基于javaweb+mysql的ssm+maven医院管理系统(java+ssm+layui+maven+mysql+jsp)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven医院管理系统(java+ssm+layui+maven+mysql+jsp)
功能介绍:
基于ssm+layui框架的小型医院后台管理系统。简单实现了病人管理、病床管理、员工管理、部门管理、药品管理、仪器管理等基础功能。 整个项目通过maven方式搭建用到的jar包通过maven导入,前端使用搭建好的Layui框架,拿来即用。后端使用SSM+MySQL,后台逻辑实现了分页、级联、多表查询。目前项目基本完成,可重构与扩展
技术栈:
- SSM框架 - Layui框架 - MySQL 5.7 数据库 - Maven搭建 - MD5加密
实现功能:
- 管理员的登录、退出与切换 - 管理员、仪器、药品、部门、员工、病床、病人各模块增删改查 - 个别模块关联查询 - 各个模块数据导出Excel
private SalaryService salaryService;
/**
* 分页查询
*/
@RequestMapping("/findSalary")
public String findSalary(String salaryNo, String salaryName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Salary> sa = salaryService.findPageInfo(salaryNo,salaryName, pageIndex,pageSize);
model.addAttribute("sa",sa);
session.setAttribute("u",salaryNo);
session.setAttribute("t",salaryName);
return "salary_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addSalary" ,method = RequestMethod.POST)
@ResponseBody
public String addSalary(@RequestBody Salary salary) {
int a = salaryService.addSalary(salary);
return "salary_list";
}
/**
* 修改仪器信息
*/
@RequestMapping( value = "/updateSalary", method = RequestMethod.POST)
public String updateSalary(Salary salary) {
int a = salaryService.updateSalary(salary);
return "redirect:/findSalary";
}
/**
* 根据Id搜索;
*/
@RequestMapping("/findSalaryById")
public String findSalaryById(Integer salaryId, HttpSession session) {
Salary sa2= salaryService.findSalaryById(salaryId);
session.setAttribute("sa2",sa2);
return "salary_edit";
private PaitientService paitientService;
/**
* 分页查询
*/
@RequestMapping("/findPaitient")
public String findPaitient(String paitientId, String paitientName,String paitientGender,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Paitient> pa = paitientService.findPageInfo(paitientId,paitientName,paitientGender, pageIndex,pageSize);
model.addAttribute("pa",pa);
session.setAttribute("u",paitientId);
session.setAttribute("t",paitientName);
session.setAttribute("g",paitientGender);
return "paitient_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addPaitient" ,method = RequestMethod.POST)
@ResponseBody
public String addPaitient(@RequestBody Paitient paitient) {
int a = paitientService.addPaitient(paitient);
return "paitient_list";
}
/**
* 删除仪器信息
*/
@RequestMapping( "/deletePaitient")
@ResponseBody
public String deletePaitient(Integer paitientId) {
int a = paitientService.deletePaitient(paitientId);
return "paitient_list";
}
/**
* 修改仪器信息
*/
@RequestMapping( value = "/updatePaitient", method = RequestMethod.POST)
public String updatePaitient(Paitient paitient) {
int a = paitientService.updatePaitient(paitient);
@Controller
public class TmsController {
@Autowired
private TmsService tmsService;
@RequestMapping(value = "/login")
public String login(Tms tms, Model model, HttpSession session){
// 通过账号和密码查询用户
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
Tms ad = tmsService.findTms(tms);
if(ad!=null){
session.setAttribute("ad", ad);
return "homepage";
}
model.addAttribute("msg", "error");
return "login";
}
/**
* 退出登录
*/
@RequestMapping(value = "/loginOut")
public String loginOut(Tms tms, Model model, HttpSession session) {
session.invalidate();
return "login";
}
/**
* 分页查询
*/
@RequestMapping(value = "/findAdmin")
public String findAdmin(String tmsUser, String tmsName,Integer pageIndex
public List<Potion> exportPotion(){
List<Potion> potions = potionService.getAll();
return potions;
}
}
@Controller
public class DeptController {
@Autowired
private DeptService deptService;
/**
* 分页查询
*/
@RequestMapping("/findDept")
public String findDept(String deptNo, String deptName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Dept> de = deptService.findPageInfo(deptNo,deptName, pageIndex,pageSize);
model.addAttribute("de",de);
session.setAttribute("u",deptNo);
session.setAttribute("t",deptName);
return "Dept_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addDept" ,method = RequestMethod.POST)
@ResponseBody
return "admin_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addAdmin" ,method = RequestMethod.POST)
@ResponseBody
public String addAdmin(@RequestBody Tms tms) {
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
int a = tmsService.addTms(tms);
return "admin_list";
}
/**
* 删除管理员信息
*/
@RequestMapping( "/deleteAdmin")
@ResponseBody
public String deleteAdmin(Integer tmsId) {
int a = tmsService.deleteTms(tmsId);
return "admin_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportadminlist" , method = RequestMethod.POST)
@ResponseBody
public List<Tms> exportAdmin(){
List<Tms> admin = tmsService.getAll();
return admin;
}
/**
* 根据管理员Id搜索;
*/
@RequestMapping( "/findAdminById")
public String findAdminById( Integer tmId,HttpSession session) {
Tms a= tmsService.findTmsById(tmId);
session.setAttribute("a",a);
return "admin_edit";
}
/**
* 修改管理员信息
*/
/**
* 将提交数据写入Tms对象
*/
@RequestMapping( value = "/updateAdmin", method = RequestMethod.POST)
public String updateAdmin(Tms tms) {
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
@Controller
public class SalaryController {
@Autowired
private SalaryService salaryService;
/**
* 分页查询
*/
@RequestMapping("/findSalary")
public String findSalary(String salaryNo, String salaryName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Salary> sa = salaryService.findPageInfo(salaryNo,salaryName, pageIndex,pageSize);
model.addAttribute("sa",sa);
session.setAttribute("u",salaryNo);
session.setAttribute("t",salaryName);
return "salary_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addSalary" ,method = RequestMethod.POST)
@ResponseBody
public String addSalary(@RequestBody Salary salary) {
int a = salaryService.addSalary(salary);
return "salary_list";
}
/**
* 修改仪器信息
*/
@RequestMapping( value = "/updateSalary", method = RequestMethod.POST)
public String updateSalary(Salary salary) {
int a = salaryService.updateSalary(salary);
return "redirect:/findSalary";
}
/**
* 根据Id搜索;
}
@Controller
public class PersonnelController {
@Autowired
private PersonnelService personnelService;
/**
* 分页查询
*/
@RequestMapping("/findPersonnel")
public String findPersonnel(String empNo, String empName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Personnel> pe = personnelService.findPageInfo(empNo,empName, pageIndex,pageSize);
model.addAttribute("pe",pe);
session.setAttribute("u",empNo);
session.setAttribute("t",empName);
return "personnel_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addPersonnel" ,method = RequestMethod.POST)
@ResponseBody
public String addPersonnel(@RequestBody Personnel personnel) {
int a = personnelService.addPersonnel(personnel);
/**
* 部门人员信息查询
*/
@RequestMapping(value = "/findDeptPersonnel")
public String findClassStudent(Dept dept,Model model, HttpSession session) {
List<Dept> dep = deptService.findDeptPersonnel(dept);
model.addAttribute("dep",dep);
return "dept_Personnellist";
}
}
@Controller
public class BedController {
@Autowired
private BedService bedService;
/**
* 分页查询
*/
@RequestMapping("/findBed")
public String findBed(String bedNo, String bedRoomId,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Bed> be = bedService.findPageInfo(bedNo,bedRoomId, pageIndex,pageSize);
model.addAttribute("be",be);
session.setAttribute("u",bedNo);
session.setAttribute("t",bedRoomId);
return "bed_list";
}
PageInfo<Bed> be = bedService.findPageInfo(bedNo,bedRoomId, pageIndex,pageSize);
model.addAttribute("be",be);
session.setAttribute("u",bedNo);
session.setAttribute("t",bedRoomId);
return "bed_list";
}
/**
* 添加病床信息
*/
@RequestMapping(value = "/addBed" ,method = RequestMethod.POST)
@ResponseBody
public String addBed(@RequestBody Bed bed) {
int a = bedService.addBed(bed);
return "bed_list";
}
/**
* 修改信息
*/
@RequestMapping( value = "/updateBed", method = RequestMethod.POST)
public String updateBed(Bed bed) {
int a = bedService.updateBed(bed);
return "redirect:/findBed";
}
/**
* 根据Id搜索;
*/
@RequestMapping("/findBedById")
public String findBedById(Integer bedId, HttpSession session) {
Bed be2= bedService.findBedById(bedId);
session.setAttribute("be2",be2);
return "bed_edit";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportBedlist" , method = RequestMethod.POST)
@ResponseBody
public List<Bed> exportBedlist(){
List<Bed> beds = bedService.getAll();
return beds;
}
/**
* 部门人员信息查询
*/
/**
* 将提交数据写入Tms对象
*/
@RequestMapping( value = "/updateAdmin", method = RequestMethod.POST)
public String updateAdmin(Tms tms) {
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
int a = tmsService.updateTms(tms);
return "redirect:/findAdmin";
}
}
@Controller
public class PaitientController {
@Autowired
private PaitientService paitientService;
/**
* 分页查询
*/
@RequestMapping("/findPaitient")
public String findPaitient(String paitientId, String paitientName,String paitientGender,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Paitient> pa = paitientService.findPageInfo(paitientId,paitientName,paitientGender, pageIndex,pageSize);
model.addAttribute("pa",pa);
session.setAttribute("u",paitientId);
session.setAttribute("t",paitientName);
session.setAttribute("g",paitientGender);
return "paitient_list";
@RequestMapping( "/deletePotion")
@ResponseBody
public String deletePotion(Integer potionId) {
int a = potionService.deletePotion(potionId);
return "potion_list";
}
/**
* 修改仪器信息
*/
@RequestMapping( value = "/updatePotion", method = RequestMethod.POST)
public String updatePotion(Potion potion) {
int a = potionService.updatePotion(potion);
return "redirect:/findPotion";
}
/**
* 根据管理员Id搜索;将请求数据a_id写入参数a_id
*/
@RequestMapping("/findPotionById")
public String findPotionById(Integer potionId, HttpSession session) {
Potion po2= potionService.findPotionById(potionId);
session.setAttribute("po2",po2);
return "potion_edit";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportPotionlist" , method = RequestMethod.POST)
@ResponseBody
public List<Potion> exportPotion(){
List<Potion> potions = potionService.getAll();
return potions;
}
}
private DeptService deptService;
/**
* 分页查询
*/
@RequestMapping("/findDept")
public String findDept(String deptNo, String deptName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Dept> de = deptService.findPageInfo(deptNo,deptName, pageIndex,pageSize);
model.addAttribute("de",de);
session.setAttribute("u",deptNo);
session.setAttribute("t",deptName);
return "Dept_list";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addDept" ,method = RequestMethod.POST)
@ResponseBody
public String addDept(@RequestBody Dept dept) {
int a = deptService.addDept(dept);
return "Dept_list";
}
/**
* 修改信息
*/
@RequestMapping( value = "/updateDept", method = RequestMethod.POST)
public String updateDept(Dept dept) {
int a = deptService.updateDept(dept);
return "redirect:/findDept";
}
/**
* 根据Id搜索;
*/
@RequestMapping("/findDeptById")
public String findDeptById(Integer deptId, HttpSession session) {
Dept de2= deptService.findDeptById(deptId);
session.setAttribute("de2",de2);
return "Dept_edit";
}
/**
* 导出Excel
return "admin_list";
}
/**
* 删除管理员信息
*/
@RequestMapping( "/deleteAdmin")
@ResponseBody
public String deleteAdmin(Integer tmsId) {
int a = tmsService.deleteTms(tmsId);
return "admin_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportadminlist" , method = RequestMethod.POST)
@ResponseBody
public List<Tms> exportAdmin(){
List<Tms> admin = tmsService.getAll();
return admin;
}
/**
* 根据管理员Id搜索;
*/
@RequestMapping( "/findAdminById")
public String findAdminById( Integer tmId,HttpSession session) {
Tms a= tmsService.findTmsById(tmId);
session.setAttribute("a",a);
return "admin_edit";
}
/**
* 修改管理员信息
*/
/**
* 将提交数据写入Tms对象
*/
@RequestMapping( value = "/updateAdmin", method = RequestMethod.POST)
public String updateAdmin(Tms tms) {
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
int a = tmsService.updateTms(tms);
return "redirect:/findAdmin";
}
}
@Controller
public class TmsController {
@Autowired
private TmsService tmsService;
@RequestMapping(value = "/login")
public String login(Tms tms, Model model, HttpSession session){
// 通过账号和密码查询用户
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
Tms ad = tmsService.findTms(tms);
if(ad!=null){
session.setAttribute("ad", ad);
return "homepage";
}
model.addAttribute("msg", "error");
return "login";
}
/**
* 退出登录
*/
@RequestMapping(value = "/loginOut")
public String loginOut(Tms tms, Model model, HttpSession session) {
session.invalidate();
return "login";
}
/**
* 分页查询
*/
@RequestMapping(value = "/findAdmin")
public String findAdmin(String tmsUser, String tmsName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session) {
PageInfo<Tms> ai = tmsService.findPageInfo(tmsUser,tmsName, pageIndex,pageSize);
model.addAttribute("ai",ai);
session.setAttribute("u",tmsUser);
session.setAttribute("t",tmsName);
return "admin_list";
}
@Controller
public class TmsController {
@Autowired
private TmsService tmsService;
@RequestMapping(value = "/login")
public String login(Tms tms, Model model, HttpSession session){
// 通过账号和密码查询用户
tms.setTmsPswd(MD5Util.MD5EncodeUtf8(tms.getTmsPswd()));
Tms ad = tmsService.findTms(tms);
if(ad!=null){
session.setAttribute("ad", ad);
return "homepage";
}
model.addAttribute("msg", "error");
return "login";
}
/**
* 退出登录
*/
@RequestMapping(value = "/loginOut")
public String loginOut(Tms tms, Model model, HttpSession session) {
session.invalidate();
return "login";
}
/**
* 分页查询
*/
@RequestMapping(value = "/findAdmin")
public String findAdmin(String tmsUser, String tmsName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session) {
PageInfo<Tms> ai = tmsService.findPageInfo(tmsUser,tmsName, pageIndex,pageSize);
model.addAttribute("ai",ai);
session.setAttribute("u",tmsUser);
session.setAttribute("t",tmsName);
return "admin_list";
, Integer pageSize, Model model,HttpSession session){
PageInfo<Bed> be = bedService.findPageInfo(bedNo,bedRoomId, pageIndex,pageSize);
model.addAttribute("be",be);
session.setAttribute("u",bedNo);
session.setAttribute("t",bedRoomId);
return "bed_list";
}
/**
* 添加病床信息
*/
@RequestMapping(value = "/addBed" ,method = RequestMethod.POST)
@ResponseBody
public String addBed(@RequestBody Bed bed) {
int a = bedService.addBed(bed);
return "bed_list";
}
/**
* 修改信息
*/
@RequestMapping( value = "/updateBed", method = RequestMethod.POST)
public String updateBed(Bed bed) {
int a = bedService.updateBed(bed);
return "redirect:/findBed";
}
/**
* 根据Id搜索;
*/
@RequestMapping("/findBedById")
public String findBedById(Integer bedId, HttpSession session) {
Bed be2= bedService.findBedById(bedId);
session.setAttribute("be2",be2);
return "bed_edit";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportBedlist" , method = RequestMethod.POST)
@ResponseBody
public List<Bed> exportBedlist(){
List<Bed> beds = bedService.getAll();
return beds;
}
/**
* 部门人员信息查询
*/
}
/**
* 删除仪器信息
*/
@RequestMapping( "/deletePaitient")
@ResponseBody
public String deletePaitient(Integer paitientId) {
int a = paitientService.deletePaitient(paitientId);
return "paitient_list";
}
/**
* 修改仪器信息
*/
@RequestMapping( value = "/updatePaitient", method = RequestMethod.POST)
public String updatePaitient(Paitient paitient) {
int a = paitientService.updatePaitient(paitient);
return "redirect:/findPaitient";
}
/**
* 根据管理员Id搜索;将请求数据a_id写入参数a_id
*/
@RequestMapping("/findPaitientById")
public String findPaitientById(Integer paitientId, HttpSession session) {
Paitient pa2= paitientService.findPaitientById(paitientId);
session.setAttribute("pa2",pa2);
return "paitient_edit";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportPaitientlist" , method = RequestMethod.POST)
@ResponseBody
public List<Paitient> exportPotion(){
List<Paitient> paitients = paitientService.getAll();
return paitients;
}
/**
* 部门人员信息查询
*/
@RequestMapping(value = "/findPP")
public String findPP(Personnel personnel, Model model) {