Java项目:医院在线预约挂号系统(java+SSM+JSP+Bootstrap+layUI+echarts+Mysql)

 源码获取:俺的博客首页 "资源" 里下载!

项目介绍

ssm医院在线预约挂号系统

角色:管理员、用户、医生

管理员登录后,主要功能有:首页、用户列表、添加用户、科室列表、新增科室、医生列表、新增医生信息、公告列表、新增公告、系统设置、数据统计等功能。

用户主要功能包括:首页、我的信息、科室列表、医生列表、门诊预约列表、门诊预约、公告列表、数据统计等功能。

医生主要功能包括:首页、科室列表、我的个人信息、我的门诊预约列表、公告列表、数据统计等功能;


环境需要

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.是否Maven项目: 否;
6.数据库:MySql 5.7/8.0等版本均可;

技术栈

后端:SSM(Spring+SpringMVC+Mybatis)
前端:JSP+css+javascript+Bootstrap+layUI+echarts

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 在Tomcat在Deployment配置中引入源码中的upload文件夹,并将其配置为/images路径;
5. 运行项目,在浏览器中输入地址:http://localhost:8080/ssm_hospital_appointment/

管理员:admin/123456
用户:zs/123456
医生:18120197878/123456

 

 

 

 

管理员控制层:

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 send by the client to the server
	 * @param response the response send 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 send by the client to the server
	 * @param response the response send 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登录
				String username = request.getParameter("username");
				String password = request.getParameter("password");String sf = request.getParameter("sf");
				if(username == null||username.trim().equals("")){
					request.setAttribute("message", "请正确输入用户名!");
					request.getRequestDispatcher(sysdir+"/login.jsp").forward(request, response);
				}
				else if(password == null||password.trim().equals("")){
					request.setAttribute("message", "请输入密码!");
					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", "登录信息错误!");
							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", "密码修改成功!");
							request.getRequestDispatcher(sysdir+"/system/editpwd.jsp").forward(request, response);
							break;
						case Constant.PASSWORD_ERROR:
							request.setAttribute("message", "原始密码错误,请确认权限!");
							request.getRequestDispatcher(sysdir+"/system/editpwd.jsp").forward(request, response);
							break;
						case Constant.SYSTEM_ERROR:
							request.setAttribute("message", "系统维护中,请稍后再试!");
							request.getRequestDispatcher(sysdir+"/system/editpwd.jsp").forward(request, response);
							break;
					}
				}		
			}
			else if(method.equals("exit")){//admin exit
				 
					session.removeAttribute("user");
					session.removeAttribute("sf");
					System.gc();
					request.getRequestDispatcher("index.jsp").forward(request, response);
				 
			}
			else if(method.equals("manager")){//add,update manager
				 
						String username = request.getParameter("bh").trim();
						String password = MD5.MD5(request.getParameter("password").trim());
						
						
						int flag = loginbean.addManager(username, password, "2", "1");
						if(flag == Constant.SUCCESS){
							request.setAttribute("message", "增加成功!");
							request.getRequestDispatcher(sysdir+"/system/user.jsp").forward(request, response);
						}
						else if(flag == Constant.SAME_NAME){
							request.setAttribute("username", username);
							request.setAttribute("message", "该用户名已经存在!");
							request.getRequestDispatcher(sysdir+"/system/user.jsp").forward(request, response);
						}
						else{
							request.setAttribute("message", "系统维护中,请稍后再试!");
							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", "不能删除原始帐号!");
						request.getRequestDispatcher(sysdir+"/system/user.jsp").forward(request, response);
					}
					else{
						int flag = loginbean.delManager(id);
						if(flag == Constant.SUCCESS){
							request.setAttribute("message", "删除成功!");
							request.getRequestDispatcher(sysdir+"/system/user.jsp").forward(request, response);
						}	
						else{
							request.setAttribute("message", "系统维护中,请稍后再试!");
							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", "请选择要删除的记录!");
						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", "删除记录成功!");
							request.getRequestDispatcher(sysdir+"/system/log.jsp").forward(request, response);
						}
						else{
							request.setAttribute("message", "系统维护中,请稍后再试!");
							request.getRequestDispatcher(sysdir+"/system/log.jsp").forward(request, response);
						}
					}
				}			
			}
			else{//无参数传入转到错误页面
				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 occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

登陆管理控制层: 

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 send by the client to the server
	 * @param response the response send 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 send by the client to the server
	 * @param response the response send 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")){//登陆页面会员登陆
			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){//登陆成功
				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", "登陆成功,登陆信息更新失败!");
					request.getRequestDispatcher("member/index.jsp").forward(request, response);
				}
			}
			else if(flag == Constant.NAME_ERROR){//用户名错误
				request.setAttribute("reg_user", username);
				request.setAttribute("message", "登录信息错误或已经被拉入黑名单!");
				request.getRequestDispatcher("login.jsp").forward(request, response);
			}
			else if(flag == Constant.PASSWORD_ERROR){//密码错误
				request.setAttribute("reg_user", username);
				request.setAttribute("message", "登录信息错误或已经被拉入黑名单!");
				request.getRequestDispatcher("login.jsp").forward(request, response);
			}
		}
		else if(method.equals("logout")){//从iframe页面退出登陆
			session.removeAttribute("member");
			session.removeAttribute("type");
			request.getRequestDispatcher("login1.jsp").forward(request, response);
		}
		else if(method.equals("pagelogout")||method.equals("memberexit")){//从网页退出登陆
			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 occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

公告管理控制层:

public class NewsAction extends HttpServlet {

	private ServletConfig 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 send by the client to the server
	 * @param response the response send 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 send by the client to the server
	 * @param response the response send 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")){//增加
		            	//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");
						
						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+"'");
		                    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", "操作成功!");
								request.getRequestDispatcher(sysdir+"/ys/index.jsp").forward(request, response);
							}
							else{
								request.setAttribute("message", "系统维护中,请稍后再试!");
								request.getRequestDispatcher(sysdir+"/ys/index.jsp").forward(request, response);
							}
		                    }
		                    else{
		                    	request.setAttribute("message", "编号重复!");
								request.getRequestDispatcher(sysdir+"/ys/index.jsp").forward(request, response);
		                    }
		                   
					 
		            }
		            //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", "操作成功!");
								request.getRequestDispatcher(sysdir+"/ys/index.jsp").forward(request, response);
							}
							else{
								request.setAttribute("message", "系统维护中,请稍后再试!");
								request.getRequestDispatcher(sysdir+"/ys/index.jsp").forward(request, response);
							}
		                    }
		                    else{
		                    	request.setAttribute("message", "编号重复!");
								request.getRequestDispatcher(sysdir+"/ys/index.jsp").forward(request, response);
		                    }
		                   
						 
		            }
		            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");
						
						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", "操作成功!");
								request.getRequestDispatcher(sysdir+"/ys/gr.jsp").forward(request, response);
							}
							else{
								request.setAttribute("message", "系统维护中,请稍后再试!");
								request.getRequestDispatcher(sysdir+"/ys/gr.jsp").forward(request, response);
							}
						 
		            }
		            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 occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

源码获取:俺的博客首页 "资源" 里下载!

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beyondwild

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值