Browse Source

Merge remote-tracking branch 'origin/master'

weixuanhuang 5 years ago
parent
commit
e0494d0faf

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

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

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

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

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

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

+ 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;

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

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

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

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

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

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

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

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