|
@@ -210,12 +210,12 @@ public class NeoFacade {
|
|
|
|
|
|
public void symptomFeatureCache() {
|
|
|
List<SymptomFeature> symptomFeatures = symptomFeatureMapper.selectList(null);
|
|
|
- if(ListUtil.isNotEmpty(symptomFeatures)){
|
|
|
+ if (ListUtil.isNotEmpty(symptomFeatures)) {
|
|
|
Map map = symptomFeatures.stream().collect(Collectors.toMap(
|
|
|
k -> RedisEnum.symptomFeature.getName() + k.getMinCombineElement(),
|
|
|
v -> {
|
|
|
Map<String, String> desc = new HashMap<>();
|
|
|
- desc.put("minCombineElement",v.getMinCombineElement());
|
|
|
+ desc.put("minCombineElement", v.getMinCombineElement());
|
|
|
desc.put("bodyPart", v.getBodyPart());
|
|
|
desc.put("change", v.getVariety());
|
|
|
desc.put("color", v.getColor());
|
|
@@ -375,11 +375,11 @@ public class NeoFacade {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "并行推送疾病出错" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
- filterAndSort(pushDis, allDis, sex, age, pd,depts);
|
|
|
+ filterAndSort(pushDis, allDis, sex, age, pd, depts);
|
|
|
//特异值推送的诊断添加到症状推送诊断的头部
|
|
|
pushDisByPacs.removeAll(pushDisByLis);
|
|
|
pushDisByLis.addAll(pushDisByPacs);
|
|
|
- filterAndSort(pushSpeDis,pushDisByLis, sex, age, pd,depts);
|
|
|
+ filterAndSort(pushSpeDis, pushDisByLis, sex, age, pd, depts);
|
|
|
pushDis.removeAll(pushSpeDis);
|
|
|
pushSpeDis.addAll(pushDis);
|
|
|
|
|
@@ -429,6 +429,7 @@ public class NeoFacade {
|
|
|
|
|
|
/**
|
|
|
* 化验特异性推送疾病
|
|
|
+ *
|
|
|
* @param pushVO
|
|
|
* @return
|
|
|
*/
|
|
@@ -496,7 +497,8 @@ public class NeoFacade {
|
|
|
List<Item> pacs = pacsPushVo.getPacs();
|
|
|
if (ListUtil.isNotEmpty(pacs)) {
|
|
|
List<String> pacsNames = pacs.stream().map(x -> x.getUniqueName()).collect(Collectors.toList());
|
|
|
- allDis_byPacsResult = pacsResultRepository.getDisByPacsResults(pacsNames);;
|
|
|
+ allDis_byPacsResult = pacsResultRepository.getDisByPacsResults(pacsNames);
|
|
|
+ ;
|
|
|
}
|
|
|
}
|
|
|
return allDis_byPacsResult;
|
|
@@ -504,110 +506,142 @@ public class NeoFacade {
|
|
|
|
|
|
/**
|
|
|
* 根据主症状推送诊断
|
|
|
+ *
|
|
|
* @param pushVO
|
|
|
* @return
|
|
|
*/
|
|
|
public List<String> pushDisBySymptom_main(NeoPushVO pushVO) {
|
|
|
List<String> disBySymptom_main = Lists.newArrayList();
|
|
|
List<String> symptoms = getSymptoms(pushVO);
|
|
|
- if(ListUtil.isNotEmpty(symptoms)){
|
|
|
+ String name = RedisEnum.symptomFeature.getName();
|
|
|
+ Set<String> keys = redisUtil.keys(name + "*");
|
|
|
+ List<String> redis_key = keys.stream().map(x -> x.split(name)[1]).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(symptoms)) {
|
|
|
String s_m = symptoms.get(0);
|
|
|
disBySymptom_main = nodeRepository.getDisBySymptom_main(s_m);
|
|
|
- /*if(ListUtil.isEmpty(disBySymptom_main) && ListUtil.isNotEmpty(pushVO.getSymptoms())){
|
|
|
- String s_second = pushVO.getSymptoms().get(0);
|
|
|
- disBySymptom_main = nodeRepository.getDisBySymptom_main(s_second);
|
|
|
- }*/
|
|
|
- if(ListUtil.isEmpty(disBySymptom_main)){
|
|
|
- String name = RedisEnum.symptomFeature.getName();
|
|
|
- Set<String> keys = redisUtil.keys(name + "*");
|
|
|
- List<String> redis_key = keys.stream().map(x -> x.split(name)[1]).collect(Collectors.toList());
|
|
|
- if(ListUtil.isNotEmpty(redis_key)){
|
|
|
- List<String> filter_keys = redis_key.stream().filter(x -> s_m.contains(x)).collect(Collectors.toList());
|
|
|
- List<Map<String,String>> redisDatas = redisUtil.getSf(filter_keys, RedisEnum.symptomFeature.getName());
|
|
|
- Map<String,List<String>> min_filds = Maps.newHashMap();
|
|
|
- if(ListUtil.isNotEmpty(redisDatas)){
|
|
|
- redisDatas.forEach(x ->{
|
|
|
- List<String> datas = Lists.newArrayList();
|
|
|
- String minCombineElement = x.get("minCombineElement");
|
|
|
- String radiationSituation = x.get("radiationSituation");
|
|
|
- String color = x.get("color");
|
|
|
- String change = x.get("change");
|
|
|
- String degree = x.get("degree");
|
|
|
- String shapePropety = x.get("shapePropety");
|
|
|
- String position = x.get("position");
|
|
|
- String bodyPart = x.get("bodyPart");
|
|
|
- String frequency = x.get("frequency");
|
|
|
- searchWord(radiationSituation,s_m,"、",datas);
|
|
|
- searchWord(color,s_m,"、",datas);
|
|
|
- searchWord(change,s_m,"、",datas);
|
|
|
- searchWord(degree,s_m,"、",datas);
|
|
|
- searchWord(shapePropety,s_m,"、",datas);
|
|
|
- searchWord(position,s_m,"、",datas);
|
|
|
- searchWord(bodyPart,s_m,"、",datas);
|
|
|
- searchWord(frequency,s_m,"、",datas);
|
|
|
- min_filds.put(minCombineElement,datas);
|
|
|
- });
|
|
|
+ Map<Integer, List<String>> fild_pailie = splitSymptom(s_m, redis_key);
|
|
|
+ //拆分主症状找疾病
|
|
|
+ if (ListUtil.isEmpty(disBySymptom_main)) {
|
|
|
+ if (MapUtils.isNotEmpty(fild_pailie)) {
|
|
|
+ Map<Integer, List<String>> result = fild_pailie.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByKey()))
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new));
|
|
|
+ for (Map.Entry<Integer, List<String>> fd : result.entrySet()) {
|
|
|
+ List<String> sv = redisUtil.getSv(fd.getValue(), RedisEnum.symptomMainFeature.getName());
|
|
|
+ sv = sv.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(sv)) {
|
|
|
+ disBySymptom_main = nodeRepository.getDisBySymptom_main(sv.get(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- if(MapUtils.isNotEmpty(min_filds)){
|
|
|
- Map<Integer, List<String>> fild_pailie = Maps.newHashMap();
|
|
|
- min_filds.forEach((k,v) ->{
|
|
|
- v.add(k);
|
|
|
- for(int i=v.size(); i>0; i--){
|
|
|
- List<String> datad = permutationNoRepeat(v, i);
|
|
|
- if(fild_pailie.containsKey(i)){
|
|
|
- List<String> strings = fild_pailie.get(i);
|
|
|
- datad.removeAll(strings);
|
|
|
- strings.addAll(datad);
|
|
|
- fild_pailie.put(i,strings);
|
|
|
- }else {
|
|
|
- fild_pailie.put(i,datad);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if(MapUtils.isNotEmpty(fild_pailie)){
|
|
|
- Map<Integer, List<String>> result = fild_pailie.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByKey()))
|
|
|
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new));
|
|
|
- for (Map.Entry<Integer, List<String>> fd:result.entrySet()) {
|
|
|
- List<String> sv = redisUtil.getSv(fd.getValue(), RedisEnum.symptomMainFeature.getName());
|
|
|
- sv = sv.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList());
|
|
|
- if(ListUtil.isNotEmpty(sv)){
|
|
|
- disBySymptom_main = nodeRepository.getDisBySymptom_main(sv.get(0));
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ListUtil.isEmpty(disBySymptom_main)) {
|
|
|
+ if (MapUtils.isNotEmpty(fild_pailie)) {
|
|
|
+ Map<Integer, List<String>> result = fild_pailie.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByKey()))
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new));
|
|
|
+ for (Map.Entry<Integer, List<String>> fd : result.entrySet()) {
|
|
|
+ List<String> sv = redisUtil.getSv(fd.getValue(), RedisEnum.symptomVitalType.getName());
|
|
|
+ sv = sv.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(sv)) {
|
|
|
+ disBySymptom_main = symptomRepository.getDisBySymptoms_1(Lists.newArrayList(sv.get(0)));
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ List<String> symptoms1 = pushVO.getSymptoms();
|
|
|
+ if (ListUtil.isEmpty(disBySymptom_main) && ListUtil.isNotEmpty(symptoms1)) {
|
|
|
+ Map<Integer, List<String>> fild_pailie = splitSymptom(symptoms1.get(0), redis_key);
|
|
|
+ if (MapUtils.isNotEmpty(fild_pailie)) {
|
|
|
+ Map<Integer, List<String>> result = fild_pailie.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByKey()))
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new));
|
|
|
+ for (Map.Entry<Integer, List<String>> fd : result.entrySet()) {
|
|
|
+ List<String> sv = redisUtil.getSv(fd.getValue(), RedisEnum.symptomVitalType.getName());
|
|
|
+ sv = sv.stream().filter(x -> StringUtils.isNotBlank(x)).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(sv)) {
|
|
|
+ disBySymptom_main = symptomRepository.getDisBySymptoms_1(Lists.newArrayList(sv.get(0)));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return disBySymptom_main;
|
|
|
}
|
|
|
|
|
|
- public void searchWord(String color,String regionWord,String patternFild,List<String> datas){
|
|
|
- if(StringUtil.isNotEmpty(color)){
|
|
|
+
|
|
|
+ private Map<Integer, List<String>> splitSymptom(String s_m, List<String> redis_key) {
|
|
|
+ List<String> filter_keys = redis_key.stream().filter(x -> s_m.contains(x)).collect(Collectors.toList());
|
|
|
+ List<Map<String, String>> redisDatas = redisUtil.getSf(filter_keys, RedisEnum.symptomFeature.getName());
|
|
|
+ Map<String, List<String>> min_filds = Maps.newHashMap();
|
|
|
+ if (ListUtil.isNotEmpty(redisDatas)) {
|
|
|
+ redisDatas.forEach(x -> {
|
|
|
+ List<String> datas = Lists.newArrayList();
|
|
|
+ String minCombineElement = x.get("minCombineElement");
|
|
|
+ String radiationSituation = x.get("radiationSituation");
|
|
|
+ String color = x.get("color");
|
|
|
+ String change = x.get("change");
|
|
|
+ String degree = x.get("degree");
|
|
|
+ String shapePropety = x.get("shapePropety");
|
|
|
+ String position = x.get("position");
|
|
|
+ String bodyPart = x.get("bodyPart");
|
|
|
+ String frequency = x.get("frequency");
|
|
|
+ searchWord(radiationSituation, s_m, "、", datas);
|
|
|
+ searchWord(color, s_m, "、", datas);
|
|
|
+ searchWord(change, s_m, "、", datas);
|
|
|
+ searchWord(degree, s_m, "、", datas);
|
|
|
+ searchWord(shapePropety, s_m, "、", datas);
|
|
|
+ searchWord(position, s_m, "、", datas);
|
|
|
+ searchWord(bodyPart, s_m, "、", datas);
|
|
|
+ searchWord(frequency, s_m, "、", datas);
|
|
|
+ min_filds.put(minCombineElement, datas);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ Map<Integer, List<String>> fild_pailie = Maps.newHashMap();
|
|
|
+ if (MapUtils.isNotEmpty(min_filds)) {
|
|
|
+ min_filds.forEach((k, v) -> {
|
|
|
+ v.add(k);
|
|
|
+ for (int i = v.size(); i > 0; i--) {
|
|
|
+ List<String> datad = permutationNoRepeat(v, i);
|
|
|
+ if (fild_pailie.containsKey(i)) {
|
|
|
+ List<String> strings = fild_pailie.get(i);
|
|
|
+ datad.removeAll(strings);
|
|
|
+ strings.addAll(datad);
|
|
|
+ fild_pailie.put(i, strings);
|
|
|
+ } else {
|
|
|
+ fild_pailie.put(i, datad);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return fild_pailie;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void searchWord(String color, String regionWord, String patternFild, List<String> datas) {
|
|
|
+ if (StringUtil.isNotEmpty(color)) {
|
|
|
String[] splitsData = color.split(patternFild);
|
|
|
- for (String fils:splitsData) {
|
|
|
- if(regionWord.contains(fils)){
|
|
|
+ for (String fils : splitsData) {
|
|
|
+ if (regionWord.contains(fils)) {
|
|
|
datas.add(fils);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public List<String> getSymptoms(NeoPushVO pushVO){
|
|
|
+ public List<String> getSymptoms(NeoPushVO pushVO) {
|
|
|
List<String> symptom_chief = Lists.newArrayList();
|
|
|
List<String> symptom_present = Lists.newArrayList();
|
|
|
ChiefPushVo chiefPushVo = pushVO.getChiefPushVo();
|
|
|
PresentPushVo presentPushVo = pushVO.getPresentPushVo();
|
|
|
- if(chiefPushVo != null){
|
|
|
+ if (chiefPushVo != null) {
|
|
|
List<Symptom> symptoms = chiefPushVo.getSymptoms();
|
|
|
- if(ListUtil.isNotEmpty(symptoms)){
|
|
|
+ if (ListUtil.isNotEmpty(symptoms)) {
|
|
|
symptom_chief = symptoms.stream().map(x -> x.getName()).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|
|
|
- if(presentPushVo != null){
|
|
|
+ if (presentPushVo != null) {
|
|
|
List<Symptom> symptoms = presentPushVo.getSymptoms();
|
|
|
- if(ListUtil.isNotEmpty(symptoms)){
|
|
|
+ if (ListUtil.isNotEmpty(symptoms)) {
|
|
|
symptom_present = symptoms.stream().map(x -> x.getName()).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|
|
@@ -656,7 +690,7 @@ public class NeoFacade {
|
|
|
if (presentPushVo != null) {
|
|
|
if (ListUtil.isNotEmpty(presentPushVo.getSymptoms())) {
|
|
|
symptom_present = presentPushVo.getSymptoms().stream().map(x -> x.getName()).collect(Collectors.toList());
|
|
|
- symptom_present = symptom_present.size() >= 5? symptom_present.subList(0,5) : symptom_present;
|
|
|
+ symptom_present = symptom_present.size() >= 5 ? symptom_present.subList(0, 5) : symptom_present;
|
|
|
}
|
|
|
}
|
|
|
symptoms = Stream.of(symptom_chief, symptom_present).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
@@ -665,28 +699,28 @@ public class NeoFacade {
|
|
|
allDis.addAll(allDis_bySymptom);
|
|
|
}
|
|
|
|
|
|
- public List<String> getDisBySymptom_other(NeoPushVO pushVO){
|
|
|
+ public List<String> getDisBySymptom_other(NeoPushVO pushVO) {
|
|
|
List<String> disBySymptoms_1 = Lists.newArrayList();
|
|
|
List<String> symptoms = getSymptoms(pushVO);
|
|
|
- if(ListUtil.isNotEmpty(symptoms) && symptoms.size() > 2){
|
|
|
- symptoms = symptoms.size() >= 5?symptoms.subList(1,5):symptoms;
|
|
|
- List<String> sv = redisUtil.getSv(symptoms,RedisEnum.symptomVitalType.getName());
|
|
|
+ if (ListUtil.isNotEmpty(symptoms) && symptoms.size() > 2) {
|
|
|
+ symptoms = symptoms.size() >= 5 ? symptoms.subList(1, 5) : symptoms;
|
|
|
+ List<String> sv = redisUtil.getSv(symptoms, RedisEnum.symptomVitalType.getName());
|
|
|
disBySymptoms_1 = symptomRepository.getDisBySymptoms_1(sv);
|
|
|
}
|
|
|
return disBySymptoms_1;
|
|
|
}
|
|
|
|
|
|
- public List<String> getDisByVital(NeoPushVO pushVO){
|
|
|
+ public List<String> getDisByVital(NeoPushVO pushVO) {
|
|
|
List<String> disByVital = Lists.newArrayList();
|
|
|
List<String> symptoms = getSymptoms(pushVO);
|
|
|
- if(ListUtil.isNotEmpty(symptoms)){
|
|
|
- List<String> sv = redisUtil.getSv(symptoms,RedisEnum.vitalType.getName());
|
|
|
+ if (ListUtil.isNotEmpty(symptoms)) {
|
|
|
+ List<String> sv = redisUtil.getSv(symptoms, RedisEnum.vitalType.getName());
|
|
|
disByVital = symptomRepository.getDisByVital(sv);
|
|
|
}
|
|
|
return disByVital;
|
|
|
}
|
|
|
|
|
|
- public List<String> getDisByLis_other(NeoPushVO pushVO){
|
|
|
+ public List<String> getDisByLis_other(NeoPushVO pushVO) {
|
|
|
List<Lis> lises = null;
|
|
|
LisPushVo lisPushVo = pushVO.getLisPushVo();
|
|
|
if (lisPushVo != null) {
|
|
@@ -710,7 +744,7 @@ public class NeoFacade {
|
|
|
if (ListUtil.isNotEmpty(allDis)) {
|
|
|
diseases = redisUtil.geth(allDis);
|
|
|
allDis = diseases.stream().filter(x -> NeoUtil.matchBasic(x, gender_code, age) && NeoUtil.matchPds(x.get("name"), pd)
|
|
|
- && NeoUtil.matchDept(x,depts)).map(x -> x.get("name")).collect(Collectors.toList());
|
|
|
+ && NeoUtil.matchDept(x, depts)).map(x -> x.get("name")).collect(Collectors.toList());
|
|
|
// diseases.forEach(x -> dis_fbl.put(x.get("name"), Double.parseDouble(x.get("fbl"))));
|
|
|
/*List<Map<String, String>> symptomNumOfDis = redisUtil.getSymptomNumOfDis(allDis);
|
|
|
if(ListUtil.isNotEmpty(symptomNumOfDis)){
|
|
@@ -723,8 +757,8 @@ public class NeoFacade {
|
|
|
}
|
|
|
|
|
|
Map<Long, List<String>> numberDiseasesMap = disCountSort(allDis);
|
|
|
- if(MapUtils.isNotEmpty(numberDiseasesMap)){
|
|
|
- for(Map.Entry<Long, List<String>> ds:numberDiseasesMap.entrySet()){
|
|
|
+ if (MapUtils.isNotEmpty(numberDiseasesMap)) {
|
|
|
+ for (Map.Entry<Long, List<String>> ds : numberDiseasesMap.entrySet()) {
|
|
|
dises.addAll(ds.getValue());
|
|
|
}
|
|
|
}
|
|
@@ -753,7 +787,7 @@ public class NeoFacade {
|
|
|
}
|
|
|
|
|
|
public List<String> getDisBySymptom(List<String> symptoms) {
|
|
|
- List<String> sv = redisUtil.getSv(symptoms,RedisEnum.symptomVitalType.getName());
|
|
|
+ List<String> sv = redisUtil.getSv(symptoms, RedisEnum.symptomVitalType.getName());
|
|
|
List<String> allDis_bySymptom = pushDisBySymptom(symptomRepository, sv);
|
|
|
return allDis_bySymptom;
|
|
|
}
|
|
@@ -1259,7 +1293,7 @@ public class NeoFacade {
|
|
|
* 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital"
|
|
|
*
|
|
|
* @param standConvert
|
|
|
- * @return Map<String , Map < String , String>> -->Map<类型, Map<原始词, 标准词>>
|
|
|
+ * @return Map<String, Map < String, String>> -->Map<类型, Map<原始词, 标准词>>
|
|
|
*/
|
|
|
public Map<String, Map<String, String>> standConvertCrf(StandConvert standConvert) {
|
|
|
Map<String, Map<String, String>> map = new LinkedHashMap<>();
|
|
@@ -1396,7 +1430,7 @@ public class NeoFacade {
|
|
|
* @param map
|
|
|
*/
|
|
|
public void getConvertMapDisease(Map<String, Map<String, StandConvertCrfDTO>> crfDTO, String type, List<String> convertList,
|
|
|
- List<String> originList, Map<String, Map<String, String>> map) {
|
|
|
+ List<String> originList, Map<String, Map<String, String>> map) {
|
|
|
Map<String, String> typeMap = new LinkedHashMap<>();
|
|
|
|
|
|
if (ListUtil.isNotEmpty(convertList)) {
|