Browse Source

三级查房修改入参及处理方式

hujing 5 years ago
parent
commit
411fe576f4
27 changed files with 372 additions and 649 deletions
  1. 8 66
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0125.java
  2. 8 65
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0126.java
  3. 24 35
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0127.java
  4. 25 35
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java
  5. 18 13
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0130.java
  6. 18 73
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java
  7. 21 17
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java
  8. 18 15
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0133.java
  9. 11 16
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0134.java
  10. 19 13
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0135.java
  11. 19 66
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java
  12. 21 17
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java
  13. 19 13
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0138.java
  14. 12 13
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0139.java
  15. 12 16
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0140.java
  16. 10 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0141.java
  17. 9 25
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0144.java
  18. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0601.java
  19. 3 3
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0602.java
  20. 62 78
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  21. 0 47
      kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java
  22. 16 12
      kernel/src/main/java/com/lantone/qc/kernel/util/ModelDataUtil.java
  23. 1 1
      public/src/main/java/com/lantone/qc/pub/Content.java
  24. 5 1
      public/src/main/java/com/lantone/qc/pub/model/doc/ward/AttendingDoctorWardDoc.java
  25. 5 1
      public/src/main/java/com/lantone/qc/pub/model/doc/ward/DirectorDoctorWardDoc.java
  26. 4 0
      public/src/main/java/com/lantone/qc/pub/model/doc/ward/GeneralDoctorWardDoc.java
  27. 3 1
      trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouThreeLevelWardDocTrans.java

+ 8 - 66
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0125.java

@@ -6,12 +6,10 @@ 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.model.doc.ward.DirectorDoctorWardDoc;
 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;
 
@@ -24,7 +22,6 @@ import java.util.Map;
 @Component
 public class THR0125 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
         if (inputInfo.getLeaveHospitalDoc() != null && inputInfo.getLeaveHospitalDoc().getStructureMap() != null
                 && inputInfo.getThreeLevelWardDocs().size() > 0) {
             Map<String, String> leaveHospitalStructureMap = inputInfo.getLeaveHospitalDoc().getStructureMap();
@@ -37,70 +34,15 @@ public class THR0125 extends QCCatalogue {
             if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (72 * 60))) {
                 return;
             }
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            Map<String, String> doctorRecord = extractWardRecord(
-                    threeLevelWardDocs,
-                    admisTime,
-                    72 * 60);
-            if (!doctorRecord.containsKey(Content.director)) {
-                status.set("-1");
-            }
-        }
-    }
-
-    /**
-     * 抽取住院duration分钟内查房记录并取第一条主治医师查房记录以及第一条主任/副主任医师查房记录
-     *
-     * @param threeLevelWardDocs
-     * @param admisTime
-     * @param duration
-     * @return
-     */
-    private Map<String, String> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, String admisTime, int duration) {
-        Map<Date, String> dateRecord = new HashMap<>();
-        List<String> sortRecord = new ArrayList<>();
-        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))) {
-                String wardTitle = threeLevelWardStructureMap.get("查房标题");
-                String remark = threeLevelWardStructureMap.get("上级查房医生职称");
-                if (StringUtil.isNotBlank(wardTitle)){
-                    dateRecord.put(recordDate, wardTitle);
-                } else if (StringUtil.isNotBlank(remark)){
-                    dateRecord.put(recordDate, remark);
+            ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
+            List<DirectorDoctorWardDoc> directorDoctorWardDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();
+            if (directorDoctorWardDocs != null && directorDoctorWardDocs.size() > 0) {
+                DirectorDoctorWardDoc firstDirector = directorDoctorWardDocs.get(0);
+                String wardDateStr = firstDirector.getStructureMap().get("查房日期");
+                if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), (long) (72 * 60))) {
+                    status.set("0");
                 }
             }
         }
-        dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
-                x -> sortRecord.add(x.getValue())
-        );
-        //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
-        for (String record : sortRecord) {
-            if (!CatalogueUtil.subTitle(record).contains(Content.indications)) {
-                continue;
-            }
-            doctorRecord.put(Content.indications, record);
-            break;
-        }
-        //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
-        for (String record : sortRecord) {
-            if (!CatalogueUtil.subTitle(record).contains(Content.director)) {
-                continue;
-            }
-            doctorRecord.put(Content.director, record);
-            break;
-        }
-        return doctorRecord;
     }
 }

+ 8 - 65
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0126.java

@@ -6,12 +6,10 @@ 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.model.doc.ward.AttendingDoctorWardDoc;
 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;
 
@@ -37,70 +35,15 @@ public class THR0126 extends QCCatalogue {
             if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (48 * 60))) {
                 return;
             }
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            Map<String, String> doctorRecord = extractWardRecord(
-                    threeLevelWardDocs,
-                    admisTime,
-                    48 * 60);
-            if (!doctorRecord.containsKey(Content.indications)) {
-                status.set("-1");
-            }
-        }
-    }
-
-    /**
-     * 抽取住院duration分钟内查房记录并取第一条主治医师查房记录以及第一条主任/副主任医师查房记录
-     *
-     * @param threeLevelWardDocs
-     * @param admisTime
-     * @param duration
-     * @return
-     */
-    private static Map<String, String> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, String admisTime, int duration) {
-        Map<Date, String> dateRecord = new HashMap<>();
-        List<String> sortRecord = new ArrayList<>();
-        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))) {
-                String wardTitle = threeLevelWardStructureMap.get("查房标题");
-                String remark = threeLevelWardStructureMap.get("上级查房医生职称");
-                if (StringUtil.isNotBlank(wardTitle)){
-                    dateRecord.put(recordDate, wardTitle);
-                } else if (StringUtil.isNotBlank(remark)){
-                    dateRecord.put(recordDate, remark);
+            ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
+            List<AttendingDoctorWardDoc> attendingDoctorWardDocs = threeLevelWardDoc.getAttendingDoctorWardDocs();
+            if (attendingDoctorWardDocs != null && attendingDoctorWardDocs.size() > 0) {
+                AttendingDoctorWardDoc firstAttending = attendingDoctorWardDocs.get(0);
+                String wardDateStr = firstAttending.getStructureMap().get("查房日期");
+                if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), (long) (48 * 60))) {
+                    status.set("0");
                 }
             }
         }
-        dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
-                x -> sortRecord.add(x.getValue())
-        );
-        //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
-        for (String record : sortRecord) {
-            if (!CatalogueUtil.subTitle(record).contains(Content.indications)) {
-                continue;
-            }
-            doctorRecord.put(Content.indications, record);
-            break;
-        }
-        //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
-        for (String record : sortRecord) {
-            if (!CatalogueUtil.subTitle(record).contains(Content.director)) {
-                continue;
-            }
-            doctorRecord.put(Content.director, record);
-            break;
-        }
-        return doctorRecord;
     }
 }

