基于javaweb+mysql的ssm医院住院管理系统(java+ssm+jsp+bootstrap+mysql)

基于javaweb+mysql的ssm医院住院管理系统(java+ssm+jsp+bootstrap+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM医院住院管理系统(java+ssm+jsp+bootstrap+mysql)

项目介绍

本项目有多种角色,包含管理员、用户、护士、服务前台等角色。由于篇幅限制,只截图了管理员角色的功能。

管理员角色主要功能包括:

入院,出院管理,医生管理,药品管理,结算中心,用户管理,日志管理等的功能。

用户角色主要功能如下:

结算中心:缴费记录、费用查询; 护理中心:录入体征数据、体征数据查询、住院历史、用药历史;

护士角色主要功能如下: 入院管理:住院查询; 出院管理:出院查询; 结算中心:缴费记录、费用查询; 护理中心:录入体征数据、体征数据查询、用药历史; 统计中心:病人统计、病房统计; 药品管理:药品发放;

服务前台角色主要功能如下: 入院管理:入院登记、住院查询; 出院管理:出院登记、出院查询、转院/病房; 结算中心:费用预缴、缴费记录、费用查询; 统计中心:病人统计、病房统计; 药品管理:库存查询;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:否;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jquery+bootstrap

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
		sign.setBreathing(BaseUtils.toInteger(breathing));// 呼吸
		sign.setBloodSugar(BaseUtils.toFloat(bloodSugar));// 血糖
		sign.setBloodPressure(BaseUtils.toString(bloodPressure));// 血压
		sign.setVein(BaseUtils.toFloat(vein));// 静脉
		sign.setRemarks(BaseUtils.toString(remarks));// 备注
		sign.setUserId(BaseUtils.getUser(request).getId());// 护理医师ID
		sign.setUserName(BaseUtils.getUser(request).getName());// 护理医师姓名
		signService.signSave(sign);
		log.info("保存患者" + patientId + "体征护理数据");
		JSON json = JSONSerializer.toJSON(new JsonResult<Sign>(sign));
		return json.toString();
	}

	@RequestMapping(value = "/signQuery.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String signQuery(@Param(value = "patientId") String patientId, @Param("name") String patientName,
			@Param("wardNo") Integer wardNo, @Param("bedNo") Integer bedNo, @Param("start") String start,
			@Param("end") String end) throws ParseException {
		PatientCode patientCode = new PatientCode();
		if (patientId == null || "".equals(patientId)) {
			patientId = null;
		}
		if (patientName == null || "".equals(patientName)) {
			patientName = null;
		}
		// System.out.println("收到的patientName传参:"+patientName);
		patientCode.setPatientId(patientId);
		patientCode.setName(patientName);
		patientCode.setWardNo(wardNo);
		patientCode.setBedNo(bedNo);
		patientCode.setStart(BaseUtils.toDate(start));
		patientCode.setEnd(BaseUtils.toDate(end));
		List<Map<String, Object>> list = signService.signQuery(patientCode);
		log.info("查询患者" + patientName + patientId + "体征护理数据");
		for (Map<String, Object> map : list) {
			String str = map.get("measureTime").toString();
			map.put("measureTime", str);
		}
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Map<String, Object>>>(list));
		return json.toString();
	}
}

		}
		List<Log> loglist = logService.LogsQuery(log);
		logg.info("查询" + log.getType() + "类型日志");
		JsonConfig jc = new JsonConfig();
		jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd HH-mm-ss"));
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Log>>(loglist), jc);
		return json.toString();
	}

	@RequestMapping(value = "/LogQueryById.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String LogQueryById(@Param("id") Integer id) throws ParseException {
		Log log = new Log();
		log.setId(id);
		List<Log> loglist = logService.LogQueryById(log);
		logg.info("查询ID为" + log.getId() + "的日志");
		JsonConfig jc = new JsonConfig();
		jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd HH-mm-ss"));
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Log>>(loglist), jc);
		return json.toString();
	}
}

@Controller
@RequestMapping("/category")
public class CategoryController {

	@Resource(name = "categoryService")

public class BaseUtils {
	/**
	 * 将字符串转换为date类型
	 */
	public static Date toDate(String time) throws ParseException {
		if (!(time == null || "".equals(time))) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			java.util.Date worktime = (java.util.Date) sdf.parse(time);
			java.util.Date utilDate = worktime;
			Date sqlDate = new Date(utilDate.getTime());
			return sqlDate;
		}
		return null;
	}

