|
@@ -15,6 +15,8 @@ import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : LEA02987
|
|
@@ -56,14 +58,37 @@ public class LEA02987 extends QCCatalogue {
|
|
|
}
|
|
|
|
|
|
String infoStr = "";
|
|
|
- for (String drug:drugs) {
|
|
|
- if (!dischargeOrder.contains(drug)){
|
|
|
- infoStr = CatalogueUtil.concatInfo(infoStr,drug);
|
|
|
+ for (String drug : drugs) {
|
|
|
+ if (!dischargeOrder.contains(drug)) {
|
|
|
+ infoStr = CatalogueUtil.concatInfo(infoStr, drug);
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtil.isNotBlank(infoStr)){
|
|
|
+ if (StringUtil.isNotBlank(infoStr)) {
|
|
|
status.set("-1");
|
|
|
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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|