ソースを参照

产科规则:入院主诉时间与疑难病例讨论中主诉时间不一致 && 新生儿出生体重错误

zhanghang 3 年 前
コミット
993bf4dd5f

+ 87 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH03332.java

@@ -0,0 +1,87 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+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.model.doc.BeHospitalizedDoc;
+import com.lantone.qc.pub.model.doc.DifficultCaseDiscussDoc;
+import com.lantone.qc.pub.model.label.ChiefLabel;
+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.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @ClassName : BEH03332
+ * @Description : 入院主诉时间与疑难病例讨论中主诉时间不一致
+ * @Author : zhanghang
+ * @Date: 2022-04-13 13:54
+ */
+@Component
+public class BEH03332 extends QCCatalogue {
+
+    @Override
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        String sjzz = Content.SJZZ;
+        List<String> timeZZ = new ArrayList<>();
+        //获取主诉
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        //入院记录为空则返回
+        if (beHospitalizedDoc == null) {
+            return;
+        }
+        ChiefLabel chiefLabel = beHospitalizedDoc.getChiefLabel();
+        String chiefLabelText = chiefLabel.getText();
+        if (chiefLabel == null || StringUtil.isEmpty(chiefLabelText)) {
+            return;
+        }
+        String rex="([0-9一二三四五六七八九十百]{1,5})";
+        String rex2="([天日周年月]|星期)";
+        Pattern pattern = Pattern.compile(sjzz);
+        Pattern patternOne = Pattern.compile(rex);
+        Pattern patternTwo = Pattern.compile(rex2);
+        Matcher ma = pattern.matcher(chiefLabelText);
+        while (ma.find()) {
+            StringBuilder sb = new StringBuilder();
+            String group = ma.group();
+            Matcher maOne = patternOne.matcher(group);
+            Matcher maTwo = patternTwo.matcher(group);
+            boolean one = maOne.find();
+            boolean two = maTwo.find();
+            String groupOne = maOne.group();
+            String groupTwo = maTwo.group();
+            String toString = sb.append(".*(").append(groupOne).append("[^。,;。,;]{0,3}").append(groupTwo).append(").*").toString();
+            timeZZ.add(toString);
+        }
+        if(ListUtil.isEmpty(timeZZ)){
+            return;
+        }
+        //获取疑难病历讨论记录
+        List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs();
+        if (ListUtil.isEmpty(difficultCaseDiscussDocs)) {
+            return;
+        }
+        for (DifficultCaseDiscussDoc difficultCaseDiscussDoc : difficultCaseDiscussDocs) {
+            if(difficultCaseDiscussDoc==null){
+                continue;
+            }
+            String discussDoc = difficultCaseDiscussDoc.getStructureMap().get("病程内容");
+            if(StringUtil.isEmpty(discussDoc)){
+                continue;
+            }
+            for (String zz : timeZZ) {
+                if(!discussDoc.matches(zz)){
+                    status.set("-1");
+                    return;
+                }
+            }
+        }
+        return;
+    }
+}

+ 39 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0200.java

@@ -1,12 +1,17 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
+import com.alibaba.fastjson.JSONArray;
+import com.google.common.collect.Lists;
 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.List;
 import java.util.Map;
 
 /**
@@ -17,21 +22,49 @@ import java.util.Map;
  */
 @Component
 public class FIRP0200 extends QCCatalogue {
+    private List<String> icdCodeList = Lists.newArrayList("Z37.0", "Z37.2", "Z37.3", "Z37.5", "Z37.6");
+
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String newbornWeightStr = firstpageStructureMap.get(Content.newbornWeight);
-            if (CatalogueUtil.isEmpty(newbornWeightStr) || !CatalogueUtil.numbersOnly(newbornWeightStr)) {
+            if (CatalogueUtil.isEmpty(newbornWeightStr)) {
                 return;
             }
-            double newbornWeight = Double.parseDouble(newbornWeightStr);
-            if (newbornWeight / 1000 >= 1) {
-                newbornWeight = newbornWeight / 1000;
+            //为阿拉伯数字情况下,比较体重范围
+            if (CatalogueUtil.numbersOnly(newbornWeightStr)) {
+                double newbornWeight = Double.parseDouble(newbornWeightStr);
+                if (newbornWeight <= 100 || newbornWeight >= 9999) {
+                    status.set("-1");
+                    return;
+                }
+            }
+            String newbornDaye = firstpageStructureMap.get("新生儿出生天数");
+            if (StringUtil.isNotEmpty(newbornDaye) && Long.valueOf(newbornDaye) <= 28) {
+                if (newbornWeightStr.equals("-")) {
+                    status.set("-1");
+                    return;
+                }
             }
-            if (newbornWeight <= 1 || newbornWeight >= 10) {
-                status.set("-1");
+            String hospitalDiagnosis = firstpageStructureMap.get("出院诊断");
+            if (StringUtil.isNotEmpty(hospitalDiagnosis)) {
+                List<Map<String, String>> diagnosisMapList = (List<Map<String, String>>) JSONArray.parse(hospitalDiagnosis);
+                for (Map<String, String> diagnosisMap : diagnosisMapList) {
+                    String diagnosisIcd = diagnosisMap.get("诊断编码");
+                    if (StringUtil.isNotEmpty(diagnosisIcd)) {
+                        for (String icdCode : icdCodeList) {
+                            if (diagnosisIcd.startsWith(icdCode)) {
+                                if (newbornWeightStr.equals("-")) {
+                                    status.set("-1");
+                                    return;
+                                }
+                            }
+                        }
+                    }
+                }
             }
+            return;
         }
     }
 }

+ 52 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/yiwu/firstpagerecord/FIRP0200.java

@@ -1,12 +1,16 @@
 package com.lantone.qc.kernel.catalogue.hospital.yiwu.firstpagerecord;
 
+import com.alibaba.fastjson.JSONArray;
+import com.google.common.collect.Lists;
 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.List;
 import java.util.Map;
 
 /**
@@ -17,12 +21,14 @@ import java.util.Map;
  */
 @Component
 public class FIRP0200 extends QCCatalogue {
+    private List<String> icdCodeList = Lists.newArrayList("Z37.0", "Z37.2", "Z37.3", "Z37.5", "Z37.6");
+
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String newbornWeightStr = firstpageStructureMap.get(Content.newbornWeight);
-            if (CatalogueUtil.isEmpty(newbornWeightStr) || !CatalogueUtil.numbersOnly(newbornWeightStr)) {
+/*            if (CatalogueUtil.isEmpty(newbornWeightStr) || !CatalogueUtil.numbersOnly(newbornWeightStr)) {
                 return;
             }
             double newbornWeight = Double.parseDouble(newbornWeightStr);
@@ -34,7 +40,52 @@ public class FIRP0200 extends QCCatalogue {
                 Map<String, Object> structureExtMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
                 String xmlId = CatalogueUtil.getXmlId(structureExtMap, Content.newbornWeight);
                 id.set(xmlId);
+            }*/
+            if (CatalogueUtil.isEmpty(newbornWeightStr)) {
+                return;
+            }
+            //为阿拉伯数字情况下,比较体重范围
+            if (CatalogueUtil.numbersOnly(newbornWeightStr)) {
+                double newbornWeight = Double.parseDouble(newbornWeightStr);
+                if (newbornWeight <= 100 || newbornWeight >= 9999) {
+                    status.set("-1");
+                    Map<String, Object> structureExtMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
+                    String xmlId = CatalogueUtil.getXmlId(structureExtMap, Content.newbornWeight);
+                    id.set(xmlId);
+                    return;
+                }
+            }
+            String newbornDaye = firstpageStructureMap.get("新生儿出生天数");
+            if (StringUtil.isNotEmpty(newbornDaye) && Long.valueOf(newbornDaye) <= 28) {
+                if (newbornWeightStr.equals("-")) {
+                    status.set("-1");
+                    Map<String, Object> structureExtMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
+                    String xmlId = CatalogueUtil.getXmlId(structureExtMap, Content.newbornWeight);
+                    id.set(xmlId);
+                    return;
+                }
+            }
+            String hospitalDiagnosis = firstpageStructureMap.get("出院诊断");
+            if (StringUtil.isNotEmpty(hospitalDiagnosis)) {
+                List<Map<String, String>> diagnosisMapList = (List<Map<String, String>>) JSONArray.parse(hospitalDiagnosis);
+                for (Map<String, String> diagnosisMap : diagnosisMapList) {
+                    String diagnosisIcd = diagnosisMap.get("诊断编码");
+                    if (StringUtil.isNotEmpty(diagnosisIcd)) {
+                        for (String icdCode : icdCodeList) {
+                            if (diagnosisIcd.startsWith(icdCode)) {
+                                if (newbornWeightStr.equals("-")) {
+                                    status.set("-1");
+                                    Map<String, Object> structureExtMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
+                                    String xmlId = CatalogueUtil.getXmlId(structureExtMap, Content.newbornWeight);
+                                    id.set(xmlId);
+                                    return;
+                                }
+                            }
+                        }
+                    }
+                }
             }
+            return;
         }
     }
 }

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

@@ -731,5 +731,10 @@ public class Content {
             "{0,10}(?:早破|早期破裂))(?!([^。,;。,;]{0,3}([::\\t](否|无|从不|从未|未发现|未见|未诉|没有)|(否|无|从不|从未|未发现|未见|未诉|没有)" +
             "(\\\\b|[。,;。,;\\f\\n\\r\\t]))))";
 
+    /**
+     *   获取时间正则
+     */
+    public static String SJZZ = "([0-9一二三四五六七八九十百]{1,5})[^。,;。,;]{0,3}([天日周年月]|星期)";
+
 }