Browse Source

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

rengb 5 years ago
parent
commit
ab87d550d7

+ 2 - 39
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP02993.java

@@ -1,6 +1,7 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.ClearBracketUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
@@ -29,7 +30,7 @@ public class FIRP02993 extends QCCatalogue {
                 for (OperationDoc operationDoc : operationDocs
                 ) {
                     String str = operationDoc.getOperationDiscussionDoc().getStructureMap().get(Content.operative_name);//手术名称
-                    String s = ClearBracket(str);
+                    String s = ClearBracketUtil.ClearBracket(str);
                     String[] digitalSplit = s.split("[\\+|,|、|,]");
                     for (int i = 0; i < digitalSplit.length; i++) {
                         if (!digitalSplit[i].equals("")) {
@@ -71,43 +72,5 @@ public class FIRP02993 extends QCCatalogue {
         }
     }
 
-    /**
-     * 去除括号里的内容
-     * @param context
-     * @return
-     */
-    private String ClearBracket(String context) {
-        //        String bracket = context.substring(context.indexOf("("), context.indexOf(")") + 1);
-        //        context = context.replace(bracket, "");
-        //
-        //        context.substring(context.lastIndexOf())
-        //
-        //        return context;
 
-        // 修改原来的逻辑,防止右括号出现在左括号前面的位置
-        int head = context.indexOf('('); // 标记第一个使用左括号的位置
-        if (head == -1) {
-            return context; // 如果context中不存在括号,什么也不做,直接跑到函数底端返回初值str
-        } else {
-            int next = head + 1; // 从head+1起检查每个字符
-            int count = 1; // 记录括号情况
-            do {
-                if (context.charAt(next) == '(') {
-                    count++;
-                } else if (context.charAt(next) == ')') {
-                    count--;
-                }
-                next++; // 更新即将读取的下一个字符的位置
-                if (count == 0) // 已经找到匹配的括号
-                {
-                    String temp = context.substring(head, next); // 将两括号之间的内容及括号提取到temp中
-                    context = context.replace(temp, ""); // 用空内容替换,复制给context
-                    head = context.indexOf('('); // 找寻下一个左括号
-                    next = head + 1; // 标记下一个左括号后的字符位置
-                    count = 1; // count的值还原成1
-                }
-            } while (head != -1); // 如果在该段落中找不到左括号了,就终止循环
-        }
-        return context; // 返回更新后的context
-    }
 }

+ 14 - 10
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java

@@ -9,6 +9,7 @@ import com.lantone.qc.pub.model.doc.DeathRecordDoc;
 import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.label.ChiefLabel;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -66,18 +67,21 @@ public class LEA0149 extends QCCatalogue {
                 status.set("0");
                 return;
             }
-            Pattern compile = Pattern.compile("(?<=2.).*(?=3.体格检查)");
-            Matcher matcher = compile.matcher(bhThings);
-            while (matcher.find()) {
-                String number = matcher.group(0);
-                if (CatalogueUtil.isEmpty(number)) {
-                    status.set("-1");
+            if(StringUtils.isNotBlank(bhThings)){
+                Pattern compile = Pattern.compile("(?<=2.).*(?=3.体格检查)");
+                Matcher matcher = compile.matcher(bhThings);
+                while (matcher.find()) {
+                    String number = matcher.group(0);
+                    if (CatalogueUtil.isEmpty(number)) {
+                        status.set("-1");
+                    }
+                }
+                //处理台州的
+                if (bhThings.contains("患者因")) {
+                    status.set("0");
                 }
             }
-            //处理台州的
-            if (bhThings.contains("患者因")) {
-                status.set("0");
-            }
+
 
 
             //                    bhThings = bhThings.replaceAll("[\\p{Punct}\\pP]", "");

+ 48 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/ClearBracketUtil.java

@@ -0,0 +1,48 @@
+package com.lantone.qc.kernel.util;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-06-29 10:33
+ */
+public class ClearBracketUtil {
+    /**
+     * 去除括号里的内容
+     * @param context
+     * @return
+     */
+    public static String ClearBracket(String context) {
+        //        String bracket = context.substring(context.indexOf("("), context.indexOf(")") + 1);
+        //        context = context.replace(bracket, "");
+        //
+        //        context.substring(context.lastIndexOf())
+        //
+        //        return context;
+
+        // 修改原来的逻辑,防止右括号出现在左括号前面的位置
+        int head = context.indexOf('('); // 标记第一个使用左括号的位置
+        if (head == -1) {
+            return context; // 如果context中不存在括号,什么也不做,直接跑到函数底端返回初值str
+        } else {
+            int next = head + 1; // 从head+1起检查每个字符
+            int count = 1; // 记录括号情况
+            do {
+                if (context.charAt(next) == '(') {
+                    count++;
+                } else if (context.charAt(next) == ')') {
+                    count--;
+                }
+                next++; // 更新即将读取的下一个字符的位置
+                if (count == 0) // 已经找到匹配的括号
+                {
+                    String temp = context.substring(head, next); // 将两括号之间的内容及括号提取到temp中
+                    context = context.replace(temp, ""); // 用空内容替换,复制给context
+                    head = context.indexOf('('); // 找寻下一个左括号
+                    next = head + 1; // 标记下一个左括号后的字符位置
+                    count = 1; // count的值还原成1
+                }
+            } while (head != -1); // 如果在该段落中找不到左括号了,就终止循环
+        }
+        return context; // 返回更新后的context
+    }
+}