Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

zhoutg 5 éve
szülő
commit
dbf8c514a2
24 módosított fájl, 342 hozzáadás és 54 törlés
  1. 2 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0012.java
  2. 10 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0070.java
  3. 11 8
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0397.java
  4. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0441.java
  5. 1 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0442.java
  6. 48 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0494.java
  7. 2 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0300.java
  8. 3 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0280.java
  9. 3 4
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0092.java
  10. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0225.java
  11. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0275.java
  12. 14 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/nursingsystem/NUR0293.java
  13. 45 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0094.java
  14. 5 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0127.java
  15. 5 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java
  16. 74 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java
  17. 6 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java
  18. 77 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java
  19. 6 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java
  20. 19 11
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/FirstCourseRecordAI.java
  21. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java
  22. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java
  23. 2 0
      kernel/src/main/java/com/lantone/qc/kernel/util/KernelConstants.java
  24. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCTestController.java

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0012.java

@@ -38,6 +38,8 @@ public class BEH0012 extends QCCatalogue {
             }
             if(diags_out.size()>0){
                 info.set(diags_out.toString().replace("[","").replace("]",""));
+            }else {
+                status.set("0");
             }
         }else {
             status.set("0");

+ 10 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0070.java

@@ -3,6 +3,7 @@ package com.lantone.qc.kernel.catalogue.behospitalized;
 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.entity.Diag;
 import com.lantone.qc.pub.model.entity.Family;
 import com.lantone.qc.pub.model.label.FamilyLabel;
 import com.lantone.qc.pub.util.ListUtil;
@@ -10,6 +11,7 @@ import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : BEH0070
@@ -36,6 +38,14 @@ public class BEH0070 extends QCCatalogue {
                 if (family.getDiagInfectious() != null && StringUtil.isNotBlank(family.getDiagInfectious().getName())) {
                     isFindDiagInfectious = true;
                 }
+                if (family.getDiags() != null) {
+                    List<Diag> diags = family.getDiags().stream().filter(diag ->
+                            (diag.getHospitalDiagName() != null && diag.getHospitalDiagName().contains("炎"))
+                                    || (diag.getHospitalDiagName() != null && diag.getHospitalDiagName().contains("核"))).collect(Collectors.toList());
+                    if (diags.size() > 0) {
+                        isFindDiagInfectious = true;
+                    }
+                }
                 if (isFindGeneticDiseaseKeyword && isFindDiagInfectious) {
                     status.set("0");
                     return;

+ 11 - 8
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0397.java

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.List;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 父母健康状况未描述
@@ -33,18 +34,20 @@ public class BEH0397 extends QCCatalogue {
         }
 
         Pattern p = Pattern.compile("[父母爸妈]");
-        long count = familyList
+        List<Family> filterFamilies = familyList
                 .stream()
                 .filter(
                         i -> i != null
                                 && StringUtil.isNotBlank(i.getName())
-                                && p.matcher(i.getName()).find()
-                                && i.getHealthCondition() != null
-                                && StringUtil.isNotBlank(i.getHealthCondition().getName())
-                )
-                .count();
-        if (count > 0) {
-            status.set("0");
+                                && p.matcher(i.getName()).find()).collect(Collectors.toList());
+        for (Family family : filterFamilies) {
+            if (family.getDead() != null) {
+                status.set("0");
+                return;
+            } else if (family.getHealthCondition() != null && StringUtil.isNotBlank(family.getHealthCondition().getName())) {
+                status.set("0");
+                return;
+            }
         }
     }
 

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

@@ -22,7 +22,7 @@ public class BEH0441 extends QCCatalogue {
         List<GeneralDesc> generals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGenerals();
         if(generals.size() > 0 || generals != null){
             for (GeneralDesc general:generals) {
-                if(general.getName().contains("纳")){
+                if(general.getName().contains("纳")|| general.getName().contains("饮食")){
                     status.set("0");
                     break;
                 }

+ 1 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0442.java

@@ -23,8 +23,7 @@ public class BEH0442 extends QCCatalogue {
         BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
         if(beHospitalizedDoc != null && beHospitalizedDoc.getPresentLabel() != null){
             String text = beHospitalizedDoc.getPresentLabel().getText();
-            if(text != null && (text.contains("二便")|| text.contains("小便")
-                    ||text.contains("大便")||text.contains("大小便"))){
+            if(text != null && (text.contains("便") || text.contains("尿"))){
                 return;
             }else {
                 status.set("-1");

+ 48 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0494.java

@@ -0,0 +1,48 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.RedisUtil;
+import com.lantone.qc.kernel.util.SpringContextUtil;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.entity.Diag;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : BEH0494
+ * @Description :  入院记录由非执业医师填写
+ * @Author : Mark
+ * @Date: 2020-04-07 10:36
+ */
+@Component
+public class BEH0494 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+
+        String sign = inputInfo.getBeHospitalizedDoc().getStructureMap().get("签名");
+        sign = (null==sign)?"":sign.trim();
+
+        if(sign.length() > 0 || true) {
+            RedisUtil redisUtil = SpringContextUtil.getBean("redisUtil");
+            int cnt = 0;
+
+            Map<String, String> surgeon;
+
+            if (null != redisUtil.get(sign)) {
+                surgeon = (Map)redisUtil.get(sign);
+                String prof = surgeon.get("职称").trim();
+                if (null != prof && prof.contains("医师")) {
+                    cnt += 1;
+                }
+            }
+
+            if (cnt == 0) {
+                status.set("-1");
+            }
+        }
+    }
+}

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0300.java

@@ -41,6 +41,8 @@ public class CLI0300 extends QCCatalogue {
                     }
                 }
             }
+        } else {
+            status.set("0");
         }
     }
 }

+ 3 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0280.java

@@ -8,13 +8,14 @@ import org.springframework.stereotype.Component;
 import java.util.Map;
 
 /**
- * @ClassName : CLI0001
- * @Description : 无输血/血制品病程记录
+ * @ClassName : CON0280
+ * @Description : 普通会诊未在24小时内完成
  * @Author : 楼辉荣
  * @Date: 2020-03-06 17:28
  */
 @Component
 public class CON0280 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getConsultationDocs() == null || inputInfo.getConsultationDocs().size() == 0) status.set("0");
     }
 }

