From c15ad8a99afa8c82af98e06941a37fc7590d6c80 Mon Sep 17 00:00:00 2001 From: zengwh <81383286@qq.com> Date: Tue, 11 Aug 2020 08:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../emr/controller/StatisticsController.java | 57 ++- .../com/emr/controller/WebServiceLoad.java | 30 +- .../emr/controller/lastVerifyController.java | 7 +- .../com/emr/dao/Archive_DetailMapper.java | 7 + .../com/emr/dao/Archive_MasterMapper.java | 8 + .../com/emr/dao/RecordStatisticsMapper.java | 22 + .../com/emr/entity/Archive_Master_Vo.java | 2 + src/main/java/com/emr/entity/Zd_Assort.java | 10 + .../ipml/ArchiveCallbackInfoService.java | 17 +- .../service/ipml/ArchiveFlowInfoService.java | 315 ++++++++------ .../ipml/Archive_MasterServiceImpl.java | 200 ++++++--- .../emr/service/ipml/StatisticsService.java | 142 +++++++ src/main/java/com/emr/shiro/MyRealm.java | 1 + .../java/com/emr/vo/RecordStatistics.java | 37 ++ .../resources/mapper/Archive_DetailMapper.xml | 19 +- .../resources/mapper/Archive_MasterMapper.xml | 5 + .../mapper/RecordStatisticsMapper.xml | 123 ++++++ src/main/resources/mapper/Zd_AssortMapper.xml | 4 + src/main/webapp/WEB-INF/jspf/comm.jspf | 64 +-- .../views/beHospitaledDir/beHospList.jsp | 31 +- .../WEB-INF/views/faultDir/faultList.jsp | 6 +- .../WEB-INF/views/flowInfo/flowInfoList.jsp | 6 +- .../views/inHospitalDir/inHositalList.jsp | 6 +- .../views/lastVerifyDir/lastVerifyList.jsp | 39 +- .../views/statistics/finalStatistics.jsp | 6 +- .../statistics/finalStatisticsDetail.jsp | 6 +- .../views/statistics/firstStatistics.jsp | 6 +- .../WEB-INF/views/statistics/printCount.jsp | 6 +- .../WEB-INF/views/statistics/printInfo.jsp | 6 +- .../views/statistics/recordStatistics.jsp | 124 ++++++ .../WEB-INF/views/statistics/scanCount.jsp | 6 +- .../WEB-INF/views/statistics/scanInfo.jsp | 6 +- .../views/statistics/statisticsDetail.jsp | 6 +- .../unfileMedicalDir/unfileMedicalList.jsp | 6 +- .../bootstrap-select/bootstrap-select.min.css | 2 +- .../webapp/static/js/beHospList/beHospList.js | 213 +++++++++- src/main/webapp/static/js/comm.js | 124 ++++++ .../static/js/holidaySet/holidaySetList.js | 36 -- .../js/hospitalCommom/hospitalCommom.js | 39 +- .../static/js/hospitalLoadPdf/loadPdf.js | 37 +- .../js/lastVerifyList/lastVerifyList.js | 143 ++++++- .../static/js/statistics/getDeptCommom.js | 2 +- .../static/js/statistics/recordStatistics.js | 394 ++++++++++++++++++ .../static/js/statistics/statisticsCommom.js | 36 +- src/main/webapp/static/json/timeInterval.json | 18 + 45 files changed, 1900 insertions(+), 480 deletions(-) create mode 100644 src/main/java/com/emr/dao/RecordStatisticsMapper.java create mode 100644 src/main/java/com/emr/vo/RecordStatistics.java create mode 100644 src/main/resources/mapper/RecordStatisticsMapper.xml create mode 100644 src/main/webapp/WEB-INF/views/statistics/recordStatistics.jsp create mode 100644 src/main/webapp/static/js/statistics/recordStatistics.js create mode 100644 src/main/webapp/static/json/timeInterval.json diff --git a/src/main/java/com/emr/controller/StatisticsController.java b/src/main/java/com/emr/controller/StatisticsController.java index b909e99..d4538ba 100644 --- a/src/main/java/com/emr/controller/StatisticsController.java +++ b/src/main/java/com/emr/controller/StatisticsController.java @@ -5,14 +5,13 @@ import com.emr.entity.OffsetLimitPage; import com.emr.service.ipml.StatisticsService; import com.emr.util.ExceptionPrintUtil; import com.emr.util.ExportExcelUtil1; -import com.emr.vo.FinalAndFirstStatistics; -import com.emr.vo.TUuInfoVo; -import com.emr.vo.TUuPrintSearch; -import com.emr.vo.TUuPrintVo; +import com.emr.vo.*; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -400,4 +399,54 @@ public class StatisticsController { e.printStackTrace(); } } + + //病案统计报表 + @RequestMapping("recordStatistics/{level}") + public String recordStatistics(@PathVariable("level")String level,RecordStatistics record,Model model){ + model.addAttribute("level",level); + model.addAttribute("record",record); + return "statistics/recordStatistics"; + } + + //病案统计报表 + @RequestMapping("getRecordStatistics") + @ResponseBody + public OffsetLimitPage getRecordStatistics(RecordStatistics recordStatistics){ + try { + List list = statisticsService.getRecordStatistics(recordStatistics); + return new OffsetLimitPage((Page)list); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return null; + } + } + + //按科室分组查 + @RequestMapping("getRecordStatisticsGroupDept") + @ResponseBody + public OffsetLimitPage getRecordStatisticsGroupDept(Integer offset, Integer limit,RecordStatistics recordStatistics){ + try { + List list = statisticsService.getRecordStatisticsGroupDept(offset, limit, recordStatistics); + return new OffsetLimitPage((Page)list); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return null; + } + } + + //按根据科室查 + @RequestMapping("getRecordStatisticsByDeptName") + @ResponseBody + public OffsetLimitPage getRecordStatisticsByDeptName(Integer offset, Integer limit,RecordStatistics recordStatistics){ + try { + List list = statisticsService.getRecordStatisticsByDeptName(offset, limit, recordStatistics); + return new OffsetLimitPage((Page)list); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return null; + } + } } diff --git a/src/main/java/com/emr/controller/WebServiceLoad.java b/src/main/java/com/emr/controller/WebServiceLoad.java index 514520f..24ccdc4 100644 --- a/src/main/java/com/emr/controller/WebServiceLoad.java +++ b/src/main/java/com/emr/controller/WebServiceLoad.java @@ -23,20 +23,22 @@ public class WebServiceLoad { @PostConstruct public void contextInitialized() { new Thread(() -> { - String token = "11"; - String POWER_URLHEAD = PropertiesUtils.getProperty("POWER_JSP"); - //创建连接工厂 - JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance(); - //创建客户端 - Client client = dcf.createClient(POWER_URLHEAD + "/WebService/PowerWebService?wsdl"); - try { - //动态调用getInfosByUserId方法 - client.invoke("getInfosByUserId", token, "emr_medical_record"); - } catch (Exception e) { - e.printStackTrace(); - }finally { - if(null != client) { - client.destroy(); + for (int i = 0; i < 2; i++) { + String token = "ORsaVDUBE1RFRFRETE5BR05ERVQ3JyBURkRGRA=="; + String POWER_URLHEAD = PropertiesUtils.getProperty("POWER_JSP"); + //创建连接工厂 + JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance(); + //创建客户端 + Client client = dcf.createClient(POWER_URLHEAD + "/WebService/PowerWebService?wsdl"); + try { + //动态调用getInfosByUserId方法 + client.invoke("getInfosByUserId", token, "emr_medical_record"); + } catch (Exception e) { + e.printStackTrace(); + }finally { + if(null != client) { + client.destroy(); + } } } }).start(); diff --git a/src/main/java/com/emr/controller/lastVerifyController.java b/src/main/java/com/emr/controller/lastVerifyController.java index 8cb953f..e0f6372 100644 --- a/src/main/java/com/emr/controller/lastVerifyController.java +++ b/src/main/java/com/emr/controller/lastVerifyController.java @@ -47,18 +47,23 @@ public class lastVerifyController { @ResponseBody @RequestMapping(value = "/lastVerifyList") public OffsetLimitPage lastVerifyList(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit,Integer isSearch) { + long start = System.currentTimeMillis(); //判断是否是初始化查询,是初始化查询把开始结束时间置空 if(isSearch == 0){ archiveMasterVo.setStartDateTo(null); archiveMasterVo.setEndDateTo(null); } try { - return archiveMasterService.selectByLast(archiveMasterVo, offset, limit); + OffsetLimitPage offsetLimitPage = archiveMasterService.selectByLast(archiveMasterVo, offset, limit); + long end = System.currentTimeMillis(); + System.out.println("用时:"+(end-start)/1000.0+"s"); + return offsetLimitPage; } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; } + } @ResponseBody diff --git a/src/main/java/com/emr/dao/Archive_DetailMapper.java b/src/main/java/com/emr/dao/Archive_DetailMapper.java index f3868d1..a54405f 100644 --- a/src/main/java/com/emr/dao/Archive_DetailMapper.java +++ b/src/main/java/com/emr/dao/Archive_DetailMapper.java @@ -34,4 +34,11 @@ public interface Archive_DetailMapper { List selectTypeTreeByPatientIdAndAssortIds(@Param("patientId")String patientId,@Param("assortIds")String assortIds); List selectPdfPathByIds(@Param("masterId")String masterId,@Param("detailIds")String detailIds); + + /** + * 按查询按masterId分组查询assortId分类集合 + * @param masterIds + * @return + */ + List selectAssortIdsByMasterIds(@Param("masterIds") String masterIds); } \ No newline at end of file diff --git a/src/main/java/com/emr/dao/Archive_MasterMapper.java b/src/main/java/com/emr/dao/Archive_MasterMapper.java index a9a0347..5609b30 100644 --- a/src/main/java/com/emr/dao/Archive_MasterMapper.java +++ b/src/main/java/com/emr/dao/Archive_MasterMapper.java @@ -39,4 +39,12 @@ public interface Archive_MasterMapper { * 查询已归档记录 * */ List selectFiled(Archive_Master_Vo master); + + /** + * 根据masterIds集合批量更新LockInfo字段 + * @param masterIds + * @param lockinfo + * @return + */ + int updateLockInfoByMasterId(@Param("masterIds")String masterIds,@Param("lockinfo")String lockinfo); } \ No newline at end of file diff --git a/src/main/java/com/emr/dao/RecordStatisticsMapper.java b/src/main/java/com/emr/dao/RecordStatisticsMapper.java new file mode 100644 index 0000000..13ed0e5 --- /dev/null +++ b/src/main/java/com/emr/dao/RecordStatisticsMapper.java @@ -0,0 +1,22 @@ +package com.emr.dao; + +import com.emr.vo.RecordStatistics; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.PathVariable; + +import java.util.List; + +public interface RecordStatisticsMapper { + //统计总病历数 + int getRecordCount(RecordStatistics record); + //统计总文件数 + List getFileCount(RecordStatistics record); + //按科室分组统计病案 + List getRecordStatisticsGroupDept(RecordStatistics recordStatistics); + //按科室和来源分组统计文件 + List getFileStatisticsGroupDept(RecordStatistics recordStatistics); + + List getRecordStatisticsByDeptName(RecordStatistics recordStatistics); + + List getFileCountByMasterIds(@Param("masterIds") String masterIds); +} diff --git a/src/main/java/com/emr/entity/Archive_Master_Vo.java b/src/main/java/com/emr/entity/Archive_Master_Vo.java index 65174f6..b466db9 100644 --- a/src/main/java/com/emr/entity/Archive_Master_Vo.java +++ b/src/main/java/com/emr/entity/Archive_Master_Vo.java @@ -39,6 +39,8 @@ public class Archive_Master_Vo extends Archive_Master{ private Integer role;//操作角色1,2,4 private Integer infoId;//流转流程的id + + private Integer isSuccess = 0;//是否完整1:完整,0:不完整 } diff --git a/src/main/java/com/emr/entity/Zd_Assort.java b/src/main/java/com/emr/entity/Zd_Assort.java index 1766ca6..1f66c92 100644 --- a/src/main/java/com/emr/entity/Zd_Assort.java +++ b/src/main/java/com/emr/entity/Zd_Assort.java @@ -9,6 +9,8 @@ public class Zd_Assort { private String printFlag; + private Integer isCheck; + public String getAssortId() { return assortId; } @@ -40,4 +42,12 @@ public class Zd_Assort { public void setPrintFlag(String printFlag) { this.printFlag = printFlag == null ? null : printFlag.trim(); } + + public Integer getIsCheck() { + return isCheck; + } + + public void setIsCheck(Integer isCheck) { + this.isCheck = isCheck; + } } \ No newline at end of file diff --git a/src/main/java/com/emr/service/ipml/ArchiveCallbackInfoService.java b/src/main/java/com/emr/service/ipml/ArchiveCallbackInfoService.java index 4f9947f..378eacd 100644 --- a/src/main/java/com/emr/service/ipml/ArchiveCallbackInfoService.java +++ b/src/main/java/com/emr/service/ipml/ArchiveCallbackInfoService.java @@ -2,6 +2,7 @@ package com.emr.service.ipml; import com.emr.dao.ArchiveCallbackInfoMapper; import com.emr.entity.ArchiveCallbackInfo; +import com.emr.entity.ArchiveFlowRole; import com.emr.entity.Archive_Master; import com.emr.entity.OffsetLimitPage; import com.emr.service.Archive_MasterService; @@ -72,7 +73,9 @@ public class ArchiveCallbackInfoService { String currentCode = EnumVerify.DocState.CallBacked.getCode() + ""; String remark = callbackInfo.getCallbackReason(); Integer targetCode = EnumVerify.DocState.CallBacked.getCode(); - archiveFlowInfoService.insertFlowInfo(masterId,currentCode,remark,targetCode,new Date()); + //获取当前节点和下个节点对象集合 + List currentRoleAndNextRole = archiveFlowInfoService.getCurrentRoleAndNextRole(currentCode,targetCode); + archiveFlowInfoService.insertFlowInfo(masterId,remark,currentRoleAndNextRole.get(0),currentRoleAndNextRole.get(1),new Date()); //TODO 删除病案资料 callbackInfoMapper.deleteRecordByRecall(masterId); } @@ -123,20 +126,20 @@ public class ArchiveCallbackInfoService { //转换状态 //计算属于哪种审核角色 List userList = statisticsService.getUserList(); - for (int i = 0; i < list.size(); i++) { - String archivestate = list.get(i).getArchivestate(); + for (ArchiveCallbackInfoVo callbackInfoVo1 : list) { + String archivestate = callbackInfoVo1.getArchivestate(); if (StringUtils.isNotBlank(archivestate)) { //转换中文状态 Integer status = Integer.valueOf(archivestate); archivestate = EnumVerify.DocState.GetStepName(status, EnumVerify.Checker.Generate.getCode()); - list.get(i).setArchivestate(archivestate); + callbackInfoVo1.setArchivestate(archivestate); } - if(!CollectionUtils.isEmpty(userList)) { + if (!CollectionUtils.isEmpty(userList)) { //转换姓名 - String userName = list.get(i).getCallbackUserName(); + String userName = callbackInfoVo1.getCallbackUserName(); for (User user : userList) { if (StringUtils.isNotBlank(userName) && userName.equals(user.getUserName())) { - list.get(i).setCallbackUserName(user.getName()); + callbackInfoVo1.setCallbackUserName(user.getName()); break; } } diff --git a/src/main/java/com/emr/service/ipml/ArchiveFlowInfoService.java b/src/main/java/com/emr/service/ipml/ArchiveFlowInfoService.java index 33c98bf..91cf02f 100644 --- a/src/main/java/com/emr/service/ipml/ArchiveFlowInfoService.java +++ b/src/main/java/com/emr/service/ipml/ArchiveFlowInfoService.java @@ -15,8 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.LinkedList; import java.util.List; /** @@ -49,148 +51,213 @@ public class ArchiveFlowInfoService { /** * 添加进流转记录 * @param masterId - * @param currentStatus 当前节点code * @param remark 审核内容 - * @param appointNextCode 手动指定下个节点code,未指定查询流转下个节点,有指定使用指定 + * @param currentRole 当前节点对象 + * @param nextRole 手动指定下个节点对象,未指定查询流转下个节点,有指定使用指定 * @param sumbitDate 提交时间 * @throws Exception */ - public Integer insertFlowInfo(String masterId,String currentStatus,String remark,Integer appointNextCode,Date sumbitDate)throws Exception{ - if(StringUtils.isNotBlank(currentStatus)) { - //添加退回流程 - ArchiveFlowInfo flowInfo = new ArchiveFlowInfo(); - //masterId; - flowInfo.setMasterId(masterId); - //查询审核角色集合,根据有效进行计算状态code - List archiveFlowRoles = flowRoleMapper.selectAll(); - //stepIndex:当前步骤 - ArchiveFlowRole currentRole = new ArchiveFlowRole(); - for (ArchiveFlowRole archiveFlowRole : archiveFlowRoles) { - if (archiveFlowRole.getCode().equals(currentStatus)) { - currentRole = archiveFlowRole; - break; - } - } - //当前stepIndex - flowInfo.setStepIndex(currentRole.getStepIndex()); - //当前节点id - flowInfo.setStartStepId(currentRole.getId()); - //startStep:当前步骤name - flowInfo.setStartStep(currentRole.getName()); - //定义操作角色operRole - Short operRole = currentRole.getRole(); - //sumbitName + public Integer insertFlowInfo(String masterId,String remark,ArchiveFlowRole currentRole,ArchiveFlowRole nextRole,Date sumbitDate)throws Exception{ + //添加退回流程 + ArchiveFlowInfo flowInfo = new ArchiveFlowInfo(); + //masterId; + flowInfo.setMasterId(masterId); + + //useSeconds:距离上次提交用时s数 + long millis = getMillis(masterId, currentRole, nextRole); + if(millis != 0){ + flowInfo.setUseSeconds(millis / 1000); + } + //如果下节点role不为空取下节点operRole + if(null != nextRole.getRole()){ + flowInfo.setOperRole(nextRole.getRole()); + }else{ + flowInfo.setOperRole(currentRole.getRole()); + } + //如果下节点的sumBitName不为空取下节点的sumbitName + if(StringUtils.isNotBlank(nextRole.getSumbitName())){ + flowInfo.setSumbitName(nextRole.getSumbitName()); + }else{ flowInfo.setSumbitName(currentRole.getSumbitName()); - //targetStep:下一步骤name - ArchiveFlowRole nextRole = new ArchiveFlowRole(); - for (ArchiveFlowRole archiveFlowRole : archiveFlowRoles) { - //判断相同审核角色,比当前步骤还大且有效的角色 - if (null != archiveFlowRole.getRole() && archiveFlowRole.getEffective() == 1) { - if(null == appointNextCode){ - if(null != currentRole.getRole() && null != archiveFlowRole.getStepIndex()){ - if (currentRole.getRole().equals(archiveFlowRole.getRole()) && archiveFlowRole.getStepIndex() > currentRole.getStepIndex()) { - nextRole = archiveFlowRole; - break; - } + } + //当前stepIndex + flowInfo.setStepIndex(currentRole.getStepIndex()); + //当前节点id + flowInfo.setStartStepId(currentRole.getId()); + //startStep:当前步骤name + flowInfo.setStartStep(currentRole.getName()); + //targetStep + flowInfo.setTargetStep(nextRole.getName()); + //下个节点的id + flowInfo.setTargetStepId(nextRole.getId()); + //remark:提交内容 + flowInfo.setRemark(remark); + //userName:提交人用户名 + // 从session获取用户名 + String username = (String) SecurityUtils.getSubject().getSession().getAttribute("userSession"); + flowInfo.setUserName(username); + //submit:提交时间 + flowInfo.setSumbitTime(sumbitDate); + //createtime:创建时间 + flowInfo.setCreatetime(new Date()); + flowInfoMapper.insertSelective(flowInfo); + return flowInfo.getId(); + } + + /** + * 获取当前节点(list.get(0))和下个节点对象信息(list.get(1)) + * @param currentStatus + * @param appointNextCode + * @return + */ + public List getCurrentRoleAndNextRole(String currentStatus,Integer appointNextCode){ + List currentRoleAndNextRoleList = new LinkedList<>(); + //查询审核角色集合,根据有效进行计算状态code + List archiveFlowRoles = flowRoleMapper.selectAll(); + //stepIndex:当前步骤 + ArchiveFlowRole currentRole = getCurrentRoleByCurrentStatus(currentStatus, archiveFlowRoles); + currentRoleAndNextRoleList.add(currentRole); + if(null != appointNextCode){ + //targetStep:下一步骤节点信息 + ArchiveFlowRole nextRole = getNextRoleByCurrentStatus(appointNextCode, archiveFlowRoles, currentRole); + currentRoleAndNextRoleList.add(nextRole); + } + return currentRoleAndNextRoleList; + } + + /*** + * 计算节点间间隔毫秒数 + * @param masterId + * @param currentRole + * @param nextRole + * @return + * @throws ParseException + */ + private long getMillis(String masterId, ArchiveFlowRole currentRole, ArchiveFlowRole nextRole) throws ParseException { + long millis = 0; + Date preDate = new Date(); + //查询上次节点的时间 + //查询上次节点的时间方法参数当前节点的名称,当下个节点为病案室终审不带当前审核名称查询该病案最后审核时间 + String currentName = ""; + if(!nextRole.getName().equals(EnumVerify.DocState.MedicalRoomCheck.getName())){ + currentName = currentRole.getName(); + } + List archiveFlowInfos = flowInfoMapper.selectPreInfo(masterId,currentName); + if (null != archiveFlowInfos && !archiveFlowInfos.isEmpty()) { + //存在取最后一次提交时间 + preDate = archiveFlowInfos.get(0).getCreatetime(); + } else { + //取出院时间 + Archive_Master archiveMaster1 = archiveMasterMapper.selectByPrimaryKey(masterId); + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dischargeDateTime = archiveMaster1.getDischargeDateTime(); + if (StringUtils.isNotBlank(dischargeDateTime)) { + preDate = fmt.parse(dischargeDateTime); + } + } + if (null != preDate) { + millis = System.currentTimeMillis() - preDate.getTime(); + //查询是否这个时间段是否有假日 + int holidayDays = holidaySetMapper.selectHolidayByDate(preDate); + if(holidayDays != 0){ + int holidayMilTime = holidayDays * 24 * 3600 * 1000; + millis -= holidayMilTime; + } + } + return millis; + } + + /** + * 根据让钱节点信息获取获取下个节点信息 + * @param appointNextCode + * @param archiveFlowRoles + * @param currentRole + * @return + */ + private ArchiveFlowRole getNextRoleByCurrentStatus(Integer appointNextCode, List archiveFlowRoles, ArchiveFlowRole currentRole) { + ArchiveFlowRole nextRole = new ArchiveFlowRole(); + for (ArchiveFlowRole archiveFlowRole : archiveFlowRoles) { + //判断相同审核角色,比当前步骤还大且有效的角色 + if (null != archiveFlowRole.getRole() && archiveFlowRole.getEffective() == 1) { + if(null == appointNextCode){ + if(null != currentRole.getRole() && null != archiveFlowRole.getStepIndex()){ + if (currentRole.getRole().equals(archiveFlowRole.getRole()) && archiveFlowRole.getStepIndex() > currentRole.getStepIndex()) { + nextRole = archiveFlowRole; + nextRole.setRole(null); + nextRole.setSumbitName(null); + break; } - }else{ - //指定的下个节点code用于退回 - if (archiveFlowRole.getCode().equals(appointNextCode+"")) { - //医生退回下个节点为医生 - if(appointNextCode.equals(EnumVerify.DocState.DortorBack.getCode())){ - //sumbitName - flowInfo.setSumbitName(EnumVerify.DocState.DortorBack.getName()); - nextRole.setName(EnumVerify.DocState.DortorSubmit.getName()); - nextRole.setId(archiveFlowRole.getId()); - operRole = 1; - break; - //护士退回下个节点为护士 - }else if(appointNextCode.equals(EnumVerify.DocState.NurseBack.getCode())){ - flowInfo.setSumbitName(EnumVerify.DocState.NurseBack.getName()); - nextRole.setName(EnumVerify.DocState.NurseSubmit.getName()); - nextRole.setId(archiveFlowRole.getId()); - operRole = 2; - break; - //下个节点是病案室审核,属于召回 - }else if(appointNextCode.equals(EnumVerify.DocState.CallBacked.getCode())){ - flowInfo.setSumbitName(archiveFlowRole.getSumbitName()); - nextRole.setName(EnumVerify.DocState.MedicalRoomCheck.getName()); - //查询病案室终审id - for (ArchiveFlowRole archiveFlowRole1 : archiveFlowRoles) { - if (archiveFlowRole1.getCode().equals(EnumVerify.DocState.MedicalRoomCheck.getCode()+"")) { - nextRole.setId(archiveFlowRole1.getId()); - break; - } + } + }else{ + //指定的下个节点code用于退回 + if (archiveFlowRole.getCode().equals(appointNextCode+"")) { + //医生退回下个节点为医生 + if(appointNextCode.equals(EnumVerify.DocState.DortorBack.getCode())){ + //sumbitName + nextRole.setSumbitName(EnumVerify.DocState.DortorBack.getName()); + nextRole.setName(EnumVerify.DocState.DortorSubmit.getName()); + nextRole.setId(archiveFlowRole.getId()); + nextRole.setRole(Short.valueOf("1")); + break; + //护士退回下个节点为护士 + }else if(appointNextCode.equals(EnumVerify.DocState.NurseBack.getCode())){ + nextRole.setSumbitName(EnumVerify.DocState.NurseBack.getName()); + nextRole.setName(EnumVerify.DocState.NurseSubmit.getName()); + nextRole.setId(archiveFlowRole.getId()); + nextRole.setRole(Short.valueOf("2")); + break; + //下个节点是病案室审核,属于召回 + }else if(appointNextCode.equals(EnumVerify.DocState.CallBacked.getCode())){ + nextRole.setSumbitName(archiveFlowRole.getSumbitName()); + nextRole.setName(EnumVerify.DocState.MedicalRoomCheck.getName()); + //查询病案室终审id + for (ArchiveFlowRole archiveFlowRole1 : archiveFlowRoles) { + if (archiveFlowRole1.getCode().equals(EnumVerify.DocState.MedicalRoomCheck.getCode()+"")) { + nextRole.setId(archiveFlowRole1.getId()); + break; } - //病案室审核 - }else if(appointNextCode.equals(EnumVerify.DocState.MedicalRoomCheck.getCode())){ - nextRole.setName("已归档"); - nextRole.setId(archiveFlowRole.getId()); } + //病案室审核 + }else if(appointNextCode.equals(EnumVerify.DocState.MedicalRoomCheck.getCode())){ + nextRole.setName("已归档"); + nextRole.setId(archiveFlowRole.getId()); } } } } - //下个节点为空,填写护士长 - if(StringUtils.isBlank(nextRole.getName())){ - for (ArchiveFlowRole archiveFlowRole : archiveFlowRoles) { - if(archiveFlowRole.getCode().equals(EnumVerify.DocState.HeadNurseCheck.getCode()+"")){ - nextRole = archiveFlowRole; - break; - } - } - } - flowInfo.setTargetStep(nextRole.getName()); - //下个节点的id - flowInfo.setTargetStepId(nextRole.getId()); - //useSeconds:距离上次提交用时s数 - Date preDate = new Date(); - //查询上次节点的时间 - //查询上次节点的时间方法参数当前节点的名称,当下个节点为病案室终审不带当前审核名称查询该病案最后审核时间 - String currentName = ""; - if(!nextRole.getName().equals(EnumVerify.DocState.MedicalRoomCheck.getName())){ - currentName = currentRole.getName(); - } - List archiveFlowInfos = flowInfoMapper.selectPreInfo(masterId,currentName); - if (null != archiveFlowInfos && !archiveFlowInfos.isEmpty()) { - //存在取最后一次提交时间 - preDate = archiveFlowInfos.get(0).getCreatetime(); - } else { - //取出院时间 - Archive_Master archiveMaster1 = archiveMasterMapper.selectByPrimaryKey(masterId); - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String dischargeDateTime = archiveMaster1.getDischargeDateTime(); - if (StringUtils.isNotBlank(dischargeDateTime)) { - preDate = fmt.parse(dischargeDateTime); + } + //下个节点为空,填写护士长 + if(StringUtils.isBlank(nextRole.getName())){ + for (ArchiveFlowRole archiveFlowRole : archiveFlowRoles) { + if(archiveFlowRole.getCode().equals(EnumVerify.DocState.HeadNurseCheck.getCode()+"")){ + nextRole = archiveFlowRole; + nextRole.setRole(null); + nextRole.setSumbitName(null); + break; } } - if (null != preDate) { - long millis = System.currentTimeMillis() - preDate.getTime(); - //查询是否这个时间段是否有假日 - int holidayDays = holidaySetMapper.selectHolidayByDate(preDate); - if(holidayDays != 0){ - int holidayMilTime = holidayDays * 24 * 3600 * 1000; - millis -= holidayMilTime; - } - flowInfo.setUseSeconds(millis / 1000); + } + return nextRole; + } + + /** + * 根据当前状态码获取当前角色节点信息 + * @param currentStatus + * @param archiveFlowRoles + * @return + */ + private ArchiveFlowRole getCurrentRoleByCurrentStatus(String currentStatus, List archiveFlowRoles) { + ArchiveFlowRole currentRole = new ArchiveFlowRole(); + for (ArchiveFlowRole archiveFlowRole : archiveFlowRoles) { + if (archiveFlowRole.getCode().equals(currentStatus)) { + currentRole = archiveFlowRole; + break; } - flowInfo.setOperRole(operRole); - //remark:提交内容 - flowInfo.setRemark(remark); - //userName:提交人用户名 - // 从session获取用户名 - String username = (String) SecurityUtils.getSubject().getSession().getAttribute("userSession"); - flowInfo.setUserName(username); - //submit:提交时间 - flowInfo.setSumbitTime(sumbitDate); - //createtime:创建时间 - flowInfo.setCreatetime(new Date()); - flowInfoMapper.insertSelective(flowInfo); - return flowInfo.getId(); } - return null; + return currentRole; } + /** * 根据masterId查看流转流程信息 * @param id diff --git a/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java b/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java index 4c62037..aa93230 100644 --- a/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java +++ b/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java @@ -7,7 +7,9 @@ package com.emr.service.ipml; import com.emr.dao.ArchiveFlowRoleMapper; +import com.emr.dao.Archive_DetailMapper; import com.emr.dao.Archive_MasterMapper; +import com.emr.dao.Zd_AssortMapper; import com.emr.entity.*; import com.emr.service.Archive_MasterService; import com.emr.service.Emr_Fault_DetailService; @@ -20,6 +22,7 @@ import org.apache.shiro.SecurityUtils; import javax.servlet.http.HttpServletRequest; +import org.apache.shiro.util.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -45,6 +48,10 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { private ArchiveFlowRoleMapper flowRoleMapper; @Autowired private ArchiveFlowInfoService flowInfoService; + @Autowired + private Archive_DetailMapper detailMapper; + @Autowired + private Zd_AssortMapper assortMapper; /** * 在院列表 * */ @@ -62,9 +69,92 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { public OffsetLimitPage selectByColumn(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) { PageHelper.offsetPage(offset, limit); List list = selectByColumn(archiveMasterVo); + long start = System.currentTimeMillis(); + //组织完整性字段 + //list集合的分组分类集合 + if(!CollectionUtils.isEmpty(list)){ + List details = getArchiveDetailsByMasterIds(list); + if(!CollectionUtils.isEmpty(details)){ + //查询需要校验完整性的分类集合 + Zd_Assort assort = new Zd_Assort(); + assort.setIsCheck(1); + List assortList = assortMapper.selectAll(assort); + //循环遍历list集合判断是否完整,完整isCheck赋值1,且批量更新LockInfo字段为完整 + checkSuccess(list, details, assortList); + } + } + long end = System.currentTimeMillis(); + System.out.println("用时"+(end-start)/1000.0+"s"); return new OffsetLimitPage((Page) list); } + /** + * //循环遍历list集合判断是否完整,完整isCheck赋值1,且批量更新LockInfo字段为完整 + * @param list + * @param details + * @param assortList + */ + private void checkSuccess(List list, List details, List assortList) { + //循环遍历list集合判断是否完整,完整isCheck赋值1,且批量更新LockInfo字段为完整 + //定义通过完整性校验的masterIds + StringBuilder masterIds = new StringBuilder(); + for(Archive_Master_Vo master : list){ + //定义匹配分类成功次数 + int successCount = 0; + for(Zd_Assort assortFor : assortList){ + //定义无匹配的分类 + boolean flag = false; + for(Archive_Detail detail : details){ + //判断主键相同且分类id相同 + if(master.getId().equals(detail.getMasterid()) && assortFor.getAssortId().equals(detail.getAssortid())){ + successCount++; + flag = true; + break; + } + } + //该分类无匹配直接跳出循环,改主键不完整 + if(!flag){ + break; + } + } + //如果成功匹配个数和需校验分类个数相等,全部匹配 + if(successCount == assortList.size()){ + //list的isSuccess字段值赋值1 + master.setIsSuccess(1); + //不完整的批量更新为完整 + if(!"完整".equals(master.getLockinfo())) { + if (StringUtils.isBlank(masterIds)) { + masterIds.append("'").append(master.getId()).append("'"); + } else { + masterIds.append(",'").append(master.getId()).append("'"); + } + } + } + } + //不完整的批量批量更新master表的LockInfo字段为完整 + if(StringUtils.isNotBlank(masterIds)){ + archiveMasterMapper.updateLockInfoByMasterId(masterIds.toString(),"完整"); + } + } + + /** + * 根据masterIds查询分组的需要校验完整性的detail分类集合 + * @param list + * @return + */ + private List getArchiveDetailsByMasterIds(List list) { + StringBuilder masterIds = new StringBuilder(); + for (int i = 0; i < list.size(); i++) { + if(i == 0){ + masterIds.append("'").append(list.get(i).getId()).append("'"); + }else{ + masterIds.append(",'").append(list.get(i).getId()).append("'"); + } + } + //根据id集合查detail明细表分组分类集合 + return detailMapper.selectAssortIdsByMasterIds(masterIds.toString()); + } + /** * 未归档列表 * */ @@ -443,12 +533,10 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { public int updateReturn(Emr_Fault_Detail_Vo emrFaultDetail) throws Exception{ //修改病案归档状态:复审退回 Archive_Master archiveMaster = new Archive_Master(); - archiveMaster.setId(emrFaultDetail.getArchiveDetailId()); // 从session获取用户名 String username = (String) SecurityUtils.getSubject().getSession().getAttribute("userSession");//获取前面登录的用户名 //设置回退给角色信息 String returntoRole = emrFaultDetail.getReturntoRole(); - archiveMaster.setReturntoRole(returntoRole); log.info(username+"将病案:"+emrFaultDetail.getArchiveDetailId()+"退回给"+returntoRole); if(StringUtils.isNotBlank(emrFaultDetail.getStatus())) { int status = Integer.valueOf(emrFaultDetail.getStatus()); @@ -467,9 +555,7 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { } //定义退回内容 String remark = emrFaultDetail.getBackContent(); - Integer backToCode = 0; - //流转记录的最新id - Integer flowInfoId = 0; + List backToCodeList = new ArrayList<>(); //参数输入 SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowTime = format1.format(new Date()); @@ -479,41 +565,38 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { switch (returntoRole) { //退回给医生 case "DOCTOR": + //获取当前状态码 status = EnumVerify.DocState.backToDoctor(Integer.valueOf(emrFaultDetail.getStatus()),archiveFlowRoles); - //添加进流转记录 - backToCode = EnumVerify.DocState.DortorBack.getCode(); - flowInfoId = flowInfoService.insertFlowInfo(masterId,targetCode,remark,backToCode,new Date()); - emrFaultDetail.setParentId(flowInfoId); - //添加缺陷记录 - emrFaultDetailService.insertSel(emrFaultDetail); + //退回的状态码 + backToCodeList.add(EnumVerify.DocState.DortorBack.getCode()); break; //退回给护士 case "NURSE": - backToCode = EnumVerify.DocState.NurseBack.getCode(); status = EnumVerify.DocState.backToNurse(Integer.valueOf(emrFaultDetail.getStatus()),archiveFlowRoles); - //添加进流转记录 - flowInfoId = flowInfoService.insertFlowInfo(masterId,targetCode,remark,backToCode,new Date()); - emrFaultDetail.setParentId(flowInfoId); - //添加缺陷记录 - emrFaultDetailService.insertSel(emrFaultDetail); + backToCodeList.add(EnumVerify.DocState.NurseBack.getCode()); break; //退回给医生和护士 case "ALL": status = EnumVerify.DocState.backToAll(); - backToCode = EnumVerify.DocState.DortorBack.getCode(); - flowInfoId = flowInfoService.insertFlowInfo(masterId,targetCode,remark,backToCode,new Date()); - emrFaultDetail.setParentId(flowInfoId); - //添加缺陷记录 - emrFaultDetailService.insertSel(emrFaultDetail); - backToCode = EnumVerify.DocState.NurseBack.getCode(); - flowInfoId = flowInfoService.insertFlowInfo(masterId,targetCode,remark,backToCode,new Date()); - emrFaultDetail.setParentId(flowInfoId); - //添加缺陷记录 - emrFaultDetailService.insertSel(emrFaultDetail); + backToCodeList.add(EnumVerify.DocState.DortorBack.getCode()); + backToCodeList.add(EnumVerify.DocState.NurseBack.getCode()); break; + default:; + } + //循环添加进流转记录和缺陷记录 + for(Integer backToCode : backToCodeList){ + //获取当前节点和下个节点对象集合 + List currentRoleAndNextRole = flowInfoService.getCurrentRoleAndNextRole(targetCode, backToCode); + //添加进流转记录 + Integer flowInfoId = flowInfoService.insertFlowInfo(masterId,remark,currentRoleAndNextRole.get(0),currentRoleAndNextRole.get(1),new Date()); + emrFaultDetail.setParentId(flowInfoId); + //添加缺陷记录 + emrFaultDetailService.insertSel(emrFaultDetail); } archiveMaster.setArchivestate(status + ""); } + archiveMaster.setId(emrFaultDetail.getArchiveDetailId()); + archiveMaster.setReturntoRole(returntoRole); //设置回退操作人信息 archiveMaster.setReturnOperUsername(username); updateByClo(archiveMaster); @@ -592,8 +675,10 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { BeanUtils.copyProperties(master,archiveMaster); //更新 updateByClo(archiveMaster); + //获取当前节点和下个节点对象集合 + List currentRoleAndNextRole = flowInfoService.getCurrentRoleAndNextRole(master.getStatus()+"", null); //添加进流转记录 - flowInfoService.insertFlowInfo(master.getId(),master.getStatus()+"",master.getRemark(),null,new Date()); + flowInfoService.insertFlowInfo(master.getId(),master.getRemark(),currentRoleAndNextRole.get(0),new ArchiveFlowRole(),new Date()); return Msg.success(); } else { return Msg.fail("初始状态出错了!"); @@ -609,32 +694,41 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { // 从session获取用户名 String username = (String) SecurityUtils.getSubject().getSession().getAttribute("userSession");//获取前面登录的用户名 SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - //修改病案归档状态 - Archive_Master archiveMaster = new Archive_Master(); - //拷贝对象 - BeanUtils.copyProperties(master,archiveMaster); - //定义提交时间 - //设置审核时间 - Date sumbitDate = new Date(); - if(StringUtils.isBlank(master.getCheckedDatetime())){ - //未手动修改终审时间,使用当前时间 - archiveMaster.setCheckedDatetime(format1.format(new Date())); - }else{ - //手动修改终审时间,是否修改的时间 - archiveMaster.setCheckedDatetime(master.getCheckedDatetime()); - sumbitDate = format1.parse(master.getCheckedDatetime()); + String ids = master.getId(); + String[] idList = ids.split(","); + for(String id : idList) { + if(StringUtils.isNotBlank(id)) { + //修改病案归档状态 + Archive_Master archiveMaster = new Archive_Master(); + master.setId(id); + //拷贝对象 + BeanUtils.copyProperties(master, archiveMaster); + //定义提交时间 + //设置审核时间 + Date sumbitDate = new Date(); + if (StringUtils.isBlank(master.getCheckedDatetime())) { + //未手动修改终审时间,使用当前时间 + archiveMaster.setCheckedDatetime(format1.format(new Date())); + } else { + //手动修改终审时间,是否修改的时间 + archiveMaster.setCheckedDatetime(master.getCheckedDatetime()); + sumbitDate = format1.parse(master.getCheckedDatetime()); + } + //设置审核人 + archiveMaster.setCheckedDoctor(username); + //设为已归档状态 + archiveMaster.setArchivestate(EnumVerify.DocState.MedicalRoomCheck.getCode() + ""); + //更新 + updateByClo(archiveMaster); + //当前节点两种可能病案室审核和已召回 + //是已召回,将当前节点code置为病案室审核 + String currentStatus = EnumVerify.DocState.MedicalRoomCheck.getCode() + ""; + //获取当前节点和下个节点对象集合 + List currentRoleAndNextRole = flowInfoService.getCurrentRoleAndNextRole(currentStatus, EnumVerify.DocState.MedicalRoomCheck.getCode()); + //添加流转节点 + flowInfoService.insertFlowInfo(master.getId(), master.getRemark(), currentRoleAndNextRole.get(0), currentRoleAndNextRole.get(1), sumbitDate); + } } - //设置审核人 - archiveMaster.setCheckedDoctor(username); - //设为已归档状态 - archiveMaster.setArchivestate(EnumVerify.DocState.MedicalRoomCheck.getCode()+""); - //更新 - updateByClo(archiveMaster); - //当前节点两种可能病案室审核和已召回 - //是已召回,将当前节点code置为病案室审核 - String currentStatus = EnumVerify.DocState.MedicalRoomCheck.getCode() + ""; - //添加流转节点 - flowInfoService.insertFlowInfo(master.getId(),currentStatus,master.getRemark(),EnumVerify.DocState.MedicalRoomCheck.getCode(),sumbitDate); /*//masterId; flowInfo.setMasterId(master.getId()); //stepIndex:当前步骤 diff --git a/src/main/java/com/emr/service/ipml/StatisticsService.java b/src/main/java/com/emr/service/ipml/StatisticsService.java index ed2fad7..c892b8e 100644 --- a/src/main/java/com/emr/service/ipml/StatisticsService.java +++ b/src/main/java/com/emr/service/ipml/StatisticsService.java @@ -1,6 +1,7 @@ package com.emr.service.ipml; import com.alibaba.fastjson.JSON; +import com.emr.dao.RecordStatisticsMapper; import com.emr.dao.StatisticsMapper; import com.emr.dao.TUuInfoMapper; import com.emr.dao.TUuPrintMapper; @@ -52,6 +53,8 @@ public class StatisticsService { private TUuPrintMapper uuPrintMapper; @Autowired private TUuInfoMapper uuInfoMapper; + @Autowired + private RecordStatisticsMapper recordStatisticsMapper; //终审按天统计 public List getFinalStatistics(Integer offset, Integer limit, String startDate, String endDate,String sql) throws Exception{ if(null != offset && null != limit){ @@ -200,5 +203,144 @@ public class StatisticsService { } return userList; } + + /** + * 统计病案列表 + * @param recordStatistics + * @return + */ + public List getRecordStatistics(RecordStatistics recordStatistics) { + List list = new Page<>(); + RecordStatistics record = new RecordStatistics(); + //设置总病历数 + int recordCount = recordStatisticsMapper.getRecordCount(recordStatistics); + record.setAllRecordCount(recordCount); + List fileCountList = null; + if(recordCount != 0) { + //查询总文件数 + fileCountList = recordStatisticsMapper.getFileCount(recordStatistics); + } + //计算总文件数,总自动采集文件数,扫描上传文件数 + setFileCounts(record, fileCountList,null,null); + //计算总页数,自动采集总页数,扫描上传总页数 + setPageCounts(record); + list.add(record); + return list; + } + + //计算总页数,自动采集总页数,扫描上传总页数 + private void setPageCounts(RecordStatistics record) { + //TODO 设置总页数 + record.setAllPageCount(null); + //TODO 设置自动采集总页数 + record.setAutoCollectionPageCount(null); + //TODO 设置扫描上传总页数 + record.setManualScanPageCount(null); + } + + //计算总文件数,总自动采集文件数,扫描上传文件数 + private void setFileCounts(RecordStatistics record, List fileCountList,String param,String paramFlag) { + int allFileCount = 0; + int autoFileCount = 0; + int scanFileCount = 0; + if(!CollectionUtils.isEmpty(fileCountList) && (record.getAllRecordCount() == null || record.getAllRecordCount() != 0)){ + for(RecordStatistics recordTemp : fileCountList){ + //定义是否匹配标识 + boolean flag = false; + if("deptName".equals(paramFlag)){ + flag = recordTemp.getDeptName().equals(param); + }else if("masterId".equals(paramFlag)){ + flag = recordTemp.getMasterId().equals(param); + } + //匹配上或不需匹配时才参与计算 + if(flag || StringUtils.isBlank(paramFlag)) { + Integer fileCount = recordTemp.getAllFileCount(); + //计算总文件数 + allFileCount += fileCount; + String source = recordTemp.getSource(); + if (StringUtils.isNotBlank(source) && "扫描上传".equals(source)) { + //计算扫描上传的文件数 + scanFileCount += fileCount; + } else { + //计算自动采集的文件数 + autoFileCount += fileCount; + } + } + } + } + //设置总文件数 + record.setAllFileCount(allFileCount); + //设置自动采集总文件数 + record.setAutoCollectionFileCount(autoFileCount); + //设置扫描上传总文件数 + record.setManualScanFileCount(scanFileCount); + } + + /** + * 按科室分组统计病案 + * @param offset + * @param limit + * @param recordStatistics + * @return + */ + public List getRecordStatisticsGroupDept(Integer offset,Integer limit,RecordStatistics recordStatistics) { + if(null != offset && null != limit){ + PageHelper.offsetPage(offset, limit); + } + //按科室分组统计病案数 + List list = recordStatisticsMapper.getRecordStatisticsGroupDept(recordStatistics); + //按科室code匹配计算总文件数、自动采集文件数和扫描上传文件数 + if(!CollectionUtils.isEmpty(list)){ + //按科室和文件来源统计文件数 + List fileList = recordStatisticsMapper.getFileStatisticsGroupDept(recordStatistics); + for(RecordStatistics record : list){ + //获取科室code + String deptName = record.getDeptName(); + //计算总文件数,总自动采集文件数,扫描上传文件数 + setFileCounts(record, fileList,deptName,"deptName"); + //计算总页数,自动采集总页数,扫描上传总页数 + setPageCounts(record); + } + } + return list; + } + + /** + * 根据科室查询患者病案统计 + * @param offset + * @param limit + * @param recordStatistics + * @return + */ + public List getRecordStatisticsByDeptName(Integer offset, Integer limit, RecordStatistics recordStatistics) { + if(null != offset && null != limit){ + PageHelper.offsetPage(offset, limit); + } + //根据科室查询基本信息 + List list = recordStatisticsMapper.getRecordStatisticsByDeptName(recordStatistics); + //获取分页查询后的masterId集合 + if(!CollectionUtils.isEmpty(list)){ + //定义masterId集合 + StringBuilder masterIds = new StringBuilder(); + for (int i = 0; i < list.size(); i++) { + String masterId = list.get(i).getMasterId(); + if(i == 0){ + masterIds.append("'").append(masterId).append("'"); + }else{ + masterIds.append(",'").append(masterId).append("'"); + } + } + //根据masterIds集合查询文件数集合 + List fileCountList = recordStatisticsMapper.getFileCountByMasterIds(masterIds.toString()); + for(RecordStatistics record : list){ + String masterId = record.getMasterId(); + //计算总文件数,总自动采集文件数,扫描上传文件数 + setFileCounts(record, fileCountList,masterId,"masterId"); + //计算总页数,自动采集总页数,扫描上传总页数 + setPageCounts(record); + } + } + return list; + } } diff --git a/src/main/java/com/emr/shiro/MyRealm.java b/src/main/java/com/emr/shiro/MyRealm.java index 995e854..95c73fd 100644 --- a/src/main/java/com/emr/shiro/MyRealm.java +++ b/src/main/java/com/emr/shiro/MyRealm.java @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import java.util.List; +import java.util.Set; /** * @author HJL diff --git a/src/main/java/com/emr/vo/RecordStatistics.java b/src/main/java/com/emr/vo/RecordStatistics.java new file mode 100644 index 0000000..7ea43c7 --- /dev/null +++ b/src/main/java/com/emr/vo/RecordStatistics.java @@ -0,0 +1,37 @@ +package com.emr.vo; + +import lombok.Data; + +/** + * @ProjectName:病案统计对象 + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2020/8/7 10:29 + * @UpdateUser: 曾文和 + * @UpdateDate: 2020/8/7 10:29 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ +@Data +public class RecordStatistics { + private String inpNo;//住院号 + private String visitId;//住院次数 + private String name;//患者姓名 + private String deptName;//出院科室 + private String dischargeDateTime;//出院日期 + private Integer allRecordCount; //总病历数 + private Integer allFileCount;//总文件数 + private Integer allPageCount;//总页数 + private Integer autoCollectionFileCount;//自动采集总文件数 + private Integer autoCollectionPageCount;//自动采集总页数 + private Integer manualScanFileCount;//扫描上传总文件数 + private Integer manualScanPageCount;//扫描上传总页数 + private String startDate;//出院开始日期 + private String endDate;//出院结束日期 + private String deptNameCn;//出院科室转换中文 + private String source;//文件来源 + private String masterId;//病案主键 + private Integer timeInterval;//出院时段 +} diff --git a/src/main/resources/mapper/Archive_DetailMapper.xml b/src/main/resources/mapper/Archive_DetailMapper.xml index 5a4ff50..05b88c7 100644 --- a/src/main/resources/mapper/Archive_DetailMapper.xml +++ b/src/main/resources/mapper/Archive_DetailMapper.xml @@ -65,7 +65,7 @@ and t.MasterID=#{patientId,jdbcType=VARCHAR} - and t.AssortID=#{assortId,jdbcType=VARCHAR} + and t.AssortID IN (${assortId}) and t.AssortID in (${assortName}) @@ -317,4 +317,21 @@ where MasterID = #{masterId} and id in (${detailIds}) and flag != 1 order by zd_assort.assort_sort,archive_detail.UpLoadDateTime + + \ No newline at end of file diff --git a/src/main/resources/mapper/Archive_MasterMapper.xml b/src/main/resources/mapper/Archive_MasterMapper.xml index bd293d2..ffce137 100644 --- a/src/main/resources/mapper/Archive_MasterMapper.xml +++ b/src/main/resources/mapper/Archive_MasterMapper.xml @@ -919,4 +919,9 @@ + + + UPDATE archive_master SET LockInfo = #{lockinfo} + WHERE id IN (${masterIds}) + \ No newline at end of file diff --git a/src/main/resources/mapper/RecordStatisticsMapper.xml b/src/main/resources/mapper/RecordStatisticsMapper.xml new file mode 100644 index 0000000..b58303e --- /dev/null +++ b/src/main/resources/mapper/RecordStatisticsMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + AND archive_master.dept_name IN + + #{item} + + + + + AND archive_master.discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and + #{endDate,jdbcType=NCHAR}+ ' 23:59:59' + + + AND archive_master.discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) + + + AND archive_master.discharge_date_time <= #{endDate,jdbcType=NCHAR}+ ' 23:59:59' + + + + AND archive_master.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%' + + + and archive_master.name like '%'+#{name,jdbcType=NCHAR}+'%' + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/Zd_AssortMapper.xml b/src/main/resources/mapper/Zd_AssortMapper.xml index b08692c..a6671eb 100644 --- a/src/main/resources/mapper/Zd_AssortMapper.xml +++ b/src/main/resources/mapper/Zd_AssortMapper.xml @@ -6,6 +6,7 @@ + + @@ -211,11 +210,7 @@
-
@@ -228,6 +223,7 @@
+ @@ -579,6 +575,7 @@ + 内容: @@ -616,6 +613,26 @@ +<%--审核确认弹窗--%> + <%--查看流程弹窗--%>
-
+ @@ -568,7 +565,7 @@ <%--审核弹窗--%> -