	/**
	 * 字符串转换为date类型YYYY-MM-dd HH:mm:ss
	 */
	public static Timestamp toDates(String time) throws ParseException {
		java.util.Date worktime = null;
		if (!(time == null || "".equals(time))) {
			DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
			sdf.setLenient(false);
			worktime = sdf.parse(time);
			return new Timestamp(worktime.getTime());
		}
		return null;
	}

	/**
	 * 将字符串转换为Integer,为空时返回null
	 */
	public static Integer toInteger(String string) {
		if (!(string == null || "".equals(string))) {
			Integer str = Integer.parseInt(string);
			return str;
		}
		return null;
	}

			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Date end = (Date) sdf.parse(endTime);
			log.setEndTime(end);
		}
		List<Log> loglist = logService.LogsQuery(log);
		logg.info("查询" + log.getType() + "类型日志");
		JsonConfig jc = new JsonConfig();
		jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd HH-mm-ss"));
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Log>>(loglist), jc);
		return json.toString();
	}

	@RequestMapping(value = "/LogQueryById.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String LogQueryById(@Param("id") Integer id) throws ParseException {
		Log log = new Log();
		log.setId(id);
		List<Log> loglist = logService.LogQueryById(log);
		logg.info("查询ID为" + log.getId() + "的日志");
		JsonConfig jc = new JsonConfig();
		jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd HH-mm-ss"));
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Log>>(loglist), jc);
		return json.toString();
	}
}

	 * 病房类型
	 * 
	 * @return
	 */
	@RequestMapping(value = "/typeList.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String wardTypeQuery() {
		List<Parameter> list = commonService.wardTypeQuery();
		log.info("查询病房类型列表");
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Parameter>>(list));
		return json.toString();
	}

	/**
	 * 民族查询
	 * 
	 * @return
	 */
	@RequestMapping(value = "/nationList.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String nationQuery() {
		List<Parameter> list = commonService.nationQuery();
		log.info("查询民族列表");
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Parameter>>(list));
		return json.toString();
	}
}


@Controller
@RequestMapping("/log")
public class LogController {
	@Resource(name = "LogService")
	private LogService logService;
	Logger logg = Logger.getLogger(Log4jLogsDetial.class);

