|  | @ -559,6 +559,9 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |             if (ind.equals("45")){
 | 
	
		
			
				|  |  |                 areaLevel="2";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (ind.equals("52")){
 | 
	
		
			
				|  |  |                 areaLevel="2";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, ind, SaveModel.timeLevel_DDL,areaLevel);
 | 
	
		
			
				|  |  |             res.put("index_"+ind+"_total",saveModel.getResult2().longValue());
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(type)){
 | 
	
	
		
			
				|  | @ -853,8 +856,8 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         String sql = " select dict.dict_code,dict_value,count(DISTINCT lab.patient) total from wlyy_hospital_sys_dict dict \n" +
 | 
	
		
			
				|  |  |                 "LEFT JOIN wlyy_patient_label lab  on  dict.dict_code = lab.label_code AND  lab.label_type='1' " +
 | 
	
		
			
				|  |  |                 "where  dict.dict_name='service_type' and lab.patient "+filter+" and  dict.dict_code is not null and dict_code<>5  \n" +
 | 
	
		
			
				|  |  |                 "LEFT JOIN wlyy_patient_label lab  on  dict.dict_code = lab.label_code AND  lab.label_type='1' and lab.patient "+filter+" " +
 | 
	
		
			
				|  |  |                 "where  dict.dict_name='service_type'  and  dict.dict_code is not null and dict_code<>5  \n" +
 | 
	
		
			
				|  |  |                 " GROUP BY dict.dict_code; ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1041,10 +1044,10 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             filter = " not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String sql =" select count(id) from base_patient where del=1 and id "+filter;
 | 
	
		
			
				|  |  |         String sql =" select count(id) from base_patient  where del=1 and archive_type=1 and id "+filter;
 | 
	
		
			
				|  |  |         Integer olderCount  = jdbcTemplate.queryForObject(sql,Integer.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = " select count(DISTINCT pd.id) from base_patient p INNER JOIN wlyy_patient_device pd on p.id = pd.user and pd.del=0 where p.del=1 and p.id "+filter;
 | 
	
		
			
				|  |  |         sql = " select count(DISTINCT p.id) from base_patient p INNER JOIN wlyy_patient_device pd on p.id = pd.user and p.archive_type=1 and pd.del=0 where p.del=1 and p.id "+filter;
 | 
	
		
			
				|  |  |         Integer bindingCount  = jdbcTemplate.queryForObject(sql,Integer.class);
 | 
	
		
			
				|  |  |         result.put("olderCount",olderCount);
 | 
	
		
			
				|  |  |         result.put("bindingCount",bindingCount);
 | 
	
	
		
			
				|  | @ -1142,8 +1145,17 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject deviceUsingInfo(String area){
 | 
	
		
			
				|  |  |         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"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             filter = " not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         String sql = "SELECT COUNT(DISTINCT device_sn) FROM wlyy_patient_device WHERE del = 0";
 | 
	
		
			
				|  |  |         String sql = "SELECT COUNT(DISTINCT device_sn) FROM wlyy_patient_device WHERE del = 0 and user "+filter;
 | 
	
		
			
				|  |  |         Integer use = jdbcTemplate.queryForObject(sql,Integer.class);
 | 
	
		
			
				|  |  |         sql = "SELECT COUNT(DISTINCT device_code) FROM wlyy_devices ";
 | 
	
		
			
				|  |  |         Integer total = jdbcTemplate.queryForObject(sql,Integer.class);
 | 
	
	
		
			
				|  | @ -1152,7 +1164,7 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |         result.put("stock",total-use);//库存
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = "SELECT DISTINCT count(wd.device_code) FROM wlyy_devices wd INNER JOIN wlyy_patient_device pd on " +
 | 
	
		
			
				|  |  |                 "wd.device_code =pd.device_sn  WHERE contact_status = 0";//contact_status = 0   失联
 | 
	
		
			
				|  |  |                 "wd.device_code =pd.device_sn  WHERE contact_status = 0 and pd.user "+filter;//contact_status = 0   失联
 | 
	
		
			
				|  |  |         Integer lost = jdbcTemplate.queryForObject(sql,Integer.class);
 | 
	
		
			
				|  |  |         //物联率 失联率
 | 
	
		
			
				|  |  |         result.put("deviceAll",total);//物联率分母总数 设备总数(包括库存)
 | 
	
	
		
			
				|  | @ -1165,6 +1177,15 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public PageEnvelop getSecurityOrderList(String area,String status, String svrDesc,String topicItem, Integer page, Integer pageSize){
 | 
	
		
			
				|  |  |         String testPatients = "";
 | 
	
		
			
				|  |  |         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(",","','");
 | 
	
		
			
				|  |  |             testPatients = " not in ('"+orgCodes+"') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         page = page>1?page-1:0;
 | 
	
		
			
				|  |  |         JSONArray result = new JSONArray();
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1183,6 +1204,7 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |         if (org.apache.commons.lang3.StringUtils.isNotBlank(topicItem)){
 | 
	
		
			
				|  |  |             fliter+=" and ord.topic_item='"+topicItem+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         fliter +=" and ord.patient "+testPatients;
 | 
	
		
			
				|  |  |         Long count = jdbcTemplate.queryForObject(sqlCount+fliter,Long.class);
 | 
	
		
			
				|  |  |         fliter+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
 | 
	
	
		
			
				|  | @ -1241,6 +1263,15 @@ public class StatisticsService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject getSecurityTab(String area,String status,String svrDesc,String topicItem){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String testPatients = "";
 | 
	
		
			
				|  |  |         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(",","','");
 | 
	
		
			
				|  |  |             testPatients = " not in ('"+orgCodes+"') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(area)){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -1274,6 +1305,8 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |         if (org.apache.commons.lang3.StringUtils.isNotBlank(topicItem)){
 | 
	
		
			
				|  |  |             fliter+=" and ord.topic_item='"+topicItem+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         fliter +=" and ord.patient "+testPatients;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         fliter+=" group by ord.status,ord.serve_desc ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
 | 
	
		
			
				|  |  |         String pyCode = "";
 |