Item No :BS-YL-010

be based on SSM Hospital online reservation and Registration Platform . Front end use layui frame . Divided into administrators , doctor , Three roles of patients , Perfect function . Suitable for practice java
web development , It can also be used as curriculum design and graduation design .

Operating environment

jdk8+tomcat9+mysql+IntelliJ IDEA+maven

Project technology ( Required )

spring+spring mvc+mybatis+layui+jquery

Here are some functions of the system :

Administrator login

My panel : It mainly includes personal information viewing , Change Password , Login log

Doctor management

 

Patient management

Announcement management

Department management

User registration

Patient login

Check my appointments

Patient information management

Appointment physician

Doctor login

View appointment patients

Reception management

Add diagnostic medical record

Medical record management

Personal information management

View hospital announcements

package com.zhang.hospital.service; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.zhang.hospital.dao.AdminDao;
import com.zhang.hospital.dao.MenuDao; import com.zhang.hospital.dao.RoleDao;
import com.zhang.hospital.dao.RoleMenuDao; import com.zhang.hospital.entity.*;
import com.zhang.hospital.util.EncryptUtil; import
com.zhang.hospital.util.ResultUtil; import
org.springframework.beans.factory.annotation.Autowired; import
org.springframework.stereotype.Service; import
org.springframework.transaction.annotation.Transactional; import
java.text.ParseException; import java.util.*; @Service @Transactional public
class AdminServiceImpl implements AdminService { @Autowired private AdminDao
adminDao; @Autowired private RoleMenuDao roleMenuDao; @Autowired private
MenuDao menuDao; @Autowired private RoleDao roleDao; // Sign in @Override public
Admin login(String username, String password) { return
adminDao.login(username,password); } // Record login record @Override public void
insAdminLog(String username, String loginIp, Date loginTime,Date
logoutTime,Integer isSafeExit) {
adminDao.insAdminLog(username,loginIp,loginTime,logoutTime,isSafeExit); }
// according to id query admin @Override public Admin getAdminById(Integer id) { return
adminDao.getAdminById(id); } //*******Menu Some related ***// @Override public
List<Menu> getMenus(Admin admin) { List<Menu> menuList=new ArrayList<>(); Long
roleId=admin.getRoleId(); List<RoleMenu>
roleMenus=roleMenuDao.selMenusByRoleId(roleId); //rolemenu Inside is a middle table Add two fields
roleId, menuId Relate if(roleMenus!=null&&roleMenus.size()>0) { List<Menu>
noChildrenMenus=new ArrayList<>(); for(int i=0;i<roleMenus.size();i++) { Menu
menu=menuDao.getMenuById(roleMenus.get(i).getMenuId()); // obtain rolemenu Medium menuId
noChildrenMenus.add(menu); // According to this lander roleid Take out the menu you have } for(int
i=0;i<noChildrenMenus.size();i++) { if(noChildrenMenus.get(i).getParentId()==0)
// This menu is a first level menu There is no previous menu // If it's not here 0 Indicates that this menu is a secondary menu Or a three-level menu ParentId Which parent menu does it belong to { Menu
menu=new Menu(); menu=noChildrenMenus.get(i); // Take out this first level menu List<Menu> menus=new
ArrayList<>(); for(int j=0;j<noChildrenMenus.size();j++) // Go through all the menus {
// If there is a menu belonging to this first level menu
if(noChildrenMenus.get(j).getParentId()==noChildrenMenus.get(i).getMenuId()) {
Menu menu2=new Menu(); menu2=noChildrenMenus.get(j);// Take out this secondary menu
menus.add(menu2); } } menu.setChildren(menus); // All secondary menus belonging to this primary menu are stored
menuList.add(menu);// It stores all primary menus and all corresponding secondary menus } } } // The following is based on menu of sorting Sort Ascending arrangement
The menus on the left are arranged in ascending order Collections.sort(menuList, new Comparator<Menu>() { @Override
public int compare(Menu o1, Menu o2) { return
o1.getSorting().compareTo(o2.getSorting()); } }); return menuList; } @Override
public ResultUtil getAdminList(Integer page, Integer limit) { //mybatis Paging plug-in
PageHelper.startPage(page,limit); // The default is 1 and 10
// Where paging is required Mybatis Call before method PageHelper.startPage Static method is enough , //
The first one immediately after this method Mybatis The query method is paged . List<Admin> admins=adminDao.getAdminsList();
// Bottom sql Statement is select * from admin order by id // Here because it's sqlserver2012 New features of Paging query
Must add order by // In front startPage The statement of paging query is automatically added // Tomcat Localhost Log An error message will be output
for(Admin admin:admins) { List<Role> roles=roleDao.selRoles();// Remove all roles
for(Role role:roles) { if(role.getRoleId()==admin.getRoleId()) {
admin.setRoleName(role.getRoleName()); // Find out the administrator here roleID Then set the next roleName } } }
PageInfo<Admin> pageInfo=new PageInfo<Admin>(admins); ResultUtil resultUtil=new
ResultUtil(); resultUtil.setCode(0);// The previous reception is 0 On behalf of success
resultUtil.setCount(pageInfo.getTotal());// Represents the total number of entries in the database
resultUtil.setData(pageInfo.getList()); // According to the above startPage Page number of settings How many entries per page Queried data
return resultUtil; } @Override public List<Role> getRoles() { return
roleDao.selRoles(); } @Override public ResultUtil getRoles(Integer page,
Integer limit) { PageHelper.startPage(page,limit); List<Role>
roles=roleDao.selRoles(); PageInfo<Role> pageInfo=new PageInfo<Role>(roles);
ResultUtil resultUtil=new ResultUtil(); resultUtil.setCode(0);
resultUtil.setCount(pageInfo.getTotal());
resultUtil.setData(pageInfo.getList()); return resultUtil; } @Override public
void updAdmin(Admin admin) { adminDao.updAdmin(admin); } @Override public void
delAdminById(Long id) { adminDao.delAdminById(id); } @Override public Admin
getAdminByUsername(String username) { return
adminDao.getAdminByUsername(username); } @Override public void insAdmin(Admin
admin) { admin.setPassword(EncryptUtil.encrypt(admin.getPassword()));// encryption
adminDao.insAdmin(admin); } @Override public void delRole(Long roleId) {
roleDao.delRole(roleId); } @Override public Role getRoleById(Long roleId) {
return roleDao.getRoleById(roleId); } // Show menu according to role @Override public List<Menu>
getXtreeData(Long roleId) { List<Menu> allMenus=menuDao.getAllMenus();
// Get all menus if(!roleId.equals(Long.valueOf("-1")))// no -1 { List<RoleMenu>
roleMenus=roleMenuDao.selMenusByRoleId(roleId); // Select the menu corresponding to this role for(Menu
menu:allMenus) // Traverse all menus { for(RoleMenu roleMenu:roleMenus) {
if(roleMenu.getMenuId()==menu.getMenuId()) { menu.setChecked("true"); // Add all menus
There are menus for this role // Set to true state Front permission tree , The selected status will be reflected //ztree It will check whether there is any in the returned data checked attribute
If yes true This node will be set to the selected state } } } } return allMenus; } @Override public Role
getRoleByRoleName(String roleName) { return
roleDao.getRoleByRoleName(roleName); } @Override public void updRole(Role role,
String m) { roleDao.updateByKey(role);
roleMenuDao.deleteMenusByRoleId(role.getRoleId()); // hold roleId The corresponding menus are deleted
if(m!=null&&m.length()!=0) { String [] result=m.split(","); // Re grant permissions
if(result!=null&&result.length>0) { for(int i=0;i<result.length;i++) { RoleMenu
roleMenu=new RoleMenu(); roleMenu.setMenuId(Long.parseLong(result[i]));
roleMenu.setRoleId(role.getRoleId()); // Insert a piece of data roleMenuDao.insert(roleMenu); }
} } } @Override public void insRole(Role role, String m) {
roleDao.insertRole(role); // Insert a new piece of data Role
role2=roleDao.selectRoleByRoleName(role.getRoleName()); // Read out the newly inserted
if(m!=null&&m.length()!=0) { String [] result=m.split(",");
if(result!=null&&result.length>0) { for(int i=0;i<result.length;i++) { RoleMenu
roleMenu=new RoleMenu(); roleMenu.setMenuId(Long.parseLong(result[i]));
roleMenu.setRoleId(role2.getRoleId()); roleMenuDao.insert(roleMenu); } } } }
@Override public List<Menu> getAllMenus() { return menuDao.getAllMenus(); }
@Override public void updMenuSortingById(Menu menu) { Menu
menu1=menuDao.getMenuById(menu.getMenuId()); // Before updating objects Read it first
menu1.setSorting(menu.getSorting()); // Set new sort menuDao.updateMenuByKey(menu1);
// to update } @Override public Menu getMenuById(Long menuId) { return
menuDao.getMenuById(menuId); } @Override public List<Menu>
checkNameSameLevel(Menu menus) { return menuDao.checkNameSameLevel(menus); }
@Override public void insMenu(Menu menus) { menuDao.insMenu(menus); } @Override
public void updMenu(Menu menus) { menuDao.updateMenu(menus); } @Override public
List<Menu> getMenusByParentId(Long menuId) { return
menuDao.getMenuByParentId(menuId); } @Override public void delMenuById(Long
menuId) { menuDao.delMenuById(menuId); roleMenuDao.deleteMenuByMenuId(menuId);
} @Override public List<RoleMenu> getRoleMenuByMenuId(Long menuId) { return
roleMenuDao.getRoleMenuByMenuId(menuId); } @Override public AdminLog
getAdminLogByUsername(String username) { return
adminDao.getAdminLogByUsername(username); } @Override public void
updateAdminLog(AdminLog adminLog) { adminDao.updateAdminLog(adminLog); }
@Override public AdminLog getAdminLogByLoginTime(Date loginTime) { return
adminDao.getAdminLogByLoginTime(loginTime); } @Override public ResultUtil
getAdminLogList(Integer page, Integer limit) throws ParseException {
List<AdminLog> adminLogList=new ArrayList<>(); // Query with paging sql server in select
Statement must have order by PageHelper.startPage(page,limit); List<AdminLog>
adminLogs=adminDao.getAdminLogsList(); PageInfo<AdminLog> pageInfo=new
PageInfo<>(adminLogs); ResultUtil resultUtil=new ResultUtil();
resultUtil.setCode(0); resultUtil.setCount(pageInfo.getTotal()-1); // The last piece of data is not displayed
// The last login message is not displayed Because it's landing
adminLogList.addAll(pageInfo.getList().subList(0,pageInfo.getList().size()-1));
resultUtil.setData(adminLogList); return resultUtil; } } package
com.zhang.hospital.service; import com.github.pagehelper.PageHelper; import
com.github.pagehelper.PageInfo; import com.zhang.hospital.dao.MenuDao; import
com.zhang.hospital.dao.RoleMenuDao; import com.zhang.hospital.dao.UserDao;
import com.zhang.hospital.entity.*; import com.zhang.hospital.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired; import
org.springframework.stereotype.Service; import
org.springframework.transaction.annotation.Transactional; import
java.util.ArrayList; import java.util.Collections; import java.util.Comparator;
import java.util.List; @Service @Transactional public class UserServiceImpl
implements UserService { @Autowired private UserDao userDao; @Autowired private
RoleMenuDao roleMenuDao; @Autowired private MenuDao menuDao; @Override public
void insUser(User user) { userDao.insUser(user); } @Override public User
login(String username, String password) { return
userDao.login(username,password); } @Override public List<Menu> getMenus(User
user1) { List<Menu> menuList=new ArrayList<>(); Long roleId=user1.getRoleId();
List<RoleMenu> roleMenus=roleMenuDao.selMenusByRoleId(roleId); //rolemenu Is an intermediate table
Two fields roleId menuId Relate if(roleMenus!=null&&roleMenus.size()>0) { List<Menu>
noChildrenMenus=new ArrayList<>(); for(int i=0;i<roleMenus.size();i++) { Menu
menu=menuDao.getMenuById(roleMenus.get(i).getMenuId()); // obtain rolemenu Medium menuId
noChildrenMenus.add(menu); // According to the lander's roleid Take out the menu you have } for(int
i=0;i<noChildrenMenus.size();i++) { if(noChildrenMenus.get(i).getParentId()==0)
// This menu is a first level menu There is no previous menu // If it's not here 0 Indicates that this menu is a secondary menu Or a three-level menu ParentId Which parent menu does it belong to { Menu
menu=new Menu(); menu=noChildrenMenus.get(i); // Take out this first level menu List<Menu> menus=new
ArrayList<>(); for(int j=0;j<noChildrenMenus.size();j++) // Go through all the menus {
// If there is a menu belonging to this first level menu
if(noChildrenMenus.get(j).getParentId()==noChildrenMenus.get(i).getMenuId()) {
Menu menu2=new Menu(); menu2=noChildrenMenus.get(j);// Take out this secondary menu
menus.add(menu2); } } menu.setChildren(menus); // All secondary menus belonging to this primary menu are stored
menuList.add(menu);// It stores all primary menus and all corresponding secondary menus } } } // The following is based on menu of sorting Sort Ascending arrangement
The menus on the left are arranged in ascending order Collections.sort(menuList, new Comparator<Menu>() { @Override
public int compare(Menu o1, Menu o2) { return
o1.getSorting().compareTo(o2.getSorting()); } }); return menuList; } @Override
public User getUserById(Integer user_id) { return userDao.getUserById(user_id);
} @Override public ResultUtil updateUser(User user) { userDao.updateUser(user);
return ResultUtil.ok(); } @Override public User getUsertByUserName(String
username) { return userDao.getUserByUserName(username); } @Override public
ResultUtil getAllUserList(Integer page, Integer limit, UserSearch search) {
PageHelper.startPage(page,limit); List<User>
users=userDao.getAllUserList(search); PageInfo<User> pageInfo=new
PageInfo<>(users); ResultUtil resultUtil=new ResultUtil();
resultUtil.setCode(0); resultUtil.setCount(pageInfo.getTotal());
resultUtil.setData(pageInfo.getList()); return resultUtil; } @Override public
ResultUtil updateUserStatusById(int user_id, int status) {
userDao.updateUserStatusById(user_id,status); return ResultUtil.ok(); }
@Override public ResultUtil deleteUserById(int user_id) {
userDao.deleteUserById(user_id); return ResultUtil.ok(); } }

Technology
©2019-2020 Toolsou All rights reserved,
Redis Underlying data structure A person who dissuades others from learning computer , Are not good people win10 System computer C Where's the disc ,c disc users where? (win10c Disk not found users) Freshman c Language student management system ( lower ) hospital WIFI Which family is strong ? utilize Python Script unlimited spoof girlfriend computer C language program design —— Student management system Byte runout - Test development practice - One side cool meridian python Run code at specified time 5 Best style Linux Server system recommendation Anti anxiety life after naked resignation , I believe everything will have the best arrangement