	@RequestMapping(value = "/LogsQuery.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String LogsQuery(@Param("type") String type, @Param("startTime") String startTime,
			@Param("endTime") String endTime) throws ParseException {
		Log log = new Log();

		if ("".equals(type)) {
			type = null;
			log.setType(type);
		} else {
			Integer type_T = BaseUtils.toInteger(type);
			String type_s = new String();
			if (type_T == 1) {
				type_s = "ERROR";
				log.setType(type_s);
				logg.info("设置日志类型为ERROR");
			}
			if (type_T == 2) {
				type_s = "WARN";
				log.setType(type_s);
				logg.info("设置日志类型为WARN");
			}
			if (type_T == 3) {
				type_s = "INFO";
				log.setType(type_s);
				logg.info("设置日志类型为INFO");
			}
			if (type_T == 4) {
				type_s = "DEBUG";
			doctorcode.setState(0);// 在职的医生
			List<Doctor> list1 = doctorService.doctorQuery(doctorcode);
			log.info("查询医生");
			// 查询科室下的患者
			PatientCode patientcode = new PatientCode();
			patientcode.setDepartmentNo(value);
			patientcode.setOutStatus(0);// 未出院患者
			List<Map<String, Object>> list2 = patientService.patientQuery(patientcode);
			log.info("查询科室" + patientcode.getDepartmentNo() + "患者");
			// 查询科室下的病房
			Ward ward = new Ward();
			ward.setDepartmentNo(value);
			List<Ward> list3 = wardService.wardQuery(ward);
			log.info("查询科室:" + ward.getDepartmentNo() + "病房");
			// System.out.println(list1);
			// System.out.println(list2);
			// System.out.println(list3);

			if (list1.size() == 0 && list2.size() == 0 && list3.size() == 0) {
				// System.out.println("进入删除科室区");
				commonService.parameterCodeDelete(id);// 删除参数
				log.info("删除科室成功");
				json = JSONSerializer.toJSON(new JsonResult<Parameter>(0, "删除成功", null));
			} else {
				// System.out.println("进入删除科室异常区");
				log.info("删除科室失败");
				json = JSONSerializer.toJSON(new JsonResult<Parameter>(1, "当前科室正在使用", null));
			}
		} else if (code.equals("002")) {
			// 查询头衔里面有没有医生,结果返回到list1
			DoctorCode doctorcode = new DoctorCode();
			doctorcode.setTitle(value);
			doctorcode.setState(0);// 在职的医生
			List<Doctor> list1 = doctorService.doctorQuery(doctorcode);
			// System.out.println(list1);

			if (list1.size() == 0) {
				// System.out.println("进入删除职称区");
				commonService.parameterCodeDelete(id);// 删除参数
				log.info("删除职称成功");
				json = JSONSerializer.toJSON(new JsonResult<Parameter>(0, "删除成功", null));
			} else {
				// System.out.println("进入删除职称异常区");
				log.info("删除职称异常");
				json = JSONSerializer.toJSON(new JsonResult<Parameter>(2, "当前职称正在使用", null));
			}
		} else if (code.equals("003")) {
			Ward ward = new Ward();
			ward.setType(value);
			List<Ward> list1 = wardService.wardQuery(ward);// 查询该类型下的病房
			// System.out.println("根据病房类型的查询结果:"+ward);
		json = JSONSerializer.toJSON(new JsonResult<User>(user));
		return json.toString();
	}

	@RequestMapping(value = "/updateUser.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String updateUser(@Param("id") String id, @Param("password") String password) {
		User user = new User();
		user.setId(id);
		password = password.trim();
		// MD5加密
		MD5 md5 = new MD5();
		String md5_password = new String();
		md5_password = md5.to_md5(password);
		user.setPassword(md5_password);
		userService.updateUser(user);
		log.info("用户" + id + "修改密码成功");
		JSON json = JSONSerializer.toJSON(new JsonResult<User>(user));
		return json.toString();
	}

	@RequestMapping(value = "/updateUserMessage.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String updateUserMessage(@Param("id") String id, @Param("name") String name, @Param("phone") String phone,
			@Param("state") Integer state) {
		User user = new User();
		user.setId(BaseUtils.toString(id));
		user.setPhone(BaseUtils.toString(phone));
		user.setName(BaseUtils.toString(name));
		user.setDescribe(state);
		userService.updateUserMessage(user);
		log.info("用户" + id + "修改信息成功");
		JSON json = JSONSerializer.toJSON(new JsonResult<User>(user));
		return json.toString();
	}

	@RequestMapping(value = "/clearCookie.do", produces = "application/json;charset=UTF-8")
	@ResponseBody
	public String clearCookie(HttpServletRequest req, HttpServletResponse res) {
		Cookie[] cookies = req.getCookies();
		for (int i = 0, len = cookies.length; i < len; i++) {
			Cookie cookie = new Cookie(cookies[i].getName(), null);
			cookie.setMaxAge(0);
			cookie.setPath("/");
			res.addCookie(cookie);
		}
		log.info("清除cookie");
	@ResponseBody
	public String parameterQuery() {
		List<Parameter> list = commonService.parameterQuery();
		log.info("一级参数查询");
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Parameter>>(list));
		return json.toString();
	}

	@RequestMapping(value = "/parameterCodeQuery.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String parameterCodeQuery(@Param("code") String code) {
		List<Parameter> list = commonService.parameterCodeQuery(code);
		log.info("二级参数查询");
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Parameter>>(list));
		return json.toString();

	}

	@RequestMapping(value = "/parameterCodeSave.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String parameterCodeSave(@Param("code") String code, @Param("list") String list) {
		/*
		 * 传入的数据格式:list: 1:1:内科:001,2:2:儿科:001,3:3:妇科:001, 先用逗号分隔,区分出每个科室
		 * 再用:分割,区分出传参序号、科室编号、科室名称、参数序号
		 */
		JSON json = null;
		String[] parameterCodes = list.split(",");
		for (int i = 0; i < parameterCodes.length; i++) {
			Integer id = null;
			String[] codes = parameterCodes[i].split(":");
			if (Integer.parseInt(codes[0]) == -1) {
				codes[0] = null;
				id = null;
			} else {
				id = Integer.parseInt(codes[0]);
			}
			String codees = codes[3];
			String name = codes[2];
			Integer value = Integer.parseInt(codes[1]);
			if (codees.equals("004")) {// 添加病房到病房管理--新置病房处添加
				json = JSONSerializer.toJSON(new JsonResult<Parameter>(4, "添加病房到病房管理-新置病房处添加", null));
			} else if (codees.equals("005")) {// 角色系统未开发
				json = JSONSerializer.toJSON(new JsonResult<Parameter>(5, "角色系统未开发", null));
			} else if (codees.equals("001") || codees.equals("002") || codees.equals("003")) {
				Parameter parameter = new Parameter();
				parameter.setId(id);
				parameter.setCode(codees);
				parameter.setName(name);
				parameter.setValue(value);
				if (parameter.getId() == null) {
					commonService.parameterCodeInsert(parameter);
		} else {
			ward.setDepartmentNo(BaseUtils.toInteger(departmentNo));
			ward.setType(BaseUtils.toInteger(typeNo));
			ward.setState(0);
			list = wardService.wardQuery(ward);
		}
		JsonConfig js = new JsonConfig();
		JSON json = JSONSerializer.toJSON(new JsonResult<List<Ward>>(list), js);
		return json.toString();
	}

	@RequestMapping(value = "/wardSave.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String wardSave(@Param("createTime") String createTime, @Param("departmentNo") String departmentNo,
			@Param("typeNo") String typeNo, @Param("wardNo") String wardNo, @Param("wardSpace") String wardSpace)
			throws ParseException {
		Ward ward = new Ward();
		ward.setCreateTime(BaseUtils.toDate(createTime));
		ward.setDepartmentNo(BaseUtils.toInteger(departmentNo));
		ward.setType(BaseUtils.toInteger(typeNo));
		ward.setWardNo(BaseUtils.toInteger(wardNo));
		ward.setwardSpace(BaseUtils.toInteger(wardSpace));
		ward.setState(0);
		// 为病房表增加数据
		wardService.wardSave(ward);
		log.info("新增病房");
		// 根据容量生成床位号,每个房间的床位号是(房间号*100)+ 床号,床号是1,2,3……自然序列。
		// 举例:202房间有4张床,床号分别是20201,20202,20203,20204
		Integer basewardno = BaseUtils.toInteger(wardNo);// 最初前端传入的房间号
		Integer wardno = basewardno * 100;// 扩大100倍后的房间号
		Integer wardspace = BaseUtils.toInteger(wardSpace);
		for (int i = 1; i <= wardspace; i++) {
			Bed bed = new Bed();
			bed.setBedNo((wardno + i));
			bed.setWardNo(basewardno);
			bed.setState(0);
			wardService.bedSave(bed);
			log.info("生成床位" + bed.getBedNo());
		}

		// 病房信息写入参数化表paracode
		/**
		 * paracode写入的病房信息是:code,parameter_value,parameter_value 其中,code是004,代表是病房信息
		 * parameter_value是病房房间号 parameter_value是病房类型名称

}

@Controller
@RequestMapping("/doctor")
public class DoctorController {
	@Resource(name = "doctorService")
	private DoctorService doctorService;
	@Resource(name = "patientService")
	private PatientService patientService;
	private JSON json;
	Logger log = Logger.getLogger(Log4jLogsDetial.class);

	@RequestMapping(value = "/save.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String doctorSave(@Param("name") String name, @Param("title") Integer title,
			@Param("department") Integer department, @Param("gender") Integer gender, @Param("time") String time)
			throws ParseException {
		Doctor doctor = new Doctor();
		if (!(time == null || "".equals(time))) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Date worktime = (Date) sdf.parse(time);
			doctor.setWorkTime(worktime);
		}
			Date end = (Date) sdf.parse(endTime);
			doctorCode.setEndTime(end);
		}
		List<Doctor> list = doctorService.doctorQuery(doctorCode);
		log.info("查询在职医生");
		JsonConfig jc = new JsonConfig();
		jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd"));
		json = JSONSerializer.toJSON(new JsonResult<List<Doctor>>(list), jc);
		return json.toString();

	}

	@RequestMapping(value = "/doctorDelete.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String doctorDelete(@Param("id") Integer id) {
		if (id == 0) {
			json = JSONSerializer.toJSON(new JsonResult<Doctor>(3, "该医生不存在", null));
		} else {
			/**
			 * 检查该医生名下是否有未出院的患者
			 */
			PatientCode patientCode = new PatientCode();
			patientCode.setDocid(id);
			patientCode.setOutStatus(0);
			List<Map<String, Object>> list = patientService.patientQuery(patientCode);
			// System.out.println("当前医生名下未出院患者:" + list);
			Doctor doctor = doctorService.doctorById(id);
			log.info("查询医生" + doctor.getId());
			if (doctor.getState() == 0 && list.size() == 0) {// 未离职且无患者
				doctorService.doctorDelete(id);
				log.info("医生" + doctor.getName() + "离职");
				json = JSONSerializer.toJSON(new JsonResult<Doctor>(new Doctor()));
			} else if (list.size() != 0) {// 有患者
				json = JSONSerializer.toJSON(new JsonResult<Doctor>(2, null, new Doctor()));
			} else {// 已离职
				json = JSONSerializer.toJSON(new JsonResult<Doctor>(1, null, new Doctor()));
			}
		}
		return json.toString();
	}

	@RequestMapping(value = "/updateDoctorMessage.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String updateDoctorMessage(@Param("id") Integer id, @Param("name") String name,
			@Param("keshi") Integer keshi, @Param("zhicheng") Integer zhicheng, @Param("gender") Integer gender) {
		Doctor doctor = new Doctor();
		doctor.setId(id);
		doctor.setName(name);
		doctor.setDepartment(keshi);
		doctor.setTitle(zhicheng);
		doctor.setGender(gender);
		doctorService.updateDoctorMessage(doctor);
			return new Timestamp(worktime.getTime());
		}
		return null;
	}

	/**
	 * 将字符串转换为Integer,为空时返回null
	 */
	public static Integer toInteger(String string) {
		if (!(string == null || "".equals(string))) {
			Integer str = Integer.parseInt(string);
			return str;
		}
		return null;
	}

	/**
	 * 将字符串转换为Integer,为空时返回0
	 */
	public static Integer toIntegers(String string) {
		if (!(string == null || "".equals(string))) {
			Integer str = Integer.parseInt(string);
			return str;
		}
		return 0;
	}

	/**
	 * 字符串转浮点型
	 */
	public static Float toFloat(String string) {
		if (!(string == null || "".equals(string))) {
			Float str = Float.parseFloat(string);
			return str;
		}
		return 0.00f;
	}

	/**
	 * 为一个date增加天数后的日期
	 */
	@SuppressWarnings("static-access")
	public static Date toAddDate(Date date, Integer days) {
		Calendar calendar = new GregorianCalendar();
		calendar.setTime(date);
		calendar.add(calendar.DATE, +days);
		// calendar的time转成java.util.Date格式日期
		java.util.Date utilDate = (java.util.Date) calendar.getTime();
		utilDate = (java.util.Date) calendar.getTime();
		// java.util.Date日期转换成转成java.sql.Date格式
		Date newDate = new Date(utilDate.getTime());
		return newDate;
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Date end = (Date) sdf.parse(endTime);
			userCode.setEndTime(end);
		}
		List<User> list = userService.userQuery(userCode);
		log.info("执行用户查询");
		JsonConfig jc = new JsonConfig();
		jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd"));
		JSON json = JSONSerializer.toJSON(new JsonResult<List<User>>(list), jc);
		return json.toString();
	}

