Java project: Hospital online appointment registration system (java+SSM+JSP+Bootstrap+layUI+echarts+Mysql)

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

Project Introduction

ssm hospital online appointment registration system

Roles: Admin, User, Doctor

After the administrator logs in, the main functions include: homepage, user list, add user, department list, new department, doctor list, new doctor information, announcement list, new announcement, system settings, data statistics and other functions.

The main user functions include: homepage, my information, department list, doctor list, outpatient appointment list, outpatient appointment, announcement list, data statistics and other functions.

The main functions of doctors include: homepage, department list, my personal information, my outpatient appointment list, announcement list, data statistics 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;
6. Database: MySql 5.7/8.0 and other versions are acceptable;

Technology stack

Backend: SSM (Spring + SpringMVC + Mybatis)
Front-end: JSP + css + javascript + Bootstrap + layUI + echarts

Instructions for use

1. Use Navicat or other tools to create a database corresponding to the sql file name in mysql, and import the sql file of the project;
2. Use IDEA/Eclipse/MyEclipse to import the project, modify the configuration, and run the project;
3. Change the database configuration in the jdbc.properties configuration file in the project to your own configuration;
4. Introduce the upload folder in the source code into Tomcat’s Deployment configuration and configure it as the /images path;
5. Run the project and enter the address in the browser: http://localhost:8080/ssm_hospital_appointment/

Administrator: admin/123456
User: zs/123456
Doctor: 18120197878/123456

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", "Incorrect 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", "Add 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 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
}

}

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
}

}

Announcement management control layer:

public class NewsAction extends HttpServlet {

privateServletConfig config;
/**
* Constructor of the object.
*/
public NewsAction() {
super();
}

final public void init(ServletConfig config) throws ServletException
    {
        this.config = config;
    }

    final public ServletConfig getServletConfig()
    {
        return config;
    }
/**
* 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 {

request.setCharacterEncoding(Constant.CHARACTERENCODING);
response.setContentType(Constant.CONTENTTYPE);
String sysdir = new SystemBean().getDir();
HttpSession session = request.getSession();
String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
try{
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String method = null;
ComBean cb=new ComBean();
SmartUpload mySmartUpload = new SmartUpload();//init
int count = 0;
try{
mySmartUpload.initialize(config,request,response);
mySmartUpload.upload();
method = mySmartUpload.getRequest().getParameter("method").trim();
if(method.equals("addys")){//Increase
//String xm = ""; String ks=""; String pic=""; String fy=""; String zc=""; String nl=""; String content="";String sj="";
String xm = mySmartUpload.getRequest().getParameter("xm");
String ks = mySmartUpload.getRequest().getParameter("ks");
String fy = mySmartUpload.getRequest().getParameter("fy");
String zc = mySmartUpload.getRequest().getParameter("zc");
String nl = mySmartUpload.getRequest().getParameter("nl");
String content = mySmartUpload.getRequest().getParameter("content1");
String bh = mySmartUpload.getRequest().getParameter("bh");
\t\t\t\t\t\t
String sj = mySmartUpload.getRequest().getParameter("sj");
\t\t\t\t\t\t 
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/sale";
count = mySmartUpload.save(path);
String str=cb.getString("select id from ys where bh='" + bh + "'");
if(str==null){
String sql="insert into ys(xm,ks,pic,fy,zc,nl,content,sj,bh) " +
"values('" + xm + "','" + ks + "','" + path + "/" + file.getFileName() + "','" + fy + "','" + zc + "','" + nl + "','" + content + "', '" + sj + "','" + bh + "')";
int flag =cb.comUp(sql);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher(sysdir + "/ys/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/ys/index.jsp").forward(request, response);
}
}
else{
request.setAttribute("message", "Duplicate number!");
request.getRequestDispatcher(sysdir + "/ys/index.jsp").forward(request, response);
}
\t\t                   
\t\t\t\t\t 
}
//update
else if(method.equals("upys")){
String id = mySmartUpload.getRequest().getParameter("id");
String xm = mySmartUpload.getRequest().getParameter("xm");
String ks = mySmartUpload.getRequest().getParameter("ks");
String fy = mySmartUpload.getRequest().getParameter("fy");
String zc = mySmartUpload.getRequest().getParameter("zc");
String nl = mySmartUpload.getRequest().getParameter("nl");
String content = mySmartUpload.getRequest().getParameter("content1");
String bh = mySmartUpload.getRequest().getParameter("bh");
String sj = mySmartUpload.getRequest().getParameter("sj");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/sale";
count = mySmartUpload.save(path);
String str=cb.getString("select id from ys where bh='" + bh + "' and id!='" + id + "'");
if(str==null){
String sql="update ys set xm='" + xm + "',ks='" + ks + "',pic='" + path + "/" + file.getFileName() + "'," +
"fy='" + fy + "',zc='" + zc + "',nl='" + nl + "',content='" + content + "',sj='" + sj + "' ,bh='" + bh + "' where id='" + id + "'";
int flag = cb.comUp(sql);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher(sysdir + "/ys/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/ys/index.jsp").forward(request, response);
}
}
else{
request.setAttribute("message", "Duplicate number!");
request.getRequestDispatcher(sysdir + "/ys/index.jsp").forward(request, response);
}
\t\t                   
\t\t\t\t\t\t 
}
else if(method.equals("upys2")){
String username=(String)session.getAttribute("user");
String xm = mySmartUpload.getRequest().getParameter("xm");
String ks = mySmartUpload.getRequest().getParameter("ks");
String fy = mySmartUpload.getRequest().getParameter("fy");
String zc = mySmartUpload.getRequest().getParameter("zc");
String nl = mySmartUpload.getRequest().getParameter("nl");
String content = mySmartUpload.getRequest().getParameter("content1");
\t\t\t\t\t\t
String sj = mySmartUpload.getRequest().getParameter("sj");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/sale";
count = mySmartUpload.save(path);
String sql="update ys set xm='" + xm + "',ks='" + ks + "',pic='" + path + "/" + file.getFileName() + "'," +
"fy='" + fy + "',zc='" + zc + "',nl='" + nl + "',content='" + content + "',sj='" + sj + "' where bh='" + username + "'";
int flag = cb.comUp(sql);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "Operation successful!");
request.getRequestDispatcher(sysdir + "/ys/gr.jsp").forward(request, response);
}
else{
request.setAttribute("message", "The system is under maintenance, please try again later!");
request.getRequestDispatcher(sysdir + "/ys/gr.jsp").forward(request, response);
}
\t\t\t\t\t\t 
}
else{
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}catch(Exception ex){
ex.printStackTrace();
//request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
}catch(Exception e){
e.printStackTrace();
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
}

}

Get the source code: Download it from the “Resources” on the homepage of my blog!

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