+ 24 - 35
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0127.java

@@ -7,17 +7,13 @@ 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.DateUtil;
-import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * @ClassName : THR0127
@@ -38,35 +34,35 @@ public class THR0127 extends QCCatalogue {
             if (CatalogueUtil.isEmpty(admisTime) || CatalogueUtil.isEmpty(dischargeTime)) {
                 return;
             }
-            //如果住院天数小于7天则不判断该条规则
-            if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (7 * 24 * 60))) {
+            //开始时间(入院时间)
+            Date beginDate = StringUtil.parseDateTime(admisTime);
+            if (beginDate == null) {
                 return;
             }
-            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
-            if (CatalogueUtil.isEmpty(admisTime)) {
+            //如果住院天数小于7天则不判断该条规则
+            if (!CatalogueUtil.compareTime(beginDate, StringUtil.parseDateTime(dischargeTime), (long) (7 * 24 * 60))) {
                 return;
             }
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            Date maxRecordDate = getMaxRecordDate(threeLevelWardDocs);
-            if (maxRecordDate == null) {
+
+            ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+            Date lastRecordDate = getLastRecordDate(allDoctorWradDocs);
+            if (lastRecordDate == null) {
                 return;
             }
             int hoursPerWeek = 7 * 24 * 60;
             String roundRecordThisWeek = "";
             List<String> roundRecordEveryWeek = new ArrayList<>();
-            //开始时间(入院时间)
-            Date beginDate = StringUtil.parseDateTime(admisTime);
-            if (beginDate == null){
-                return;
-            }
-            beginDate = DateUtil.dateZeroClear(DateUtil.addDate(beginDate,1));
+            beginDate = DateUtil.dateZeroClear(DateUtil.addDate(beginDate, 1));
             int i = 1;
+            String lastWardDateRange = "";
             //每周的病历记录
             while (i >= 1) {
-                roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek, maxRecordDate);
+                roundRecordThisWeek = extractWardRecord(allDoctorWradDocs, beginDate, hoursPerWeek, lastRecordDate);
                 if (CatalogueUtil.isEmpty(roundRecordThisWeek)) {
                     break;
                 }
+                lastWardDateRange = DateUtil.formatDate(beginDate) + "    ->    " + DateUtil.formatDate(DateUtil.addDate(beginDate, 7));
                 roundRecordEveryWeek.add(roundRecordThisWeek);
                 beginDate = DateUtil.addDate(beginDate, 7);
                 i++;
@@ -81,23 +77,19 @@ public class THR0127 extends QCCatalogue {
                 if (directorNum + dept_doctorNum < 2) {
                     //每周无2次主任医师查房记录/科主任查房记录
                     status.set("-1");
+                    info.set(lastWardDateRange);
                     return;
                 }
             }
         }
     }
 
-    private Date getMaxRecordDate(List<ThreeLevelWardDoc> threeLevelWardDocs) {
-        List<Date> recordTime = new ArrayList<>();
-        threeLevelWardDocs.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("查房日期")))
-                .forEach(i -> recordTime.add(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))));
-        List<Date> sortRecordTime = recordTime.stream()
-                .filter(Objects::nonNull)
-                .sorted(Comparator.reverseOrder())
-                .collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(sortRecordTime) && sortRecordTime.size() > 0) {
-            return sortRecordTime.get(0);
+    private Date getLastRecordDate(List<ThreeLevelWardDoc> allDoctorWradDocs) {
+        ThreeLevelWardDoc threeLevelWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
+        Map<String, String> lastWardDocStructureMap = threeLevelWardDoc.getStructureMap();
+        String wardDateStr = lastWardDocStructureMap.get("查房日期");
+        if (StringUtil.isNotBlank(wardDateStr)) {
+            return StringUtil.parseDateTime(wardDateStr);
         }
         return null;
     }
@@ -123,17 +115,14 @@ public class THR0127 extends QCCatalogue {
             }
             if (admisDate.before(recordDate) && !CatalogueUtil.compareTime(admisDate, recordDate, Long.valueOf(duration))) {
                 String title = threeLevelWardStructureMap.get("查房标题");
-                String remark = threeLevelWardStructureMap.get("查房备注");
-                if (StringUtil.isNotBlank(title)){
+                if (StringUtil.isNotBlank(title)) {
                     recordTitle += title + ",";
-                } else if (StringUtil.isNotBlank(remark)){
-                    recordTitle += remark + ",";
+                    dateList.add(recordDate);
                 }
-                dateList.add(recordDate);
             }
         }
         if (dateList.size() > 0) {
-            dateList.sort(Date::compareTo);
+            //dateList.sort(Date::compareTo);
             if (!maxRecordDate.equals(dateList.get(dateList.size() - 1)) || CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
                 return recordTitle;
             }

+ 25 - 35
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java

@@ -7,17 +7,13 @@ 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.DateUtil;
-import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * @ClassName : THR0128
@@ -38,35 +34,35 @@ public class THR0128 extends QCCatalogue {
             if (CatalogueUtil.isEmpty(admisTime) || CatalogueUtil.isEmpty(dischargeTime)) {
                 return;
             }
-            //如果住院天数小于7天则不判断该条规则
-            if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (7 * 24 * 60))) {
+            //开始时间(入院时间)
+            Date beginDate = StringUtil.parseDateTime(admisTime);
+            if (beginDate == null) {
                 return;
             }
-            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
-            if (CatalogueUtil.isEmpty(admisTime)) {
+            //如果住院天数小于7天则不判断该条规则
+            if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (7 * 24 * 60))) {
                 return;
             }
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            Date maxRecordDate = getMaxRecordDate(threeLevelWardDocs);
-            if (maxRecordDate == null) {
+
+            ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+            Date lastRecordDate = getLastRecordDate(allDoctorWradDocs);
+            if (lastRecordDate == null) {
                 return;
             }
             int hoursPerWeek = 7 * 24 * 60;
             String roundRecordThisWeek = "";
             List<String> roundRecordEveryWeek = new ArrayList<>();
-            //开始时间(入院时间)
-            Date beginDate = StringUtil.parseDateTime(admisTime);
-            if (beginDate == null) {
-                return;
-            }
             beginDate = DateUtil.dateZeroClear(DateUtil.addDate(beginDate, 1));
             int i = 1;
+            String lastWardDateRange = "";
             //每周的病历记录
             while (i >= 1) {
-                roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek, maxRecordDate);
+                roundRecordThisWeek = extractWardRecord(allDoctorWradDocs, beginDate, hoursPerWeek, lastRecordDate);
                 if (CatalogueUtil.isEmpty(roundRecordThisWeek)) {
                     break;
                 }
+                lastWardDateRange = DateUtil.formatDate(beginDate) + "    ->    " + DateUtil.formatDate(DateUtil.addDate(beginDate, 7));
                 roundRecordEveryWeek.add(roundRecordThisWeek);
                 beginDate = DateUtil.addDate(beginDate, 7);
                 i++;
@@ -76,31 +72,28 @@ public class THR0128 extends QCCatalogue {
                 return;
             }
             for (String roundRecord : roundRecordEveryWeek) {
-                int indicationsNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.indications);
+                int indicationsNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.attend);
                 if (indicationsNum < 3) {
                     //每周无3次主治医师查房记录
                     status.set("-1");
+                    info.set(lastWardDateRange);
                     return;
                 }
             }
         }
     }
 
