|
@ -5623,18 +5623,15 @@ public class StatisticsESService {
|
|
|
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 RIGHT 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 p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "') a " +
|
|
|
" GROUP BY a.doctor,a.name";
|
|
|
//计算发放量,按发放人分组
|
|
|
String sql =" select count(*) as amount, if(d.grant_doctor is null,'other',d.grant_doctor) as doctorCode,if(d.grant_doctor_name is null,'其他',d.grant_doctor_name) as doctorName from device.wlyy_devices d where d.grant_org_code = '"+ hos.getCode()+"' GROUP BY d.grant_doctor,d.grant_doctor_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);
|
|
|
obj = deviceRateList(obj,hos);//统计每个人发放的设备中绑定的数量
|
|
|
if("other".equals(one.get("doctorCode")+"")){
|
|
|
amount += Integer.valueOf(obj.get("amount")+"");
|
|
|
allNum += Integer.valueOf(obj.get("allNum")+"");
|
|
@ -5767,21 +5764,18 @@ public class StatisticsESService {
|
|
|
|
|
|
//按绑定的医生列表展示绑定的设备列表
|
|
|
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 wd.grant_org_code ='"+hos.getCode()+"' and (wd.grant_doctor is null or wd.grant_doctor='')":" and wd.grant_doctor='"+String.valueOf(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 p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
|
|
|
" GROUP BY a.doctor,a.name";*/
|
|
|
String sql ="SELECT count(1) as amount from device.wlyy_devices wd LEFT JOIN dm_device dd ON wd.device_model=dd.model where 1=1 "+temp+" AND dd.category_code IN('1','2') and wd.is_grant=1";
|
|
|
// Map<String, Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
String temp = "other".equals(reMap.get("code"))? " and (d.grant_doctor is null or d.grant_doctor='')":" and d.grant_doctor='"+String.valueOf(reMap.get("code"))+"' ";
|
|
|
String sql =" select count(DISTINCT d.id) amount from wlyy.wlyy_patient_device p " +
|
|
|
" LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code " +
|
|
|
" where p.del = 0 "+temp+" and p.id is not null and d.grant_org_code='"+hos.getCode()+"'";
|
|
|
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));//续签率是 续签量/去年的签约数
|
|
|
Integer bingdingAmount = Integer.valueOf(map.get("amount").toString());//绑定量
|
|
|
Integer paymentAmount = Integer.valueOf(reMap.get("amount").toString());//发放量
|
|
|
reMap.put("allNum", paymentAmount);
|
|
|
reMap.put("bindingNum", bingdingAmount);
|
|
|
reMap.put("rate", getRange(bingdingAmount, paymentAmount, 2));//续签率是 续签量/去年的签约数
|
|
|
reMap.put("rateNum", getRangeNum(bingdingAmount, paymentAmount, 2));//续签率是 续签量/去年的签约数
|
|
|
return reMap;
|
|
|
}
|
|
|
|