+ 3 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0092.java

@@ -16,13 +16,12 @@ import org.springframework.stereotype.Component;
 @Component
 public class FIRC0092 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
         if (firstCourseRecordDoc != null) {
             TreatPlanLabel treatPlanLabel = firstCourseRecordDoc.getTreatPlanLabel();
-            if (!(treatPlanLabel.getNursingLevel() != null &&
-                    (treatPlanLabel.getMedicine() != null || treatPlanLabel.getTreat().size() > 0))) {
-                status.set("-1");
+            if (treatPlanLabel.getNursingLevel() != null &&
+                    (treatPlanLabel.getMedicine() != null || treatPlanLabel.getTreat().size() > 0)) {
+                status.set("0");
             }
         }
     }

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0225.java

@@ -11,7 +11,7 @@ import java.util.Map;
 
 /**
  * @ClassName : FIRP0225
- * @Description : 出院时间与出院记录时间不一致
+ * @Description : 出院时间与出院记录时间不一致,具体到天
  * @Author : 胡敬
  * @Date: 2020-03-14 17:10
  */
@@ -25,7 +25,7 @@ public class FIRP0225 extends QCCatalogue {
             Map<String, String> leaveHospitalStructureMap = inputInfo.getLeaveHospitalDoc().getStructureMap();
             String firstDischargeTime = firstpageStructureMap.get(Content.dischargeTime);//病案首页出院时间
             String dischargeTime = leaveHospitalStructureMap.get(Content.dischargeTime);//出院小结出院时间
-            if (!CatalogueUtil.equalsDate(firstDischargeTime, dischargeTime, "yyyy-MM-ddHH:mm")) {
+            if (!CatalogueUtil.equalsDate(firstDischargeTime, dischargeTime, "yyyy-MM-dd")) {
                 status.set("-1");
             }
         }

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0275.java

@@ -24,7 +24,7 @@ public class FIRP0275 extends QCCatalogue {
             Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
             Map<String, String> leaveHospitalStructureMap = inputInfo.getLeaveHospitalDoc().getStructureMap();
             String firstDischargeTime = firstpageStructureMap.get(Content.actualStay).toString();//病案首页出院时间
-            String dischargeTime = leaveHospitalStructureMap.get(Content.stayLength);//出院小结出院时间
+            String dischargeTime = leaveHospitalStructureMap.get(Content.stayLength).replace("天","");//出院小结出院时间
             if (!CatalogueUtil.compareToken(firstDischargeTime, dischargeTime)) {
                 status.set("-1");
             }

+ 14 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/nursingsystem/NUR0293.java

@@ -3,18 +3,30 @@ package com.lantone.qc.kernel.catalogue.nursingsystem;
 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.DoctorAdviceDoc;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
- * @ClassName : CLI0001
- * @Description : 无输血/血制品病程记录
+ * @ClassName : NUR0293
+ * @Description : 医嘱无护理级别(一级护理/二级护理/三级护理/特级护理)(医嘱部分)
  * @Author : 楼辉荣
  * @Date: 2020-03-06 17:28
  */
 @Component
 public class NUR0293 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
+        List<DoctorAdviceDoc> filters = doctorAdviceDocs.stream().filter(doctorAdviceDoc ->
+            StringUtils.isNotEmpty(doctorAdviceDoc.getStructureMap().get("医嘱项目名称"))
+                    && doctorAdviceDoc.getStructureMap().get("医嘱项目名称").indexOf("护理") > -1
+            ).distinct().collect(Collectors.toList());
+        if (filters.size() > 0) {
+            status.set("0");
+        }
     }
 }

