Преглед изворни кода

1、长兴更新 修改病危病重逻辑

louhr пре 5 година
родитељ
комит
896f632723

+ 1 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/dutyshiftsystem/DUT0296.java

@@ -188,6 +188,7 @@ public class DUT0296 extends QCCatalogue {
         try {
             Date dateIn = StringUtil.parseDateTime(beDate);
             Date dateOut = StringUtil.parseDateTime(leaveDate);
+            if (dateIn == null || dateOut == null) return 0;
             Calendar from = Calendar.getInstance();
             from.setTime(dateIn);
             Calendar to = Calendar.getInstance();

+ 36 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03023.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.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
@@ -8,6 +9,7 @@ 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.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -30,12 +32,26 @@ public class THR03023 extends QCCatalogue {
          * 1、有病重医嘱、查房记录。
          * 2、第一个病重医嘱的开始时间当天有查房记录,结束时间有查房记录。
          * 3、每2天有查房记录。
+         * 4、如果医嘱结束时间大于出院时间,那以出院时间为结束时间
+         * 5、首程也算第一次查房
          */
         status.set("0");
         if (ListUtil.isEmpty(inputInfo.getDoctorAdviceDocs()) ||
                 ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
+
+        String leaveDateString = "";
+        Date leaveDate = null;
+        if (inputInfo.getLeaveHospitalDoc() != null) {
+            leaveDateString = inputInfo.getLeaveHospitalDoc().getStructureMap().get("出院时间");
+        } else if (inputInfo.getDeathRecordDoc() != null) {
+            leaveDateString = inputInfo.getDeathRecordDoc().getStructureMap().get("死亡时间");
+        }
+        if (StringUtils.isNotEmpty(leaveDateString)) {
+            leaveDate = StringUtil.parseDateTime(leaveDateString);
+        }
+
         List<DoctorAdviceDoc> doctorAdviceDocList = inputInfo.getDoctorAdviceDocs();
         List<List<Date>> doctorAdviceDate = new ArrayList<>();
 
@@ -49,6 +65,10 @@ public class THR03023 extends QCCatalogue {
                 if (StringUtil.isNotBlank(startDateStr) && StringUtil.isNotBlank(endDateStr)) {
                     Date startDate = StringUtil.parseDateTime(startDateStr);
                     Date endDate = StringUtil.parseDateTime(endDateStr);
+                    //如果医嘱结束时间大于出院时间,那以出院时间为结束时间
+                    if (leaveDate != null && leaveDate.before(endDate)) {
+                        endDate = leaveDate;
+                    }
                     if (startDate.before(endDate)) {
                         List<Date> listDate = new ArrayList<>();
                         listDate.add(DateUtil.dateZeroClear(startDate));
@@ -75,6 +95,15 @@ public class THR03023 extends QCCatalogue {
             }
         }
 
+        //首程也算第一次查房
+        if (inputInfo.getFirstCourseRecordDoc() != null) {
+            String recordTime = inputInfo.getFirstCourseRecordDoc().getStructureMap().get("病历日期");
+            if (StringUtils.isNotEmpty(recordTime)) {
+                Date recordDate = StringUtil.parseDateTime(recordTime);
+                dateRecordDay.add(DateUtil.dateZeroClear(recordDate));
+            }
+        }
+
         if (ListUtil.isEmpty(dateRecordDay)) {
             return ;
         }
@@ -95,17 +124,20 @@ public class THR03023 extends QCCatalogue {
 
         // 医嘱开始时间当天有查房记录
         if (!dateRecordDay.contains(doctorDateStart)) {
+            info.set(DateUtil.formatDate(doctorDateStart));
             status.set("-1");
             return ;
         }
         // 医嘱结束时间当天有查房记录
         if (!dateRecordDay.contains(doctorDateEnd)) {
+            info.set(DateUtil.formatDate(doctorDateEnd));
             status.set("-1");
             return ;
         }
         int flag = 0;
         Date nextDate = doctorDateStart;
         int returnFlag = 0; // 防止出现死循环系统崩溃
+        String infoStr = "";
         while(returnFlag <= 1000) {
             if (!dateRecordDay.contains(nextDate)) {
                 flag++;
@@ -114,7 +146,7 @@ public class THR03023 extends QCCatalogue {
             }
             if (flag == 2) {
                 status.set("-1");
-                return ;
+                infoStr = CatalogueUtil.concatInfo(infoStr, DateUtil.formatDate(nextDate));
             }
             nextDate = DateUtil.addDate(nextDate, 1);
             if (nextDate.after(doctorDateEnd)) {
@@ -122,5 +154,8 @@ public class THR03023 extends QCCatalogue {
             }
             returnFlag++; // 防止出现死循环系统崩溃
         }
+        if (StringUtils.isNotEmpty(infoStr)) {
+            info.set(infoStr);
+        }
     }
 }

+ 36 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03024.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.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
@@ -8,6 +9,7 @@ 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.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -30,12 +32,25 @@ public class THR03024 extends QCCatalogue {
          * 1、有病危医嘱、查房记录。
          * 2、第一个危重医嘱的开始时间当天有查房记录,结束时间有查房记录。
          * 3、每天有查房记录。
+         * 4、如果医嘱结束时间大于出院时间,那以出院时间为结束时间
+         * 5、首程也算第一次查房
          */
         status.set("0");
         if (ListUtil.isEmpty(inputInfo.getDoctorAdviceDocs()) ||
                 ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
+        String leaveDateString = "";
+        Date leaveDate = null;
+        if (inputInfo.getLeaveHospitalDoc() != null) {
+            leaveDateString = inputInfo.getLeaveHospitalDoc().getStructureMap().get("出院时间");
+        } else if (inputInfo.getDeathRecordDoc() != null) {
+            leaveDateString = inputInfo.getDeathRecordDoc().getStructureMap().get("死亡时间");
+        }
+        if (StringUtils.isNotEmpty(leaveDateString)) {
+            leaveDate = StringUtil.parseDateTime(leaveDateString);
+        }
+
         List<DoctorAdviceDoc> doctorAdviceDocList = inputInfo.getDoctorAdviceDocs();
         List<List<Date>> doctorAdviceDate = new ArrayList<>();
 
@@ -49,6 +64,10 @@ public class THR03024 extends QCCatalogue {
                 if (StringUtil.isNotBlank(startDateStr) && StringUtil.isNotBlank(endDateStr)) {
                     Date startDate = StringUtil.parseDateTime(startDateStr);
                     Date endDate = StringUtil.parseDateTime(endDateStr);
+                    //如果医嘱结束时间大于出院时间,那以出院时间为结束时间
+                    if (leaveDate != null && leaveDate.before(endDate)) {
+                        endDate = leaveDate;
+                    }
                     if (startDate.before(endDate)) {
                         List<Date> listDate = new ArrayList<>();
                         listDate.add(DateUtil.dateZeroClear(startDate));
@@ -69,8 +88,16 @@ public class THR03024 extends QCCatalogue {
         for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
             Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
             String recordTime = rescueStructureMap.get("查房日期");
-            Date recordDate = StringUtil.parseDateTime(recordTime);
-            if (recordDate != null) {
+            if (StringUtils.isNotEmpty(recordTime)) {
+                Date recordDate = StringUtil.parseDateTime(recordTime);
+                dateRecordDay.add(DateUtil.dateZeroClear(recordDate));
+            }
+        }
+        //首程也算第一次查房
+        if (inputInfo.getFirstCourseRecordDoc() != null) {
+            String recordTime = inputInfo.getFirstCourseRecordDoc().getStructureMap().get("病历日期");
+            if (StringUtils.isNotEmpty(recordTime)) {
+                Date recordDate = StringUtil.parseDateTime(recordTime);
                 dateRecordDay.add(DateUtil.dateZeroClear(recordDate));
             }
         }
@@ -95,20 +122,23 @@ public class THR03024 extends QCCatalogue {
 
         // 医嘱开始时间当天有查房记录
         if (!dateRecordDay.contains(doctorDateStart)) {
+            info.set(DateUtil.formatDate(doctorDateStart));
             status.set("-1");
             return ;
         }
         // 医嘱结束时间当天有查房记录
         if (!dateRecordDay.contains(doctorDateEnd)) {
+            info.set(DateUtil.formatDate(doctorDateEnd));
             status.set("-1");
             return ;
         }
         Date nextDate = doctorDateStart;
         int returnFlag = 0; // 防止出现死循环系统崩溃
+        String infoStr = "";
         while(returnFlag <= 1000) {
             if (!dateRecordDay.contains(nextDate)) {
                 status.set("-1");
-                return ;
+                infoStr = CatalogueUtil.concatInfo(infoStr, DateUtil.formatDate(nextDate));
             }
             nextDate = DateUtil.addDate(nextDate, 1);
             if (nextDate.after(doctorDateEnd)) {
@@ -116,5 +146,8 @@ public class THR03024 extends QCCatalogue {
             }
             returnFlag++; // 防止出现死循环系统崩溃
         }
+        if (StringUtils.isNotEmpty(infoStr)) {
+            info.set(infoStr);
+        }
     }
 }