Explorar el Código

修改规则:拼接显示提示信息(、)

wangsy hace 4 años
padre
commit
5d93f84535

+ 36 - 15
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03070.java

@@ -9,9 +9,11 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.CrisisInfoDoc;
 import com.lantone.qc.pub.model.doc.LisDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -41,6 +43,8 @@ public class THR03070 extends QCCatalogue {
                 .collect(Collectors.toList());
         //异常数据列表
         List<String> abnormal = Lists.newArrayList();
+        Map<String, String> abnormalMap = Maps.newHashMap();
+        StringBuffer sb = new StringBuffer();
         for (LisDoc lisDoc : lisDocs) {
             double resultValue = -1, max = -1, min = -1;
             Map<String, String> structureMap = lisDoc.getStructureMap();
@@ -50,13 +54,16 @@ public class THR03070 extends QCCatalogue {
             }
             String result = structureMap.get("检验结果");
             String reference = structureMap.get("参考值");
-            if (StringUtil.isBlank(itemName) || StringUtil.isBlank(result) || StringUtil.isBlank(reference)) {
+            String itemDate = structureMap.get("报告创建时间");
+            if (StringUtil.isBlank(itemName) || StringUtil.isBlank(result)
+                    || StringUtil.isBlank(reference) || StringUtil.isBlank(itemDate)) {
                 continue;
             }
             itemName = itemName.split("=")[1];
             //1.化验结果是阳性时,直接把该化验名称放入异常数据列表中
             if (result.contains("阳")) {
                 abnormal.add(itemName);
+                abnormalMap.put(itemName, itemDate);
                 continue;
             }
             //2.化验结果为阴性,或化验结果中不包含数字,跳过该条化验结果
@@ -83,6 +90,7 @@ public class THR03070 extends QCCatalogue {
                     //化验结果在正常范围之外(返回扩大10%),把该化验名称放入异常数据列表中
                     if (min >= 0 && max >= 0 && (resultValue < min || resultValue > max)) {
                         abnormal.add(itemName);
+                        abnormalMap.put(itemName, itemDate);
                     }
                 } catch (Exception e) {
                     System.out.println("THR03070--3.出异常");
@@ -97,6 +105,7 @@ public class THR03070 extends QCCatalogue {
                     }
                     if (resultValue > max) {
                         abnormal.add(itemName);
+                        abnormalMap.put(itemName, itemDate);
                     }
                 } catch (Exception e) {
                     System.out.println("THR03070--4.出异常");
@@ -111,6 +120,7 @@ public class THR03070 extends QCCatalogue {
                     }
                     if (resultValue < min) {
                         abnormal.add(itemName);
+                        abnormalMap.put(itemName, itemDate);
                     }
                 } catch (Exception e) {
                     System.out.println("THR03070--5.出异常");
@@ -139,8 +149,6 @@ public class THR03070 extends QCCatalogue {
                 if (content.contains(lis)) {
                     abnormalCount.put(lis, abnormalCount.get(lis) + 1);
                 }
-
-
             }
         }
 
@@ -149,23 +157,21 @@ public class THR03070 extends QCCatalogue {
             if (lis.getValue() == 0) {
                 abnormalMiss.add(lis.getKey());
             }
+            if (abnormalMiss.size() > 0) {
+                infoAppend(sb, lis.getKey(), abnormalMap);
+            }
         }
-        if (abnormalMiss.size() > 0) {
+//        if (abnormalMiss.size() > 0) {
+//            status.set("-1");
+//            info.set(abnormalMiss.toString().replaceAll("[\\[\\]]", ""));
+//        }
+
+        if (sb.toString().length() > 0) {
             status.set("-1");
-            info.set(abnormalMiss.toString().replaceAll("[\\[\\]]", ""));
+            info.set("化验:" + sb.toString().substring(0, sb.toString().length() - 1));
         }
     }
 
-    /**
-     * 拼接提示信息
-     *
-     * @param sb
-     * @param drugKey
-     */
-    private void infoAppend(StringBuffer sb, String drugKey) {
-        sb.append(drugKey).append("、");
-    }
-
     public String getNumber(String content) {
         String group = "";
         String compile = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9]|0)";
@@ -176,4 +182,19 @@ public class THR03070 extends QCCatalogue {
         }
         return group;
     }
+
+    /**
+     * 拼接提示信息
+     *
+     * @param sb
+     * @param repNm
+     * @param abnormalMap
+     */
+    private void infoAppend(StringBuffer sb, String repNm, Map<String, String> abnormalMap) {
+        for (Map.Entry<String, String> map : abnormalMap.entrySet()) {
+            if (repNm.equals(map.getKey())) {
+                sb.append(repNm).append("(").append(DateUtil.formatDate(StringUtil.parseDateTime(map.getValue()))).append(")").append("、");
+            }
+        }
+    }
 }