一、系统介绍
1.开发环境
开发工具:IDEA2018.2
JDK版本:jdk1.8
Mysql版本:8.0.13
2.技术选型
后端:Java+Struts+Spring+Hibernate进行开发。
前端:JSP+HTML+CSS。
3.系统功能
医院挂号系统主要用于实现医院的挂号
前台基本功能包括:用户注册、用户登录、医院查询、挂号、取消挂号、修改个人信息、退出等。
后台基本功能包括:系统管理员登录、医院管理、科室管理、公告管理、退出系统等。
本系统结构如下:
1.前台功能
用户注册:注册功能;
用户登录:登录功能;
医院查询:选择医院、科室查询该医院下的医生信息
挂号:选择医生后点击挂号,填写信息完成挂号
管理中心:点击管理中心可以修改个人信息、取消挂号
2.系统管理员
登录模块:实现管理员登录功能;
医院管理模块:实现医院的增加、删除功能;
科室管理模块:实现科室的增加、删除功能;
公告管理模块:实现公告的增加、删除功能;
退出系统模块:实现用户的退出功能;
4.数据库
/* Navicat Premium Data Transfer Source Server : MySQL Source Server Type : MySQL Source Server Version : 80013 Source Host : 127.0.0.1:3306 Source Schema : ssh_hospital_registration Target Server Type : MySQL Target Server Version : 80013 File Encoding : 65001 Date: 11/08/2021 23:31:01 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for t_admin -- ---------------------------- DROP TABLE IF EXISTS `t_admin`; CREATE TABLE `t_admin` ( `userId` int(11) NOT NULL, `userName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `userPw` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`userId`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_admin -- ---------------------------- INSERT INTO `t_admin` VALUES (1, 'admin', 'admin'); -- ---------------------------- -- Table structure for t_gonggao -- ---------------------------- DROP TABLE IF EXISTS `t_gonggao`; CREATE TABLE `t_gonggao` ( `id` int(11) NOT NULL, `biaoti` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `neirong` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `shijian` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_gonggao -- ---------------------------- INSERT INTO `t_gonggao` VALUES (1, '疫情防控公告', '针对国内外疫情防控形势的新变化,为贯彻落实常态化疫情防控工作中“外防输入、内防反弹”的要求,进一步强化医院感染防控的各项措施,最大限度地降低院内感染发生风险,切实保障人民群众的健康和安全', '2021-08-11 21:20'); INSERT INTO `t_gonggao` VALUES (2, '关于感染科门诊搬迁的通知', '我院感染科门诊现已搬至3号楼2楼(该门诊候诊区有独立的自助挂号收费系统),请从西边楼梯上二楼,由此给您带来的不便,敬请谅解!', '2021-08-11 21:20'); -- ---------------------------- -- Table structure for t_guahao -- ---------------------------- DROP TABLE IF EXISTS `t_guahao`; CREATE TABLE `t_guahao` ( `id` int(11) NOT NULL DEFAULT 0, `zhuanjiaId` int(11) NULL DEFAULT NULL, `userId` int(11) NULL DEFAULT NULL, `riqi` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `jibing` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `xingming` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `lianxi` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_guahao -- ---------------------------- INSERT INTO `t_guahao` VALUES (1, 2, 1, '2021-08-12', '1', '1', '1'); INSERT INTO `t_guahao` VALUES (2, 2, 2, '2021-08-12', '1', '1', '1'); -- ---------------------------- -- Table structure for t_keshi -- ---------------------------- DROP TABLE IF EXISTS `t_keshi`; CREATE TABLE `t_keshi` ( `keshi_id` int(11) NOT NULL, `keshi_anme` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `del` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`keshi_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_keshi -- ---------------------------- INSERT INTO `t_keshi` VALUES (2, '内科', 'no'); INSERT INTO `t_keshi` VALUES (3, '外科', 'no'); INSERT INTO `t_keshi` VALUES (4, '胸科', 'no'); INSERT INTO `t_keshi` VALUES (5, '骨科', 'no'); -- ---------------------------- -- Table structure for t_user -- ---------------------------- DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `user_id` int(11) NOT NULL, `user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `user_pw` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `user_realname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `user_address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `user_tel` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `user_email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `user_del` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`user_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_user -- ---------------------------- INSERT INTO `t_user` VALUES (1, 'liusan', '000000', '刘三', '北京路1', '13444444444', 'liusan@163.com', 'no'); INSERT INTO `t_user` VALUES (2, 'zhangsan', '000000', '张三', '湖北武汉', '123456', '123456@qq.com', 'no'); -- ---------------------------- -- Table structure for t_yiyuan -- ---------------------------- DROP TABLE IF EXISTS `t_yiyuan`; CREATE TABLE `t_yiyuan` ( `id` int(11) NOT NULL, `mingcheng` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `dizhi` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `dianhua` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `del` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_yiyuan -- ---------------------------- INSERT INTO `t_yiyuan` VALUES (2, '北京大学第三医院 ', '海淀区花园北路49号', '010-82266699', 'no'); INSERT INTO `t_yiyuan` VALUES (3, '阜外心血管病医院', '西城区北礼士路167号', '010-88398866', 'no'); INSERT INTO `t_yiyuan` VALUES (4, '北京大学人民医院', '西城区西直门南大街', '010-66583666', 'no'); INSERT INTO `t_yiyuan` VALUES (5, '1', '1', '1', 'yes'); -- ---------------------------- -- Table structure for t_zhuanjia -- ---------------------------- DROP TABLE IF EXISTS `t_zhuanjia`; CREATE TABLE `t_zhuanjia` ( `id` int(11) NOT NULL DEFAULT 0, `yiyuanId` int(11) NULL DEFAULT NULL, `keshiId` int(11) NULL DEFAULT NULL, `xingming` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `xingbie` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `nianling` int(11) NULL DEFAULT NULL, `shanchang` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `leixing` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `fujian` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `del` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_zhuanjia -- ---------------------------- INSERT INTO `t_zhuanjia` VALUES (2, 2, 2, '王晓光', '男', 40, '各类心脑血管各类疾病病', '专家门诊', '/upload/1362249942828.jpg', 'no'); INSERT INTO `t_zhuanjia` VALUES (3, 2, 2, '张大海', '男', 40, '各类心血管外科各种疾病', '专家门诊', '/upload/1362250001253.jpg', 'no'); INSERT INTO `t_zhuanjia` VALUES (4, 2, 2, '刘莉莉', '男', 52, '各类口腔科疾病药到病除', '普通门诊', '/upload/1362250044364.jpg', 'no'); SET FOREIGN_KEY_CHECKS = 1;
5.工程截图
二、系统展示
1.前台-系统首页
2.前台-医生查询
3.前台-公告信息
4.前台-用户注册
5.用户-主页
6.用户-修改信息
7.用户-挂号信息
8.管理员-登录
9.管理员-主页
10.管理员-修改密码
11.管理员-医院信息管理
12.管理员-科室信息管理
13.管理员-医生信息管理
14.管理员-会员信息管理
15.管理员-系统公告管理
三、部分代码
gonggaoAction
package com.action; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; import org.apache.struts2.ServletActionContext; import com.dao.TGonggaoDAO; import com.model.TAdmin; import com.model.TGonggao; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class gonggaoAction extends ActionSupport { private Integer id; private String biaoti; private String neirong; private String shijian; private String message; private String path; private TGonggaoDAO gonggaoDAO; public String gonggaoAdd() { TGonggao gonggao = new TGonggao(); gonggao.setBiaoti(biaoti); gonggao.setNeirong(neirong); gonggao.setShijian(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date())); gonggaoDAO.save(gonggao); this.setMessage("公告添加完毕"); this.setPath("gonggaoMana.action"); return "succeed"; } public String gonggaoMana() { List gonggaoList = gonggaoDAO.findAll(); Map request = (Map) ServletActionContext.getContext().get("request"); request.put("gonggaoList", gonggaoList); return ActionSupport.SUCCESS; } public String gonggaoDel() { TGonggao gonggao = gonggaoDAO.findById(id); gonggaoDAO.delete(gonggao); this.setMessage("公告删除完毕"); this.setPath("gonggaoMana.action"); return "succeed"; } public String gonggaoDetailHou() { TGonggao gonggao = gonggaoDAO.findById(id); Map request = (Map) ServletActionContext.getContext().get("request"); request.put("gonggao", gonggao); return ActionSupport.SUCCESS; } public String gonggaoAll() { List gonggaoList = gonggaoDAO.findAll(); Map request = (Map) ServletActionContext.getContext().get("request"); request.put("gonggaoList", gonggaoList); return ActionSupport.SUCCESS; } public String gonggaoDetailQian() { TGonggao gonggao = gonggaoDAO.findById(id); Map request = (Map) ServletActionContext.getContext().get("request"); request.put("gonggao", gonggao); return ActionSupport.SUCCESS; } public String getBiaoti() { return biaoti; } public void setBiaoti(String biaoti) { this.biaoti = biaoti; } public TGonggaoDAO getGonggaoDAO() { return gonggaoDAO; } public void setGonggaoDAO(TGonggaoDAO gonggaoDAO) { this.gonggaoDAO = gonggaoDAO; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getNeirong() { return neirong; } public void setNeirong(String neirong) { this.neirong = neirong; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getShijian() { return shijian; } public void setShijian(String shijian) { this.shijian = shijian; } }
guahaoAction
package com.action; import java.util.Date; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import com.dao.TGuahaoDAO; import com.dao.TZhuanjiaDAO; import com.model.TGuahao; import com.model.TUser; import com.model.TZhuanjia; import com.opensymphony.xwork2.ActionSupport; public class guahaoAction extends ActionSupport { private Integer id; private Integer zhuanjiaId; private Integer userId; private String riqi; private String jibing; private String xingming; private String lianxi; private String message; private String path; private TGuahaoDAO guahaoDAO; private TZhuanjiaDAO zhuanjiaDAO; public String guahaoAdd() { HttpServletRequest request=ServletActionContext.getRequest(); HttpSession session=request.getSession(); TUser user=(TUser)session.getAttribute("user"); TGuahao guahao=new TGuahao(); guahao.setZhuanjiaId(zhuanjiaId); guahao.setUserId(user.getUserId()); guahao.setRiqi(riqi); guahao.setJibing(jibing); guahao.setXingming(xingming); guahao.setLianxi(lianxi); guahaoDAO.save(guahao); this.setMessage("成功挂号"); this.setPath("index.action"); return "succeed"; } public String guahaoDel() { HttpServletRequest request=ServletActionContext.getRequest(); TGuahao guahao=guahaoDAO.findById(id); guahaoDAO.delete(guahao); request.setAttribute("msg", "成功取消挂号"); return "msg"; } public String guahaoMana_user() { HttpServletRequest request=ServletActionContext.getRequest(); HttpSession session=request.getSession(); TUser user=(TUser)session.getAttribute("user"); String sql="from TGuahao where userId="+user.getUserId(); List guahaoList =guahaoDAO.getHibernateTemplate().find(sql); for(int i=0;i<guahaoList.size();i++) { TGuahao guahao=(TGuahao)guahaoList.get(i); guahao.setZhuanjia(zhuanjiaDAO.findById(guahao.getZhuanjiaId())); } request.setAttribute("guahaoList", guahaoList); return ActionSupport.SUCCESS; } public String guahaoMana_zhuanjia() { HttpServletRequest request=ServletActionContext.getRequest(); HttpSession session=request.getSession(); TZhuanjia zhuanjia=(TZhuanjia)session.getAttribute("zhuanjia"); String sql="from TGuahao where zhuanjiaId="+zhuanjia.getId(); List guahaoList =guahaoDAO.getHibernateTemplate().find(sql); for(int i=0;i<guahaoList.size();i++) { TGuahao guahao=(TGuahao)guahaoList.get(i); guahao.setZhuanjia(zhuanjiaDAO.findById(guahao.getZhuanjiaId())); } request.setAttribute("guahaoList", guahaoList); return ActionSupport.SUCCESS; } public TGuahaoDAO getGuahaoDAO() { return guahaoDAO; } public void setGuahaoDAO(TGuahaoDAO guahaoDAO) { this.guahaoDAO = guahaoDAO; } public TZhuanjiaDAO getZhuanjiaDAO() { return zhuanjiaDAO; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public void setZhuanjiaDAO(TZhuanjiaDAO zhuanjiaDAO) { this.zhuanjiaDAO = zhuanjiaDAO; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getJibing() { return jibing; } public void setJibing(String jibing) { this.jibing = jibing; } public String getLianxi() { return lianxi; } public void setLianxi(String lianxi) { this.lianxi = lianxi; } public String getRiqi() { return riqi; } public void setRiqi(String riqi) { this.riqi = riqi; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getXingming() { return xingming; } public void setXingming(String xingming) { this.xingming = xingming; } public Integer getZhuanjiaId() { return zhuanjiaId; } public void setZhuanjiaId(Integer zhuanjiaId) { this.zhuanjiaId = zhuanjiaId; } }
indexAction
package com.action; import com.opensymphony.xwork2.ActionSupport; public class indexAction extends ActionSupport { public String index() { return ActionSupport.SUCCESS; } }
keshiAction
package com.action; import java.util.List; import java.util.Map; import org.apache.struts2.ServletActionContext; import com.dao.TKeshiDAO; import com.dao.TZhuanjiaDAO; import com.model.TKeshi; import com.opensymphony.xwork2.ActionSupport; public class keshiAction extends ActionSupport { private int keshiId; private String keshiAnme; private String keshiJianjie; private String message; private String path; private TKeshiDAO keshiDAO; private TZhuanjiaDAO zhuanjiaDAO; public String keshiAdd() { TKeshi keshi=new TKeshi(); keshi.setKeshiAnme(keshiAnme); keshi.setDel("no"); keshiDAO.save(keshi); this.setMessage("操作成功"); this.setPath("keshiMana.action"); return "succeed"; } public String keshiMana() { String sql="from TKeshi where del='no'"; List keshiList=keshiDAO.getHibernateTemplate().find(sql); Map request=(Map)ServletActionContext.getContext().get("request"); request.put("keshiList", keshiList); return ActionSupport.SUCCESS; } public String keshiDel() { TKeshi keshi=keshiDAO.findById(keshiId); keshi.setDel("yes"); keshiDAO.attachDirty(keshi); this.setMessage("操作成功"); this.setPath("keshiMana.action"); return "succeed"; } public String getKeshiAnme() { return keshiAnme; } public void setKeshiAnme(String keshiAnme) { this.keshiAnme = keshiAnme; } public TKeshiDAO getKeshiDAO() { return keshiDAO; } public void setKeshiDAO(TKeshiDAO keshiDAO) { this.keshiDAO = keshiDAO; } public TZhuanjiaDAO getZhuanjiaDAO() { return zhuanjiaDAO; } public void setZhuanjiaDAO(TZhuanjiaDAO zhuanjiaDAO) { this.zhuanjiaDAO = zhuanjiaDAO; } public int getKeshiId() { return keshiId; } public void setKeshiId(int keshiId) { this.keshiId = keshiId; } public String getKeshiJianjie() { return keshiJianjie; } public void setKeshiJianjie(String keshiJianjie) { this.keshiJianjie = keshiJianjie; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } }