瀏覽代碼

辅检提取信息

zhoutg 4 年之前
父節點
當前提交
01b793eec6

+ 12 - 4
src/main/java/com/diagbot/dto/WordCrfDTO.java

@@ -3,8 +3,16 @@ package com.diagbot.dto;
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
-import com.diagbot.model.entity.PacsNew;
-import com.diagbot.model.label.*;
+import com.diagbot.model.label.ChiefLabel;
+import com.diagbot.model.label.DiagLabel;
+import com.diagbot.model.label.FamilyLabel;
+import com.diagbot.model.label.MaritalLabel;
+import com.diagbot.model.label.MenstrualLabel;
+import com.diagbot.model.label.PacsLabel;
+import com.diagbot.model.label.PastLabel;
+import com.diagbot.model.label.PersonalLabel;
+import com.diagbot.model.label.PresentLabel;
+import com.diagbot.model.label.VitalLabel;
 import lombok.Data;
 
 import java.util.ArrayList;
@@ -28,7 +36,7 @@ public class WordCrfDTO {
     private List<Lis> lis = new ArrayList<>();
     // 辅检项目和结果
     private List<Pacs> pacs = new ArrayList<>();
-    private List<PacsNew> pacsNews = new ArrayList<>();
+    // private List<PacsNew> pacsNews = new ArrayList<>();
     // 主诉
     private ChiefLabel chiefLabel = new ChiefLabel();
     // 现病史
@@ -63,5 +71,5 @@ public class WordCrfDTO {
     // 化验
     // private LisLabel lisLabel;
     // 辅检
-    // private PacsLabel pacsLabel;
+    private PacsLabel pacsLabel;
 }

+ 2 - 2
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -96,7 +96,7 @@ public class CommonFacade {
         //所有辅助检查(结构化数据)
         List<String> allPacs = new ArrayList<>();
 //        List<Pacs> pacs = wordCrfDTO.getPacs();
-        List<PacsNew> pacsNews = wordCrfDTO.getPacsNews();
+        List<PacsNew> pacsNews = wordCrfDTO.getPacsLabel().getPacsNewList();
         if (ListUtil.isNotEmpty(pacsNews)) {
             List<String> pacss_unique = pacsNews.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
                     .map(x -> x.getName()).collect(Collectors.toList());
@@ -145,7 +145,7 @@ public class CommonFacade {
         DiagLabel diagLabel = wordCrfDTO.getDiagLabel();
         List<Lis> lis = wordCrfDTO.getLis();
 //        List<Pacs> pacs = wordCrfDTO.getPacs();
-        List<PacsNew> pacsNews = wordCrfDTO.getPacsNews();
+        List<PacsNew> pacsNews = wordCrfDTO.getPacsLabel().getPacsNewList();
         VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
 
         //症状回填

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

@@ -139,6 +139,7 @@ public class BeHospitalizedAI extends ModelAI {
                 wordCrfDTO.setFamilyLabel(familyLabel);
                 putContent(crfContent, medicalTextType.get(1), familyText, Content.family);
             }
+            /* 辅检 */
             if(ListUtil.isNotEmpty(inputInfo.getPacs())){
                 List<PacsNew> collect = inputInfo.getPacs().stream().map(x -> {
                     PacsNew pacsNew = new PacsNew();
@@ -147,7 +148,9 @@ public class BeHospitalizedAI extends ModelAI {
                     pacsNew.setResult(x.getResult());
                     return pacsNew;
                 }).collect(Collectors.toList());
-                wordCrfDTO.setPacsNews(collect);
+                PacsLabel pacsLabel = new PacsLabel();
+                pacsLabel.setPacsNewList(collect);
+                wordCrfDTO.setPacsLabel(pacsLabel);
             }
 
             /* *//* 辅助检查(暂用主诉现病史模型,之后会新训练单独模型再做修改) *//*
@@ -256,11 +259,11 @@ public class BeHospitalizedAI extends ModelAI {
                 putPacsCrfData(midData.getJSONObject(Content.pacs), wordCrfDTO);
             }*/
             /**
-             * 处理pacsnew
+             * 处理辅检pacsnew
              */
-            if(ListUtil.isNotEmpty(wordCrfDTO.getPacsNews())){
+            if(wordCrfDTO.getPacsLabel() != null && ListUtil.isNotEmpty(wordCrfDTO.getPacsLabel().getPacsNewList())){
                 EntityProcessPacsNew entityProcessPacsNew = new EntityProcessPacsNew();
-                List<PacsNew> pacsNews = wordCrfDTO.getPacsNews();
+                List<PacsNew> pacsNews = wordCrfDTO.getPacsLabel().getPacsNewList();
                 for (PacsNew pacsnew:pacsNews) {
                     JSONArray crfPacsContent = new JSONArray();
                     putContent(crfPacsContent, medicalTextType.get(5), pacsnew.getResult(), Content.pacs);
@@ -273,8 +276,7 @@ public class BeHospitalizedAI extends ModelAI {
                     if (aiOut == null) {
                         continue;
                     }
-                    List<Pacs> pacs = entityProcessPacsNew.extractEntity(aiOut);
-                    pacsnew.setPacsResults(pacs);
+                    entityProcessPacsNew.extractEntity(aiOut, pacsnew);
                 }
             }
         }

+ 20 - 4
src/main/java/com/diagbot/model/ai/process/EntityProcessPacsNew.java

@@ -5,6 +5,7 @@ import com.diagbot.model.ai.model.EntityEnum;
 import com.diagbot.model.ai.model.Lemma;
 import com.diagbot.model.entity.BodyPart;
 import com.diagbot.model.entity.Pacs;
+import com.diagbot.model.entity.PacsNew;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -15,8 +16,9 @@ import java.util.List;
  * @time 14:03
  */
 public class EntityProcessPacsNew extends EntityProcess {
-    public List<Pacs> extractEntity(JSONObject aiOut) {
-        //辅检情况
+
+    public void extractEntity(JSONObject aiOut, PacsNew pacsNew) {
+        //辅检描述情况
         List<Pacs> pacses = new ArrayList<>();
         List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
         for (Lemma lemma : pacsLemmas) {
@@ -24,16 +26,30 @@ public class EntityProcessPacsNew extends EntityProcess {
             pacs.setName(lemma.getText());
             pacs.setStandName(lemma.getText());
             if (lemma.isHaveChildren()) {
+                List<BodyPart> bodyPartList = new ArrayList<>();
                 for (Lemma relationLemma : lemma.getRelationLemmas()) {
                     if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
-                        pacs.setBodyPart(addBodyPart(relationLemma));
+                        bodyPartList.add(addBodyPart(relationLemma));
                     }
                 }
+                pacs.setBodyPartList(bodyPartList);
             }
             pacses.add(pacs);
         }
-        return pacses;
+        pacsNew.setPacsResults(pacses);
+
+        // 辅检诊断信息
+        List<Pacs> pacsDisList = new ArrayList<>();
+        List<Lemma> disLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
+        for (Lemma lemma : disLemmas) {
+            Pacs pacs = new Pacs();
+            pacs.setName(lemma.getText());
+            pacs.setStandName(lemma.getText());
+            pacsDisList.add(pacs);
+        }
+        pacsNew.setDisease(pacsDisList);
     }
+
     /**
      * 添加身体部位
      *

+ 3 - 0
src/main/java/com/diagbot/model/entity/Pacs.java

@@ -3,6 +3,8 @@ package com.diagbot.model.entity;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * @ClassName com.lantone.util.module.Pacs
  * @Description TODO
@@ -16,5 +18,6 @@ public class Pacs extends General{
     private PD pd;  //时间
     private PacsValue pacsValues;
     private BodyPart bodyPart;
+    private List<BodyPart> bodyPartList; // 部位列表
     private OuterCourtyard outerCourtyard; //外院
 }

+ 2 - 1
src/main/java/com/diagbot/model/entity/PacsNew.java

@@ -14,5 +14,6 @@ public class PacsNew  {
     private String name;
     private String uniqueName;
     private String result;
-    private List<Pacs> pacsResults;
+    private List<Pacs> pacsResults; // 辅检提取的描述信息
+    private List<Pacs> disease; // 辅检提取的诊断
 }

+ 4 - 2
src/main/java/com/diagbot/model/label/PacsLabel.java

@@ -1,10 +1,11 @@
 package com.diagbot.model.label;
 
 
-import com.diagbot.model.entity.Pacs;
+import com.diagbot.model.entity.PacsNew;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -16,5 +17,6 @@ import java.util.List;
 @Setter
 @Getter
 public class PacsLabel extends GeneralLabel {
-    List<Pacs> pacses;
+    // List<Pacs> pacses;
+    List<PacsNew> pacsNewList = new ArrayList<>(); // 辅检信息
 }