|
@@ -1647,7 +1647,9 @@ public class Neo4jAPI {
|
|
|
TreeMap<String, Object> result = null;
|
|
|
Map<String, Object> title = new LinkedHashMap<>();
|
|
|
List<TreeMap<String, Object>> results = new ArrayList<>();
|
|
|
+
|
|
|
List<Object> titles;
|
|
|
+ Map<String,Object> calculate = new HashMap<>();
|
|
|
|
|
|
threeLevelItems.put("scaleType", "");
|
|
|
|
|
@@ -1704,10 +1706,10 @@ public class Neo4jAPI {
|
|
|
title.put("name", "得分");
|
|
|
title.put("column", "score");
|
|
|
titles.add(title);
|
|
|
- title = new LinkedHashMap<>();
|
|
|
- title.put("name", "推荐选项");
|
|
|
- title.put("column", "state");
|
|
|
- titles.add(title);
|
|
|
+// title = new LinkedHashMap<>();
|
|
|
+// title.put("name", "推荐选项");
|
|
|
+// title.put("column", "state");
|
|
|
+// titles.add(title);
|
|
|
threeLevelItems.put("title", titles);
|
|
|
}
|
|
|
}
|
|
@@ -1723,7 +1725,13 @@ public class Neo4jAPI {
|
|
|
for (TreeMap<String, Object> resMap:results) {
|
|
|
resMap.remove("priority");
|
|
|
}
|
|
|
- threeLevelItems.put("formula", results);
|
|
|
+ calculate.put("range", results);
|
|
|
+ calculate.put("formula","");
|
|
|
+ Map<String,String> calcResult = new HashMap<>();
|
|
|
+ calcResult.put("score","");
|
|
|
+ calcResult.put("text","");
|
|
|
+ calculate.put("result",calcResult);
|
|
|
+ threeLevelItems.put("calculate",calculate);
|
|
|
|
|
|
Map<String, List<Map<String, String>>> nameDetails = new HashMap<>();
|
|
|
List<TreeMap<String, Object>> finalResult = new ArrayList<>();
|
|
@@ -1876,4 +1884,48 @@ public class Neo4jAPI {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public Map<String, Object> scaleScoreCalc(String[] scaleItems,String scaleName,Neo4jAPI neo4jAPI){
|
|
|
+
|
|
|
+ int sum = 0;
|
|
|
+ String final_result = null;
|
|
|
+ Map<String, Object> scaleCalc = neo4jAPI.getScaleCalc(scaleName);
|
|
|
+ for (String scaleItem:scaleItems) {
|
|
|
+ Object details = scaleCalc.get("rows");
|
|
|
+ //获取name
|
|
|
+ List<Map<String, Object>> content = (List<Map<String, Object>>) details;
|
|
|
+ for (Map<String, Object> map : content) {
|
|
|
+ String name = map.get("name").toString();
|
|
|
+ if (scaleItem.contains(name) || name.contains(scaleItem)) {
|
|
|
+ List<Map<String, Object>> sub_detail = (List<Map<String, Object>>) map.get("details");
|
|
|
+ for (Map<String, Object> sub_map : sub_detail) {
|
|
|
+ String detailName = sub_map.get("detailName").toString();
|
|
|
+ String score = sub_map.get("score").toString();
|
|
|
+ if(scaleItem.contains(detailName)){
|
|
|
+ sum += Double.valueOf(score);
|
|
|
+ sub_map.put("state","1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(sum);
|
|
|
+ Map<String, Object> calculate = (Map<String, Object>) scaleCalc.get("calculate");
|
|
|
+ List<Map<String, String>> range = (List<Map<String, String>>) calculate.get("range");
|
|
|
+ for (Map<String, String> range_map:range) {
|
|
|
+ Integer min = Integer.valueOf(range_map.get("min"));
|
|
|
+ Integer max = Integer.valueOf(range_map.get("max"));
|
|
|
+ String text = range_map.get("text");
|
|
|
+ if (sum >= min && sum <= max){
|
|
|
+ final_result = text;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, String> result = (Map<String, String>) calculate.get("result");
|
|
|
+ result.put("score",String.valueOf(sum));
|
|
|
+ result.put("text",(final_result));
|
|
|
+ return scaleCalc;
|
|
|
+ }
|
|
|
+
|
|
|
}
|