+ 45 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0094.java

@@ -0,0 +1,45 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.RedisUtil;
+import com.lantone.qc.kernel.util.SpringContextUtil;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : THR0094
+ * @Description :  首次病程由非执业医师填写
+ * @Author : Mark
+ * @Date: 2020-04-07 17:06
+ */
+@Component
+public class THR0094 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+
+        String sign = inputInfo.getFirstCourseRecordDoc().getStructureMap().get("记录医师");
+        sign = (null==sign)?"":sign.trim();
+
+        if(sign.length() > 0 || true) {
+            RedisUtil redisUtil = SpringContextUtil.getBean("redisUtil");
+            int cnt = 0;
+
+            Map<String, String> surgeon;
+
+            if (null != redisUtil.get(sign)) {
+                surgeon = (Map)redisUtil.get(sign);
+                String prof = surgeon.get("职称").trim();
+                if (null != prof && prof.contains("医师")) {
+                    cnt += 1;
+                }
+            }
+
+            if (cnt == 0) {
+                status.set("-1");
+            }
+        }
+    }
+}

+ 5 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0127.java

@@ -49,6 +49,10 @@ public class THR0127 extends QCCatalogue {
                 beginDate = DateUtil.addDate(beginDate, 7);
                 i++;
             }
+            if (roundRecordEveryWeek.size() == 0){
+                status.set("0");
+                return;
+            }
             for (String roundRecord : roundRecordEveryWeek) {
                 int directorNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.director);
                 int dept_doctorNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.dept_doctor);
@@ -86,7 +90,7 @@ public class THR0127 extends QCCatalogue {
                 dateList.add(recordDate);
             }
         }