	@RequestMapping(value = "/userDelete.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String userDelete(@Param("id") String id) {
		JSON json;
		if (id == null || "".equals(id)) {
			json = JSONSerializer.toJSON(new JsonResult<User>(3, "该用户不存在", null));
		}
		userService.userDelete(id);
		log.info("执行用户删除");
		json = JSONSerializer.toJSON(new JsonResult<User>(new User()));
		return json.toString();
	}

	@RequestMapping(value = "/getUser.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String getUser(HttpServletRequest request) throws UnsupportedEncodingException {
		User user = BaseUtils.getUser(request);
		log.info("访问当前会话cookie信息");
		json = JSONSerializer.toJSON(new JsonResult<User>(user));
		return json.toString();
	}

	@RequestMapping(value = "/updateUser.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String updateUser(@Param("id") String id, @Param("password") String password) {
		User user = new User();
		user.setId(id);
		password = password.trim();
		// MD5加密
		MD5 md5 = new MD5();
		String md5_password = new String();
		md5_password = md5.to_md5(password);
		user.setPassword(md5_password);
		userService.updateUser(user);
		log.info("用户" + id + "修改密码成功");
		JSON json = JSONSerializer.toJSON(new JsonResult<User>(user));
		return json.toString();
	}
	private void checkDotDo(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		User user = BaseUtils.getUser(request);
		if (user != null) {
			chain.doFilter(request, response);
			return;
		}
		String json = "{\"state\":1,\"message\":\"必须登录!\"}";
		response.setCharacterEncoding("utf-8");
		response.setContentType("application/json;charset=UTF-8");
		response.getWriter().println(json);
	}

