基于javaweb+mysql的springboot体检管理系统(java+springboot+thymeleaf+layui+html+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot体检管理系统(java+springboot+thymeleaf+layui+html+mysql)
分为:管理员、医生、体检人
体检人预约-管理员审核-医生问诊
项目介绍:
登录、注册、用户管理、角色管理、体检人管理、体检健康史、体检人档案、体检中心管理
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:是;
技术栈
JSP +SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目
/**
* 管理员权限控制类
*/
@Controller("Admin")
@RequestMapping("/admin")
public class Adminontroller {
@Autowired
private PageService pageService;
@Autowired
private RoleService roleService;
@Autowired
private PageRoleService pageRoleService;
@Autowired
private UserRoleService userRoleService;
@Autowired
private UserService userService;
private final Logger logger = LoggerFactory.getLogger(Adminontroller.class);
/**
* Method name: page <BR>
* Description: 跳转到页面设置页面 <BR>
*
* @param model
* @return String<BR>
*/
@RequestMapping("/page")
public String page(Model model) {
List<Page> pageList = pageService.getAllPage();
model.addAttribute("pageList", pageList);
return "sa/page";
}
/**
* Method name: role <BR>
* Description: 跳转到角色设置页面 <BR>
*
* @param model
* @return String<BR>
*/
@RequestMapping("/role")
}else {
model.addAttribute("petId", "petId");
}
return "user/petDailyListDoctor";
}
/**
* 普通用户体检日志页面user/petDailyList.html
*/
@RequestMapping("/petDailyList")
public String petDailyList(Long petId, Model model) {
if (petId!=null){
model.addAttribute("petId", petId);
}else {
model.addAttribute("petId", "petId");
}
return "user/petDailyList";
}
/**
* 普通用户返回查询数据
*/
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(PetDaily pojo) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
pojo.setUserId(user.getId());
return petDailyService.getAllByLimit(pojo);
}
/**
* 医生返回查询数据
*/
@RequestMapping("/getAllByLimitDoctor")
@ResponseBody
public Object getAllByLimitDoctor(PetDaily pojo) {
return petDailyService.getAllByLimit(pojo);
}
/**
* 删除
*/
@RequestMapping(value = "/del")
@ResponseBody
@Transactional
public String del(Long id) {
try {
petDailyService.deleteById(id);
return "SUCCESS";
User user = userService.selectByPrimaryKey(userId);
model.addAttribute("manageUser", user);
}
return "sa/userAdd";
}
/**
* Method name: checkUserId <BR>
* Description: 检测用户账号是否存在 <BR>
*
* @param userId
* @return User<BR>
*/
@ResponseBody
@RequestMapping("/checkUserId")
public User checkUserId(Long userId) {
return userService.selectByPrimaryKey(userId);
}
/**
* Method name: addUser <BR>
* Description: 用户添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addUser")
public String addUser(User user) {
try {
user.setPassword(MD5.md5(user.getPassword()));
user.setCreateTime(new Date());
userService.addUser(user);
User u = userService.getUserByPhoneAndName(user.getPhone(), user.getName());
String[] ids = new String[1];
ids[0] = u.getId()+"";
// 医生角色
userRoleService.addUserRole(3, ids);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
* Method name: addUser <BR>
* Description: 用户添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addUser")
public String addUser(User user) {
try {
user.setPassword(MD5.md5(user.getPassword()));
user.setCreateTime(new Date());
userService.addUser(user);
User u = userService.getUserByPhoneAndName(user.getPhone(), user.getName());
String[] ids = new String[1];
ids[0] = u.getId()+"";
// 医生角色
userRoleService.addUserRole(3, ids);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateUser <BR>
* Description: 更新用户 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateUser")
public String updateUser(User user, Long oldId) {
return userService.updateUser(oldId, user);
}
/**
* Method name: delUserPage <BR>
* Description: 已删除用户列表 <BR>
*
* @return String<BR>
*/
user.setPassword(MD5.md5(user.getPassword()));
user.setCreateTime(new Date());
userService.addUser(user);
User u = userService.getUserByPhoneAndName(user.getPhone(), user.getName());
String[] ids = new String[1];
ids[0] = u.getId()+"";
// 医生角色
userRoleService.addUserRole(3, ids);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateUser <BR>
* Description: 更新用户 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateUser")
public String updateUser(User user, Long oldId) {
return userService.updateUser(oldId, user);
}
/**
* Method name: delUserPage <BR>
* Description: 已删除用户列表 <BR>
*
* @return String<BR>
*/
@RequestMapping("/delUserPage")
public String delUserPage() {
return "sa/userDelPage";
}
}
/**
* Method name: updateRole <BR>
* Description: 根据权限id修改权限信息 <BR>
*
* @param id
* @param name
* @return String<BR>
*/
@RequestMapping("/updateRole")
@ResponseBody
public String updateRole(Integer id, String name) {
int n = roleService.updateRoleById(id, name);
if (n != 0) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: addPageRoleByRoleId <BR>
* Description: 增加某个角色的权限页面 <BR>
*
* @param roleId
* @param pageIds
* @return String<BR>
*/
@RequestMapping("/addPageRoleByRoleId")
@ResponseBody
public String addPageRoleByRoleId(Integer roleId, Integer[] pageIds) {
if (null == roleId) {
return "ERROR";
}
// 先删除老的权限
boolean flag1 = pageRoleService.delPageRoleByRoleId(roleId);
boolean flag2 = pageRoleService.addPageRoles(roleId, pageIds);
if (flag1 && flag2) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Description: 用户管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userPage")
public String userPage() {
return "sa/userList";
}
/**
* Method name: getAllUserByLimit <BR>
* Description: 根据条件获取所有用户 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllUserByLimit")
@ResponseBody
public Object getAllUserByLimit(UserParameter userParameter) {
return userService.getAllUserByLimit(userParameter);
}
/**
* Method name: getAllDelUserByLimit <BR>
* Description: 获取所有删除用户 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllDelUserByLimit")
@ResponseBody
public Object getAllDelUserByLimit(UserParameter userParameter) {
return userService.getAllDelUserByLimit(userParameter);
}
/**
* Method name: delUser <BR>
* Description: 批量删除用户 <BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delUser")
@ResponseBody
@RequestMapping(value = "/doAdd")
@ResponseBody
@Transactional
public String doAdd(Pet pojo) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
pojo.setUserId(user.getId());
pojo.setCreateTime(new Date());
petService.add(pojo);
return "SUCCESS";
} catch (Exception e) {
logger.error("添加异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
}
/**
* 监控标准
*/
@Controller("UserStandardController")
@RequestMapping("/user/standard")
public class UserStandardController {
@Autowired
private StandardService standardService;
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 医生列表页面user/standardListDoctor.html
*/
/**
* 登录控制类
*/
@Controller("OpenLogin")
@RequestMapping()
public class LoginController {
@Autowired
private ResultMap resultMap;
@Autowired
private UserService userService;
@Autowired
private PageService pageService;
@Autowired
private UserRoleService userRoleService;
private final Logger logger = LoggerFactory.getLogger(LoginController.class);
/**
* 返回 尚未登陆信息
*/
@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
@ResponseBody
public ResultMap notLogin() {
logger.warn("尚未登陆!");
return resultMap.success().message("您尚未登陆!");
}
/**
* 返回 没有权限
*/
@RequestMapping(value = "/notRole", method = RequestMethod.GET)
@ResponseBody
public ResultMap notRole() {
Subject subject = SecurityUtils.getSubject();
Integer a2 = 0;
Integer a3 = 0;
Integer a4 = 0;
for (Appointment a: rows){
switch (a.getStatus()){
case 1: a1++;break;
case 2: a2++;break;
case 3: a3++;break;
case 4: a4++;break;
}
}
model.addAttribute("a1", a1);
model.addAttribute("a2", a2);
model.addAttribute("a3", a3);
model.addAttribute("a4", a4);
return "tj/tjApply";
}
/**
* 医生预约统计
*/
@RequestMapping("/tjApplyDoctor")
public String tjApplyDoctor(Model model) {
Appointment appointment = new Appointment();
appointment.setPage(1);
appointment.setLimit(99999);
MMGridPageVoBean<Appointment> voBean = (MMGridPageVoBean<Appointment>) appointmentService.getAllByLimit(appointment);
List<Appointment> rows = voBean.getRows();
Integer a1 = 0;
Integer a2 = 0;
Integer a3 = 0;
Integer a4 = 0;
for (Appointment a: rows){
switch (a.getStatus()){
case 1: a1++;break;
case 2: a2++;break;
case 3: a3++;break;
case 4: a4++;break;
}
}
model.addAttribute("a1", a1);
model.addAttribute("a2", a2);
model.addAttribute("a3", a3);
model.addAttribute("a4", a4);
return "tj/tjApplyDoctor";
}
/**
* 普通用户体检日志统计
*/
return "user/petDailyAdd";
}
/**
* 插入数据库
*/
@RequestMapping(value = "/doAdd")
@ResponseBody
@Transactional
public String doAdd(PetDaily pojo) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
pojo.setUserId(user.getId());
pojo.setCreateTime(new Date());
petDailyService.add(pojo);
return "SUCCESS";
} catch (Exception e) {
logger.error("添加异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
}
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: addPageRoleByRoleId <BR>
* Description: 增加某个角色的权限页面 <BR>
*
* @param roleId
* @param pageIds
* @return String<BR>
*/
@RequestMapping("/addPageRoleByRoleId")
@ResponseBody
public String addPageRoleByRoleId(Integer roleId, Integer[] pageIds) {
if (null == roleId) {
return "ERROR";
}
// 先删除老的权限
boolean flag1 = pageRoleService.delPageRoleByRoleId(roleId);
boolean flag2 = pageRoleService.addPageRoles(roleId, pageIds);
if (flag1 && flag2) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: getAllUserByMap <BR>
* Description: 根据角色查询下面所有的人员/非角色下所有人员 <BR>
*/
@RequestMapping("/getAllUserByRoleId")
@ResponseBody
public Object getAllUserByRoleId(Integer roleId, String roleNot, Integer page, Integer limit) {
if (null == roleNot) {
return userService.getAllUserByRoleId(roleId, page, limit);
}
return userService.getAllUserByNotRoleId(roleId, page, limit);
}
/**
* Method name: delUserRoleByUserIdAndRoleId <BR>
* Description: 根据用户id权限id删除用户权限表 <BR>
*
* @param userId
* @param roleId
* @return ResultMap<BR>
@Autowired
private PageService pageService;
@Autowired
private UserRoleService userRoleService;
private final Logger logger = LoggerFactory.getLogger(LoginController.class);
/**
* 返回 尚未登陆信息
*/
@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
@ResponseBody
public ResultMap notLogin() {
logger.warn("尚未登陆!");
return resultMap.success().message("您尚未登陆!");
}
/**
* 返回 没有权限
*/
@RequestMapping(value = "/notRole", method = RequestMethod.GET)
@ResponseBody
public ResultMap notRole() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (user != null) {
logger.info("{}---没有权限!", user.getName());
}
return resultMap.success().message("您没有权限!");
}
/**演示页面**/
@RequestMapping(value = "/demo/table", method = RequestMethod.GET)
public String demoTable() {
return "table";
}
@RequestMapping(value = "/demo/tu", method = RequestMethod.GET)
public String demoTu() {
return "tu";
}
@RequestMapping(value = "/demo/tu1", method = RequestMethod.GET)
public String tu1() {
return "tu1";
}
@RequestMapping(value = "/demo/tu2", method = RequestMethod.GET)
public String tu2() {
return "tu2";
}
mt.add(tsMax);
mw.add(wsMax);
mh.add(hsMax);
ma.add(asMax);
if (t>=tsMin && t<=tsMax){
tsCount.add(" 体温正常");
}else if (t<tsMin){
tsCount.add( " 体温偏低");
}else if (t>tsMax){
tsCount.add( " 体温偏高");
}
if (w>=wsMin && w<=wsMax){
wsCount.add( " 体重正常");
}else if (w<wsMin){
wsCount.add(" 体重偏低");
}else if (w>wsMax){
wsCount.add(" 体重偏高");
}
if (h>=hsMin && h<=hsMax){
hsCount.add(" 身高正常");
}else if (h<hsMin){
hsCount.add( " 身高偏低");
}else if (h>hsMax){
hsCount.add(" 身高偏高");
}
if (a>=asMin && a<=asMax){
asCount.add( " 饭量正常");
}else if (a<asMin){
asCount.add(" 饭量偏低");
}else if (a>asMax){
asCount.add(" 饭量偏高");
}
}
model.addAttribute("pets", rows);
model.addAttribute("tsCount", tsCount);
model.addAttribute("wsCount", wsCount);
model.addAttribute("hsCount", hsCount);
model.addAttribute("asCount", asCount);
model.addAttribute("dsCount", dsCount);
System.out.println(pt);
model.addAttribute("pt", pt);
model.addAttribute("ph", ph);
model.addAttribute("pw", pw);
model.addAttribute("pa", pa);
model.addAttribute("mt", mt);
model.addAttribute("mh", mh);
model.addAttribute("mw", mw);
model.addAttribute("value", value);
return "tj/freeTime";
}
@RequestMapping(value = "/getFreeTime")
@ResponseBody
public Object getFreeTime(Long id, String date) {
User doctors = userService.selectByPrimaryKey(id);
Map<String, Object> result = new HashMap<>();
result.put("n", doctors.getName());
List<Map<String, Object>> map = appointmentService.getFreeTimeById(id, date+MyUtils.START_HOUR);
List<String> time = new ArrayList<>();
List<Long> value = new ArrayList<>();
for (Map<String, Object> m : map){
String df = (String) m.get("df");
time.add(df+"点");
Long v = (Long) m.get("c");
if (v == null) {
value.add(0L);
}else {
value.add(v);
}
}
result.put("t", time);
result.put("v", value);
return result;
}
}
return "SUCCESS";
} catch (Exception e) {
logger.error("添加异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
}
/**
* 监控标准
*/
@Controller("UserStandardController")
@RequestMapping("/user/standard")
public class UserStandardController {
@Autowired
private StandardService standardService;
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 医生列表页面user/standardListDoctor.html
*/
@RequestMapping("/standardListDoctor")
public String standardListDoctor() {
return "user/standardListDoctor";
}
/**
* 普通用户页面user/standardList.html
@RequestMapping("/delUserRoleByUserIdAndRoleId")
@ResponseBody
public ResultMap delUserRoleByUserIdAndRoleId(String userId, Integer roleId) {
return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
}
/**
* Method name: selectUserRole <BR>
* Description: 跳转到选择用户角色页面 <BR>
*
* @return String<BR>
*/
@RequestMapping("/selectUserRole")
public String selectUserRole() {
return "sa/selectUserRole";
}
/**
* Method name: addUserRole <BR>
* Description: 增加用户的角色 <BR>
*
* @param roleId
* @param userIds
* @return String<BR>
*/
@RequestMapping("/addUserRole")
@ResponseBody
public String addUserRole(Integer roleId, String[] userIds) {
return userRoleService.addUserRole(roleId, userIds);
}
/**
* Method name: userAddPage <BR>
* Description: 用户添加页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userAddPage")
public String userAddPage() {
return "sa/userAdd";
}
/**