Kaynağa Gözat

Merge remote-tracking branch 'origin/dev-shaoyf' into dev-shaoyf

rengb 5 yıl önce
ebeveyn
işleme
3e25d44859

+ 126 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03023.java

@@ -0,0 +1,126 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+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 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.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : THR03023
+ * @Description : 病重少于每2天记录1次
+ * @Author : zhoutg
+ * @Date: 2020-03-28 14:22
+ */
+@Component
+public class THR03023 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        /**
+         * 1、有病重医嘱、查房记录。
+         * 2、第一个病重医嘱的开始时间当天有查房记录,结束时间有查房记录。
+         * 3、每2天有查房记录。
+         */
+        status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getDoctorAdviceDocs()) ||
+                ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
+            return;
+        }
+        List<DoctorAdviceDoc> doctorAdviceDocList = inputInfo.getDoctorAdviceDocs();
+        List<List<Date>> doctorAdviceDate = new ArrayList<>();
+
+        // 目前只判断第一个病重医嘱
+        for (DoctorAdviceDoc bean : doctorAdviceDocList) {
+            Map<String, String> structureMap = bean.getStructureMap();
+            String name = structureMap.get("医嘱项目名称");
+            if (StringUtil.isNotBlank(name) && name.contains("病重")) {
+                String startDateStr = structureMap.get("医嘱开始时间");
+                String endDateStr = structureMap.get("医嘱结束时间");
+                if (StringUtil.isNotBlank(startDateStr) && StringUtil.isNotBlank(endDateStr)) {
+                    Date startDate = StringUtil.parseDateTime(startDateStr);
+                    Date endDate = StringUtil.parseDateTime(endDateStr);
+                    if (startDate.before(endDate)) {
+                        List<Date> listDate = new ArrayList<>();
+                        listDate.add(DateUtil.dateZeroClear(startDate));
+                        listDate.add(DateUtil.dateZeroClear(endDate));
+                        doctorAdviceDate.add(listDate);
+                        break;
+                    }
+                }
+            }
+        }
+
+        if (ListUtil.isEmpty(doctorAdviceDate)) {
+            return ;
+        }
+        List<Date> dateRecordDay = new ArrayList<>();
+
+        List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();//查房记录
+        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
+            Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
+            String recordTime = rescueStructureMap.get("查房日期");
+            Date recordDate = StringUtil.parseDateTime(recordTime);
+            if (recordDate != null) {
+                dateRecordDay.add(DateUtil.dateZeroClear(recordDate));
+            }
+        }
+
+        if (ListUtil.isEmpty(dateRecordDay)) {
+            return ;
+        }
+
+        // 时间正序排列
+        Collections.sort(dateRecordDay, new Comparator<Date>() {
+            public int compare(Date o1, Date o2) {
+                int flag = o1.compareTo(o2);
+                return flag;
+            }
+        });
+
+        // 医嘱开始时间和结束时间当天必须要有查房记录
+        Date dateStart = dateRecordDay.get(0); // 查房第一个时间
+        Date dateEnd = dateRecordDay.get(dateRecordDay.size() - 1);// 查房最后一个时间
+        Date doctorDateStart = doctorAdviceDate.get(0).get(0); // 医嘱开始时间
+        Date doctorDateEnd = doctorAdviceDate.get(0).get(1); // 医嘱结束时间
+
+        // 医嘱开始时间当天有查房记录
+        if (!dateRecordDay.contains(doctorDateStart)) {
+            status.set("-1");
+            return ;
+        }
+        // 医嘱结束时间当天有查房记录
+        if (!dateRecordDay.contains(doctorDateEnd)) {
+            status.set("-1");
+            return ;
+        }
+        int flag = 0;
+        Date nextDate = doctorDateStart;
+        int returnFlag = 0; // 防止出现死循环系统崩溃
+        while(returnFlag <= 1000) {
+            if (!dateRecordDay.contains(nextDate)) {
+                flag++;
+            } else {
+                flag = 0;
+            }
+            if (flag == 2) {
+                status.set("-1");
+                return ;
+            }
+            nextDate = DateUtil.addDate(nextDate, 1);
+            if (nextDate.after(doctorDateEnd)) {
+                return ;
+            }
+            returnFlag++; // 防止出现死循环系统崩溃
+        }
+    }
+}

