J2EE课程设计实训项目《社区医疗信息管理系统》——构建出项目的数据库系统及用户信息相关的数据库表结构
J2EE 课程设计项目——社区信息管理系统——在项目的表示层组件中实现Web表单验证等功能
![J2EE 课程设计项目——社区信息管理系统——在项目的表示层组件中实现Web表单验证等功能](https://img.taocdn.com/s3/m/c5d2c7c2360cba1aa811dabe.png)
在项目的表示层组件中实现Web表单验证等功能1.1.1应用validator.js验证模板组件1、使用方法(1)在页面中引用validator.js<script language="javascript" type="text/javascript" src="../../javascript/commonFunction.js"charset="gbk" ></script>(2)在需要验证的表单<form>标签中加上onSubmit="return Validator.Validate(this,3)"。
<form name="theForm" id="demo" method="get" onSubmit="return Validator.Validate(this,3)"> </ form>其中的Validate函数有两个可选的参数,第一个参数为表单对象,如果是写在表单的onSubmit事件中,可以用this指代当前表单,默认值为事件源对象;第二个参数为错误提示模式,可选值为1,2和3,默认值为1。
省略第二个参数时相当于使用Validate(objform,1),省略第一个参数时相当于Validate(this,1)。
注意,不可以省略第一个参数而只写第二个参数,Validate(,2)是错误的用法。
(3)在表单的数据输入标签中加入dataType="数据类型"和msg="错误提示信息"如下示例:<input name="Card" dataType="IdCard" msg="身份证号错误">其中的msg代表在验证失败时要提示的出错信息,为字符串,必选的数据。
J2EE课程设计《社区医疗信息管理系统》——在项目中应用Struts2的拦截器实现对用户访问状态进行拦截和控制
![J2EE课程设计《社区医疗信息管理系统》——在项目中应用Struts2的拦截器实现对用户访问状态进行拦截和控制](https://img.taocdn.com/s3/m/a136092e10661ed9ad51f334.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——在项目中应用Struts2的拦截器实现对用户访问状态进行拦截和控制1.1.1在项目中应用Struts2的拦截器实现对用户访问状态进行拦截和控制1、在项目中添加UserInfoInterceptor拦截器package com.px1987.sshchims.interceptor;import java.util.Map;import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.AbstractInterceptor;import erInfoActionForm;public class UserInfoInterceptor extends AbstractInterceptor {public UserInfoInterceptor() {}@Overridepublic String intercept(ActionInvocation oneActionInvocation) throws Exception { Map session = oneActionInvocation.getInvocationContext().getSession();UserInfoActionForm oneUserInfo = (UserInfoActionForm)session.get("oneUserInfo");if(oneUserInfo==null){return "login";}String returnResult = oneActionInvocation.invoke();return returnResult;}}注意:最好将拦截器设计为“方法过滤”类型的拦截器2、在struts.xml中“定义”和“引用”该拦截器(1)定义该拦截器<interceptors><interceptor name="userinfoInterceptor"class="erInfoInterceptor"/> </interceptors>(2)引用该拦截器<action name ="medicalInfoAction"class ="medicalInfoActionBean" ><interceptor-ref name="userinfoInterceptor"></interceptor-ref><interceptor-ref name="defaultStack"/><result name="success">/medicalInf/index.jsp</result><result name="goQueryMedicalInfo">/medicalInf/queryMedicalInfo.jsp</result><result name="input">/medicalInf/queryMedicalInfo.jsp</result><result name="goStatistMedicalInfo">/medicalInf/statistMedicalInfo</result><result name="goPrintMedicalInfo">/medicalInf/printMedicalInfo.jsp</result><result name="goShowQueryResultInfo">/medicalInf/queryMedicalInfo.jsp</result></action>(3)定义一个名称为login的结果(本例设计为全局结果)<global-results><result name="error">/errorDeal/showWebAppError.jsp</result><result name="login">/index.jsp</result></global-results>3、测试该拦截器的效果(1)没有进行系统登录就直接访问目标页面http://127.0.0.1:8080/sshchims/medicalInfoAction!goQueryMedicalInfo.action系统将进行拦截,并自动地跳转下面的登录页面中。
《社区医疗信息管理系统》——实现分页查询中的修改、删除和批量删除老年人档案信息的功能模块(第2部分)
![《社区医疗信息管理系统》——实现分页查询中的修改、删除和批量删除老年人档案信息的功能模块(第2部分)](https://img.taocdn.com/s3/m/9827ec1f763231126fdb1104.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——实现分页查询中的修改、删除和批量删除老年人档案信息的功能模块(第2/2部分)1.1.1实现分页查询中的修改、删除和批量删除老年人档案信息的功能模块3、设计和实现Servlet程序中相关的功能方法package com.px1987.sshchims.action;import java.io.IOException;import java.io.UnsupportedEncodingException;import java.util.HashSet;import java.util.List;import java.util.Set;import java.util.UUID;import javax.servlet.RequestDispatcher;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts2.ServletActionContext;import com.opensymphony.xwork2.Action;import com.px1987.sshchims.actionform.OlderFilesActionForm;import com.px1987.sshchims.actionform.OlderFilesActionFormUtil;import com.px1987.sshchims.dao.imple.OlderFilesDAOImple;import com.px1987.sshchims.dao.inter.OlderFilesDAOInterface;import com.px1987.sshchims.dao.po.ChildrenFilesPO;import com.px1987.sshchims.dao.po.OlderFilesPO;import com.px1987.sshchims.dao.po.PageStatePO;import com.px1987.sshchims.exception.CHIMSException;public class OlderFilesManageAction extends HttpServlet {private static final long serialVersionUID = 1L;public OlderFilesManageAction() {super();}public void destroy() {super.destroy();}public void init() throws ServletException {}public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {doActionService(request, response);}public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {/*** 对Post请求中的中文信息进行转码*/request.setCharacterEncoding("gb2312");/*** 然后再对“中央控制器调度”调用*/doActionService(request, response);}/*** 下面的doActionService方法为get/post的请求的“中央控制器调度”*/public void doActionService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {/**中央控制器调度方法代码在此省略*/}/*** 下面的方法是响应分页显示的结果页面中的批量删除老年人档案信息* @param request* @param response* @param currentOlderFilesActionForm* @throws ServletException* @throws IOException*/public void doBatchDeleteOlderFileInfoAction(HttpServletRequest request, HttpServletResponse response,OlderFilesActionForm currentOlderFilesActionForm)throws ServletException, IOException {RequestDispatcher currentRequestDispatcher=null;/*** 获得所选中的待删除的老年人档案信息的编号,并识别是否选择了任何的档案编号*/String deleteFileIDs[]=currentOlderFilesActionForm.getDeleteFileIDs();if((deleteFileIDs==null)||(deleteFileIDs.length==0)){/*** 跳转到错误信息显示的页面中去显示错误信息*/request.setAttribute("errorText", "你没有选择任何要删除的档案编号,请选择待删除的档案编号!");currentRequestDispatcher=request.getRequestDispatcher("/errorDeal/showWebAppError.jsp");currentRequestDispatcher.forward(request, response);return;}/*** 将保存在数组中的各个待删除的档案编号转存到Set集合中*/Set<String> deleteFilesIDs=new HashSet<String>();for(int loopIndex=0; loopIndex <deleteFileIDs.length; loopIndex++){ deleteFilesIDs.add(deleteFileIDs[loopIndex]);}/*** 构建实现老年人档案信息存储的DAO组件对象*/OlderFilesDAOInterface oneOlderFilesDAOImple=null; oneOlderFilesDAOImple=new OlderFilesDAOImple();/*** 对DAO组件类中的批量删除的方法进行调用,完成最终的批量删除功能*/try {oneOlderFilesDAOImple.deleteSomeOlderFileInfo(deleteFilesIDs);} catch (CHIMSException e) {e.printStackTrace();}/*** 再进行分页查询删除后的数据库表,并获得相关的数据*/PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 由于是分页状态下的批量删除,因此需要从表单对象中获得当前的显示页码*/onePageStatePO.setCurrentPageNumber(currentOlderFilesActionForm.getCurrentPageNum ber());onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 对DAO组件对象内的目标方法进行调用,并获得相关的返回结果的集合数据*/List<OlderFilesPO> returnAllOlderFilesPOResult=null;try {returnAllOlderFilesPOResult=oneOlderFilesDAOImple.dividPageQueryOlderFileInfo(query SQLWhere, onePageStatePO);} catch (CHIMSException e) {e.printStackTrace();}/*** 识别返回的结果集合中是否存在有效的数据*/boolean returnResultStatus=true;if((returnAllOlderFilesPOResult==null)||(returnAllOlderFilesPOResult.size()==0)){ returnResultStatus=false;}else{returnResultStatus=true;}/*** 识别处理(保存)的操作结果状态,并分别进行跳转*/if(returnResultStatus){request.setAttribute("olderFilesPOList", returnAllOlderFilesPOResult);/*** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);/*** 跳转到目标页面中去显示查询的结果数据*/currentRequestDispatcher=request.getRequestDispatcher("/mainMenuThree/dividPageShow QueryResult.jsp");}else{request.setAttribute("errorText", "系统在查询老年人档案信息时出现了错误,请重新查询老年人的档案信息!");currentRequestDispatcher=request.getRequestDispatcher("/errorDeal/showWebAppError.jsp ");}currentRequestDispatcher.forward(request, response);}/*** 下面的方法是响应删除单个老年人的档案信息* @param request* @param response* @param currentOlderFilesActionForm* @throws ServletException* @throws IOException*/public void doOnLineDeleteOneOlderFileInfoAction(HttpServletRequest request, HttpServletResponse response,OlderFilesActionForm currentOlderFilesActionForm)throws ServletException, IOException {/*** 构建实现老年人档案信息存储的DAO组件对象*/OlderFilesDAOInterface oneOlderFilesDAOImple=null;oneOlderFilesDAOImple=new OlderFilesDAOImple();/*** 通过调用DAO组件中的相关的删除方法实现删除功能*/try {oneOlderFilesDAOImple.deleteOneOlderFileInfo(currentOlderFilesActionForm.getFilesID() );} catch (CHIMSException e) {e.printStackTrace();}/*** 再进行分页查询删除后的数据库表,并获得相关的数据*/PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 由于是分页状态下的删除,因此需要从表单对象中获得当前的显示页码*/onePageStatePO.setCurrentPageNumber(currentOlderFilesActionForm.getCurrentPageNum ber());onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 对DAO组件对象内的目标方法进行调用,并获得相关的返回结果的集合数据*/List<OlderFilesPO> returnAllOlderFilesPOResult=null;try {returnAllOlderFilesPOResult=oneOlderFilesDAOImple.dividPageQueryOlderFileInfo(querySQLWhere, onePageStatePO);} catch (CHIMSException e) {e.printStackTrace();}/*** 识别返回的结果集合中是否存在有效的数据*/boolean returnResultStatus=true;if((returnAllOlderFilesPOResult==null)||(returnAllOlderFilesPOResult.size()==0)){ returnResultStatus=false;}else{returnResultStatus=true;}RequestDispatcher currentRequestDispatcher=null;/*** 识别处理(保存)的操作结果状态,并分别进行跳转*/if(returnResultStatus){request.setAttribute("olderFilesPOList", returnAllOlderFilesPOResult);/*** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);/*** 跳转到目标页面中去显示查询的结果数据*/currentRequestDispatcher=request.getRequestDispatcher("/mainMenuThree/dividPageShow QueryResult.jsp");}else{request.setAttribute("errorText", "系统在查询老年人档案信息时出现了错误,请重新查询老年人的档案信息!");currentRequestDispatcher=request.getRequestDispatcher("/errorDeal/showWebAppError.jsp ");}currentRequestDispatcher.forward(request, response);}/*** 下面的方法是响应“修改”链接按钮的点击事件* @param request* @param response* @param currentOlderFilesActionForm* @throws ServletException* @throws IOException*/public void doOnLineUpdateOneOlderFileInfosAction(HttpServletRequest request, HttpServletResponse response,OlderFilesActionForm currentOlderFilesActionForm)throws ServletException, IOException {/*** 解决get提交的中文乱码*/String olderName=currentOlderFilesActionForm.getOlderName();if(olderName!=null){try {olderName=new String(olderName.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setOlderName(olderName);}String homeAddress=currentOlderFilesActionForm.getHomeAddress();if(homeAddress!=null){try {homeAddress=new String(homeAddress.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setHomeAddress(homeAddress);}String workUnitName=currentOlderFilesActionForm.getWorkUnitName();if(workUnitName!=null){try {workUnitName=new String(workUnitName.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setWorkUnitName(workUnitName);}String nation=currentOlderFilesActionForm.getNation();if(nation!=null){try {nation=new String(nation.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setNation(nation);}String occupational=currentOlderFilesActionForm.getOccupational();if(occupational!=null){try {occupational=new String(occupational.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setOccupational(occupational);}String bloodGroup=currentOlderFilesActionForm.getBloodGroup();if(bloodGroup!=null){try {bloodGroup=new String(bloodGroup.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setBloodGroup(bloodGroup);}String healthProblems=currentOlderFilesActionForm.getHealthProblems();if(healthProblems!=null){try {healthProblems=newString(healthProblems.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setBloodGroup(healthProblems);}String diseaseProcessTable=currentOlderFilesActionForm.getDiseaseProcessTable();if(diseaseProcessTable!=null){try {diseaseProcessTable=new String(diseaseProcessTable.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setDiseaseProcessTable(diseaseProcessTable);}String healthCounseling=currentOlderFilesActionForm.getHealthCounseling();if(healthCounseling!=null){try {healthCounseling=new String(healthCounseling.getBytes("ISO8859-1"),"GB2312");} catch (UnsupportedEncodingException e) {e.printStackTrace();}currentOlderFilesActionForm.setHealthCounseling(healthCounseling);}PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 由于是分页状态下的修改,因此需要从表单对象中获得当前的显示页码*/onePageStatePO.setCurrentPageNumber(currentOlderFilesActionForm.getCurrentPageNum ber());onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);request.setAttribute("updatedOlderFilesPO",OlderFilesActionFormUtil.saveOlderActionFormToPO(currentOlderFilesActionForm));/*** 跳转到目标修改页面中*/RequestDispatcher currentRequestDispatcher=null;currentRequestDispatcher=request.getRequestDispatcher("/mainMenuThree/updateFileInfo.j sp");currentRequestDispatcher.forward(request, response);}/*** 下面的方法是响应“修改表单”中的“提交”按钮的点击事件* @param request* @param response* @param currentOlderFilesActionForm* @throws ServletException* @throws IOException*/public void doUpdateOlderFilesFormAction(HttpServletRequest request, HttpServletResponse response,OlderFilesActionForm currentOlderFilesActionForm) throws ServletException, IOException {/*** 将ActionForm组件转存到PO对象中*/OlderFilesPO oneOlderFilesPO=OlderFilesActionFormUtil.saveOlderActionFormToPO(currentOlderFilesActionForm);/*** 构建实现老年人档案信息存储的DAO组件对象*/OlderFilesDAOInterface oneOlderFilesDAOImple=null;oneOlderFilesDAOImple=new OlderFilesDAOImple();/*** 通过调用DAO组件中的相关的修改方法实现修改功能*/try {oneOlderFilesDAOImple.updateOneOlderFileInfo(oneOlderFilesPO);} catch (CHIMSException e) {e.printStackTrace();}/*** 再进行分页查询删除后的数据库表,并获得相关的数据*/PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 由于是分页状态下的删除,因此需要从表单对象中获得当前的显示页码*/onePageStatePO.setCurrentPageNumber(currentOlderFilesActionForm.getCurrentPageNumber() );onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 对DAO组件对象内的目标方法进行调用,并获得相关的返回结果的集合数据*/List<OlderFilesPO> returnAllOlderFilesPOResult=null;try {returnAllOlderFilesPOResult=oneOlderFilesDAOImple.dividPageQueryOlderFileInfo(query SQLWhere, onePageStatePO);} catch (CHIMSException e) {e.printStackTrace();}/*** 识别返回的结果集合中是否存在有效的数据*/boolean returnResultStatus=true;if((returnAllOlderFilesPOResult==null)||(returnAllOlderFilesPOResult.size()==0)){ returnResultStatus=false;}else{returnResultStatus=true;}RequestDispatcher currentRequestDispatcher=null;/*** 识别处理(保存)的操作结果状态,并分别进行跳转*/if(returnResultStatus){request.setAttribute("olderFilesPOList", returnAllOlderFilesPOResult);/*** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);/*** 跳转到目标页面中去显示查询的结果数据*/currentRequestDispatcher=request.getRequestDispatcher("/mainMenuThree/dividPageShow QueryResult.jsp");}else{request.setAttribute("errorText", "系统在查询老年人档案信息时出现了错误,请重新查询老年人的档案信息!");currentRequestDispatcher=request.getRequestDispatcher("/errorDeal/showWebAppError.jsp ");}currentRequestDispatcher.forward(request, response);}/*** 下面的方法实现恢复老年人档案的信息* @param request* @param response* @param currentOlderFilesActionForm* @throws ServletException* @throws IOException*/public void doRestoreOlderFileInfoAction(HttpServletRequest request, HttpServletResponse response,OlderFilesActionForm currentOlderFilesActionForm)throws ServletException, IOException {PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 由于是第一次访问,因此获得第一页的数据*/onePageStatePO.setCurrentPageNumber(firstPageNumber);onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 定义查询待恢复的档案信息的HQL的查询条件*/restoreDeletedFilesSQLWhere=" where deleteFlag=0";/*** 构建实现老年人档案信息存储的DAO组件对象*/OlderFilesDAOInterface oneOlderFilesDAOImple=null; oneOlderFilesDAOImple=new OlderFilesDAOImple();/*** 对DAO类中的查询方法进行调用*/List<OlderFilesPO> returnAllOlderFilesPOResult=null;try {returnAllOlderFilesPOResult=oneOlderFilesDAOImple.dividPageQueryOlderFileInfo(restoreDeletedFilesSQLWhere,onePageStatePO);} catch (CHIMSException e) {e.printStackTrace();}/*** 识别返回的结果集合中是否存在有效的数据*/boolean returnResultStatus=true;if((returnAllOlderFilesPOResult==null)||(returnAllOlderFilesPOResult.size()==0)){ returnResultStatus=false;}else{returnResultStatus=true;}RequestDispatcher currentRequestDispatcher=null;/*** 识别处理(保存)的操作结果状态,并分别进行跳转*/if(returnResultStatus){request.setAttribute("deletedOlderFilesPOList", returnAllOlderFilesPOResult);/*** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);/*** 跳转到目标页面中去显示查询的结果数据*/currentRequestDispatcher=request.getRequestDispatcher("/mainMenuThree/restoreDeleteFil eInfosResult.jsp");}else{request.setAttribute("errorText", "系统在查询删除的老年人档案信息时出现了错误或者没有找到相关的数据!");currentRequestDispatcher=request.getRequestDispatcher("/errorDeal/showWebAppError.jsp ");}currentRequestDispatcher.forward(request, response);}/*** 下面的方法实现恢复所选中的各个删除的老年人信息的请求响应方法* @param request* @param response* @param currentOlderFilesActionForm* @throws ServletException* @throws IOException*/public void doBatchRestoreOlderFileInfoAction(HttpServletRequest request, HttpServletResponse response,OlderFilesActionForm currentOlderFilesActionForm)throws ServletException, IOException {RequestDispatcher currentRequestDispatcher=null;/*** 获得所选中的待恢复的老年人档案信息的编号,并识别是否选择了任何的档案编号*/String restoreFileIDs[]=currentOlderFilesActionForm.getRestoreFileIDs();if((restoreFileIDs==null)||(restoreFileIDs.length==0)){/*** 跳转到错误信息显示的页面中去显示错误信息*/request.setAttribute("errorText", "你没有选择任何要恢复的档案编号,请选择待恢复的档案编号!");currentRequestDispatcher=request.getRequestDispatcher("/errorDeal/showWebAppError.jsp ");currentRequestDispatcher.forward(request, response);return;}/*** 将保存在数组中的各个待恢复的档案编号转存到Set集合中*/Set<String> restoringFileIDs=new HashSet<String>();for(int loopIndex=0; loopIndex <restoreFileIDs.length; loopIndex++){restoringFileIDs.add(restoreFileIDs[loopIndex]);}/*** 构建实现老年人档案信息存储的DAO组件对象*/OlderFilesDAOInterface oneOlderFilesDAOImple=null;oneOlderFilesDAOImple=new OlderFilesDAOImple();/*** 对DAO组件类中的批量恢复的方法进行调用,完成最终的批量恢复功能*/try {oneOlderFilesDAOImple.restoreSomeOlderFileInfo(restoringFileIDs);} catch (CHIMSException e) {e.printStackTrace();}/*** 构建恢复数据后的分页查询的状态对象*/PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 从表单对象中获得当前的显示页码*/onePageStatePO.setCurrentPageNumber(currentOlderFilesActionForm.getCurrentPageNum ber());onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 再查询恢复后的数据库表,并获得没有进行恢复的相关数据(也就是已经删除的数据)。
J2EE课程设计实训项目《社区医疗信息管理系统》——实现新生儿档案信息的Hibernate框架的DAO数据访问组件
![J2EE课程设计实训项目《社区医疗信息管理系统》——实现新生儿档案信息的Hibernate框架的DAO数据访问组件](https://img.taocdn.com/s3/m/b7a885c0d15abe23482f4d45.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——实现系统中新生儿档案信息的Hibernate框架的DAO数据访问组件1、映射封装新生儿档案信息的PO实体类和数据库表(1)在项目中添加ChildrenFilesPO.hbm.xml(2)设计该映射文件<?xml version="1.0"?><!DOCTYPE hibernate-mappingPUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""/hibernate-mapping-3.0.dtd"><hibernate-mapping><class name="com.px1987.sshchims.dao.po.ChildrenFilesPO" table="childrenfiles"> <id name="filesID"><generator class="uuid.hex" /></id><property name="childName" /><property name="motherName" /><property name="childSex" /><property name="birthDay" /><property name="homeAddress" /><property name="telphoneNo" /><property name="deleteFlag" /></class></hibernate-mapping>(3)在hibernate.cfg.xml文件中引用连接该映射文件<mapping resource="ChildrenFilesPO.hbm.xml" />(4)测试ChildrenFilesPO.hbm.xml文件中的映射配置是否正确4、设计相关的DAO接口和对应的接口(1)DAO接口接口名称为ChildrenFilesDAOInterface,包名称为com.px1987.sshchims.dao.inter(2)设计该接口package com.px1987.sshchims.dao.inter;import java.util.List;import java.util.Set;import com.px1987.sshchims.dao.po.ChildrenFilesPO;import com.px1987.sshchims.dao.po.PageStatePO;public interface ChildrenFilesDAOInterface {/*** (1)增加数据*/public boolean addOneChildrenFileInfo(ChildrenFilesPO oneChildrenFileInfo);/*** (2)删除*/public boolean deleteOneChildrenFileInfo(String deleteFilesID);public boolean deleteSomeChildrenFileInfo(Set<String> deleteFilesIDs);/*** (3)修改*/public boolean updateOneChildrenFileInfo(ChildrenFilesPO oneChildrenFileInfo);/*** (4)查询*/public ChildrenFilesPO queryOneChildrenFileInfo(String filesID);public List<ChildrenFilesPO> querySomeChildrenFileInfo(String querySQL);public List<ChildrenFilesPO> queryAllChildrenFileInfo();/*** 分页查询*/public List<ChildrenFilesPO> dividPageQueryChildrenFileInfo(String queryHQLWhere,PageStatePO onePageStatePO);/*** 恢复已删除的数据*/public boolean restoreSomeChildrenFileInfo(Set<String> restoreFilesIDs);}5、设计相关的DAO接口和对应的接口的实现类(1)DAO接口的实现类——应用Spring 的模板类实现数据访问类名称为ChildrenFilesDAOImple,包名称为com.px1987.sshchims.dao.imple,并实现com.px1987.sshchims.dao.inter.ChildrenFilesDAOInterface接口,并继承org.springframework.orm.hibernate3.support.HibernateDaoSupport类(2)在DAO类中定义一个LocalSessionFactoryBean的成员属性private LocalSessionFactoryBean sessionFactory;public void setSessionFactory(LocalSessionFactoryBean sessionFactory) { this.sessionFactory = sessionFactory;}(3)编程该实现类中的相关方法package com.px1987.sshchims.dao.imple;import java.util.Iterator;import java.util.List;import java.util.Set;import org.hibernate.Query;import org.hibernate.Session;import org.springframework.orm.hibernate3.HibernateTemplate;import org.springframework.orm.hibernate3.LocalSessionFactoryBean; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.px1987.sshchims.dao.inter.ChildrenFilesDAOInterface;import com.px1987.sshchims.dao.po.ChildrenFilesPO;import com.px1987.sshchims.dao.po.PageStatePO;public class ChildrenFilesDAOImple extends HibernateDaoSupport implementsChildrenFilesDAOInterface {/*** 下面的sessionFactory是提供给HibernateDaoSupport基类中的getHibernateTemplate 方法*/private LocalSessionFactoryBean sessionFactory;private HibernateTemplate currentHibernateTemplate=null;public void setSessionFactory(LocalSessionFactoryBean sessionFactory) {this.sessionFactory = sessionFactory;}public ChildrenFilesDAOImple() {super();}@Overridepublic boolean addOneChildrenFileInfo(ChildrenFilesPO oneChildrenFileInfo) { currentHibernateTemplate=this.getHibernateTemplate();currentHibernateTemplate.save(oneChildrenFileInfo);return true;}@Overridepublic boolean deleteOneChildrenFileInfo(String filesID) {currentHibernateTemplate=this.getHibernateTemplate();/**ChildrenFilesPO deletedChildrenFilesPO=currentHibernateTemplate.get(ChildrenFilesPO.class, filesID);deletedChildrenFilesPO.setDeleteFlag(0);currentHibernateTemplate.update(deletedChildrenFilesPO);*//**String updateHQL="update com.px1987.sshchims.dao.po.ChildrenFilesPO set deleteFlag=0 where filesID='" +filesID+"'";currentHibernateTemplate.bulkUpdate(updateHQL);*/String updateHQL="update com.px1987.sshchims.dao.po.ChildrenFilesPO set deleteFlag=0 where filesID=?";Object paraValues[]={filesID};currentHibernateTemplate.bulkUpdate(updateHQL, paraValues);return true;}@Overridepublic boolean deleteSomeChildrenFileInfo(Set<String> deleteFilesIDs) {currentHibernateTemplate=this.getHibernateTemplate();String deleteUpdateHQL="update com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO "+"set oneChildrenFilesPO.deleteFlag=0 where oneChildrenFilesPO.filesID=?";/*** bulkUpdate的批量修改行为其实也还是一条一条语句的修改*/Iterator<String> allDeletedFileID=deleteFilesIDs.iterator();while(allDeletedFileID.hasNext()){String oneDeletedFileID=allDeletedFileID.next();currentHibernateTemplate.bulkUpdate(deleteUpdateHQL, oneDeletedFileID);}return true;}@Overridepublic boolean restoreSomeChildrenFileInfo(Set<String> restoreFilesIDs){currentHibernateTemplate=this.getHibernateTemplate();String restoreUpdateHQL="update com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO "+"set oneChildrenFilesPO.deleteFlag=1 where oneChildrenFilesPO.filesID=?";/*** bulkUpdate的批量修改行为其实也还是一条一条语句的修改*/Iterator<String> allREstoreFileID=restoreFilesIDs.iterator();while(allREstoreFileID.hasNext()){String oneRestoredFileID=allREstoreFileID.next();currentHibernateTemplate.bulkUpdate(restoreUpdateHQL, oneRestoredFileID);}return true;}@Overridepublic List<ChildrenFilesPO> queryAllChildrenFileInfo() {// TODO Auto-generated method stubreturn null;}@Overridepublic ChildrenFilesPO queryOneChildrenFileInfo(String filesID) {currentHibernateTemplate=this.getHibernateTemplate();ChildrenFilesPO returnOneChildrenFilesPO=currentHibernateTemplate.get(ChildrenFilesPO.class, filesID);return returnOneChildrenFilesPO;}@Overridepublic List<ChildrenFilesPO> querySomeChildrenFileInfo(String queryHQLWhere) { currentHibernateTemplate=this.getHibernateTemplate();String queryHQLString="from com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO "+queryHQLWhere;List<ChildrenFilesPO> returnAllResult=currentHibernateTemplate.find(queryHQLString);return returnAllResult;}@Overridepublic List<ChildrenFilesPO> dividPageQueryChildrenFileInfo(String queryHQLWhere,PageStatePO onePageStatePO) { /*** 首先获得满足查询条件的记录总数totalCounter*/Session currentSession=this.getSessionFactory().openSession();Query query = currentSession.createQuery("select count(*) from com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO "+queryHQLWhere);Long objectCounter=(Long)query.uniqueResult();long totalCounter=objectCounter.longValue();/*** 根据所获得的满足查询条件的记录总数,动态获得分页状态PO对象中的其它属性值(通过调用* setPageStatePOMemberProperty方法)*/onePageStatePO.setPageStatePOMemberProperty((int)totalCounter);/*** 构建满足查询条件的HQL语句*/String queryHQLString="from com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO "+queryHQLWhere;/*** 创建出包装该HQL语句的Query接口对象*/query = currentSession.createQuery(queryHQLString);/*** 设置分页查询过程中的相关的两个控制参数(开始记录号和返回的每页数量)*/query.setFirstResult(onePageStatePO.getThisPageFirstElementNumber());query.setMaxResults(onePageStatePO.getOnePageSize());/*** 查询出满足条件的某一页的数据,并返回该页数据(注意:不是返回所有的数据)*/List<ChildrenFilesPO> returnAllResult=query.list();return returnAllResult;}@Overridepublic boolean updateOneChildrenFileInfo(ChildrenFilesPO oneChildrenFileInfo) { currentHibernateTemplate=this.getHibernateTemplate();/*** 将修改后的结果PO再次回写到数据库表中*/currentHibernateTemplate.update(oneChildrenFileInfo);return true;}}6、在Spring的IOC的XML配置文件中定义出该DAO组件对象(1)在项目中增加一个新的XML配置childrenfiles_Spring.xml杨教授大学堂精心创作的优秀程序员职业提升必读系列资料(2)在主配置文件中级联该子配置文件<import resource="childrenfiles_Spring.xml"/>(3)在子配置文件中进行定义DAO<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN""/dtd/spring-beans.dtd"><beans><!-- 下面定义对新生儿信息操作的DAO组件对象,并注入sessionFactory --> <bean id="childrenFilesDAOImple"class="com.px1987.sshchims.dao.imple.ChildrenFilesDAOImple"> <property name="sessionFactory"> <ref bean="sessionFactory"/></property> </bean></beans>杨教授大学堂,版权所有,盗版必究。
J2EE课程设计实训项目——《社区医疗信息管理系统》——构建课程设计实训项目中的页面模板和应用页面模板
![J2EE课程设计实训项目——《社区医疗信息管理系统》——构建课程设计实训项目中的页面模板和应用页面模板](https://img.taocdn.com/s3/m/19f85b0459eef8c75fbfb3b1.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——构建课程设计实训项目中的页面模板和应用页面模板1.1.1构建课程设计实训项目中的页面模板和应用页面模板1、在项目中添加美工提供的页面模板及相关的资源文件2、在JSP中包含(引用)模板页(1)在JSP中引用模板页面文件(2)index.jsp页面的代码示例<jsp:include page="/commonPage/pageHead.jsp" ></jsp:include><%@ page language="java" import="java.util.*" pageEncoding="gb2312"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head></head><body>社区信息管理系统首页</body></html><jsp:include page="/commonPage/authorInfo.jsp" ></jsp:include>(3)页头模板页面pageHead.jsp的代码示例<%@ page isELIgnored="false" pageEncoding="GB18030"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb18030" /><title>蓝梦集团社区信息管理系统Web标题页面</title><link href="${pageContext.request.contextPath}/css/indexStyle.css" rel="stylesheet" type="text/css" /><script src="${pageContext.request.contextPath}/SpryAssets/SpryMenuBar.js" type="text/javascript"></script><script src="${pageContext.request.contextPath}/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script><script src="${pageContext.request.contextPath}/SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script><link href="${pageContext.request.contextPath}/SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /><link href="${pageContext.request.contextPath}/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /><link href="${pageContext.request.contextPath}/SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" /><script src="${pageContext.request.contextPath}/Scripts/AC_RunActiveContent.js"type="text/javascript"></script></head><body><div id="topLogoBar"><div id="topLogoBar_spaceColumn">蓝梦社区信息系统</div><div id="topLogoBar_searchInfo"><table width="100%" border="0" id="topLogoBar_rightTable"><tr><td><form action="#" method="post" name="searchInfoForm"><select name="search_Method" id="search_Method"><option value="1" selected="selected">按病人ID搜索</option><option value="2">按病人类型搜索</option><option value="3">按体检时间搜索</option><option value="4">按疾病分类搜索</option></select><input type="text" name="searchKeyWord" id="searchKeyWord" /><input type="image" alt="点击我可以产生提交的行为"src="${pageContext.request.contextPath}/images/search_btn.gif"/></form></td><td align="right"><a href="#" id="indexPageHref">北京社区</a> /<a href="#" id="indexPageHref">上海社区</a> /<a href="#" id="indexPageHref">广州社区</a> /<a href="#" id="systemBBSHref">技术论坛</a> /<a href="#" id="AmericanOffice">集团总部</a></td></tr></table><marquee onmouseover="this.stop();" onmouseout="this.start();"><a href="#">系统最新公告:蓝梦集团成功香港上市,为进军国际化市场迈出了可喜的第一步!点击可以浏览详细的信息...</a></marquee></div><div class="clearFloat"></div></div><div id="navMenuBar"><ul id="MenuBar1" class="MenuBarHorizontal"><li><a href="${pageContext.request.contextPath}/indexContent/index.jsp">返回首页</a></li><li><a class="MenuBarItemSubmenu" href="#">社区医院</a><ul><li><ahref="${pageContext.request.contextPath}/mainMenuOne/hosptialNews.jsp">本院新闻</a></li><li><a href="#">业务活动</a></li><li><a href="#">院长致词</a></li><li><a href="#">工会活动</a></li><li><a href="#">后勤保障</a></li><li><a href="#">社区共建</a></li></ul></li><li><a class="MenuBarItemSubmenu" href="#">儿童档案</a><ul><li><a href="${pageContext.request.contextPath}/mainMenuTwo/addFileInfo.jsp">录入档案</a></li><li><a href="${pageContext.request.contextPath}/mainMenuTwo/queryFileInfoByID.jsp">修改档案</a></li><li><a href="${pageContext.request.contextPath}/mainMenuTwo/querySomeFilesInfo.jsp">查询档案</a></li><li><a href="${pageContext.request.contextPath}/mainMenuTwo/advanceQuerySomeFilesInfo.jsp">高级查询</a></li><li><a href="${pageContext.request.contextPath}/mainMenuTwo/dividPageQueryFileInfo.jsp">分页查询</a></li><li><ahref="${pageContext.request.contextPath}/${pageContext.request.contextPath}/childFilesManag eAction!restoreChildrenFileInfos.action">恢复档案</a></li><li><ahref="${pageContext.request.contextPath}/mainMenuTwo/destoryFileInfo.jsp">注销档案</a></li></ul></li><li><a class="MenuBarItemSubmenu" href="#">老人档案</a><ul><li><ahref="${pageContext.request.contextPath}/mainMenuThree/addFileInfo.jsp">录入档案</a></li><li><ahref="${pageContext.request.contextPath}/mainMenuThree/querySomeFilesInfo.jsp">查询档案</a></li><li><ahref="${pageContext.request.contextPath}/mainMenuThree/advanceQuerySomeFilesInfo.jsp">高级查询</a></li><li><ahref="${pageContext.request.contextPath}/mainMenuThree/restoreFileInfo.jsp">恢复档案</a></li><li><ahref="${pageContext.request.contextPath}/mainMenuThree/backupFileInfo.jsp">备份档案</a></li><li><ahref="${pageContext.request.contextPath}/mainMenuThree/destoryFileInfo.jsp">注销档案</a></li></ul></li><li><a href="#" class="MenuBarItemSubmenu">就诊信息</a><ul><li><a href="#">记录就诊</a></li><li><a href="#">修改就诊</a></li><li><a href="#">删除就诊</a></li><li><a href="#">注销就诊</a></li><li><a href="#">编号查询</a></li><li><a href="#">分类查询</a></li><li><a href="#">高级查询</a></li><li><a href="#">统计报表</a></li></ul></li><li><a href="#" class="MenuBarItemSubmenu">体检结果</a><ul><li><a href="#">录入结果</a></li><li><a href="#">修改结果</a></li><li><a href="#">删除结果</a></li><li><a href="#">编号查询</a></li><li><a href="#">分类查询</a></li><li><a href="#">高级查询</a></li><li><a href="#">统计结果</a></li><li><a href="#">打印结果</a></li></ul></li><li><a href="#" class="MenuBarItemSubmenu">医务人员</a> <ul><li><a href="#">修改密码</a></li><li><a href="#">重新登录</a></li><li><a href="#">添加信息</a></li><li><a href="#">修改信息</a></li><li><a href="#">删除信息</a></li><li><a href="#">编号查询</a></li><li><a href="#">分类查询</a></li><li><a href="#">高级查询</a></li><li><a href="#">人员统计</a></li><li><a href="#">打印简历</a></li></ul></li><li><a href="#" class="MenuBarItemSubmenu">系统服务</a> <ul><li><a href="#">关于我们</a></li><li><a href="#">客户服务</a></li><li><a href="#">在线帮助</a></li><li><a href="#">系统备份</a></li><li><a href="#">安全管理</a></li><li><a href="#">后台管理</a></li></ul></li></ul></div><div class="clearPageContentFloat"></div><div id="pageSplitMenuBar"><div id="TabbedPanels1" class="TabbedPanels"><ul class="TabbedPanelsTabGroup"><li class="TabbedPanelsTab" ><a href="#">慢病管理</a></li><li class="TabbedPanelsTab" ><a href="#">孕妇保健</a></li><li class="TabbedPanelsTab" ><a href="#">儿童保健</a></li><li class="TabbedPanelsTab" ><a href="#">预防免疫</a></li><li class="TabbedPanelsTab" ><a href="#">健康档案管理</a></li><li class="TabbedPanelsTab" ><a href="#">健康教育管理</a></li><li class="TabbedPanelsTab" ><a href="#">老年人群管理</a></li></ul><div class="TabbedPanelsContentGroup"><div class="TabbedPanelsContent"><a href="#">服务提示</a> <a href="#">体检管理</a> <a href="#">访示管理</a> <a href="#">信息维护功能</a></div><div class="TabbedPanelsContent"><a href="#">孕妇健卡</a> <a href="#">孕妇体检</a> <a href="#">孕妇访视</a> <a href="#">统计查询</a> <a href="#">孕产妇管理表</a><a href="#">孕妇预产期提醒</a></div><div class="TabbedPanelsContent"><a href="#">新生儿建卡</a> <a href="#">新生儿体检</a> <a href="#">查询统计</a> <a href="#">新生儿问题管理</a></div><div class="TabbedPanelsContent"><a href="#">系统管理</a> <a href="#">接种管理</a> <a href="#">统计查询</a></div><div class="TabbedPanelsContent"><a href="#">疾病史</a> <a href="#">残疾史</a> <a href="#">社区定义</a> <a href="#">查询统计</a> <a href="#">个人档案管理</a> <a href="#">家庭档案管理</a> <a href="#">主要问题记录</a></div><div class="TabbedPanelsContent"><a href="#">健康资料管理</a> <a href="#">健康教育管理</a></div><div class="TabbedPanelsContent"><a href="#">系统管理</a> <a href="#">查询统计</a><a href="#">老年人访视</a></div></div></div><div class="clearPageContentFloat"></div></div><script type="text/javascript"><!--var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1",{imgDown:"${pageContext.request.contextPath}/SpryAssets/SpryMenuBarDownHover.gif", imgRight:"${pageContext.request.contextPath}/SpryAssets/SpryMenuBarRightHover.gif"}); var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", {contentIsOpen:false});//--></script></body></html>(4)系统版权信息模板页面authorInfo.jsp的代码示例<%@ page isELIgnored="false" pageEncoding="GB18030"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb18030" /><title>底部共用信息页</title><link href="${pageContext.request.contextPath}/css/indexStyle.css" rel="stylesheet" type="text/css" /></head><body><hr /><div id="pageFooter">版权所有,2016-2020 蓝梦集团,版权所有,违法必究。
J2EE课程设计实训项目——《社区医疗信息管理系统》——应用JavaScript脚本程序对各种表单中的数据进行验证
![J2EE课程设计实训项目——《社区医疗信息管理系统》——应用JavaScript脚本程序对各种表单中的数据进行验证](https://img.taocdn.com/s3/m/af3e7361168884868762d645.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——应用JavaScript脚本程序对各种表单中的数据进行验证1.1.1应用JavaScript脚本程序对各种表单中的数据进行验证1、应用JavaScript脚本程序对工作人员的登录表单进行数据有效性检查(1)相关的JavaScript脚本程序代码示例function checkLoginFormValid(thisLoginForm){if((erName.value=="")||(erName.value.length==0)){ window.alert("你的登录账号为空,请输入有效的登录账号!");return false;}else if((erPassWord.value=="")||(erPassWord.value.length==0)){ window.alert("你的登录密码为空,请输入有效的登录密码!");return false;}else if(erPassWord.value.length < 6){window.alert("你的登录密码太短,请输入多于6个字符的有效登录密码!");return false;}return true;}(2)测试表单数据验证的功能实现效果2、应用JavaScript脚本程序对添加新生儿档案信息的表单数据进行检查(1)相关的JavaScript脚本程序代码示例function checkAddFileInfoFormValid(){var userInputedChildName=document.getElementById("oneFilesFormBean.childName").value;if((userInputedChildName=="")||(userInputedChildName.length==0)){window.alert("新生儿档案姓名信息不能为空,请输入有效的新生儿档案姓名!");return false;}var userInputedBirthDay=document.getElementById("oneFilesFormBean.birthDay").value;if((userInputedBirthDay=="")||(userInputedBirthDay.length==0)){window.alert("新生儿出身日期信息不能为空,请输入有效的新生儿出身日期!");return false;}var userInputedHomeAddress=document.getElementById("oneFilesFormBean.homeAddress").value;if((userInputedHomeAddress=="")||(userInputedHomeAddress.length==0)){window.alert("新生儿的家庭地址信息不能为空,请输入有效的新生儿家庭地址信息!");return false;}var userInputedTelphoneNo=document.getElementById("oneFilesFormBean.telphoneNo").value;if((userInputedTelphoneNo=="")||(userInputedTelphoneNo.length==0)){window.alert("新生儿的联系电话不能为空,请输入有效的新生儿联系电话!");return false;}var userInputedMotherName=document.getElementById("oneFilesFormBean.motherName").value;if((userInputedMotherName=="")||(userInputedMotherName.length==0)){window.alert("新生儿的母亲姓名不能为空,请输入有效的新生儿母亲姓名!");return false;}return true;}(2)测试表单数据验证的功能实现效果3、应用JavaScript脚本程序对按照新生儿档案信息编号ID查询的表单数据进行检查(1)相关的JavaScript脚本程序代码示例function checkQueryChildrenFileInfoByIDFormValid(){var userInputedFilesID=document.getElementById("oneFilesFormBean.filesID").value;if((userInputedFilesID=="")||(userInputedFilesID.length==0)){window.alert("待查询的新生儿档案编号信息不能为空,请输入有效的新生儿档案编号!");return false;}return true;}(2)测试基本表单数据验证的功能实现效果(3)测试组合表单数据验证的功能实现效果4、完整的HTML页面和JS代码示例<jsp:include page="/commonPage/pageHead.jsp" ></jsp:include><%@ page isELIgnored="false" pageEncoding="GB18030"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><title>蓝梦集团社区信息管理系统根据新生儿档案信息编号查询的页面</title><script src="${pageContext.request.contextPath}/javascript/commonJavaScript.js" type="text/javascript"></script></head><body><br/><br/><br/><br/><br/><center><form name="queryChildrenFileInfoByID" id="queryChildrenFileInfoByID" action="${pageContext.request.contextPath}/childFilesManageAction!doQueryoSomeChildrenFi leInfo.action"method="post" onsubmit="return checkQueryChildrenFileInfoByIDFormValid()" >新生儿档案编号<select name="oneFilesFormBean.filesIDOperator" id="oneFilesFormBean.filesIDOperator"><option value="1" selected="selected">精确匹配</option><option value="2" >前置模糊匹配</option><option value="3">后置模糊匹配</option></select><input type="text" name="oneFilesFormBean.filesID" id="oneFilesFormBean.filesID" /><br/><br/><br/><input type="image" src="${pageContext.request.contextPath}/images/researchInfo.gif" title="开始查询" /></form></center><br/><br/><br/><br/><br/></body></html><jsp:include page="/commonPage/authorInfo.jsp"></jsp:include>。
J2EE课程设计实训项目《社区医疗信息管理系统》——实现对新生儿档案信息查询结果进行分页显示(第2部分)
![J2EE课程设计实训项目《社区医疗信息管理系统》——实现对新生儿档案信息查询结果进行分页显示(第2部分)](https://img.taocdn.com/s3/m/3a60ee7125c52cc58bd6be33.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——实现对新生儿档案信息的查询结果进行分页显示(第2/2部分)1.1.1实现对查询返回的结果数据集进行分页显示的功能1、在项目中添加包装分页状态的数据PageStatePOpackage com.px1987.sshchims.dao.po;public class PageStatePO {public boolean isFirstPage() {return firstPage;}public void setFirstPage(boolean firstPage) {this.firstPage = firstPage;}public boolean isLastPage() {return lastPage;}public void setLastPage(boolean lastPage) {stPage = lastPage;}public boolean isHasNextPage() {return hasNextPage;}public void setHasNextPage(boolean hasNextPage) {this.hasNextPage = hasNextPage;}public boolean isHasPreviousPage() {return hasPreviousPage;}public void setHasPreviousPage(boolean hasPreviousPage) {this.hasPreviousPage = hasPreviousPage;}public int getLastPageNumber() {return lastPageNumber;}public void setLastPageNumber(int lastPageNumber) {stPageNumber = lastPageNumber;}public int getTotalNumberOfElements() {return totalNumberOfElements;}public void setTotalNumberOfElements(int totalNumberOfElements) { this.totalNumberOfElements = totalNumberOfElements;}public int getThisPageFirstElementNumber() {return thisPageFirstElementNumber;}public void setThisPageFirstElementNumber(int thisPageFirstElementNumber) { this.thisPageFirstElementNumber = thisPageFirstElementNumber;}public int getThisPageLastElementNumber() {return thisPageLastElementNumber;}public void setThisPageLastElementNumber(int thisPageLastElementNumber) { this.thisPageLastElementNumber = thisPageLastElementNumber;}public int getNextPageNumber() {return nextPageNumber;}public void setNextPageNumber(int nextPageNumber) {this.nextPageNumber = nextPageNumber;}public int getPreviousPageNumber() {return previousPageNumber;}public void setPreviousPageNumber(int previousPageNumber) { this.previousPageNumber = previousPageNumber;}public int getOnePageSize() {return onePageSize;}public void setOnePageSize(int onePageSize) {this.onePageSize = onePageSize;}public int getTotalPageNumber() {return totalPageNumber;}public void setTotalPageNumber(int totalPageNumber) { this.totalPageNumber = totalPageNumber;}public int getCurrentPageNumber() {return currentPageNumber;}public void setCurrentPageNumber(int currentPageNumber) { this.currentPageNumber = currentPageNumber;}public byte getSomeOneOrderMethod() {return someOneOrderMethod;}public void setSomeOneOrderMethod(byte someOneOrderMethod) {this.someOneOrderMethod = someOneOrderMethod;}/*** 下面的方法是根据记录总数获得分页中的其他状态属性值*/public void setPageStatePOMemberProperty(int totalNumberOfElements) { /*** 下面的代码是根据总记录数和每页显示的记录数计算出总页数*/if ((totalNumberOfElements % onePageSize) == 0){/** 如果记录总数为每页的整倍数,则计算出其总页数*/totalPageNumber = totalNumberOfElements/onePageSize;}else{/** 如果有不满一页的,则页数加一,并且计算出其总页数*/totalPageNumber = totalNumberOfElements/onePageSize + 1;}/*** 当前页是否是首页(第一页)*/setFirstPage((currentPageNumber==1)?true:false);/*** 如果当前页数不等于总页数,则表明当前页不是最后一页(属于中间的某一页)*/if(currentPageNumber!=totalPageNumber){setLastPage(false);}else{/*** 如果当前页数等于总页数,则表明当前页是最后一页*/setLastPage(true);}/*** 如果当前页数小于总页数,则表明仍然有下一页*/if(currentPageNumber <totalPageNumber){setHasNextPage(true);}else{//如果当前页数大于或者等于总页数,则表明没有了下一页setHasNextPage(false);}if(currentPageNumber ==1){//如果当前页数等于首页(第一页),则表明没有上一页setHasPreviousPage(false);}else{//如果当前页数不等于首页(第一页),则表明有上一页setHasPreviousPage(true);}//总的数据条目数量,0表示没有数据setTotalNumberOfElements(totalNumberOfElements);setLastPageNumber(totalPageNumber); //获取最后一页页码,也就是总页数int thisPageFirstElementNumber=(currentPageNumber-1)*onePageSize;int thisPageEndElementNumber=thisPageFirstElementNumber+(((currentPageNumber!=totalPageNumber)||(totalNumberOfElements % getOnePageSize())==0)?getOnePageSize():(totalNumberOfElements % getOnePageSize())); //当前页是最后一页时,为余数的实际值//获取当前页的首条数据的行编码,(从0开始计数)setThisPageFirstElementNumber(thisPageFirstElementNumber);//获取当前页的末条数据的行编码(从0开始计数)setThisPageLastElementNumber(thisPageEndElementNumber);setNextPageNumber(currentPageNumber+1); //获取下一页编码setPreviousPageNumber(currentPageNumber-1); //获取上一页编码}private boolean firstPage; //是否是首页(第一页),第一页页码为1 private boolean lastPage; //是否是最后一页private boolean hasNextPage; //是否有下一页private boolean hasPreviousPage; //是否有上一页private int lastPageNumber; //获取最后一页页码,也就是总页数private int totalNumberOfElements; //总的数据条目数量,0表示没有数据//获取当前页的首条数据的行编码(从0开始计数)private int thisPageFirstElementNumber;//获取当前页的末条数据的行编码(从0开始计数)private int thisPageLastElementNumber;private int nextPageNumber; //获取下一页编码private int previousPageNumber; //获取上一页编码private int onePageSize; //每一页显示的条目数private int totalPageNumber; //总页数private int currentPageNumber; //当前页的页码private byte someOneOrderMethod; //重新按照某种排序方式再次查询数据public PageStatePO() {super();}}2、在ActionForm组件中添加一个成员属性,并提供get/set方法private int targetPageCounter;public int getTargetPageCounter() {return targetPageCounter;}public void setTargetPageCounter(int targetPageCounter) {this.targetPageCounter = targetPageCounter;}3、编程Action类中的第1次查询的请求响应方法public String doDividPageQueryoChildrenFileInfo(){/*** 构建必须的条件字符串*/queryHQLWhere=" where oneChildrenFilesPO.deleteFlag=1 ";/*** 首先识别操作者在档案编号的输入框是否输入了档案编号*/boolean checkFilesIDInValid=(oneFilesFormBean.getFilesID()==null)||(oneFilesFormBean.getFilesID().length()==0);if(!checkFilesIDInValid){/*** 获得所选择的档案编号的操作符,并识别具体的符号类型*/switch(oneFilesFormBean.getFilesIDOperator()){case 1: /** 精确匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.filesID='"+oneFilesFormBean.getFilesID()+"'";break;case 2: /** 前置模糊匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.filesID like '"+ oneFilesFormBean.getFilesID()+"%'";break;case 3: /** 后置模糊匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.filesID like '%"+oneFilesFormBean.getFilesID()+"'";break;}}/*** 其次识别操作者在新生儿姓名输入框是否输入了新生儿姓名*/boolean checkChildNameInValid= (oneFilesFormBean.getChildName()==null)||(oneFilesFormBean.getChildName().length()==0);if(!checkChildNameInValid){switch(oneFilesFormBean.getChildNameOperator()){case 1: /** 精确匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.childName='"+oneFilesFormBean.getChildName()+"'";break;case 2: /** 前置模糊匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.childName like '"+ oneFilesFormBean.getChildName()+"%'";break;case 3: /** 后置模糊匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.childName like '%"+oneFilesFormBean.getChildName()+"'";break;}}/*** 再识别所选择的新生儿的性别查询的条件要求*/switch(oneFilesFormBean.getChildSex()){case 0: /** 要求选择女孩*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.childSex=0";break;case 1: /** 要求选择男孩*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.childSex=1";break;case 2: /** 男孩或者女孩都可以(对性别没有要求)*/break;}/*** 再识别操作者在新生儿出生日期输入框是否输入了出生日期*/boolean checkBirthDayInValid=(oneFilesFormBean.getBirthDay()==null)||(oneFilesFormBean.getBirthDay().length()==0);if(!checkBirthDayInValid){switch(oneFilesFormBean.getBirthDayOperator()){case 1: /** 精确匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.birthDay='"+ oneFilesFormBean.getBirthDay()+"'";break;case 2: /** 前置模糊匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.birthDay like '"+ oneFilesFormBean.getBirthDay()+"%'";break;case 3: /** 后置模糊匹配*/queryHQLWhere=queryHQLWhere+" and oneChildrenFilesPO.birthDay like '%"+oneFilesFormBean.getBirthDay()+"'";break;}}PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 由于是第一次访问,因此获得第一页的数据*/onePageStatePO.setCurrentPageNumber(1);onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 对DAO类中的查询方法进行调用*/List<ChildrenFilesPO> returnAllResult=childrenFilesDAOImple.dividPageQueryChildrenFileInfo(queryHQLWhere,onePageStatePO);/*** 将所查询出的满足条件的“新生儿”档案信息(returnAllResult)传到显示结果的JSP页面中*/HttpServletRequest request=ServletActionContext.getRequest();request.setAttribute("childrenFilesPOList", returnAllResult);/** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);/*** 跳转到目标页面中去显示查询的结果数据*/return "dividPageShowQueryResult";}4、编程Action类中的第2次查询(查询目标页)的请求响应方法doShowTargetPageChildrenFileInfopublic String doShowTargetPageChildrenFileInfo(){PageStatePO onePageStatePO=null;onePageStatePO=new PageStatePO();/*** 从表单对象中获得需要跳转的目标页码*/onePageStatePO.setCurrentPageNumber(oneFilesFormBean.getTargetPageCounter());onePageStatePO.setOnePageSize(totalRecordInOnePage);/*** 对DAO类中的查询方法进行调用*/List<ChildrenFilesPO> returnAllResult=childrenFilesDAOImple.dividPageQueryChildrenFileInfo(queryHQLWhere,onePageStatePO);/*** 将所查询出的满足条件的“新生儿”档案信息(returnAllResult)传到显示结果的JSP页面中*/HttpServletRequest request=ServletActionContext.getRequest();request.setAttribute("childrenFilesPOList", returnAllResult);/** 将分页状态对象保存到requestScope作用域中,在页面中显示分页状态有关的各个数据*/request.setAttribute("onePageStatePO", onePageStatePO);/*** 跳转到目标页面中去显示查询的结果数据*/return "dividPageShowQueryResult";}5、编程DAO中满足分页数据查询访问方法dividPageQueryChildrenFileInfo@Overridepublic List<ChildrenFilesPO> dividPageQueryChildrenFileInfo(String queryHQLWhere,PageStatePO onePageStatePO) { /*** 首先获得满足查询条件的记录总数totalCounter*/Session currentSession=this.getSessionFactory().openSession();Query query = currentSession.createQuery("select count(*) from com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO " +queryHQLWhere);Long objectCounter=(Long)query.uniqueResult();long totalCounter=objectCounter.longValue();/*** 根据所获得的满足查询条件的记录总数,动态获得分页状态PO对象中的其它属性值(通过调用setPageStatePOMemberProperty方法)*/onePageStatePO.setPageStatePOMemberProperty((int)totalCounter);/*** 构建满足查询条件的HQL语句*/String queryHQLString="from com.px1987.sshchims.dao.po.ChildrenFilesPO as oneChildrenFilesPO "+queryHQLWhere;/*** 创建出包装该HQL语句的Query接口对象*/query = currentSession.createQuery(queryHQLString);/*** 设置分页查询过程中的相关的两个控制参数(开始记录号和返回的每页数量)*/query.setFirstResult(onePageStatePO.getThisPageFirstElementNumber());query.setMaxResults(onePageStatePO.getOnePageSize());/*** 查询出满足条件的某一页的数据,并返回该页数据(注意:不是返回所有的数据)*/List<ChildrenFilesPO> returnAllResult=query.list();return returnAllResult;}6、测试目前的功能实现效果同时在控制台中打印输出满足MySQL数据库的分页查询的SQL语句(加了limit限定)同时也提供对跳转过程中输入的目标页码的正确性判断。
基于S2SH架构的J2EE课程设计实训项目《社区医疗信息管理系统》——实现批量删除新生儿档案信息的功能模块
![基于S2SH架构的J2EE课程设计实训项目《社区医疗信息管理系统》——实现批量删除新生儿档案信息的功能模块](https://img.taocdn.com/s3/m/d49b4eca76a20029bd642d37.png)
return Action.ERROR; } for(int index=0; index < deleteFileIDs.length; index++){
5、在 DAO 类中实现批量删除的数据访问处理方法
@Override
public boolean deleteSomeChildrenFileInfo(Set<String> filesIDs) {
currentHibernateTemplate=this.getHibernateTemplate();
String updateHQL="update com.px1987.sshchims.dao.po.ChildrenFilesPO as
oneChildrenFilesPO
"+"set
oneChildrenFilesPO.deleteFlag=0
where
oneChildrenFilesPO.filesID=?";
杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料
注意 bulkUpdate 的批量修改行为其实也还是一条一条语句的修改。
6、再编程 Action 类中的批量删除的请求处理 public String doBatchDeleteChildrenFileInfo(){ if(oneFilesFormBean==null){ /** * 跳转到错误信息显示的页面中去显示错误信息 */ HttpServletRequest request=ServletActionContext.getRequest(); request.setAttribute("errorText", "你没有选择任何要删除的编号,请选择待删除的档
基于S2SH架构的J2EE课程设计实训项目《社区医疗信息管理系统》——构建出项目的Hibernate框架的开发环境
![基于S2SH架构的J2EE课程设计实训项目《社区医疗信息管理系统》——构建出项目的Hibernate框架的开发环境](https://img.taocdn.com/s3/m/49c2fc18b52acfc789ebc91b.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——构建出项目的Hibernate框架的开发环境1.1.1构建出项目的Hibernate框架的开发环境1、在项目中添加Hibernate的系统库(1)然后将下面的各个*.lib库文件(总共13文件)在Eclipse中导入放到Web应用的/WEB-INF/lib目录中。
antlr-2.7.6.jar、cglib-2.2.jar、commons-collections-3.1.jar、commons-logging-1.0.4.jar (在Struts中已经包含有,可以不再需要它)、javassist-3.9.0.GA.jar、ehcache-1.2.3.jar hibernate3.jar、jta-1.1.jar、dom4j-1.6.1.jar和log4j-1.2.15.jar、slf4j-api-1.5.8.jar和slf4j-simple-1.5.8.jar和c3p0-0.9.1.jar。
(2)最后为下面的状态2、在项目中添加hibernate.cfg.xml文件(1)创建出Hibernate框架的系统配置文件hibernate.cfg.xml(2)系统配置文件hibernate.cfg.xml的代码示例<?xml version='1.0' encoding='gb2312'?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory><property name="dialect">org.hibernate.dialect.MySQLDialect</property><property name="connection.driver_class">com.mysql.jdbc.Driver</property><property name="connection.url">jdbc:mysql://192.168.0.20:3306/chimsdb</property> <property name="ername">root</property><property name="connection.password">root</property><property name="show_sql">true</property></session-factory></hibernate-configuration>3、在项目中添加工作人员的PO实体类(1)实体类名称为StaffInfoPO,程序包名称为com.px1987.sshchims.dao.po(2)添加相关的成员属性(名称与数据库库表中的字段名称保持一致性)private String staffID=null;private String staffName=null;private String staffPassWord=null;private int staffSex=0;private int staffAge=0;private String staffBirth=null;private int department=0;/*** 职务*/private String duty;/*** 职称*/private String positional_titles;(3)为每个成员属性添加get/set方法(4)再添加equals和Hashcode方法(5)StaffInfoPO类最终的代码示例package com.px1987.sshchims.dao.po;public class StaffInfoPO {private String staffID=null;public int hashCode() {final int prime = 31;int result = 1;result = prime * result + department;result = prime * result + ((duty == null) ? 0 : duty.hashCode());result = prime* result+ ((positional_titles == null) ? 0 : positional_titles.hashCode());result = prime * result + staffAge;result = prime * result+ ((staffBirth == null) ? 0 : staffBirth.hashCode());result = prime * result + ((staffID == null) ? 0 : staffID.hashCode());result = prime * result+ ((staffName == null) ? 0 : staffName.hashCode());result = prime * result+ ((staffPassWord == null) ? 0 : staffPassWord.hashCode());result = prime * result + staffSex;return result;}public boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;StaffInfoPO other = (StaffInfoPO) obj;if (department != other.department)return false;if (duty == null) {if (other.duty != null)return false;} else if (!duty.equals(other.duty))return false;if (positional_titles == null) {if (other.positional_titles != null)return false;} else if (!positional_titles.equals(other.positional_titles)) return false;if (staffAge != other.staffAge)return false;if (staffBirth == null) {if (other.staffBirth != null)return false;} else if (!staffBirth.equals(other.staffBirth))return false;if (staffID == null) {if (other.staffID != null)return false;} else if (!staffID.equals(other.staffID))return false;if (staffName == null) {if (other.staffName != null)return false;} else if (!staffName.equals(other.staffName))return false;if (staffPassWord == null) {if (other.staffPassWord != null)return false;} else if (!staffPassWord.equals(other.staffPassWord)) return false;if (staffSex != other.staffSex)return false;return true;}return staffID;}public void setStaffID(String staffID) {this.staffID = staffID;}public String getStaffName() {return staffName;}public void setStaffName(String staffName) { this.staffName = staffName;}public String getStaffPassWord() {return staffPassWord;}public void setStaffPassWord(String staffPassWord) { this.staffPassWord = staffPassWord;}public int getStaffSex() {return staffSex;}public void setStaffSex(int staffSex) {this.staffSex = staffSex;}public int getStaffAge() {return staffAge;}public void setStaffAge(int staffAge) {this.staffAge = staffAge;}return staffBirth;}public void setStaffBirth(String staffBirth) {this.staffBirth = staffBirth;}public int getDepartment() {return department;}public void setDepartment(int department) {this.department = department;}public String getDuty() {return duty;}public void setDuty(String duty) {this.duty = duty;}public String getPositional_titles() {return positional_titles;}public void setPositional_titles(String positionalTitles) { positional_titles = positionalTitles;}private String staffName=null;private String staffPassWord=null;private int staffSex=0;private int staffAge=0;private String staffBirth=null;private int department=0;/*** 职务*/private String duty;/*** 职称*/private String positional_titles;public StaffInfoPO() {super();}}4、映射工作人员的PO类(1)添加StaffInfoPO.hbm.xml文件(2)设计该映射文件<?xml version="1.0"?><!DOCTYPE hibernate-mappingPUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""/hibernate-mapping-3.0.dtd"> <hibernate-mapping><class name="com.px1987.sshchims.dao.po.StaffInfoPO" table="staffinfo"> <!--下面的name="staffID"中的staffID为PO类中的主键属性变量名称--><id name="staffID"><generator class="uuid.hex" /></id><property name="staffName" /><property name="staffPassWord" /><property name="staffSex" /><property name="staffAge" /><property name="staffBirth" /><property name="department" /><property name="duty" /><property name="positional_titles" /></class></hibernate-mapping>(3)在系统配置hibernate.cfg.xml文件中引用连接该映射文件<mapping resource="StaffInfoPO.hbm.xml" />。
《社区医疗信息管理系统》——设计与实现基本查询老年人档案信息相关的JSP页面及查询表单
![《社区医疗信息管理系统》——设计与实现基本查询老年人档案信息相关的JSP页面及查询表单](https://img.taocdn.com/s3/m/9cf72ccd50e2524de4187e04.png)
<tr>
<td><div align="right">老年病人的姓名</div></td>
<td><div align="center">
<select name="oneFilesFormBean.childNameOperator"
id="oneFilesFormBean.childNameOperator">
"/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="/1999/xhtml">
<head>
<title>蓝梦集团社区信息管理系统根据老年人档案信息编号的基本查询的页面
</title>
<option value="1" selected="selected">精确匹配</option>
杨教授大学堂,版权所有,盗版必究。 2/14 页
杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料
<option value="2" >前置模糊匹配</option> <option value="3">后置模糊匹配</option> </select> </div></td> <td><div align="left"> <input type="text" name="oneFilesFormBean.olderName"
软件开发岗位实习报告之医疗信息管理系统开发
![软件开发岗位实习报告之医疗信息管理系统开发](https://img.taocdn.com/s3/m/b07ba910cec789eb172ded630b1c59eef8c79ae4.png)
软件开发岗位实习报告之医疗信息管理系统开发一、引言医疗信息管理系统是近年来医疗行业中广泛应用的一种信息化系统,它的主要功能是对病人的基本信息、医疗记录、药物管理以及医疗设备管理进行集中管理和维护。
作为一名软件开发岗位的实习生,我参与了医疗信息管理系统的开发工作,并通过本报告来详细总结和分享我的实习经验。
二、需求分析在项目开始之前,我和团队成员一起进行了需求分析工作。
我们先与客户进行交流和沟通,了解他们的需求和期望,然后对现有医疗信息管理系统的功能进行了评估和分析,最后确定了系统的需求。
在需求分析过程中,我们发现医疗信息管理系统需要具备以下功能:1. 病人档案管理:包括病人的个人信息、诊断记录、治疗方案等;2. 医生管理:包括医生的基本信息、排班表、医生的工作量统计等;3. 药物管理:包括药品的库存管理、药品的进销存等;4. 设备管理:包括医疗设备的维护记录、设备的安全检查等;5. 报表统计:包括病人的就诊情况统计、医生的工作量统计等。
三、系统设计1. 数据库设计:我们采用了关系型数据库来存储和管理系统中的数据。
通过对数据表的设计和规划,我们能够更好地满足系统的功能需求,并提高数据的查询和存取效率。
2. 前后端分离: 我们采用了前后端分离的架构来开发医疗信息管理系统。
前端使用了React框架来实现用户界面的设计和交互,后端使用了Spring Boot框架来处理业务逻辑和数据交互。
使用前后端分离的架构可以提高开发效率和系统的可维护性。
3. 安全性设计:考虑到医疗信息的保密性和完整性,我们在系统中加入了用户身份验证和权限控制的功能,以保证只有授权人员才能访问和修改系统中的数据。
四、开发实践1. 团队协作:我们采用了敏捷开发的方法来组织和管理项目。
在每个迭代周期开始前,我们与团队成员进行了需求评审和任务分配。
通过每日的Scrum会议,我们及时交流和解决了项目中的问题。
2. 编码规范:为了保证代码的可读性和可维护性,我们制定了一套统一的编码规范,并使用代码检查工具来进行代码质量的检查。
基于J2EE架构的医院信息管理系统的设计
![基于J2EE架构的医院信息管理系统的设计](https://img.taocdn.com/s3/m/1049f2df360cba1aa811da46.png)
民营 科技
21 0 0年第 8 期
ห้องสมุดไป่ตู้
基于 JE 2 E架构的医院信息管理系统的设计
王 常 智
( 齐哈 尔 医学 院 , 龙 江 齐 齐哈 尔 1 10 ) 齐 黑 60 0
摘 要 : 据 本 校 附属 医 院 管理 特 点 , 用 J E 依 采 2 E架 构 , 究设 计 了 医 院 综合 管理 信 息 系统 , 研 以更 现 代 化 、 学化 、 范 化 的 手段 来 加 强 医 院 的 管 科 规 理 , 高 医院 工 作 效 率 , 提 改善 医 院 工作 质 量。 关键词 : 医院 信 息 系统 ; S JE 架构 HI;2 E 医 院信 息 系统 HI( optl nomao ytm) S H s i fr t nS s aI i e 是现 代 化 医 院必 不 可 缺的技术支撑环境和基础设施 ,它体现 r —个现代化医院的综合管理水平。 为了满足我校附属医院发展的需要 , 了以更现代化 、 为 科学化、 规范化的 段 来加强医院的管理, 提高医院的丁作效率, 改进医疗质量 , 从而树立现代医院 的新形象 , 现根据我校附属医院管理牦点, 应用先进的 JE 2 E技术 , 对我校附 属医院的管理信息系统进行具体分析与设计。 J E ( v lt r E trr eE io ) 一种 利 用 Jv 2 EJ a2Paf m,nepi dt n是 a o s i aa2平 台来 简 化 企业解 决方 案的 开发 、 和管 理相 关的 复杂 问题 的体 系结 构 。尽管 它 对 部署 操 作系统 及硬 件配 置要求 低 , 却具 有支持 异 构环 境 , 缩性 强 , 但它 伸 以及稳 定 的可用性等优点。 尤其是它具有高效的可开发性 , 它允许把一些通用的、 很繁 琐的服务端任务交给中问件供应商去完成。 这样开发人员可以集 中精力在如 何创 建逻 辑上 , 应地缩 短 了开发 时 间。 相 因此 , 应用 J E 2 E技术 已成 为企 业 , 医 院, 高校等网络系统庞大的机构构建信息管理系统关注的焦点。 1 信 息管 理 系统 设计 原贝 0 1 实用性 。 . 1 构建信 包管理系统首先要考虑到系统应用的实用性。 要保证系 统的稳定运行 , 数据处理 、 通讯能力处理强 , 响应速度快, 故障率低, 并且在浏 览 流量 大时 , 合理 的 的排 队基 质 , 易 出现 服 务器 死机 、 有 不 当机 的情 况 发生 。 而 且 , 建信息 管理 系统 时还 应考 虑到 要对 浏览 用户操 作 系统 和硬 件 配置 要 构 求低 , 最大 限度 的保护 和利 用现 有资 源 , 资合理 , 良好 的 l价 比。 要 投 有 生 l 保密 性 。设计 医院信 息管理 系统 时 要考虑 到 涉及病 人病 历 、 2 隐私 等敏 感 问题 , 要保证所设计的医信息管理系统做到绝对安全保密 , 可以通过密码设 置、 权限控制等方式实现。 1 先进 陛。 计医 院信息 管理 系统 时要有 先 进 , 学 的理念 , 仅要 考虑 到 . 3 设 科 不 系统 用 于现有 条件 的情 况 , 要考 虑 到其发 展潜 力 , 还 保证 系统 的牛命 力 。 采 要 用 先进 的设 汁思想 、 结构 以及 开 发工具 。 网络 1 开放性。 . 4 信息管理系统的网络体系要具有开放性。 不仅要力便 不同计算 机之 间 的网络 互联 , 且要方 便 网络 的升级 、 展和 互联 ; 而 扩 选择 采用 国际标 化 网络 协议 的择服 务器 、 产 品。 网络 1 管理性。 5 在设 汁系统方案时 , 要充分号虑到以后系统的扩展与升级 , 要合 理的规划 , 提供高效的网络管理功能, 一方面要使 日常维护和操作简单易行 , 便捷高效 , 另一方面要降低系统维护的费用 , 同时要具备 良好的可扩充 。 1 易用性。 . 6 信息管理系统使用时必须强调简单易用 , 图片分布合理, 文字规 范, 功能全面。使用户在系统界面只需单击鼠标就能完成大部分1 作。 = 1 安全 陛。要确保系统能够提供内部网络之间 、 网络与外部公共网之 . 7 内部 间互联的同时 , 也要能够确保 网络的安全; 既考虑信息资源的充分共享 , 更要 注意信 息的保护和隔离。要根据不同的网络环境 , 采取不同的网络安全机制 和 访问权 限等 措施 。 2 信 息管 理 系统 的设 计 2 需求分析。根据调查与分析 , 个综合性医院信 息管理系统需要包括多 . 1 一 个模块 , 实现¨诊管理 、 住院部管理 、 药品管理 、 病案管理 、 医疔保险管理 、 物 资管理、 设备器材管理 、 财务管理 、 职能部门管理 、 人事管理等多种功能。 2 系统设计。HI . 2 S作为专业的医疗信息管理系统 , 紧随计算机的普及 以及 软件行业的产业化 , S发展十分迅速。对医院的管理 、 HI 服务 、 效率等很多方 面起到了积极的作用。为了提高我校附属医院的工作质量 , 所设汁的信息管 理 系统 应包括 1 个 子系 统 , 总体设 汁如图 I 1 系统 所示 。 其中, 中心 管理 系统 是 lj 删 . 1 c S HI 系统 的管理 中心, 负责系统 f 的管理与维护, 以及二作人 r 上 上 上 上 上 上 上 _ 员权限信息管理 ; L 门诊管理 f 物 { “ j 系统 具有 门诊 挂 号 、 价 收 划 门诊 门 0 ‘? l : j ? “ 费 、 医 生 处 置 、 诊 药 艇 i 州 j 州 洲 u房 、门诊 化 验 以及 统计 、 查 采 系 条 不 询等功能 ,使病人挂号 、 就 t 筑 L _ L 皖 诊 、 验 、 药 等 活 动 方 便 化 取 图 1系统 总体 设计 快捷 ; 住院管理系统包括住
基于J2EE的医院医护信息管理系统
![基于J2EE的医院医护信息管理系统](https://img.taocdn.com/s3/m/5bc061eb551810a6f52486ca.png)
基于J2EE的医院医护信息管理系统摘要:医院医护信息管理系统是一个适用于小型医院的计算机化的医护信息管理系统,用于支持医院的行政管理与事务处理业务,减轻事务处理人员的劳动强度,辅助医院管理,辅助高层领导决策,提高医院的工作效率,从而使医院能够以少的投入获得更好的社会效益与经济效益。
本系统是一个运用Struts、Spring、iBatis等开源框架技术开发的基于J2EE的B/S 信息管理系统,通过本系统可以实现以下主要功能:(1)管理员通过网络登陆对员工信息进行管理与维护。
(2)用户通过网络登陆对个人信息进行管理与维护。
(3)医生通过网络登陆对病人信息进行管理与维护。
(4)医生通过网络登陆记录病人诊疗情况。
(5)管理员通过网络登陆对病房信息进行管理与维护。
(6)产生病房使用情况。
关键字:J2EE; Struts; Spring; iBatis;HIS。
Doctor&Nurse Information Management SystemAbstract:Doctor&Nurse information management system is a computerized system which applies into the small-scale hospitals. The system is used to facilitate the administration and transaction processing, alleviate the labor intensity of the hospital staff, as well as assist the high-level officers to manage the hospital and make big decisions. In this way, the work efficiency is improved. Therefore, the hospital is able to obtain better social and economical benefit at a lower price.This system is a B/S information management system based on J2EE and it is developed with the open source framework technology such as Struts, Spring and iBatis. The following functions can be achieved by this system:(1)The administrator log onto the system to administrate and maintain the staffs’ information and the basic information of the hospital.(2) The users log onto the system to administrate and maintain the personal information.(3) The doctors log onto the system to administrate and maintain the patients’ information.(4) The doctors log onto the system to record the diagnosis result and treat process of the patients.(5) The administrators log onto the system to manage and maintain the room information.(6) The room usage condition can be generated.key words: J2EE; Struts; Spring; iBatis;HIS.目录第一章引言 (1)1.1 系统应用背景 (1)1.2国内外研究现状 (1)1.3 本系统的特点与定位 (1)第二章技术方法 (1)2.1开发环境介绍 (3)2.1.1集成开发环境:eclipse (3)2.1.2 Web应用服务器:JBoss (3)2.1.3 数据库服务器:MySql (3)2.2开源框架介绍 (3)2.2.1 Struts (3)2.2.2 Spring (4)2.2.3 iBatis (4)2.3设计模式介绍 (4)2.4 J2EE简介 (5)2.4.1 J2EE的概念 (5)2.4.2 J2EE的优点 (5)2.4.3 J2EE三层模型 (6)2.5 研究设计方法 (6)2.5.1表现层 (6)2.5.2 控制层 (6)2.5.3 DAO层 (6)2.6 与其他技术的比较 (7)2.6.1 ASP开发语言 (7)2.6.2 PHP开发语言 (7)2.6.3 JSP开发语言 (7)2.6.4性能比较: (8)3.1需求概述 (9)3.1.1业务功能 (9)3.1.2信息交流功能 (9)3.1.3安全 (9)3.2 业务流程分析 (9)4.1系统设计 (11)4.2 系统框架 (11)4.3数据库设计 (11)5.1页面的组装 (15)5.2 struts的配置 (16)5.3 Spring的配置 (16)5.4 iBatis的配置 (17)5.5 datasource的配置 (18)5.6 系统编码实现 (20)5.6.3管理医生模块 (24)5.6.4管理护士模块: (26)5.6.5 管理挂号员模块 (27)5.6.6管理病房模块 (28)5.6.7管理病房类型模块 (30)5.6.8管理医生类型模块 (30)5.6.9 管理科室模块 (31)5.6.10诊疗模块 (32)基于J2EE的医护信息管理系统第一章引言1.1 系统应用背景随着计算机性能不断提高,价格不断下降,计算机已在医院医疗、教学、科研、•管理的各个方面得到越来越广泛的应用。
J2EE课程设计实训项目——《社区医疗信息管理系统》——构建系统中新生儿档案信息数据库表对应的实体PO类
![J2EE课程设计实训项目——《社区医疗信息管理系统》——构建系统中新生儿档案信息数据库表对应的实体PO类](https://img.taocdn.com/s3/m/a6134a7e25c52cc58bd6be83.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——构建系统中新生儿档案信息数据库表对应的实体PO类1.1.1构建系统中新生儿档案信息数据库表对应的实体PO类1、构建出封装新生儿档案信息的PO类(1)类名称为ChildrenFilesPO,包名称为com.px1987.sshchims.dao.po(2)在该PO类中添加成员属性private String filesID;private String childName;private String motherName;private int childSex;private String birthDay;private String homeAddress;private String telphoneNo;/*** 设置默认状态下的数据是有效的数据*/private int deleteFlag=1;(3)为它们提供get/set方法(4)提供hashcode和equals方法(5)最终的PO类的代码如下package com.px1987.sshchims.dao.po;public class ChildrenFilesPO {private String filesID;@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result+ ((birthDay == null) ? 0 : birthDay.hashCode());result = prime * result+ ((childName == null) ? 0 : childName.hashCode());result = prime * result + childSex;result = prime * result + deleteFlag;result = prime * result + ((filesID == null) ? 0 : filesID.hashCode());result = prime * result+ ((homeAddress == null) ? 0 : homeAddress.hashCode());result = prime * result+ ((motherName == null) ? 0 : motherName.hashCode());result = prime * result+ ((telphoneNo == null) ? 0 : telphoneNo.hashCode());return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;ChildrenFilesPO other = (ChildrenFilesPO) obj;if (birthDay == null) {if (other.birthDay != null)return false;} else if (!birthDay.equals(other.birthDay))return false;if (childName == null) {if (other.childName != null)return false;} else if (!childName.equals(other.childName))return false;if (childSex != other.childSex)return false;if (deleteFlag != other.deleteFlag)return false;if (filesID == null) {if (other.filesID != null)return false;} else if (!filesID.equals(other.filesID))return false;if (homeAddress == null) {if (other.homeAddress != null)return false;} else if (!homeAddress.equals(other.homeAddress)) return false;if (motherName == null) {if (other.motherName != null)return false;} else if (!motherName.equals(other.motherName)) return false;if (telphoneNo == null) {if (other.telphoneNo != null)return false;} else if (!telphoneNo.equals(other.telphoneNo)) return false;return true;}public String getFilesID() {return filesID;}public void setFilesID(String filesID) {this.filesID = filesID;}public String getChildName() {return childName;}public void setChildName(String childName) { this.childName = childName;}public String getMotherName() {return motherName;}public void setMotherName(String motherName) { this.motherName = motherName;}public int getChildSex() {return childSex;}public void setChildSex(int childSex) {this.childSex = childSex;}public String getBirthDay() {return birthDay;}public void setBirthDay(String birthDay) { this.birthDay = birthDay;}public String getHomeAddress() {return homeAddress;}public void setHomeAddress(String homeAddress) {this.homeAddress = homeAddress;}public String getTelphoneNo() {return telphoneNo;}public void setTelphoneNo(String telphoneNo) {this.telphoneNo = telphoneNo;}public int getDeleteFlag() {return deleteFlag;}public void setDeleteFlag(int deleteFlag) {this.deleteFlag = deleteFlag;}private String childName;private String motherName;private int childSex;private String birthDay;private String homeAddress;private String telphoneNo;private int deleteFlag;public ChildrenFilesPO() {super();}}2、添加包装分页状态信息的PO实体类(1)类名称为PageStatePO,包名称为com.px1987.sshchims.dao.po(2)添加相关的采用属性private boolean firstPage; //是否是首页(第一页),第一页页码为1private boolean lastPage; //是否是最后一页private boolean hasNextPage; //是否有下一页private boolean hasPreviousPage; //是否有上一页private int lastPageNumber; //获取最后一页页码,也就是总页数private int totalNumberOfElements; //总的数据条目数量,0表示没有数据private int thisPageFirstElementNumber;//获取当前页的首条数据的行编码(从0开始计数)private int thisPageLastElementNumber; //获取当前页的末条数据的行编码(从0开始计数)private int nextPageNumber; //获取下一页编码private int previousPageNumber; //获取上一页编码private int onePageSize; //每一页显示的条目数private int totalPageNumber; //总页数private int currentPageNumber; //当前页的页码private byte someOneOrderMethod; //重新按照某种排序方式再次查询数据(3)为每个成员属性提供get/set方法(4)再提供下面的方法/** 下面的方法是根据记录总数获得分页中的其他属性值*/public void setPageStatePOMemberProperty(int totalNumberOfElements) { if ((totalNumberOfElements % onePageSize) == 0){//如果记录总数为每页的整倍数,则计算出其总页数totalPageNumber = totalNumberOfElements/onePageSize;}else{//如果有不满一页的,则页数加一,并且计算出其总页数totalPageNumber = totalNumberOfElements/onePageSize + 1;}setFirstPage((currentPageNumber==1)?true:false); //当前页是否是首页(第一页)if(currentPageNumber!=totalPageNumber){//如果当前页数不等于总页数,则表明当前页不是最后一页setLastPage(false);}else{//如果当前页数等于总页数,则表明当前页是最后一页setLastPage(true);}if(currentPageNumber <totalPageNumber){//如果当前页数小于总页数,则表明仍然有下一页setHasNextPage(true);}else{//如果当前页数大于或者等于总页数,则表明没有了下一页setHasNextPage(false);}if(currentPageNumber ==1){//如果当前页数等于首页(第一页),则表明没有上一页setHasPreviousPage(false);}else{//如果当前页数不等于首页(第一页),则表明有上一页setHasPreviousPage(true);}//总的数据条目数量,0表示没有数据setTotalNumberOfElements(totalNumberOfElements);//获取最后一页页码,也就是总页数setLastPageNumber(totalPageNumber);int thisPageFirstElementNumber=(currentPageNumber-1)*onePageSize;//当前页不是最后一页时或者总记录为整页数,最后记录号应该为一页的大小int thisPageEndElementNumber=thisPageFirstElementNumber+(((currentPageNumber!=totalPageNumber)||(totalNumberOfElements % getOnePageSize())==0)?getOnePageSize():(totalNumberOfElements % getOnePageSize()));/**当前页是最后一页时,为余数的实际值。
2EE课程设计实训项目——《社区医疗信息管理系统》——实现基于Hibernate框架的用户系统登录的数据访问功能
![2EE课程设计实训项目——《社区医疗信息管理系统》——实现基于Hibernate框架的用户系统登录的数据访问功能](https://img.taocdn.com/s3/m/a42a826a27284b73f242501e.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——实现基于Hibernate框架的用户系统登录的数据访问功能1.1.1在项目中添加对工作人员数据库表进行“CRUD(增、删、改、查)”功能的DAO组件类1、添加DAO的接口StaffInfoDAOInterface(1)接口名称为StaffInfoDAOInterface,程序包名称为com.px1987.sshchims.dao.inter(2)设计StaffInfoDAOInterface接口中的功能方法package com.px1987.sshchims.dao.inter;import com.px1987.sshchims.dao.po.StaffInfoPO;public interface StaffInfoDAOInterface {public StaffInfoPO checkLoginValid(StaffInfoPO staffLoginInfo);}2、为StaffInfoDAOInterface接口提供一个实现类StaffInfoDAOImple(1)实现类名称为StaffInfoDAOImple,程序包名称为com.px1987.sshchims.dao.imple(2)StaffInfoDAOImple程序类的代码示例package com.px1987.sshchims.dao.imple;import java.util.List;import org.hibernate.HibernateException;import org.hibernate.Query;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.Transaction;import com.px1987.sshchims.dao.inter.StaffInfoDAOInterface; import com.px1987.sshchims.dao.po.StaffInfoPO;public class StaffInfoDAOImple implements StaffInfoDAOInterface { private SessionFactory sessionFactory=null;public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory;}public StaffInfoDAOImple() {super();}/*** checkLoginValid方法根据提供的登录者的信息进行数据访问查询*/public StaffInfoPO checkLoginValid(StaffInfoPO staffLoginInfo) {Session session = null;Transaction tx = null;StaffInfoPO returnResultStaffInfoPO=null;try{/*** (1)创建出Session对象(类似于JDBC中的数据库连接),从注入的SessionFactory中获得session*/session = sessionFactory.openSession();/*** (2)创建出事务(Transaction)对象,并启动事务*/tx = session.beginTransaction();/*** (3)具体的数据访问操作*/String queryHQL="from com.px1987.sshchims.dao.po.StaffInfoPO as oneStaffInfoPO where oneStaffInfoPO.staffName=:staffName and oneStaffInfoPO.staffPassWord=:staffPassWord and oneStaffInfoPO.department=:department";Query currentQuery=session.createQuery(queryHQL);currentQuery.setString("staffName", staffLoginInfo.getStaffName());currentQuery.setString("staffPassWord", staffLoginInfo.getStaffPassWord());currentQuery.setInteger("department", staffLoginInfo.getDepartment());List<StaffInfoPO> returnAllStaffInfoPOs=currentQuery.list();if((returnAllStaffInfoPOs==null)||(returnAllStaffInfoPOs.size()==0)){returnResultStaffInfoPO=null;}else{returnResultStaffInfoPO=returnAllStaffInfoPOs.get(0);}/*** (4)提交事务(事务结束)*/mit();}catch(HibernateException e){tx.rollback();/*** 打印输出详细的异常跟踪信息*/e.printStackTrace();}finally{/*** (5)关闭Session(释放Session所用的内存空间)*/session.close();}return returnResultStaffInfoPO;}}。
J2EE课程设计实训项目——《社区医疗信息管理系统》——构建老年人档案信息管理中的表现层各个JSP页面
![J2EE课程设计实训项目——《社区医疗信息管理系统》——构建老年人档案信息管理中的表现层各个JSP页面](https://img.taocdn.com/s3/m/58f275dd2cc58bd63186bdb1.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——构建老年人档案信息管理中的表现层各个JSP页面1、根据应用的需求设计出对应的JSP页面2、录入老年人档案信息的UI示图示例3、录入老年人档案信息的JSP页面文件代码示例<jsp:include page="/commonPage/pageHead.jsp" ></jsp:include><%@ page isELIgnored="false" pageEncoding="GB18030"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><title>蓝梦集团社区信息管理系统添加老年人档案信息页面</title> <script src="${pageContext.request.contextPath}/javascript/commonJavaScript.js"type="text/javascript"></script><script type="text/javascript" language="JavaScript">/*由于initBirthDateForm()函数需要在body标签中应用,因此不能放在外部的*.js 文件中,而必须要放在本页面中*/function initBirthDateForm(){var yearSelectInstance =document.getElementById("oneFilesFormBean.yearSelect");var monthSelectInstance =document.getElementById("oneFilesFormBean.monthSelect");var daySelectInstance =document.getElementById("oneFilesFormBean.daySelect");var newOptionInstance;for(var startYear=1949;startYear<=2012;startYear++){newOptionInstance = document.createElement("option");newOptionInstance.value = startYear;newOptionInstance.text =startYear;yearSelectInstance.options.add(newOptionInstance);}for(var startMonth=1;startMonth<=12;startMonth++){newOptionInstance = document.createElement("option");newOptionInstance.value = startMonth;newOptionInstance.text =startMonth;monthSelectInstance.options.add(newOptionInstance);}for(var startDay=1;startDay<=31;startDay++){newOptionInstance = document.createElement("option");newOptionInstance.value = startDay;newOptionInstance.text =startDay;daySelectInstance.options.add(newOptionInstance);}}var selectedYearValue;var totalDaysInSomeOneMonth;function getSelectedYear(yearSelectInstance){selectedYearValue=yearSelectInstance.options[yearSelectInstance.selectedIndex].value; }function getSelectedMonth(monthSelectInstance){var someOneMonthValue=monthSelectInstance.options[monthSelectInstance.selectedIndex].value;switch(parseInt(someOneMonthValue,10)){case 1:case 3:case 5:case 7:case 8:case 10:case 12:totalDaysInSomeOneMonth=31;break;case 2:if((selectedYearValue%4)==0){totalDaysInSomeOneMonth=29;}else{totalDaysInSomeOneMonth=28;}break;case 4:case 6:case 9:case 11:totalDaysInSomeOneMonth=30;break;}var daySelectInstance =document.getElementById("oneFilesFormBean.daySelect");do{daySelectInstance.options.remove(0); /* 清除日期框中的原有日期数据*/ }while(daySelectInstance.options.length>0);var newOptionInstance;for(var startDay=1;startDay<=totalDaysInSomeOneMonth;startDay++){newOptionInstance = document.createElement("option");newOptionInstance.value = startDay;newOptionInstance.text =startDay;/* 在日期框中重新添加新的日期数据*/daySelectInstance.options.add(newOptionInstance);}}</script><script type="text/javascript" language="JavaScript">/*下面的checkAddFileInfoFormValid函数实现对添加老年人档案信息表单中的相关数据进行有效性检查*/function checkAddFileInfoFormValid(){if(document.getElementById("oneFilesFormBean.yearSelect").selectedIndex==0) { window.alert("请选择年份");return false;}if(document.getElementById("oneFilesFormBean.monthSelect").selectedIndex==0){ window.alert("请选择月份");return false;}var daySelectInstance =document.getElementById("oneFilesFormBean.daySelect");var someOneDayValue=daySelectInstance.options[daySelectInstance.selectedIndex].value;if(someOneDayValue=="选择日期") {window.alert("请选择日期");return false;}return true;}</script></head><body onload="initBirthDateForm();"><br/><br/><br/><br/><form action="${pageContext.request.contextPath}/olderFilesManageAction.servlet" method="post" name="addFileInfoForm" onsubmit="return checkAddFileInfoFormValid()"> <input type="hidden" name="oneFilesFormBean.actionType" id="oneFilesFormBean.actionType" value="doAddOlderFiles" /><table width="726" border="1" align="center"><tr><td width="61" align="right">姓名</td><td width="290" align="left"><input type="text" name="oneFilesFormBean.olderName"id="oneFilesFormBean.olderName"/></td><td width="146" align="right">血型</td><td width="203" align="left"><input type="text" name="oneFilesFormBean.bloodGroup"id="oneFilesFormBean.bloodGroup"/></td></tr><tr><td align="right">性别</td><td align="left"><input type="radio" name="oneFilesFormBean.sex" checked="checked"id="oneFilesFormBean.sex" value="1" />男<input value="0" type="radio" name="oneFilesFormBean.sex"id="oneFilesFormBean.sex"/> 女</td><td align="right">健康问题</td><td align="left"><input type="text" name="oneFilesFormBean.healthProblems"id="oneFilesFormBean.healthProblems"/> </td></tr><tr><td align="right">出生日期</td><td align="left"><select name="oneFilesFormBean.yearSelect" onchange="getSelectedYear(this);"id="oneFilesFormBean.yearSelect" > <option value="选择年份" selected="selected">年</option> </select><select name="oneFilesFormBean.monthSelect"id="oneFilesFormBean.monthSelect" onchange="getSelectedMonth(this);"><option value="选择月份" selected="selected">月</option> </select><select name="oneFilesFormBean.daySelect"id="oneFilesFormBean.daySelect"><option value="选择日期" selected="selected">日</option> </select></td><td align="right">病情流程表</td><td align="left"><input type="text" name="oneFilesFormBean.diseaseProcessTable"id="oneFilesFormBean.diseaseProcessTable"/> </td></tr><tr><td align="right">家庭住址</td><td align="left"><input type="text" name="oneFilesFormBean.homeAddress"id="oneFilesFormBean.homeAddress"/></td><td align="right">健康宣教及健康咨询</td><td align="left"><input type="text" name="oneFilesFormBean.healthCounseling"id="oneFilesFormBean.healthCounseling"/> </td></tr><tr><td align="right">联系电话</td><td align="left"><input type="text" name="oneFilesFormBean.telphoneNo"id="oneFilesFormBean.telphoneNo"/><td align="right">家族史</td><td align="left"><input type="radio" name="oneFilesFormBean.familyHistory"id="oneFilesFormBean.familyHistory"value="1" checked="checked" />有<input value="0" type="radio" id="oneFilesFormBean.familyHistory"name="oneFilesFormBean.familyHistory" /> 无</td></tr><tr><td align="right">单位</td><td align="left"><input type="text" name="oneFilesFormBean.workUnitName"id="oneFilesFormBean.workUnitName"/> </td><td align="right">行为危险因素</td><td align="left"><input type="radio" name="oneFilesFormBean.behavioralRiskFactors"id="oneFilesFormBean.behavioralRiskFactors " value="1"/>危险<input type="radio" name="oneFilesFormBean.behavioralRiskFactors"id="oneFilesFormBean.behavioralRiskFactors" value="0"checked="checked" />不危险</td></tr><tr><td align="right">民族</td><td align="left"><input type="text" name="oneFilesFormBean.nation"id="oneFilesFormBean.nation"/><td align="right">饮食情况</td><td align="left"><input type="radio" name="oneFilesFormBean.dietType" value="1"id="oneFilesFormBean.dietType" checked="checked" />好<input value="2" type="radio" name="oneFilesFormBean.dietType"id="oneFilesFormBean.dietType"/> 一般<input value="3" type="radio" name="oneFilesFormBean.dietType"id="oneFilesFormBean.dietType"/> 较差</td></tr><tr><td align="right">体重</td><td align="left"><input type="text" name="oneFilesFormBean.bodyWeight"id="oneFilesFormBean.bodyWeight"/></td><td align="right">运动情况</td><td align="left"><input type="radio" name="oneFilesFormBean.movementType"id="oneFilesFormBean.movementType"value="1" checked="checked" />经常<input value="2" type="radio" name="oneFilesFormBean.movementType"id="oneFilesFormBean.movementType" /> 偶尔<input value="3" type="radio" name="oneFilesFormBean.movementType"id="oneFilesFormBean.movementType" /> 不运动</td></tr><tr><td align="right">婚姻状况</td><td align="left"><input type="radio" name="oneFilesFormBean.isMarray"id="oneFilesFormBean.isMarray"checked="checked" value="1"/>已婚<input type="radio" name="oneFilesFormBean.isMarray"id="oneFilesFormBean.isMarray" value="2" />未婚<input type="radio" name="oneFilesFormBean.isMarray"id="oneFilesFormBean.isMarray" value="3" /> 丧偶</td><td align="right">居住条件</td><td align="left"><input type="radio" name="oneFilesFormBean.livingConditions"id="oneFilesFormBean.livingConditions"value="1" checked="checked" />好<input value="2" type="radio" id="oneFilesFormBean.livingConditions"name="oneFilesFormBean.livingConditions" /> 一般<input value="3" type="radio" name="oneFilesFormBean.livingConditions"id="oneFilesFormBean.livingConditions"/> 较差</td></tr><tr><td align="right">文化程度</td><td align="left"><input type="radio" name="oneFilesFormBean.cultureLevel"id="oneFilesFormBean.cultureLevel" value="0" />初中<input type="radio" name="oneFilesFormBean.cultureLevel"id="oneFilesFormBean.cultureLevel" value="1" />高中<input value="2" type="radio" name="oneFilesFormBean.cultureLevel"id="oneFilesFormBean.cultureLevel" checked="checked" /> 大专<input value="3" type="radio" name="oneFilesFormBean.cultureLevel"id="oneFilesFormBean.cultureLevel"/> 大学<input value="4" type="radio" name="oneFilesFormBean.cultureLevel"id="oneFilesFormBean.cultureLevel"/> 硕士<input value="5" type="radio" name="oneFilesFormBean.cultureLevel"id="oneFilesFormBean.cultureLevel"/> 博士</td><td align="right">是否签订老年人就医合同</td><td align="left"><input type="radio" name="oneFilesFormBean.hasContract"id="oneFilesFormBean.hasContract" value="1"/> 是<input type="radio" name="oneFilesFormBean.hasContract"id="oneFilesFormBean.hasContract" checked="checked" value="0"/> 否</td></tr><tr><td align="right">职业</td><td align="left"><input type="text" name="oneFilesFormBean.occupational"id="oneFilesFormBean.occupational" /> </td><td colspan="2"><input type="image" title="开始提交"src="${pageContext.request.contextPath}/images/comfirm.gif" /> <img src="${pageContext.request.contextPath}/images/cancel.gif"title="取消提交" onclick="document.addFileInfoForm.reset();"/> </td></tr></table></form><br/><br/><br/><br/></body></html><jsp:include page="/commonPage/authorInfo.jsp"></jsp:include>。
J2EE 课程设计项目——社区信息管理系统——将Dreamweaver和MyEclipse开发工具相互整合
![J2EE 课程设计项目——社区信息管理系统——将Dreamweaver和MyEclipse开发工具相互整合](https://img.taocdn.com/s3/m/71930cd19ec3d5bbfd0a74ab.png)
将Dreamweaver和MyEclipse开发工具相互整合
1、在DW中新建一个Web项目sshchims
(1)项目名称为sshchims,路径指向WebRoot目录
(2)最终的结果
2、在项目中添加美工提供的页面模板及相关的资源文件
3、在DW中新建JSP页面、CSS和JS等程序——JSP中包含(引用)模板页
4、再测试userLogin.jsp页面
将能够看到在页面中应用了模板页中的相关的资源。
5、对JSP中的各种文件正确地进行定位
(1)方式一:以WebRoot站点根目录为定位基准并应用${pageContext.request.contextPath}动态获得当前项目的Web Context的名称字符串
<link href="${${pageContext.request.contextPath}}/css/skin.css" rel="stylesheet" type="text/css">
(2)方式二:采用<base>标签进行本页面——但该方式没有成功?
<base href="${${pageContext.request.contextPath}}/" />。
J2EE课程设计实训项目——《社区医疗信息管理系统》——在项目的数据访问层中添加数据库连接组件程序类
![J2EE课程设计实训项目——《社区医疗信息管理系统》——在项目的数据访问层中添加数据库连接组件程序类](https://img.taocdn.com/s3/m/f7a2ad5f33687e21ae45a900.png)
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——在项目的数据访问层中添加数据库连接组件程序类1.1.1在项目的数据访问层中添加数据库连接组件程序类1、数据库连接的接口ConnectDBInterface(1)接口名称为ConnectDBInterface,包名称为com.px1987.sshchims.dao.inter(2)设计该数据库连接接口package com.px1987.sshchims.dao.inter;import java.sql.Connection;import com.px1987.sshchims.exception.CHIMSException;public interface ConnectDBInterface {public Connection getConnection() throws CHIMSException;public void closeDBConnection() throws CHIMSException;public boolean isDBConnectionClose();}2、数据库连接接口ConnectDBInterface的实现类(1)类名称为MySQLConnectDBBean,包名称为com.px1987.sshchims.dao.imple,并实现com.px1987.sshchims.dao.inter.ConnectDBInterface接口(2)编程该实现类package com.px1987.sshchims.dao.imple;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.util.logging.Level;import java.util.logging.Logger;import com.px1987.sshchims.dao.inter.ConnectDBInterface;import com.px1987.sshchims.exception.CHIMSException;public class MySQLConnectDBBean implements ConnectDBInterface { private static String JDBC_DBDriver_ClassName ="com.mysql.jdbc.Driver";private static String JDBC_DSN_URL = "jdbc:mysql://127.0.0.1:3306/chimsdb";private static String JDBC_dbUserName="root";private static String JDBC_dbUserPassWord="root";//(1)创建一个Logger对象Logger logger=Logger.getLogger(MySQLConnectDBBean.class.getName());Level loggerLevel=;private Connection jdbcDBConnection = null;public MySQLConnectDBBean() {super();}private void loadJDBCDriveClassAndConnectToDB() throws CHIMSException{ try {Class.forName(JDBC_DBDriver_ClassName);} catch (ClassNotFoundException e) {logger.log(loggerLevel, "不能正确地加载JDBC驱动程序"+e.getMessage());throw new CHIMSException(e.getMessage());}try {jdbcDBConnection=DriverManager.getConnection(JDBC_DSN_URL,JDBC_dbUserName, JDBC_dbUserPassWord);} catch (SQLException e) {logger.log(loggerLevel, e.getMessage());throw new CHIMSException(e.getMessage());}}public void closeDBConnection() throws CHIMSException {try {jdbcDBConnection.close();} catch (SQLException e) {logger.log(loggerLevel, e.getMessage());throw new CHIMSException(e.getMessage());}}public Connection getConnection() throws CHIMSException {loadJDBCDriveClassAndConnectToDB();return jdbcDBConnection;}public boolean isDBConnectionClose() {if(jdbcDBConnection==null){return false;}else{return true;}}/** 正确性——单元测试集成测试*/public static void main(String[] args) throws CHIMSException { ConnectDBInterface oneDBConnect=new MySQLConnectDBBean();boolean isValid=oneDBConnect.isDBConnectionClose();if(isValid){System.out.println("正确地进行数据库的连接");}else{System.out.println("没有正确地进行数据库连接");}}}。
J2EE 课程设计项目——社区信息管理系统——在项目中实现保存登录表单中的用户名称的功能
![J2EE 课程设计项目——社区信息管理系统——在项目中实现保存登录表单中的用户名称的功能](https://img.taocdn.com/s3/m/f7ffe236af45b307e87197aa.png)
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Cookie; public class ReadAndWriteCookieUtil {
杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料
在项目中实现保存登录表单中的用户名称的功能
1、添加一个读写 Cookie 中的数据的工具类 (1)类名称为 ReadAndWriteCookieUtil,包名称为 com.px1987.sshchims.util
(2)保存该类中的相关方法 package com.px1987.sshchims.util; import java.io.UnsupportedEncodingException;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
loginNameCookie.setPath(request.getContextPath());
loginNameCookie.setMaxAge(7*24*60*60);
}
}
2、在 index.jsp 页面进行转发跳转到系统的登录页面——通过 Servlet 实现跳转
<%@ page pageEncoding="gb2312"%>
<jsp:forward page="/checkLoginInfoCookieServlet.servlet" />
杨教授大学堂,版权所有,盗版必究。 2/7 页
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
基于S2SH架构的J2EE课程设计实训项目——《社区医疗信息管理系统》——构建出项目的数据库系统及用户信息相关的数据库表结构
1.1.1构建出项目的数据库系统及相关的数据库表结构
1、在MySQL中建立数据库文件和数据库表
(1)新建chimsdb数据库文件
(2)在该数据库文件中新建数据库表
2、staffInfo(医务工作人员信息数据库表)
(1)工作人员信息数据库表结构说明
(2)工作人员信息数据库表字段
(3)创建staffinfo数据库表的SQL语句
DROP TABLE IF EXISTS `staffinfo`;
CREATE TABLE `staffinfo` (
`staffID` varchar(50) NOT NULL DEFAULT '',
`staffName` varchar(25) NOT NULL DEFAULT '', loginName` varchar(25) NOT NULL DEFAULT '',
`staffPassWord` varchar(20) NOT NULL DEFAULT '', `staffSex` int(1) NOT NULL,
`staffAge` int(2) NOT NULL,
`staffBirth` varchar(20) NOT NULL,
`department` int(2) DEFAULT NULL,
`duty` int(1) DEFAULT NULL,
`positional_titles` int(1) DEFAULT NULL, mobileNumber` varchar(11) DEFAULT NULL,
staffStatus` int(1) DEFAULT NULL,
PRIMARY KEY (`staffID`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312;
INSERT INTO `staffinfo` V ALUES ('1', '杨少波', 'yang1234','12345678', '1', '30', '19800201', '1', '1', '1', '12345678901', '1');。