Procházet zdrojové kódy

家族史规则修改逻辑,添加辅检外院判断

hujing před 5 roky
rodič
revize
81673acbe1

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0059.java

@@ -17,7 +17,8 @@ public class BEH0059 extends QCCatalogue {
     @Override
     protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getMenstrualLabel() != null) {
-            if (CatalogueUtil.isEmpty(inputInfo.getBeHospitalizedDoc().getMenstrualLabel().getText())) {
+            if (CatalogueUtil.isEmpty(inputInfo.getBeHospitalizedDoc().getMenstrualLabel().getText()
+                    .replace("月经史:null",""))) {
                 status = "0";
             }
         }

+ 11 - 8
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0070.java

@@ -26,16 +26,19 @@ public class BEH0070 extends QCCatalogue {
         if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getFamilyLabel() != null) {
             FamilyLabel familyLabel = inputInfo.getBeHospitalizedDoc().getFamilyLabel();
             List<Family> families = familyLabel.getFamilies();
-            boolean isFind = false;
-            for (Family family:families) {
-                if (family.getGeneticDiseaseKeyword() != null && StringUtil.isNotBlank(family.getGeneticDiseaseKeyword().getName())
-                && family.getDiagInfectious() != null && StringUtil.isNotBlank(family.getDiagInfectious().getName())){
-                    isFind = true;
+            boolean isFindGeneticDiseaseKeyword = false, isFindDiagInfectious = false;
+            for (Family family : families) {
+                if (family.getGeneticDiseaseKeyword() != null && StringUtil.isNotBlank(family.getGeneticDiseaseKeyword().getName())) {
+                    isFindGeneticDiseaseKeyword = true;
+                }
+                if (family.getDiagInfectious() != null && StringUtil.isNotBlank(family.getDiagInfectious().getName())) {
+                    isFindDiagInfectious = true;
+                    break;
+                }
+                if (isFindGeneticDiseaseKeyword && isFindDiagInfectious) {
+                    status = "0";
                     break;
                 }
-            }
-            if (!isFind){
-                status = "0";
             }
         }
     }

+ 37 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0082.java

@@ -0,0 +1,37 @@
+package com.lantone.qc.kernel.catalogue.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.OuterCourtyard;
+import com.lantone.qc.pub.model.entity.Pacs;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+/**
+ * @ClassName : BEH0082
+ * @Description : 外院医疗机构检查记录不规范
+ * @Author : 胡敬
+ * @Date: 2020-03-12 16:29
+ */
+@Component
+public class BEH0082 extends QCCatalogue {
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getPacsLabel() != null) {
+            boolean isFindOuterCourtyard = false;
+            for (Pacs pacs:inputInfo.getBeHospitalizedDoc().getPacsLabel().getPacses()) {
+                if (pacs.getOuterCourtyard() != null){
+                    OuterCourtyard outerCourtyard = pacs.getOuterCourtyard();
+                    if (outerCourtyard.getPd().size() > 0 && StringUtil.isNotBlank(outerCourtyard.getPacsValue().getName())){
+                        isFindOuterCourtyard = true;
+                        break;
+                    }
+                }
+            }
+            if (!isFindOuterCourtyard){
+                status = "0";
+            }
+        }
+    }
+}

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java

