Forráskód Böngészése

Merge branch 'dev-1.2' into dev

rengb 5 éve
szülő
commit
55e20dd887

+ 43 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC02910.java

@@ -0,0 +1,43 @@
+package com.lantone.qc.kernel.catalogue.firstcourserecord;
+
+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.BeHospitalizedDoc;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @ClassName : FIRC02910
+ * @Description : 首次病程创建时间早于患者入院时间
+ * @Author : 胡敬
+ * @Date: 2020-06-12 14:12
+ */
+@Component
+public class FIRC02910 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        if (firstCourseRecordDoc == null || beHospitalizedDoc == null) {
+            return;
+        }
+        Map<String, String> firstRecordMap = firstCourseRecordDoc.getStructureMap();
+        Map<String, String> beHospitalizedMap = beHospitalizedDoc.getStructureMap();
+        String createDateStr = firstRecordMap.get("记录时间");
+        String beHospitalDateStr = beHospitalizedMap.get("入院日期");
+        if (StringUtil.isNotBlank(createDateStr) && StringUtil.isNotBlank(beHospitalDateStr)) {
+            Date createDate = StringUtil.parseDateTime(createDateStr);
+            Date beHospitalDate = StringUtil.parseDateTime(beHospitalDateStr);
+            if (createDate != null && beHospitalDate != null) {
+                if (createDate.before(beHospitalDate)) {
+                    status.set("-1");
+                }
+            }
+        }
+    }
+}

+ 124 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR02911.java

@@ -0,0 +1,124 @@
+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.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : THR02911
+ * @Description : 非一助代主刀医师查房
+ * @Author : 胡敬
+ * @Date: 2020-06-12 14:39
+ */
+@Component
+public class THR02911 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        if (inputInfo.getThreeLevelWardDocs().size() == 0 || inputInfo.getOperationDocs().size() == 0) {
+            return;
+        }
+        ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+        if (allDoctorWradDocs.size() == 0 || operationDocs.size() == 0) {
+            return;
+        }
+
+        for (ThreeLevelWardDoc wardDoc : allDoctorWradDocs) {
+            Map<String, String> wardMap = wardDoc.getStructureMap();
+            String title = wardMap.get("查房标题");
+            String wardDateStr = wardMap.get("查房日期");
+            if (StringUtil.isBlank(title) || StringUtil.isBlank(wardDateStr)) {
+                continue;
+            }
+            Date wardDate = StringUtil.parseDateTime(wardDateStr);
+            if (wardDate == null) {
+                continue;
+            }
+            if (title.contains("一助") && title.contains("代") && title.contains("主刀")) {
+                String firstAssistant = getFirstAssistant(operationDocs, wardDate);
+                if (StringUtil.isNotBlank(firstAssistant) && !title.contains(firstAssistant)) {
+                    status.set("-1");
+                    return;
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取主刀医师/一助职称(取距离查房记录时间最近的一次手术记录)
+     *
+     * @param operationDocs
+     * @return
+     */
+    public static String getFirstAssistant(List<OperationDoc> operationDocs, Date recordDate) {
+        String name = "";
+        /* 用于存放手术结束时间距离查房时间最近的一次时间差 */
+        long timeDiff = 0L;
+        for (OperationDoc operationDoc : operationDocs) {
+            OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
+            if (operationRecordDoc == null) {
+                continue;
+            }
+            Map<String, String> structureMap = operationRecordDoc.getStructureMap();
+            String firstAssistant = structureMap.get("一助");
+            String operatorEndDateStr = structureMap.get("手术结束时间");
+            if (StringUtil.isBlank(firstAssistant) || StringUtil.isBlank(operatorEndDateStr)) {
+                continue;
+            }
+            Date operatorEndDate = StringUtil.parseDateTime(operatorEndDateStr);
+            if (operatorEndDate != null) {
+                long timeDifference = timeDifference(operatorEndDate, recordDate);
+                if (timeDifference == 0){
+                    continue;
+                }
+                if (timeDiff == 0 || timeDiff > timeDifference) {
+                    /* 取距离此次主刀医师查房最近的一次手术时间 */
+                    timeDiff = timeDifference;
+                    name = firstAssistant;
+                }
+            }
+        }
+        return name;
+    }
+
+    public static long timeDifference(Date firstDate, Date secondDate) {
+        long timeDifference = 0L;
+        if (firstDate == null || secondDate == null) {
+            return timeDifference;
+        }
+        boolean flag = false;
+        if (firstDate.before(secondDate)) {
+            flag = true;
+        }
+        Calendar calendarS = Calendar.getInstance();
+        Calendar calendarE = Calendar.getInstance();
+        long timeS, timeE;
+        try {
+            calendarS.setTime(firstDate);
+            calendarE.setTime(secondDate);
+
+            timeS = calendarS.getTimeInMillis();
+            timeE = calendarE.getTimeInMillis();
+
+            if (flag) {
+                timeDifference = (timeE - timeS) / (1000 * 60);
+            } else {
+                timeDifference = (timeS - timeE) / (1000 * 60);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return timeDifference;
+    }
+}

+ 3 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java

@@ -449,6 +449,9 @@ public class CatalogueUtil {
                 Date operatorEndDate = StringUtil.parseDateTime(operatorEndDateStr);
                 if (operatorEndDate != null) {
                     long timeDifference = timeDifference(operatorEndDate, recordDate);
+                    if (timeDifference == 0){
+                        continue;
+                    }
                     if (timeDiff == 0 || timeDiff > timeDifference) {
                         /* 取距离此次主刀医师查房最近的一次手术时间 */
                         timeDiff = timeDifference;

+ 3 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxThreeLevelWardDocTrans.java

@@ -254,6 +254,9 @@ public class ChangxThreeLevelWardDocTrans extends ModelDocTrans {
                 Date operatorEndDate = StringUtil.parseDateTime(operatorEndDateStr);
                 if (operatorEndDate != null) {
                     long timeDifference = timeDifference(operatorEndDate, recordDate);
+                    if (timeDifference == 0){
+                        continue;
+                    }
                     if (timeDiff == 0 || timeDiff > timeDifference) {
                         /* 取距离此次主刀医师查房最近的一次手术时间 */
                         timeDiff = timeDifference;