|
@ -2135,7 +2135,7 @@ public class StatisticsESService {
|
|
|
/**
|
|
|
* 去年的签约量,续签量和续签率 列表
|
|
|
* @param area
|
|
|
* @param level 等级 1(5):团队 2(4)社区机构 3()3区级 4(2)市级
|
|
|
* @param level 等级 1(5):团队 2(4)社区机构 (3)3区级 4(2)市级
|
|
|
* @param index
|
|
|
* @param sort
|
|
|
* @param lowLevel
|
|
@ -2178,74 +2178,74 @@ public class StatisticsESService {
|
|
|
//自建结果集
|
|
|
resultList = getLowLevelMapKey(level, low_level, area);
|
|
|
|
|
|
// if (resultList != null) {
|
|
|
// DecimalFormat df = new DecimalFormat("0.0000");
|
|
|
// //查询去年的签约转map
|
|
|
// if (StringUtils.isBlank(lowCode)) {
|
|
|
// yearsYear = findQuotaResultList(lastDate, Integer.valueOf(low_level), "1");
|
|
|
// } else {
|
|
|
// if ("3".equals(lowCode)) {
|
|
|
// //老年人
|
|
|
// yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate, Integer.valueOf(low_level), "17", "3");
|
|
|
// } else if ("4".equals(lowCode)) {
|
|
|
// //高血压
|
|
|
// yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate, Integer.valueOf(low_level), "17", "1");
|
|
|
// } else if ("5".equals(lowCode)) {
|
|
|
// //糖尿病
|
|
|
// yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate, Integer.valueOf(low_level), "17", "2");
|
|
|
// } else {
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// Map<String, WlyyQuotaResult> resultMap = new HashMap<>();
|
|
|
// yearsYear.stream().forEach(one -> {
|
|
|
// if ("1".equals(low_level)) {
|
|
|
// resultMap.put(one.getQkdoctorCode(), one);
|
|
|
// } else if ("2".equals(low_level)) {
|
|
|
// resultMap.put(one.getOrgCode(), one);
|
|
|
// } else if ("3".equals(low_level)) {
|
|
|
// resultMap.put(one.getTown(), one);
|
|
|
// }
|
|
|
// });
|
|
|
//
|
|
|
// for (Map<String, Object> map : resultList) {
|
|
|
// map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
|
|
|
// //获取去年签约的人数 默认是上个年度的最后一天
|
|
|
// WlyyQuotaResult one = resultMap.get(map.get("code").toString());
|
|
|
// int signNum = 0;
|
|
|
// int renewNum = renewMap.get(map.get("code").toString());
|
|
|
// if (one != null) {
|
|
|
// signNum = Integer.valueOf(one.getResult());
|
|
|
// }
|
|
|
// map.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
|
|
|
// map.put("signNum", signNum);
|
|
|
// map.put("renewNum", renewNum);
|
|
|
//
|
|
|
// }
|
|
|
//
|
|
|
// if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
|
|
|
// translateTeamLeaderName(resultList);
|
|
|
// }
|
|
|
// //对结果进行排序
|
|
|
// Collections.sort(resultList, new Comparator<Map<String, Object>>() {
|
|
|
// public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
// int map1value = (int) o1.get("renewNum");
|
|
|
// int map2value = (int) o2.get("renewNum");
|
|
|
//
|
|
|
// if (map1value - map2value > 0) {
|
|
|
// return sort == 1 ? -1 : 1;
|
|
|
// } else if (map1value - map2value < 0) {
|
|
|
// return sort == 1 ? 1 : -1;
|
|
|
// } else {
|
|
|
// return 0;
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
//
|
|
|
// return new JSONArray(resultList);
|
|
|
// } else {
|
|
|
// return new JSONArray();
|
|
|
// }
|
|
|
return null;
|
|
|
if (resultList != null) {
|
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
|
//查询去年的签约转map
|
|
|
List<SaveModel> yearsList = new ArrayList();
|
|
|
if (StringUtils.isBlank(lowCode)) {
|
|
|
yearsList = elasticsearchUtil.findListDateQuotaLevel0(lastDate,"",Integer.valueOf(low_level),"1","2","");
|
|
|
} else {
|
|
|
if ("3".equals(lowCode)) {
|
|
|
//老年人
|
|
|
yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate,"",Integer.valueOf(low_level),"17","2","","3");
|
|
|
} else if ("4".equals(lowCode)) {
|
|
|
//高血压
|
|
|
yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate,"",Integer.valueOf(low_level),"17","2","","1");
|
|
|
} else if ("5".equals(lowCode)) {
|
|
|
//糖尿病
|
|
|
yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate,"",Integer.valueOf(low_level),"17","2","","2");
|
|
|
} else {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Map<String, SaveModel> resultMap = new HashMap<>();
|
|
|
yearsList.stream().forEach(one -> {
|
|
|
if ("5".equals(low_level)) {
|
|
|
resultMap.put(one.getTeam(), one);
|
|
|
} else if ("4".equals(low_level)) {
|
|
|
resultMap.put(one.getHospital(), one);
|
|
|
} else if ("3".equals(low_level)) {
|
|
|
resultMap.put(one.getTown(), one);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
for (Map<String, Object> map : resultList) {
|
|
|
map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
|
|
|
//获取去年签约的人数 默认是上个年度的最后一天
|
|
|
SaveModel one = resultMap.get(map.get("code").toString());
|
|
|
int signNum = 0;
|
|
|
int renewNum = renewMap.get(map.get("code").toString());
|
|
|
if (one != null) {
|
|
|
signNum = Integer.valueOf(one.getResult2());
|
|
|
}
|
|
|
map.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
|
|
|
map.put("signNum", signNum);
|
|
|
map.put("renewNum", renewNum);
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
|
|
|
translateTeamLeaderName(resultList);
|
|
|
}
|
|
|
//对结果进行排序
|
|
|
Collections.sort(resultList, new Comparator<Map<String, Object>>() {
|
|
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
int map1value = (int) o1.get("renewNum");
|
|
|
int map2value = (int) o2.get("renewNum");
|
|
|
|
|
|
if (map1value - map2value > 0) {
|
|
|
return sort == 1 ? -1 : 1;
|
|
|
} else if (map1value - map2value < 0) {
|
|
|
return sort == 1 ? 1 : -1;
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return new JSONArray(resultList);
|
|
|
} else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
}
|
|
|
}
|