@@ -20,7 +20,7 @@ public enum EntityEnum {
     OCCUPATION("职业"), LOCATION("地点"), DEAD("死亡"), DEAD_REASON("死亡原因"),
     SIMILAR_DISEASE_KEYWORD("相似疾病"), GENETIC_DISEASE_KEYWORD("家族遗传病"), EPIDEMIC_AREA_HISTORY("疫区史"), SPECIAL_HOBBY("特殊嗜好"),
     CONTACT_HISTORY("接触史"), MARITAL_HISTORY("冶游史"), MARITAL_STATUS("婚姻情况"), MARRYIAGE("结婚年龄"), NEAR_RELATION("近亲史"),
-    CURE_AIM("治疗目的"), OTHER("其他");
+    CURE_AIM("治疗目的"), OTHER("其他"),OUTERCOURTYARD("外院");
 
     private String value;
 

+ 66 - 24
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessPacs.java

@@ -3,9 +3,14 @@ package com.lantone.qc.kernel.structure.ai.process;
 import com.alibaba.fastjson.JSONObject;
 import com.lantone.qc.kernel.structure.ai.model.CrfOut;
 import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
+import com.lantone.qc.kernel.structure.ai.model.Lemma;
 import com.lantone.qc.pub.model.entity.BodyPart;
+import com.lantone.qc.pub.model.entity.Clinical;
+import com.lantone.qc.pub.model.entity.OuterCourtyard;
 import com.lantone.qc.pub.model.entity.Pacs;
 import com.lantone.qc.pub.model.entity.PacsValue;
+import com.lantone.qc.pub.model.label.MenstrualLabel;
+import com.lantone.qc.pub.model.label.PacsLabel;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.ArrayList;
@@ -13,35 +18,72 @@ import java.util.List;
 import java.util.Map;
 
 public class EntityProcessPacs extends EntityProcess {
-    public List<Pacs> extractEntity(JSONObject outputs) {
+
+    public List<Pacs> extractEntity(JSONObject aiOut) {
+        //辅检情况
         List<Pacs> pacses = new ArrayList<>();
-        Pacs pacs = null;
-        List<Map<String, String>> pacsEntityList = processJson(outputs, EntityEnum.AUXILIARY_EXAMINATION.toString());
-        for (Map<String, String> pacsEntityMap : pacsEntityList) {
-            if (StringUtils.isEmpty(pacsEntityMap.get(EntityEnum.AUXILIARY_EXAMINATION.toString()))) {
-                continue;
-            }
-            pacs = new Pacs();
-            for (String key : pacsEntityMap.keySet()) {
-                String entity = StringUtils.isEmpty(pacsEntityMap.get(key)) ? "" : pacsEntityMap.get(key);
-                switch (EntityEnum.parseOfValue(key)) {
-                    case AUXILIARY_EXAMINATION:
-                        pacs.setName(entity);
-                        break;
-                    case AUXILIARY_DESCRIPT:
-                        PacsValue pacsValue = new PacsValue();
-                        pacsValue.setName(entity);
-                        pacs.setPacsValues(pacsValue);
-                        break;
-                    case BODY:
-                        BodyPart bodyPart = new BodyPart();
-                        bodyPart.setName(entity);
-                        pacs.setBodyPart(bodyPart);
-                        break;
+        List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
+        for (Lemma lemma : pacsLemmas) {
+            Pacs pacs = new Pacs();
+            pacs.setName(lemma.getText());
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
+                        pacs.setPacsValues(addPacsValue(relationLemma));
+                    } else if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
+                        pacs.setBodyPart(addBodyPart(relationLemma));
+                    } else if (relationLemma.getProperty().equals(EntityEnum.OUTERCOURTYARD.toString())) {
+                        pacs.setOuterCourtyard(addOuterCourtyard(relationLemma));
+                    }
                 }
             }
             pacses.add(pacs);
         }
         return pacses;
     }
+
+    /**
+     * 添加辅助检查描述
+     *
+     * @param relationLemma
+     * @return
+     */
+    private PacsValue addPacsValue(Lemma relationLemma) {
+        PacsValue pacsValue = new PacsValue();
+        pacsValue.setName(relationLemma.getText());
+        return pacsValue;
+    }
+
+    /**
+     * 添加身体部位
+     *
+     * @param relationLemma
+     * @return
+     */
+    private BodyPart addBodyPart(Lemma relationLemma) {
+        BodyPart bodyPart = new BodyPart();
+        bodyPart.setName(relationLemma.getText());
+        return bodyPart;
+    }
+
+    /**
+     * 添加外院
+     *
+     * @param relationLemma
+     * @return
+     */
+    private OuterCourtyard addOuterCourtyard(Lemma relationLemma) {
+        OuterCourtyard outerCourtyard = new OuterCourtyard();
+        outerCourtyard.setName(relationLemma.getText());
+        if (relationLemma.isHaveChildren()) {
+            outerCourtyard.setPd(findTime(relationLemma));
+            for (Lemma lemma : relationLemma.getRelationLemmas()) {
+                if (lemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
+                    outerCourtyard.setPacsValue(addPacsValue(lemma));
+                    break;
+                }
+            }
+        }
+        return outerCourtyard;
+    }
 }

+ 4 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/OuterCourtyard.java

@@ -3,6 +3,8 @@ package com.lantone.qc.pub.model.entity;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * @ClassName : OuterCourtyard
  * @Description : 外院
@@ -12,4 +14,6 @@ import lombok.Setter;
 @Setter
 @Getter
 public class OuterCourtyard extends General {
+    private List<PD> pd;
+    private PacsValue pacsValue;
 }