|
@ -5834,44 +5834,23 @@ public class StatisticsESService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Map<String, SaveModel> applyMap = new HashMap<>();
|
|
|
applyAmountList.stream().forEach(one -> {
|
|
|
if ("5".equals(low_level)) {
|
|
|
applyMap.put(one.getTeam(), one);
|
|
|
} else if ("4".equals(low_level)) {
|
|
|
applyMap.put(one.getHospital(), one);
|
|
|
} else if ("3".equals(low_level)) {
|
|
|
applyMap.put(one.getTown(), one);
|
|
|
}
|
|
|
});
|
|
|
//自建结果集
|
|
|
List<Map<String, Object>> resultList = getLowLevelMapKey(level, low_level, area);
|
|
|
List<Map<String, Object>> resultList = getActivityLowLevelMapKey(level, low_level, area,allMap,applyMap);
|
|
|
|
|
|
if (resultList != null && resultList.size() > 0) {
|
|
|
Map<String, SaveModel> applyMap = new HashMap<>();
|
|
|
applyAmountList.stream().forEach(one -> {
|
|
|
if ("5".equals(low_level)) {
|
|
|
applyMap.put(one.getTeam(), one);
|
|
|
} else if ("4".equals(low_level)) {
|
|
|
applyMap.put(one.getHospital(), one);
|
|
|
} else if ("3".equals(low_level)) {
|
|
|
applyMap.put(one.getTown(), one);
|
|
|
}
|
|
|
});
|
|
|
for (Map<String, Object> reMap : resultList) {
|
|
|
reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
|
|
|
Integer allAmount = 0;
|
|
|
int applyAmount = 0;
|
|
|
//获取绑定数量
|
|
|
if (applyMap != null && applyMap.size() > 0) {
|
|
|
SaveModel one = applyMap.get(reMap.get("code").toString());
|
|
|
if (one != null) {
|
|
|
applyAmount = one.getResult2().intValue();
|
|
|
}
|
|
|
}
|
|
|
if (allMap != null && allMap.size() > 0) {
|
|
|
allAmount = allMap.get(reMap.get("code").toString());
|
|
|
if (allAmount == null) {
|
|
|
allAmount = 0;
|
|
|
}
|
|
|
}
|
|
|
reMap.put("allNum", allAmount);
|
|
|
reMap.put("applyNum", applyAmount);
|
|
|
reMap.put("rate", getRange2(applyAmount, allAmount, 2));//参与率是 报名数/签约数
|
|
|
if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
|
|
|
translateTeamLeaderName(resultList);
|
|
|
}
|
|
|
|
|
|
if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
|
|
|
translateTeamLeaderName(resultList);
|
|
|
}
|
|
|
//对结果进行排序
|
|
|
Collections.sort(resultList, new Comparator<Map<String, Object>>() {
|
|
@ -5899,6 +5878,113 @@ public class StatisticsESService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取下级统计key
|
|
|
*
|
|
|
* @param level
|
|
|
* @param lowLevel
|
|
|
* @param area
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> getActivityLowLevelMapKey(int level, String lowLevel, String area,Map<String, Integer> allMap,Map<String, SaveModel> applyMap) {
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
if (SaveModel.townLevel.equals(lowLevel)) {
|
|
|
List<Town> towns = townDao.findByCityCode(area);
|
|
|
if (towns != null) {
|
|
|
for (Town town : towns) {
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", town.getCode());
|
|
|
obj.put("name", town.getName());
|
|
|
obj.put("amount", "0");
|
|
|
obj = activityRateList(obj,allMap,applyMap);
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
} else if (lowLevel.equals("4")) {
|
|
|
List<Town> towns = new ArrayList<>();
|
|
|
if (SaveModel.cityLevel.equals(level + "")) {
|
|
|
towns = townDao.findByCityCode(area);
|
|
|
} else if (SaveModel.townLevel.equals(level + "")) {
|
|
|
Town town = townDao.findByCode(area);
|
|
|
if (town != null) {
|
|
|
towns.add(town);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (towns != null && towns.size() > 0) {
|
|
|
for (Town town : towns) {
|
|
|
List<Hospital> hospitals = hospitalDao.findByTownCode(town.getCode());
|
|
|
|
|
|
for (Hospital hos : hospitals) {
|
|
|
if (hos.getCode().length() > 10) {
|
|
|
continue;
|
|
|
}
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", hos.getCode());
|
|
|
obj.put("name", hos.getName());
|
|
|
obj.put("amount", "0");
|
|
|
obj = activityRateList(obj,allMap,applyMap);
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else if (SaveModel.teamLevel.equals(lowLevel)) {
|
|
|
List<Hospital> hospitals = new ArrayList<>();
|
|
|
if (level == 2) {
|
|
|
hospitals = hospitalDao.findByCity(area);
|
|
|
} else if (SaveModel.townLevel.equals(level + "")) {
|
|
|
hospitals = hospitalDao.findByTownCode(area);
|
|
|
} else {
|
|
|
Hospital hos = hospitalDao.findByCode(area);
|
|
|
if (hos != null) {
|
|
|
hospitals.add(hos);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (hospitals != null && hospitals.size() > 0) {
|
|
|
for (Hospital hos : hospitals) {
|
|
|
if (hos.getCode().length() > 10) {
|
|
|
continue;
|
|
|
}
|
|
|
List<AdminTeam> teams = adminTeamDao.findByOrgCode(hos.getCode());
|
|
|
|
|
|
for (AdminTeam team : teams) {
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", String.valueOf(team.getId()));
|
|
|
obj.put("name", team.getName());
|
|
|
obj.put("amount", "0");
|
|
|
obj = activityRateList(obj,allMap,applyMap);
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> activityRateList(Map<String, Object> reMap,Map<String, Integer> allMap,Map<String, SaveModel> applyMap){
|
|
|
reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
|
|
|
Integer allAmount = 0;
|
|
|
int applyAmount = 0;
|
|
|
//获取绑定数量
|
|
|
if (applyMap != null && applyMap.size() > 0) {
|
|
|
SaveModel one = applyMap.get(reMap.get("code").toString());
|
|
|
if (one != null) {
|
|
|
applyAmount = one.getResult2().intValue();
|
|
|
}
|
|
|
}
|
|
|
if (allMap != null && allMap.size() > 0) {
|
|
|
allAmount = allMap.get(reMap.get("code").toString());
|
|
|
if (allAmount == null) {
|
|
|
allAmount = 0;
|
|
|
}
|
|
|
}
|
|
|
reMap.put("allNum", allAmount);
|
|
|
reMap.put("applyNum", applyAmount);
|
|
|
reMap.put("rate", getRange2(applyAmount, allAmount, 2));//参与率是 报名数/签约数
|
|
|
return reMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
|