• Java项目:ssm医院管理系统


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    功能介绍

    基于ssm+layui框架的小型医院后台管理系统。简单实现了病人管理、病床管理、员工管理、部门管理、药品管理、仪器管理等基础功能。
    整个项目通过maven方式搭建用到的jar包通过maven导入,前端使用搭建好的Layui框架,拿来即用。后端使用SSM+MySQL,后台逻辑实现了分页、级联、多表查询。目前项目基本完成,可重构与扩展

    技术栈

    - SSM框架
    - Layui框架
    - MySQL 5.7 数据库
    - Maven搭建
    - MD5加密

    实现功能

    - 管理员的登录、退出与切换
    - 管理员、仪器、药品、部门、员工、病床、病人各模块增删改查
    - 个别模块关联查询
    - 各个模块数据导出Excel

    运行截图

    相关代码 

    AppartusController

    1. package com.xie.controller;
    2. import com.xie.pojo.Appartus;
    3. import com.xie.pojo.PageInfo;
    4. import com.xie.pojo.Tms;
    5. import com.xie.service.AppartusService;
    6. import com.xie.util.MD5Util;
    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.RequestBody;
    11. import org.springframework.web.bind.annotation.RequestMapping;
    12. import org.springframework.web.bind.annotation.RequestMethod;
    13. import org.springframework.web.bind.annotation.ResponseBody;
    14. import javax.servlet.http.HttpSession;
    15. import java.util.List;
    16. @Controller
    17. public class AppartusController {
    18. @Autowired
    19. private AppartusService appartusService;
    20. /**
    21. * 分页查询
    22. */
    23. @RequestMapping("/findAppartus")
    24. public String findAppartus(String appartusNo, String appartusName,Integer pageIndex
    25. , Integer pageSize, Model model,HttpSession session){
    26. PageInfo ap = appartusService.findPageInfo(appartusNo,appartusName, pageIndex,pageSize);
    27. model.addAttribute("ap",ap);
    28. session.setAttribute("u",appartusNo);
    29. session.setAttribute("t",appartusName);
    30. return "appartus_list";
    31. }
    32. /**
    33. * 添加管理员信息
    34. */
    35. @RequestMapping(value = "/addAppartus" ,method = RequestMethod.POST)
    36. @ResponseBody
    37. public String addAppartus(@RequestBody Appartus appartus) {
    38. int a = appartusService.addAppartus(appartus);
    39. return "admin_list";
    40. }
    41. /**
    42. * 删除仪器信息
    43. */
    44. @RequestMapping( "/deleteAppartus")
    45. @ResponseBody
    46. public String deleteAdmin(Integer appartusId) {
    47. int a = appartusService.deleteAppartus(appartusId);
    48. return "appartus_list";
    49. }
    50. /**
    51. * 修改仪器信息
    52. */
    53. @RequestMapping( value = "/updateAppartus", method = RequestMethod.POST)
    54. public String updateAdmin(Appartus appartus) {
    55. int a = appartusService.updateAppartus(appartus);
    56. return "redirect:/findAppartus";
    57. }
    58. /**
    59. * 根据管理员Id搜索;将请求数据a_id写入参数a_id
    60. */
    61. @RequestMapping("/findAppartusById")
    62. public String findAppartusById(Integer appartusId, HttpSession session) {
    63. Appartus ap2= appartusService.findAppartusById(appartusId);
    64. session.setAttribute("ap2",ap2);
    65. return "appartus_edit";
    66. }
    67. /**
    68. * 导出Excel
    69. */
    70. @RequestMapping(value = "/exportAppartuslist" , method = RequestMethod.POST)
    71. @ResponseBody
    72. public List exportAdmin(){
    73. List appartus = appartusService.getAll();
    74. return appartus;
    75. }
    76. }

    BedController

    1. package com.xie.controller;
    2. import com.xie.pojo.Bed;
    3. import com.xie.pojo.PageInfo;
    4. import com.xie.pojo.Room;
    5. import com.xie.service.BedService;
    6. import org.springframework.beans.factory.annotation.Autowired;
    7. import org.springframework.stereotype.Controller;
    8. import org.springframework.ui.Model;
    9. import org.springframework.web.bind.annotation.RequestBody;
    10. import org.springframework.web.bind.annotation.RequestMapping;
    11. import org.springframework.web.bind.annotation.RequestMethod;
    12. import org.springframework.web.bind.annotation.ResponseBody;
    13. import javax.servlet.http.HttpSession;
    14. import java.util.List;
    15. @Controller
    16. public class BedController {
    17. @Autowired
    18. private BedService bedService;
    19. /**
    20. * 分页查询
    21. */
    22. @RequestMapping("/findBed")
    23. public String findBed(String bedNo, String bedRoomId,Integer pageIndex
    24. , Integer pageSize, Model model,HttpSession session){
    25. PageInfo be = bedService.findPageInfo(bedNo,bedRoomId, pageIndex,pageSize);
    26. model.addAttribute("be",be);
    27. session.setAttribute("u",bedNo);
    28. session.setAttribute("t",bedRoomId);
    29. return "bed_list";
    30. }
    31. /**
    32. * 添加病床信息
    33. */
    34. @RequestMapping(value = "/addBed" ,method = RequestMethod.POST)
    35. @ResponseBody
    36. public String addBed(@RequestBody Bed bed) {
    37. int a = bedService.addBed(bed);
    38. return "bed_list";
    39. }
    40. /**
    41. * 修改信息
    42. */
    43. @RequestMapping( value = "/updateBed", method = RequestMethod.POST)
    44. public String updateBed(Bed bed) {
    45. int a = bedService.updateBed(bed);
    46. return "redirect:/findBed";
    47. }
    48. /**
    49. * 根据Id搜索;
    50. */
    51. @RequestMapping("/findBedById")
    52. public String findBedById(Integer bedId, HttpSession session) {
    53. Bed be2= bedService.findBedById(bedId);
    54. session.setAttribute("be2",be2);
    55. return "bed_edit";
    56. }
    57. /**
    58. * 导出Excel
    59. */
    60. @RequestMapping(value = "/exportBedlist" , method = RequestMethod.POST)
    61. @ResponseBody
    62. public List exportBedlist(){
    63. List beds = bedService.getAll();
    64. return beds;
    65. }
    66. /**
    67. * 部门人员信息查询
    68. */
    69. @RequestMapping(value = "/findRoomT")
    70. public String findRoomT(Room room, Model model) {
    71. List beds = bedService.findRoomT(room);
    72. model.addAttribute("beds",beds);
    73. return "roomT_list";
    74. }
    75. }

    DeptController

    1. package com.xie.controller;
    2. import com.xie.pojo.Dept;
    3. import com.xie.pojo.PageInfo;
    4. import com.xie.pojo.Salary;
    5. import com.xie.service.DeptService;
    6. import org.springframework.beans.factory.annotation.Autowired;
    7. import org.springframework.stereotype.Controller;
    8. import org.springframework.ui.Model;
    9. import org.springframework.web.bind.annotation.RequestBody;
    10. import org.springframework.web.bind.annotation.RequestMapping;
    11. import org.springframework.web.bind.annotation.RequestMethod;
    12. import org.springframework.web.bind.annotation.ResponseBody;
    13. import javax.servlet.http.HttpSession;
    14. import java.util.List;
    15. @Controller
    16. public class DeptController {
    17. @Autowired
    18. private DeptService deptService;
    19. /**
    20. * 分页查询
    21. */
    22. @RequestMapping("/findDept")
    23. public String findDept(String deptNo, String deptName,Integer pageIndex
    24. , Integer pageSize, Model model,HttpSession session){
    25. PageInfo de = deptService.findPageInfo(deptNo,deptName, pageIndex,pageSize);
    26. model.addAttribute("de",de);
    27. session.setAttribute("u",deptNo);
    28. session.setAttribute("t",deptName);
    29. return "Dept_list";
    30. }
    31. /**
    32. * 添加管理员信息
    33. */
    34. @RequestMapping(value = "/addDept" ,method = RequestMethod.POST)
    35. @ResponseBody
    36. public String addDept(@RequestBody Dept dept) {
    37. int a = deptService.addDept(dept);
    38. return "Dept_list";
    39. }
    40. /**
    41. * 修改信息
    42. */
    43. @RequestMapping( value = "/updateDept", method = RequestMethod.POST)
    44. public String updateDept(Dept dept) {
    45. int a = deptService.updateDept(dept);
    46. return "redirect:/findDept";
    47. }
    48. /**
    49. * 根据Id搜索;
    50. */
    51. @RequestMapping("/findDeptById")
    52. public String findDeptById(Integer deptId, HttpSession session) {
    53. Dept de2= deptService.findDeptById(deptId);
    54. session.setAttribute("de2",de2);
    55. return "Dept_edit";
    56. }
    57. /**
    58. * 导出Excel
    59. */
    60. @RequestMapping(value = "/exportDeptlist" , method = RequestMethod.POST)
    61. @ResponseBody
    62. public List exportDept(){
    63. List depts = deptService.getAll();
    64. return depts;
    65. }
    66. /**
    67. * 部门人员信息查询
    68. */
    69. @RequestMapping(value = "/findDeptPersonnel")
    70. public String findClassStudent(Dept dept,Model model, HttpSession session) {
    71. List dep = deptService.findDeptPersonnel(dept);
    72. model.addAttribute("dep",dep);
    73. return "dept_Personnellist";
    74. }
    75. }

    PaitientController

    1. package com.xie.controller;
    2. import com.xie.pojo.*;
    3. import com.xie.service.PaitientService;
    4. import org.springframework.beans.factory.annotation.Autowired;
    5. import org.springframework.stereotype.Controller;
    6. import org.springframework.ui.Model;
    7. import org.springframework.web.bind.annotation.RequestBody;
    8. import org.springframework.web.bind.annotation.RequestMapping;
    9. import org.springframework.web.bind.annotation.RequestMethod;
    10. import org.springframework.web.bind.annotation.ResponseBody;
    11. import javax.servlet.http.HttpSession;
    12. import java.util.List;
    13. @Controller
    14. public class PaitientController {
    15. @Autowired
    16. private PaitientService paitientService;
    17. /**
    18. * 分页查询
    19. */
    20. @RequestMapping("/findPaitient")
    21. public String findPaitient(String paitientId, String paitientName,String paitientGender,Integer pageIndex
    22. , Integer pageSize, Model model,HttpSession session){
    23. PageInfo pa = paitientService.findPageInfo(paitientId,paitientName,paitientGender, pageIndex,pageSize);
    24. model.addAttribute("pa",pa);
    25. session.setAttribute("u",paitientId);
    26. session.setAttribute("t",paitientName);
    27. session.setAttribute("g",paitientGender);
    28. return "paitient_list";
    29. }
    30. /**
    31. * 添加管理员信息
    32. */
    33. @RequestMapping(value = "/addPaitient" ,method = RequestMethod.POST)
    34. @ResponseBody
    35. public String addPaitient(@RequestBody Paitient paitient) {
    36. int a = paitientService.addPaitient(paitient);
    37. return "paitient_list";
    38. }
    39. /**
    40. * 删除仪器信息
    41. */
    42. @RequestMapping( "/deletePaitient")
    43. @ResponseBody
    44. public String deletePaitient(Integer paitientId) {
    45. int a = paitientService.deletePaitient(paitientId);
    46. return "paitient_list";
    47. }
    48. /**
    49. * 修改仪器信息
    50. */
    51. @RequestMapping( value = "/updatePaitient", method = RequestMethod.POST)
    52. public String updatePaitient(Paitient paitient) {
    53. int a = paitientService.updatePaitient(paitient);
    54. return "redirect:/findPaitient";
    55. }
    56. /**
    57. * 根据管理员Id搜索;将请求数据a_id写入参数a_id
    58. */
    59. @RequestMapping("/findPaitientById")
    60. public String findPaitientById(Integer paitientId, HttpSession session) {
    61. Paitient pa2= paitientService.findPaitientById(paitientId);
    62. session.setAttribute("pa2",pa2);
    63. return "paitient_edit";
    64. }
    65. /**
    66. * 导出Excel
    67. */
    68. @RequestMapping(value = "/exportPaitientlist" , method = RequestMethod.POST)
    69. @ResponseBody
    70. public List exportPotion(){
    71. List paitients = paitientService.getAll();
    72. return paitients;
    73. }
    74. /**
    75. * 部门人员信息查询
    76. */
    77. @RequestMapping(value = "/findPP")
    78. public String findPP(Personnel personnel, Model model) {
    79. List paitients = paitientService.findPP(personnel);
    80. model.addAttribute("pas",paitients);
    81. return "PP_list";
    82. }
    83. }

    PersonnelController

    1. package com.xie.controller;
    2. import com.xie.pojo.PageInfo;
    3. import com.xie.pojo.Personnel;
    4. import com.xie.pojo.Potion;
    5. import com.xie.service.PersonnelService;
    6. import org.springframework.beans.factory.annotation.Autowired;
    7. import org.springframework.stereotype.Controller;
    8. import org.springframework.ui.Model;
    9. import org.springframework.web.bind.annotation.RequestBody;
    10. import org.springframework.web.bind.annotation.RequestMapping;
    11. import org.springframework.web.bind.annotation.RequestMethod;
    12. import org.springframework.web.bind.annotation.ResponseBody;
    13. import javax.servlet.http.HttpSession;
    14. import java.util.List;
    15. @Controller
    16. public class PersonnelController {
    17. @Autowired
    18. private PersonnelService personnelService;
    19. /**
    20. * 分页查询
    21. */
    22. @RequestMapping("/findPersonnel")
    23. public String findPersonnel(String empNo, String empName,Integer pageIndex
    24. , Integer pageSize, Model model,HttpSession session){
    25. PageInfo pe = personnelService.findPageInfo(empNo,empName, pageIndex,pageSize);
    26. model.addAttribute("pe",pe);
    27. session.setAttribute("u",empNo);
    28. session.setAttribute("t",empName);
    29. return "personnel_list";
    30. }
    31. /**
    32. * 添加管理员信息
    33. */
    34. @RequestMapping(value = "/addPersonnel" ,method = RequestMethod.POST)
    35. @ResponseBody
    36. public String addPersonnel(@RequestBody Personnel personnel) {
    37. int a = personnelService.addPersonnel(personnel);
    38. return "personnel_list";
    39. }
    40. /**
    41. * 删除仪器信息
    42. */
    43. @RequestMapping( "/deletePersonnel")
    44. @ResponseBody
    45. public String deletePersonnel(Integer empId) {
    46. int a = personnelService.deletePersonnel(empId);
    47. return "personnel_list";
    48. }
    49. /**
    50. * 修改仪器信息
    51. */
    52. @RequestMapping( value = "/updatePersonnel", method = RequestMethod.POST)
    53. public String updatePersonnel(Personnel personnel) {
    54. int a = personnelService.updatePersonnel(personnel);
    55. return "redirect:/findPersonnel";
    56. }
    57. /**
    58. * 根据管理员Id搜索;将请求数据a_id写入参数a_id
    59. */
    60. @RequestMapping("/findPersonnelById")
    61. public String findPersonnelById(Integer empId, HttpSession session) {
    62. Personnel pe2= personnelService.findPersonnelById(empId);
    63. session.setAttribute("pe2",pe2);
    64. return "personnel_edit";
    65. }
    66. /**
    67. * 导出Excel
    68. */
    69. @RequestMapping(value = "/exportPersonnel" , method = RequestMethod.POST)
    70. @ResponseBody
    71. public List exportPersonnel(){
    72. List personnel = personnelService.getAll();
    73. return personnel;
    74. }
    75. }

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

  • 相关阅读:
    [题] 最长连续不重复子序列
    Raft共识算法浅谈
    基于QUBO模型的多体分子对接
    UE5 C++报错:is not currently enabled for Live Coding
    第 363 场 LeetCode 周赛题解
    智能中控屏:产品介绍+未来发展趋势详解
    vue基础
    vue3 setup展示数据
    百度AI智能审核
    Dart:补充
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126757252