Java project: Hospital appointment registration system (java+SSM+JSP+JS+JQUERY+Layui+Mysql)

Source code acquisition: Download from my blog homepage “Resources”!

Project Introduction

Hospital appointment registration system based on SSM

Roles: Administrator, Doctor, User

After the administrator logs in to the system, he can make corresponding adjustments to the home page, personal center, user management, doctor management, outpatient information management, appointment registration management, appointment cancellation management, appointment change notification management, message board management, system management and other functions. Operations Management

Doctors who log in to the hospital appointment registration system can manage the home page, personal center, outpatient information management, appointment registration management, appointment cancellation management and other functions

Users who log in to the hospital appointment registration system can manage the homepage, personal center, appointment registration management, appointment cancellation management, appointment change notification management and other functions

Environmental needs

1. Operating environment: preferably java jdk 1.8, we run on this platform. Other versions are theoretically possible.
2. IDE environment: IDEA, Eclipse, Myeclipse are all available. Recommend IDEA;
3. Tomcat environment: Tomcat 7.x, 8.x, 9.x versions are available
4. Hardware environment: windows 7/8/10 1G memory or more; or Mac OS;
5. Whether it is a Maven project: No; check whether the source code directory contains pom.xml; if it is included, it is a Maven project, otherwise it is a non-Maven project;
6. Database: MySql 5.7/8.0 and other versions are acceptable;

Technology stack

Backend: SSM (Spring + SpringMVC + Mybatis)

Front-end: JSP + CSS + JS + JQUERY + Layui

Instructions for use

1. Use Navicat or other tools to create a database with the corresponding name in mysql and import the project’s sql file;
2. Use IDEA/Eclipse/MyEclipse to import the project, modify the configuration, and run the project;
3. Change the database configuration in the db.xml configuration file in the project to your own configuration, and then run;

Log in to the management control layer:

public class LoginAction extends HttpServlet {

/**
* Constructor of the object.
*/
public LoginAction() {
super();
}

/**
* Destruction of the servlet.<br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet.<br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request sent by the client to the server
* @param response the response sent by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request,response);
}

/**
* The doPost method of the servlet.<br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request sent by the client to the server
* @param response the response sent by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType(Constant.CONTENTTYPE);
request.setCharacterEncoding(Constant.CHARACTERENCODING);
HttpSession session = request.getSession();
MemberBean memberBean = new MemberBean();
String method = Filter.escapeHTMLTags(request.getParameter("method").trim());
if(method.equals("PAGEUSERLOGIN")){//Login page member login
String username = Filter.escapeHTMLTags(request.getParameter("username").trim());
String password = Filter.escapeHTMLTags(request.getParameter("password").trim());
String reg_type = Filter.escapeHTMLTags(request.getParameter("reg_type").trim());
String lastip = request.getRemoteAddr();
int flag = memberBean.memberLogin(username, password, reg_type);
if(flag == Constant.SUCCESS){//Login successful
String info = memberBean.getLastTimeIP(username);
int flag2 = memberBean.upmemberLogin(username, lastip);
if(flag2 == Constant.SUCCESS){
session.setAttribute("member", username);
session.setAttribute("type", reg_type);
session.setAttribute("info", info);
request.getRequestDispatcher("member/index.jsp").forward(request, response);
}
else{
session.setAttribute("member", username);
session.setAttribute("type", reg_type);
session.setAttribute("info", info);
session.setAttribute("message", "Login successful, login information update failed!");
request.getRequestDispatcher("member/index.jsp").forward(request, response);
}
}
else if(flag == Constant.NAME_ERROR){//Username error
request.setAttribute("reg_user", username);
request.setAttribute("message", "The login information is incorrect or has been blacklisted!");
request.getRequestDispatcher("login.jsp").forward(request, response);
}
else if(flag == Constant.PASSWORD_ERROR){//Wrong password
request.setAttribute("reg_user", username);
request.setAttribute("message", "The login information is incorrect or has been blacklisted!");
request.getRequestDispatcher("login.jsp").forward(request, response);
}
}
else if(method.equals("logout")){//Exit the login from the iframe page
session.removeAttribute("member");
session.removeAttribute("type");
request.getRequestDispatcher("login1.jsp").forward(request, response);
}
else if(method.equals("pagelogout")||method.equals("memberexit")){//Log out from the web page
session.removeAttribute("member");
session.removeAttribute("type");
request.getRequestDispatcher("index.jsp").forward(request, response);
}
else{
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}

/**
* Initialization of the servlet.<br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}

Backend administrator control layer:

public class AdminAction extends HttpServlet {

/**
* Constructor of the object.
*/
public AdminAction() {
super();
}

/**
* Destruction of the servlet.<br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet.<br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request sent by the client to the server
* @param response the response sent by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request,response);
}

/**
* The doPost method of the servlet.<br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request sent by the client to the server
* @param response the response sent by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType(Constant.CONTENTTYPE);
request.setCharacterEncoding(Constant.CHARACTERENCODING);
try{
String method=request.getParameter("method").trim();
AdminBean loginbean = new AdminBean();
HttpSession session = request.getSession();
session.setMaxInactiveInterval(1200);
SystemBean systembean = new SystemBean();
String sysdir = systembean.getDir();
if(method.equals("one")){//admin login
String username = request.getParameter("username");
String password = request.getParameter("password");String sf = request.getParameter("sf");
if(username == null||username.trim().equals("")){
request.setAttribute("message", "Please enter the user name correctly!");
request.getRequestDispatcher(sysdir + "/login.jsp").forward(request, response);
}
else if(password == null||password.trim().equals("")){
request.setAttribute("message", "Please enter your password!");
request.getRequestDispatcher(sysdir + "/login.jsp").forward(request, response);
}
else{
ComBean cb=new ComBean();
String str=cb.getString("select id from admin where username='" + username + "' and password='" + password + "' and sf='" + sf + "'");
if(str!=null){
session.setAttribute("user", username);session.setAttribute("sf", sf);
request.getRequestDispatcher("admin/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "Wrong login information!");
request.getRequestDispatcher("admin/login.jsp").forward(request, response);
}
}
}
else if(method.equals("editpwd")){//admin edit password
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String oldpwd = MD5.MD5(request.getParameter("oldpwd").trim());
String newpwd = MD5.MD5(request.getParameter("newpwd").trim());
String username = (String)session.getAttribute("user");
int flag = loginbean.editPassword(username, oldpwd, newpwd);
switch (flag){
case Constant.SUCCESS:
request.setAttribute("message", "Password changed successfully!");
request.getRequestDispatcher(sysdir + "/system/editpwd.jsp").forward(request, response);
break;
case Constant.PASSWORD_ERROR:
request.setAttribute("message", "The original password is wrong, please confirm permission!");
request.getRequestDispatcher(sysdir + "/system/editpwd.jsp").forward(request, response);
break;
case Constant.SYSTEM_ERROR:
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/system/editpwd.jsp").forward(request, response);
break;
}
}
}
else if(method.equals("exit")){//admin exit
\t\t\t\t 
session.removeAttribute("user");
session.removeAttribute("sf");
System.gc();
request.getRequestDispatcher("index.jsp").forward(request, response);
\t\t\t\t 
}
else if(method.equals("manager")){//add,update manager
\t\t\t\t 
String username = request.getParameter("bh").trim();
String password = MD5.MD5(request.getParameter("password").trim());
\t\t\t\t\t\t
\t\t\t\t\t\t
int flag = loginbean.addManager(username, password, "2", "1");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Added successfully!");
request.getRequestDispatcher(sysdir + "/system/user.jsp").forward(request, response);
}
else if(flag == Constant.SAME_NAME){
request.setAttribute("username", username);
request.setAttribute("message", "This username already exists!");
request.getRequestDispatcher(sysdir + "/system/user.jsp").forward(request, response);
}
else{
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/system/user.jsp").forward(request, response);
}
}
else if(method.equals("delm")){//delete manager
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
int id = Integer.parseInt(request.getParameter("id").trim());
if(id==1){
request.setAttribute("message", "The original account cannot be deleted!");
request.getRequestDispatcher(sysdir + "/system/user.jsp").forward(request, response);
}
else{
int flag = loginbean.delManager(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Deletion successful!");
request.getRequestDispatcher(sysdir + "/system/user.jsp").forward(request, response);
}
else{
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/system/user.jsp").forward(request, response);
}
}
}
}
else if(method.equals("dellog")){//delete login note
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String check[] = request.getParameterValues("checkit");
if(check == null){
request.setAttribute("message", "Please select the record you want to delete!");
request.getRequestDispatcher(sysdir + "/system/log.jsp").forward(request, response);
}
else{
int id[]= new int[check.length];
for(int i = 0;i<check.length;i + + ){
int s = Integer.parseInt(check[i]);
id[i] = s;
}
int flag = loginbean.delLog(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Record deleted successfully!");
request.getRequestDispatcher(sysdir + "/system/log.jsp").forward(request, response);
}
else{
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/system/log.jsp").forward(request, response);
}
}
}
}
else{//No parameters are passed in and go to the error page
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}catch(Exception e){
e.printStackTrace();
request.getRequestDispatcher("error.jsp").forward(request, response);
}
\t\t
}

/**
* Initialization of the servlet.<br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}

Reservation information management control layer:

public class ComServlet extends HttpServlet {

/**
* Constructor of the object.
*/
public ComServlet() {
super();
}

/**
* Destruction of the servlet.<br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet.<br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request sent by the client to the server
* @param response the response sent by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request,response);
}

/**
* The doPost method of the servlet.<br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request sent by the client to the server
* @param response the response sent by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType(Constant.CONTENTTYPE);
request.setCharacterEncoding(Constant.CHARACTERENCODING);
HttpSession session = request.getSession();
ComBean cBean = new ComBean();
String date2=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
String method = request.getParameter("method");
if(method.equals("addFenLei")){ //Add department ------Code comments
String fl = request.getParameter("bj");
String str=cBean.getString("select id from fenlei where fl='" + fl + "'");
if(str==null){
int flag = cBean.comUp("insert into fenlei(fl) values('" + fl + "')");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/ys/fenlei.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/ys/fenlei.jsp").forward(request, response);
}
}
else {
request.setAttribute("message", "Duplicate departments!");
request.getRequestDispatcher("admin/ys/fenlei.jsp").forward(request, response);
}
}
else if(method.equals("delFenLei")){ //Delete department
//hm xm dh zz zj sj sjzj lx bz
String id = request.getParameter("id");
int flag = cBean.comUp("delete from fenlei where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/ys/fenlei.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/ys/fenlei.jsp").forward(request, response);
}
}
else if(method.equals("delmember")){ //Delete registered users
//hm xm dh zz zj sj sjzj lx bz
String id = request.getParameter("id");
int flag = cBean.comUp("delete from member where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
}
}
else if(method.equals("addpb")){ //Add shift information
String ys = request.getParameter("ys");
String ks = request.getParameter("ks");
String sj = request.getParameter("sj");
String xx = request.getParameter("xx");
String str=cBean.getString("select id from pb where ys='" + ys + "' and xx='" + xx + "'");
if(str==null){
int flag = cBean.comUp("insert into pb(ys,ks,sj,xx) values('" + ys + "','" + ks + "','\ " + sj + "','" + xx + "')");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
}
else{
request.setAttribute("message", "Time conflict!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
}
else if(method.equals("uppb")){ //Modify schedule information
String id = request.getParameter("id");
String ys = request.getParameter("ys");
String ks = request.getParameter("ks");
String sj = request.getParameter("sj");
String xx = request.getParameter("xx");
String str=cBean.getString("select ks from pb where ys='" + ys + "' and xx='" + xx + "' and id!='" + id + "'");
if(str==null){
int flag = cBean.comUp("update pb set ys='" + ys + "',ks='" + ks + "',sj='" + sj + \ "',xx='" + xx + "' where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
}
else{
request.setAttribute("message", "Time conflict!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
}
\t\t 
else if(method.equals("delpb")){ //Delete schedule information
String id = request.getParameter("id");
int flag = cBean.comUp("delete from pb where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/pb/index.jsp").forward(request, response);
}
}
else if(method.equals("delys")){ //Delete doctor
//hm xm dh zz zj sj sjzj lx bz
String id = request.getParameter("id");
int flag = cBean.comUp("delete from ys where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/ys/index.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/ys/index.jsp").forward(request, response);
}
}
\t\t
\t\t 
\t\t 
\t\t//reserve  
else if(method.equals("gh")){ //Join the appointment
String member=(String)session.getAttribute("member");
\t\t\t 
String ysid = request.getParameter("ysid");
String sj = request.getParameter("sj");
String xs = request.getParameter("xs");
String lxr = request.getParameter("lxr");
String lxfs = request.getParameter("lxfs");
String xm=cBean.getString("select xm from ys where id='" + ysid + "'");
String ks=cBean.getString("select ks from ys where id='" + ysid + "'");
String fy=cBean.getString("select fy from ys where id='" + ysid + "'");
String ysbh=cBean.getString("select bh from ys where id='" + ysid + "'");
long bh=System.currentTimeMillis();
int flag = cBean.comUp("insert into gh(ysid,xm,ks,sj,lxr,lxfs,tjsj,member,bh,fy,xs,ysbh) " +
"values('" + ysid + "','" + xm + "','" + ks + "','" + sj + "\ ','" + lxr + "','" + lxfs + "','" + date2 + "','" + member + "', '" + bh + "','" + fy + "','" + xs + "','" + ysbh + "')" );
if(flag == Constant.SUCCESS){
request.setAttribute("message", "The operation is successful, please check the reservation number in the user center!");
request.getRequestDispatcher("ys.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("ys.jsp").forward(request, response);
}
}
\t\t 
else if(method.equals("delgh")){ //Delete reservation
\t\t\t 
String id = request.getParameter("id");
int flag = cBean.comUp("delete from gh where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("member/gh/index.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("member/gh/index.jsp").forward(request, response);
}
}
else if(method.equals("delgh2")){ //Delete reservation
\t\t\t 
String id = request.getParameter("id");
int flag = cBean.comUp("delete from gh where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/gh/index.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/gh/index.jsp").forward(request, response);
}
}
else if(method.equals("delgh3")){ //Delete reservation
\t\t\t 
String id = request.getParameter("id");
int flag = cBean.comUp("delete from gh where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/gh/index2.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/gh/index2.jsp").forward(request, response);
}
}
else if(method.equals("wcgh")){ //Delete reservation
\t\t\t 
String id = request.getParameter("id");
int flag = cBean.comUp("update gh set zt='Complete' where id='" + id + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/gh/index2.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/gh/index2.jsp").forward(request, response);
}
}
else if(method.equals("hmd")){ //Delete reservation
\t\t\t 
String id = request.getParameter("id");
String member=cBean.getString("select member from gh where id='" + id + "'");
int flag = cBean.comUp("update member set hmd='is' where username='" + member + "'");
System.out.println("update member set hmd='is' where username='" + member + "'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher("admin/gh/index2.jsp").forward(request, response);
}
else {
request.setAttribute("message", "Operation failed!");
request.getRequestDispatcher("admin/gh/index2.jsp").forward(request, response);
}
}
}

/**
* Initialization of the servlet.<br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}

Source code acquisition: Download from my blog homepage “Resources”!

The knowledge points of the article match the official knowledge files, and you can further learn related knowledge. Java Skill TreeHomepageOverview 138778 people are learning the system