Browse Source

新增杭州妇保院个性化规则 BEH02902 辅助检查未注明地点

hecc 3 years ago
parent
commit
d01eec9203

+ 81 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/hangzhoufubao/behospitalized/BEH02902.java

@@ -0,0 +1,81 @@
+package com.lantone.qc.kernel.catalogue.hospital.hangzhoufubao.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.entity.PD;
+import com.lantone.qc.pub.model.entity.Pacs;
+import com.lantone.qc.pub.model.label.PacsLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : BEH02902
+ * @Description : 辅助检查未注明地点
+ * @Author : 贺聪聪
+ * @Date: 2022-6-6 11:03
+ */
+@Component
+public class BEH02902 extends QCCatalogue {
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getBeHospitalizedDoc() == null) {
+            status.set("0");
+            return;
+        }
+
+        String pacsText = inputInfo.getBeHospitalizedDoc().getStructureMap().get("辅助检查");
+        if (StringUtil.isBlank(pacsText)) {
+            status.set("0");
+            return;
+        }
+
+        if (StringUtil.isNotBlank(pacsText) && (pacsText.contains("缺") || pacsText.contains("暂无")
+                || "无".equals(pacsText) || "无。".equals(pacsText) || "。".equals(pacsText))) {
+            status.set("0");
+            return;
+        }
+
+        PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
+        if (pacsLabel == null || StringUtil.isBlank(pacsLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        boolean findPlace = false;
+        pacsText = pacsLabel.getText();
+        List<Pacs> pacses = pacsLabel.getPacses();
+        if (pacses != null) {
+            for (Pacs pacs : pacses) {
+                /* 时间为入院检查的时间,模型输出处理后结构为 name为空,pd不为空 */
+                if (pacs.getName() == null && pacs.getPd() != null) {
+                    /* 模型先找到时间实体,找到后再从这个时间实体开始,往前往后找 */
+                    PD pd = pacs.getPd();
+                    String name = pd.getName();
+                    int timeIndex = pacsText.indexOf(name);
+                    String beforeTimeText = pacsText.substring(Math.max(timeIndex - 5, 0), timeIndex);
+                    String afterTimeText = pacsText.substring(timeIndex + name.length(), Math.min(timeIndex + name.length() + 20, pacsText.length()));
+                    if (beforeTimeText.contains("院") || afterTimeText.contains("院") || beforeTimeText.contains("市") || beforeTimeText.contains("市") || beforeTimeText.contains("区") ||
+                        beforeTimeText.contains("区") || beforeTimeText.contains("中心") || beforeTimeText.contains("中心") || beforeTimeText.contains("省") || beforeTimeText.contains("省")) {
+                        findPlace = true;
+                        break;
+                    }
+                }
+            }
+        }
+
+        /* 如果模型没找到时间实体,则直接取辅助检查前20个字,判断有没有院字 */
+        if (!findPlace) {
+            String prefixText = pacsText.substring(0, Math.min(20, pacsText.length()));
+            if (prefixText.contains("院")) {
+                findPlace = true;
+            }
+        }
+
+        if (findPlace) {
+            status.set("0");
+            return;
+        }
+    }
+}