基于javaweb的SpringBoot医院管理系统(java+springboot+layui+freemaker+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

260023122402

280023122402

290023122402

300023122402

310023122402

320023122402

330023122402

基于javaweb的SpringBoot医院管理系统(java+springboot+layui+freemaker+maven+mysql)

项目介绍

医院管理系统,分为管理员、医生、病人三种角色;

管理员主要功能包括: 首页、系统管理:医生管理、患者管理、药品管理;预约管理;病史管理;住院信息管理;管理员用户管理; 医生主要功能包括:首页、就医/查看病史;

病人主要功能包括:首页、病史、住院信息、挂号;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;

技术栈

  1. 后端:SpringBoot

  2. 前端:Layui+Freemaker

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

  2. 使用IDEA/Eclipse/MyEclipse导入项目

  3. 将项目中application.yml配置文件中的数据库配置改为自己的配置然后运行;

  4. 运行项目,输入http://localhost:8088 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
        //设置日期格式
HSSFCellStyle style = workbook.createCellStyle();
style.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));

//新增数据行,并且设置单元格数据
int rowNum=1;
for(Hospitalization hospitalization:rows){
HSSFRow row = sheet.createRow(rowNum);
row.createCell(0).setCellValue(rowNum);
row.createCell(1).setCellValue(hospitalization.getFloor());
row.createCell(2).setCellValue(hospitalization.getBed());
row.createCell(3).setCellValue(hospitalization.getDoor());
row.createCell(4).setCellValue(hospitalization.getMedicalname());
row.createCell(5).setCellValue(hospitalization.getPatientname());
HSSFCell cell1 = row.createCell(6);
HSSFCell cell2 = row.createCell(7);
cell1.setCellValue(hospitalization.getIntime()==null?"": DateUtils.date2String(hospitalization.getIntime()));
cell2.setCellValue(hospitalization.getOuttime() == null?"":DateUtils.date2String(hospitalization.getOuttime()));
cell1.setCellStyle(style);
cell2.setCellStyle(style);
rowNum++;
}

String fileName = "住院信息.xls";

//生成excel文件
//ExcelUtils.buildExcelFile(fileName, workbook);

//浏览器下载excel
ExcelUtils.buildExcelDocument(fileName,workbook,response);

return "download excel";
}
}
package com.gbq.hospital.controller;



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
        String password = new String((char[]) authenticationToken.getCredentials());
Login user = loginMapper.findByUsername(username);

//验证登录账号
if (user == null) {
throw new UnknownAccountException("用户名不存在");
}
//验证密码
if(!StringUtils.equals(user.getPassword(), password)){
throw new UnknownAccountException("密码错误,请重新输入");
}

//把登录人存进session
SecurityUtils.getSubject().getSession().setAttribute("currentManager", user);
return new SimpleAuthenticationInfo(user, password, this.getName());
}

}
package com.gbq.hospital.config.shiro;



/**
*/
public class MySessionManager extends DefaultWebSessionManager {

public static final String AUTHORIZATION = "token";

public static final String REFERENCED_SESSION_ID_SOURCE = "Stateless request";

public MySessionManager() {
super();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
            result.put("status",-1);
httpServletResponse.getWriter().write(JSONObject.toJSON(result).toString());
}/* else {
*//**
* @Mark 非ajax请求重定向为登录页面
*//*
httpServletResponse.sendRedirect("/gbq_blog/login/noLogin");
}*/
return false;
}

private boolean isAjax(ServletRequest request) {
String header = ((HttpServletRequest) request).getHeader("X-Requested-With");
return "XMLHttpRequest".equalsIgnoreCase(header);
}

}
package com.gbq.hospital.config.shiro;




