Przeglądaj źródła

Merge remote-tracking branch 'origin/debug' into debug

rengb 5 lat temu
rodzic
commit
33efe52fc7
23 zmienionych plików z 457 dodań i 54 usunięć
  1. 5 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0409.java
  2. 32 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0280.java
  3. 5 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0340.java
  4. 30 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0707.java
  5. 4 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0166.java
  6. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java
  7. 15 21
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0370.java
  8. 7 5
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0330.java
  9. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java
  10. 40 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0698.java
  11. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0700.java
  12. 77 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0701.java
  13. 78 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0702.java
  14. 44 14
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java
  15. 15 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/FirstCourseRecordAI.java
  16. 3 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/LeaveHospitalAI.java
  17. 3 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/OperationAI.java
  18. 3 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  19. 2 1
      trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouBeHospitalizedDocTrans.java
  20. 4 4
      trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouDeathCaseDiscussDocTrans.java
  21. 4 4
      trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouDeathRecordDocTrans.java
  22. 6 1
      trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouFirstPageRecordDocTrans.java
  23. 1 1
      trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouOperationDocTrans.java

+ 5 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0409.java

@@ -27,8 +27,12 @@ public class BEH0409 extends QCCatalogue {
             String name = structureMap.get("关系");
             String historyPresenter = structureMap.get("病史陈述者");
             String historyreporter = structureMap.get("病史提供人");
+            String infoSources = structureMap.get("信息来源");
 
-            if(CatalogueUtil.isEmpty(name) && CatalogueUtil.isEmpty(historyPresenter) && CatalogueUtil.isEmpty(historyreporter)){
+            if(CatalogueUtil.isEmpty(name)
+                    && CatalogueUtil.isEmpty(historyPresenter)
+                    && CatalogueUtil.isEmpty(historyreporter)
+                    && CatalogueUtil.isEmpty(infoSources)){
                 status.set("-1");
             }
         }

+ 32 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0280.java

@@ -1,10 +1,16 @@
 package com.lantone.qc.kernel.catalogue.consultation;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.consultation.ConsultationDoc;
+import com.lantone.qc.pub.model.doc.consultation.ConsultationResultsDoc;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -16,6 +22,31 @@ import java.util.Map;
 @Component
 public class CON0280 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if (inputInfo.getConsultationDocs() == null || inputInfo.getConsultationDocs().size() == 0) status.set("0");
+        status.set("0");
+        if (inputInfo.getConsultationDocs() == null) {
+            return;
+        }
+        List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
+        for (ConsultationDoc consultationDoc : consultationDocs) {
+            ConsultationResultsDoc consultationResultsDoc = consultationDoc.getConsultationResultsDoc();
+            if (consultationResultsDoc == null) {
+                continue;
+            }
+            Map<String, String> structureMap = consultationResultsDoc.getStructureMap();
+            String applicationDateStr = structureMap.get("会诊申请日期");
+            String arrivalDateStr = structureMap.get("会诊到达时间");
+            if (StringUtil.isBlank(applicationDateStr) || StringUtil.isBlank(arrivalDateStr)) {
+                continue;
+            }
+            Date applicationDate = StringUtil.parseDateTime(applicationDateStr);
+            Date arrivalDate = StringUtil.parseDateTime(arrivalDateStr);
+            if (applicationDate == null || arrivalDate == null) {
+                continue;
+            }
+            if (CatalogueUtil.compareTime(applicationDate, arrivalDate, (long) (24 * 60))) {
+                status.set("-1");
+                return;
+            }
+        }
     }
 }

+ 5 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0340.java

@@ -4,6 +4,7 @@ import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -20,6 +21,10 @@ public class DEAR0340 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
             Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if(StringUtils.isBlank(deathRecordStructureMap.get("主诉"))){
+                status.set("-1");
+                return;
+            }
             if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("入院情况"))) {
                 status.set("-1");
             }

