소스 검색

三级查房规则修改

hujing 5 년 전
부모
커밋
aff51c16d4

+ 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("-1");
+                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("-1");
+                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;

+ 73 - 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, String> doctorRecord = extractWardRecord(
+                    threeLevelWardDocs,
+                    admisTime,
+                    48 * 60);
+            if (doctorRecord.containsKey(Content.indications)) {
+                if (doctorRecord.get("病情记录").contains("鉴别诊断")) {
+                    return;
+                }
+            }
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
                 if (threeLevelWardLabel == null
@@ -37,4 +57,56 @@ public class THR0131 extends QCCatalogue {
             }
         }
     }
+
+    /**
+     * 抽取住院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("查房标题");
+                wardTitle = StringUtil.isBlank(wardTitle) ? "" : wardTitle;
+                dateRecord.put(recordDate, wardTitle);
+            }
+        }
+        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;
+    }
 }

+ 76 - 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, String> doctorRecord = extractWardRecord(
+                    threeLevelWardDocs,
+                    admisTime,
+                    72 * 60);
+            if (doctorRecord.containsKey(Content.director)) {
+                if (doctorRecord.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,56 @@ public class THR0136 extends QCCatalogue {
             }
         }
     }
+
+    /**
+     * 抽取住院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("查房标题");
+                wardTitle = StringUtil.isBlank(wardTitle) ? "" : wardTitle;
+                dateRecord.put(recordDate, wardTitle);
+            }
+        }
+        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;
+    }
 }