瀏覽代碼

Merge remote-tracking branch 'origin/master'

zhoutg 4 年之前
父節點
當前提交
3b71d0f292

+ 6 - 17
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -2,30 +2,18 @@ package com.diagbot.facade;
 
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
-import com.diagbot.biz.push.entity.Pacs;
 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.PacsNew;
-import com.diagbot.model.label.ChiefLabel;
-import com.diagbot.model.label.DiagLabel;
-import com.diagbot.model.label.PastLabel;
-import com.diagbot.model.label.PresentLabel;
-import com.diagbot.model.label.VitalLabel;
+import com.diagbot.model.label.*;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.NeoPushVO;
 import com.diagbot.vo.SearchData;
 import com.diagbot.vo.StandConvert;
-import com.diagbot.vo.neoPushEntity.ChiefPushVo;
-import com.diagbot.vo.neoPushEntity.Diag;
-import com.diagbot.vo.neoPushEntity.DiagVo;
-import com.diagbot.vo.neoPushEntity.Drug;
-import com.diagbot.vo.neoPushEntity.LisPushVo;
-import com.diagbot.vo.neoPushEntity.PacsPushVo;
-import com.diagbot.vo.neoPushEntity.PresentPushVo;
-import com.diagbot.vo.neoPushEntity.Symptom;
+import com.diagbot.vo.neoPushEntity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -204,7 +192,8 @@ public class CommonFacade {
         List<Item> diagOrder = wordCrfDTO.getDiagOrder();
         PastLabel pastLabel = wordCrfDTO.getPastLabel();
         List<Lis> lis = wordCrfDTO.getLis();
-        List<Pacs> pacs = wordCrfDTO.getPacs();
+//        List<Pacs> pacs = wordCrfDTO.getPacs();
+        List<PacsNew> pacsNewList = wordCrfDTO.getPacsLabel().getPacsNewList();
         pushVO.setAge(wordCrfDTO.getAge());
         pushVO.setSex(wordCrfDTO.getSex());
         if (chiefLabel != null) {
@@ -253,9 +242,9 @@ public class CommonFacade {
             lisPushVo.setLises(lis);
             pushVO.setLisPushVo(lisPushVo);
         }
-        if(ListUtil.isNotEmpty(pacs)){
+        if(ListUtil.isNotEmpty(pacsNewList)){
             PacsPushVo pacsPushVo = new PacsPushVo();
-            pacsPushVo.setPacs(pacs);
+            pacsPushVo.setPacs(pacsNewList);
             pushVO.setPacsPushVo(pacsPushVo);
         }
         if(ListUtil.isNotEmpty(diagOrder)){

+ 39 - 11
src/main/java/com/diagbot/facade/PushFacade.java

@@ -1,17 +1,18 @@
 package com.diagbot.facade;
 
 import com.diagbot.biz.push.entity.Item;
-import com.diagbot.dto.*;
+import com.diagbot.dto.NeoPushDTO;
+import com.diagbot.dto.PushBaseDTO;
+import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.process.PushProcess;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -44,6 +45,7 @@ public class PushFacade {
         Map<String, Map<String, String>> standConvertMap = neoFacade.standConvertCrf(standConvert);
         commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
         List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
+        Map<String, List<String>> typeWords = typeWords(standConvertMap);
         //生成push入参,供图谱调用
         NeoPushVO pushVO = commonFacade.generatePushInput(wordCrfDTO);
         //图谱推送数据
@@ -54,19 +56,29 @@ public class PushFacade {
                 int length = pushVo.getLength();
                 // 症状
                 if (ruleTypeList.contains("1") && ListUtil.isNotEmpty(neoPushDTO.getSymptoms())) {
-                    pushDTO.setSymptom(neoPushDTO.getSymptoms().subList(0, neoPushDTO.getSymptoms().size() >= length ? length : neoPushDTO.getSymptoms().size()));
+                    List<PushBaseDTO> filterSymptoms = neoPushDTO.getSymptoms().stream().filter(x -> !typeWords.get(StandConvertEnum.clinical.getName()).contains(x.getName())).collect(Collectors.toList());
+                    pushDTO.setSymptom(filterSymptoms.subList(0, filterSymptoms.size() >= length ? length : filterSymptoms.size()));
                 }
                 // 查体
                 if (ruleTypeList.contains("4") && ListUtil.isNotEmpty(neoPushDTO.getVitals())) {
-                    pushDTO.setVital(neoPushDTO.getVitals().subList(0, neoPushDTO.getVitals().size() >= length ? length : neoPushDTO.getVitals().size()));
+                    List<PushBaseDTO> filtervitals = neoPushDTO.getSymptoms().stream().filter(x -> !typeWords.get(StandConvertEnum.vital.getName()).contains(x.getName())).collect(Collectors.toList());
+                    pushDTO.setVital(filtervitals.subList(0, filtervitals.size() >= length ? length : filtervitals.size()));
+                }
+                // 化验
+                if (ruleTypeList.contains("5") && ListUtil.isNotEmpty(neoPushDTO.getLis())) {
+                    List<PushBaseDTO> filterlis = neoPushDTO.getSymptoms().stream().filter(x -> !typeWords.get(StandConvertEnum.lis.getName()).contains(x.getName())).collect(Collectors.toList());
+                    pushDTO.setLis(filterlis.subList(0, filterlis.size() >= length ? length : filterlis.size()));
+                }
+                // 辅检
+                if (ruleTypeList.contains("6") && ListUtil.isNotEmpty(neoPushDTO.getPacs())) {
+                    List<PushBaseDTO> filterpacs = neoPushDTO.getSymptoms().stream().filter(x -> !typeWords.get(StandConvertEnum.pacs.getName()).contains(x.getName())).collect(Collectors.toList());
+                    pushDTO.setPacs(filterpacs.subList(0, filterpacs.size() >= length ? length : filterpacs.size()));
                 }
             }
 
         }
 
-
-
-        if (wordCrfDTO.getDiagLabel() != null && ListUtil.isNotEmpty(wordCrfDTO.getDiagLabel().getDiags())) { // 有诊断
+        /*if (wordCrfDTO.getDiagLabel() != null && ListUtil.isNotEmpty(wordCrfDTO.getDiagLabel().getDiags())) { // 有诊断
             List<String> diags = wordCrfDTO.getDiagLabel().getDiags().stream().map(r -> r.getStandName()).collect(Collectors.toList());
             PushNeoVO pushNeoVO = new PushNeoVO();
             pushNeoVO.setSex(pushVo.getSex());
@@ -110,7 +122,7 @@ public class PushFacade {
                 }
             }
 
-        }
+        }*/
         return pushDTO;
     }
 
@@ -124,4 +136,20 @@ public class PushFacade {
 
         return billNeoVO;
     }
+
+    public Map<String,List<String>> typeWords( Map<String, Map<String, String>> standConvertMap){
+        Map<String,List<String>> typeWordsMap = new HashMap<>();
+        for (Map.Entry<String, Map<String, String>> s:standConvertMap.entrySet()) {
+            List<String> words = new ArrayList<>();
+            String type = s.getKey();
+            Map<String, String> value = s.getValue();
+            value.forEach((name,standName)->{
+                words.add(name);
+                words.add(standName);
+            });
+            typeWordsMap.put(type,new ArrayList<>(new HashSet<>(words)));
+        }
+
+        return typeWordsMap;
+    }
 }

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

@@ -154,7 +154,7 @@ public class BeHospitalizedAI extends ModelAI {
 
                 StringBuffer sb = new StringBuffer();
                 for (PacsNew pacsNew : collect) {
-                    sb.append(pacsNew.getUniqueName() + ":").append(pacsNew.getResult() + "。\n");
+                    sb.append(StringUtils.isNotBlank(pacsNew.getUniqueName())? pacsNew.getUniqueName():pacsNew.getUniqueName()+ ":").append(pacsNew.getResult() + "。\n");
                 }
                 pacsLabel.setText(sb.toString());
                 pacsLabel.setAiText(sb.toString());

+ 2 - 2
src/main/java/com/diagbot/vo/neoPushEntity/PacsPushVo.java

@@ -1,6 +1,6 @@
 package com.diagbot.vo.neoPushEntity;
 
-import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.model.entity.PacsNew;
 import lombok.Data;
 
 import java.util.List;
@@ -12,5 +12,5 @@ import java.util.List;
  */
 @Data
 public class PacsPushVo {
-    private List<Pacs> pacs;
+    private List<PacsNew> pacs;
 }