|
@ -117,7 +117,9 @@ public class DetectionPlatformService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public JSONObject getDeviceComapny(){
|
|
|
public JSONObject getDeviceComapny(String area,Integer level){
|
|
|
String olderFilter = roleService.getOlderRoleSQL(area,level+"");
|
|
|
|
|
|
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);
|
|
@ -144,7 +146,7 @@ public class DetectionPlatformService {
|
|
|
}
|
|
|
String securitySql = "SELECT allCount,isUse,(allCount - isUse) inventory FROM \n" +
|
|
|
"(SELECT COUNT(1) allCount FROM wlyy_devices WHERE device_type = 1) allCount,\n" +
|
|
|
"(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 1 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0) isUse";
|
|
|
"(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 1 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0 "+olderFilter.replace("{patient}","pd.user")+" ) isUse";
|
|
|
List<Map<String , Object>> securityList = jdbcTemplate.queryForList(securitySql);
|
|
|
if (securityList.size() > 0) {
|
|
|
object.put("securityAllCount",securityList.get(0).get("allCount")); //安防设备总量
|
|
@ -157,7 +159,7 @@ public class DetectionPlatformService {
|
|
|
}
|
|
|
String healthSql = "SELECT allCount,isUse,(allCount - isUse) inventory FROM \n" +
|
|
|
"(SELECT COUNT(1) allCount FROM wlyy_devices WHERE device_type = 0) allCount,\n" +
|
|
|
"(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 0 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0) isUse";
|
|
|
"(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 0 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0 "+olderFilter.replace("{patient}","pd.user")+" ) isUse";
|
|
|
List<Map<String , Object>> healthList = jdbcTemplate.queryForList(healthSql);
|
|
|
if (healthList.size() > 0) {
|
|
|
object.put("healthAllCount",healthList.get(0).get("allCount"));//健康设备总量
|
|
@ -175,7 +177,7 @@ public class DetectionPlatformService {
|
|
|
object.put("lawOfIOT",getRange( (securityIsUser.intValue() + healthIsUser.intValue() ),( securityAllCount.intValue() + healthAllCount.intValue() ) ));//物联率 发放了就算物联
|
|
|
object.put("isUseAllIot",(securityIsUser.intValue() + healthIsUser.intValue()));//已发放设备 失联分母、物联分子
|
|
|
object.put("allIot",securityAllCount.intValue() + healthAllCount.intValue());//总设备 物联分母
|
|
|
String unUseSql = "SELECT DISTINCT wd.device_code FROM wlyy_devices wd INNER JOIN wlyy_patient_device pd on wd.device_code =pd.device_sn and pd.user "+filter+" WHERE contact_status = 0";//contact_status = 0 失联
|
|
|
String unUseSql = "SELECT DISTINCT wd.device_code FROM wlyy_devices wd INNER JOIN wlyy_patient_device pd on wd.device_code =pd.device_sn and pd.user "+filter+" "+olderFilter.replace("{patient}","pd.user")+" WHERE contact_status = 0";//contact_status = 0 失联
|
|
|
List<Map<String , Object>> unUseList = jdbcTemplate.queryForList(unUseSql);
|
|
|
int unUseCount = unUseList.size();
|
|
|
object.put("unUseCount",unUseCount);//设备失联数量 失联分子
|
|
@ -492,8 +494,9 @@ public class DetectionPlatformService {
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
public JSONObject getServiceSituation(){
|
|
|
public JSONObject getServiceSituation(String area,Integer level){
|
|
|
JSONObject object = new JSONObject();
|
|
|
String olderFilter = roleService.getOlderRoleSQL(area,level+"");
|
|
|
/*****设备分类****/
|
|
|
// SELECT hsd.`value` dict_value,aa.count FROM base_system_dict_entry hsd LEFT JOIN (SELECT serve_desc,COUNT(1) count FROM base_security_monitoring_order GROUP BY serve_desc)aa ON hsd.`value` = aa.serve_desc WHERE hsd.remark = 'security'
|
|
|
String passportTypeSql = "SELECT sde.`value`,COUNT(d.id) count,GROUP_CONCAT(DISTINCT d.category_code SEPARATOR ',') AS category_code,GROUP_CONCAT(DISTINCT d.model SEPARATOR ',') AS model FROM base_system_dict_entry sde LEFT JOIN dm_device d ON FIND_IN_SET(sde.`code`,d.service_topic) WHERE sde.remark = 'security' GROUP BY sde.`value` ";
|
|
@ -510,7 +513,7 @@ public class DetectionPlatformService {
|
|
|
model = (String) passportType.get(i).get("model");
|
|
|
model = model.replace(",","','");
|
|
|
if ( count.intValue() > 0) {
|
|
|
useSql = "SELECT COUNT(DISTINCT device_sn) FROM wlyy_patient_device WHERE category_code IN ("+ passportType.get(i).get("category_code") +") AND del = 0";
|
|
|
useSql = "SELECT COUNT(DISTINCT device_sn) FROM wlyy_patient_device pd WHERE category_code IN ("+ passportType.get(i).get("category_code") +") AND del = 0 "+olderFilter.replace("{patient}","pd.user");
|
|
|
use = jdbcTemplate.queryForObject(useSql,Integer.class);
|
|
|
passportType.get(i).put("use",use);//使用
|
|
|
allSql = "SELECT COUNT(DISTINCT device_code) FROM wlyy_devices WHERE device_model IN ('"+ model +"')";
|