Переглянути джерело

现病史抽辅检,找uniqueName

kongwz 4 роки тому
батько
коміт
10f5e4746c

+ 40 - 5
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -6,6 +6,7 @@ import com.diagbot.client.CRFServiceClient;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.model.ai.AIAnalyze;
+import com.diagbot.model.entity.Pacs;
 import com.diagbot.model.entity.PacsNew;
 import com.diagbot.model.label.*;
 import com.diagbot.util.CoreUtil;
@@ -34,6 +35,8 @@ public class CommonFacade {
     CRFServiceClient crfServiceClient;
     @Autowired
     LisConfigFacade lisConfigFacade;
+    @Autowired
+    PacsConfigFacade pacsConfigFacade;
 
     //组装好的label
     public WordCrfDTO crf_process(SearchData searchData) {
@@ -68,9 +71,8 @@ public class CommonFacade {
             wordCrfDTO.setDiag(searchData.getDiag());
         }
         aiAnalyze.aiProcess(searchData, wordCrfDTO);
-        List<Lis> lisList = processPresentLisPacs(wordCrfDTO);
-        wordCrfDTO.getLis().addAll(lisList);
-        wordCrfDTO.setLis(wordCrfDTO.getLis());
+
+        processPresentLisPacs(wordCrfDTO);
         return wordCrfDTO;
     }
 
@@ -274,7 +276,7 @@ public class CommonFacade {
         return pushVO;
     }
 
-    public List<Lis> processPresentLisPacs(WordCrfDTO wordCrfDTO){
+    public void processPresentLisPacs(WordCrfDTO wordCrfDTO){
         PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
         List<com.diagbot.model.entity.Lis> lises = presentLabel.getLises();
         List<Lis> lisList = new ArrayList<>();
@@ -325,7 +327,40 @@ public class CommonFacade {
                 });
             }
         }
-        return lisList;
+        //处理辅检
+        List<PacsNew> packagePacs = new ArrayList<>();
+        List<PacsNew> pacsNewList = wordCrfDTO.getPresentLabel().getPacsNewList();
+        if(ListUtil.isNotEmpty(pacsNewList)){
+            List<String> pacsNames = pacsNewList.stream().map(x -> x.getName()).collect(Collectors.toList());
+            Map<String, Map<String, Long>> configMap = pacsConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), pacsNames, null);
+            if(configMap.size() > 0){
+                pacsNewList.stream().forEach(pacsNew ->{
+                    String name = pacsNew.getName();
+                    List<Pacs> disease = pacsNew.getDisease();
+                    List<Pacs> pacsResults = pacsNew.getPacsResults();
+                    if(configMap.containsKey(name)){
+                        Map<String, Long> uinqueNameMap = configMap.get(name);
+                        List<PacsNew> collect = uinqueNameMap.keySet().stream().map(x -> {
+                            PacsNew pan = new PacsNew();
+                            pan.setName(name);
+                            pan.setUniqueName(x);
+                            pan.setPacsResults(pacsResults);
+                            pan.setDisease(disease);
+                            return pan;
+                        }).collect(Collectors.toList());
+                        packagePacs.addAll(collect);
+                    }
+                });
+            }else {
+                packagePacs.addAll(pacsNewList);
+            }
+        }
+        wordCrfDTO.getLis().addAll(lisList);
+        wordCrfDTO.setLis(wordCrfDTO.getLis());
+
+        PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
+        pacsLabel.getPacsNewList().addAll(packagePacs);
+        wordCrfDTO.setPacsLabel(pacsLabel);
     }
 }
 

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

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -306,6 +307,8 @@ public class BeHospitalizedAI extends ModelAI {
         presentLabel.setText(wordCrfDTO.getPresentLabel().getText());
         List<Lis> lis = loadLises(aiOut);
         presentLabel.setLises(lis);
+//        EntityProcessPacsNew entityProcessPacsNew = new EntityProcessPacsNew();
+//        entityProcessPacsNew.extractEntity(aiOut, wordCrfDTO.getPacsLabel());
         wordCrfDTO.setPresentLabel(presentLabel);
     }
 
@@ -664,6 +667,14 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         EntityProcessPacsNew entityProcessPacsNew = new EntityProcessPacsNew();
-        entityProcessPacsNew.extractEntity(aiOut, pacsLabel);
+        Map<String, PacsNew> map = entityProcessPacsNew.extractEntity(aiOut);
+
+        List<PacsNew> pacsNewList = pacsLabel.getPacsNewList();
+        for (PacsNew p : pacsNewList) {
+            if (map.get(p.getName()) != null) {
+                p.setPacsResults(map.get(p.getName()).getPacsResults());
+                p.setDisease(map.get(p.getName()).getDisease());
+            }
+        }
     }
 }

+ 12 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessClinic.java

@@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 现病史处理
@@ -97,6 +98,17 @@ public class EntityProcessClinic extends EntityProcess {
 //            EntityProcessPacs entityProcessLis = new EntityProcessPacs();
 //            List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
 //            presentLabel.setPacses(pacses);
+            EntityProcessPacsNew entityProcessPacsNew = new EntityProcessPacsNew();
+            Map<String, PacsNew> pacsNewMap = entityProcessPacsNew.extractEntity(aiOut);
+            List<PacsNew> collect = new ArrayList<>();
+            if(pacsNewMap.size() > 0){
+                pacsNewMap.forEach((item,pacsNew)->{
+                    pacsNew.setName(item);
+                    pacsNew.setResult(presentLabel.getText());
+                    collect.add(pacsNew);
+                });
+            }
+            presentLabel.setPacsNewList(collect);
 
             //治疗
             List<Lemma> cureLemmas = createEntityTree(aiOut, EntityEnum.CURE.toString());

+ 3 - 8
src/main/java/com/diagbot/model/ai/process/EntityProcessPacsNew.java

@@ -22,7 +22,7 @@ import java.util.Map;
  */
 public class EntityProcessPacsNew extends EntityProcess {
 
-    public void extractEntity(JSONObject aiOut, PacsLabel pacsLabel) {
+    public Map<String, PacsNew>  extractEntity(JSONObject aiOut) {
         // 获取描述和部位的关系
         Map<String, List<BodyPart>> bodyMap = new LinkedHashMap<>();
         List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
@@ -71,13 +71,8 @@ public class EntityProcessPacsNew extends EntityProcess {
             }
             map.put(lemma.getText(), pacs);
         }
-        List<PacsNew> pacsNewList = pacsLabel.getPacsNewList();
-        for (PacsNew p : pacsNewList) {
-            if (map.get(p.getName()) != null) {
-                p.setPacsResults(map.get(p.getName()).getPacsResults());
-                p.setDisease(map.get(p.getName()).getDisease());
-            }
-        }
+        return map;
+
     }
 
     /**

+ 2 - 1
src/main/java/com/diagbot/model/label/PresentLabel.java

@@ -19,7 +19,8 @@ public class PresentLabel extends GeneralLabel {
     //临床表现
     private List<Clinical> clinicals = new ArrayList<>();
     //辅助检查
-    private List<Pacs> pacses;
+//    private List<Pacs> pacses;
+    List<PacsNew> pacsNewList = new ArrayList<>(); // 辅检信息
     //化验
     private List<Lis> lises;
     //治疗