소스 검색

宁波中医:手术名称未标引号

chengyao 3 년 전
부모
커밋
27db960f4a
1개의 변경된 파일78개의 추가작업 그리고 0개의 파일을 삭제
  1. 78 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/ningbozhongyi/behospitalized/BEH0034.java

+ 78 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/ningbozhongyi/behospitalized/BEH0034.java

@@ -0,0 +1,78 @@
+package com.lantone.qc.kernel.catalogue.hospital.ningbozhongyi.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.entity.Operation;
+import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 手术名称未标引号
+ * @author: rengb
+ * @time: 2020/3/10 14:02
+ */
+@Component
+public class BEH0034 extends QCCatalogue {
+
+    @Override
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        if (inputInfo.getBeHospitalizedDoc() == null) {
+            return;
+        }
+        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
+        List<Operation> operations = pastLabel.getOperations();
+        if (ListUtil.isEmpty(operations)) {
+            return;
+        }
+        List<String> wtOperationNames = CatalogueUtil.noInQuotes(
+                operations.stream()
+                        .filter(i ->
+                                i != null && StringUtil.isNotBlank(i.getName()) && i.getNegative() == null
+                                        && !"手术史".equals(i.getName()) && !"手术".equals(i.getName()) && !"手术治疗".equals(i.getName())
+                                        && !"手术无手术史".equals(i.getName())&& !"手术处理".equals(i.getName())&& !"其他手术史".equals(i.getName())
+                        )
+                        .map(i -> i.getName())
+                        .distinct()
+                        .collect(Collectors.toList()),
+                pastLabel.getText().replace("“", "\"").replace("”", "\"")
+        );
+        if (ListUtil.isNotEmpty(wtOperationNames)) {
+            String pastLabelText = pastLabel.getText();
+            for (String wtOperationName : wtOperationNames) {
+                if (isASMark(pastLabelText, wtOperationName)) {
+                    continue;
+                }
+                status.set("-1");
+                info.set(info.get() + wtOperationName + " ");
+            }
+        }
+    }
+
+    private boolean isASMark(String pastLabelText, String wtOperationName) {
+        String operName = wtOperationName.replace("手术", "");
+        Pattern pattern = Pattern.compile("[0-9][(?=次)][\\s\\S]*");
+        Matcher matcher = pattern.matcher(operName);
+        if (matcher.find()) {
+            operName = operName.substring(0, matcher.start());
+        }
+        int index = pastLabelText.indexOf(operName);
+        if (index != -1 && index + operName.length() != pastLabelText.length()) {
+            String substring = pastLabelText.substring(index + operName.length(), index + operName.length() + 1);
+            if (substring.equals("\"") || substring.equals("”")) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}