-        if (dateList.size() >= 2) {
+        if (dateList.size() > 0) {
             dateList.sort(Date::compareTo);
             if (CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
                 return recordTitle;

+ 5 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java

@@ -49,6 +49,10 @@ public class THR0128 extends QCCatalogue {
                 beginDate = DateUtil.addDate(beginDate, 7);
                 i++;
             }
+            if (roundRecordEveryWeek.size() == 0){
+                status.set("0");
+                return;
+            }
             for (String roundRecord : roundRecordEveryWeek) {
                 int indicationsNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.indications);
                 if (indicationsNum < 3) {
@@ -85,7 +89,7 @@ public class THR0128 extends QCCatalogue {
                 dateList.add(recordDate);
             }
         }
-        if (dateList.size() >= 2) {
+        if (dateList.size() > 0) {
             dateList.sort(Date::compareTo);
             if (CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
                 return recordTitle;

+ 74 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java

@@ -1,6 +1,7 @@
 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;
@@ -9,7 +10,11 @@ import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : THR0131
@@ -21,8 +26,23 @@ import java.util.List;
 public class THR0131 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+        if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getStructureMap() != null
+                && inputInfo.getThreeLevelWardDocs().size() > 0) {
+            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+            String admisTime = beHospitalStructureMap.get(Content.admisDate);
+            if (CatalogueUtil.isEmpty(admisTime)) {
+                return;
+            }
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            Map<String, Map<String, String>> doctorRecord = extractWardRecord(
+                    threeLevelWardDocs,
+                    admisTime,
+                    48 * 60);
+            if (doctorRecord.containsKey(Content.indications)) {
+                if (doctorRecord.get(Content.indications).get("病情记录").contains("鉴别诊断")) {
+                    return;
+                }
+            }
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
                 if (threeLevelWardLabel == null
@@ -37,4 +57,57 @@ public class THR0131 extends QCCatalogue {
             }
         }
     }
+
+    /**
+     * 抽取住院duration分钟内查房记录并取第一条主治医师查房记录以及第一条主任/副主任医师查房记录
+     *
+     * @param threeLevelWardDocs
+     * @param admisTime
+     * @param duration
+     * @return
+     */
+    private static Map<String, Map<String, String>> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, String admisTime, int duration) {
+        Map<Date, Map<String, String>> dateRecord = new HashMap<>();
+        List<Map<String, String>> sortRecord = new ArrayList<>();
+        Map<String, Map<String, String>> doctorRecord = new HashMap<>();
+        String recordTime = "";
+        Date admisDate = StringUtil.parseDateTime(admisTime);
+        if (admisDate == null) {
+            return doctorRecord;
+        }
+        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+            Map<String, String> threeLevelWardStructureMap = threeLevelWardDoc.getStructureMap();
+            recordTime = threeLevelWardStructureMap.get("查房日期");
+            Date recordDate = StringUtil.parseDateTime(recordTime);
+            if (recordDate == null) {
+                continue;
+            }
+            if (admisDate.before(recordDate) && !CatalogueUtil.compareTime(admisDate, recordDate, Long.valueOf(duration))) {
+                if (StringUtil.isBlank(threeLevelWardStructureMap.get("查房标题"))) {
+                    continue;
+                }
+                dateRecord.put(recordDate, threeLevelWardStructureMap);
+            }
+        }
+        dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
+                x -> sortRecord.add(x.getValue())
+        );
+        //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
+        for (Map<String, String> record : sortRecord) {
+            if (!CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications)) {
+                continue;
+            }
+            doctorRecord.put(Content.indications, record);
+            break;
+        }
+        //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
+        for (Map<String, String> record : sortRecord) {
+            if (!CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director)) {
+                continue;
+            }
+            doctorRecord.put(Content.director, record);
+            break;
+        }
+        return doctorRecord;
+    }
 }

+ 6 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -20,7 +21,6 @@ import java.util.List;
 @Component
 public class THR0132 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
@@ -30,11 +30,11 @@ public class THR0132 extends QCCatalogue {
                         || !Content.indications.equals(threeLevelWardLabel.getTitle())) {
                     continue;
                 }
