|
@@ -21,6 +21,7 @@ import com.diagbot.vo.neoPushEntity.ChiefPushVo;
|
|
|
import com.diagbot.vo.neoPushEntity.Diag;
|
|
|
import com.diagbot.vo.neoPushEntity.PresentPushVo;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
@@ -30,6 +31,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -140,7 +142,14 @@ public class NeoFacade {
|
|
|
*/
|
|
|
@Cacheable(value = "cache", key = "'disSexCache'")
|
|
|
public Map<String,String> getDisSexCache() {
|
|
|
- Map<String, String> disSexClass = nodeRepository.getDisSexClass();
|
|
|
+ Map<String, String> disSexClass = Maps.newHashMap();
|
|
|
+ List<String> disSex = nodeRepository.getDisSexClass();
|
|
|
+ if (ListUtil.isNotEmpty(disSex)) {
|
|
|
+ disSex.parallelStream().forEach(x -> {
|
|
|
+ String[] splits = x.split("&");
|
|
|
+ disSexClass.put(splits[0], splits[1]);
|
|
|
+ });
|
|
|
+ }
|
|
|
return disSexClass;
|
|
|
}
|
|
|
/**
|
|
@@ -150,7 +159,14 @@ public class NeoFacade {
|
|
|
*/
|
|
|
@Cacheable(value = "cache", key = "'disAgeCache'")
|
|
|
public Map<String,String> getDisAgeCache() {
|
|
|
- Map<String, String> disAgeClass = nodeRepository.getDisAgeClass();
|
|
|
+ Map<String, String> disAgeClass = Maps.newHashMap();
|
|
|
+ List<String> ageClass = nodeRepository.getDisAgeClass();
|
|
|
+ if(ListUtil.isNotEmpty(ageClass)){
|
|
|
+ ageClass.parallelStream().forEach(x ->{
|
|
|
+ String[] splits = x.split("&");
|
|
|
+ disAgeClass.put(splits[0],splits[1]);
|
|
|
+ });
|
|
|
+ }
|
|
|
return disAgeClass;
|
|
|
}
|
|
|
/**
|
|
@@ -159,14 +175,18 @@ public class NeoFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
@Cacheable(value = "cache", key = "'disdistributionCache'")
|
|
|
- public Map<String,Float> getDisdistributionCache() {
|
|
|
- Map<String,Float> disdistribution = new HashMap<>();
|
|
|
- /*Map<String, String> disdistributionClass = nodeRepository.getDisdistributionClass();
|
|
|
- disdistributionClass.forEach((x,y) ->{
|
|
|
- disdistribution.put(x,Float.parseFloat(y));
|
|
|
- });
|
|
|
- return disdistribution;*/
|
|
|
- return null;
|
|
|
+ public Map<String,Double> getDisdistributionCache() {
|
|
|
+ DecimalFormat df = new DecimalFormat("0.######");
|
|
|
+ Map<String,Double> disdistribution = new HashMap<>();
|
|
|
+ List<String> disdistributionClass = nodeRepository.getDisdistributionClass();
|
|
|
+ if(ListUtil.isNotEmpty(disdistributionClass)){
|
|
|
+ disdistributionClass.parallelStream().forEach(x ->{
|
|
|
+ String[] splits = x.split("&");
|
|
|
+ disdistribution.put(splits[0],Double.parseDouble(splits[1]));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return disdistribution;
|
|
|
+
|
|
|
}
|
|
|
/**
|
|
|
* 图谱反推的数据
|
|
@@ -248,10 +268,24 @@ public class NeoFacade {
|
|
|
|
|
|
Map<Long,List<String>> numberDiseasesMap = disCountSort(allDis);
|
|
|
//根据发病率排序
|
|
|
- Map<String, Float> disdistributionCache = getDisdistributionCache();
|
|
|
- numberDiseasesMap.forEach((x,y) ->{
|
|
|
-
|
|
|
+ Map<String, Double> disdistributionCache = self.getDisdistributionCache();
|
|
|
+ numberDiseasesMap.forEach((x,y)->{
|
|
|
+ y.parallelStream().forEach(z ->{
|
|
|
+ if(disdistributionCache.containsKey(z)){
|
|
|
+ disdistributionCache.put(z,disdistributionCache.get(z));
|
|
|
+ }else {
|
|
|
+ disdistributionCache.put(z,0.0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ Map<Long,Map<String,Double>> disPack = new HashMap<>();
|
|
|
+ numberDiseasesMap.forEach((x,y)->{
|
|
|
+ Map<String,Double> dis_dbt = new HashMap<>();
|
|
|
+ y.parallelStream().forEach(dis -> dis_dbt.put(dis,disdistributionCache.get(dis)));
|
|
|
+ disPack.put(x,dis_dbt);
|
|
|
});
|
|
|
+ System.out.println();
|
|
|
+
|
|
|
|
|
|
// String dis_first = dis_count.entrySet().stream().map(x -> x.getKey()).collect(Collectors.toList()).get(0);
|
|
|
|