zhoutg 4 gadi atpakaļ
vecāks
revīzija
fb2c8d7e2a

+ 6 - 6
src/main/java/com/diagbot/model/ai/BeHospitalizedAI.java

@@ -538,12 +538,12 @@ public class BeHospitalizedAI extends ModelAI {
      * @param aiOut
      * @return
      */
-    public List<Pacs> loadPacses(JSONObject aiOut) {
-        //辅检信息
-        EntityProcessPacs entityProcessLis = new EntityProcessPacs();
-        List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
-        return pacses;
-    }
+    // public List<Pacs> loadPacses(JSONObject aiOut) {
+    //     //辅检信息
+    //     EntityProcessPacs entityProcessLis = new EntityProcessPacs();
+    //     List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
+    //     return pacses;
+    // }
 
     /**
      * 关系抽取体格检查

+ 22 - 9
src/main/java/com/diagbot/model/ai/process/EntityProcessPacsNew.java

@@ -7,9 +7,11 @@ import com.diagbot.model.entity.BodyPart;
 import com.diagbot.model.entity.Pacs;
 import com.diagbot.model.entity.PacsNew;
 import com.diagbot.model.label.PacsLabel;
+import com.diagbot.util.ListUtil;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -21,6 +23,23 @@ import java.util.Map;
 public class EntityProcessPacsNew extends EntityProcess {
 
     public void extractEntity(JSONObject aiOut, PacsLabel pacsLabel) {
+        // 获取描述和部位的关系
+        Map<String, List<BodyPart>> bodyMap = new LinkedHashMap<>();
+        List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
+        for (Lemma lemma : pacsLemmas) {
+            List<BodyPart> bodyPartList = new ArrayList<>();
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
+                        BodyPart bodyPart = new BodyPart();
+                        bodyPart.setName(relationLemma.getText());
+                        bodyPartList.add(bodyPart);
+                    }
+                }
+                bodyMap.put(lemma.getText(), bodyPartList);
+            }
+        }
+
         //辅检描述情况
         List<Lemma> pacsAll = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
 
@@ -35,15 +54,9 @@ public class EntityProcessPacsNew extends EntityProcess {
                         Pacs desc = new Pacs();
                         desc.setName(relationLemma.getText());
                         desc.setStandName(relationLemma.getText());
-                        // if (lemma.isHaveChildren()) {
-                        //     List<BodyPart> bodyPartList = new ArrayList<>();
-                        //     for (Lemma relationLemmaSon : lemma.getRelationLemmas()) {
-                        //         if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
-                        //             bodyPartList.add(addBodyPart(relationLemmaSon));
-                        //         }
-                        //     }
-                        //     desc.setBodyPartList(bodyPartList);
-                        // }
+                        if (ListUtil.isNotEmpty(bodyMap.get(relationLemma.getText()))) {
+                            desc.setBodyPartList(bodyMap.get(relationLemma.getText()));
+                        }
                         descList.add(desc);
                     } else if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
                         // 辅检诊断信息