作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
本系统分为两个角色,一个管理员,一个是护工;
管理员角色主要功能如下:
密码信息管理、系统用户管理(系统用户管理、增加系统用户、系统用户查询)、老人信息管理(老人信息管理、增加老人信息、老人信息查询)、事故记录管理(事故记录管理、增加事故记录、事故记录查询)、请假信息管理(请假信息管理、增加请假信息、请假信息查询)、床位分配管理(床位分配管理、)、入住费用管理、护工薪资管理、护工请假管理
护工角色主要功能如下:
密码信息管理、老人信息查看、请假信息查看、护工薪资查看等;
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.数据库:MySql 5.7版本;
6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
1. 后端:servlet
2. 前端:JSP+css+javascript+bootstrap+jQuery
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中util/DBO.java配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/yanglaoyuan 登录
管理员账号密码:admin/111
护工账号密码:111/111
- package com.action;
-
- import java.io.IOException;
- import java.text.SimpleDateFormat;
- import java.util.Calendar;
- import java.util.List;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSession;
-
- import com.bean.ComBean;
- import com.util.Constant;
-
- public class ComServlet extends HttpServlet {
-
- /**
- * Constructor of the object.
- */
- public ComServlet() {
- super();
- }
-
- /**
- * Destruction of the servlet.
- */
- public void destroy() {
- super.destroy(); // Just puts "destroy" string in log
- // Put your code here
- }
-
- /**
- * The doGet method of the servlet.
- *
- * 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.
- *
- * 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();
- ComBean cBean = new ComBean();
- String date=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
- String date2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
- String method = request.getParameter("method");
-
-
- if(method.equals("addlr")){ //ÀÏÈËÐÅÏ¢
- //String xm="";String xb="";String nl="";String st="";String hj="";String sfz="";String lxr="";
- //String dh="";String zz="";String cw="";String hg="";String rz="";String cy="";
- String xm = request.getParameter("xm");
- String xb = request.getParameter("xb");
- String nl = request.getParameter("nl");
- String st = request.getParameter("st");
- String hj = request.getParameter("hj");
- String sfz = request.getParameter("sfz");
- String lxr = request.getParameter("lxr");
- String dh = request.getParameter("dh");
- String zz = request.getParameter("zz");
- String cw = request.getParameter("cw");
- String hg = request.getParameter("hg");
- String rz = request.getParameter("rz");
- String cy = request.getParameter("cy");
- int flag = cBean.comUp("insert into lr(xm,xb,nl,st,hj,sfz,lxr,dh,zz,cw,hg,rz,cy) " +
- "values('"+xm+"','"+xb+"','"+nl+"','"+st+"','"+hj+"','"+sfz+"','"+lxr+"','"+dh+"','"+zz+"','"+cw+"','"+hg+"','"+rz+"','"+cy+"' )");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("uplr")){ //ÐÞ¸ÄÀÏÈËÐÅÏ¢
- String id=request.getParameter("id");
- String xm = request.getParameter("xm");
- String xb = request.getParameter("xb");
- String nl = request.getParameter("nl");
- String st = request.getParameter("st");
- String hj = request.getParameter("hj");
- String sfz = request.getParameter("sfz");
- String lxr = request.getParameter("lxr");
- String dh = request.getParameter("dh");
- String zz = request.getParameter("zz");
- String cw = request.getParameter("cw");
- String hg = request.getParameter("hg");
- String rz = request.getParameter("rz");
- String cy = request.getParameter("cy");
- int flag = cBean.comUp("update lr set xm='"+xm+"',xb='"+xb+"',nl='"+nl+"',st='"+st+"',hj='"+hj+"',sfz='"+sfz+"'" +
- ",lxr='"+lxr+"',dh='"+dh+"',zz='"+zz+"',cw='"+cw+"',hg='"+hg+"',rz='"+rz+"',cy='"+cy+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("dellr")){//ɾ³ýÀÏÈËÐÅÏ¢
- String id = request.getParameter("id");
- int flag = cBean.comUp("delete from lr where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
- request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
- }
- }
-
- else if(method.equals("addsg")){ //ʹʼǼ
- String lr = request.getParameter("lr");
- String sj = request.getParameter("sj");
- String xx = request.getParameter("xx");
- int flag = cBean.comUp("insert into sg(lr,sj,xx) values('"+lr+"','"+sj+"','"+xx+"' )");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("upsg")){ //ÐÞ¸ÄʹʼǼ
- String id=request.getParameter("id");
- String lr = request.getParameter("lr");
- String sj = request.getParameter("sj");
- String xx = request.getParameter("xx");
- int flag = cBean.comUp("update sg set lr='"+lr+"',sj='"+sj+"',xx='"+xx+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("delsg")){//ɾ³ýʹʼǼ
- String id = request.getParameter("id");
- int flag = cBean.comUp("delete from sg where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
- request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
- }
- }
-
- else if(method.equals("addqj")){ //Çë¼ÙÐÅÏ¢
- String lr = request.getParameter("lr");
- String sj = request.getParameter("sj");
- String xx = request.getParameter("xx");
- int flag = cBean.comUp("insert into qj(lr,sj,xx) values('"+lr+"','"+sj+"','"+xx+"' )");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("upqj")){ //ÐÞ¸ÄÇë¼ÙÐÅÏ¢
- String id=request.getParameter("id");
- String lr = request.getParameter("lr");
- String sj = request.getParameter("sj");
- String xx = request.getParameter("xx");
- int flag = cBean.comUp("update qj set lr='"+lr+"',sj='"+sj+"',xx='"+xx+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("delqj")){//ɾ³ýÇë¼ÙÐÅÏ¢
- String id = request.getParameter("id");
- int flag = cBean.comUp("delete from qj where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
- request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("upcw")){
- String id=request.getParameter("id");
- String cw = request.getParameter("cw");
- int flag = cBean.comUp("update lr set cw='"+cw+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/cw/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/cw/index.jsp").forward(request, response);
- }
- }
-
-
- else if(method.equals("addfy")){ //Èëס·ÑÓÃ
- String lr = request.getParameter("lr");
- String fy = request.getParameter("fy");
- String kc = request.getParameter("kc");
- String zt = request.getParameter("zt");
- String xx = request.getParameter("xx");
- float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
- int flag = cBean.comUp("insert into fy(lr,fy,kc,zt,xx,sji) values('"+lr+"','"+fy+"','"+kc+"','"+zt+"','"+xx+"','"+sji+"' )");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("upfy")){ //ÐÞ¸ÄÈëס·ÑÓÃ
- String id=request.getParameter("id");
- String lr = request.getParameter("lr");
- String fy = request.getParameter("fy");
- String kc = request.getParameter("kc");
- String zt = request.getParameter("zt");
- String xx = request.getParameter("xx");
- float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
- int flag = cBean.comUp("update fy set lr='"+lr+"',fy='"+fy+"',kc='"+kc+"',zt='"+zt+"',xx='"+xx+"',sji='"+sji+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("delfy")){//ɾ³ýÈëס·ÑÓÃ
- String id = request.getParameter("id");
- int flag = cBean.comUp("delete from fy where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
- request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("addxz")){ //Èëס·ÑÓÃ
- String lr = request.getParameter("lr");
- String fy = request.getParameter("fy");
- String kc = request.getParameter("kc");
- String zt = request.getParameter("zt");
- String xx = request.getParameter("xx");
- float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
- int flag = cBean.comUp("insert into xz(lr,fy,kc,zt,xx,sji) values('"+lr+"','"+fy+"','"+kc+"','"+zt+"','"+xx+"','"+sji+"' )");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("upxz")){ //ÐÞ¸ÄÈëס·ÑÓÃ
- String id=request.getParameter("id");
- String lr = request.getParameter("lr");
- String fy = request.getParameter("fy");
- String kc = request.getParameter("kc");
- String zt = request.getParameter("zt");
- String xx = request.getParameter("xx");
- float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
- int flag = cBean.comUp("update xz set lr='"+lr+"',fy='"+fy+"',kc='"+kc+"',zt='"+zt+"',xx='"+xx+"',sji='"+sji+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("delxz")){//ɾ³ýÈëס·ÑÓÃ
- String id = request.getParameter("id");
- int flag = cBean.comUp("delete from xz where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
- request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
- }
- }
-
- else if(method.equals("addhgqj")){ //Çë¼ÙÐÅÏ¢
- String lr = request.getParameter("lr");
- String sj = request.getParameter("sj");
- String xx = request.getParameter("xx");
- int flag = cBean.comUp("insert into hgqj(lr,sj,xx) values('"+lr+"','"+sj+"','"+xx+"' )");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("uphgqj")){ //ÐÞ¸ÄÇë¼ÙÐÅÏ¢
- String id=request.getParameter("id");
- String lr = request.getParameter("lr");
- String sj = request.getParameter("sj");
- String xx = request.getParameter("xx");
- int flag = cBean.comUp("update hgqj set lr='"+lr+"',sj='"+sj+"',xx='"+xx+"' where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
- request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
- }
- }
- else if(method.equals("delhgqj")){//ɾ³ýÇë¼ÙÐÅÏ¢
- String id = request.getParameter("id");
- int flag = cBean.comUp("delete from hgqj where id='"+id+"'");
- if(flag == Constant.SUCCESS){
- request.setAttribute("message", "²Ù×÷³É¹¦£¡");
- request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
- }
- else{
- request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
- request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
- }
- }
- }
-
- /**
- * Initialization of the servlet.
- *
- * @throws ServletException if an error occure
- */
- public void init() throws ServletException {
- // Put your code here
- }
-
- }
如果也想学习本系统,下面领取。关注并回复:121jsp