|
@ -24,6 +24,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@ -324,10 +325,12 @@ public class StatisticsService {
|
|
|
String medicalInstitutionSql = "SELECT COUNT(1) FROM base_org WHERE (type = 1 OR type = 2) AND del = 1 " + orgFilter;
|
|
|
String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1" + orgFilter;
|
|
|
String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1" + orgFilter;
|
|
|
String careCenterNumSql = "SELECT COUNT(1) FROM base_org WHERE type = 6 AND del = 1" + orgFilter;
|
|
|
|
|
|
//社工和教师注册人数
|
|
|
Integer doctorNum = 0;
|
|
|
Integer helperNum = 0;
|
|
|
Integer helper4Num = 0;
|
|
|
Integer teacherNum = 0;
|
|
|
String sql2 = "SELECT COUNT(a.id) c,a.doctor_level from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
|
|
|
"and a.doctor_level is not null and h.org_code not in ( " +
|
|
@ -345,6 +348,10 @@ public class StatisticsService {
|
|
|
helperNum = num;
|
|
|
continue;
|
|
|
}
|
|
|
if ("4".equals(archive_type)) {
|
|
|
helper4Num = num;
|
|
|
continue;
|
|
|
}
|
|
|
if ("3".equals(archive_type)) {
|
|
|
teacherNum = num;
|
|
|
}
|
|
@ -352,11 +359,14 @@ public class StatisticsService {
|
|
|
Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql, Integer.class);
|
|
|
Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql, Integer.class);
|
|
|
Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql, Integer.class);
|
|
|
Integer careCenterNum = jdbcTemplate.queryForObject(careCenterNumSql, Integer.class);
|
|
|
res.put("medicalInstitutionNum", medicalInstitutionNum); //医疗结构
|
|
|
res.put("elderlyCarServiceNum", elderlyCarServiceNum); //养老机构
|
|
|
res.put("childcareInstitutionsssNum", childcareInstitutionsssNum); //托育机构
|
|
|
res.put("careCenterNum", careCenterNum); //照料中心
|
|
|
res.put("doctorNum", doctorNum); //医生
|
|
|
res.put("helperNum", helperNum); //社工
|
|
|
res.put("helper4Num", helper4Num); //助老员
|
|
|
res.put("teacherNum", teacherNum); //教师
|
|
|
return res;
|
|
|
}
|
|
@ -365,19 +375,18 @@ public class StatisticsService {
|
|
|
public JSONObject realTimeDataNew() throws Exception {
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
|
String filter = "";
|
|
|
String userfilter = "";
|
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
|
|
|
List<Map<String, Object>> listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
if (listtmp.size() > 0) {
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
orgCodes = orgCodes.replaceAll(",", "','");
|
|
|
filter = " and id not in ('" + orgCodes + "')";
|
|
|
userfilter = " not in ('" + orgCodes + "') ";
|
|
|
}
|
|
|
|
|
|
Integer olderTotal = 0;
|
|
|
Integer childTotal = 0;
|
|
|
String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type from base_patient WHERE archive_type is not null and del='1' ";
|
|
|
sql1 += filter;
|
|
|
String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type from base_patient WHERE archive_type is not null and del='1' and id "+userfilter;
|
|
|
sql1 += " GROUP BY archive_type";
|
|
|
|
|
|
List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1);
|
|
@ -400,17 +409,15 @@ public class StatisticsService {
|
|
|
|
|
|
sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
|
|
|
listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
filter = "";
|
|
|
String filter2 = "";
|
|
|
String orgFilter = "";
|
|
|
if (listtmp.size() > 0) {
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
orgCodes = orgCodes.replaceAll(",", "','");
|
|
|
filter = " and hospital not in ('" + orgCodes + "') ";
|
|
|
filter2 = " and org_code not in ('" + orgCodes + "') ";
|
|
|
orgFilter = " not in ('" + orgCodes + "') ";
|
|
|
}
|
|
|
String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status <> -1 " + filter2;
|
|
|
String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status <> -1 and org_code " + orgFilter;
|
|
|
Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class);
|
|
|
String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 " + filter;
|
|
|
String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 and hospital " + orgFilter;
|
|
|
Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class);
|
|
|
res.put("olderTotal", olderTotal); //老人注册人数
|
|
|
res.put("childTotal", childTotal); //儿童注册人数
|
|
@ -418,6 +425,27 @@ public class StatisticsService {
|
|
|
res.put("securityEquipmentNum", securityEquipmentNum); //安防设备
|
|
|
res.put("emergencyCallNum", emergencyCallNum); //紧急呼叫的次数
|
|
|
res.put("securityMonitoringNum", securityMonitoringNum); //安防监护触发工单的次数
|
|
|
//离线的设备数 超过6小时未受理的预警数 超6小时未响应服务(审核照料发起6小时未接单)
|
|
|
sqltmp = " select count(distinct pd.device_sn) from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
|
|
|
" INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " +
|
|
|
"where (dev.contact_status=0 or dev.contact_status is null ) and pd.user "+userfilter;
|
|
|
Long count = jdbcTemplate.queryForObject(sqltmp,Long.class);//离线设备
|
|
|
res.put("offlineDevice", count);
|
|
|
sqltmp = " select sum(total) from ( " +
|
|
|
"select count(o.id) total from " +
|
|
|
"base_emergency_assistance_order o INNER JOIN base_patient p on o.patient = p.id where status=1 and o.patient " +userfilter+
|
|
|
" and (TIMESTAMPDIFF(HOUR,o.create_time,now()) >=6) and not EXISTS ( " +
|
|
|
"select 1 from base_emergency_warn_log log where log.order_id = o.id) " +
|
|
|
"union all " +
|
|
|
"select count(o.id) total from " +
|
|
|
"base_security_monitoring_order o INNER JOIN base_patient p on o.patient = p.id where status=1 and o.patient " +userfilter+
|
|
|
" and (TIMESTAMPDIFF(HOUR,o.create_time,now()) >=6) and not EXISTS ( " +
|
|
|
"select 1 from base_emergency_warn_log log where log.order_id = o.id))B ";
|
|
|
count = jdbcTemplate.queryForObject(sqltmp,Long.class);
|
|
|
res.put("overTimeWarnOrder", count);//超过6小时未受理的预警数
|
|
|
sqltmp = " select count(o.id) from base_life_care_order o where `status`=1 and (TIMESTAMPDIFF(hour,o.create_time,NOW())) >=6 and o.hospital "+orgFilter;
|
|
|
count = jdbcTemplate.queryForObject(sqltmp,Long.class);
|
|
|
res.put("overTimeServerOrder", count);//超6小时未响应服务
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@ -2170,7 +2198,7 @@ public class StatisticsService {
|
|
|
monitorDevice.put("securityDevice",count);
|
|
|
sql = " select count(distinct pd.device_sn) from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
|
|
|
" INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " +
|
|
|
"where (dev.contact_status=0 or dev.contact_status is null ) "+olderFilter.replace("{patient}","pd.user");
|
|
|
"where (dev.contact_status=0 or dev.contact_status is null ) "+olderFilter.replace("{patient}","pd.user");
|
|
|
count = jdbcTemplate.queryForObject(sql,Long.class);//离线设备
|
|
|
monitorDevice.put("offlineDevice",count);
|
|
|
monitorDevice.put("total",monitorDevice.getInteger("securityDevice")+monitorDevice.getInteger("healthDevice"));
|
|
@ -2277,6 +2305,7 @@ public class StatisticsService {
|
|
|
String teamName = map.get("teamName").toString();
|
|
|
String teamId = map.get("teamId").toString();
|
|
|
teamName = teamName.replace("团队","社区");
|
|
|
teamName = teamName.replace("服务","");
|
|
|
if(!teamName.contains("社区")){
|
|
|
teamName = teamName+"社区";
|
|
|
}
|
|
@ -2313,7 +2342,193 @@ public class StatisticsService {
|
|
|
" WHERE `dict_name` = 'jkzl_older' or dict_name='jkzl_child') and r.team_code='"+teamId+"' ) ";
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("bindingDeviceCount",count);
|
|
|
//社工数量
|
|
|
String filter = "";
|
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_older' ";
|
|
|
List<Map<String,Object>> listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
if(listtmp.size()>0){
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
filter = " and a.id not in ('"+orgCodes+"')";
|
|
|
}
|
|
|
sql = "SELECT count(a.id) from base_patient a WHERE a.archive_type = 1 and a.del = '1' ";
|
|
|
sql += " and EXISTS ( select 1 from " +
|
|
|
"base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+teamId+"' ) "+filter;
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("oldTotal",count);
|
|
|
//照护老人数量
|
|
|
filter = "";
|
|
|
sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
|
|
|
listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
if(listtmp.size()>0){
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
filter = " and h.org_code not in ('"+orgCodes+"')";
|
|
|
}
|
|
|
sql = "SELECT count(a.id) from base_doctor a,base_doctor_hospital h WHERE a.id=h.doctor_code and " +
|
|
|
" a.doctor_level = 2 and a.del = '1' and h.del = '1' ";
|
|
|
sql += " and EXISTS ( select 1 from base_team_member mem where mem.doctor_code = a.id " +
|
|
|
" and mem.team_code='"+teamId+"' and mem.del=1 ) "+filter;
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("helperTotal",count);
|
|
|
}
|
|
|
return teamList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public PageEnvelop<List<Map<String,Object>>> getOlderTeamListWithPage(Integer page,Integer size) throws Exception {
|
|
|
List<Map<String,Object>> teamList = new ArrayList<>();
|
|
|
page = page>0?page-1:0;
|
|
|
String sql = " select count(distinct org.code) from " +
|
|
|
" base_service_package pack INNER JOIN base_org org on pack.org_code = org.code " +
|
|
|
"INNER JOIN base_team te on te.org_code = org.`code` " +
|
|
|
" where org.del=1 and org.type=3 and te.del=1 and org.code not in " +
|
|
|
" (select dict_code from wlyy_hospital_sys_dict where dict_name='jkzl_org') ";
|
|
|
Long totalNum = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
sql = " select distinct org.code as orgCode,org.name as orgName,te.id as teamId,te.name as teamName from " +
|
|
|
" base_service_package pack INNER JOIN base_org org on pack.org_code = org.code " +
|
|
|
"INNER JOIN base_team te on te.org_code = org.`code` " +
|
|
|
" where org.del=1 and org.type=3 and te.del=1 and org.code not in " +
|
|
|
" (select dict_code from wlyy_hospital_sys_dict where dict_name='jkzl_org') order by org.code asc " +
|
|
|
"limit "+(page*size)+","+size ;
|
|
|
teamList = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> map:teamList){
|
|
|
//1 获取社工人数(该团队人数) 2.预警数(紧急呼叫+安防监护 已取消的不算)
|
|
|
//3助老服务(该社区所有老人的生活照料总数 已取消的不算) 4物联设备(健康设备绑定量+安防设备绑定量)
|
|
|
String teamName = map.get("teamName").toString();
|
|
|
String teamId = map.get("teamId").toString();
|
|
|
teamName = teamName.replace("团队","社区");
|
|
|
teamName = teamName.replace("服务","");
|
|
|
if(!teamName.contains("社区")){
|
|
|
teamName = teamName+"社区";
|
|
|
}
|
|
|
map.put("teamName",teamName);
|
|
|
sql = " select count(doc.id) from base_team_member mem ,base_doctor doc where mem.team_code='"+teamId+"' " +
|
|
|
" and mem.doctor_code = doc.id and mem.del=1 and doc.del=1 ";
|
|
|
Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("doctorCount",count);
|
|
|
sql = " SELECT count(o.bussiness_id) " +
|
|
|
"FROM ( SELECT o.id AS bussiness_id,o.team_code as dept,o.`status`,o.update_time " +
|
|
|
"FROM base_security_monitoring_order o UNION ALL " +
|
|
|
"SELECT o.id AS bussiness_id,o.team_code as dept,o.`status`,o.update_time " +
|
|
|
"FROM base_emergency_assistance_order o " +
|
|
|
") o WHERE 1=1 and dept='"+teamId+"' and `status` in (-2,0,1) ";
|
|
|
Long emeAssistanceCount = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
map.put("emeAssistanceCount",emeAssistanceCount);//救助服务
|
|
|
sql = " SELECT count(o.id) FROM base_life_care_order o WHERE o.status<>0 and o.status<>-1 and EXISTS ( " +
|
|
|
" select 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i," +
|
|
|
" base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = o.patient " +
|
|
|
" and CONVERT(sr.patient USING utf8) not in (SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` " +
|
|
|
" WHERE `dict_name` = 'jkzl_older' or dict_name='jkzl_child') and r.team_code='"+teamId+"' ) ";
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("olderServiceCount",count);//助老服务
|
|
|
sql = " select count(distinct pd.device_sn) from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
|
|
|
" INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " +
|
|
|
" where 1=1 and EXISTS ( " +
|
|
|
" select 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i," +
|
|
|
" base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = p.id " +
|
|
|
" and CONVERT(sr.patient USING utf8) not in (SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` " +
|
|
|
" WHERE `dict_name` = 'jkzl_older' or dict_name='jkzl_child') and r.team_code='"+teamId+"' ) ";
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("bindingDeviceCount",count);
|
|
|
|
|
|
|
|
|
String filter = "";
|
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_older' ";
|
|
|
List<Map<String,Object>> listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
if(listtmp.size()>0){
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
filter = " and a.id not in ('"+orgCodes+"')";
|
|
|
}
|
|
|
sql = "SELECT count(a.id) from base_patient a WHERE a.archive_type = 1 and a.del = '1' ";
|
|
|
sql += " and EXISTS ( select 1 from " +
|
|
|
"base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+teamId+"' ) "+filter;
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("oldTotal",count);//照护老人数量
|
|
|
|
|
|
filter = "";
|
|
|
sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
|
|
|
listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
if(listtmp.size()>0){
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
filter = " and h.org_code not in ('"+orgCodes+"')";
|
|
|
}
|
|
|
sql = "SELECT count(a.id) from base_doctor a,base_doctor_hospital h WHERE a.id=h.doctor_code and " +
|
|
|
" a.doctor_level = 2 and a.del = '1' and h.del = '1' ";
|
|
|
sql += " and EXISTS ( select 1 from base_team_member mem where mem.doctor_code = a.id " +
|
|
|
" and mem.team_code='"+teamId+"' and mem.del=1 ) "+filter;
|
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
map.put("helperTotal",count);//社工数量
|
|
|
|
|
|
//医生服务 老人健康咨询咨询+续方
|
|
|
String olderFilter = " and EXISTS ( select 1 from " +
|
|
|
" base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id and i.del = 1 " +
|
|
|
" and sr.`status`=1 and CONVERT(sr.patient USING utf8) = {patient} " +
|
|
|
" and CONVERT(sr.patient USING utf8) not in (SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` WHERE `dict_name` = 'jkzl_older' or dict_name='jkzl_child') and r.team_code='"+teamId+"' ) ";
|
|
|
sql = " SELECT count(p.id) FROM base_care_prescription p where 1=1 "+olderFilter.replace("{patient}","p.patient")+" ";
|
|
|
Long doctorServiceCount = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
//老人健康咨询咨询
|
|
|
sql = " SELECT count(o.consult) FROM wlyy_consult_team o INNER JOIN base_doctor d on o.doctor = d.id " +
|
|
|
" where 1=1 and o.type = 25 AND d.del = 1 "+olderFilter.replace("{patient}","o.patient")+" ";
|
|
|
doctorServiceCount += jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
map.put("doctorServiceTotal",doctorServiceCount);//社工数量
|
|
|
}
|
|
|
return PageEnvelop.getSuccessListWithPage("success",teamList,page,size,totalNum);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取助老机构生活照料服务响应率情况
|
|
|
*/
|
|
|
public List<Map<String,Object>> getOrgLifeCareStatistic() {
|
|
|
String sql = " select code,name from base_org where type=3 and code not in (select dict_code from wlyy_hospital_sys_dict " +
|
|
|
" where dict_name ='jkzl_org') and del=1 ";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
sql = " select count(life.id) total,life.hospital,org.name from base_life_care_order life INNER JOIN base_org org " +
|
|
|
" on life.hospital = org.code where life.`status`=2 and org.code not in (select dict_code from wlyy_hospital_sys_dict "+
|
|
|
" where dict_name ='jkzl_org') and org.del=1 ";
|
|
|
List<Map<String,Object>> tmpList = jdbcTemplate.queryForList(sql);
|
|
|
Map<String,List<Map<String,Object>>> numList = tmpList.stream().collect(Collectors.groupingBy(e->e.get("hospital").toString()));
|
|
|
sql = " select count(life.id) total,life.hospital,org.name from base_life_care_order life INNER JOIN base_org org " +
|
|
|
" on life.hospital = org.code where life.`status` in (1,3) and org.code not in (select dict_code from wlyy_hospital_sys_dict "+
|
|
|
" where dict_name ='jkzl_org') and org.del=1 ";
|
|
|
tmpList = jdbcTemplate.queryForList(sql);
|
|
|
Map<String,List<Map<String,Object>>> numList2 = tmpList.stream().collect(Collectors.groupingBy(e->e.get("hospital").toString()));
|
|
|
for (Map<String, Object> tmp : list) {
|
|
|
if (numList.containsKey(tmp.get("code"))||numList2.containsKey(tmp.get("code"))) {
|
|
|
Long finish=0l;
|
|
|
Long unfinish=0l;
|
|
|
if (numList.containsKey(tmp.get("code"))){
|
|
|
finish =Long.valueOf(numList.get(tmp.get("code")).get(0).get("total").toString());
|
|
|
}
|
|
|
if (numList2.containsKey(tmp.get("code"))){
|
|
|
unfinish =Long.valueOf(numList2.get(tmp.get("code")).get(0).get("total").toString());
|
|
|
}
|
|
|
tmp.put("finish", finish);
|
|
|
tmp.put("unfinish", unfinish);
|
|
|
tmp.put("total", finish+unfinish);
|
|
|
tmp.put("law", commonUtil.getRangeDouble(finish.intValue(),(finish.intValue()+unfinish.intValue())));
|
|
|
} else {
|
|
|
tmp.put("finish", 0);
|
|
|
tmp.put("unfinish", 0);
|
|
|
tmp.put("total", 0);
|
|
|
tmp.put("law", 0);
|
|
|
}
|
|
|
}
|
|
|
if (list.size()>0){
|
|
|
list.sort(Comparator.comparing(obj -> Double.parseDouble(((Map<String,Object>) obj).get("law").toString())).reversed());
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
}
|