作者主页:夜未央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
运行截图
相关代码
部门控制器
package com.bjpowernode.triage.buss.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bjpowernode.triage.buss.entity.Dept;
import com.bjpowernode.triage.buss.service.DeptService;
import com.bjpowernode.triage.common.controller.BaseController;
import com.bjpowernode.triage.common.persistence.Page;
import com.bjpowernode.triage.common.persistence.PropertyFilter;
import com.bjpowernode.triage.system.entity.Permission;
/**
* 用户controller
* @author bjpowernode
* @date 2016年1月13日
*/
@Controller
@RequestMapping("buss/dept")
public class DeptController extends BaseController {
@Autowired
private DeptService deptService;
/**
* 默认页面
*/
@RequestMapping(method = RequestMethod.GET)
public String list() {
return "buss/deptList";
}
/**
* 部门集合(JSON)
*/
@RequestMapping(value="allDept/json",method = RequestMethod.GET)
@ResponseBody
public List<Dept> allDept(){
List<Dept> deptList=deptService.getAll();
return deptList;
}
/**
* 获取科室json
*/
@RequiresPermissions("buss:dept:view")
@RequestMapping(value="json",method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getData(HttpServletRequest request) {
Page<Dept> page = getPage(request);
List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(request);
page = deptService.search(page, filters);
return getEasyUIData(page);
}
/**
* 添加科室跳转
*
* @param model
*/
@RequiresPermissions("buss:dept:add")
@RequestMapping(value = "create", method = RequestMethod.GET)
public String createForm(Model model) {
model.addAttribute("dept", new Dept());
model.addAttribute("action", "create");
return "buss/deptForm";
}
/**
* 添加科室
*
* @param dept
* @param model
*/
@RequiresPermissions("buss:dept:add")
@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody
public String create(@Valid Dept dept, Model model) {
deptService.save(dept);
return "success";
}
/**
* 修改科室跳转
*
* @param id
* @param model
* @return
*/
@RequiresPermissions("buss:dept:update")
@RequestMapping(value = "update/{id}", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Integer id, Model model) {
model.addAttribute("dept", deptService.get(id));
model.addAttribute("action", "update");
return "buss/deptForm";
}
/**
* 修改科室
*
* @param dept
* @param model
* @return
*/
@RequiresPermissions("buss:dept:update")
@RequestMapping(value = "update", method = RequestMethod.POST)
@ResponseBody
public String update(@Valid @ModelAttribute @RequestBody Dept dept,Model model) {
deptService.update(dept);
return "success";
}
/**
* 删除用户
*
* @param id
* @return
*/
@RequiresPermissions("buss:dept:delete")
@RequestMapping(value = "delete/{id}")
@ResponseBody
public String delete(@PathVariable("id") Integer id) {
deptService.delete(id);
return "success";
}
}
病人控制器
package com.bjpowernode.triage.buss.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bjpowernode.triage.buss.entity.Patient;
import com.bjpowernode.triage.buss.service.PatientService;
import com.bjpowernode.triage.common.controller.BaseController;
import com.bjpowernode.triage.common.persistence.Page;
import com.bjpowernode.triage.common.persistence.PropertyFilter;
/**
* 用户controller
* @author bjpowernode
* @date 2016年1月13日
*/
@Controller
@RequestMapping("buss/patient")
public class PatientController extends BaseController {
@Autowired
private PatientService patientService;
/**
* 默认页面
*/
@RequestMapping(method = RequestMethod.GET)
public String list() {
return "buss/patientList";
}
/**
* 获取json
*/
@RequiresPermissions("buss:patient:view")
@RequestMapping(value="json",method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getData(HttpServletRequest request) {
Page<Patient> page = getPage(request);
List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(request);
page = patientService.search(page, filters);
return getEasyUIData(page);
}
/**
* 添加科室跳转
*
* @param model
*/
@RequiresPermissions("buss:patient:add")
@RequestMapping(value = "create", method = RequestMethod.GET)
public String createForm(Model model) {
model.addAttribute("patient", new Patient());
model.addAttribute("action", "create");
return "buss/patientForm";
}
/**
* 添加科室
*
* @param patient
* @param model
*/
@RequiresPermissions("buss:patient:add")
@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody
public String create(@Valid Patient patient, Model model) {
patientService.save(patient);
return "success";
}
/**
* 修改科室跳转
*
* @param id
* @param model
* @return
*/
@RequiresPermissions("buss:patient:update")
@RequestMapping(value = "update/{id}", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Integer id, Model model) {
model.addAttribute("patient", patientService.get(id));
model.addAttribute("action", "update");
return "buss/patientForm";
}
/**
* 修改科室
*
* @param patient
* @param model
* @return
*/
@RequiresPermissions("buss:patient:update")
@RequestMapping(value = "update", method = RequestMethod.POST)
@ResponseBody
public String update(@Valid @ModelAttribute @RequestBody Patient patient,Model model) {
patientService.update(patient);
return "success";
}
/**
* 删除用户
*
* @param id
* @return
*/
@RequiresPermissions("buss:patient:delete")
@RequestMapping(value = "delete/{id}")
@ResponseBody
public String delete(@PathVariable("id") Integer id) {
patientService.delete(id);
return "success";
}
}
分诊controller
package com.bjpowernode.triage.buss.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bjpowernode.triage.buss.entity.Dept;
import com.bjpowernode.triage.buss.entity.Patient;
import com.bjpowernode.triage.buss.entity.Triage;
import com.bjpowernode.triage.buss.service.PrescriptionService;
import com.bjpowernode.triage.buss.service.TriageService;
import com.bjpowernode.triage.common.controller.BaseController;
import com.bjpowernode.triage.common.persistence.Page;
import com.bjpowernode.triage.common.persistence.PropertyFilter;
/**
* 分诊controller
* @author bjpowernode
* @date 2016年1月13日
*/
@Controller
@RequestMapping("buss/triage")
public class TriageController extends BaseController {
@Autowired
private TriageService triageService;
@Autowired
private PrescriptionService prescriptionService;
/**
* 默认页面
*/
@RequestMapping(method = RequestMethod.GET)
public String list() {
return "buss/triageList";
}
/**
* 获取分诊json
*/
@RequiresPermissions("buss:triage:view")
@RequestMapping(value="json",method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getData(HttpServletRequest request) {
Page<Triage> page = getPage(request);
page.setOrderBy("urgent,createTime");
page.setOrder("desc,asc");
List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(request);
page = triageService.search(page, filters);
return getEasyUIData(page);
}
// /**
// * 添加分诊跳转
// *
// * @param model
// */
// @RequiresPermissions("buss:triage:add")
// @RequestMapping(value = "create", method = RequestMethod.GET)
// public String createForm(Model model) {
// model.addAttribute("triage", new Dept());
// model.addAttribute("action", "create");
// return "buss/deptForm";
// }
/**
* 添加分诊
*
* @param triage
* @param model
*/
@RequiresPermissions("buss:triage:add")
@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody
public String create(@Valid Triage triage,Integer patientId,Integer deptId, Model model) {
triage.setStatus("1");
Patient patient = new Patient(patientId);
Dept dept = new Dept(deptId);
triage.setDept(dept);
triage.setPatient(patient);
triage.setCreateTime(new Date());
triageService.save(triage);
return "success";
}
/**
* 叫号
*
* @param model
*/
@RequestMapping(value = "callPatient", method = RequestMethod.GET)
@ResponseBody
public String callPatient(HttpServletRequest request,Model model) {
Page<Triage> page = getPage(request);
page.setOrderBy("urgent,createTime");
page.setOrder("desc,asc");
PropertyFilter pf = new PropertyFilter("EQS_status","1");
List<PropertyFilter> filters = new ArrayList<PropertyFilter>();
filters.add(pf);
page = triageService.search(page, filters);
if(page == null){
return "目前没有候诊人员!";
}
if(page.getResult().size() == 0){
return "目前没有候诊人员!";
}
Triage triage = page.getResult().get(0);
triage.setStatus("0");
triageService.save(triage);
return "success";
}
/**
* 弹窗页
*
* @param id
* @param model
* @return
*/
@RequestMapping(value = "{patientId}/patientTriage/{patientName}/patientName")
public String getUserRole(@PathVariable("patientId") Integer patientId, @PathVariable("patientName") String patientName,Model model) {
model.addAttribute("patientId", patientId);
model.addAttribute("patientName", patientName);
model.addAttribute("action", "create");
return "buss/triagePatientForm";
}
/**
* 修改triage跳转
*
* @param id
* @param model
* @return
*/
@RequiresPermissions("buss:triage:update")
@RequestMapping(value = "update/{id}", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Integer id, Model model) {
model.addAttribute("triage", triageService.get(id));
model.addAttribute("action", "update");
return "buss/triageForm";
}
/**
* 修改分诊
*
* @param dept
* @param model
* @return
*/
@RequiresPermissions("buss:triage:update")
@RequestMapping(value = "update", method = RequestMethod.POST)
@ResponseBody
public String update(@Valid @ModelAttribute @RequestBody Triage triage,Integer patientId,Integer deptId,Model model) {
Patient patient = new Patient(patientId);
Dept dept = new Dept(deptId);
triage.setDept(dept);
triage.setPatient(patient);
triageService.update(triage);
return "success";
}
/**
* 删除分诊
*
* @param id
* @return
*/
@RequiresPermissions("buss:dept:delete")
@RequestMapping(value = "delete/{id}")
@ResponseBody
public String delete(@PathVariable("id") Integer id) {
triageService.delete(id);
return "success";
}
}
角色控制器
package com.bjpowernode.triage.system.controller;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.PrincipalCollection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bjpowernode.triage.common.controller.BaseController;
import com.bjpowernode.triage.common.persistence.Page;
import com.bjpowernode.triage.common.persistence.PropertyFilter;
import com.bjpowernode.triage.system.entity.Role;
import com.bjpowernode.triage.system.entity.User;
import com.bjpowernode.triage.system.service.RolePermissionService;
import com.bjpowernode.triage.system.service.RoleService;
/**
* 角色controller
* @author ty
* @date 2016年1月13日
*/
@Controller
@RequestMapping("system/role")
public class RoleController extends BaseController{
@Autowired
private RoleService roleService;
@Autowired
private RolePermissionService rolePermissionService;
/**
* 默认页面
* @return
*/
@RequestMapping(method = RequestMethod.GET)
public String list(){
return "system/roleList";
}
/**
* 角色集合(JSON)
*/
@RequiresPermissions("sys:role:view")
@RequestMapping(value="json",method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getData(HttpServletRequest request) {
Page<Role> page=getPage(request);
List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(request);
page = roleService.search(page, filters);
return getEasyUIData(page);
}
/**
* 获取角色拥有的权限ID集合
* @param id
* @return
*/
@RequiresPermissions("sys:role:permView")
@RequestMapping("{id}/json")
@ResponseBody
public List<Integer> getRolePermissions(@PathVariable("id") Integer id){
List<Integer> permissionIdList=rolePermissionService.getPermissionIds(id);
return permissionIdList;
}
/**
* 修改角色权限
* @param id
* @param newRoleList
* @return
*/
@RequiresPermissions("sys:role:permUpd")
@RequestMapping(value = "{id}/updatePermission")
@ResponseBody
public String updateRolePermission(@PathVariable("id") Integer id,@RequestBody List<Integer> newRoleIdList,HttpSession session){
List<Integer> oldRoleIdList=rolePermissionService.getPermissionIds(id);
//获取application中的sessions
@SuppressWarnings("rawtypes")
HashSet sessions=(HashSet) session.getServletContext().getAttribute("sessions");
@SuppressWarnings("unchecked")
Iterator<Session> iterator= sessions.iterator();
PrincipalCollection pc=null;
//遍历sessions
while(iterator.hasNext()){
HttpSession s=(HttpSession) iterator.next();
User user=(User) s.getAttribute("user");
if(user !=null && user.getId()==id){
pc= (PrincipalCollection) s.getAttribute(String.valueOf(id));
//清空该用户权限缓存
rolePermissionService.clearUserPermCache(pc);
s.removeAttribute(String.valueOf(id));
break;
}
}
rolePermissionService.updateRolePermission(id,oldRoleIdList ,newRoleIdList);
return "success";
}
/**
* 添加角色跳转
* @param model
* @return
*/
@RequiresPermissions("sys:role:add")
@RequestMapping(value = "create", method = RequestMethod.GET)
public String createForm(Model model) {
model.addAttribute("role", new Role());
model.addAttribute("action", "create");
return "system/roleForm";
}
/**
* 添加角色
* @param role
* @param model
* @return
*/
@RequiresPermissions("sys:role:add")
@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody
public String create(@Valid Role role,Model model) {
roleService.save(role);
return "success";
}
/**
* 修改角色跳转
* @param id
* @param model
* @return
*/
@RequiresPermissions("sys:role:update")
@RequestMapping(value = "update/{id}", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Integer id, Model model) {
model.addAttribute("role", roleService.get(id));
model.addAttribute("action", "update");
return "system/roleForm";
}
/**
* 修改角色
* @param role
* @param model
* @return
*/
@RequiresPermissions("sys:role:update")
@RequestMapping(value = "update", method = RequestMethod.POST)
@ResponseBody
public String update(@Valid @ModelAttribute("role") Role role,Model model) {
roleService.save(role);
return "success";
}
/**
* 删除角色
* @param id
* @return
*/
@RequiresPermissions("sys:role:delete")
@RequestMapping(value = "delete/{id}")
@ResponseBody
public String delete(@PathVariable("id") Integer id) {
roleService.delete(id);
return "success";
}
@ModelAttribute
public void getRole(@RequestParam(value = "id", defaultValue = "-1") Integer id, Model model) {
if (id != -1) {
model.addAttribute("role", roleService.get(id));
}
}
}
如果也想学习本系统,下面领取。关注并回复:175ssm