소스 검색

无出院记录

zhaops 3 년 전
부모
커밋
09f890e71a
1개의 변경된 파일62개의 추가작업 그리고 16개의 파일을 삭제
  1. 62 16
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0507.java

+ 62 - 16
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0507.java

@@ -4,13 +4,19 @@ import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.DeathCaseDiscussDoc;
 import com.lantone.qc.pub.model.doc.DeathRecordDoc;
-import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
+import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
+import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
+import com.lantone.qc.pub.model.doc.RescueDoc;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
-import java.util.Map;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 无出院记录
@@ -22,22 +28,62 @@ import java.util.Map;
 public class LEA0507 extends QCCatalogue {
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        /**
+         * 1.获取【住院信息表】,存在出院时间的病人。有则继续
+         * 2.根据【住院信息表】入院时间和出院时间判断超过24小时则继续
+         * 2.判断是否是死亡病人,存在“死亡”医嘱,排除“死亡蛋白”医嘱;存在【抢救记录】并抢救文书内包含“死亡”;存在【死亡记录】;存在【死亡病例讨论记录】。上述情况任意一种存在不报
+         * 3.非死亡病人,无【出院记录/出院小结】文书则报出。
+         */
         status.set("0");
-        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
-        if (firstPageRecordDoc == null) {
+        MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
+        List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
+        List<RescueDoc> rescueDocs = inputInfo.getRescueDocs();
+        DeathCaseDiscussDoc deathCaseDiscussDoc = inputInfo.getDeathCaseDiscussDoc();
+        DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+
+        if (medicalRecordInfoDoc == null
+                || medicalRecordInfoDoc.getStructureMap() == null
+                || StringUtil.isBlank(medicalRecordInfoDoc.getStructureMap().get("leaveHospitalDate"))) {
             return;
         }
-        Map<String, String> pageMap = firstPageRecordDoc.getStructureMap();
-        DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
-        if (deathRecordDoc == null) {
-            String outDate = pageMap.get("出院时间");
-            String inDate = pageMap.get("入院时间");
-            Date infusionEndDate = StringUtil.parseDateTime(inDate);
-            Date recordDate = StringUtil.parseDateTime(outDate);
-
-            if (CatalogueUtil.compareTime(infusionEndDate, recordDate, 24 * 60L) && inputInfo.getLeaveHospitalDoc() == null) {
-                status.set("-1");
-            }
+
+        String outDate = medicalRecordInfoDoc.getStructureMap().get("leaveHospitalDate");
+        String inDate = medicalRecordInfoDoc.getStructureMap().get("behospitalDate");
+        Date infusionEndDate = StringUtil.parseDateTime(inDate);
+        Date recordDate = StringUtil.parseDateTime(outDate);
+        if (!CatalogueUtil.compareTime(infusionEndDate, recordDate, 24 * 60L)) {
+            return;
+        }
+
+        //是否死亡患者
+        Boolean death = false;
+        if (ListUtil.isNotEmpty(doctorAdviceDocs)
+                && doctorAdviceDocs.stream().filter(i -> i.getStructureMap() != null
+                        && StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
+                        && i.getStructureMap().get("医嘱项目名称").contains("死亡")
+                        && !i.getStructureMap().get("医嘱项目名称").contains("死亡蛋白"))
+                .collect(Collectors.toList()).size() > 0) {
+            death = true;
+        }
+        if (ListUtil.isNotEmpty(rescueDocs)
+                && rescueDocs.stream().filter(i -> i.getStructureMap() != null
+                        && StringUtil.isNotBlank(i.getStructureMap().get("抢救内容"))
+                        && i.getStructureMap().get("抢救内容").contains("死亡"))
+                .collect(Collectors.toList()).size() > 0) {
+            death = true;
+        }
+        if (deathRecordDoc != null || deathCaseDiscussDoc != null) {
+            death = true;
+        }
+
+        if (death) {
+            return;
+        }
+
+        //非死亡患者
+        if (leaveHospitalDoc == null) {
+            status.set("-1");
         }
     }
-}
+}