-                if (threeLevelWardLabel.getDiags().size() == 0
-                        || StringUtil.isNotBlank(threeLevelWardLabel.getDiagBasisText()) && threeLevelWardLabel.getDiagBasisText().length() < 30
-                        || threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())
-                        || threeLevelWardLabel.getTreatmentPlans().size() == 0) {
-                    status.set("-1");
+                if (threeLevelWardLabel.getDiags().size() > 0
+                        && StringUtil.isNotBlank(threeLevelWardLabel.getDiagBasisText())
+                        && (threeLevelWardLabel.getDiffDiag().size() > 0 || StringUtils.isNotEmpty(threeLevelWardLabel.getDiffDiagText()))
+                        && threeLevelWardLabel.getTreatmentPlans().size() > 0) {
+                    status.set("0");
                     return;
                 }
             }

+ 77 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java

@@ -1,6 +1,7 @@
 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;
@@ -9,7 +10,11 @@ import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : THR0136
@@ -21,8 +26,23 @@ import java.util.List;
 public class THR0136 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+        if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getStructureMap() != null
+                && inputInfo.getThreeLevelWardDocs().size() > 0) {
+            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+            String admisTime = beHospitalStructureMap.get(Content.admisDate);
+            if (CatalogueUtil.isEmpty(admisTime)) {
+                return;
+            }
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            Map<String,Map<String, String>> doctorRecord = extractWardRecord(
+                    threeLevelWardDocs,
+                    admisTime,
+                    72 * 60);
+            if (doctorRecord.containsKey(Content.director)) {
+                if (doctorRecord.get(Content.director).get("病情记录").contains("鉴别诊断")) {
+                    return;
+                }
+            }
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
                 if (threeLevelWardLabel == null
@@ -30,6 +50,9 @@ public class THR0136 extends QCCatalogue {
                         || !Content.director.equals(threeLevelWardLabel.getTitle())) {
                     continue;
                 }
+                if (threeLevelWardDoc.getText().contains("鉴别诊断")) {
+                    return;
+                }
                 if (threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())) {
                     status.set("-1");
                     return;
@@ -37,4 +60,57 @@ public class THR0136 extends QCCatalogue {
             }
         }
     }
+
+    /**
+     * 抽取住院duration分钟内查房记录并取第一条主治医师查房记录以及第一条主任/副主任医师查房记录
+     *
+     * @param threeLevelWardDocs
+     * @param admisTime
+     * @param duration
+     * @return
+     */
+    private static Map<String, Map<String, String>> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, String admisTime, int duration) {
+        Map<Date, Map<String, String>> dateRecord = new HashMap<>();
+        List<Map<String, String>> sortRecord = new ArrayList<>();
+        Map<String, Map<String, String>> doctorRecord = new HashMap<>();
+        String recordTime = "";
+        Date admisDate = StringUtil.parseDateTime(admisTime);
+        if (admisDate == null) {
+            return doctorRecord;
+        }
+        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+            Map<String, String> threeLevelWardStructureMap = threeLevelWardDoc.getStructureMap();
+            recordTime = threeLevelWardStructureMap.get("查房日期");
+            Date recordDate = StringUtil.parseDateTime(recordTime);
+            if (recordDate == null) {
+                continue;
+            }
+            if (admisDate.before(recordDate) && !CatalogueUtil.compareTime(admisDate, recordDate, Long.valueOf(duration))) {
+                if (StringUtil.isBlank(threeLevelWardStructureMap.get("查房标题"))) {
+                    continue;
+                }
+                dateRecord.put(recordDate, threeLevelWardStructureMap);
+            }
+        }
+        dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
+                x -> sortRecord.add(x.getValue())
+        );
+        //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
+        for (Map<String, String> record : sortRecord) {
+            if (!CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications)) {
+                continue;
+            }
+            doctorRecord.put(Content.indications, record);
+            break;
+        }
+        //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
+        for (Map<String, String> record : sortRecord) {
+            if (!CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director)) {
+                continue;
+            }
+            doctorRecord.put(Content.director, record);
+            break;
+        }
+        return doctorRecord;
+    }
 }