/**
*/
public class MyShiroRealm extends AuthorizingRealm{

@Autowired
private LoginMapper loginMapper;
@Autowired
private HttpServletRequest request;

@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
return null;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
        for(Hospitalization hospitalization:rows){
HSSFRow row = sheet.createRow(rowNum);
row.createCell(0).setCellValue(rowNum);
row.createCell(1).setCellValue(hospitalization.getFloor());
row.createCell(2).setCellValue(hospitalization.getBed());
row.createCell(3).setCellValue(hospitalization.getDoor());
row.createCell(4).setCellValue(hospitalization.getMedicalname());
row.createCell(5).setCellValue(hospitalization.getPatientname());
HSSFCell cell1 = row.createCell(6);
HSSFCell cell2 = row.createCell(7);
cell1.setCellValue(hospitalization.getIntime()==null?"": DateUtils.date2String(hospitalization.getIntime()));
cell2.setCellValue(hospitalization.getOuttime() == null?"":DateUtils.date2String(hospitalization.getOuttime()));
cell1.setCellStyle(style);
cell2.setCellStyle(style);
rowNum++;
}

String fileName = "住院信息.xls";

//生成excel文件
//ExcelUtils.buildExcelFile(fileName, workbook);

//浏览器下载excel
ExcelUtils.buildExcelDocument(fileName,workbook,response);

return "download excel";
}
}
package com.gbq.hospital.controller;



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@ResponseBody
public JSONObject upAdmin(@RequestBody Login login){
JSONObject json=new JSONObject();
json.put("message",loginService.updateAdmin(login));
return json;
}
@RequestMapping(value = "/admin/admin/{id}",method = RequestMethod.DELETE)
@ResponseBody
public JSONObject delAdmin(@PathVariable Integer id){
JSONObject json=new JSONObject();
json.put("message",loginService.delAdmin(id));
return json;
}
@RequestMapping(value = "/loginout",method = RequestMethod.GET)
public String loginout(HttpSession session){
session.removeAttribute("login");
return "login&regist";
}
@RequestMapping(value = "/login",method = RequestMethod.POST)
@ResponseBody
public JSONObject login(@RequestBody Login login,HttpSession session){
// 生成登录验证用到的token对象
UsernamePasswordToken token = new UsernamePasswordToken(login.getUsername(), login.getPassword());
Subject subject = SecurityUtils.getSubject();

//登录验证
subject.login(token);


String login1 = loginService.login(login);

JSONObject json=new JSONObject();
json.put("message",login1);
session.setAttribute("login",login);
return json;
}
@RequestMapping(value = "/regest",method = RequestMethod.POST)
@ResponseBody
public JSONObject regest(@RequestBody Login login){
JSONObject json=new JSONObject();
json.put("message",loginService.regist(login));
return json;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@Autowired
PatientService patientService;
@RequestMapping("/admin/appointmentManage")
public String appointmentManage(HttpServletRequest request,@RequestParam(value = "doctorname",required = false)String doctorname,@RequestParam(value = "patientname",required = false)String patientname){
List<Appointment> appointmentList=appointmentService.getAllAppointments(doctorname,patientname);
request.setAttribute("appointments" ,appointmentList);
return"admin/appointmentManage";
}
@RequestMapping("/admin/appointmentAdd")
public String appointmentAddPage(HttpServletRequest request){
request.setAttribute("patients",patientService.getAllPatients());
//request.setAttribute("doctors",doctorService.getAllDoctor());
return"admin/add/appointmentadd";
}
@RequestMapping(value = "/admin/appointment/{id}",method = RequestMethod.DELETE)
@ResponseBody
public JSONObject delAppointment(@PathVariable Integer id){
JSONObject json=new JSONObject();
json.put("message",appointmentService.delAppointment(id));
return json;
}
@RequestMapping(value = "/admin/appointment/{id}",method = RequestMethod.GET)
public String AppointmentInfo(@PathVariable Integer id,HttpServletRequest request){
request.setAttribute("patients",patientService.getAllPatients());
request.setAttribute("doctors",doctorService.getAllDoctor());
request.setAttribute("appointment",appointmentService.getAppointment(id));
return "admin/info/appointmentInfo";
}
@RequestMapping(value = "/admin/appointment",method = RequestMethod.PUT)
@ResponseBody
public JSONObject AppointmentUpdate(@RequestBody Appointment appointment){
JSONObject json=new JSONObject();
json.put("message",appointmentService.UpdateAppointment(appointment));
return json;
}
@RequestMapping(value = "/admin/appointment",method = RequestMethod.POST)
@ResponseBody
public JSONObject AppointmentAdd(@RequestBody Appointment appointment){
System.out.println(appointment);
JSONObject json=new JSONObject();
json.put("message",appointmentService.addAppointment(appointment));
return json;
}


项目链接:
https://javayms.github.io?id=261422272105200ax
https://javayms.pages.dev?id=261422272105200ax