diff --git a/src/main/java/com/emr/controller/lastVerifyController.java b/src/main/java/com/emr/controller/lastVerifyController.java index 3571f428..14d4c438 100644 --- a/src/main/java/com/emr/controller/lastVerifyController.java +++ b/src/main/java/com/emr/controller/lastVerifyController.java @@ -287,33 +287,13 @@ public class lastVerifyController { Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String handleName = user.getUserPosition();//姓名 String username = user.getUserName();//工号 - SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowTime = format1.format(new Date()); - - //参数输入 emrFaultDetail.setCreater(username); emrFaultDetail.setCreateTime(nowTime); emrFaultDetail.setState("未召回"); - - //暂时优化不改动流程(每次初审通过后,都会删除已有的召回记录,并插入新的未召回记录) - bol = emrFaultDetailService.delbyCol(emrFaultDetail); - if(bol>=0) { - emrFaultDetailService.insertSel(emrFaultDetail); - } - /*判断是否已经有召回记录 - Emr_Fault_Vo vo=new Emr_Fault_Vo(); - vo.setArchiveDetailId(emrFaultDetail.getArchiveDetailId()); - List list = emrFaultDetailService.selectByCol(vo); - if(list.size()>0){ - //存在归档记录 - bol = emrFaultDetailService.delbyCol(emrFaultDetail); - if(bol==1){ - emrFaultDetailService.insertSel(emrFaultDetail); - } - }else{ - emrFaultDetailService.insertSel(emrFaultDetail); - }*/ + emrFaultDetailService.delbyCol(emrFaultDetail); + emrFaultDetailService.insertSel(emrFaultDetail); //初审成功日志 Archive_Master_Following archiveMasterFollowing = new Archive_Master_Following(); archiveMasterFollowing.setMasterId(emrFaultDetail.getArchiveDetailId()); diff --git a/src/main/java/com/emr/controller/storageController.java b/src/main/java/com/emr/controller/storageController.java index 3bfefd59..cec9afaa 100644 --- a/src/main/java/com/emr/controller/storageController.java +++ b/src/main/java/com/emr/controller/storageController.java @@ -132,7 +132,6 @@ public class storageController { SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowTime = format1.format(new Date()); emrFaultDetail.setUpdateTime(nowTime); - Archive_Master archiveMaster = new Archive_Master(); Archive_Master_Following archiveMasterFollowing = new Archive_Master_Following(); archiveMaster.setId(emrFaultDetail.getArchiveDetailId()); 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 056ec5c7..1121e4b4 100644 --- a/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java +++ b/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java @@ -851,6 +851,24 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { public OffsetLimitPage selectHandleDetail(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) { PageHelper.offsetPage(offset, limit); List list = archiveMasterMapper.selectHandleDetail(archiveMasterVo); + Emr_Dictionary dic = new Emr_Dictionary(); + dic.setEffective(1); + dic.setTypecode("dept_code"); + List dicList = emrDictionaryService.dicByTypeCode(dic); + //转换科室 + Map codeMap = ListUtil.toMap(dicList, Emr_Dictionary::getCode); + Setters.instance().list(list).cycleSetProperties(p -> { + String deptCode = p.getDeptName(); + String deptAdmissionCode = p.getDeptAdmissionTo(); + if(StringUtils.isNotBlank(deptCode) && codeMap.containsKey(deptCode)){ + String deptName = codeMap.get(deptCode).getName(); + p.setDeptName(deptName); + } + if(StringUtils.isNotBlank(deptAdmissionCode) && codeMap.containsKey(deptAdmissionCode)){ + String deptAdmissionTo = codeMap.get(deptAdmissionCode).getName(); + p.setDeptAdmissionTo(deptAdmissionTo); + } + }); return new OffsetLimitPage((Page) list); } diff --git a/src/main/java/com/emr/service/ipml/BatchExportServiceImpl.java b/src/main/java/com/emr/service/ipml/BatchExportServiceImpl.java index 3d958fdd..0a4f8fda 100644 --- a/src/main/java/com/emr/service/ipml/BatchExportServiceImpl.java +++ b/src/main/java/com/emr/service/ipml/BatchExportServiceImpl.java @@ -61,32 +61,40 @@ public class BatchExportServiceImpl implements BatchExportService { return "没有任务"; } for (ExportTaskDetailsVo list : taskList) { - //根据住院号出院日期查询需要导出病历路径 - List masterIds = exportTaskDetailsMapper.getMasterId(list.getInpNo(), list.getDischargeDateTime()); - if (CollectionUtils.isEmpty(masterIds)) { - logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历找不到。"); - continue; - } - for (String masterId : masterIds) { - List pdfPathList = exportZdAssortMapper.getPdfPath(masterId); - if (CollectionUtils.isEmpty(pdfPathList)){ - logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历查询不到影像"); + try { + //根据住院号出院日期查询需要导出病历路径 + List masterIds = exportTaskDetailsMapper.getMasterId(list.getInpNo(), list.getDischargeDateTime()); + if (CollectionUtils.isEmpty(masterIds)) { + logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历找不到。"); continue; } - try { - //组织导出文件名 - fileName = exportFlieName(list); - } catch (ParseException e) { - throw new RuntimeException(e); - } -// downPdfResponse(fileName,response); - Boolean aBoolean = exportPdf(pdfPathList,fileName); - //为true时修改任务状态1完成2失败 - if (aBoolean){ - exportTaskDetailsMapper.upStatc(1,list.getId()); - }else { - exportTaskDetailsMapper.upStatc(2,list.getId()); + for (String masterId : masterIds) { + List pdfPathList = exportZdAssortMapper.getPdfPath(masterId); + if (CollectionUtils.isEmpty(pdfPathList)){ + logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历查询不到影像"); + continue; + } + try { + //组织导出文件名 + fileName = exportFlieName(list); + } catch (ParseException e) { + logger.log("保存失败!异常处理" + e.getMessage()); + exportTaskDetailsMapper.upStatc(2,list.getId()); + } + // downPdfResponse(fileName,response); + Boolean aBoolean = exportPdf(pdfPathList,fileName); + //为true时修改任务状态1完成2失败 + if (aBoolean){ + logger.log(list.getId()+"这个id导出失败"); + exportTaskDetailsMapper.upStatc(1,list.getId()); + }else { + exportTaskDetailsMapper.upStatc(2,list.getId()); + } } + } catch (Exception e) { + logger.log(list.getId()+"这个id导出失败"); + logger.log("保存失败!异常处理" + e.getMessage()); + exportTaskDetailsMapper.upStatc(2,list.getId()); } } return "下载完成"; @@ -157,17 +165,24 @@ public class BatchExportServiceImpl implements BatchExportService { } pageNum =pageNum+getPageNum(pdfPathList.get(i)); } catch (Exception e) { + //报错删除错误文件 + File file = new File("D://export//"+fileName+".pdf"); + try { + file.delete(); // 删除照片 + } catch (Exception c) { + c.printStackTrace(); + } return false; } } - return true; } catch (Exception e) { - e.printStackTrace(); + logger.log(e.getMessage()); } finally { if (document != null) { document.close(); } } + document.close(); return true; } diff --git a/src/main/resources/config/applicationContext.xml b/src/main/resources/config/applicationContext.xml index ad8f6714..259b9599 100644 --- a/src/main/resources/config/applicationContext.xml +++ b/src/main/resources/config/applicationContext.xml @@ -45,8 +45,8 @@ - - + + diff --git a/src/main/resources/mapper/Archive_MasterMapper.xml b/src/main/resources/mapper/Archive_MasterMapper.xml index 5a2e3f9e..d12b87b9 100644 --- a/src/main/resources/mapper/Archive_MasterMapper.xml +++ b/src/main/resources/mapper/Archive_MasterMapper.xml @@ -693,7 +693,7 @@ - and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%' + and m.inp_no =#{inpNo,jdbcType=NCHAR} and m.bed_number like '%'+#{bedNumber,jdbcType=NVARCHAR}+'%' @@ -1425,11 +1425,11 @@ ,m.visit_id ,m.name ,m.sex - ,g.name dept_name + ,m.dept_name ,CONVERT(varchar(10),m.discharge_date_time, 120)discharge_date_time ,m.ArchiveState ,CONVERT(varchar(10),m.admission_date_time, 120)admission_date_time - ,d.name dept_admission_to + ,m.dept_admission_to ,m.check_doctor ,m.check_datetime ,m.checked_doctor @@ -1463,18 +1463,12 @@ FROM archive_master m LEFT JOIN Archive_Master_Following f on m.id=f.master_id - LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where - typeCode='dept_code' )) d - on m.dept_admission_to=d.code - LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where - typeCode='dept_code' )) g - on m.dept_name=g.code where 1=1 and f.following_type in(8,9) and m.ArchiveState!='已封存' and m.id = #{id,jdbcType=NVARCHAR} - and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%' + and m.inp_no =#{inpNo,jdbcType=NCHAR} and m.visit_id=#{visitId,jdbcType=NCHAR}