|
@@ -1,25 +1,12 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
import com.diagbot.client.ChiefPresentSimilarityServiceClient;
|
|
import com.diagbot.client.ChiefPresentSimilarityServiceClient;
|
|
import com.diagbot.client.StandConvertServiceClient;
|
|
import com.diagbot.client.StandConvertServiceClient;
|
|
-import com.diagbot.dto.BillNeoDTO;
|
|
|
|
-import com.diagbot.dto.CriticalNeoDTO;
|
|
|
|
-import com.diagbot.dto.HighRiskNeoDTO;
|
|
|
|
-import com.diagbot.dto.NeoPushDTO;
|
|
|
|
-import com.diagbot.dto.NodeNeoDTO;
|
|
|
|
-import com.diagbot.dto.OtherTipNeoDTO;
|
|
|
|
-import com.diagbot.dto.OtherTipPacsNeoDTO;
|
|
|
|
-import com.diagbot.dto.OtherTipTransfusionNeoDTO;
|
|
|
|
-import com.diagbot.dto.PushBaseDTO;
|
|
|
|
-import com.diagbot.dto.StandConvertCrfBatchDTO;
|
|
|
|
-import com.diagbot.dto.StandConvertCrfDTO;
|
|
|
|
-import com.diagbot.dto.WordCrfDTO;
|
|
|
|
-import com.diagbot.entity.node.LisRemind;
|
|
|
|
-import com.diagbot.entity.node.Medicine;
|
|
|
|
-import com.diagbot.entity.node.Symptom;
|
|
|
|
-import com.diagbot.entity.node.YiBaoDiseaseName;
|
|
|
|
|
|
+import com.diagbot.dto.*;
|
|
|
|
+import com.diagbot.entity.node.*;
|
|
import com.diagbot.enums.RedisEnum;
|
|
import com.diagbot.enums.RedisEnum;
|
|
import com.diagbot.enums.StandConvertEnum;
|
|
import com.diagbot.enums.StandConvertEnum;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
@@ -29,14 +16,9 @@ import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.NeoUtil;
|
|
import com.diagbot.util.NeoUtil;
|
|
import com.diagbot.util.RedisUtil;
|
|
import com.diagbot.util.RedisUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
-import com.diagbot.vo.BillNeoVO;
|
|
|
|
-import com.diagbot.vo.CriticalNeoVO;
|
|
|
|
-import com.diagbot.vo.Drug;
|
|
|
|
-import com.diagbot.vo.NeoPushVO;
|
|
|
|
-import com.diagbot.vo.StandConvert;
|
|
|
|
-import com.diagbot.vo.StandConvertCrfVO;
|
|
|
|
|
|
+import com.diagbot.vo.*;
|
|
import com.diagbot.vo.neoPushEntity.ChiefPushVo;
|
|
import com.diagbot.vo.neoPushEntity.ChiefPushVo;
|
|
-import com.diagbot.vo.neoPushEntity.Diag;
|
|
|
|
|
|
+import com.diagbot.vo.neoPushEntity.PacsPushVo;
|
|
import com.diagbot.vo.neoPushEntity.PresentPushVo;
|
|
import com.diagbot.vo.neoPushEntity.PresentPushVo;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
@@ -50,14 +32,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Collection;
|
|
|
|
-import java.util.Collections;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.Iterator;
|
|
|
|
-import java.util.LinkedHashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
@@ -117,6 +92,8 @@ public class NeoFacade {
|
|
TransfusionSuggestRepository transfusionSuggestRepository;
|
|
TransfusionSuggestRepository transfusionSuggestRepository;
|
|
@Autowired
|
|
@Autowired
|
|
PacsRemindRepository pacsRemindRepository;
|
|
PacsRemindRepository pacsRemindRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsResultRepository pacsResultRepository;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 返回药品缓存信息
|
|
* 返回药品缓存信息
|
|
@@ -225,14 +202,14 @@ public class NeoFacade {
|
|
* @param pushVO
|
|
* @param pushVO
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<NeoPushDTO> getReversePush(NeoPushVO pushVO) {
|
|
|
|
- List<NeoPushDTO> neoPushDTOS = new ArrayList<>();
|
|
|
|
|
|
+ public NeoPushDTO getReversePush(NeoPushVO pushVO) {
|
|
|
|
+ NeoPushDTO neoPushDTO = new NeoPushDTO();
|
|
// 如果有诊断名称,则通过诊断反推
|
|
// 如果有诊断名称,则通过诊断反推
|
|
if (null != pushVO.getDiagVo() && pushVO.getDiagVo().getDiags().size() > 0) {
|
|
if (null != pushVO.getDiagVo() && pushVO.getDiagVo().getDiags().size() > 0) {
|
|
- neoPushDTOS = getDiagInfo(pushVO);
|
|
|
|
|
|
+ neoPushDTO = getDiagInfo(pushVO);
|
|
}
|
|
}
|
|
|
|
|
|
- return neoPushDTOS;
|
|
|
|
|
|
+ return neoPushDTO;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -264,34 +241,22 @@ public class NeoFacade {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
symptoms = Stream.of(symptom_chief,symptom_present).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
symptoms = Stream.of(symptom_chief,symptom_present).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
- //症状推疾病
|
|
|
|
|
|
+ //症状、体征推疾病
|
|
List<String> allDis_bySymptom = getDisBySymptom(symptoms,age,sex);
|
|
List<String> allDis_bySymptom = getDisBySymptom(symptoms,age,sex);
|
|
allDis.addAll(allDis_bySymptom);
|
|
allDis.addAll(allDis_bySymptom);
|
|
- //体征推出的疾病
|
|
|
|
- //化验推出的疾病辅检
|
|
|
|
|
|
+ //化验推出的疾病
|
|
//辅检推出的疾病
|
|
//辅检推出的疾病
|
|
- //推送出的所有疾病进行性别和年龄的过滤
|
|
|
|
- Map<String, String> disSexCache = getDisSexCache();
|
|
|
|
- Map<String, String> disAgeCache = getDisAgeCache();
|
|
|
|
- Iterator<String> iterator_dis = allDis.iterator();
|
|
|
|
- while (iterator_dis.hasNext()){
|
|
|
|
- String disease = iterator_dis.next();
|
|
|
|
- if(disSexCache.containsKey(disease)){
|
|
|
|
- if((disSexCache.get(disease) == "男" && sex != 1) ||
|
|
|
|
- (disSexCache.get(disease) == "女" && sex != 2)){
|
|
|
|
- iterator_dis.remove();
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(disAgeCache.containsKey(disease)){
|
|
|
|
- String[] betweenAge = disAgeCache.get(disease).split("-");
|
|
|
|
- if(betweenAge.length == 2 && (age < Double.parseDouble(betweenAge[0])
|
|
|
|
- || age > Double.parseDouble(betweenAge[1]))){
|
|
|
|
- iterator_dis.remove();
|
|
|
|
- }
|
|
|
|
|
|
+ PacsPushVo pacsPushVo = pushVO.getPacsPushVo();
|
|
|
|
+ if(pacsPushVo !=null){
|
|
|
|
+ List<Item> pacs = pacsPushVo.getPacs();
|
|
|
|
+ if(ListUtil.isNotEmpty(pacs)){
|
|
|
|
+ List<String> pacsNames = pacs.stream().map(x -> x.getUniqueName()).collect(Collectors.toList());
|
|
|
|
+ List<String> allDis_byPacsResult = getDisByPacsResult(pacsNames, age, sex);
|
|
|
|
+ allDis.addAll(allDis_byPacsResult);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //推送出的所有疾病进行性别和年龄的过滤
|
|
Map<Long,List<String>> numberDiseasesMap = disCountSort(allDis);
|
|
Map<Long,List<String>> numberDiseasesMap = disCountSort(allDis);
|
|
//根据发病率排序
|
|
//根据发病率排序
|
|
Map<String, Double> disdistributionCache = self.getDisdistributionCache();
|
|
Map<String, Double> disdistributionCache = self.getDisdistributionCache();
|
|
@@ -310,10 +275,10 @@ public class NeoFacade {
|
|
y.forEach(dis -> dis_dbt.put(dis,disdistributionCache.get(dis)));
|
|
y.forEach(dis -> dis_dbt.put(dis,disdistributionCache.get(dis)));
|
|
disPack.put(x,dis_dbt);
|
|
disPack.put(x,dis_dbt);
|
|
});
|
|
});
|
|
- Map<Long,List<String>> num_sortDiseases = new HashMap<>();
|
|
|
|
-
|
|
|
|
disPack.forEach((x,y)->{
|
|
disPack.forEach((x,y)->{
|
|
- Map<String, Double> collect = y.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByValue())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,LinkedHashMap::new));
|
|
|
|
|
|
+ Map<String, Double> collect = y.entrySet().stream()
|
|
|
|
+ .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,LinkedHashMap::new));
|
|
disPack.put(x,collect);
|
|
disPack.put(x,collect);
|
|
collect.forEach((k,n)->{
|
|
collect.forEach((k,n)->{
|
|
NeoPushDTO neoPushDTO = new NeoPushDTO();
|
|
NeoPushDTO neoPushDTO = new NeoPushDTO();
|
|
@@ -322,10 +287,8 @@ public class NeoFacade {
|
|
neoPushDTO.setDisease(pushBaseDTO);
|
|
neoPushDTO.setDisease(pushBaseDTO);
|
|
neoPushDTOS.add(neoPushDTO);
|
|
neoPushDTOS.add(neoPushDTO);
|
|
});
|
|
});
|
|
-
|
|
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
return neoPushDTOS;
|
|
return neoPushDTOS;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -334,11 +297,19 @@ public class NeoFacade {
|
|
//取交集
|
|
//取交集
|
|
symptoms.retainAll(symptomCache);
|
|
symptoms.retainAll(symptomCache);
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
- List<String> allDis_bySymptom = pushDis(symptomNameRepository, symptoms,age,sex);
|
|
|
|
|
|
+ List<String> allDis_bySymptom = pushDisBySymptom(symptomNameRepository, symptoms,age,sex);
|
|
long end = System.currentTimeMillis();
|
|
long end = System.currentTimeMillis();
|
|
return allDis_bySymptom;
|
|
return allDis_bySymptom;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<String> getDisByPacsResult(List<String> pacsResult,Double age,Integer sex){
|
|
|
|
+ List<PacsResult> byNameIn = pacsResultRepository.findByNameIn(pacsResult);
|
|
|
|
+ List<String> allDis = byNameIn.stream()
|
|
|
|
+ .map(z -> z.getDisease().stream().filter(o -> NeoUtil.matchBasic(o,sex,age)).map(y -> y.getName()).collect(Collectors.toList())).flatMap(List::stream)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ return allDis;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -347,31 +318,16 @@ public class NeoFacade {
|
|
* @param symptoms
|
|
* @param symptoms
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<String> pushDis(SymptomNameRepository symptomNameRepository,List<String> symptoms,Double age,Integer sex){
|
|
|
|
|
|
+ public List<String> pushDisBySymptom(SymptomNameRepository symptomNameRepository,List<String> symptoms,Double age,Integer sex){
|
|
List<String> allDis = Lists.newArrayList();
|
|
List<String> allDis = Lists.newArrayList();
|
|
-
|
|
|
|
- /*if(ListUtil.isNotEmpty(symptoms)){
|
|
|
|
- symptoms.parallelStream().forEach(x ->{
|
|
|
|
- List<Symptom> byNameIs = symptomNameRepository.findByNameIs(x);
|
|
|
|
- if(ListUtil.isNotEmpty(byNameIs)){
|
|
|
|
- List<String> diseases = byNameIs.stream().filter(z -> z.getDisease() != null && z.getDisease().size() > 0)
|
|
|
|
- .map(z -> z.getDisease().stream().map(y -> y.getName()).collect(Collectors.toList())).flatMap(List::stream)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- allDis.addAll(diseases);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }*/
|
|
|
|
List<Symptom> byNameIn = symptomNameRepository.findByNameIn(symptoms);
|
|
List<Symptom> byNameIn = symptomNameRepository.findByNameIn(symptoms);
|
|
- /*List<YiBaoDiseaseName> collect = byNameIn.stream()
|
|
|
|
- .map(x -> x.getDisease().stream().filter(z -> NeoUtil.matchBasic(z,sex,age)).collect(Collectors.toList()))
|
|
|
|
- .flatMap(List::stream).collect(Collectors.toList());*/
|
|
|
|
-
|
|
|
|
- allDis = byNameIn.stream()
|
|
|
|
|
|
+ allDis = byNameIn.parallelStream()
|
|
.map(z -> z.getDisease().stream().filter(o -> NeoUtil.matchBasic(o,sex,age)).map(y -> y.getName()).collect(Collectors.toList())).flatMap(List::stream)
|
|
.map(z -> z.getDisease().stream().filter(o -> NeoUtil.matchBasic(o,sex,age)).map(y -> y.getName()).collect(Collectors.toList())).flatMap(List::stream)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
return allDis;
|
|
return allDis;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 推送的疾病计数排序
|
|
* 推送的疾病计数排序
|
|
* @param allDis
|
|
* @param allDis
|
|
@@ -684,16 +640,14 @@ public class NeoFacade {
|
|
* @param neoPushVO
|
|
* @param neoPushVO
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<NeoPushDTO> getDiagInfo(NeoPushVO neoPushVO) {
|
|
|
|
-
|
|
|
|
- List<NeoPushDTO> neoPushDTOs = new ArrayList<>();
|
|
|
|
- NeoPushDTO pushDTO;
|
|
|
|
|
|
+ public NeoPushDTO getDiagInfo(NeoPushVO neoPushVO) {
|
|
|
|
+ NeoPushDTO pushDTO = new NeoPushDTO();
|
|
|
|
|
|
YiBaoDiseaseNode icdDiseaseNode = new YiBaoDiseaseNode();
|
|
YiBaoDiseaseNode icdDiseaseNode = new YiBaoDiseaseNode();
|
|
String term;
|
|
String term;
|
|
|
|
|
|
- for (Diag diag : neoPushVO.getDiagVo().getDiags()) {
|
|
|
|
- term = diag.getName();
|
|
|
|
|
|
+// for (Diag diag : neoPushVO.getDiagVo().getDiags()) {
|
|
|
|
+ term = neoPushVO.getDiagVo().getDiags().get(0).getName();
|
|
List<YiBaoDiseaseName> yiBaoName = yiBaoDiseaseRepository.findByNameIs(term);
|
|
List<YiBaoDiseaseName> yiBaoName = yiBaoDiseaseRepository.findByNameIs(term);
|
|
YiBaoDiseaseName icdDisease = null;
|
|
YiBaoDiseaseName icdDisease = null;
|
|
if(ListUtil.isNotEmpty(yiBaoName)){
|
|
if(ListUtil.isNotEmpty(yiBaoName)){
|
|
@@ -702,13 +656,13 @@ public class NeoFacade {
|
|
if (icdDisease != null) {
|
|
if (icdDisease != null) {
|
|
pushDTO = icdDiseaseNode.YiBaoDiseasetoDiseaseDTO(icdDisease, neoPushVO);
|
|
pushDTO = icdDiseaseNode.YiBaoDiseasetoDiseaseDTO(icdDisease, neoPushVO);
|
|
|
|
|
|
- if (null != pushDTO) {
|
|
|
|
|
|
+ /*if (null != pushDTO) {
|
|
neoPushDTOs.add(pushDTO);
|
|
neoPushDTOs.add(pushDTO);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+// }
|
|
|
|
|
|
- return neoPushDTOs;
|
|
|
|
|
|
+ return pushDTO;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|