Kaynağa Gözat

电子出院医嘱药品未见于文书出院带药中

louhr 5 yıl önce
ebeveyn
işleme
44f98588c0

+ 26 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA02987.java

@@ -12,6 +12,8 @@ import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : LEA02987
@@ -62,7 +64,7 @@ public class LEA02987 extends QCCatalogue {
 
         //没有包含的药品再次查看商品名或化学名在出院医嘱书写
         for (String drug : notContainsDrugs) {
-            List<String> splitDrugs = new ArrayList<>();
+            Set<String> splitDrugs = getRegexWords(drug, "[((][^()()]+[))]");
             boolean isFind = false;
             for (String sd : splitDrugs) {
                 if (dischargeOrder.contains(sd)){
@@ -78,4 +80,27 @@ public class LEA02987 extends QCCatalogue {
             info.set(infoStr);
         }
     }
+
+
+    private Set<String> getRegexWords(String word, String regex) {
+        Set<String> ret = new HashSet<>();
+        if (StringUtil.isNotBlank(word) && StringUtil.isNotBlank(regex)) {
+            Pattern pattern = Pattern.compile(regex);
+            Matcher matcher = pattern.matcher(word);
+            if (matcher.find()) {
+                ret.add(matcher.group().replaceAll("[(())]", ""));
+                int startIndex = matcher.start();
+                int endIndex = matcher.end();
+                if (startIndex > 0) {
+                    ret.add(word.substring(0, startIndex));
+                }
+                if (endIndex <= word.length()) {
+                    ret.addAll(getRegexWords(word.substring(endIndex), regex));
+                }
+            } else {
+                ret.add(word);
+            }
+        }
+        return ret;
+    }
 }