Jelajahi Sumber

考评分析

chenminghua 1 tahun lalu
induk
melakukan
bc2e083375

+ 17 - 8
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluatioinScoreCountServiceImpl.java

@@ -54,7 +54,7 @@ public class EvaluatioinScoreCountServiceImpl extends ServiceImpl<EvaluationScor
 		Map<Object, List<Map<String, Object>>> collect = list.stream().collect(Collectors.groupingBy(c -> c.get("organization_name"), Collectors.toList()));
 		boolean flag = true;
 		List<Object> value = new ArrayList<>();
-		List<Object> title = new ArrayList<>();
+		Map<String, Object> title = new HashMap<>();
 		for (Map.Entry<Object, List<Map<String, Object>>> entry : collect.entrySet()) {
 			List<Map<String, Object>> v = entry.getValue();
 			Map<String, Object> mp = new HashMap<>();
@@ -64,16 +64,24 @@ public class EvaluatioinScoreCountServiceImpl extends ServiceImpl<EvaluationScor
 				mp.put("organization_name", item.get("organization_name"));
 				mp.put(item.get("indicator_code").toString() + "_flag", item.get("score") == item.get("standard_score") ? "0"
 					: Double.valueOf(item.get("score").toString()) > Double.valueOf(item.get("standard_score").toString()) ? "1" : "-1");
+			}
+			value.add(mp);
 
-				if (flag) {
-					Map<String, Object> tl = new HashMap<>();
-					tl.put("key", item.get("indicator_name"));
-					tl.put("code", item.get("indicator_code").toString() + "_score");
-					title.add(tl);
+			// 添加标题
+			if (flag) {
+				Map<Object, List<Map<String, Object>>> types = v.stream().collect(Collectors.groupingBy(c -> c.get("type_name")));
+				for (Map.Entry<Object, List<Map<String, Object>>> e : types.entrySet()) {
+					List<Object> ls = new ArrayList<>();
+					e.getValue().forEach(el -> {
+						Map<String, Object> mt = new HashMap<>();
+						mt.put("key", el.get("indicator_name"));
+						mt.put("code", el.get("indicator_code").toString() + "_score");
+						ls.add(mt);
+					});
+					title.put((String) e.getKey(), ls);
 				}
+				flag = false;
 			}
-			flag = false;
-			value.add(mp);
 		}
 
 		result.put("title", title);
@@ -81,6 +89,7 @@ public class EvaluatioinScoreCountServiceImpl extends ServiceImpl<EvaluationScor
 		return result;
 	}
 
+
 	@Override
 	public List<EvaluationScoreCount> getEvaluationScoreCountList(String organizationEvaluationId, String organizationEvaluationRuleId, String indicatorId) {