• Java项目:SSM医院分诊管理系统


    作者主页:夜未央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/8.0版本均可;
    6.是否Maven项目:否;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis

    2. 前端:JSP+CSS+JavaScript+jQuery+easyUI

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,修改相关配置,然后运行;
    3. 将项目中application.properties配置文件中的数据库配置改为自己的配置;
    4. 运行项目,输入localhost:8080/triage 登录
    管理员账号/密码:admin/123456

    运行截图

     

     

     

     

     

     

    相关代码

    部门控制器

    1. package com.bjpowernode.triage.buss.controller;
    2. import java.util.List;
    3. import java.util.Map;
    4. import javax.servlet.http.HttpServletRequest;
    5. import javax.validation.Valid;
    6. import org.apache.shiro.authz.annotation.RequiresPermissions;
    7. import org.springframework.beans.factory.annotation.Autowired;
    8. import org.springframework.stereotype.Controller;
    9. import org.springframework.ui.Model;
    10. import org.springframework.web.bind.annotation.ModelAttribute;
    11. import org.springframework.web.bind.annotation.PathVariable;
    12. import org.springframework.web.bind.annotation.RequestBody;
    13. import org.springframework.web.bind.annotation.RequestMapping;
    14. import org.springframework.web.bind.annotation.RequestMethod;
    15. import org.springframework.web.bind.annotation.ResponseBody;
    16. import com.bjpowernode.triage.buss.entity.Dept;
    17. import com.bjpowernode.triage.buss.service.DeptService;
    18. import com.bjpowernode.triage.common.controller.BaseController;
    19. import com.bjpowernode.triage.common.persistence.Page;
    20. import com.bjpowernode.triage.common.persistence.PropertyFilter;
    21. import com.bjpowernode.triage.system.entity.Permission;
    22. /**
    23. * 用户controller
    24. * @author bjpowernode
    25. * @date 2016年1月13日
    26. */
    27. @Controller
    28. @RequestMapping("buss/dept")
    29. public class DeptController extends BaseController {
    30. @Autowired
    31. private DeptService deptService;
    32. /**
    33. * 默认页面
    34. */
    35. @RequestMapping(method = RequestMethod.GET)
    36. public String list() {
    37. return "buss/deptList";
    38. }
    39. /**
    40. * 部门集合(JSON)
    41. */
    42. @RequestMapping(value="allDept/json",method = RequestMethod.GET)
    43. @ResponseBody
    44. public List allDept(){
    45. List deptList=deptService.getAll();
    46. return deptList;
    47. }
    48. /**
    49. * 获取科室json
    50. */
    51. @RequiresPermissions("buss:dept:view")
    52. @RequestMapping(value="json",method = RequestMethod.GET)
    53. @ResponseBody
    54. public Map getData(HttpServletRequest request) {
    55. Page page = getPage(request);
    56. List filters = PropertyFilter.buildFromHttpRequest(request);
    57. page = deptService.search(page, filters);
    58. return getEasyUIData(page);
    59. }
    60. /**
    61. * 添加科室跳转
    62. *
    63. * @param model
    64. */
    65. @RequiresPermissions("buss:dept:add")
    66. @RequestMapping(value = "create", method = RequestMethod.GET)
    67. public String createForm(Model model) {
    68. model.addAttribute("dept", new Dept());
    69. model.addAttribute("action", "create");
    70. return "buss/deptForm";
    71. }
    72. /**
    73. * 添加科室
    74. *
    75. * @param dept
    76. * @param model
    77. */
    78. @RequiresPermissions("buss:dept:add")
    79. @RequestMapping(value = "create", method = RequestMethod.POST)
    80. @ResponseBody
    81. public String create(@Valid Dept dept, Model model) {
    82. deptService.save(dept);
    83. return "success";
    84. }
    85. /**
    86. * 修改科室跳转
    87. *
    88. * @param id
    89. * @param model
    90. * @return
    91. */
    92. @RequiresPermissions("buss:dept:update")
    93. @RequestMapping(value = "update/{id}", method = RequestMethod.GET)
    94. public String updateForm(@PathVariable("id") Integer id, Model model) {
    95. model.addAttribute("dept", deptService.get(id));
    96. model.addAttribute("action", "update");
    97. return "buss/deptForm";
    98. }
    99. /**
    100. * 修改科室
    101. *
    102. * @param dept
    103. * @param model
    104. * @return
    105. */
    106. @RequiresPermissions("buss:dept:update")
    107. @RequestMapping(value = "update", method = RequestMethod.POST)
    108. @ResponseBody
    109. public String update(@Valid @ModelAttribute @RequestBody Dept dept,Model model) {
    110. deptService.update(dept);
    111. return "success";
    112. }
    113. /**
    114. * 删除用户
    115. *
    116. * @param id
    117. * @return
    118. */
    119. @RequiresPermissions("buss:dept:delete")
    120. @RequestMapping(value = "delete/{id}")
    121. @ResponseBody
    122. public String delete(@PathVariable("id") Integer id) {
    123. deptService.delete(id);
    124. return "success";
    125. }
    126. }

    病人控制器

    1. package com.bjpowernode.triage.buss.controller;
    2. import java.util.List;
    3. import java.util.Map;
    4. import javax.servlet.http.HttpServletRequest;
    5. import javax.validation.Valid;
    6. import org.apache.shiro.authz.annotation.RequiresPermissions;
    7. import org.springframework.beans.factory.annotation.Autowired;
    8. import org.springframework.stereotype.Controller;
    9. import org.springframework.ui.Model;
    10. import org.springframework.web.bind.annotation.ModelAttribute;
    11. import org.springframework.web.bind.annotation.PathVariable;
    12. import org.springframework.web.bind.annotation.RequestBody;
    13. import org.springframework.web.bind.annotation.RequestMapping;
    14. import org.springframework.web.bind.annotation.RequestMethod;
    15. import org.springframework.web.bind.annotation.ResponseBody;
    16. import com.bjpowernode.triage.buss.entity.Patient;
    17. import com.bjpowernode.triage.buss.service.PatientService;
    18. import com.bjpowernode.triage.common.controller.BaseController;
    19. import com.bjpowernode.triage.common.persistence.Page;
    20. import com.bjpowernode.triage.common.persistence.PropertyFilter;
    21. /**
    22. * 用户controller
    23. * @author bjpowernode
    24. * @date 2016年1月13日
    25. */
    26. @Controller
    27. @RequestMapping("buss/patient")
    28. public class PatientController extends BaseController {
    29. @Autowired
    30. private PatientService patientService;
    31. /**
    32. * 默认页面
    33. */
    34. @RequestMapping(method = RequestMethod.GET)
    35. public String list() {
    36. return "buss/patientList";
    37. }
    38. /**
    39. * 获取json
    40. */
    41. @RequiresPermissions("buss:patient:view")
    42. @RequestMapping(value="json",method = RequestMethod.GET)
    43. @ResponseBody
    44. public Map getData(HttpServletRequest request) {
    45. Page page = getPage(request);
    46. List filters = PropertyFilter.buildFromHttpRequest(request);
    47. page = patientService.search(page, filters);
    48. return getEasyUIData(page);
    49. }
    50. /**
    51. * 添加科室跳转
    52. *
    53. * @param model
    54. */
    55. @RequiresPermissions("buss:patient:add")
    56. @RequestMapping(value = "create", method = RequestMethod.GET)
    57. public String createForm(Model model) {
    58. model.addAttribute("patient", new Patient());
    59. model.addAttribute("action", "create");
    60. return "buss/patientForm";
    61. }
    62. /**
    63. * 添加科室
    64. *
    65. * @param patient
    66. * @param model
    67. */
    68. @RequiresPermissions("buss:patient:add")
    69. @RequestMapping(value = "create", method = RequestMethod.POST)
    70. @ResponseBody
    71. public String create(@Valid Patient patient, Model model) {
    72. patientService.save(patient);
    73. return "success";
    74. }
    75. /**
    76. * 修改科室跳转
    77. *
    78. * @param id
    79. * @param model
    80. * @return
    81. */
    82. @RequiresPermissions("buss:patient:update")
    83. @RequestMapping(value = "update/{id}", method = RequestMethod.GET)
    84. public String updateForm(@PathVariable("id") Integer id, Model model) {
    85. model.addAttribute("patient", patientService.get(id));
    86. model.addAttribute("action", "update");
    87. return "buss/patientForm";
    88. }
    89. /**
    90. * 修改科室
    91. *
    92. * @param patient
    93. * @param model
    94. * @return
    95. */
    96. @RequiresPermissions("buss:patient:update")
    97. @RequestMapping(value = "update", method = RequestMethod.POST)
    98. @ResponseBody
    99. public String update(@Valid @ModelAttribute @RequestBody Patient patient,Model model) {
    100. patientService.update(patient);
    101. return "success";
    102. }
    103. /**
    104. * 删除用户
    105. *
    106. * @param id
    107. * @return
    108. */
    109. @RequiresPermissions("buss:patient:delete")
    110. @RequestMapping(value = "delete/{id}")
    111. @ResponseBody
    112. public String delete(@PathVariable("id") Integer id) {
    113. patientService.delete(id);
    114. return "success";
    115. }
    116. }

    分诊controller

    1. package com.bjpowernode.triage.buss.controller;
    2. import java.util.ArrayList;
    3. import java.util.Date;
    4. import java.util.List;
    5. import java.util.Map;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.validation.Valid;
    8. import org.apache.shiro.authz.annotation.RequiresPermissions;
    9. import org.springframework.beans.factory.annotation.Autowired;
    10. import org.springframework.stereotype.Controller;
    11. import org.springframework.ui.Model;
    12. import org.springframework.web.bind.annotation.ModelAttribute;
    13. import org.springframework.web.bind.annotation.PathVariable;
    14. import org.springframework.web.bind.annotation.RequestBody;
    15. import org.springframework.web.bind.annotation.RequestMapping;
    16. import org.springframework.web.bind.annotation.RequestMethod;
    17. import org.springframework.web.bind.annotation.ResponseBody;
    18. import com.bjpowernode.triage.buss.entity.Dept;
    19. import com.bjpowernode.triage.buss.entity.Patient;
    20. import com.bjpowernode.triage.buss.entity.Triage;
    21. import com.bjpowernode.triage.buss.service.PrescriptionService;
    22. import com.bjpowernode.triage.buss.service.TriageService;
    23. import com.bjpowernode.triage.common.controller.BaseController;
    24. import com.bjpowernode.triage.common.persistence.Page;
    25. import com.bjpowernode.triage.common.persistence.PropertyFilter;
    26. /**
    27. * 分诊controller
    28. * @author bjpowernode
    29. * @date 2016年1月13日
    30. */
    31. @Controller
    32. @RequestMapping("buss/triage")
    33. public class TriageController extends BaseController {
    34. @Autowired
    35. private TriageService triageService;
    36. @Autowired
    37. private PrescriptionService prescriptionService;
    38. /**
    39. * 默认页面
    40. */
    41. @RequestMapping(method = RequestMethod.GET)
    42. public String list() {
    43. return "buss/triageList";
    44. }
    45. /**
    46. * 获取分诊json
    47. */
    48. @RequiresPermissions("buss:triage:view")
    49. @RequestMapping(value="json",method = RequestMethod.GET)
    50. @ResponseBody
    51. public Map getData(HttpServletRequest request) {
    52. Page page = getPage(request);
    53. page.setOrderBy("urgent,createTime");
    54. page.setOrder("desc,asc");
    55. List filters = PropertyFilter.buildFromHttpRequest(request);
    56. page = triageService.search(page, filters);
    57. return getEasyUIData(page);
    58. }
    59. // /**
    60. // * 添加分诊跳转
    61. // *
    62. // * @param model
    63. // */
    64. // @RequiresPermissions("buss:triage:add")
    65. // @RequestMapping(value = "create", method = RequestMethod.GET)
    66. // public String createForm(Model model) {
    67. // model.addAttribute("triage", new Dept());
    68. // model.addAttribute("action", "create");
    69. // return "buss/deptForm";
    70. // }
    71. /**
    72. * 添加分诊
    73. *
    74. * @param triage
    75. * @param model
    76. */
    77. @RequiresPermissions("buss:triage:add")
    78. @RequestMapping(value = "create", method = RequestMethod.POST)
    79. @ResponseBody
    80. public String create(@Valid Triage triage,Integer patientId,Integer deptId, Model model) {
    81. triage.setStatus("1");
    82. Patient patient = new Patient(patientId);
    83. Dept dept = new Dept(deptId);
    84. triage.setDept(dept);
    85. triage.setPatient(patient);
    86. triage.setCreateTime(new Date());
    87. triageService.save(triage);
    88. return "success";
    89. }
    90. /**
    91. * 叫号
    92. *
    93. * @param model
    94. */
    95. @RequestMapping(value = "callPatient", method = RequestMethod.GET)
    96. @ResponseBody
    97. public String callPatient(HttpServletRequest request,Model model) {
    98. Page page = getPage(request);
    99. page.setOrderBy("urgent,createTime");
    100. page.setOrder("desc,asc");
    101. PropertyFilter pf = new PropertyFilter("EQS_status","1");
    102. List filters = new ArrayList();
    103. filters.add(pf);
    104. page = triageService.search(page, filters);
    105. if(page == null){
    106. return "目前没有候诊人员!";
    107. }
    108. if(page.getResult().size() == 0){
    109. return "目前没有候诊人员!";
    110. }
    111. Triage triage = page.getResult().get(0);
    112. triage.setStatus("0");
    113. triageService.save(triage);
    114. return "success";
    115. }
    116. /**
    117. * 弹窗页
    118. *
    119. * @param id
    120. * @param model
    121. * @return
    122. */
    123. @RequestMapping(value = "{patientId}/patientTriage/{patientName}/patientName")
    124. public String getUserRole(@PathVariable("patientId") Integer patientId, @PathVariable("patientName") String patientName,Model model) {
    125. model.addAttribute("patientId", patientId);
    126. model.addAttribute("patientName", patientName);
    127. model.addAttribute("action", "create");
    128. return "buss/triagePatientForm";
    129. }
    130. /**
    131. * 修改triage跳转
    132. *
    133. * @param id
    134. * @param model
    135. * @return
    136. */
    137. @RequiresPermissions("buss:triage:update")
    138. @RequestMapping(value = "update/{id}", method = RequestMethod.GET)
    139. public String updateForm(@PathVariable("id") Integer id, Model model) {
    140. model.addAttribute("triage", triageService.get(id));
    141. model.addAttribute("action", "update");
    142. return "buss/triageForm";
    143. }
    144. /**
    145. * 修改分诊
    146. *
    147. * @param dept
    148. * @param model
    149. * @return
    150. */
    151. @RequiresPermissions("buss:triage:update")
    152. @RequestMapping(value = "update", method = RequestMethod.POST)
    153. @ResponseBody
    154. public String update(@Valid @ModelAttribute @RequestBody Triage triage,Integer patientId,Integer deptId,Model model) {
    155. Patient patient = new Patient(patientId);
    156. Dept dept = new Dept(deptId);
    157. triage.setDept(dept);
    158. triage.setPatient(patient);
    159. triageService.update(triage);
    160. return "success";
    161. }
    162. /**
    163. * 删除分诊
    164. *
    165. * @param id
    166. * @return
    167. */
    168. @RequiresPermissions("buss:dept:delete")
    169. @RequestMapping(value = "delete/{id}")
    170. @ResponseBody
    171. public String delete(@PathVariable("id") Integer id) {
    172. triageService.delete(id);
    173. return "success";
    174. }
    175. }

    角色控制器

    1. package com.bjpowernode.triage.system.controller;
    2. import java.util.HashSet;
    3. import java.util.Iterator;
    4. import java.util.List;
    5. import java.util.Map;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpSession;
    8. import javax.validation.Valid;
    9. import org.apache.shiro.authz.annotation.RequiresPermissions;
    10. import org.apache.shiro.session.Session;
    11. import org.apache.shiro.subject.PrincipalCollection;
    12. import org.springframework.beans.factory.annotation.Autowired;
    13. import org.springframework.stereotype.Controller;
    14. import org.springframework.ui.Model;
    15. import org.springframework.web.bind.annotation.ModelAttribute;
    16. import org.springframework.web.bind.annotation.PathVariable;
    17. import org.springframework.web.bind.annotation.RequestBody;
    18. import org.springframework.web.bind.annotation.RequestMapping;
    19. import org.springframework.web.bind.annotation.RequestMethod;
    20. import org.springframework.web.bind.annotation.RequestParam;
    21. import org.springframework.web.bind.annotation.ResponseBody;
    22. import com.bjpowernode.triage.common.controller.BaseController;
    23. import com.bjpowernode.triage.common.persistence.Page;
    24. import com.bjpowernode.triage.common.persistence.PropertyFilter;
    25. import com.bjpowernode.triage.system.entity.Role;
    26. import com.bjpowernode.triage.system.entity.User;
    27. import com.bjpowernode.triage.system.service.RolePermissionService;
    28. import com.bjpowernode.triage.system.service.RoleService;
    29. /**
    30. * 角色controller
    31. * @author ty
    32. * @date 2016年1月13日
    33. */
    34. @Controller
    35. @RequestMapping("system/role")
    36. public class RoleController extends BaseController{
    37. @Autowired
    38. private RoleService roleService;
    39. @Autowired
    40. private RolePermissionService rolePermissionService;
    41. /**
    42. * 默认页面
    43. * @return
    44. */
    45. @RequestMapping(method = RequestMethod.GET)
    46. public String list(){
    47. return "system/roleList";
    48. }
    49. /**
    50. * 角色集合(JSON)
    51. */
    52. @RequiresPermissions("sys:role:view")
    53. @RequestMapping(value="json",method = RequestMethod.GET)
    54. @ResponseBody
    55. public Map getData(HttpServletRequest request) {
    56. Page page=getPage(request);
    57. List filters = PropertyFilter.buildFromHttpRequest(request);
    58. page = roleService.search(page, filters);
    59. return getEasyUIData(page);
    60. }
    61. /**
    62. * 获取角色拥有的权限ID集合
    63. * @param id
    64. * @return
    65. */
    66. @RequiresPermissions("sys:role:permView")
    67. @RequestMapping("{id}/json")
    68. @ResponseBody
    69. public List getRolePermissions(@PathVariable("id") Integer id){
    70. List permissionIdList=rolePermissionService.getPermissionIds(id);
    71. return permissionIdList;
    72. }
    73. /**
    74. * 修改角色权限
    75. * @param id
    76. * @param newRoleList
    77. * @return
    78. */
    79. @RequiresPermissions("sys:role:permUpd")
    80. @RequestMapping(value = "{id}/updatePermission")
    81. @ResponseBody
    82. public String updateRolePermission(@PathVariable("id") Integer id,@RequestBody List newRoleIdList,HttpSession session){
    83. List oldRoleIdList=rolePermissionService.getPermissionIds(id);
    84. //获取application中的sessions
    85. @SuppressWarnings("rawtypes")
    86. HashSet sessions=(HashSet) session.getServletContext().getAttribute("sessions");
    87. @SuppressWarnings("unchecked")
    88. Iterator iterator= sessions.iterator();
    89. PrincipalCollection pc=null;
    90. //遍历sessions
    91. while(iterator.hasNext()){
    92. HttpSession s=(HttpSession) iterator.next();
    93. User user=(User) s.getAttribute("user");
    94. if(user !=null && user.getId()==id){
    95. pc= (PrincipalCollection) s.getAttribute(String.valueOf(id));
    96. //清空该用户权限缓存
    97. rolePermissionService.clearUserPermCache(pc);
    98. s.removeAttribute(String.valueOf(id));
    99. break;
    100. }
    101. }
    102. rolePermissionService.updateRolePermission(id,oldRoleIdList ,newRoleIdList);
    103. return "success";
    104. }
    105. /**
    106. * 添加角色跳转
    107. * @param model
    108. * @return
    109. */
    110. @RequiresPermissions("sys:role:add")
    111. @RequestMapping(value = "create", method = RequestMethod.GET)
    112. public String createForm(Model model) {
    113. model.addAttribute("role", new Role());
    114. model.addAttribute("action", "create");
    115. return "system/roleForm";
    116. }
    117. /**
    118. * 添加角色
    119. * @param role
    120. * @param model
    121. * @return
    122. */
    123. @RequiresPermissions("sys:role:add")
    124. @RequestMapping(value = "create", method = RequestMethod.POST)
    125. @ResponseBody
    126. public String create(@Valid Role role,Model model) {
    127. roleService.save(role);
    128. return "success";
    129. }
    130. /**
    131. * 修改角色跳转
    132. * @param id
    133. * @param model
    134. * @return
    135. */
    136. @RequiresPermissions("sys:role:update")
    137. @RequestMapping(value = "update/{id}", method = RequestMethod.GET)
    138. public String updateForm(@PathVariable("id") Integer id, Model model) {
    139. model.addAttribute("role", roleService.get(id));
    140. model.addAttribute("action", "update");
    141. return "system/roleForm";
    142. }
    143. /**
    144. * 修改角色
    145. * @param role
    146. * @param model
    147. * @return
    148. */
    149. @RequiresPermissions("sys:role:update")
    150. @RequestMapping(value = "update", method = RequestMethod.POST)
    151. @ResponseBody
    152. public String update(@Valid @ModelAttribute("role") Role role,Model model) {
    153. roleService.save(role);
    154. return "success";
    155. }
    156. /**
    157. * 删除角色
    158. * @param id
    159. * @return
    160. */
    161. @RequiresPermissions("sys:role:delete")
    162. @RequestMapping(value = "delete/{id}")
    163. @ResponseBody
    164. public String delete(@PathVariable("id") Integer id) {
    165. roleService.delete(id);
    166. return "success";
    167. }
    168. @ModelAttribute
    169. public void getRole(@RequestParam(value = "id", defaultValue = "-1") Integer id, Model model) {
    170. if (id != -1) {
    171. model.addAttribute("role", roleService.get(id));
    172. }
    173. }
    174. }

    如果也想学习本系统,下面领取。关注并回复:175ssm

  • 相关阅读:
    Spring实例化Bean的三种方法
    【ManageEngine】如何利用好OpManager的报表功能
    SystemVerilog学习-07-类的继承和包的使用
    Java逻辑控制
    dubbo 2.5.3 环境搭建
    实战讲解SpringCloud网关接口限流SpringCloudGateway+Redis(图+文)
    C++ 多线程编程教程:使用 std::thread 和 std::future 进行并发任务管理 ,处理线程超时
    ADAS测试方案
    Vite + React + Ant Design构建项目
    Javascript 教程
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126412636