|
@ -453,9 +453,9 @@ public class StatisticsService {
|
|
" '女' ELSE a.sex \n" +
|
|
" '女' ELSE a.sex \n" +
|
|
" END AS sex,\n" +
|
|
" END AS sex,\n" +
|
|
" TIMESTAMPDIFF(YEAR,a.birthday,now()) AS age,\n" +
|
|
" TIMESTAMPDIFF(YEAR,a.birthday,now()) AS age,\n" +
|
|
" a.doctor_level,a.mobile,h.org_name,a.idcard ";
|
|
|
|
|
|
" a.doctor_level,a.mobile,org.name org_name,a.idcard ";
|
|
String countSql = " select count(a.id)";
|
|
String countSql = " select count(a.id)";
|
|
String fromSql = " from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
|
|
|
|
|
|
String fromSql = " from base_doctor a,base_doctor_hospital h,base_org org where a.id=h.doctor_code and h.org_code=org.code and org.del=1 and a.del = '1' and h.del = '1' " +
|
|
" and a.doctor_level is not null and h.org_code not in ( " +
|
|
" and a.doctor_level is not null and h.org_code not in ( " +
|
|
" SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ) and a.doctor_level="+type+" ";
|
|
" SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ) and a.doctor_level="+type+" ";
|
|
if(StringUtils.isNotBlank(name)){
|
|
if(StringUtils.isNotBlank(name)){
|
|
@ -2675,12 +2675,14 @@ public class StatisticsService {
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
filter = " and a.id not in ('"+orgCodes+"')";
|
|
filter = " and a.id not in ('"+orgCodes+"')";
|
|
}
|
|
}
|
|
sql = "SELECT count(a.id) from base_patient a WHERE a.archive_type = 1 and a.sign_status=1 and a.del = '1' ";
|
|
|
|
sql += " and EXISTS ( select 1 from " +
|
|
|
|
|
|
sql = "SELECT count(distinct a.id) from base_patient a WHERE a.archive_type = 1 and a.sign_status=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 " +
|
|
"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 " +
|
|
" 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;
|
|
|
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+teamId+"') or " +
|
|
|
|
" (EXISTS (select 1 from wlyy_patient_device pd where pd.user = a.id and pd.del=0)) ) "+filter;
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
|
|
|
map.put("oldTotal",count);//照护老人数量
|
|
map.put("oldTotal",count);//照护老人数量
|
|
|
|
|
|
filter = "";
|
|
filter = "";
|
|
@ -2807,6 +2809,9 @@ public class StatisticsService {
|
|
tmp.setServeItems(serviceItems.get(0));
|
|
tmp.setServeItems(serviceItems.get(0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ("2".equals(tmp.getType())){//咨询
|
|
|
|
tmp.setServeItems("咨询");
|
|
|
|
}
|
|
if ("3".equals(tmp.getType())||"4".equals(tmp.getType())){//生活照料
|
|
if ("3".equals(tmp.getType())||"4".equals(tmp.getType())){//生活照料
|
|
String sql = " select group_concat(Distinct name SEPARATOR '、') from base_life_care_fee_detail where order_id ='"+relationCode+"' ";
|
|
String sql = " select group_concat(Distinct name SEPARATOR '、') from base_life_care_fee_detail where order_id ='"+relationCode+"' ";
|
|
List<String> serviceItems = jdbcTemplate.queryForList(sql,String.class);
|
|
List<String> serviceItems = jdbcTemplate.queryForList(sql,String.class);
|
|
@ -2814,6 +2819,9 @@ public class StatisticsService {
|
|
tmp.setServeItems(serviceItems.get(0));
|
|
tmp.setServeItems(serviceItems.get(0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ("5".equals(tmp.getType())){//咨询
|
|
|
|
tmp.setServeItems("紧急救助");
|
|
|
|
}
|
|
if ("6".equals(tmp.getType())){//安防
|
|
if ("6".equals(tmp.getType())){//安防
|
|
String sql = "SELECT serve_desc FROM base_security_monitoring_order WHERE id = '"+relationCode+"'";
|
|
String sql = "SELECT serve_desc FROM base_security_monitoring_order WHERE id = '"+relationCode+"'";
|
|
List<String> serviceItems = jdbcTemplate.queryForList(sql,String.class);
|
|
List<String> serviceItems = jdbcTemplate.queryForList(sql,String.class);
|
|
@ -3524,6 +3532,17 @@ public class StatisticsService {
|
|
if (StringUtils.isNotBlank(name)) nameSql = " AND p.name LIKE '%" + name + "%'";
|
|
if (StringUtils.isNotBlank(name)) nameSql = " AND p.name LIKE '%" + name + "%'";
|
|
if (StringUtils.isNotBlank(deviceSn)) deviceSnSql = " AND pd.device_sn = '" + deviceSn + "'";
|
|
if (StringUtils.isNotBlank(deviceSn)) deviceSnSql = " AND pd.device_sn = '" + deviceSn + "'";
|
|
|
|
|
|
|
|
String filter="";
|
|
|
|
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"));
|
|
|
|
if (StringUtils.isNotBlank(orgCodes)){
|
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
|
filter = " and p.id not in ('"+orgCodes+"') ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
page = page>0?page-1:0;
|
|
page = page>0?page-1:0;
|
|
|
|
|
|
String deviceSql = "";
|
|
String deviceSql = "";
|
|
@ -3537,11 +3556,11 @@ public class StatisticsService {
|
|
" FROM " +
|
|
" FROM " +
|
|
" wlyy_patient_device pd LEFT JOIN base_patient p ON pd.`user` = p.id LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
|
|
" wlyy_patient_device pd LEFT JOIN base_patient p ON pd.`user` = p.id LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
|
|
" LEFT JOIN wlyy_devices wd ON wd.device_code = pd.device_sn WHERE " +
|
|
" LEFT JOIN wlyy_devices wd ON wd.device_code = pd.device_sn WHERE " +
|
|
" pd.del = 0 " + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
|
|
|
|
|
|
" pd.del = 0 "+filter + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
|
|
totalSql = "SELECT count(DISTINCT pd.id) FROM " +
|
|
totalSql = "SELECT count(DISTINCT pd.id) FROM " +
|
|
" wlyy_patient_device pd LEFT JOIN base_patient p ON pd.`user` = p.id LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
|
|
" wlyy_patient_device pd LEFT JOIN base_patient p ON pd.`user` = p.id LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
|
|
" LEFT JOIN wlyy_devices wd ON wd.device_code = pd.device_sn WHERE " +
|
|
" LEFT JOIN wlyy_devices wd ON wd.device_code = pd.device_sn WHERE " +
|
|
" pd.del = 0 " + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
|
|
|
|
|
|
" pd.del = 0 " +filter+ nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
|
|
}
|
|
}
|
|
|
|
|
|
if ("af".equals(type) || StringUtils.isBlank(type)) {
|
|
if ("af".equals(type) || StringUtils.isBlank(type)) {
|