|
@@ -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;
|
|
|
+ }
|
|
|
}
|