基于JSP实现医院病历管理系统

简介: 基于JSP实现医院病历管理系统

项目编号:BS-YL-006


本系统基于JSP+SERVLET实现医院病历管理系统,前端基于CSS+JS实现开发,数据库采用MYSQL,开发工具为IDEA或ECLIPSE均可。


本系统共分为四个角色:


管理员角色:主要管理工作人员信息,管理员信息,系统日志等。


医生角色:主要进行患者就诊,病历管理,处方管理,个人信息管理等功能。


窗口工作人员角色:主要进行划价收费工作。


库存工作人员角色:主要管理药品相关的库存工作。


系统部分功能展示:


http://localhost:8080/tjsqyygl/login.jsp

image.png

管理员登陆:


工作人员管理

image.png

管理人员管理

image.png

日志管理

image.png

image.png

医生登陆系统:


患者就诊

image.png

填写病历

image.png

病历查看

image.png

处方管理

image.png

个人信息管理

image.png

窗口工作人员:


患者挂号

image.png

处方划价

image.png

处方缴费

image.png

药品取药

image.png

库管人员登陆


药品管理

image.png

药品入库管理

image.png

药品盘点

image.png

本系统功能完整,运行无误,界面简洁大方,适合做毕业设计使用。

部分代码实现:

package cn.bukaa.control;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.bukaa.dao.CommDAO;
import cn.bukaa.util.Info;
public class UserController extends MainCtrl {
  private CommDAO dao;
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    dao = new CommDAO();
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String ac = request.getParameter("ac");
    String date = Info.getDateStr();
    String today = date.substring(0, 10);
    String tomonth = date.substring(0, 7);
    if ("login".equals(ac)) {
      login(request, response);
    }else if("logout".equals(ac)){
      logout(request,response);
    }
    else if("uppass".equals(ac)){
      updatePass(request, response);
    }
  }
  private void logout(HttpServletRequest request,HttpServletResponse response) {
    request.getSession().invalidate();
    gor("login.jsp", request, response);
  }
  private void login(HttpServletRequest request, HttpServletResponse response){
    String pagerandom = request.getParameter("pagerandom") == null ? ""
        : request.getParameter("pagerandom");
    String random = (String) request.getSession()
        .getAttribute("random");
    if (!pagerandom.equals(random) && request.getParameter("a") != null) {
      request.setAttribute("random", "");
      go("/login.jsp", request, response);
    } else {
      dao = new CommDAO();
      String username = request.getParameter("uname");
      String password = request.getParameter("upass");
      String utype = request.getParameter("utype");
      request.getSession().setAttribute("utype", utype);
      List<HashMap> list = dao
          .select("select * from sysuser where uname='"
              + username + "'");
      if (list.size() == 1) {
        HashMap map = list.get(0);
        List<HashMap> ulist = dao
            .select("select * from sysuser where uname='"
                + username + "' and upass='" + password
                + "'");
        if (ulist.size() == 1
            && password.equals(map.get("upass").toString())) {
          request.getSession().setAttribute("admin", map);
          dao = new CommDAO();
          HashMap<String,Object> ext = new HashMap<String,Object>();
          ext.put("userid", map.get("id"));
          ext.put("tname", map.get("tname"));
          ext.put("oper", "登录");
          request.setAttribute("f", "f");
          dao.insert(request, response, "log", ext, false, true);
          gor("admin/index.jsp", request, response);
        } else {
          request.setAttribute("error", "");
          go("/login.jsp", request, response);
        }
      } else {
        request.setAttribute("error", "");
        go("/login.jsp", request, response);
      }
    }
  }
  private void  updatePass(HttpServletRequest request, HttpServletResponse response){
    dao = new CommDAO();
    String olduserpass = request.getParameter("oldpass");
    String userpass = request.getParameter("upass");
    String copyuserpass = request.getParameter("repass");
    HashMap user = dao.getmap(Info.getUser(request).get("id")
        .toString(), "sysuser");
    if (!(((String) user.get("upass")).equals(olduserpass))) {
      request.setAttribute("error", "");
      go("/admin/uppass.jsp", request, response);
    } else {
      String id = (String) user.get("id");
      String sql = "update sysuser set upass='" + userpass
          + "' where id=" + id;
      dao.commOper(sql);
      request.setAttribute("suc", "");
      go("/admin/uppass.jsp", request, response);
    }
  }
}
package cn.bukaa.control;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.RequestContext;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.servlet.ServletRequestContext;
import cn.bukaa.dao.CommDAO;
import cn.bukaa.util.Info;
public class MainCtrl extends HttpServlet {
  public MainCtrl() {
    super();
  }
  public void destroy() {
    super.destroy(); 
  }
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    this.doPost(request, response);
  }
  public void go(String url, HttpServletRequest request,
      HttpServletResponse response) {
    try {
      request.getRequestDispatcher(url).forward(request, response);
    } catch (ServletException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void gor(String url, HttpServletRequest request,
      HttpServletResponse response) {
    try {
      response.sendRedirect(url);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String ac = request.getParameter("ac");
    if (ac == null)
      ac = "";
    CommDAO dao = new CommDAO();
    String date = Info.getDateStr();
    String today = date.substring(0, 10);
    String tomonth = date.substring(0, 7);
    if (ac.equals("uploaddoc")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploaddoc.jsp?docname=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploaddoc2")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploaddoc2.jsp?docname=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploaddoc3")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploaddoc3.jsp?docname=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    // 导excel
    if (ac.equals("importexcel")) {
      String page = request.getParameter("page");
      String whzdstr = request.getParameter("whzdstr");
      String tablename = request.getParameter("tablename");
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
          if (filename.indexOf(".xls") > -1) {
            Workbook workbook;
            try {
              workbook = Workbook.getWorkbook(new File(request
                  .getRealPath("/upfile/") + "/" + filename));
              // 通过Workbook的getSheet方法选择第一个工作簿(从0开始)
              Sheet sheet = workbook.getSheet(0);
              // 通过Sheet方法的getCell方法选择位置为C2的单元格(两个参数都从0开始)
              for (int i = 1; i < 1000; i++) {
                Cell cell = null;
                try {
                  String isql = "insert into " + tablename
                      + "(";
                  for (String str : whzdstr.split("-")) {
                    isql += str + ",";
                  }
                  isql = isql.substring(0, isql.length() - 1);
                  isql += ")values(";
                  int j = 0;
                  int empty = 1;
                  for (String str : whzdstr.split("-")) {
                    cell = sheet.getCell(j, i);
                    isql += "'" + cell.getContents() + "',";
                    String content = cell.getContents() == null ? ""
                        : cell.getContents();
                    if (!"".equals(content.trim())) {
                      empty = 0;
                    }
                    j++;
                  }
                  if (empty == 1)
                    continue;
                  isql = isql.substring(0, isql.length() - 1);
                  isql += ")";
                  dao.commOper(isql);
                } catch (Exception e) {
                  continue;
                }
              }
              workbook.close();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        }
        go("/admin/" + page + "?docname=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploadimg")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploadimg.jsp?filename=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploadimg2")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploadimg2.jsp?filename=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploadimg3")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploadimg3.jsp?filename=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploadimg4")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploadimg4.jsp?filename=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    if (ac.equals("uploadimg5")) {
      try {
        String filename = "";
        request.setCharacterEncoding("utf-8");
        RequestContext requestContext = new ServletRequestContext(
            request);
        if (FileUpload.isMultipartContent(requestContext)) {
          DiskFileItemFactory factory = new DiskFileItemFactory();
          factory.setRepository(new File(request
              .getRealPath("/upfile/") + "/"));
          ServletFileUpload upload = new ServletFileUpload(factory);
          upload.setSizeMax(100 * 1024 * 1024);
          List items = new ArrayList();
          items = upload.parseRequest(request);
          FileItem fileItem = (FileItem) items.get(0);
          if (fileItem.getName() != null && fileItem.getSize() != 0) {
            if (fileItem.getName() != null
                && fileItem.getSize() != 0) {
              File fullFile = new File(fileItem.getName());
              filename = Info.generalFileName(fullFile.getName());
              File newFile = new File(
                  request.getRealPath("/upfile/") + "/"
                      + filename);
              try {
                fileItem.write(newFile);
              } catch (Exception e) {
                e.printStackTrace();
              }
            } else {
            }
          }
        }
        go("/js/uploadimg5.jsp?filename=" + filename, request, response);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    dao.close();
    out.flush();
    out.close();
  }
  public void init() throws ServletException {
  }
}
相关文章
|
2月前
|
Java 关系型数据库 MySQL
毕设项目&课程设计&毕设项目:springboot+jsp实现的房屋租租赁系统(含教程&源码&数据库数据)
本文介绍了一款基于Spring Boot和JSP技术的房屋租赁系统,旨在通过自动化和信息化手段提升房屋管理效率,优化租户体验。系统采用JDK 1.8、Maven 3.6、MySQL 8.0、JSP、Layui和Spring Boot 2.0等技术栈,实现了高效的房源管理和便捷的租户服务。通过该系统,房东可以轻松管理房源,租户可以快速找到合适的住所,双方都能享受数字化带来的便利。未来,系统将持续优化升级,提供更多完善的服务。
毕设项目&课程设计&毕设项目:springboot+jsp实现的房屋租租赁系统(含教程&源码&数据库数据)
|
3月前
|
安全 Java 关系型数据库
毕设项目&课程设计&毕设项目:基于springboot+jsp实现的健身房管理系统(含教程&源码&数据库数据)
本文介绍了一款基于Spring Boot和JSP技术实现的健身房管理系统。随着健康生活观念的普及,健身房成为日常锻炼的重要场所,高效管理会员信息、课程安排等变得尤为重要。该系统旨在通过简洁的操作界面帮助管理者轻松处理日常运营挑战。技术栈包括:JDK 1.8、Maven 3.6、MySQL 8.0、JSP、Shiro、Spring Boot 2.0等。系统功能覆盖登录、会员管理(如会员列表、充值管理)、教练管理、课程管理、器材管理、物品遗失管理、商品管理及信息统计等多方面。
|
3月前
|
供应链 前端开发 Java
JSP+servlet+mybatis+layui服装库存管理系统(大三上学期课程设计)
这篇文章通过一个服装库存管理系统的实例,展示了在Spring Boot项目中使用Ajax、JSON、layui、MVC架构和iframe等技术,涵盖了注册登录、权限管理、用户管理、库存管理等功能,并提供了系统运行环境和技术要求的详细说明。
JSP+servlet+mybatis+layui服装库存管理系统(大三上学期课程设计)
|
5月前
|
Java 关系型数据库 MySQL
基于JSP的高校毕业生就业满意度调查统计系统
基于JSP的高校毕业生就业满意度调查统计系统
|
5月前
|
搜索推荐 Java 关系型数据库
基于JSP的房屋租赁系统
基于JSP的房屋租赁系统
|
5月前
|
安全 Java 关系型数据库
基于JSP技术的个人网站系统
基于JSP技术的个人网站系统
|
5月前
|
安全 Java 关系型数据库
基于JSP技术的定西扶贫惠农推介系统
基于JSP技术的定西扶贫惠农推介系统
|
5月前
|
安全 Java 关系型数据库
基于JSP技术的电子商城系统
基于JSP技术的电子商城系统
|
5月前
|
安全 Java 关系型数据库
基于JSP技术的弹幕视频网站系统
基于JSP技术的弹幕视频网站系统
|
5月前
|
安全 Java 关系型数据库
基于JSP技术的大学生校园兼职系统
基于JSP技术的大学生校园兼职系统