+ 6 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -20,7 +21,6 @@ import java.util.List;
 @Component
 public class THR0137 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
@@ -30,11 +30,11 @@ public class THR0137 extends QCCatalogue {
                         || !Content.director.equals(threeLevelWardLabel.getTitle())) {
                     continue;
                 }
-                if (threeLevelWardLabel.getDiags().size() == 0
-                        || StringUtil.isNotBlank(threeLevelWardLabel.getDiagBasisText()) && threeLevelWardLabel.getDiagBasisText().length() < 30
-                        || threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())
-                        || threeLevelWardLabel.getTreatmentPlans().size() == 0) {
-                    status.set("-1");
+                if (threeLevelWardLabel.getDiags().size() > 0
+                        && StringUtil.isNotBlank(threeLevelWardLabel.getDiagBasisText())
+                        && (threeLevelWardLabel.getDiffDiag().size() > 0 || StringUtils.isNotEmpty(threeLevelWardLabel.getDiffDiagText()))
+                        && threeLevelWardLabel.getTreatmentPlans().size() > 0) {
+                    status.set("0");
                     return;
                 }
             }

+ 19 - 11
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/FirstCourseRecordAI.java

@@ -39,16 +39,24 @@ public class FirstCourseRecordAI extends ModelAI {
         JSONArray similarContent = new JSONArray();
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
         if (firstCourseRecordDoc != null && StringUtils.isNotEmpty(firstCourseRecordDoc.getText())) {
-            //病历特点
-            putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), Content.case_feature);
+//            //病历特点
+//            putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), Content.case_feature);
             //初步诊断
             putContent(crfContent, medicalTextType.get(1), firstCourseRecordDoc.getInitialDiagLabel().getText(), Content.initial_diag);
-            //诊断依据
-            putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getDiagnosisLabel().getText(), Content.diag_basis);
+//            //诊断依据
+//            putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getDiagnosisLabel().getText(), Content.diag_basis);
             //鉴别诊断
             putContent(crfContent, medicalTextType.get(1), firstCourseRecordDoc.getDifferentialDiagLabel().getText(), Content.differential_diag_basis);
             //诊疗计划
