作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
本项目有多种角色,包含管理员、用户、护士、服务前台等角色。由于篇幅限制,只截图了管理员角色的功能。
管理员角色主要功能包括:
入院,出院管理,医生管理,药品管理,结算中心,用户管理,日志管理等的功能。
用户角色主要功能如下:
结算中心:缴费记录、费用查询;
护理中心:录入体征数据、体征数据查询、住院历史、用药历史;
护士角色主要功能如下:
入院管理:住院查询;
出院管理:出院查询;
结算中心:缴费记录、费用查询;
护理中心:录入体征数据、体征数据查询、用药历史;
统计中心:病人统计、病房统计;
药品管理:药品发放;
服务前台角色主要功能如下:
入院管理:入院登记、住院查询;
出院管理:出院登记、出院查询、转院/病房;
结算中心:费用预缴、缴费记录、费用查询;
统计中心:病人统计、病房统计;
药品管理:库存查询;
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/ 登录

- package com.qut.controller;
-
- import java.util.List;
- import javax.annotation.Resource;
- import org.apache.ibatis.annotations.Param;
- import org.apache.log4j.Logger;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- import com.qut.pojo.Bed;
- import com.qut.service.BedService;
- import com.qut.util.JsonResult;
- import com.qut.util.Log4jLogsDetial;
- import net.sf.json.JSON;
- import net.sf.json.JSONSerializer;
- import net.sf.json.JsonConfig;
-
- @Controller
- @RequestMapping("/bed")
- public class BedController {
- @Resource(name = "bedService")
- private BedService bedService;
- Logger log = Logger.getLogger(Log4jLogsDetial.class);
-
- @RequestMapping(value = "/bedQuery.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String bedQuery(@Param("wardNo") Integer wardNo) {
- Bed bed = new Bed();
- bed.setWardNo(wardNo);
- bed.setState(0);
- List
list = bedService.bedQuery(bed); - log.info("查询" + wardNo + "房间内病床");
- JsonConfig js = new JsonConfig();
- JSON json = JSONSerializer.toJSON(new JsonResult
>(list), js);
- return json.toString();
- }
- }
- package com.qut.controller;
-
- import java.util.Date;
- import java.util.List;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import org.apache.ibatis.annotations.Param;
- import org.apache.log4j.Logger;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- import com.qut.pojo.Category;
- import com.qut.service.CategoryService;
- import com.qut.util.BaseUtils;
- import com.qut.util.JsonDateValueProcessor;
- import com.qut.util.JsonResult;
- import com.qut.util.Log4jLogsDetial;
- import net.sf.json.JSON;
- import net.sf.json.JSONSerializer;
- import net.sf.json.JsonConfig;
-
- @Controller
- @RequestMapping("/category")
- public class CategoryController {
-
- @Resource(name = "categoryService")
- private CategoryService categoryService;
- Logger log = Logger.getLogger(Log4jLogsDetial.class);
-
- @RequestMapping(value = "/categoryQuery.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String categoryQuery(@Param("id") Integer id, @Param("type") Integer type, @Param("name") String name) {
- List
list = categoryService.categoryQuery(new Category()); - log.info("查询参数" + id);
- JsonConfig jc = new JsonConfig();
- jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd"));
- JSON json = JSONSerializer.toJSON(new JsonResult
>(list), jc);
- return json.toString();
- }
-
- @RequestMapping(value = "/categoryUpdate.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String categoryUpdate(HttpServletRequest request, HttpServletResponse response) {
- Integer total = BaseUtils.toInteger(request.getParameter("total"));
- for (int i = 0; i < total; i++) {
- Integer id = BaseUtils.toInteger(request.getParameter("id" + i));
- Float updatePrice = BaseUtils.toFloat(request.getParameter("updatePrice" + i));
- Category category = new Category();
- if (updatePrice != 0) {
- category.setId(id);
- category.setPrice(updatePrice);
- categoryService.categoryUpdate(category);
- log.info("更新参数" + id);
- }
- }
- JsonConfig jc = new JsonConfig();
- jc.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd"));
- JSON json = JSONSerializer.toJSON(new JsonResult
(new Category()), jc); - return json.toString();
- }
- }
- package com.qut.controller;
-
- import java.util.List;
- import java.util.Map;
-
- import javax.annotation.Resource;
- import org.apache.ibatis.annotations.Param;
- import org.apache.log4j.Logger;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- import com.qut.pojo.Common;
- import com.qut.pojo.Ward;
- import com.qut.pojo.PatientCode;
- import com.qut.pojo.DoctorCode;
- import com.qut.pojo.Doctor;
- import com.qut.pojo.Parameter;
- import com.qut.service.CommonService;
- import com.qut.service.DoctorService;
- import com.qut.service.PatientService;
- import com.qut.service.WardService;
- import com.qut.util.JsonResult;
- import com.qut.util.Log4jLogsDetial;
- import net.sf.json.JSON;
- import net.sf.json.JSONSerializer;
-
- @Controller
- @RequestMapping("/common")
- public class CommonController {
- @Resource(name = "commonService")
- private CommonService commonService;
- @Resource(name = "doctorService")
- private DoctorService doctorService;
- @Resource(name = "patientService")
- private PatientService patientService;
- @Resource(name = "wardService")
- private WardService wardService;
- Logger log = Logger.getLogger(Log4jLogsDetial.class);
-
- @RequestMapping(value = "/list.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String titleQuery(@Param("name") String name) {
- List
list = commonService.titleQuery(name); - log.info("职称查询");
- JSON json = JSONSerializer.toJSON(new JsonResult
>(list));
- return json.toString();
- }
-
- @RequestMapping(value = "/parameterQuery.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String parameterQuery() {
- List
list = commonService.parameterQuery(); - log.info("一级参数查询");
- JSON json = JSONSerializer.toJSON(new JsonResult
>(list));
- return json.toString();
- }
-
- @RequestMapping(value = "/parameterCodeQuery.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String parameterCodeQuery(@Param("code") String code) {
- List
list = commonService.parameterCodeQuery(code); - log.info("二级参数查询");
- JSON json = JSONSerializer.toJSON(new JsonResult
>(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
(4, "添加病房到病房管理-新置病房处添加", null)); - } else if (codees.equals("005")) {// 角色系统未开发
- json = JSONSerializer.toJSON(new JsonResult
(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);
- log.info("增加参数" + parameter.getName());
- }
- if (parameter.getId() != null) {
- commonService.parameterCodeUpdate(parameter);
- log.info("更新参数" + parameter.getName());
- }
- json = JSONSerializer.toJSON(new JsonResult
(0, "添加成功", null)); - } else {
- json = JSONSerializer.toJSON(new JsonResult
(6, "请求码异常", null)); - }
- }
- return json.toString();
- }
-
- /*
- * 删除科室/医生头衔, 满足以下两点: ①删除头衔以前,确保头衔里面没有医生 ②删除科室以前,确保科室里面没有医生 ③删除科室以前,确保科室里面没有患者
- * ④删除科室以前,确保科室里面没有病房 ⑤删除病房类型前,确保病房类型里面没有病房 ⑥删除病房前,确保病房里面没有患者
- */
- @RequestMapping(value = "/parameterCodeDelete.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String parameterCodeDelete(@Param("id") Integer id, @Param("value") Integer value,
- @Param("code") String code) {
- /**
- * 如果传入的code码是001,表明是要修改/删除科室,此时要保证②③④成立才能执行
- * 如果传入的code码是002,表明要修改/删除头衔,此时要保证①成立才能执行
- * 如果传入的code码是003,表明要修改/删除病房类型,此时要保证⑤成立才能执行
- * 如果传入的code码是004,表明要修改/删除病房,此时要保证⑥成立才能执行 如果传入其他code码,请求异常
- */
- JSON json = null;
- if (code.equals("001")) {
- // 查询科室下的医生
- DoctorCode doctorcode = new DoctorCode();
- doctorcode.setDepartment(value);
- doctorcode.setState(0);// 在职的医生
- List
list1 = doctorService.doctorQuery(doctorcode); - log.info("查询医生");
- // 查询科室下的患者
- PatientCode patientcode = new PatientCode();
- patientcode.setDepartmentNo(value);
- patientcode.setOutStatus(0);// 未出院患者
- List
- log.info("查询科室" + patientcode.getDepartmentNo() + "患者");
- // 查询科室下的病房
- Ward ward = new Ward();
- ward.setDepartmentNo(value);
- List
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
(0, "删除成功", null)); - } else {
- // System.out.println("进入删除科室异常区");
- log.info("删除科室失败");
- json = JSONSerializer.toJSON(new JsonResult
(1, "当前科室正在使用", null)); - }
- } else if (code.equals("002")) {
- // 查询头衔里面有没有医生,结果返回到list1
- DoctorCode doctorcode = new DoctorCode();
- doctorcode.setTitle(value);
- doctorcode.setState(0);// 在职的医生
- List
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
(0, "删除成功", null)); - } else {
- // System.out.println("进入删除职称异常区");
- log.info("删除职称异常");
- json = JSONSerializer.toJSON(new JsonResult
(2, "当前职称正在使用", null)); - }
- } else if (code.equals("003")) {
- Ward ward = new Ward();
- ward.setType(value);
- List
list1 = wardService.wardQuery(ward);// 查询该类型下的病房 - // System.out.println("根据病房类型的查询结果:"+ward);
- if (list1.size() == 0) {
- // System.out.println("进入删除病房类型区");
- // 删除参数表,数据库内的触发器会同步删除category表中的相关行
- commonService.parameterCodeDelete(id);
- log.info("删除病房类型成功");
- json = JSONSerializer.toJSON(new JsonResult
(0, "删除成功", null)); - } else {
- // System.out.println("进入删除病房类型异常区");
- log.info("删除病房类型异常");
- json = JSONSerializer.toJSON(new JsonResult
(3, "当前病房类型正在使用", null)); - }
- } else if (code.equals("004")) {
- PatientCode patientCode = new PatientCode();
- patientCode.setWardNo(value);
- patientCode.setOutStatus(0);// 未出院
- List
- if (list1.size() == 0) {
- // 删除参数
- commonService.parameterCodeDelete(id);
- // 删除病房
- wardService.wardDelete(value);
- log.info("删除病房成功");
- json = JSONSerializer.toJSON(new JsonResult
(0, "删除成功", null)); - } else {
- // System.out.println("进入删除病房异常区");
- log.info("删除病房异常");
- json = JSONSerializer.toJSON(new JsonResult
(4, "当前病房正在使用", null)); - }
- } else if (code.equals("005")) {
- json = JSONSerializer.toJSON(new JsonResult
(5, "角色系统未开发", null)); - // TODO 角色系统
-
- } else {
- // System.out.println("异常的请求code:"+code);
- json = JSONSerializer.toJSON(new JsonResult
(6, "请求码异常", null)); - }
- return json.toString();
- }
-
- /**
- * 病房类型
- *
- * @return
- */
- @RequestMapping(value = "/typeList.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String wardTypeQuery() {
- List
list = commonService.wardTypeQuery(); - log.info("查询病房类型列表");
- JSON json = JSONSerializer.toJSON(new JsonResult
>(list));
- return json.toString();
- }
-
- /**
- * 民族查询
- *
- * @return
- */
- @RequestMapping(value = "/nationList.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String nationQuery() {
- List
list = commonService.nationQuery(); - log.info("查询民族列表");
- JSON json = JSONSerializer.toJSON(new JsonResult
>(list));
- return json.toString();
- }
- }
- package com.qut.controller;
-
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
-
- import javax.annotation.Resource;
-
- import org.apache.ibatis.annotations.Param;
- import org.apache.log4j.Logger;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- import com.qut.pojo.Doctor;
- import com.qut.pojo.DoctorCode;
- import com.qut.pojo.PatientCode;
- import com.qut.service.DoctorService;
- import com.qut.service.PatientService;
- import com.qut.util.JsonDateValueProcessor;
- import com.qut.util.JsonResult;
- import com.qut.util.Log4jLogsDetial;
- import net.sf.json.JSON;
- import net.sf.json.JSONSerializer;
- import net.sf.json.JsonConfig;
-
- @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);
- }
- doctor.setName(name);
- doctor.setGender(gender);
- doctor.setTitle(title);
- doctor.setDepartment(department);
- doctorService.doctorSave(doctor);
- log.info("新增医生" + doctor.getName());
- json = JSONSerializer.toJSON(new JsonResult
(doctor)); - return json.toString();
- }
-
- @RequestMapping(value = "/doctorQuery.do", produces = "application/json;charset=utf-8")
- @ResponseBody
- public String doctorQuery(@Param("name") String name, @Param("startTime") String startTime,
- @Param("endTime") String endTime, @Param("title") Integer title, @Param("department") Integer department,
- @Param("state") Integer state) throws ParseException {
- DoctorCode doctorCode = new DoctorCode();
- doctorCode.setTitle(title);
- doctorCode.setName(name);
- doctorCode.setDepartment(department);
- /**
- * 入院登记的医生查询下拉框和医生查询功能模块的医生查询复用的是这一个接口 但是入院登记的下拉框不会传入state参数,而且此处只希望查到在职医生
- * 所以当没有传入state参数时,将医生状态设置为在职
- */
- if (state != null) {
- // System.out.println("进入非空区");
- if (state == -1) {
- // System.out.println("进入-1区");
- doctorCode.setState(null);
- log.info("设置医生状态为缺省");
- }
- if (state == 0) {
- // System.out.println("进入0区");
- doctorCode.setState(0);
- log.info("设置医生状态为在职");
- }
- if (state == 1) {
- // System.out.println("进入1区");
- doctorCode.setState(1);
- log.info("设置医生状态为离职");
- }
- }
- if (state == null) {
- doctorCode.setState(0);
- // System.out.println("进入null区");
- }
- // System.out.println("医生状态最终设置为" + doctorCode.getState());
- if (!(startTime == null || "".equals(startTime))) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Date start = (Date) sdf.parse(startTime);
- doctorCode.setStartTime(start);
- }
- if (!(endTime == null || "".equals(endTime))) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Date end = (Date) sdf.parse(endTime);
- doctorCode.setEndTime(end);
- }
- List
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), 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
(3, "该医生不存在", null)); - } else {
- /**
- * 检查该医生名下是否有未出院的患者
- */
- PatientCode patientCode = new PatientCode();
- patientCode.setDocid(id);
- patientCode.setOutStatus(0);
- List
- // 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
(new Doctor())); - } else if (list.size() != 0) {// 有患者
- json = JSONSerializer.toJSON(new JsonResult
(2, null, new Doctor())); - } else {// 已离职
- json = JSONSerializer.toJSON(new JsonResult
(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);
- log.info("更新医生" + doctor.getName() + "信息");
- json = JSONSerializer.toJSON(new JsonResult
(doctor)); - return json.toString();
- }
- }
如果也想学习本系统,下面领取。关注并回复:126ssm