-    private Date getMaxRecordDate(List<ThreeLevelWardDoc> threeLevelWardDocs) {
-        List<Date> recordTime = new ArrayList<>();
-        threeLevelWardDocs.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("查房日期")))
-                .forEach(i -> recordTime.add(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))));
-        List<Date> sortRecordTime = recordTime.stream()
-                .filter(Objects::nonNull)
-                .sorted(Comparator.reverseOrder())
-                .collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(sortRecordTime) && sortRecordTime.size() > 0) {
-            return sortRecordTime.get(0);
+    private Date getLastRecordDate(List<ThreeLevelWardDoc> allDoctorWradDocs) {
+        ThreeLevelWardDoc threeLevelWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
+        Map<String, String> lastWardDocStructureMap = threeLevelWardDoc.getStructureMap();
+        String wardDateStr = lastWardDocStructureMap.get("查房日期");
+        if (StringUtil.isNotBlank(wardDateStr)) {
+            return StringUtil.parseDateTime(wardDateStr);
         }
         return null;
     }
 
+
     /**
      * 抽取duration分钟内所有查房标题
      * 抽取一周内所有查房标题,若一周内记录少于6天,则返回""
@@ -122,17 +115,14 @@ public class THR0128 extends QCCatalogue {
             }
             if (admisDate.before(recordDate) && !CatalogueUtil.compareTime(admisDate, recordDate, Long.valueOf(duration))) {
                 String title = threeLevelWardStructureMap.get("查房标题");
-                String remark = threeLevelWardStructureMap.get("查房备注");
-                if (StringUtil.isNotBlank(title)){
+                if (StringUtil.isNotBlank(title)) {
                     recordTitle += title + ",";
-                } else if (StringUtil.isNotBlank(remark)){
-                    recordTitle += remark + ",";
+                    dateList.add(recordDate);
                 }
-                dateList.add(recordDate);
             }
         }
         if (dateList.size() > 0) {
-            dateList.sort(Date::compareTo);
+            //dateList.sort(Date::compareTo);
             if (!maxRecordDate.equals(dateList.get(dateList.size() - 1)) || CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
                 return recordTitle;
             }

+ 18 - 13
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0130.java

@@ -5,11 +5,13 @@ 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.model.doc.ward.AttendingDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : THR0130
@@ -20,20 +22,23 @@ import java.util.List;
 @Component
 public class THR0130 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.indications.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardLabel.getClinicals().size() == 0 && threeLevelWardLabel.getSigns().size() == 0) {
-                        status.set("-1");
-                        return;
-                    }
+            List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
+            if (attendDocs.size() > 0) {
+                AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstAttendStructureMap = firstAttendDoc.getStructureMap();
+                if (StringUtil.isNotBlank(firstAttendStructureMap.get("体检"))) {
+                    status.set("0");
+                    return;
+                }
+                ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
+                if (firstAttendLabel == null) {
+                    return;
+                }
+
+                if (firstAttendLabel.getClinicals().size() != 0 || firstAttendLabel.getSigns().size() != 0) {
+                    status.set("0");
                 }
             }
         }

+ 18 - 73
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java

@@ -1,18 +1,13 @@
 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.model.doc.ward.AttendingDoctorWardDoc;
 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;
 
@@ -25,80 +20,30 @@ import java.util.Map;
 @Component
 public class THR0131 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.indications.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardDoc.getText().contains("鉴别")
-                            || threeLevelWardDoc.getText().contains("诊断明确")
-                            || threeLevelWardDoc.getText().contains("无需鉴别")) {
-                        return;
-                    }
-                    if (threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())) {
-                        status.set("-1");
+            List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
+            if (attendDocs.size() > 0) {
+                AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstAttendStructureMap = firstAttendDoc.getStructureMap();
+                String conditionRecord = firstAttendStructureMap.get("病情记录");
+                if (StringUtil.isNotBlank(conditionRecord)) {
+                    if (conditionRecord.contains("鉴别")
+                            || conditionRecord.contains("诊断明确")
+                            || conditionRecord.contains("无需鉴别")) {
+                        status.set("0");
                         return;
                     }
                 }
-            }
-        }
-    }
+                ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
+                if (firstAttendLabel == null) {
+                    return;
+                }
 
-    /**
-     * 抽取住院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;
+                if (firstAttendLabel.getDiffDiag().size() != 0 || StringUtil.isNotBlank(firstAttendLabel.getDiffDiagText())) {
+                    status.set("0");
                 }
-                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;
     }
 }

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

@@ -1,16 +1,16 @@
 package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-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.model.doc.ward.AttendingDoctorWardDoc;
 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;
+import java.util.Map;
 
 /**
  * @ClassName : THR0132
@@ -22,21 +22,25 @@ import java.util.List;
 public class THR0132 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.indications.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    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;
-                    }
+            List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
+            if (attendDocs.size() > 0) {
+                AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstAttendStructureMap = firstAttendDoc.getStructureMap();
+                if (StringUtil.isNotBlank(firstAttendStructureMap.get("病情记录"))) {
+                    status.set("0");
+                    return;
+                }
+                ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
+                if (firstAttendLabel == null) {
+                    return;
+                }
+
+                if (firstAttendLabel.getDiags().size() > 0
+                        || StringUtil.isNotBlank(firstAttendLabel.getDiagBasisText())
+                        || (firstAttendLabel.getDiffDiag().size() > 0 || StringUtils.isNotEmpty(firstAttendLabel.getDiffDiagText()))
+                        || firstAttendLabel.getTreatmentPlans().size() > 0) {
+                    status.set("0");
                 }
             }
         }

+ 18 - 15
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0133.java

@@ -1,15 +1,15 @@
 package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-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.model.doc.ward.AttendingDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : THR0133
@@ -20,20 +20,23 @@ import java.util.List;
 @Component
 public class THR0133 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.indications.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardLabel.getTreatmentPlans().size() == 0) {
-                        status.set("-1");
-                        return;
-                    }
+            List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
+            if (attendDocs.size() > 0) {
+                AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstAttendStructureMap = firstAttendDoc.getStructureMap();
+                if (StringUtil.isNotBlank(firstAttendStructureMap.get("治疗计划和措施"))) {
+                    status.set("0");
+                    return;
+                }
+                ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
+                if (firstAttendLabel == null) {
+                    return;
+                }
+
+                if (firstAttendLabel.getTreatmentPlans().size() != 0) {
+                    status.set("0");
                 }
             }
         }

+ 11 - 16
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0134.java

@@ -1,12 +1,10 @@
 package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-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.model.doc.ward.AttendingDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
-import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -20,20 +18,17 @@ import java.util.List;
 @Component
 public class THR0134 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.indications.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardLabel.getDiags().size() == 0) {
-                        status.set("-1");
-                        return;
-                    }
+            List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
+            if (attendDocs.size() > 0) {
+                AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
+                ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
+                if (firstAttendLabel == null) {
+                    return;
+                }
+
+                if (firstAttendLabel.getDiags().size() != 0) {
+                    status.set("0");
                 }
             }
         }

+ 19 - 13
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0135.java

@@ -5,11 +5,14 @@ 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.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : THR0135
@@ -20,20 +23,23 @@ import java.util.List;
 @Component
 public class THR0135 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.director.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardLabel.getClinicals().size() == 0 && threeLevelWardLabel.getSigns().size() == 0) {
-                        status.set("-1");
-                        return;
-                    }
+            List<DirectorDoctorWardDoc> directorDocs = inputInfo.getThreeLevelWardDocs().get(0).getDirectorDoctorWardDocs();
+            if (directorDocs.size() > 0) {
+                DirectorDoctorWardDoc firstDirectDoc = directorDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstDirectStructureMap = firstDirectDoc.getStructureMap();
+                if (StringUtil.isNotBlank(firstDirectStructureMap.get("体检"))) {
+                    status.set("0");
+                    return;
+                }
+                ThreeLevelWardLabel firstDirectLabel = firstDirectDoc.getThreeLevelWardLabel();
+                if (firstDirectLabel == null) {
+                    return;
+                }
+
+                if (firstDirectLabel.getClinicals().size() != 0 || firstDirectLabel.getSigns().size() != 0) {
+                    status.set("0");
                 }
             }
         }

+ 19 - 66
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java

@@ -6,6 +6,8 @@ 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.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
@@ -27,78 +29,29 @@ public class THR0136 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.director.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardDoc.getText().contains("鉴别")
-                            || threeLevelWardDoc.getText().contains("诊断明确")
-                            || threeLevelWardDoc.getText().contains("无需鉴别")) {
-                        return;
-                    }
-                    if (threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())) {
-                        status.set("-1");
+            List<DirectorDoctorWardDoc> directorDocs = inputInfo.getThreeLevelWardDocs().get(0).getDirectorDoctorWardDocs();
+            if (directorDocs.size() > 0) {
+                DirectorDoctorWardDoc firstDirectDoc = directorDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstDirectStructureMap = firstDirectDoc.getStructureMap();
+                String conditionRecord = firstDirectStructureMap.get("病情记录");
+                if (StringUtil.isNotBlank(conditionRecord)) {
+                    if (conditionRecord.contains("鉴别")
+                            || conditionRecord.contains("诊断明确")
+                            || conditionRecord.contains("无需鉴别")) {
+                        status.set("0");
                         return;
                     }
                 }
-            }
-        }
-    }
+                ThreeLevelWardLabel firstDirectLabel = firstDirectDoc.getThreeLevelWardLabel();
+                if (firstDirectLabel == null) {
+                    return;
+                }
 
-    /**
-     * 抽取住院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;
+                if (firstDirectLabel.getDiffDiag().size() != 0 || StringUtil.isNotBlank(firstDirectLabel.getDiffDiagText())) {
+                    status.set("0");
                 }
-                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;
     }
 }

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

@@ -1,16 +1,16 @@
 package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-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.model.doc.ward.DirectorDoctorWardDoc;
 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;
+import java.util.Map;
 
 /**
  * @ClassName : THR0137
@@ -22,21 +22,25 @@ import java.util.List;
 public class THR0137 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.director.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    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;
-                    }
+            List<DirectorDoctorWardDoc> directorDocs = inputInfo.getThreeLevelWardDocs().get(0).getDirectorDoctorWardDocs();
+            if (directorDocs.size() > 0) {
+                DirectorDoctorWardDoc firstDirectDoc = directorDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstDirectStructureMap = firstDirectDoc.getStructureMap();
+                if (StringUtil.isNotBlank(firstDirectStructureMap.get("病情记录"))) {
+                    status.set("0");
+                    return;
+                }
+                ThreeLevelWardLabel firstDirectLabel = firstDirectDoc.getThreeLevelWardLabel();
+                if (firstDirectLabel == null) {
+                    return;
+                }
+
+                if (firstDirectLabel.getDiags().size() > 0
+                        || StringUtil.isNotBlank(firstDirectLabel.getDiagBasisText())
+                        || (firstDirectLabel.getDiffDiag().size() > 0 || StringUtils.isNotEmpty(firstDirectLabel.getDiffDiagText()))
+                        || firstDirectLabel.getTreatmentPlans().size() > 0) {
+                    status.set("0");
                 }
             }
         }

+ 19 - 13
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0138.java

@@ -5,11 +5,14 @@ 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.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : THR0138
@@ -20,20 +23,23 @@ import java.util.List;
 @Component
 public class THR0138 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.director.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardLabel.getTreatmentPlans().size() == 0) {
-                        status.set("-1");
-                        return;
-                    }
+            List<DirectorDoctorWardDoc> directorDocs = inputInfo.getThreeLevelWardDocs().get(0).getDirectorDoctorWardDocs();
+            if (directorDocs.size() > 0) {
+                DirectorDoctorWardDoc firstDirectDoc = directorDocs.get(0);
+                //先取结构化数据判断
+                Map<String, String> firstDirectStructureMap = firstDirectDoc.getStructureMap();
+                if (StringUtil.isNotBlank(firstDirectStructureMap.get("治疗计划和措施"))) {
+                    status.set("0");
+                    return;
+                }
+                ThreeLevelWardLabel firstDirectLabel = firstDirectDoc.getThreeLevelWardLabel();
+                if (firstDirectLabel == null) {
+                    return;
+                }
+
+                if (firstDirectLabel.getTreatmentPlans().size() != 0) {
+                    status.set("0");
                 }
             }
         }

+ 12 - 13
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0139.java

@@ -5,6 +5,8 @@ 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.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
@@ -20,20 +22,17 @@ import java.util.List;
 @Component
 public class THR0139 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) {
-                List<ThreeLevelWardLabel> threeLevelWardLabels = threeLevelWardDoc.getThreeLevelWardLabel();
-                for (ThreeLevelWardLabel threeLevelWardLabel : threeLevelWardLabels) {
-                    if (StringUtil.isBlank(threeLevelWardLabel.getTitle())
-                            || !Content.director.equals(threeLevelWardLabel.getTitle())) {
-                        continue;
-                    }
-                    if (threeLevelWardLabel.getDiags().size() == 0) {
-                        status.set("-1");
-                        return;
-                    }
+            List<DirectorDoctorWardDoc> directorDocs = inputInfo.getThreeLevelWardDocs().get(0).getDirectorDoctorWardDocs();
+            if (directorDocs.size() > 0) {
+                DirectorDoctorWardDoc firstDirectDoc = directorDocs.get(0);
+                ThreeLevelWardLabel firstDirectLabel = firstDirectDoc.getThreeLevelWardLabel();
+                if (firstDirectLabel == null) {
+                    return;
+                }
+
+                if (firstDirectLabel.getDiags().size() != 0) {
+                    status.set("0");
                 }
             }
         }

+ 12 - 16
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0140.java

@@ -6,7 +6,6 @@ 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.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -22,25 +21,22 @@ import java.util.Map;
 @Component
 public class THR0140 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
         List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-        if (ListUtil.isEmpty(threeLevelWardDocs)) {
+        if (threeLevelWardDocs.size() == 0) {
             return;
         }
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-            Map<String, String> threeLevelWardDocStructureMap = threeLevelWardDoc.getStructureMap();
-            String recordDoctor = threeLevelWardDocStructureMap.get("记录医师");
-            if (CatalogueUtil.isEmpty(recordDoctor)) {
-                status.set("-1");
-                break;
-            }
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+        allDoctorWradDocs.stream().filter(doc -> StringUtil.isBlank(doc.getStructureMap().get("记录医师")));
+        if (allDoctorWradDocs.size() == 0) {
+            status.set("0");
         }
-//        if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
-//            processSign(inputInfo, "疑难患者");
-//        }
-//        if (inputInfo.getRescueDocs().size() > 0) {
-//            processSign(inputInfo, "抢救患者");
-//        }
+
+        //        if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
+        //            processSign(inputInfo, "疑难患者");
+        //        }
+        //        if (inputInfo.getRescueDocs().size() > 0) {
+        //            processSign(inputInfo, "抢救患者");
+        //        }
     }
 
     private void processSign(InputInfo inputInfo, String message) {

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

@@ -6,6 +6,7 @@ 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.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -25,18 +26,21 @@ public class THR0141 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() == 0) {
             return;
         }
+        List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();
+        if (ListUtil.isEmpty(allDoctorWradDocs)) {
+            return;
+        }
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
-            processSign(inputInfo, "疑难患者");
+            processSign(allDoctorWradDocs, "疑难患者");
         }
         if (inputInfo.getRescueDocs().size() > 0) {
-            processSign(inputInfo, "抢救患者");
+            processSign(allDoctorWradDocs, "抢救患者");
         }
     }
 
-    private void processSign(InputInfo inputInfo, String message) {
-        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+    private void processSign(List<ThreeLevelWardDoc> allDoctorWradDocs, String message) {
         int directorSum = 0;
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
             Map<String, String> threeLevelWardDocStructureMap = threeLevelWardDoc.getStructureMap();
             String title = threeLevelWardDocStructureMap.get("查房标题");
             if (CatalogueUtil.isEmpty(title)) {
@@ -46,7 +50,7 @@ public class THR0141 extends QCCatalogue {
                 directorSum++;
             }
         }
-        if (directorSum != threeLevelWardDocs.size()) {
+        if (directorSum != allDoctorWradDocs.size()) {
             status.set("-1");
             if (StringUtil.isBlank(message)) {
                 info.set(message);

+ 9 - 25
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0144.java

@@ -22,33 +22,17 @@ import java.util.Map;
 @Component
 public class THR0144 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
-            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-            String lastWardCRoundRecord = "", lastWardRoundTitle = "";
-            Date lastWardCRoundDate = null;
-            String wardRoundTime, wardCRoundRecord, wardRoundTitle;
-            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                Map<String, String> threeLevelWardDocStructureMap = threeLevelWardDoc.getStructureMap();
-                if (StringUtil.isEmpty(threeLevelWardDocStructureMap.get("查房日期"))
-                        || StringUtil.isEmpty(threeLevelWardDocStructureMap.get("病情记录"))) {
-                    continue;
+            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("病情记录");
+                String title = structureMap.get("查房标题");
+                if (conditionRecord.contains("出院") && StringUtil.isNotBlank(title)
+                        && (CatalogueUtil.subTitle(title).contains(Content.attend) || CatalogueUtil.subTitle(title).contains(Content.director))) {
+                    status.set("0");
                 }
-                wardRoundTime = threeLevelWardDocStructureMap.get("查房日期");
-                wardCRoundRecord = threeLevelWardDocStructureMap.get("病情记录");
-                wardRoundTitle = threeLevelWardDocStructureMap.get("查房标题");
-                Date wardRoundDate = StringUtil.parseDateTime(wardRoundTime);
-                if (lastWardCRoundDate == null || (wardRoundDate != null && wardRoundDate.after(lastWardCRoundDate))) {
-                    lastWardCRoundDate = wardRoundDate;
-                    lastWardCRoundRecord = wardCRoundRecord;
-                    lastWardRoundTitle = wardRoundTitle;
-                }
-            }
-            if (!lastWardCRoundRecord.contains("出院")
-                    || (!CatalogueUtil.isEmpty(lastWardRoundTitle)
-                    && !CatalogueUtil.subTitle(lastWardRoundTitle).contains(Content.indications)
-                    && !CatalogueUtil.subTitle(lastWardRoundTitle).contains(Content.director))) {
-                status.set("-1");
             }
         }
     }

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

@@ -30,7 +30,7 @@ public class THR0601 extends QCCatalogue {
         for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
             Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
             title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
-            if (!CatalogueUtil.isEmpty(title) && title.contains(Content.indications)) {
+            if (!CatalogueUtil.isEmpty(title) && title.contains(Content.attend)) {
                 findIndications = true;
                 break;
             }

+ 3 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0602.java

@@ -47,7 +47,7 @@ public class THR0602 extends QCCatalogue {
                     threeLevelWardDocs,
                     operationEndDateStr,
                     48 * 60);
-            if (!doctorRecord.containsKey(Content.indications)) {
+            if (!doctorRecord.containsKey(Content.attend)) {
                 status.set("-1");
                 return;
             }
@@ -91,10 +91,10 @@ public class THR0602 extends QCCatalogue {
         );
         //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
         for (String record : sortRecord) {
-            if (!CatalogueUtil.subTitle(record).contains(Content.indications)) {
+            if (!CatalogueUtil.subTitle(record).contains(Content.attend)) {
                 continue;
             }
-            doctorRecord.put(Content.indications, record);
+            doctorRecord.put(Content.attend, record);
             break;
         }
         //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord

+ 62 - 78
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -10,6 +10,8 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.doc.DifficultCaseDiscussDoc;
 import com.lantone.qc.pub.model.doc.RescueDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
@@ -43,52 +45,56 @@ public class ThreeLevelWardAI extends ModelAI {
         if (threeLevelWardDocs.size() == 0) {
             return;
         }
-        //主治/主任首次查房记录
-        Map<String, Map<String, String>> firstWardRecord = CatalogueUtil.extractWardRecord(threeLevelWardDocs);
-        //主治医师首次查房记录
-        if (firstWardRecord.get(Content.indications) != null) {
-            putContent(crfContent, medicalTextType.get(0), firstWardRecord.get(Content.indications).get("病情记录"), Content.indications);
+        ThreeLevelWardDoc threeLevelWardDoc = threeLevelWardDocs.get(0);
+        List<AttendingDoctorWardDoc> attendingDocs = threeLevelWardDoc.getAttendingDoctorWardDocs();//主治医师查房记录
+        if (attendingDocs.size() > 0) {
+            //主治医师首次查房记录
+            Map<String, String> fitstAttStructureMap = attendingDocs.get(0).getStructureMap();
+            putContent(crfContent, medicalTextType.get(0), fitstAttStructureMap.get("病情记录"), Content.attend);
         }
-        //主任医师首次查房记录
-        if (firstWardRecord.get(Content.director) != null) {
-            putContent(crfContent, medicalTextType.get(0), firstWardRecord.get(Content.director).get("病情记录"), Content.director);
-        }
-        Map<String, String> lastCourseRecord = getLastCourseRecord(threeLevelWardDocs);
-        if (lastCourseRecord != null && lastCourseRecord.containsKey("病情记录")) {
+
+        List<DirectorDoctorWardDoc> directorDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();//主任医师查房记录
+        if (directorDocs.size() > 0) {
+            //主任医师首次查房记录
+            Map<String, String> fitstDirStructureMap = directorDocs.get(0).getStructureMap();
+            putContent(crfContent, medicalTextType.get(0), fitstDirStructureMap.get("病情记录"), Content.director);
+
             //主任医师最后一次查房记录
-            putContent(crfContent, medicalTextType.get(1), lastCourseRecord.get("病情记录"), Content.director + "最后一次");
+            Map<String, String> lastDirStructureMap = directorDocs.get(directorDocs.size() - 1).getStructureMap();
+            putContent(crfContent, medicalTextType.get(0), lastDirStructureMap.get("病情记录"), Content.director + "最后一次");
         }
 
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();//所有查房记录
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
         //疑难患者副高及以上查房记录
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
-            directorDifficultRecord = putDirectorDifficultRecord(inputInfo, threeLevelWardDocs);
+            directorDifficultRecord = putDirectorDifficultRecord(inputInfo, allDoctorWradDocs);
             for (int i = 0; i < directorDifficultRecord.size(); i++) {
-                putContent(crfContent, medicalTextType.get(0), directorDifficultRecord.get(i).get("病情记录"), Content.difficultPatients + i);
+                putContent(crfContent, medicalTextType.get(0), directorDifficultRecord.get(i).get("病情记录"), Content.difficultPatients + i, directorDifficultRecord.get(i).get("查房日期"));
             }
         }
         List<Map<String, String>> directorRescueRecord = new ArrayList<>();
         //抢救患者副高及以上查房记录
         if (inputInfo.getRescueDocs().size() > 0) {
-            directorRescueRecord = putDirectorRescueRecord(inputInfo, threeLevelWardDocs);
+            directorRescueRecord = putDirectorRescueRecord(inputInfo, allDoctorWradDocs);
             for (int i = 0; i < directorRescueRecord.size(); i++) {
-                putContent(crfContent, medicalTextType.get(0), directorRescueRecord.get(i).get("病情记录"), Content.rescuingPatients + i);
+                putContent(crfContent, medicalTextType.get(0), directorRescueRecord.get(i).get("病情记录"), Content.rescuingPatients + i, directorRescueRecord.get(i).get("查房日期"));
             }
         }
 
         JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
 
         //主治医师首次查房记录模型输出
-        if (midData.get(Content.indications) != null) {
-            putWardRoundCrfData(midData.getJSONObject(Content.indications), inputInfo, Content.indications, 0);//查房记录
+        if (midData.get(Content.attend) != null) {
+            putWardRoundCrfData(midData.getJSONObject(Content.attend), inputInfo, 0);//查房记录
         }
         //主任医师首次查房记录模型输出
         if (midData.get(Content.director) != null) {
-            putWardRoundCrfData(midData.getJSONObject(Content.director), inputInfo, Content.director, 0);//查房记录
+            putWardRoundCrfData(midData.getJSONObject(Content.director), inputInfo, 0);//查房记录
         }
         //主任医师最后一次查房记录模型输出
         if (midData.get(Content.director + "最后一次") != null) {
-            putWardRoundCrfData(midData.getJSONObject(Content.director + "最后一次"), inputInfo, Content.director + "最后一次", 0);//最后一次查房记录
+            putWardRoundCrfData(midData.getJSONObject(Content.director + "最后一次"), inputInfo, 0);//最后一次查房记录
         }
         //疑难患者副高及以上查房记录模型输出
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0 && ListUtil.isNotEmpty(directorDifficultRecord)) {
@@ -96,7 +102,7 @@ public class ThreeLevelWardAI extends ModelAI {
                 if (midData.get(Content.difficultPatients + i) == null) {
                     continue;
                 }
-                putWardRoundCrfData(midData.getJSONObject(Content.difficultPatients + i), inputInfo, Content.director, 2);//查房记录
+                putWardRoundCrfData(midData.getJSONObject(Content.difficultPatients + i), inputInfo, 2);//查房记录
             }
         }
         //抢救患者副高及以上查房记录模型输出
@@ -105,22 +111,22 @@ public class ThreeLevelWardAI extends ModelAI {
                 if (midData.get(Content.rescuingPatients + i) == null) {
                     continue;
                 }
-                putWardRoundCrfData(midData.getJSONObject(Content.difficultPatients + i), inputInfo, Content.director, 3);//查房记录
+                putWardRoundCrfData(midData.getJSONObject(Content.difficultPatients + i), inputInfo, 3);//查房记录
             }
         }
 
     }
 
-    protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign) {
-        String move_text = CatalogueUtil.removeSpecialChar(text);
-        if (StringUtil.isEmpty(move_text)) {
+    protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign, String wardDate) {
+        String moveText = CatalogueUtil.removeSpecialChar(text);
+        if (StringUtil.isEmpty(moveText)) {
             return;
         }
         JSONObject detailContent = new JSONObject();
         detailContent.put("medical_text_type", medicalTextType);
-        detailContent.put("content", move_text);
+        detailContent.put("content", moveText);
         detailContent.put("detail_title", sign);
-        detailContent.put("originalText", text);
+        detailContent.put("wardDate", wardDate);
         crfContent.add(detailContent);
     }
 
@@ -130,20 +136,33 @@ public class ThreeLevelWardAI extends ModelAI {
      * @param jsonObject
      * @param inputInfo
      */
-    public void putWardRoundCrfData(JSONObject jsonObject, InputInfo inputInfo, String detailTitle, int serious) {
+    public void putWardRoundCrfData(JSONObject jsonObject, InputInfo inputInfo, int serious) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
-        String originalText = jsonObject.getString("originalText");
+        String wardDate = jsonObject.getString("wardDate");
+        String detailTitle = jsonObject.getString("detail_title");
         //使用现病史结构来处理病历特点
         EntityProcessThreeLevelWard entityProcessThreeLevelWard = new EntityProcessThreeLevelWard();
         ThreeLevelWardLabel threeLevelWardLabel = entityProcessThreeLevelWard.extractEntity(aiOut);
         threeLevelWardLabel.setTitle(detailTitle);
         threeLevelWardLabel.setSerious(serious);
-        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-            String text = threeLevelWardDoc.getText();
-            if (StringUtil.isNotBlank(text) && StringUtil.isNotBlank(originalText) && text.equals(originalText)) {
-                threeLevelWardDoc.getThreeLevelWardLabel().add(threeLevelWardLabel);
-                break;
+        ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
+        if (serious == 0) {//处理主治/主任查房记录
+            if (Content.attend.equals(detailTitle)) {
+                threeLevelWardDoc.getAttendingDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
+            } else if (Content.director.equals(detailTitle)) {
+                threeLevelWardDoc.getDirectorDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
+            } else if ((Content.director + "最后一次").equals(detailTitle)) {
+                List<DirectorDoctorWardDoc> director = threeLevelWardDoc.getDirectorDoctorWardDocs();
+                director.get(director.size() - 1).setThreeLevelWardLabel(threeLevelWardLabel);
+            }
+        } else {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+            for (ThreeLevelWardDoc wardDoc : allDoctorWradDocs) {
+                String date = wardDoc.getStructureMap().get("查房日期");
+                if (StringUtil.isNotBlank(date) && StringUtil.isNotBlank(wardDate) && date.equals(wardDate)) {
+                    wardDoc.getThreeLevelWardLabel().add(threeLevelWardLabel);
+                    break;
+                }
             }
         }
     }
@@ -152,10 +171,10 @@ public class ThreeLevelWardAI extends ModelAI {
      * 存放每条疑难病例讨论记录后第一条查房记录
      *
      * @param inputInfo
-     * @param threeLevelWardDocs
+     * @param allDoctorWradDocs
      * @return
      */
-    public List<Map<String, String>> putDirectorDifficultRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> threeLevelWardDocs) {
+    public List<Map<String, String>> putDirectorDifficultRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> allDoctorWradDocs) {
         List<Map<String, String>> record = new ArrayList<>();
         List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs(); //疑难病例讨论记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
@@ -170,7 +189,7 @@ public class ThreeLevelWardAI extends ModelAI {
             Map<String, String> difficultCaseDiscussStructureMap = difficultCaseDiscussDoc.getStructureMap();
             recordTime = difficultCaseDiscussStructureMap.get("讨论时间");
             Date recordDate = null;
-            if(StringUtil.isNotEmpty(recordTime)){
+            if (StringUtil.isNotEmpty(recordTime)) {
                 recordDate = StringUtil.parseDateTime(recordTime);
             }
             if (recordDate == null) {
@@ -179,7 +198,7 @@ public class ThreeLevelWardAI extends ModelAI {
             dateRecord.put(recordDate, difficultCaseDiscussStructureMap);
         }
         dateRecord = extractUnique(dateRecord);
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
             Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
             recordTime = rescueStructureMap.get("查房日期");
             title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
@@ -198,7 +217,7 @@ public class ThreeLevelWardAI extends ModelAI {
         for (int i = 0; i < dateRecordList.size(); i++) {
             if (i != dateRecordList.size() - 1) {
                 //当前为疑难病例讨论记录
-                if (!dateRecordList.get(i).containsKey("抢救时间")) {
+                if (!dateRecordList.get(i).containsKey("讨论时间")) {
                     continue;
                 }
                 //疑难病例讨论记录下一条不是查房记录则清空list
@@ -218,10 +237,10 @@ public class ThreeLevelWardAI extends ModelAI {
      * 存放每条抢救记录后第一条
      *
      * @param inputInfo
-     * @param threeLevelWardDocs
+     * @param allDoctorWradDocs
      * @return
      */
-    public List<Map<String, String>> putDirectorRescueRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> threeLevelWardDocs) {
+    public List<Map<String, String>> putDirectorRescueRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> allDoctorWradDocs) {
         List<Map<String, String>> record = new ArrayList<>();
         List<RescueDoc> rescueDocs = inputInfo.getRescueDocs(); //抢救记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
@@ -242,7 +261,7 @@ public class ThreeLevelWardAI extends ModelAI {
             dateRecord.put(recordDate, rescueStructureMap);
         }
         dateRecord = extractUnique(dateRecord);
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
             Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
             recordTime = rescueStructureMap.get("查房日期");
             title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
@@ -300,39 +319,4 @@ public class ThreeLevelWardAI extends ModelAI {
         }
         return record;
     }
-
-    /**
-     * 获取查房记录最后一条记录
-     *
-     * @param threeLevelWardDocs
-     * @return
-     */
-    public Map<String, String> getLastCourseRecord(List<ThreeLevelWardDoc> threeLevelWardDocs) {
-        Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
-            @Override
-            public int compare(Date o1, Date o2) {
-                // 降序排列
-                return o2.compareTo(o1);
-            }
-        });//按时间key排序,存放抢救记录、查房记录
-        String recordTime = "", title = "";
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-            Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
-            recordTime = rescueStructureMap.get("查房日期");
-            title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
-            Date recordDate = null;
-            if(StringUtil.isNotEmpty(recordTime)){
-                recordDate = StringUtil.parseDateTime(recordTime);
-            }
-            if (recordDate == null || StringUtil.isBlank(title) || !title.contains(Content.director)) {//只存副高以上查房记录) {
-                continue;
-            }
-            dateRecord.put(recordDate, rescueStructureMap);
-        }
-        List<Map<String, String>> dateRecordList = new ArrayList<>(dateRecord.values());
-        if (ListUtil.isEmpty(dateRecordList)) {
-            return null;
-        }
-        return dateRecordList.get(0);
-    }
 }

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

@@ -227,53 +227,6 @@ public class CatalogueUtil {
         return overtime;
     }
 
-    /**
-     * 第一条主治医师查房记录以及第一条主任/副主任医师查房记录
-     *
-     * @param threeLevelWardDocs
-     * @return
-     */
-    public static Map<String, Map<String, String>> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs) {
-        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 = "";
-        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-            Map<String, String> threeLevelWardStructureMap = threeLevelWardDoc.getStructureMap();
-            recordTime = threeLevelWardStructureMap.get("查房日期");
-            Date recordDate = null;
-            if(StringUtil.isNotEmpty(recordTime)){
-                recordDate = StringUtil.parseDateTime(recordTime);
-            }
-            if (recordDate == null) {
-                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) {
-            String roundTitle = record.get("查房标题");
-            if (isEmpty(roundTitle) || (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications))) {
-                continue;
-            }
-            doctorRecord.put(Content.indications, record);
-            break;
-        }
-        //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
-        for (Map<String, String> record : sortRecord) {
-            String roundTitle = record.get("查房标题");
-            if (isEmpty(roundTitle) || (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director))) {
-                continue;
-            }
-            doctorRecord.put(Content.director, record);
-            break;
-        }
-        return doctorRecord;
-    }
-
     /**
      * 获取查房记录标题中医师职称
      *

+ 16 - 12
kernel/src/main/java/com/lantone/qc/kernel/util/ModelDataUtil.java

@@ -10,6 +10,8 @@ import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.vo.QueryVo;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.PropertiesUtil;
@@ -229,21 +231,23 @@ public class ModelDataUtil {
         }
         ThreeLevelWardAI threeLevelWardAI = new ThreeLevelWardAI();
         Map<String, String> changxDoc = new LinkedHashMap<>();
-        //主治/主任首次查房记录
-        Map<String, Map<String, String>> firstWardRecord = CatalogueUtil.extractWardRecord(threeLevelWardDocs);
-        //主治医师首次查房记录
-        if (firstWardRecord.get(Content.indications) != null) {
-            putDoc(changxDoc, Content.indications + "首次查房记录", firstWardRecord.get(Content.indications).get("病情记录"));
-        }
-        //主任医师首次查房记录
-        if (firstWardRecord.get(Content.director) != null) {
-            putDoc(changxDoc, Content.director + "首次查房记录", firstWardRecord.get(Content.director).get("病情记录"));
+        ThreeLevelWardDoc threeLevelWardDoc = threeLevelWardDocs.get(0);
+        List<AttendingDoctorWardDoc> attendingDocs = threeLevelWardDoc.getAttendingDoctorWardDocs();//主治医师查房记录
+        if (attendingDocs.size() > 0) {
+            //主治医师首次查房记录
+            Map<String, String> fitstAttStructureMap = attendingDocs.get(0).getStructureMap();
+            putDoc(changxDoc, Content.attend + "首次查房记录", fitstAttStructureMap.get("病情记录"));
         }
 
-        Map<String, String> lastCourseRecord = threeLevelWardAI.getLastCourseRecord(threeLevelWardDocs);
-        if (lastCourseRecord != null && lastCourseRecord.containsKey("病情记录")) {
+        List<DirectorDoctorWardDoc> directorDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();//主任医师查房记录
+        if (directorDocs.size() > 0) {
+            //主任医师首次查房记录
+            Map<String, String> fitstDirStructureMap = directorDocs.get(0).getStructureMap();
+            putDoc(changxDoc, Content.director + "首次查房记录", fitstDirStructureMap.get("病情记录"));
+
             //主任医师最后一次查房记录
-            putDoc(changxDoc, Content.director + "末次查房记录", lastCourseRecord.get("病情记录"));
+            Map<String, String> lastDirStructureMap = directorDocs.get(directorDocs.size() - 1).getStructureMap();
+            putDoc(changxDoc, Content.director + "末次查房记录", lastDirStructureMap.get("病情记录"));
         }
 
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();

+ 1 - 1
public/src/main/java/com/lantone/qc/pub/Content.java

@@ -197,7 +197,7 @@ public class Content {
     public static final String director_doctor="主任医师";
     public static final String dept_doctor="科主任";
 
-    public static final String indications="主治";
+    public static final String attend ="主治";
     public static final String director="主任";
 
     public static final String criticallyIllPatients="危重患者";

+ 5 - 1
public/src/main/java/com/lantone/qc/pub/model/doc/ward/AttendingDoctorWardDoc.java

@@ -2,6 +2,8 @@ package com.lantone.qc.pub.model.doc.ward;
 
 import com.lantone.qc.pub.model.doc.ModelDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -12,6 +14,8 @@ import java.util.List;
  * @Author : 楼辉荣
  * @Date: 2020-04-17 09:55
  */
+@Getter
+@Setter
 public class AttendingDoctorWardDoc extends ModelDoc {
-    private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
+    private ThreeLevelWardLabel threeLevelWardLabel;
 }

+ 5 - 1
public/src/main/java/com/lantone/qc/pub/model/doc/ward/DirectorDoctorWardDoc.java

@@ -2,6 +2,8 @@ package com.lantone.qc.pub.model.doc.ward;
 
 import com.lantone.qc.pub.model.doc.ModelDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -12,6 +14,8 @@ import java.util.List;
  * @Author : 楼辉荣
  * @Date: 2020-04-17 09:53
  */
+@Getter
+@Setter
 public class DirectorDoctorWardDoc extends ModelDoc {
-    private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
+    private ThreeLevelWardLabel threeLevelWardLabel;
 }

+ 4 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/ward/GeneralDoctorWardDoc.java

@@ -2,6 +2,8 @@ package com.lantone.qc.pub.model.doc.ward;
 
 import com.lantone.qc.pub.model.doc.ModelDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -12,6 +14,8 @@ import java.util.List;
  * @Author : 楼辉荣
  * @Date: 2020-04-17 09:57
  */
+@Getter
+@Setter
 public class GeneralDoctorWardDoc extends ModelDoc {
     private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
 }

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

@@ -129,11 +129,13 @@ public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
     private List<String> keyContrasts = Lists.newArrayList(
             "事件日期=记录时间",
             "事件日期=查房日期",
+            "简要病情=病情记录",
+            "查房记录=病情记录",
             "医生=记录医师"
     );
 
     public static String subTitle(String srcText) {
-        if (StringUtil.isNotBlank(srcText) && srcText.contains("代")) {
+        if (StringUtil.isNotBlank(srcText) && srcText.contains("代") && srcText.indexOf("代") != srcText.length() - 1) {
             srcText = srcText.substring(srcText.indexOf("代") + 1);
         }
         return srcText;