|
@ -5553,13 +5553,18 @@ public class StatisticsESService {
|
|
|
}
|
|
|
});
|
|
|
//自建结果集
|
|
|
List<Map<String, Object>> resultList = getDeviceLowLevelMapKey(level, low_level, area,allMap,bingdingMap);
|
|
|
List<Map<String, Object>> resultList = null;
|
|
|
if (SaveModel.teamLevel.equals(low_level)){
|
|
|
resultList = getDeviceLowLevelMapKey(level, low_level,area);
|
|
|
}else{
|
|
|
resultList = getDeviceLowLevelMapKey(level, low_level, area,allMap,bingdingMap);
|
|
|
}
|
|
|
|
|
|
if (resultList != null && resultList.size() > 0) {
|
|
|
|
|
|
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>>() {
|
|
|
|
|
@ -5593,6 +5598,47 @@ public class StatisticsESService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//获取机构下的所有医生的设备绑定列表
|
|
|
public List<Map<String, Object>> getDeviceLowLevelMapKey(int level, String lowLevel, String area){
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
// 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;
|
|
|
}
|
|
|
// String sql = " select count(DISTINCT p.doctor,p.device_sn) AS amount,p.doctor as doctorCode,r.name as doctorName from wlyy.wlyy_patient_device p JOIN wlyy.wlyy_doctor r on p.doctor is not null and p.doctor =r.code LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code where p.del=0 and p.doctor is not null and d.grant_org_code ='" + hos.getCode() + "' group by p.doctor,r.name";
|
|
|
String sql = " select count(*) as amount,if(a.doctor is null,'other',a.doctor) as doctorCode,if(a.NAME is null,'其他',a.NAME) as doctorName " +
|
|
|
" from (select DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON p.doctor = r. CODE " +
|
|
|
"where p.del=0 and d.is_binding in (1,2) and d.grant_org_code ='" + hos.getCode() + "') a " +
|
|
|
" GROUP BY a.doctor,a.name";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String, Object> one : list) {
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", one.get("doctorCode"));
|
|
|
obj.put("name", one.get("doctorName"));
|
|
|
obj.put("amount", one.get("amount"));
|
|
|
obj = deviceRateList(obj,hos);
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取下级统计key
|
|
|
*
|
|
@ -5677,7 +5723,6 @@ public class StatisticsESService {
|
|
|
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> deviceRateList(Map<String, Object> reMap,Map<String, Integer> allMap,Map<String, SaveModel> bingdingMap){
|
|
|
reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
|
|
|
int bindingAmount = 0;
|
|
@ -5694,7 +5739,6 @@ public class StatisticsESService {
|
|
|
if (allAmount == null) {
|
|
|
allAmount = 0;
|
|
|
}
|
|
|
} else {
|
|
|
}
|
|
|
reMap.put("allNum", allAmount);
|
|
|
reMap.put("bindingNum", bindingAmount);
|
|
@ -5703,6 +5747,25 @@ public class StatisticsESService {
|
|
|
return reMap;
|
|
|
}
|
|
|
|
|
|
//按绑定的医生列表展示绑定的设备列表
|
|
|
public Map<String, Object> deviceRateList(Map<String, Object> reMap,Hospital hos){
|
|
|
// String sql = " select count(1) as amount from wlyy.wlyy_patient_device p JOIN wlyy.wlyy_doctor r on p.doctor is not null and p.doctor =r.code LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code where p.doctor is not null and d.grant_org_code ='" + hos.getCode() + "' and p.doctor='"+reMap.get("code")+"'";
|
|
|
String temp = "other".equals(reMap.get("code"))? " and p.doctor is null ":" and p.doctor='"+reMap.get("code")+"' ";
|
|
|
String sql = " select count(1) as amount " +
|
|
|
" from (select DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON p.doctor = r. CODE " +
|
|
|
" where d.is_binding in (1,2) and d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
|
|
|
" GROUP BY a.doctor,a.name";
|
|
|
// Map<String, Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
|
|
|
Map<String,Object> map = result.get(0);
|
|
|
Integer amount = Integer.valueOf(map.get("amount").toString());
|
|
|
reMap.put("allNum", amount);
|
|
|
reMap.put("bindingNum", reMap.get("amount"));
|
|
|
reMap.put("rate", getRange(Integer.valueOf(reMap.get("amount").toString()), amount, 2));//续签率是 续签量/去年的签约数
|
|
|
reMap.put("rateNum", getRangeNum(Integer.valueOf(reMap.get("amount").toString()), amount, 2));//续签率是 续签量/去年的签约数
|
|
|
return reMap;
|
|
|
}
|
|
|
|
|
|
//i健康活动统计1.4.8版本
|
|
|
public Map<String, Object> statisticsActivity(String area, int level, int sort,String lowLevel,String slaveKey1) throws Exception {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|