基于javaweb+mysql的ssm+maven医院管理系统(java+ssm+layui+maven+mysql+jsp)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven医院管理系统(java+ssm+layui+maven+mysql+jsp)
功能介绍:
基于ssm+layui框架的小型医院后台管理系统。简单实现了病人管理、病床管理、员工管理、部门管理、药品管理、仪器管理等基础功能。 整个项目通过maven方式搭建用到的jar包通过maven导入,前端使用搭建好的Layui框架,拿来即用。后端使用SSM+MySQL,后台逻辑实现了分页、级联、多表查询。目前项目基本完成,可重构与扩展
技术栈:
- SSM框架 - Layui框架 - MySQL 5.7 数据库 - Maven搭建 - MD5加密
实现功能:
- 管理员的登录、退出与切换 - 管理员、仪器、药品、部门、员工、病床、病人各模块增删改查 - 个别模块关联查询 - 各个模块数据导出Excel
@ResponseBody
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
public String addDept(@RequestBody Dept dept) {
int a = deptService.addDept(dept);
return "Dept_list";
}
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()));
int a = tmsService.updateTms(tms);
return "redirect:/findAdmin";
}
}
@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";
}
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) {
/**
* 导出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";
}
}
@Controller
public class BedController {
@Autowired
private BedService bedService;
/**
* 分页查询
*/
@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;
}
}
@Controller
public class PotionController {
@Autowired
private PotionService potionService;
/**
* 分页查询
*/
@RequestMapping("/findPotion")
public String findPotion(String potionNo, String potionName,Integer pageIndex
, Integer pageSize, Model model,HttpSession session){
PageInfo<Potion> po = potionService.findPageInfo(potionNo,potionName, pageIndex,pageSize);
model.addAttribute("po",po);
/**
* 导出Excel
*/
@RequestMapping(value = "/exportPotionlist" , method = RequestMethod.POST)
@ResponseBody
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 = "/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";
}
/**
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(value = "/addPaitient" ,method = RequestMethod.POST)
@ResponseBody
public String addPaitient(@RequestBody Paitient paitient) {
int a = paitientService.addPaitient(paitient);
@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) {
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;
}
}
@Controller
public class PersonnelController {
@Autowired
private PersonnelService personnelService;
/**
* 分页查询
*/
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";
}
}
@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);
}
/**
* 删除仪器信息
*/
@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(){
}
/**
* 部门人员信息查询
*/
@RequestMapping(value = "/findPP")
public String findPP(Personnel personnel, Model model) {
List<Paitient> paitients = paitientService.findPP(personnel);
model.addAttribute("pas",paitients);
return "PP_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
@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";
}
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 "PP_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";
@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";
}
/**
* 添加管理员信息
*/
@RequestMapping(value = "/addAdmin" ,method = RequestMethod.POST)
@ResponseBody