+ 30 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0707.java

@@ -0,0 +1,30 @@
+package com.lantone.qc.kernel.catalogue.firstcourserecord;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+/**
+ * @ClassName : FIRC0707
+ * @Description : 鉴别诊断书写不规范
+ * 首次病程录里的鉴别诊断病情分析,最后一句要分析鉴别诊断的原因,要多加一个规则“可能不考虑该诊断”
+ * @Author : kwz
+ * @Date: 2020-04-20 17:28
+ */
+@Component
+public class FIRC0707 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        if (firstCourseRecordDoc == null || firstCourseRecordDoc.getTreatPlanLabel() == null) {
+            return;
+        }
+        String differentTxt = firstCourseRecordDoc.getDifferentialDiagLabel().getText();
+        if(!differentTxt.endsWith("可能不考虑该诊断")){
+            status.set("-1");
+        }
+    }
+}

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0166.java

@@ -5,6 +5,7 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -25,6 +26,9 @@ public class FIRP0166 extends QCCatalogue {
             Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
             String firstAdmissionMarry = firstpageStructureMap.get(Content.marry);
             String admissionMarry = beHospitalStructureMap.get(Content.marry);
+            if (StringUtil.isBlank(firstAdmissionMarry) || StringUtil.isBlank(admissionMarry)) {
+                return;
+            }
             if (!CatalogueUtil.compareToken(firstAdmissionMarry, admissionMarry)) {
                 status.set("-1");
             }

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java

@@ -42,7 +42,7 @@ public class LEA0149 extends QCCatalogue {
 
                     //如果出院小结结构化数据能取出主诉,则直接用该主诉和入院记录主诉比较
                     if (StringUtil.isNotBlank(leaveChief)) {
-                        leaveChief = leaveChief.replaceAll("。", "");
+                        leaveChief = leaveChief.replaceAll("[\\p{Punct}\\pP]", "");
                         if (bhChief.equals(leaveChief)) {
                             status.set("0");
                             return;

+ 15 - 21
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0370.java

@@ -1,17 +1,13 @@
 package com.lantone.qc.kernel.catalogue.operationdiscussion;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
-import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
-import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.text.ParseException;
 import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 手术患者缺术前讨论或术前小结
@@ -31,26 +27,24 @@ public class OPE0370 extends QCCatalogue {
         //        boolean isOperativePatient = CatalogueUtil.isOperativePatients(doctorAdviceDocs);
         boolean isOperativePatient = true;//是手术患者(暂时默认是)
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
-        if(operationDocs == null || operationDocs.size() < 1){
+        if (operationDocs == null || operationDocs.size() < 1) {
             return;
         }
-        if ( operationDocs.size()>0) {
-
-            for (OperationDoc operationDoc : operationDocs) {
-                OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
-                if (operationRecordDoc == null) {
-                    continue;
-                }
-                Map<String, String> operationRecordStructureMap = operationRecordDoc.getStructureMap();
-                String preoperativeDiscussion = operationRecordStructureMap.get("术前讨论");
-                if (CatalogueUtil.isEmpty(preoperativeDiscussion)) {
-                    status.set("-1");
-                    return;
-                }
+        for (OperationDoc operationDoc : operationDocs) {
+            if (operationDoc.getPreoperativeDiscussionDoc() == null) {
+                status.set("-1");
+                return;
             }
-
-
         }
+        //            OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
+        //            if (operationRecordDoc == null) {
+        //                continue;
+        //            }
+        //            Map<String, String> operationRecordStructureMap = operationRecordDoc.getStructureMap();
+        //            String preoperativeDiscussion = operationRecordStructureMap.get("术前讨论");
+        //            if (CatalogueUtil.isEmpty(preoperativeDiscussion)) {
+        //                status.set("-1");
+        //                return;
+        //            }
     }
-
 }

+ 7 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0330.java

@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
 
 import java.text.ParseException;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 术前讨论记录无拟行术式
@@ -22,15 +23,16 @@ public class PRE0330 extends QCCatalogue {
     protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
         status.set("0");
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
-        if(operationDocs == null || operationDocs.size()== 0){
+        if (operationDocs == null || operationDocs.size() == 0) {
             return;
         }
         for (OperationDoc operationDoc : operationDocs) {
-            if (operationDoc.getPreoperativeDiscussionDoc() != null
-                    && StringUtil.isEmpty(operationDoc.getPreoperativeDiscussionDoc().getStructureMap().get("拟行术式"))) {
-                status.set("-1");
+            if (operationDoc.getPreoperativeDiscussionDoc() != null) {
+                Map<String, String> structureMap = operationDoc.getPreoperativeDiscussionDoc().getStructureMap();
+                if (StringUtil.isEmpty(structureMap.get("拟行术式")) && StringUtil.isEmpty(structureMap.get("可能的变更"))) {
+                    status.set("-1");
+                }
             }
         }
     }
-
 }

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java

@@ -2,12 +2,16 @@ package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.kernel.util.KernelConstants;
+import com.lantone.qc.kernel.util.RedisUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -23,6 +27,9 @@ import java.util.Map;
  */
 @Component
 public class THR0128 extends QCCatalogue {
+    @Autowired
+    private RedisUtil redisUtil;
+
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getLeaveHospitalDoc() != null
@@ -71,6 +78,19 @@ public class THR0128 extends QCCatalogue {
                 status.set("0");
                 return;
             }
+            boolean firstRecordAttendExist = findfirstRecordAttend(inputInfo);
+            for (int j = 0; j < roundRecordEveryWeek.size(); j++) {
+                int indicationsNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), Content.attend);
+                if (j == 0 && firstRecordAttendExist) { //如果首程中医师签名为主治医师,第一周查房记录也要加上
+                    indicationsNum += 1;
+                }
+                if (indicationsNum < 3) {
+                    //每周无3次主治医师查房记录
+                    status.set("-1");
+                    info.set(lastWardDateRange);
+                    return;
+                }
+            }
             for (String roundRecord : roundRecordEveryWeek) {
                 int indicationsNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.attend);
                 if (indicationsNum < 3) {
@@ -129,4 +149,23 @@ public class THR0128 extends QCCatalogue {
         }
         return "";
     }
+
+    private boolean findfirstRecordAttend(InputInfo inputInfo) {
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        if (firstCourseRecordDoc == null) {
+            return false;
+        }
+        Map<String, Map<String, Object>> hospitalDoctorMap = redisUtil.getJsonStringValue(KernelConstants.HOSPITAL_DOCTOR_MAP);
+        String doctorSign = firstCourseRecordDoc.getStructureMap().get("医师签名");
+        if (hospitalDoctorMap == null || StringUtil.isBlank(doctorSign)) {
+            return false;
+        }
+        if (hospitalDoctorMap.containsKey(doctorSign)) {
+            Object professor = hospitalDoctorMap.get(doctorSign).get("professor");
+            if (professor != null) {
+                return professor.toString().contains("主治");
+            }
+        }
+        return false;
+    }
 }

+ 40 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0698.java

@@ -0,0 +1,40 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName : THR0698
+ * @Description : 查房记录无记录时间
+ * @Author : 胡敬
+ * @Date: 2020-04-20 15:23
+ */
+@Component
+public class THR0698 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        if (threeLevelWardDocs.size() == 0) {
+            status.set("0");
+            return;
+        }
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+        List<ThreeLevelWardDoc> recordDoctorList = allDoctorWradDocs
+                .stream()
+                .filter(doc -> StringUtil.isBlank(doc.getStructureMap().get("记录时间")))
+                .collect(Collectors.toList());
+        if (recordDoctorList.size() == 0) {
+            status.set("0");
+        }
+
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0700.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : THR0700
+ * @Description : 最后一次查房记录缺“上级医师”
+ * @Author : 胡敬
+ * @Date: 2020-03-19 17:20
+ */
+@Component
+public class THR0700 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();
+            if (allDoctorWradDocs.size() > 0) {
+                ThreeLevelWardDoc lastWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
+                Map<String, String> structureMap = lastWardDoc.getStructureMap();
+                String conditionRecord = structureMap.get("病情记录");
+                if (StringUtil.isBlank(conditionRecord)){
+                    return;
+                }
+                if (conditionRecord.contains("上级医师")){
+                    status.set("0");
+                }
+            }
+        }
+    }
+}

+ 77 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0701.java

@@ -0,0 +1,77 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0701
+ * @Description : 首次主治医师查房中鉴别诊断跟首程一致
+ * @Author : 胡敬
+ * @Date: 2020-04-20 16:38
+ */
+@Component
+public class THR0701 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getThreeLevelWardDocs().size() == 0 || inputInfo.getFirstCourseRecordDoc() == null) {
+            status.set("0");
+        }
+        List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        String firstCourseDiffDiag = getDiffDiag(firstCourseRecordDoc);
+        if (StringUtil.isBlank(firstCourseDiffDiag)) {
+            return;
+        }
+        if (attendDocs.size() > 0) {
+            AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
+            ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
+            if (firstAttendLabel == null) {
+                return;
+            }
+            if (firstAttendLabel.getDiffDiag().size() != 0) {
+                for (Diag diffDiag : firstAttendLabel.getDiffDiag()) {
+                    String diffDiagName = diffDiag.getHospitalDiagName();
+                    if (StringUtil.isBlank(diffDiagName)) {
+                        continue;
+                    }
+                    if (firstCourseDiffDiag.equals(diffDiagName)) {
+                        status.set("0");
+                        return;
+                    }
+                }
+
+            }
+            if (StringUtil.isNotBlank(firstAttendLabel.getDiffDiagText())) {
+                if (firstAttendLabel.getDiffDiagText().equals(firstCourseDiffDiag)) {
+                    status.set("0");
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取首程鉴别诊断
+     *
+     * @param firstCourseRecordDoc
+     * @return
+     */
+    private String getDiffDiag(FirstCourseRecordDoc firstCourseRecordDoc) {
+        String diffDiag = "";
+        DiagLabel differentialDiagLabel = firstCourseRecordDoc.getDifferentialDiagLabel();
+        if (StringUtil.isNotBlank(firstCourseRecordDoc.getStructureMap().get("鉴别诊断"))) {
+            diffDiag = firstCourseRecordDoc.getStructureMap().get("鉴别诊断");
+        } else if (differentialDiagLabel != null && StringUtil.isNotBlank(differentialDiagLabel.getText())) {
+            diffDiag = differentialDiagLabel.getText();
+        }
+        return diffDiag;
+    }
+}

+ 78 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0702.java

@@ -0,0 +1,78 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0701
+ * @Description : 首次主任医师查房中鉴别诊断跟首程一致
+ * @Author : 胡敬
+ * @Date: 2020-04-20 16:38
+ */
+@Component
+public class THR0702 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getThreeLevelWardDocs().size() == 0 || inputInfo.getFirstCourseRecordDoc() == null) {
+            status.set("0");
+        }
+        List<DirectorDoctorWardDoc> directorDocs = inputInfo.getThreeLevelWardDocs().get(0).getDirectorDoctorWardDocs();
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        String firstCourseDiffDiag = getDiffDiag(firstCourseRecordDoc);
+        if (StringUtil.isBlank(firstCourseDiffDiag)) {
+            return;
+        }
+        if (directorDocs.size() > 0) {
+            DirectorDoctorWardDoc firstDirectorDoc = directorDocs.get(0);
+            ThreeLevelWardLabel firstAttendLabel = firstDirectorDoc.getThreeLevelWardLabel();
+            if (firstAttendLabel == null) {
+                return;
+            }
+            if (firstAttendLabel.getDiffDiag().size() != 0) {
+                for (Diag diffDiag : firstAttendLabel.getDiffDiag()) {
+                    String diffDiagName = diffDiag.getHospitalDiagName();
+                    if (StringUtil.isBlank(diffDiagName)) {
+                        continue;
+                    }
+                    if (firstCourseDiffDiag.equals(diffDiagName)) {
+                        status.set("0");
+                        return;
+                    }
+                }
+
+            }
+            if (StringUtil.isNotBlank(firstAttendLabel.getDiffDiagText())) {
+                if (firstAttendLabel.getDiffDiagText().equals(firstCourseDiffDiag)) {
+                    status.set("0");
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取首程鉴别诊断
+     *
+     * @param firstCourseRecordDoc
+     * @return
+     */
+    private String getDiffDiag(FirstCourseRecordDoc firstCourseRecordDoc) {
+        String diffDiag = "";
+        DiagLabel differentialDiagLabel = firstCourseRecordDoc.getDifferentialDiagLabel();
+        if (StringUtil.isNotBlank(firstCourseRecordDoc.getStructureMap().get("鉴别诊断"))) {
+            diffDiag = firstCourseRecordDoc.getStructureMap().get("鉴别诊断");
+        } else if (differentialDiagLabel != null && StringUtil.isNotBlank(differentialDiagLabel.getText())) {
+            diffDiag = differentialDiagLabel.getText();
+        }
+        return diffDiag;
+    }
+}

+ 44 - 14
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java

@@ -41,7 +41,7 @@ public class BeHospitalizedAI extends ModelAI {
      * Present_cx[现病史]
      */
     public static List<String> medicalTextType = Arrays.asList("FirstCourseRecord_cx", "PastFamily_cx", "PersonalHistory_cx", "HPIForCX_cx",
-            "GeneralVital_cx", "chief_present", "Diagnoses_cx","Present_cx");
+            "GeneralVital_cx", "chief_present", "Diagnoses_cx", "Present_cx");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
 
@@ -89,7 +89,7 @@ public class BeHospitalizedAI extends ModelAI {
             }
             //月经史
             String concatMenstrual = "";
-            if(personal_text != null){
+            if (personal_text != null) {
                 if (personal_text.length() > 30) {
                     concatMenstrual = personal_text.substring(personal_text.length() - 30);
                 } else {
@@ -169,6 +169,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //使用现病史结构
         EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
         PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
@@ -184,6 +187,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //放置入inputinfo
         EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
         PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
@@ -202,6 +208,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //家族史信息处理
         EntityProcessFamily entityProcess = new EntityProcessFamily();
         FamilyLabel familyLabel = entityProcess.extractEntity(aiOut);
@@ -220,6 +229,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //家族史信息处理
         EntityProcessMarital entityProcess = new EntityProcessMarital();
         MaritalLabel maritalLabel = entityProcess.extractEntity(aiOut);
@@ -232,6 +244,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //放置入inputinfo
         EntityProcessPast entityProcessPast = new EntityProcessPast();
         PastLabel pastLabel = entityProcessPast.extractEntity(aiOut);
@@ -251,6 +266,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //个人史信息提取
         EntityProcessPersonal entityProcessPersonal = new EntityProcessPersonal();
         PersonalLabel personalLabel = entityProcessPersonal.extractEntity(aiOut);
@@ -269,6 +287,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //月经史信息处理
         EntityProcessMenses entityProcess = new EntityProcessMenses();
         MenstrualLabel menstrualLabel = entityProcess.extractEntity(aiOut);
@@ -287,6 +308,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //诊断信息
         EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
         List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
@@ -296,18 +320,18 @@ public class BeHospitalizedAI extends ModelAI {
         initialDiagLabel.setDiags(diags);
         inputInfo.getBeHospitalizedDoc().setInitialDiagLabel(initialDiagLabel);
 
-//        //因为关系抽取未标注完成,先用规则
-//        String diagString = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText();
-//        if (StringUtils.isNotEmpty(diagString)) {
-//            String[] diagArray = diagString.split(",");
-//            List<Diag> diags = new ArrayList<>();
-//            for (String d : diagArray) {
-//                Diag diag = DiagEnhancer.create(d);
-//                diags.add(diag);
-//            }
-//            InitialDiagLabel initialDiagLabel = new InitialDiagLabel();
-//            initialDiagLabel.setDiags(diags);
-//        }
+        //        //因为关系抽取未标注完成,先用规则
+        //        String diagString = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText();
+        //        if (StringUtils.isNotEmpty(diagString)) {
+        //            String[] diagArray = diagString.split(",");
+        //            List<Diag> diags = new ArrayList<>();
+        //            for (String d : diagArray) {
+        //                Diag diag = DiagEnhancer.create(d);
+        //                diags.add(diag);
+        //            }
+        //            InitialDiagLabel initialDiagLabel = new InitialDiagLabel();
+        //            initialDiagLabel.setDiags(diags);
+        //        }
     }
 
     /**
@@ -352,6 +376,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //诊断信息
         EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
         List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
@@ -373,6 +400,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //放置入inputinfo
         PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
         pacsLabel.setPacses(loadPacses(aiOut));

+ 15 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/FirstCourseRecordAI.java

@@ -113,6 +113,9 @@ public class FirstCourseRecordAI extends ModelAI {
     public void putCaseCharacteristicCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
         //使用现病史结构来处理病历特点
+        if (aiOut == null) {
+            return;
+        }
         EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
         PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
         //临床表现
@@ -138,6 +141,9 @@ public class FirstCourseRecordAI extends ModelAI {
      */
     public void putInitialDiagCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         //诊断信息
         EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
         List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
@@ -152,6 +158,9 @@ public class FirstCourseRecordAI extends ModelAI {
      */
     public void putDiagnosisCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         //使用现病史结构来处理诊断依据
         EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
         PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
@@ -167,6 +176,9 @@ public class FirstCourseRecordAI extends ModelAI {
      */
     public void putDifferentialDiagCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         //诊断信息
         EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
         List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
@@ -181,6 +193,9 @@ public class FirstCourseRecordAI extends ModelAI {
      */
     public void putTreatPlanCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         //诊疗计划
         EntityProcessTreatPlan entityProcessTreatPlan = new EntityProcessTreatPlan();
         TreatPlanLabel treatPlanLabel = entityProcessTreatPlan.extractEntity(aiOut);

+ 3 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/LeaveHospitalAI.java

@@ -69,6 +69,9 @@ public class LeaveHospitalAI extends ModelAI {
      */
     public void putDischargeCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         //使用现病史结构来处理病历特点
         EntityProcessLeaveHospital entityProcessLeaveHospital = new EntityProcessLeaveHospital();
         LeaveHospitalLabel leaveHospitalLabel = entityProcessLeaveHospital.extractEntity(aiOut);

+ 3 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/OperationAI.java

@@ -59,6 +59,9 @@ public class OperationAI extends ModelAI {
      */
     public void putOperationDiscussionCrfData(JSONObject jsonObject, InputInfo inputInfo) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         String originalText = jsonObject.getString("originalText");
         //使用现病史结构来处理病历特点
         EntityProcessOperationDiscussion entityProcessOperationDiscussion = new EntityProcessOperationDiscussion();

+ 3 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -138,6 +138,9 @@ public class ThreeLevelWardAI extends ModelAI {
      */
     public void putWardRoundCrfData(JSONObject jsonObject, InputInfo inputInfo, int serious) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        if (aiOut == null) {
+            return;
+        }
         String wardDate = jsonObject.getString("wardDate");
         String detailTitle = jsonObject.getString("detail_title");
         //使用现病史结构来处理病历特点

+ 2 - 1
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouBeHospitalizedDocTrans.java

@@ -74,7 +74,8 @@ public class TaiZhouBeHospitalizedDocTrans extends ModelDocTrans {
             "修正诊断=修正诊断",
             "医生=医师签名",
             "补充诊断=补充诊断",
-            "户口地址=联系地址"
+            "户口地址=联系地址",
+            "关系=病史陈述者"
             );
 
 

+ 4 - 4
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouDeathCaseDiscussDocTrans.java

@@ -45,7 +45,7 @@ public class TaiZhouDeathCaseDiscussDocTrans extends ModelDocTrans {
             "年龄=",
             "讨论小结=",
             "主诉=",
-            "主持人=",
+            "主持人=讨论主持人",
             "当前诊断=",
             "床号=",
             "实验室检查=",
@@ -53,15 +53,15 @@ public class TaiZhouDeathCaseDiscussDocTrans extends ModelDocTrans {
             "死亡原因=",
             "审核日期=",
             "记录人=",
-            "死亡日期=",
+            "死亡日期=死亡时间",
             "性别=",
             "辅助检查结果=",
-            "讨论意见=",
+            "讨论意见=讨论内容",
             "本人姓名=",
             "病历号=",
             "病历日期=",
             "职称=",
-            "现病史-发病情况=",
+            "现病史-发病情况=入院情况",
             "脉搏=",
             "呼吸=",
             "入院日期=",

+ 4 - 4
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouDeathRecordDocTrans.java

@@ -40,7 +40,7 @@ public class TaiZhouDeathRecordDocTrans extends ModelDocTrans {
             "年龄=",
             "影像学检查=",
             "主诉=",
-            "当前诊断=",
+            "当前诊断=死亡诊断",
             "床号=",
             "病人基本信息=",
             "实验室检查=",
@@ -48,19 +48,19 @@ public class TaiZhouDeathRecordDocTrans extends ModelDocTrans {
             "死亡原因=",
             "审核日期=",
             "入院情况=",
-            "死亡日期=",
+            "死亡日期=死亡时间",
             "辅助检查结果=",
             "性别=",
             "本人姓名=",
             "病历号=",
-            "初步诊断=",
+            "初步诊断=入院诊断",
             "病历日期=",
             "现病史-发病情况=",
             "呼吸=",
             "入院日期=",
             "脉搏=",
             "临床科室=",
-            "诊治经过=",
+            "诊治经过=诊疗经过",
             "病历状态=",
             "审核=",
             "体温(耳)=",

+ 6 - 1
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouFirstPageRecordDocTrans.java

@@ -234,7 +234,12 @@ public class TaiZhouFirstPageRecordDocTrans extends ModelDocTrans {
             "工作单位邮政编码=",
             "病理号=",
             "病人入院日期=入院时间",
-            "病人出生日期=出生日期"
+            "病人出生日期=出生日期",
+            "门诊与出院符合 0.未做 1.符合 2.不符合 3.不确定=门诊与出院",
+            "入院与出院符合 0.未做 1.符合 2.不符合 3.不确定=入院与出院",
+            "术前与术后符合 0.未做 1.符合 2.不符合 3.不确定=术前与术后",
+            "临床与病理符合 0.未做 1.符合 2.不符合 3.不确定=临床与病理",
+            "放射与病理符合0.未做 1.符合 2.不符合 3.不确定=放射与病理"
     );
 
 }

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouOperationDocTrans.java

@@ -189,7 +189,7 @@ public class TaiZhouOperationDocTrans extends ModelDocTrans {
             "麻醉方式=麻醉方式",
             "术前准备=术前准备内容",
             "注意事项=术前术后注意事项",
-            "治疗计划和措施=可能意外和防范措施",
+            "术中、术后防范措施=可能意外和防范措施",
             "拟施手术名称和方式=拟行术式"
     );