	private void checkLogin(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		// 如果没有, 就重定向到login.jsp
		User user = BaseUtils.getUser(request);
		if (user != null) {
			if (!("".equals(user.getId())) && (user.getId() != null)) {
				chain.doFilter(request, response);
				return;
			}
		}
		// 重定向到 login.jsp
		String path = request.getContextPath() + "/login.jsp";
		response.sendRedirect(path);
	}

}

@Controller
public class TestYzmController {
	Logger log = Logger.getLogger(Log4jLogsDetial.class);

		Cookie cookie[] = request.getCookies();
		if (cookie != null) {
			for (Cookie cookie2 : cookie) {
				if (cookie2.getName().equals("user")) {
					String value = cookie2.getValue();
					value = URLDecoder.decode(value, "utf-8");
					String[] userInfo = value.split("#");
					user.setId(userInfo[0]);
					user.setName(userInfo[1]);
				}
			}
		}
		return user;
	}

}

@Controller
@RequestMapping("/log")
public class LogController {
	@Resource(name = "LogService")
	private LogService logService;
	Logger logg = Logger.getLogger(Log4jLogsDetial.class);

	@RequestMapping(value = "/LogsQuery.do", produces = "application/json;charset=utf-8")
		Sign sign = new Sign();
		sign.setPatientId(BaseUtils.toString(patientId));// 患者ID
		sign.setMeasureTime(BaseUtils.toDates(measureTime));// 护理时间
		sign.setTemperature(BaseUtils.toFloat(temperature));// 体温
		sign.setPulse(BaseUtils.toInteger(pulse));// 心率
		sign.setBreathing(BaseUtils.toInteger(breathing));// 呼吸
		sign.setBloodSugar(BaseUtils.toFloat(bloodSugar));// 血糖
		sign.setBloodPressure(BaseUtils.toString(bloodPressure));// 血压
		sign.setVein(BaseUtils.toFloat(vein));// 静脉
		sign.setRemarks(BaseUtils.toString(remarks));// 备注
		sign.setUserId(BaseUtils.getUser(request).getId());// 护理医师ID
		sign.setUserName(BaseUtils.getUser(request).getName());// 护理医师姓名
		signService.signSave(sign);
		log.info("保存患者" + patientId + "体征护理数据");
		JSON json = JSONSerializer.toJSON(new JsonResult<Sign>(sign));
		return json.toString();
	}

	@RequestMapping(value = "/signQuery.do", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String signQuery(@Param(value = "patientId") String patientId, @Param("name") String patientName,
			@Param("wardNo") Integer wardNo, @Param("bedNo") Integer bedNo, @Param("start") String start,
			@Param("end") String end) throws ParseException {
		PatientCode patientCode = new PatientCode();
		if (patientId == null || "".equals(patientId)) {
			patientId = null;
		}
		if (patientName == null || "".equals(patientName)) {
			patientName = null;
		}
		// System.out.println("收到的patientName传参:"+patientName);
		patientCode.setPatientId(patientId);
		patientCode.setName(patientName);
		patientCode.setWardNo(wardNo);
		patientCode.setBedNo(bedNo);
		patientCode.setStart(BaseUtils.toDate(start));
		patientCode.setEnd(BaseUtils.toDate(end));
		List<Map<String, Object>> list = signService.signQuery(patientCode);
		log.info("查询患者" + patientName + patientId + "体征护理数据");
		for (Map<String, Object> map : list) {
			String str = map.get("measureTime").toString();
			map.put("measureTime", str);
		}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值