+ 120 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03024.java

@@ -0,0 +1,120 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+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 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.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : THR03024
+ * @Description : 病危没有每天或随时记录
+ * @Author : zhoutg
+ * @Date: 2020-03-28 14:22
+ */
+@Component
+public class THR03024 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        /**
+         * 1、有病危医嘱、查房记录。
+         * 2、第一个危重医嘱的开始时间当天有查房记录,结束时间有查房记录。
+         * 3、每天有查房记录。
+         */
+        status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getDoctorAdviceDocs()) ||
+                ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
+            return;
+        }
+        List<DoctorAdviceDoc> doctorAdviceDocList = inputInfo.getDoctorAdviceDocs();
+        List<List<Date>> doctorAdviceDate = new ArrayList<>();
+
+        // 目前只判断第一个病重医嘱
+        for (DoctorAdviceDoc bean : doctorAdviceDocList) {
+            Map<String, String> structureMap = bean.getStructureMap();
+            String name = structureMap.get("医嘱项目名称");
+            if (StringUtil.isNotBlank(name) && name.contains("病危")) {
+                String startDateStr = structureMap.get("医嘱开始时间");
+                String endDateStr = structureMap.get("医嘱结束时间");
+                if (StringUtil.isNotBlank(startDateStr) && StringUtil.isNotBlank(endDateStr)) {
+                    Date startDate = StringUtil.parseDateTime(startDateStr);
+                    Date endDate = StringUtil.parseDateTime(endDateStr);
+                    if (startDate.before(endDate)) {
+                        List<Date> listDate = new ArrayList<>();
+                        listDate.add(DateUtil.dateZeroClear(startDate));
+                        listDate.add(DateUtil.dateZeroClear(endDate));
+                        doctorAdviceDate.add(listDate);
+                        break;
+                    }
+                }
+            }
+        }
+
+        if (ListUtil.isEmpty(doctorAdviceDate)) {
+            return ;
+        }
+        List<Date> dateRecordDay = new ArrayList<>();
+
+        List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();//查房记录
+        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
+            Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
+            String recordTime = rescueStructureMap.get("查房日期");
+            Date recordDate = StringUtil.parseDateTime(recordTime);
+            if (recordDate != null) {
+                dateRecordDay.add(DateUtil.dateZeroClear(recordDate));
+            }
+        }
+
+        if (ListUtil.isEmpty(dateRecordDay)) {
+            return ;
+        }
+
+        // 时间正序排列
+        Collections.sort(dateRecordDay, new Comparator<Date>() {
+            public int compare(Date o1, Date o2) {
+                int flag = o1.compareTo(o2);
+                return flag;
+            }
+        });
+
+        // 医嘱开始时间和结束时间当天必须要有查房记录
+        Date dateStart = dateRecordDay.get(0); // 查房第一个时间
+        Date dateEnd = dateRecordDay.get(dateRecordDay.size() - 1);// 查房最后一个时间
+        Date doctorDateStart = doctorAdviceDate.get(0).get(0); // 医嘱开始时间
+        Date doctorDateEnd = doctorAdviceDate.get(0).get(1); // 医嘱结束时间
+
+        // 医嘱开始时间当天有查房记录
+        if (!dateRecordDay.contains(doctorDateStart)) {
+            status.set("-1");
+            return ;
+        }
+        // 医嘱结束时间当天有查房记录
+        if (!dateRecordDay.contains(doctorDateEnd)) {
+            status.set("-1");
+            return ;
+        }
+        Date nextDate = doctorDateStart;
+        int returnFlag = 0; // 防止出现死循环系统崩溃
+        while(returnFlag <= 1000) {
+            if (!dateRecordDay.contains(nextDate)) {
+                status.set("-1");
+                return ;
+            }
+            nextDate = DateUtil.addDate(nextDate, 1);
+            if (nextDate.after(doctorDateEnd)) {
+                return ;
+            }
+            returnFlag++; // 防止出现死循环系统崩溃
+        }
+    }
+}