diff --git a/WholeCheckInterface.iml b/WholeCheckInterface.iml index bf75017..bfadfb8 100644 --- a/WholeCheckInterface.iml +++ b/WholeCheckInterface.iml @@ -20,8 +20,10 @@ + + @@ -34,24 +36,8 @@ - + - - - - - - - - - - - - - - - - diff --git a/src/main/java/com/ann/demo/DemoApplication.java b/src/main/java/com/ann/demo/DemoApplication.java index 7a132a5..201a8e0 100644 --- a/src/main/java/com/ann/demo/DemoApplication.java +++ b/src/main/java/com/ann/demo/DemoApplication.java @@ -1,13 +1,43 @@ package com.ann.demo; + +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.util.StringUtils; + + +import java.net.InetAddress; + + + @SpringBootApplication +@Slf4j public class DemoApplication { - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); + + public static void main(String[] args) throws Exception { + ConfigurableApplicationContext application = SpringApplication.run(DemoApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String property = env.getProperty("server.servlet.context-path"); + String path = property == null ? "" : property; + System.out.println( + "\n\t" + + "----------------------------------------------------------\n\t" + + "Application Sailrui-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/\n\t" + + "External: \thttp://" + ip + ":" + port + path + "/\n\t" + + "------------------------------------------------------------"); } -} + + } + + + + diff --git a/src/main/java/com/ann/demo/entity/filing/ArchiveMaster.java b/src/main/java/com/ann/demo/entity/filing/ArchiveMaster.java index 4784294..c7615b4 100644 --- a/src/main/java/com/ann/demo/entity/filing/ArchiveMaster.java +++ b/src/main/java/com/ann/demo/entity/filing/ArchiveMaster.java @@ -90,7 +90,7 @@ public class ArchiveMaster { /** * */ - private Date checkedDoctor; + private String checkedDoctor; /** diff --git a/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java b/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java index 77d9351..d24453b 100644 --- a/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java +++ b/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java @@ -5,6 +5,7 @@ import com.ann.demo.entity.filing.ArchiveMaster; import com.ann.demo.interfaces.HomepageDictionary; import com.ann.demo.service.ArchiveDetailService; import com.ann.demo.service.ArchiveMasterService; +import com.ann.demo.util.ExceptionPrintUtil; import com.google.common.base.Objects; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,72 +73,86 @@ public class HomepageDictionaryImpl implements HomepageDictionary { } // 必须检查类型 sb = new StringBuffer(); + String[] inspectionReportTypeArray; + List types; + String checkLisNotExits; if (!mustCheckData.equals("")) { - String[] mustCheckDataArray = mustCheckData.split(","); - List types = Arrays.asList(mustCheckDataArray); - String typeIsExits = archiveDetailService.getTypeNotExits(types, masterId); - if (typeIsExits != null ) { - sb.append("缺失"+typeIsExits); + inspectionReportTypeArray = mustCheckData.split(","); + types = Arrays.asList(inspectionReportTypeArray); + checkLisNotExits = this.archiveDetailService.getTypeNotExits(types, masterId); + if (checkLisNotExits != null) { + sb.append("缺失" + checkLisNotExits); } //----------------单独处理出院记录,包含情况 2021-1-14 //----------------如果缺失出院记录,那么考虑是不是24小时病历,如果是,那么提示不缺失,如果不是, 那么考虑是不是存在die病历,如果是,那么提示,缺失死亡记录,否择提示缺失出院记录; - List list = new ArrayList(); - list.add("113"); + List list = new ArrayList(); list.add("11"); String disResult = archiveDetailService.getTypeNotExits(list, masterId); if (disResult != null ) { //再判断是不是24小时入院 String beHospitalized = archiveDetailService.getBeHospitalized(masterId, "9"); if (!Objects.equal(beHospitalized, "24小时内入出院记录")) { + sb.append("," + disResult); + } + } + List list1 = new ArrayList(); + list1.add("113"); + String disResult1 = archiveDetailService.getTypeNotExits(list1, masterId); + if (disResult1 != null ) { + //再判断是不是24小时入院 + String beHospitalized1 = archiveDetailService.getBeHospitalized(masterId, "9"); + if (!Objects.equal(beHospitalized1, "24小时内入出院记录")) { if (Objects.equal(archiveMaster.getDeathFlag(), "1")) { - Integer dieResult = archiveDetailService.countDetail(masterId, "17"); - if(dieResult == 0){ + Integer dieResult1 = archiveDetailService.countDetail(masterId, "17"); + if(dieResult1 == 0){ sb.append(",死亡记录"); } }else{ - sb.append("," + disResult); + sb.append("," + disResult1); } } } - //----------------单独处理出院记录 - - //----------------单独处理重症单中“首次护理记录单” - List list2 = new ArrayList(); - list2.add("7"); - String huliResult = archiveDetailService.getTypeNotExits(list2, masterId); - if (huliResult != null){ - //缺失首次护理记录单(来源V6护士) - //再判断重症单中是否有首次护理记录单 - Integer result = archiveDetailService.countFirstNursingRecord(masterId, "121"); - if (result==0){ - //重症单中没有首次护理记录单 - sb.append("缺失首次护理记录单"); + //单独检验骨密度 + List list2 = new ArrayList(); + list1.add("130"); + String disResult2 = archiveDetailService.getTypeNotExits(list2, masterId); + if (disResult2==null){ + int dicomNum = archiveDetailService.getDicomNum(masterId); + if (dicomNum>0){ + if (sb.length()==0){ + sb.append("缺失骨密度检查报告"); + }else { + sb.append(","+"缺失骨密度检查报告"); + } + } } } // 检验申请单 if (!inspectionReportType.equals("")) { - String[] inspectionReportTypeArray = inspectionReportType.split(","); - List types = Arrays.asList(inspectionReportTypeArray); - String checkLisNotExits = archiveDetailService.getInspectionReportNotExits1(types, masterId); - if (checkLisNotExits != null ) { + inspectionReportTypeArray = inspectionReportType.split(","); + types = Arrays.asList(inspectionReportTypeArray); + checkLisNotExits = this.archiveDetailService.getInspectionReportNotExits1(types, masterId); + if (checkLisNotExits != null) { if (sb.length() != 0) { sb.append(";"); } + sb.append(checkLisNotExits); } } - //最后 if (sb.length() == 0) { sb.append("完整"); }else{ sb.append("。如开的医嘱有对应的单子,可备注给主任。"); } + }catch (Exception e){ sb.setLength(0); sb.append("服务器正忙"); + ExceptionPrintUtil.printException(e); logger.error("出错了:",e.getMessage()); } return sb + ""; diff --git a/src/main/java/com/ann/demo/repository/ArchiveDetailRepository.java b/src/main/java/com/ann/demo/repository/ArchiveDetailRepository.java index 9b6b545..f42e9bc 100644 --- a/src/main/java/com/ann/demo/repository/ArchiveDetailRepository.java +++ b/src/main/java/com/ann/demo/repository/ArchiveDetailRepository.java @@ -27,6 +27,13 @@ public interface ArchiveDetailRepository extends JpaRepository type, String masterId); + + + @Query(value = "select Title from archive_detail where MasterID = ?1 and flag !=0", nativeQuery = true) + String getTypeToVoid(String masterId); + + + @Query(value = " SELECT stuff( " + " ( select ',' +name+'缺失' + cast(COUNT(report_type) as varchar)+'份' from exam_apply e " + " where not exists (select 1 from archive_detail a where source <> '后台' and a.apply_id = e.apply_id and a.assortid in ?1 and a.masterId = ?2 ) " + @@ -99,7 +106,7 @@ public interface ArchiveDetailRepository extends JpaRepository> getAllInspectionApply(List type, String masterId); @@ -118,5 +125,9 @@ public interface ArchiveDetailRepository extends JpaRepository type, String masterId); + public String getTypeToVoid(String masterId); + public String getCheckReportNotExits(List type,String masterId); // public String getInspectionReportNotExits(List type,String masterId); @@ -27,4 +29,6 @@ public interface ArchiveDetailService { Integer countDetail(String masterId, String s); Integer countFirstNursingRecord(String masterId, String s); + + int getDicomNum(String masterId); } diff --git a/src/main/java/com/ann/demo/service/impl/ArchiveDetailServiceImpl.java b/src/main/java/com/ann/demo/service/impl/ArchiveDetailServiceImpl.java index 477129c..c5d8a88 100644 --- a/src/main/java/com/ann/demo/service/impl/ArchiveDetailServiceImpl.java +++ b/src/main/java/com/ann/demo/service/impl/ArchiveDetailServiceImpl.java @@ -29,79 +29,67 @@ public class ArchiveDetailServiceImpl implements ArchiveDetailService { } @Override - public String getCheckReportNotExits(List type,String masterId) { - return archiveDetailRepository.getCheckReportNotExits( type,masterId); + public String getTypeToVoid(String masterId) { + return archiveDetailRepository.getTypeToVoid(masterId); } @Override - public String getInspectionReportNotExits1(List type,String masterId) { + public String getCheckReportNotExits(List type, String masterId) { + return archiveDetailRepository.getCheckReportNotExits(type, masterId); + } + + @Override + public String getInspectionReportNotExits1(List type, String masterId) { String result = null; // 1、查出所有的检验申请单 List> examAllTempList = archiveDetailRepository.getAllInspectionApply(type, masterId); - if (examAllTempList == null || examAllTempList.isEmpty()){ + if (examAllTempList == null || examAllTempList.isEmpty()) { return null; } //转成对应的集合 List examAllList = new ArrayList(); - for (Map map: examAllTempList){ - ExamApplyDto examApplyDto = MapObjUtil.map2Object(map,ExamApplyDto.class); + for (Map map : examAllTempList) { + ExamApplyDto examApplyDto = MapObjUtil.map2Object(map, ExamApplyDto.class); examAllList.add(examApplyDto); } // 2、查出所有的detail List applyIdTempList = archiveDetailRepository.getInspectionApply(type, masterId); // 3、进行匹配 List resultList = new ArrayList(examAllList); - for (ExamApplyDto examApplyDto:examAllList) { - for (String applyId: applyIdTempList){ - Pattern pattern = Pattern.compile(examApplyDto.getApplyId()); - Matcher matcher = pattern.matcher(applyId); - if(matcher.find()){ - resultList.remove(examApplyDto); + for (ExamApplyDto examApplyDto : examAllList) { + for (String applyId : applyIdTempList) { + if (!applyId.isEmpty()) { + Pattern pattern = Pattern.compile(examApplyDto.getApplyId()); + Matcher matcher = pattern.matcher(applyId); + if (matcher.find()) { + resultList.remove(examApplyDto); + } } } } - StringBuffer sb=new StringBuffer(); - for (ExamApplyDto examApplyDto: - resultList) { + StringBuffer sb = new StringBuffer(); + for (ExamApplyDto examApplyDto : + resultList) { String authorReportTime = examApplyDto.getAuthorReportTime(); - if(authorReportTime != null && authorReportTime.lastIndexOf(".") != -1){ - authorReportTime = authorReportTime.substring(0,authorReportTime.lastIndexOf(".")); + if (authorReportTime != null && authorReportTime.lastIndexOf(".") != -1) { + authorReportTime = authorReportTime.substring(0, authorReportTime.lastIndexOf(".")); } - sb.append("缺失"+examApplyDto.getName() +"("+authorReportTime+"),"); + sb.append("缺失" + examApplyDto.getName() + "(" + authorReportTime + "),"); } -// // 4、统计集合里元素相同的名称及数量 -// Map map = new HashMap(); -// for(ExamApplyDto examApplyDto: -// resultList){ -// String name = examApplyDto.getName() ==null ? (Objects.equals(examApplyDto.getReportType(),"10") ? "检验报告" : "检查报告"):examApplyDto.getName(); -// if(map.containsKey(name)){ -// map.put(name, map.get(name).intValue() + 1); -// }else{ -// map.put(name, new Integer(1)); -// } -// } - // 5、开始拼装 -// Iterator keys = map.keySet().iterator(); - -// while(keys.hasNext()){ -// String key = keys.next(); -// int i = map.get(key).intValue(); -// sb.append(key + "缺失" + map.get(key).intValue() + "份,"); -// } - if(sb.length() > 0){ - result = sb.substring(0,sb.length()-1); + if (sb.length() > 0) { + result = sb.substring(0, sb.length() - 1); } return result; } @Override - public String getBeHospitalized(String masterid,String assortId) { - return archiveDetailRepository.getResultByMasterIDAndAssortIDAndFlag(masterid,assortId,"0"); + public String getBeHospitalized(String masterid, String assortId) { + return archiveDetailRepository.getResultByMasterIDAndAssortIDAndFlag(masterid, assortId, "0"); } @Override public Integer countDetail(String masterId, String s) { - return archiveDetailRepository.countDetail(masterId,s,"0"); + return archiveDetailRepository.countDetail(masterId, s, "0"); } // @Override @@ -111,17 +99,19 @@ public class ArchiveDetailServiceImpl implements ArchiveDetailService { @Override public String getCheckReportNotExits1(List types, String masterId) { - return archiveDetailRepository.getCheckReportNotExits1( types,masterId); + return archiveDetailRepository.getCheckReportNotExits1(types, masterId); } @Override public Integer countFirstNursingRecord(String masterId, String s) { - return archiveDetailRepository.countFirstNursingRecord(masterId,s,"0"); + return archiveDetailRepository.countFirstNursingRecord(masterId, s, "0"); } -} - - + @Override + public int getDicomNum(String masterId) { + return archiveDetailRepository.getDicomNum(masterId); + } +} // List> examAndDetailTempList = archiveDetailRepository.getInspectionApply(type, masterId); diff --git a/src/main/java/com/ann/demo/util/ExceptionPrintUtil.java b/src/main/java/com/ann/demo/util/ExceptionPrintUtil.java new file mode 100644 index 0000000..6ef7cae --- /dev/null +++ b/src/main/java/com/ann/demo/util/ExceptionPrintUtil.java @@ -0,0 +1,40 @@ +package com.ann.demo.util; + + + + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; + +/** + * @ProjectName: + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2020/8/4 14:18 + * @UpdateUser: 曾文和 + * @UpdateDate: 2020/8/4 14:18 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ +public class ExceptionPrintUtil { + private static Logger log = LogManager.getLogger(ExceptionPrintUtil.class); + public static void printException(Exception e){ + //方法名 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + log.error(exception); + try { + baos.flush(); + baos.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..f9f8e2c --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,2 @@ +#server.port= 8091 +#server.address=localhost diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fcf06b3..b6f45bf 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -39,8 +39,7 @@ spring: #完整性核查 必查项,填类型id #9月 增加大类的校验 -#mustCheckData: 3,9,20,122,123,5,7,2 -mustCheckData: 3,9,20,122,123,5,2 +mustCheckData: 3,9,20,122,123,5,7,2 #2020-9-23 1、新增60、110 核医学以及其他报告 2、将检查检验校验合并(因超声会有合并报告) inspectionReportType: 54,59,52,57,60,110,10 checkReportType: 54,59,52,57