-            putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getTreatPlanLabel().getText(), Content.treat_plan);
+            if (StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划")) && StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("需求评估"))) {
+                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getStructureMap().get("需求评估") + StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划")), Content.treat_plan);
+            } else if (StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划"))) {
+                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getStructureMap().get("诊疗计划"), Content.treat_plan);
+            } else if (StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("需求评估"))) {
+                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getStructureMap().get("需求评估"), Content.treat_plan);
+            } else {
+                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getTreatPlanLabel().getText(), Content.treat_plan);
+            }
 
             //病历特点与现病史比较相似度
             if (inputInfo.getBeHospitalizedDoc() != null && StringUtil.isNotBlank(inputInfo.getBeHospitalizedDoc().getPresentLabel().getText())) {
@@ -56,15 +64,15 @@ public class FirstCourseRecordAI extends ModelAI {
             }
 
             JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
-            if (midData.containsKey(Content.case_feature)) {
-                putCaseCharacteristicCrfData(midData.getJSONObject(Content.case_feature), inputInfo);//处理病历特点
-            }
+//            if (midData.containsKey(Content.case_feature)) {
+//                putCaseCharacteristicCrfData(midData.getJSONObject(Content.case_feature), inputInfo);//处理病历特点
+//            }
             if (midData.containsKey(Content.initial_diag)) {
                 putInitialDiagCrfData(midData.getJSONObject(Content.initial_diag), inputInfo);//处理初步诊断
             }
-            if (midData.containsKey(Content.diag_basis)) {
-                putDiagnosisCrfData(midData.getJSONObject(Content.diag_basis), inputInfo);//处理诊断依据
-            }
+//            if (midData.containsKey(Content.diag_basis)) {
+//                putDiagnosisCrfData(midData.getJSONObject(Content.diag_basis), inputInfo);//处理诊断依据
+//            }
             if (midData.containsKey(Content.differential_diag_basis)) {
                 putDifferentialDiagCrfData(midData.getJSONObject(Content.differential_diag_basis), inputInfo);//处理鉴别诊断
             }

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java

@@ -15,7 +15,7 @@ public enum EntityEnum {
     OPERATION_KEYWORD("手术史"), OPERATION_RESULT("手术结果"), INJURY("外伤史"), ALLERGY("过敏"),
     FOOD_ALLERGY("食物过敏原"), DRUG_ALLERGY("药物过敏原"), ALLERGY_SYMPTOM("过敏表现"), BLOOD_TRANSFUSION("输血史"),
     TRANSFUSION_REACTION("输血反应"), VACCINATION("预防接种史"), DISEASE_KEYWORD("疾病史"), INFECTIOUS_KEYWORD("传染病史"),
-    UNKNOWN("情况不详"), HEALTH("健康况"), AGE("年龄"), SMOKING_HISTORY("吸烟史"),
+    UNKNOWN("情况不详"), HEALTH("健康况"), AGE("年龄"), SMOKING_HISTORY("吸烟史"),
     HISTORY_OF_ALCOHOL_INTAKE("饮酒史"), USAGE("用量"), MENSES("月经"), LEUKORRHEA("白带"),
     BIRTH_HIS("生育情况"), CONJUGAL_RELATION("夫妻关系"), RELATIVES("家属"), GROUP_CONSULTATION("会诊"), ORGANISM("生物体"),
     OCCUPATION("职业"), LOCATION("地点"), DEAD("死亡"), DEAD_REASON("死亡原因"),

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java

@@ -244,7 +244,7 @@ public class CatalogueUtil {
         //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
         for (Map<String, String> record : sortRecord) {
             String roundTitle = record.get("查房标题");
-            if (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications)) {
+            if (isEmpty(roundTitle) || (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications))) {
                 continue;
             }
             doctorRecord.put(Content.indications, record);
@@ -253,7 +253,7 @@ public class CatalogueUtil {
         //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
         for (Map<String, String> record : sortRecord) {
             String roundTitle = record.get("查房标题");
-            if (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director)) {
+            if (isEmpty(roundTitle) || (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director))) {
                 continue;
             }
             doctorRecord.put(Content.director, record);

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/KernelConstants.java

@@ -22,6 +22,8 @@ public class KernelConstants {
     public static final String LANTONE_DIAG_HUAZ_MAP = "lantone_diag_huaz_map";
     //医院疾病信息
     public static final String HOSPITAL_DIAG_MAP = "hospital_diag_map";
+    //医院医生信息
+    public static final String HOSPITAL_DOCTOR_MAP = "hospital_doctor_map";
 
 
     public static List<String> hospitalDiagNameList = new ArrayList<>();

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCTestController.java

@@ -270,8 +270,8 @@ public class QCTestController {
         String r1, r2, r3, r4, r5;
         try {
             st = conn.createStatement();
-            String sql = "SELECT qim.id, q.case_number, qc.code FROM qc_inputcases_mapping_all qim, qc_cases_number q, qc_cases_entry qc " +
-                    "where qim.case_number_id = q.id and qim.cases_entry_id = qc.id and q.is_deleted = 'N' " +
+            String sql = "SELECT qim.id, q.case_number, qc.code FROM qc_inputcases_mapping_all qim, qc_cases_number q, qc_cases_entry qc, qc_cases_entry_hospital h " +
+                    "where qim.case_number_id = q.id and qim.cases_entry_id = qc.id and qc.id = h.cases_entry_id and q.hospital_id = h.hospital_id and q.is_deleted = 'N' and h.is_used = 1 " +
                     "and q.hospital_id = " + hospitalId;
             if (StringUtils.isNotEmpty(caseNumber)) {
                 sql = sql + " and q.case_number = '" + caseNumber + "' ";