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

添加死亡记录规则

hujing 5 éve
szülő
commit
5ad1ecb171

+ 15 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0337.java

@@ -1,6 +1,7 @@
 package com.lantone.qc.kernel.catalogue.deathrecord;
 
 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 org.springframework.stereotype.Component;
@@ -8,13 +9,25 @@ import org.springframework.stereotype.Component;
 import java.util.Map;
 
 /**
- * @ClassName : CLI0001
- * @Description : 无输血/血制品病程记录
+ * @ClassName : DEAR0337
+ * @Description : 死亡记录未在患者离院前完成
  * @Author : 楼辉荣
  * @Date: 2020-03-06 17:28
  */
 @Component
 public class DEAR0337 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null
+                && inputInfo.getLeaveHospitalDoc() != null && inputInfo.getLeaveHospitalDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructure = inputInfo.getDeathRecordDoc().getStructureMap();
+            Map<String, String> leaveHospitalStructure = inputInfo.getLeaveHospitalDoc().getStructureMap();
+            String recordTime = deathRecordStructure.get("记录时间");
+            String signTime = leaveHospitalStructure.get("签名时间");
+            //如果死亡记录时间比出院小结签名时间晚
+            if(CatalogueUtil.compareDate(recordTime,signTime,-1)){
+                status = "-1";
+            }
+        }
     }
 }

+ 36 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0339.java

@@ -0,0 +1,36 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0339
+ * @Description : 死亡记录无主诉
+ * @Author : 胡敬
+ * @Date: 2020-03-18 19:44
+ */
+@Component
+public class DEAR0339 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null
+                && inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getChiefLabel() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            String chiefText = inputInfo.getBeHospitalizedDoc().getChiefLabel().getText();
+            String admissionStatus = deathRecordStructureMap.get("入院情况");
+            if (CatalogueUtil.isEmpty(admissionStatus) || CatalogueUtil.isEmpty(chiefText)) {
+                return;
+            }
+            chiefText = CatalogueUtil.removeSpecialChar(chiefText).replace("。", "");
+            admissionStatus = CatalogueUtil.removeSpecialChar(admissionStatus).replace("。", "");
+            if (!admissionStatus.contains(chiefText)) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 28 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0340.java

@@ -0,0 +1,28 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0340
+ * @Description : 死亡记录无入院情况
+ * @Author : 胡敬
+ * @Date: 2020-03-18 17:14
+ */
+@Component
+public class DEAR0340 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("入院情况"))) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 28 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0341.java

@@ -0,0 +1,28 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0341
+ * @Description : 死亡记录无入院诊断
+ * @Author : 胡敬
+ * @Date: 2020-03-18 17:14
+ */
+@Component
+public class DEAR0341 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("入院诊断"))) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 28 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0342.java

@@ -0,0 +1,28 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0342
+ * @Description : 死亡记录无诊疗经过
+ * @Author : 胡敬
+ * @Date: 2020-03-18 17:14
+ */
+@Component
+public class DEAR0342 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("诊疗经过"))) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 32 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0343.java

@@ -0,0 +1,32 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0343
+ * @Description : 死亡记录无病情演变
+ * @Author : 胡敬
+ * @Date: 2020-03-18 17:14
+ */
+@Component
+public class DEAR0343 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            String diagnosisTreatmentProcess = deathRecordStructureMap.get("诊疗经过");
+            if (CatalogueUtil.isEmpty(diagnosisTreatmentProcess)) {
+                return;
+            }
+            if (!diagnosisTreatmentProcess.contains("加重") && !diagnosisTreatmentProcess.contains("抢救")) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 32 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0344.java

@@ -0,0 +1,32 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0344
+ * @Description : 死亡记录无抢救经过
+ * @Author : 胡敬
+ * @Date: 2020-03-18 18:35
+ */
+@Component
+public class DEAR0344 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            String diagnosisTreatmentProcess = deathRecordStructureMap.get("诊疗经过");
+            if (CatalogueUtil.isEmpty(diagnosisTreatmentProcess)) {
+                return;
+            }
+            if (!diagnosisTreatmentProcess.contains("抢救")) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 28 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0345.java

@@ -0,0 +1,28 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0345
+ * @Description : 死亡记录无死亡原因
+ * @Author : 胡敬
+ * @Date: 2020-03-18 18:37
+ */
+@Component
+public class DEAR0345 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("死亡原因"))) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 28 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0346.java

@@ -0,0 +1,28 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0346
+ * @Description : 死亡记录无死亡诊断
+ * @Author : 胡敬
+ * @Date: 2020-03-18 18:38
+ */
+@Component
+public class DEAR0346 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("死亡诊断"))) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 28 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0347.java

