Java项目:ssm医院管理系统

发布于:2022-12-25 ⋅ 阅读:(556) ⋅ 点赞:(0)

作者主页:夜未央5788

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

文末获取源码

功能介绍

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

技术栈

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

实现功能

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

运行截图

相关代码 

AppartusController

package com.xie.controller;

import com.xie.pojo.Appartus;
import com.xie.pojo.PageInfo;
import com.xie.pojo.Tms;
import com.xie.service.AppartusService;
import com.xie.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class AppartusController {
    @Autowired
    private AppartusService appartusService;

    /**
     * 分页查询
     */
    @RequestMapping("/findAppartus")
    public String findAppartus(String appartusNo, String appartusName,Integer pageIndex
            , Integer pageSize, Model model,HttpSession session){
        PageInfo<Appartus> ap = appartusService.findPageInfo(appartusNo,appartusName, pageIndex,pageSize);
        model.addAttribute("ap",ap);
        session.setAttribute("u",appartusNo);
        session.setAttribute("t",appartusName);
        return "appartus_list";
    }

    /**
     * 添加管理员信息
     */
    @RequestMapping(value = "/addAppartus" ,method = RequestMethod.POST)
    @ResponseBody
    public String addAppartus(@RequestBody Appartus appartus) {
        int a = appartusService.addAppartus(appartus);
        return "admin_list";
    }


    /**
     * 删除仪器信息
     */
    @RequestMapping( "/deleteAppartus")
    @ResponseBody
    public String deleteAdmin(Integer appartusId) {
        int a = appartusService.deleteAppartus(appartusId);
        return "appartus_list";
    }

    /**
     * 修改仪器信息
     */
    @RequestMapping( value = "/updateAppartus", method = RequestMethod.POST)
    public String updateAdmin(Appartus appartus) {
        int a = appartusService.updateAppartus(appartus);
        return "redirect:/findAppartus";
    }


    /**
     * 根据管理员Id搜索;将请求数据a_id写入参数a_id
     */
    @RequestMapping("/findAppartusById")
    public String findAppartusById(Integer appartusId, HttpSession session) {
        Appartus ap2= appartusService.findAppartusById(appartusId);
        session.setAttribute("ap2",ap2);
        return "appartus_edit";
    }


    /**
     * 导出Excel
     */
    @RequestMapping(value = "/exportAppartuslist" , method = RequestMethod.POST)
    @ResponseBody
    public List<Appartus> exportAdmin(){
        List<Appartus> appartus = appartusService.getAll();
        return appartus;
    }
}

BedController

package com.xie.controller;

import com.xie.pojo.Bed;
import com.xie.pojo.PageInfo;
import com.xie.pojo.Room;
import com.xie.service.BedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;

@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";
    }

    /**
     * 添加病床信息
     */
    @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(value = "/findRoomT")
    public String findRoomT(Room room, Model model) {
        List<Bed> beds = bedService.findRoomT(room);
        model.addAttribute("beds",beds);
        return "roomT_list";
    }
}

DeptController

package com.xie.controller;

import com.xie.pojo.Dept;
import com.xie.pojo.PageInfo;
import com.xie.pojo.Salary;
import com.xie.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;

@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
    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
     */
    @RequestMapping(value = "/exportDeptlist" , method = RequestMethod.POST)
    @ResponseBody
    public List<Dept> exportDept(){
        List<Dept> depts = deptService.getAll();
        return depts;
    }


    /**
     * 部门人员信息查询
     */
    @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";
    }

}

PaitientController

package com.xie.controller;

import com.xie.pojo.*;
import com.xie.service.PaitientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;

@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(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);
        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) {
        List<Paitient> paitients = paitientService.findPP(personnel);
        model.addAttribute("pas",paitients);
        return "PP_list";
    }
}

PersonnelController

package com.xie.controller;

import com.xie.pojo.PageInfo;
import com.xie.pojo.Personnel;
import com.xie.pojo.Potion;
import com.xie.service.PersonnelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 javax.servlet.http.HttpSession;
import java.util.List;

@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);
        return "personnel_list";
    }

    /**
     * 删除仪器信息
     */
    @RequestMapping( "/deletePersonnel")
    @ResponseBody
    public String deletePersonnel(Integer empId) {
        int a = personnelService.deletePersonnel(empId);
        return "personnel_list";
    }


    /**
     * 修改仪器信息
     */
    @RequestMapping( value = "/updatePersonnel", method = RequestMethod.POST)
    public String updatePersonnel(Personnel personnel) {
        int a = personnelService.updatePersonnel(personnel);
        return "redirect:/findPersonnel";
    }

    /**
     * 根据管理员Id搜索;将请求数据a_id写入参数a_id
     */
    @RequestMapping("/findPersonnelById")
    public String findPersonnelById(Integer empId, HttpSession session) {
        Personnel pe2= personnelService.findPersonnelById(empId);
        session.setAttribute("pe2",pe2);
        return "personnel_edit";
    }



    /**
     * 导出Excel
     */
    @RequestMapping(value = "/exportPersonnel" , method = RequestMethod.POST)
    @ResponseBody
    public List<Personnel> exportPersonnel(){
        List<Personnel> personnel = personnelService.getAll();
        return personnel;
    }
}

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


网站公告

今日签到

点亮在社区的每一天
去签到