Pārlūkot izejas kodu

结构化数据格式调整

chengyao 4 gadi atpakaļ
vecāks
revīzija
b3435a5214

+ 121 - 113
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -287,7 +287,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         // 获取病历所有数据
         Map<String, Map<String, String>> dicMap = sysDictionaryFacade.getDictionaryWithKey(); // 获取字典信息
         // 获取文书信息
-    /*    RecordContentVO recordContentVO = new RecordContentVO();
+        RecordContentVO recordContentVO = new RecordContentVO();
         BeanUtil.copyProperties(analyzeVO, recordContentVO);
         List<RecordContentDTO> recordContentDTOList = medicalRecordFacade.getRecordContentFac(recordContentVO);
         String recTitle = "";
@@ -306,7 +306,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         }
 
         Map<String, List<RecordContentDTO>> recMap = EntityUtil.makeEntityListMap(recordContentDTOList, "standModelName");
-*/
 //        -------------------------------------文书数据改造开始----------------------------------
         // 获取会诊申请单
         List<MedConsultationApply> medConsultationApplyList = medConsultationApplyFacade.list(new QueryWrapper<MedConsultationApply>()
@@ -334,7 +333,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 .select("whole_data")
                 .orderByAsc("behospital_date")
         );
-
         // 入院记录
         List<MedAdmissionNote> medAdmissionNoteList = medAdmissionNoteFacade.list(new QueryWrapper<MedAdmissionNote>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -579,8 +577,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
 
 
         // 化验
-        // List<MedLisResult> medLisResultList = getMedLisResultList(behospitalInfoList.get(0));
-        //使用sql进行关联优化数据查询
+       //使用sql进行关联优化数据查询
         List<MedLisResultDTO> medLisResultListDTO = medLisResultFacade.getMedLisResultList(behospitalInfoList.get(0));
         List<MedLisResult> medLisResultList = new ArrayList<>();
         for (MedLisResultDTO medLisResultSingle : medLisResultListDTO) {
@@ -591,37 +588,50 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         }
 
         // 辅检
-        // List<MedPacsResult> medPacsResultList = getMedPacsResultList(behospitalInfoList.get(0));
-        //使用sql进行关联优化数据查询
+      //使用sql进行关联优化数据查询
         List<MedPacsResult> medPacsResultList = medPacsResultFacade.getMedPacsResultList(behospitalInfoList.get(0));
 
 
         /**
-         * 文书数据拼接
+         * 结构化/文书数据兼容处理
          */
+
+        // 会诊记录
+        addDataWithKey("会诊记录", recMap, medrecVoList,
+                Arrays.asList("会诊记录"));
+
         //会诊申请单
         if (ListUtil.isNotEmpty(medConsultationApplyList)) {
-            newAddData("会诊申请单", medConsultationApplyList, medrecVoList);
+            newAddData("会诊申请单", medConsultationApplyList, recMap,medrecVoList);
+        }else{
+            addDataWithKey("会诊申请单", recMap, medrecVoList,
+                    Arrays.asList("会诊申请单"));
         }
-
+/*
         //会诊结果单
         if (ListUtil.isNotEmpty(medConsultationResultList)) {
             newAddData("会诊结果单", medConsultationResultList, medrecVoList);
+        }else{
+            addDataWithKey("会诊结果单", recMap, medrecVoList,
+                    Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
         }
 
         //会诊单(申请和结果)
         if (ListUtil.isNotEmpty(medConsultationNoteList)) {
             newAddData("会诊单(申请和结果)", medConsultationNoteList, medrecVoList);
         }
-
         //入院记录
         if (ListUtil.isNotEmpty(medAdmissionNoteList)) {
             newAddData("入院记录", medAdmissionNoteList, medrecVoList);
+        }else{
+            addData("入院记录", recMap, medrecVoList);
         }
 
         //输血效果评价
         if (ListUtil.isNotEmpty(medBloodResultList)) {
             newAddData("输血效果评价", medBloodResultList, medrecVoList);
+        }else{
+            addData("输血后效果评价", recMap, medrecVoList);
         }
 
         //输血记录
@@ -632,31 +642,43 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         //危急值记录
         if (ListUtil.isNotEmpty(medCrisisNoteList)) {
             newAddData("危急值记录", medCrisisNoteList, medrecVoList);
+        }else{
+            addData("危急值记录", recMap, medrecVoList);
         }
 
         //死亡病例讨论记录
         if (ListUtil.isNotEmpty(medDeathDiscussionList)) {
             newAddData("死亡病例讨论记录", medDeathDiscussionList, medrecVoList);
+        }else{
+            addData("死亡病例讨论记录", recMap, medrecVoList);
         }
 
         //死亡记录
         if (ListUtil.isNotEmpty(medDeathNoteList)) {
             newAddData("死亡记录", medDeathNoteList, medrecVoList);
+        }else{
+            addData("死亡记录", recMap, medrecVoList);
         }
 
         //疑难病例讨论记录
         if (ListUtil.isNotEmpty(medDifficultCaseList)) {
             newAddData("疑难病例讨论记录", medDifficultCaseList, medrecVoList);
+        }else{
+            addData("疑难病例讨论记录", recMap, medrecVoList);
         }
 
         //首次病程录
         if (ListUtil.isNotEmpty(medFirstRecordList)) {
             newAddData("首次病程录", medFirstRecordList, medrecVoList);
+        }else{
+            addData("首次病程录", recMap, medrecVoList);
         }
 
         //病危通知单
         if (ListUtil.isNotEmpty(medIllCriticallyList)) {
             newAddData("病危通知单", medIllCriticallyList, medrecVoList);
+        }else{
+            addData("病危通知书", recMap, medrecVoList);
         }
 
         //病重通知单
@@ -667,6 +689,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         //出院小结
         if (ListUtil.isNotEmpty(medLeaveHospitalList)) {
             newAddData("出院小结", medLeaveHospitalList, medrecVoList);
+        }else{
+            addData("出院小结", recMap, medrecVoList);
         }
 
         //术后首程
@@ -682,6 +706,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         //阶段小结
         if (ListUtil.isNotEmpty(medPeriodConclusionList)) {
             newAddData("阶段小结", medPeriodConclusionList, medrecVoList);
+        }else{
+            addData("阶段小结", recMap, medrecVoList);
         }
 
         //术前讨论小结
@@ -692,22 +718,70 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         //抢救记录
         if (ListUtil.isNotEmpty(medRescueNoteList)) {
             newAddData("抢救记录", medRescueNoteList, medrecVoList);
+        }else{
+            addData("抢救记录", recMap, medrecVoList);
         }
 
         //转入记录
         if (ListUtil.isNotEmpty(medTransferInNoteList)) {
             newAddData("转入记录", medTransferInNoteList, medrecVoList);
+        }else{
+            addDataWithKey("转入记录", recMap, medrecVoList,
+                    Arrays.asList("转入记录"));
         }
 
         //转出记录
         if (ListUtil.isNotEmpty(medTransferOutNoteList)) {
             newAddData("转出记录", medTransferOutNoteList, medrecVoList);
+        }else{
+            addDataWithKey("转出记录", recMap, medrecVoList,
+                    Arrays.asList("转出记录"));
         }
 
         //查房记录
         if (ListUtil.isNotEmpty(medWardRecordList)) {
             newAddData("查房记录", medWardRecordList, medrecVoList);
-        }
+        }else{
+            addData("查房记录", recMap, medrecVoList);
+        }*/
+
+            //==============非结构化表拥有,文书单独查出来====================
+
+//        // 会诊记录
+//        addDataWithKey("会诊", recMap, medrecVoList,
+//                Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
+
+
+        // 手术
+        addDataWithKey("手术", recMap, medrecVoList,
+                Arrays.asList("术后首次病程及谈话记录", "手术记录",
+                        "术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
+
+        // 转科
+//        addDataWithKey("转科", recMap, medrecVoList,
+//                Arrays.asList("转入记录", "转出记录"));
+
+//        addData("入院记录", recMap, medrecVoList);
+//        addData("病危通知书", recMap, medrecVoList);
+//        addData("阶段小结", recMap, medrecVoList);
+//        addData("抢救记录", recMap, medrecVoList);
+//        addData("查房记录", recMap, medrecVoList);
+//        addData("首次病程录", recMap, medrecVoList);
+        addData("输血/血制品病程记录", recMap, medrecVoList);
+//        addData("输血后效果评价", recMap, medrecVoList);
+//        addData("死亡病例讨论记录", recMap, medrecVoList);
+//        addData("死亡记录", recMap, medrecVoList);
+//        addData("危急值记录", recMap, medrecVoList);
+//        addData("出院小结", recMap, medrecVoList);
+//        addData("疑难病例讨论记录", recMap, medrecVoList);
+//        addData("输血后效果评价", recMap, medrecVoList);
+        addData("病理检验送检单", recMap, medrecVoList);
+        addData("日常病程录", recMap, medrecVoList);//结构化表名为首次病程录
+
+        addDataWithInnerKey("知情同意书", recMap, medrecVoList);
+        addDataWithInnerKey("谈话告知书", recMap, medrecVoList);
+
+        //==============文书====================
 
         // 医嘱
         if (ListUtil.isNotEmpty(doctorAdviceList)) {
@@ -743,101 +817,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         return queryVo;
     }
 
-   /* private List<MedLisResult> getMedLisResultList(BehospitalInfo behospitalInfo) {
-        String behospitalDate = null, leaveHospitalDate = null;
-        try {
-            behospitalDate = DateUtil.format(behospitalInfo.getBehospitalDate(), DateUtil.DATE_TIME_FORMAT);
-            leaveHospitalDate = DateUtil.format(behospitalInfo.getLeaveHospitalDate(), DateUtil.DATE_TIME_FORMAT);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-        }
-        if (StringUtil.isBlank(behospitalDate)) {
-            return null;
-        }
-        List<MedLisResult> medLisResultList = null;
-        QueryWrapper<MedLisInfo> medLisInfoQe = new QueryWrapper<>();
-        medLisInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
-        medLisInfoQe.eq("hospital_id", behospitalInfo.getHospitalId());
-        medLisInfoQe.like("behospital_code", behospitalInfo.getFileCode());
-        medLisInfoQe.isNotNull("rep_name");
-        medLisInfoQe.isNotNull("check_date");
-        medLisInfoQe.apply("check_date!=''");
-        medLisInfoQe.apply(
-                "date_format (check_date,'%Y-%m-%d %H:%i:%s') >= date_format('"
-                        + behospitalDate
-                        + "','%Y-%m-%d %H:%i:%s')"
-        );
-        if (StringUtil.isNotBlank(behospitalInfo.getIsPlacefile())
-                && behospitalInfo.getIsPlacefile().equals("1")
-                && StringUtil.isNotBlank(leaveHospitalDate)) {
-            medLisInfoQe.apply(
-                    "date_format (check_date,'%Y-%m-%d %H:%i:%s') <= date_format('"
-                            + leaveHospitalDate
-                            + "','%Y-%m-%d %H:%i:%s')"
-            );
-        }
-        medLisInfoQe.select("rep_no", "rep_name");
-        List<MedLisInfo> medLisInfoList = medLisInfoFacade.list(medLisInfoQe);
-        if (ListUtil.isNotEmpty(medLisInfoList)) {
-            Map<String, String> repNoRepNameMap = medLisInfoList.stream().collect(Collectors.toMap(i -> i.getRepNo(), i -> i.getRepName()));
-            medLisResultList = medLisResultFacade.list(new QueryWrapper<MedLisResult>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", behospitalInfo.getHospitalId())
-                    .like("behospital_code", behospitalInfo.getFileCode())
-                    .isNotNull("item_name")
-                    .in("rep_no", medLisInfoList.stream().map(i -> i.getRepNo()).collect(Collectors.toList()))
-            );
-            medLisResultList.forEach(medLisResult -> {
-                medLisResult.setItemName(repNoRepNameMap.get(medLisResult.getRepNo()) + "=" + medLisResult.getItemName());
-            });
-        }
-        return medLisResultList;
-    }*/
-
-   /* private List<MedPacsResult> getMedPacsResultList(BehospitalInfo behospitalInfo) {
-        String behospitalDate = null, leaveHospitalDate = null;
-        try {
-            behospitalDate = DateUtil.format(behospitalInfo.getBehospitalDate(), DateUtil.DATE_TIME_FORMAT);
-            leaveHospitalDate = DateUtil.format(behospitalInfo.getLeaveHospitalDate(), DateUtil.DATE_TIME_FORMAT);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-        }
-        if (StringUtil.isBlank(behospitalDate)) {
-            return null;
-        }
-        List<MedPacsResult> medPacsResultList = null;
-        QueryWrapper<MedPacsInfo> medPacsInfoQe = new QueryWrapper<>();
-        medPacsInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
-        medPacsInfoQe.eq("hospital_id", behospitalInfo.getHospitalId());
-        medPacsInfoQe.like("behospital_code", behospitalInfo.getFileCode());
-        medPacsInfoQe.isNotNull("check_date");
-        medPacsInfoQe.apply("check_date!=''");
-        medPacsInfoQe.apply(
-                "date_format (check_date,'%Y-%m-%d %H:%i:%s') >= date_format('"
-                        + behospitalDate
-                        + "','%Y-%m-%d %H:%i:%s')"
-        );
-        if (StringUtil.isNotBlank(behospitalInfo.getIsPlacefile())
-                && behospitalInfo.getIsPlacefile().equals("1")
-                && StringUtil.isNotBlank(leaveHospitalDate)) {
-            medPacsInfoQe.apply(
-                    "date_format (check_date,'%Y-%m-%d %H:%i:%s') <= date_format('"
-                            + leaveHospitalDate
-                            + "','%Y-%m-%d %H:%i:%s')"
-            );
-        }
-        List<MedPacsInfo> medPacsInfoList = medPacsInfoFacade.list(medPacsInfoQe);
-        if (ListUtil.isNotEmpty(medPacsInfoList)) {
-            medPacsResultList = medPacsResultFacade.list(new QueryWrapper<MedPacsResult>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", behospitalInfo.getHospitalId())
-                    .like("behospital_code", behospitalInfo.getFileCode())
-                    .in("rep_no", medPacsInfoList.stream().map(i -> i.getRepNo()).collect(Collectors.toList()))
-            );
-        }
-        return medPacsResultList;
-    }*/
-
     /**
      * 评分-终末质控
      *
@@ -907,7 +886,12 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         Map<String, List<String>> listMap = new HashMap<>();
         if (ListUtil.isNotEmpty(list)) {
             MedrecVo medrecVo = new MedrecVo();
-            medrecVo.setTitle(key);
+            if("输血后效果评价".equals(key)){
+                medrecVo.setTitle("输血效果评价");
+            }else{
+                medrecVo.setTitle(key);
+            }
+
             Map<String, Object> content = new HashMap<>();
             content.put("content", list);
             medrecVo.setContent(content);
@@ -936,11 +920,21 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             }
         }
         if (flag) {
+            if(ListUtil.isNotEmpty(keyList)&&keyList.size()==3){
             // 会诊记录特殊处理,有会诊申请单,没有会诊结果单,复制一份到会诊结果单
             if ("会诊记录".equals(key) && listMap.get("会诊申请单") != null
                     && listMap.get("会诊结果单") == null) {
                 listMap.put("会诊结果单", listMap.get("会诊申请单"));
             }
+            //只封装会诊结果单数据
+
+               for (String k : keyList) {
+                   if (!"会诊结果单".equals(k)&&ListUtil.isNotEmpty(recMap.get(k))) {
+                       listMap.remove(k);
+                   }
+               }
+           }
+            listMap.put("isParsed",0);
             content.put("content", listMap);
             medrecVo.setContent(content);
             medrecVoList.add(medrecVo);
@@ -983,12 +977,21 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param list
      * @param medrecVoList
      */
-public <T> void newAddData(String key, List<T> list, List<MedrecVo> medrecVoList) {
+public <T> void newAddData(String key, List<T> list, Map<String, List<RecordContentDTO>> recMap, List<MedrecVo> medrecVoList) {
     MedrecVo medrecVo = new MedrecVo();
     medrecVo.setTitle(key);
     Map<String, Object> content = new HashMap<>();
-    //装入jason数据
+    Map<String, Object> listMap = new HashMap<>();
     List<String> contents = new ArrayList<>();
+    Boolean flag = false;
+    String k = key;
+    if("输血效果评价".equals(key)){
+        k="输血后效果评价";
+    }
+        if (ListUtil.isNotEmpty(recMap.get(k))) {
+            listMap.put(key, recMap.get(k));
+            flag = true;
+        }
     for (T bean : list) {
         try {
             Map<String, Object> objectMap = MapUtil.objectToMap(bean);
@@ -998,13 +1001,18 @@ public <T> void newAddData(String key, List<T> list, List<MedrecVo> medrecVoList
             e.printStackTrace();
         }
     }
-    content.put("content", contents);
-    medrecVo.setContent(content);
-    medrecVoList.add(medrecVo);
 
+    if (flag) {
+
+        listMap.put("isParsed",1);
+        content.put("content", listMap);
+        medrecVo.setContent(content);
+        medrecVoList.add(medrecVo);
+    }
 }
 
 
+
     /**
      * 拼接数据,从数据字典获取信息转换
      *

+ 1 - 1
src/main/resources/application-local.yml

@@ -59,7 +59,7 @@ spring:
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       platform: mysql
-      url: jdbc:mysql://127.0.0.1:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+      url: jdbc:mysql://192.168.2.236:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
       username: root
       password: lantone
       # 连接池的配置信息