@@ -0,0 +1,28 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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 org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0347
+ * @Description : 死亡记录无死亡时间
+ * @Author : 胡敬
+ * @Date: 2020-03-18 18:38
+ */
+@Component
+public class DEAR0347 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            if (CatalogueUtil.isEmpty(deathRecordStructureMap.get("死亡时间"))) {
+                status = "-1";
+            }
+        }
+    }
+}

+ 54 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0371.java

@@ -0,0 +1,54 @@
+package com.lantone.qc.kernel.catalogue.deathrecord;
+
+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;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : DEAR0371
+ * @Description : 死亡记录里死亡时间未精确到分
+ * @Author : 胡敬
+ * @Date: 2020-03-18 18:38
+ */
+@Component
+public class DEAR0371 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
+            Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
+            String deathTime = deathRecordStructureMap.get("死亡时间");
+            if (CatalogueUtil.isEmpty(deathTime)) {
+                return;
+            }
+            Date deathDate = StringUtil.parseDateTime(CatalogueUtil.removeSpecialChar(deathTime)
+                    , processDateFormat(Content.dateFormats));
+            if (null == deathDate) {
+                status = "-1";
+            }
+        }
+    }
+
+    /**
+     * 只保留Date精确到分的格式
+     *
+     * @param dateFormats
+     * @return
+     */
+    private String[] processDateFormat(String[] dateFormats) {
+        List<String> dateFormatsList = Arrays.asList(dateFormats);
+        List<String> dateFormatsNew = new ArrayList<>(dateFormatsList);
+        dateFormatsNew.removeIf(dateFormat -> dateFormat.contains("s") || !dateFormat.contains("m"));
+        String[] dateFormatsArr = new String[dateFormatsNew.size()];
+        return dateFormatsNew.toArray(dateFormatsArr);
+    }
+}

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

@@ -137,6 +137,27 @@ public class CatalogueUtil {
         return false;
     }
 
+    /**
+     * 对比两个String类型的Date先后
+     * @param firstDateStr
+     * @param secondDateStr
+     * @param symbol   =1 -> firstDateStr比secondDateStr时间早
+     * @param symbol   =-1 -> firstDateStr比secondDateStr时间晚
+     * @return
+     */
+    public static boolean compareDate(String firstDateStr, String secondDateStr,int symbol) {
+        if (!isEmpty(firstDateStr) && !isEmpty(secondDateStr)) {
+            Date firstDate = StringUtil.parseDateTime(firstDateStr);
+            Date secondDate = StringUtil.parseDateTime(secondDateStr);
+            if (symbol == 1){
+                return firstDate != null && secondDate != null && firstDate.before(secondDate);
+            } else if (symbol == -1){
+                return firstDate != null && secondDate != null && firstDate.after(secondDate);
+            }
+        }
+        return false;
+    }
+
     /**
      * 对比两个去除了特殊字符的字符串是否一致
      * @param firstStr

+ 1 - 1
public/src/main/java/com/lantone/qc/pub/Content.java

@@ -230,7 +230,7 @@ public class Content {
 
     public static final String timestamp = "timestamp";
 
-    public static String[] DateFormats = {
+    public static String[] dateFormats = {
             "yyyy年MM月dd日HH时mm分",
             "yyyy年MM月dd日H时mm分",
             "yyyy年MM月dd日HH时m分",

+ 1 - 2
public/src/main/java/com/lantone/qc/pub/model/keys/ModelStandardKeys.java

@@ -87,7 +87,6 @@ public class ModelStandardKeys {
             "记录医师",
             "入院时间",
             "死亡时间",
-            "死亡原因",
             "入院诊断",
             "死亡诊断",
             "讨论时间",
@@ -110,7 +109,7 @@ public class ModelStandardKeys {
             "死亡时间",
             "入院情况",
             "发病经过",
-            "入院情况",
+            "入院诊断",
             "诊疗经过",
             "死亡原因",
             "死亡诊断",

+ 25 - 2
public/src/main/java/com/lantone/qc/pub/util/StringUtil.java

@@ -9,7 +9,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
-import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -190,7 +189,31 @@ public class StringUtil {
             }
 
             if (datetime.length() > 0) {
-                date = DateUtils.parseDate(datetime, Content.DateFormats);
+                date = DateUtils.parseDate(datetime, Content.dateFormats);
+            }
+        } catch (ParseException ex) {
+            ex.printStackTrace();
+        } finally {
+            return date;
+        }
+    }
+
+    /**
+     * 根据给定的时间格式解析时间
+     *
+     * @param datetime
+     * @return
+     */
+    public static Date parseDateTime(String datetime,String[] dateFormats) {
+        Date date = null;
+        try {
+            datetime = remove_ctl(datetime);
+
+            if (datetime.contains("至")) {
+                datetime = datetime.split("至")[1].replaceAll("[\\u4e00-\\u9fa5]", "");
+            }
+            if (datetime.length() > 0) {
+                date = DateUtils.parseDate(datetime, dateFormats);
             }
         } catch (ParseException ex) {
             ex.printStackTrace();