|
@@ -101,56 +101,58 @@ public class AIFacade {
|
|
|
|
|
|
FeatureRate item;
|
|
|
if (disFeatureMap.get("确诊") != null) {
|
|
|
- List<FeatureRate> featureRateList = disFeatureMap.get("确诊");
|
|
|
- featureRateList = featureRateList
|
|
|
- .stream()
|
|
|
- .filter(i -> i.getExtraProperty() != null)
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (ListUtil.isNotEmpty(featureRateList)) {
|
|
|
- Map<String, List<FeatureRate>> disMap
|
|
|
- = EntityUtil.makeEntityListMap(featureRateList, "extraProperty");
|
|
|
- List<Map.Entry<String, List<FeatureRate>>> list = new ArrayList<Map.Entry<String, List<FeatureRate>>>(disMap.entrySet());
|
|
|
- Collections.sort(list, new Comparator<Map.Entry<String, List<FeatureRate>>>() {
|
|
|
- //降序排序
|
|
|
- public int compare(Map.Entry<String, List<FeatureRate>> o1,
|
|
|
- Map.Entry<String, List<FeatureRate>> o2) {
|
|
|
- return Integer.compare(o2.getValue().size(), o1.getValue().size());
|
|
|
- }
|
|
|
- });
|
|
|
- for (Map.Entry<String, List<FeatureRate>> entry : list) {
|
|
|
- if (items.size() < 1) {
|
|
|
- item = new FeatureRate();
|
|
|
- item.setExtraProperty(entry.getKey());
|
|
|
- items.add(item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ items = getItems(disFeatureMap, "确诊", 1);
|
|
|
+ // List<FeatureRate> featureRateList = disFeatureMap.get("确诊");
|
|
|
+ // featureRateList = featureRateList
|
|
|
+ // .stream()
|
|
|
+ // .filter(i -> i.getExtraProperty() != null)
|
|
|
+ // .collect(Collectors.toList());
|
|
|
+ // if (ListUtil.isNotEmpty(featureRateList)) {
|
|
|
+ // Map<String, List<FeatureRate>> disMap
|
|
|
+ // = EntityUtil.makeEntityListMap(featureRateList, "extraProperty");
|
|
|
+ // List<Map.Entry<String, List<FeatureRate>>> list = new ArrayList<Map.Entry<String, List<FeatureRate>>>(disMap.entrySet());
|
|
|
+ // Collections.sort(list, new Comparator<Map.Entry<String, List<FeatureRate>>>() {
|
|
|
+ // //降序排序
|
|
|
+ // public int compare(Map.Entry<String, List<FeatureRate>> o1,
|
|
|
+ // Map.Entry<String, List<FeatureRate>> o2) {
|
|
|
+ // return Integer.compare(o2.getValue().size(), o1.getValue().size());
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // for (Map.Entry<String, List<FeatureRate>> entry : list) {
|
|
|
+ // if (items.size() < 1) {
|
|
|
+ // item = new FeatureRate();
|
|
|
+ // item.setExtraProperty(entry.getKey());
|
|
|
+ // items.add(item);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
if (disFeatureMap.get("拟诊") != null && ListUtil.isEmpty(items)) {
|
|
|
- List<FeatureRate> featureRateList = disFeatureMap.get("拟诊");
|
|
|
- featureRateList = featureRateList
|
|
|
- .stream()
|
|
|
- .filter(i -> i.getExtraProperty() != null)
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (ListUtil.isNotEmpty(featureRateList)) {
|
|
|
- Map<String, List<FeatureRate>> disMap
|
|
|
- = EntityUtil.makeEntityListMap(featureRateList, "extraProperty");
|
|
|
- List<Map.Entry<String, List<FeatureRate>>> list = new ArrayList<Map.Entry<String, List<FeatureRate>>>(disMap.entrySet());
|
|
|
- Collections.sort(list, new Comparator<Map.Entry<String, List<FeatureRate>>>() {
|
|
|
- //降序排序
|
|
|
- public int compare(Map.Entry<String, List<FeatureRate>> o1,
|
|
|
- Map.Entry<String, List<FeatureRate>> o2) {
|
|
|
- return Integer.compare(o2.getValue().size(), o1.getValue().size());
|
|
|
- }
|
|
|
- });
|
|
|
- for (Map.Entry<String, List<FeatureRate>> entry : list) {
|
|
|
- if (items.size() < 2) {
|
|
|
- item = new FeatureRate();
|
|
|
- item.setExtraProperty(entry.getKey());
|
|
|
- items.add(item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ items = getItems(disFeatureMap, "拟诊", 2);
|
|
|
+ // List<FeatureRate> featureRateList = disFeatureMap.get("拟诊");
|
|
|
+ // featureRateList = featureRateList
|
|
|
+ // .stream()
|
|
|
+ // .filter(i -> i.getExtraProperty() != null)
|
|
|
+ // .collect(Collectors.toList());
|
|
|
+ // if (ListUtil.isNotEmpty(featureRateList)) {
|
|
|
+ // Map<String, List<FeatureRate>> disMap
|
|
|
+ // = EntityUtil.makeEntityListMap(featureRateList, "extraProperty");
|
|
|
+ // List<Map.Entry<String, List<FeatureRate>>> list = new ArrayList<Map.Entry<String, List<FeatureRate>>>(disMap.entrySet());
|
|
|
+ // Collections.sort(list, new Comparator<Map.Entry<String, List<FeatureRate>>>() {
|
|
|
+ // //降序排序
|
|
|
+ // public int compare(Map.Entry<String, List<FeatureRate>> o1,
|
|
|
+ // Map.Entry<String, List<FeatureRate>> o2) {
|
|
|
+ // return Integer.compare(o2.getValue().size(), o1.getValue().size());
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // for (Map.Entry<String, List<FeatureRate>> entry : list) {
|
|
|
+ // if (items.size() < 2) {
|
|
|
+ // item = new FeatureRate();
|
|
|
+ // item.setExtraProperty(entry.getKey());
|
|
|
+ // items.add(item);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
if (disFeatureMap.get("可能诊断") != null && ListUtil.isEmpty(items)) {
|
|
|
Double rate;
|
|
@@ -187,6 +189,8 @@ public class AIFacade {
|
|
|
item = new FeatureRate();
|
|
|
item.setExtraProperty(entry.getKey());
|
|
|
items.add(item);
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
if (ListUtil.isEmpty(items)) {
|
|
@@ -220,4 +224,39 @@ public class AIFacade {
|
|
|
}
|
|
|
return aidto;
|
|
|
}
|
|
|
+
|
|
|
+ private List<FeatureRate> getItems(Map<String, List<FeatureRate>> disFeatureMap,
|
|
|
+ String type, int size) {
|
|
|
+ List<FeatureRate> items = new ArrayList<>();
|
|
|
+
|
|
|
+ List<FeatureRate> featureRateList = disFeatureMap.get(type);
|
|
|
+ featureRateList = featureRateList
|
|
|
+ .stream()
|
|
|
+ .filter(i -> i.getExtraProperty() != null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(featureRateList)) {
|
|
|
+ Map<String, List<FeatureRate>> disMap
|
|
|
+ = EntityUtil.makeEntityListMap(featureRateList, "extraProperty");
|
|
|
+ List<Map.Entry<String, List<FeatureRate>>> list = new ArrayList<Map.Entry<String, List<FeatureRate>>>(disMap.entrySet());
|
|
|
+ Collections.sort(list, new Comparator<Map.Entry<String, List<FeatureRate>>>() {
|
|
|
+ //降序排序
|
|
|
+ public int compare(Map.Entry<String, List<FeatureRate>> o1,
|
|
|
+ Map.Entry<String, List<FeatureRate>> o2) {
|
|
|
+ return Integer.compare(o2.getValue().size(), o1.getValue().size());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ FeatureRate item;
|
|
|
+ for (Map.Entry<String, List<FeatureRate>> entry : list) {
|
|
|
+ if (items.size() < size) {
|
|
|
+ item = new FeatureRate();
|
|
|
+ item.setExtraProperty(entry.getKey());
|
|
|
+ items.add(item);
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return items;
|
|
|
+ }
|
|
|
}
|