| 
					
				 | 
			
			
				@ -53,7 +53,6 @@ import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by yeshijie on 2021/4/7. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Service 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -102,6 +101,7 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 统计总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -118,27 +118,27 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String index = "28,31,35,37,39,44,54"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+ind,saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + ind, saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //41紧急预警43安防要与实时一样,查sql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter2=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(listtmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> listtmp = jdbcTemplate.queryForList(sqltmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter2 = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter = " and hospital not in ('" + orgCodes + "') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter2 = " and org_code not in ('" + orgCodes + "') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 "+filter2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 " + filter2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 " + filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*//男 女 性别总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sexCountSql = "SELECT COUNT(*) ss, CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END AS sex " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -148,37 +148,37 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("sexCount",sexCountMap);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //老人-紧急预警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_"+41,emergencyCallNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_" + 41, emergencyCallNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //老人 安放监护 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_"+43,securityMonitoringNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_" + 43, securityMonitoringNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //评估类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("capacityAssessment",cloudCareForTheElderly(endDate,defalutArea,defalutLevel)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("capacityAssessment", cloudCareForTheElderly(endDate, defalutArea, defalutLevel)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民健康标签纬度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("patientLabelStatistic",statisticsOrderServer("47",endDate,2,"2")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("patientLabelStatistic", statisticsOrderServer("47", endDate, 2, "2")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // activity-1   活动浏览次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // activity-2   公艺课程播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select type,num from base_child_activity_click where type in(1,2)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> lists = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> tmp:lists){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> lists = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> tmp : lists) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num = Integer.parseInt(tmp.get("num").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("activity_"+tmp.get("type").toString(),num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("activity_" + tmp.get("type").toString(), num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //activity-3 幼儿活动报名-总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql = " select count(id) as total from base_child_activity_registration "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("activity_3",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(sql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("activity_3", count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /*曲线*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject curveTotal(String day,String type,String area,int level,String timeLevel,String interval,String lowLevel) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject curveTotal(String day, String type, String area, int level, String timeLevel, String interval, String lowLevel) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sqlbuff = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listMaps = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("".equals(day)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> listMaps = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("".equals(day)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            day = "30"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar cal = Calendar.getInstance(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -188,39 +188,39 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*---------sql----------*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 3 幼儿活动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("3".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT count(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') as `range` FROM base_child_activity_registration WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= date(create_time) GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("3".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT count(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') as `range` FROM base_child_activity_registration WHERE DATE_SUB(CURDATE(), INTERVAL " + day + " DAY) <= date(create_time) GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count",listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count", listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //41 老人-紧急呼叫 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("41".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_emergency_assistance_order WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND status >= 0 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("41".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_emergency_assistance_order WHERE DATE_SUB(CURDATE(), INTERVAL " + day + " DAY) <= DATE(create_time) AND status >= 0 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count",listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count", listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //43 老人 安放监护 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("43".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_security_monitoring_order WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND status >= 0 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("43".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_security_monitoring_order WHERE DATE_SUB(CURDATE(), INTERVAL " + day + " DAY) <= DATE(create_time) AND status >= 0 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count",listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count", listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 1   活动浏览次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_activity_click WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND activity_type = 1 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_activity_click WHERE DATE_SUB(CURDATE(), INTERVAL " + day + " DAY) <= DATE(create_time) AND activity_type = 1 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count",listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count", listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 2 公艺课程播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("2".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_activity_click WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND activity_type = 2 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("2".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_activity_click WHERE DATE_SUB(CURDATE(), INTERVAL " + day + " DAY) <= DATE(create_time) AND activity_type = 2 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count",listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count", listMaps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*----------es-----------*/ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -230,23 +230,23 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 32 新生儿-在线咨询总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 35 新生儿-上门辅导-服务工单数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 54 新生儿-上门辅导-工单数发起数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("".equals(interval)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            interval ="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("".equals(interval)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            interval = "1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("".equals(timeLevel)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            timeLevel ="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("".equals(timeLevel)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            timeLevel = "1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!"3".equals(type)&&!"41".equals(type)&&!"43".equals(type)&&!"1".equals(type)&&!"2".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray esResoult = addLine(String.valueOf(date),LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), area, level, type, timeLevel, interval, lowLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!"3".equals(type) && !"41".equals(type) && !"43".equals(type) && !"1".equals(type) && !"2".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray esResoult = addLine(String.valueOf(date), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), area, level, type, timeLevel, interval, lowLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map> maps = JSONObject.parseArray(esResoult.toJSONString(), Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count",maps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("count", maps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /*综合总数*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject combinedTotal(String type,String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject combinedTotal(String type, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String index = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //es 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -264,60 +264,60 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //43 老人 安放监护 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //type   幼儿42    37老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("37".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("37".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            index = "39,44"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_"+ind,saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_" + ind, saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_41",emergencyCallNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_43",securityMonitoringNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_41", emergencyCallNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_43", securityMonitoringNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            index = "28,35,54,29"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_"+ind,saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_" + ind, saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // activity-1   活动浏览次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // activity-2   公艺课程播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select type,num from base_child_activity_click where type in(1,2)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> lists = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String,Object> tmp:lists){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> lists = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> tmp : lists) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer num = Integer.parseInt(tmp.get("num").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("activity_"+tmp.get("type").toString(),num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("activity_" + tmp.get("type").toString(), num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*幼儿活动报名 总数*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlActivity = " select count(id) as total from base_child_activity_registration "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer count = jdbcTemplate.queryForObject(sqlActivity,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("activity_3",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer count = jdbcTemplate.queryForObject(sqlActivity, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("activity_3", count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject serviceResources(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject serviceResources() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String orgFilter = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlOrg = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listOrg =  jdbcTemplate.queryForList(sqlOrg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(listOrg.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> listOrg = jdbcTemplate.queryForList(sqlOrg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (listOrg.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String orgCodes = String.valueOf(listOrg.get(0).get("orgCodes")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgFilter = " and code not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgFilter = " and code not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //助老员和教师注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer doctorNum = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -327,31 +327,31 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "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'  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ") GROUP BY a.doctor_level"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:list2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String archive_type = map.get("doctor_level").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num = Integer.valueOf(map.get("c").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("1".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctorNum = num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("2".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                helperNum = num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("3".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("3".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                teacherNum = num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("medicalInstitutionNum",medicalInstitutionNum);             //医疗结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("elderlyCarServiceNum",elderlyCarServiceNum);               //养老机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("childcareInstitutionsssNum",childcareInstitutionsssNum);   //托育机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("doctorNum",doctorNum);     //医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("helperNum",helperNum);     //助老员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("teacherNum",teacherNum);   //教师 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("medicalInstitutionNum", medicalInstitutionNum);             //医疗结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("elderlyCarServiceNum", elderlyCarServiceNum);               //养老机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("childcareInstitutionsssNum", childcareInstitutionsssNum);   //托育机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("doctorNum", doctorNum);     //医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("helperNum", helperNum);     //助老员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("teacherNum", teacherNum);   //教师 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -361,11 +361,11 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter = " and id not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer olderTotal = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -374,158 +374,159 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql1 += filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql1 += " GROUP BY archive_type"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:list1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String archive_type = map.get("archive_type").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num = Integer.valueOf(map.get("c").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("1".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                olderTotal = num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("2".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                childTotal = num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String healthEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND (category_code = 1 OR category_code = 2)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer healthEquipmentNum = jdbcTemplate.queryForObject(healthEquipmentSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer healthEquipmentNum = jdbcTemplate.queryForObject(healthEquipmentSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String securityEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND category_code > 2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer securityEquipmentNum = jdbcTemplate.queryForObject(securityEquipmentSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer securityEquipmentNum = jdbcTemplate.queryForObject(securityEquipmentSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        listtmp =  jdbcTemplate.queryForList(sqltmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        filter=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter2=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(listtmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        listtmp = jdbcTemplate.queryForList(sqltmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        filter = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter2 = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0"+filter2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("olderTotal",olderTotal);   //老人注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("childTotal",childTotal);   //儿童注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("healthEquipmentNum",healthEquipmentNum);   //健康设备 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("securityEquipmentNum",securityEquipmentNum);   //安防设备 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("emergencyCallNum",emergencyCallNum);   //紧急呼叫的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("securityMonitoringNum",securityMonitoringNum);   //安防监护触发工单的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter = " and hospital not in ('" + orgCodes + "') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter2 = " and org_code not in ('" + orgCodes + "') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0" + filter2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 " + filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("olderTotal", olderTotal);   //老人注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("childTotal", childTotal);   //儿童注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("healthEquipmentNum", healthEquipmentNum);   //健康设备 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("securityEquipmentNum", securityEquipmentNum);   //安防设备 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("emergencyCallNum", emergencyCallNum);   //紧急呼叫的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("securityMonitoringNum", securityMonitoringNum);   //安防监护触发工单的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getAllDynamics(Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getAllDynamics(Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date date = DateUtil.getPreDays(new Date(),-7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date date = DateUtil.getPreDays(new Date(), -7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String dateStr = DateUtil.dateToStrLong(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filter =" "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  or dict_name = 'jkzl_user' or dict_name = 'jkzl_helper'  or dict_name = 'jkzl_teacher' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(listtmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 user_id not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(orgCodes)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter = " and user_id not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * from base_login_log where create_time>='"+dateStr+"' "+filter+" order by create_time desc limit "+ (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(id) from base_login_log where create_time>='"+dateStr+"' "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount,Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseLoginLogDO> loginLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseLoginLogDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BaseLoginLogDO log:loginLogDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * from base_login_log where create_time>='" + dateStr + "' " + filter + " order by create_time desc limit " + (page - 1) * size + "," + size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(id) from base_login_log where create_time>='" + dateStr + "' " + filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount, Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseLoginLogDO> loginLogDOs = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BaseLoginLogDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BaseLoginLogDO log : loginLogDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("patient",log.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("1".equals(log.getLoginType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("patient", log.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(log.getLoginType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("onLineFlag", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("archiveType","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if("2".equals(log.getLoginType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("archiveType", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("2".equals(log.getLoginType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //docotr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer onLineFlag =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer onLineFlag = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorDO doctorDO = doctorDao.findOne(log.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(doctorDO!=null&&"1".equals(doctorDO.getOnline())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    onLineFlag=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (doctorDO != null && "1".equals(doctorDO.getOnline())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    onLineFlag = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("onLineFlag", onLineFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("archiveType","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("archiveType", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //居民 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BasePatientDO patient = patientDao.findById(log.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (patient != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Integer onLineFlag =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (patient.getArchiveType() == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (patient != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Integer onLineFlag = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (patient.getArchiveType() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    switch (patient.getArchiveType().toString()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    switch (patient.getArchiveType().toString()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if(StringUtils.isNotBlank(patient.getOpenid())||"1".equals(patient.getOnline())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                onLineFlag=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (StringUtils.isNotBlank(patient.getOpenid()) || "1".equals(patient.getOnline())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                onLineFlag = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        case "2": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //新生儿 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if(StringUtils.isNotBlank(patient.getOpenid())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                onLineFlag=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (StringUtils.isNotBlank(patient.getOpenid())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                onLineFlag = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("archiveType",patient.getArchiveType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("residentialArea",patient.getResidentialArea()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("archiveType", patient.getArchiveType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("residentialArea", patient.getResidentialArea()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("onLineFlag", onLineFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("name",log.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("createTime", DateUtil.dateToStrLong(log.getCreateTime()) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("name", log.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("createTime", DateUtil.dateToStrLong(log.getCreateTime())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("clientType", log.getClientType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功", result, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 服务排名分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<NumVo> serviceRankingAnalysis(String endDate, String orgType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String index = "28,35"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("3".equals(orgType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("3".equals(orgType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            index = "31,39,44"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,NumVo> map = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, NumVo> map = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(endDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL,null,SaveModel.OrgLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SaveModel saveModel:saveModels){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(endDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL, null, SaveModel.OrgLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SaveModel saveModel : saveModels) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String orgCode = saveModel.getHospital(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(StringUtils.isBlank(orgCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isBlank(orgCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(map.containsKey(orgCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (map.containsKey(orgCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    NumVo numVo = map.get(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Long num = saveModel.getResult2().longValue()+numVo.getNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Long num = saveModel.getResult2().longValue() + numVo.getNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    numVo.setNum(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    NumVo numVo = new NumVo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    numVo.setCode(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    numVo.setName(saveModel.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    numVo.setNum(saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put(orgCode,numVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    map.put(orgCode, numVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<NumVo> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String key:map.keySet()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String key : map.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list.add(map.get(key)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list=list.stream().sorted(Comparator.comparing(NumVo::getNum).reversed()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = list.stream().sorted(Comparator.comparing(NumVo::getNum).reversed()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -533,83 +534,85 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 大屏实时数据 半小时刷新一次只能查数据库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject realTimeData() throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject realTimeData() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //幼儿数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT COUNT(DISTINCT patient) from base_doctor_patient_tmp WHERE del = 1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childNum = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("childNum",childNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childNum = jdbcTemplate.queryForObject(sql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("childNum", childNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //幼儿 服务次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startDate = DateUtil.getNowYear()+"-01-01 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startDate = DateUtil.getNowYear() + "-01-01 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endDate = DateUtil.getStringDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql28 = "SELECT COUNT(o.consult) FROM wlyy_consult_team o WHERE o.type = 23 and o.czrq >='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql35 = "SELECT COUNT(o.patient) FROM base_door_coach_order o WHERE o.`status`=6  and o.update_time>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num28 = jdbcTemplate.queryForObject(sql28,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num35 = jdbcTemplate.queryForObject(sql35,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childServiceNum = num28+num35; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("childServiceNum",childServiceNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql28 = "SELECT COUNT(o.consult) FROM wlyy_consult_team o WHERE o.type = 23 and o.czrq >='" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql35 = "SELECT COUNT(o.patient) FROM base_door_coach_order o WHERE o.`status`=6  and o.update_time>='" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num28 = jdbcTemplate.queryForObject(sql28, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num35 = jdbcTemplate.queryForObject(sql35, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childServiceNum = num28 + num35; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("childServiceNum", childServiceNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //老人 服务次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql31 = "SELECT COUNT(o.consult) FROM wlyy_consult_team o WHERE o.type = 24 and o.czrq >='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql39 = "SELECT COUNT(o.patient) FROM base_life_care_order o WHERE o.`status`=2 and o.update_time>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql44 = "SELECT COUNT(o.id) FROM base_life_care_order o WHERE o.`status`>0 and o.type = 3 and o.update_time>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num31 = jdbcTemplate.queryForObject(sql31,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num39 = jdbcTemplate.queryForObject(sql39,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num44 = jdbcTemplate.queryForObject(sql44,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql31 = "SELECT COUNT(o.consult) FROM wlyy_consult_team o WHERE o.type = 24 and o.czrq >='" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql39 = "SELECT COUNT(o.patient) FROM base_life_care_order o WHERE o.`status`=2 and o.update_time>='" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql44 = "SELECT COUNT(o.id) FROM base_life_care_order o WHERE o.`status`>0 and o.type = 3 and o.update_time>='" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num31 = jdbcTemplate.queryForObject(sql31, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num39 = jdbcTemplate.queryForObject(sql39, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer num44 = jdbcTemplate.queryForObject(sql44, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer olderServiceNum = num31 + num39 + num44; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("olderServiceNum",olderServiceNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("olderServiceNum", olderServiceNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String signSql = " SELECT COUNT(sr.id) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  base_service_package_sign_record sr " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  sr.STATUS = 1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //当前签约老人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer signNum = jdbcTemplate.queryForObject(signSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("signNum",signNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer signNum = jdbcTemplate.queryForObject(signSql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("signNum", signNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return json; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取登录记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop fingLoginLog(Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop fingLoginLog(Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<String> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date date = DateUtil.getPreDays(new Date(),-7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date date = DateUtil.getPreDays(new Date(), -7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String dateStr = DateUtil.dateToStrLong(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * from base_login_log where create_time>='"+dateStr+"'  order by create_time desc limit "+ (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(id) from base_login_log where create_time>='"+dateStr+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount,Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseLoginLogDO> loginLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseLoginLogDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BaseLoginLogDO log:loginLogDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * from base_login_log where create_time>='" + dateStr + "'  order by create_time desc limit " + (page - 1) * size + "," + size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(id) from base_login_log where create_time>='" + dateStr + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount, Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseLoginLogDO> loginLogDOs = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BaseLoginLogDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BaseLoginLogDO log : loginLogDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String content = log.getName() + "登录云照护平台 登录终端:" + getClientName(log.getClientType()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    + " " + DateUtil.dateToStrLong(log.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功", result, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * app,wx,pad,pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param clientType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String getClientName(String clientType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(clientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String getClientName(String clientType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(clientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("app".equals(clientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("app".equals(clientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "APP"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("wx".equals(clientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("wx".equals(clientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "微信公众号"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("pad".equals(clientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("pad".equals(clientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "多媒体平板"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("pc".equals(clientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("pc".equals(clientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "电脑脑端"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -618,7 +621,7 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 平台人员实时统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject platformPeople(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject platformPeople() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer olderTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer childTotal = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -637,21 +640,21 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //儿童注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String childFilter = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlChildtmp = "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(sqlChildtmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(listtmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> listtmp = jdbcTemplate.queryForList(sqlChildtmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (listtmp.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            childFilter = " and id not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            childFilter = " and id not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlchild = "SELECT COUNT(*) c,case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online from base_patient a WHERE archive_type = 2" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and del='1' "+childFilter+" GROUP BY online"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listChild = jdbcTemplate.queryForList(sqlchild); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:listChild){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and del='1' " + childFilter + " GROUP BY online"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> listChild = jdbcTemplate.queryForList(sqlchild); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : listChild) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num = Integer.valueOf(map.get("c").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer online = Integer.valueOf(map.get("online").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(online == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (online == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                childOn += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                childOff += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -659,99 +662,100 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String oldFilter = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlOldtmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_older' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listOldtmp =  jdbcTemplate.queryForList(sqlOldtmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(listOldtmp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> listOldtmp = jdbcTemplate.queryForList(sqlOldtmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (listOldtmp.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String orgCodes = String.valueOf(listOldtmp.get(0).get("orgCodes")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            oldFilter = " and a.id not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            oldFilter = " and a.id not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1 = "SELECT COUNT(*) c,case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online from base_patient a WHERE archive_type = 1" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and del='1' "+oldFilter+" GROUP BY online"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:list1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and del='1' " + oldFilter + " GROUP BY online"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num = Integer.valueOf(map.get("c").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer online = Integer.valueOf(map.get("online").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(online == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (online == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                olderOn += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                olderOff += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        olderTotal = olderOff+olderOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        childTotal = childOff+childOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        olderTotal = olderOff + olderOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        childTotal = childOff + childOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //助老员和教师注册人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online 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 ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ") GROUP BY a.doctor_level,on_line"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:list2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String archive_type = map.get("doctor_level").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer num = Integer.valueOf(map.get("c").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer online = Integer.valueOf(map.get("online").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("2".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(online == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (online == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    helperOn += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    helperOff += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("3".equals(archive_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(online == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("3".equals(archive_type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (online == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    teacherOn += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    teacherOff += num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        helperTotal = helperOff+helperOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        teacherTotal = teacherOff+teacherOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        helperTotal = helperOff + helperOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        teacherTotal = teacherOff + teacherOn; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("olderTotal",olderTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("childTotal",childTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("helperTotal",helperTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("teacherTotal",teacherTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("helperOn",helperOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("teacherOn",teacherOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("childOn",childOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("olderOn",olderOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("childOff",childOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("helperOff",helperOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("teacherOff",teacherOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("olderOff",olderOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("olderTotal", olderTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("childTotal", childTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("helperTotal", helperTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("teacherTotal", teacherTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("helperOn", helperOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("teacherOn", teacherOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("childOn", childOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("olderOn", olderOn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("childOff", childOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("helperOff", helperOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("teacherOff", teacherOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("olderOff", olderOff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 统计总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level 2 市  3区  4医院 5、科室 6医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level   2 市  3区  4医院 5、科室 6医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param index 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsTotalAmount( String endDate, String area, int level, String index, String type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsTotalAmount(String endDate, String area, int level, String index, String type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String areaLevel = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //周/月 增量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String start = statisticsUtilService.calStart(endDate,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevel0(start, endDate, area, level, ind, SaveModel.timeLevel_ZL,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String start = statisticsUtilService.calStart(endDate, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevel0(start, endDate, area, level, ind, SaveModel.timeLevel_ZL, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_"+ind+"_add",saveModelAdd.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_" + ind + "_add", saveModelAdd.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -762,12 +766,12 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 咨询分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * type 1幼儿 2老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject consultAnalysis(String endDate, String area, int level, String type) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject consultAnalysis(String endDate, String area, int level, String type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalIndex = "28"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String noReplyIndex = "29"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String inTimeIndex = "30"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("2".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("2".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalIndex = "31"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            noReplyIndex = "32"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            inTimeIndex = "33"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -778,11 +782,11 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, noReplyIndex, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //及时回复数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, inTimeIndex, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("total",saveModel1.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("noReply",saveModel2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("inTime",saveModel3.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("noReplyRate",statisticsUtilService.getTwoRange(saveModel2.getResult2(),saveModel1.getResult2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("inTimeRate",statisticsUtilService.getTwoRange(saveModel3.getResult2(),saveModel1.getResult2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("total", saveModel1.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("noReply", saveModel2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("inTime", saveModel3.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("noReplyRate", statisticsUtilService.getTwoRange(saveModel2.getResult2(), saveModel1.getResult2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("inTimeRate", statisticsUtilService.getTwoRange(saveModel3.getResult2(), saveModel1.getResult2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -791,7 +795,7 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 上门辅导分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject doorCoachAnalysis(String endDate, String area, int level) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject doorCoachAnalysis(String endDate, String area, int level) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalIndex = "34"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String noReplyIndex = "35"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -802,22 +806,22 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, noReplyIndex, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //服务费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, inTimeIndex, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("patientNum",saveModel1.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("orderNum",saveModel2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("fee",saveModel3.getResult1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("patientNum", saveModel1.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("orderNum", saveModel2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("fee", saveModel3.getResult1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //服务项目分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate,endDate,area,level,inTimeIndex,SaveModel.timeLevel_DDL,null,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;(i<list.size()&&i<5);i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate, endDate, area, level, inTimeIndex, SaveModel.timeLevel_DDL, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; (i < list.size() && i < 5); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("items",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("items", jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -825,16 +829,16 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 上门辅导服务项目 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray doorCoachItems(String endDate, String area, int level) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray doorCoachItems(String endDate, String area, int level) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //服务项目分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate,endDate,area,level,"36",SaveModel.timeLevel_DDL,null,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate, endDate, area, level, "36", SaveModel.timeLevel_DDL, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jsonArray; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -843,8 +847,8 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 通用增量趋势接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray addLine(String startDate,String endDate, String area, int level,String index,String timeLevel,String interval,String lowLevel)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = elasticsearchUtil.findDateQuotaLevel0(startDate,endDate,area,level,index,timeLevel,interval,lowLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray addLine(String startDate, String endDate, String area, int level, String index, String timeLevel, String interval, String lowLevel) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, index, timeLevel, interval, lowLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray result = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (SaveModel saveModel : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject range = new JSONObject(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -858,113 +862,113 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 居民分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject patientAnalysis(String endDate, String area, int level,String index) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject patientAnalysis(String endDate, String area, int level, String index) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String areaLevel = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("42".equals(index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("42".equals(index)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            areaLevel = "4"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //新生儿 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //是否入学 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> statusList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL,null,null,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> statusList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, null, null, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray statusArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<statusList.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < statusList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = statusList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statusArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("statusList",statusArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("statusList", statusArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //能力评估 从签约时服务标签取 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("levelList",capacityAssessment(null,null,null)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("levelList", capacityAssessment(null, null, null)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //居民健康标签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"47",SaveModel.timeLevel_DDL,null,null,"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "47", SaveModel.timeLevel_DDL, null, null, "2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray labelArr = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long total = 0l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue() == 0 && StringUtils.isBlank(saveModel.getSlaveKey1())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())) {//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total+=saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total += saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                labelArr.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject arrTmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelTotal",total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelList",labelArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("patientLabelStatistic",arrTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelTotal", total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelList", labelArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("patientLabelStatistic", arrTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //年龄分布 50 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL,null,null,"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel>  ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"50",SaveModel.timeLevel_DDL,null,null,"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL, null, null, "2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray ageArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<ageList.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < ageList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = ageList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())) {//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ageArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("ageList",ageArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("ageList", ageArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //居住小区分布 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter = " not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String  sql = "select count(id) total,residential_area residentialArea  from base_patient where del=1 and id "+filter+"  and archive_type=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "select count(id) total,residential_area residentialArea  from base_patient where del=1 and id " + filter + "  and archive_type=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "GROUP BY residential_area ORDER BY total desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> result = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Iterator<Map<String, Object>> iterator = result.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> tmp = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (iterator.hasNext()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (iterator.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp = iterator.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null==tmp.get("residentialArea")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null == tmp.get("residentialArea")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    iterator.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("residentialArea",result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("residentialArea", result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //性别分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String archiType=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("42".equals(index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType="2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String archiType = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("42".equals(index)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType = "2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("37".equals(index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("37".equals(index)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType = "1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate,defalutArea, level, "51",SaveModel.timeLevel_DDL,null,archiType,null,null,"2","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate, defalutArea, level, "51", SaveModel.timeLevel_DDL, null, archiType, null, null, "2", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray sexArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;i<sexList.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < sexList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = sexList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sexArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("sexList",sexArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("sexList", sexArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -972,7 +976,7 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 生活照料分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject lifeCareAnalysis(String endDate, String area, int level) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject lifeCareAnalysis(String endDate, String area, int level) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalIndex = "38"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String noReplyIndex = "39"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -983,22 +987,22 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, noReplyIndex, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //服务费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, inTimeIndex, SaveModel.timeLevel_DDL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("patientNum",saveModel1.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("orderNum",saveModel2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("fee",saveModel3.getResult1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("patientNum", saveModel1.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("orderNum", saveModel2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("fee", saveModel3.getResult1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //服务项目分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate,endDate,area,level,inTimeIndex,SaveModel.timeLevel_DDL,null,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;(i<list.size()&&i<5);i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate, endDate, area, level, inTimeIndex, SaveModel.timeLevel_DDL, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; (i < list.size() && i < 5); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("items",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("items", jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1006,16 +1010,16 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 生活照料服务项目 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray lifeCareItems(String endDate, String area, int level) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray lifeCareItems(String endDate, String area, int level) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //服务项目分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate,endDate,area,level,"40",SaveModel.timeLevel_DDL,null,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate, endDate, area, level, "40", SaveModel.timeLevel_DDL, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jsonArray; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1025,48 +1029,50 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 能力评估评估类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray capacityAssessment(String endDate, String area, Integer level) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray capacityAssessment(String endDate, String area, Integer level) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //评估类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 lab.patient not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(orgCodes)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter = " and lab.patient not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select dict.dict_code,dict_value,count(DISTINCT A.patient) total from wlyy_hospital_sys_dict dict \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN (select distinct lab.patient,lab.label_code from  wlyy_patient_label lab  INNER JOIN base_patient p on p.id = lab.patient AND  lab.label_type='1' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  filter+"   \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter + "   \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")A on dict.dict_code = A.label_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String older = " select count(distinct lab.patient) from  wlyy_patient_label lab  INNER JOIN base_patient p on p.id = lab.patient AND  lab.label_type='1' "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(older,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String older = " select count(distinct lab.patient) from  wlyy_patient_label lab  INNER JOIN base_patient p on p.id = lab.patient AND  lab.label_type='1' " + filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(older, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DecimalFormat df = new DecimalFormat("0.00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", df.format((Integer.parseInt(map.get("total").toString())*1.00) / count * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", df.format((Integer.parseInt(map.get("total").toString()) * 1.00) / count * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", map.get("total")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",map.get("dict_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",map.get("dict_value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", map.get("dict_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", map.get("dict_value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jsonArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         * 统计首页头部数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject indexTopNum(String area,String startDate,String endDate,Integer level){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 统计首页头部数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject indexTopNum(String area, String startDate, String endDate, Integer level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject re = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String signSql = " SELECT COUNT(sr.id) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1082,98 +1088,100 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String capacitySql = "select count(sr.id) from base_capacity_assessment_record sr, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   base_org o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " sr.org_code = o.code" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " sr.org_code = o.code"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filters = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(ConstantUtil.cityLevel.equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters = " and o.city_code = '"+area+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(ConstantUtil.townLevel.equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters = " and o.town_code = '"+area+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(ConstantUtil.orgLevel.equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters = " and o.code = '"+area+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (ConstantUtil.cityLevel.equals(level)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters = " and o.city_code = '" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (ConstantUtil.townLevel.equals(level)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters = " and o.town_code = '" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (ConstantUtil.orgLevel.equals(level)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters = " and o.code = '" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time >='"+startDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time >='" + startDate + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time <='" + endDate + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //签约数 能力评估 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer signNum = jdbcTemplate.queryForObject(signSql+filters,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer capacityNum = jdbcTemplate.queryForObject(capacitySql+filters,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("signNum",signNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("capacityNum",capacityNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer signNum = jdbcTemplate.queryForObject(signSql + filters, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer capacityNum = jdbcTemplate.queryForObject(capacitySql + filters, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("signNum", signNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("capacityNum", capacityNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页 养护服务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 类型:1本周,2本月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type      类型:1本周,2本月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject indexMaintenanceServices(String area,String startDate,String endDate,Integer level,int type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject indexMaintenanceServices(String area, String startDate, String endDate, Integer level, int type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject re = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select count(sr.id) from base_life_care_order sr, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   base_org o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " sr.hospital = o.code" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " sr.hospital = o.code"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(ConstantUtil.cityLevel.equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and o.city_code = '"+area+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(ConstantUtil.townLevel.equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and o.town_code = '"+area+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(ConstantUtil.orgLevel.equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and o.code = '"+area+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (ConstantUtil.cityLevel.equals(level)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and o.city_code = '" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (ConstantUtil.townLevel.equals(level)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and o.town_code = '" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (ConstantUtil.orgLevel.equals(level)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and o.code = '" + area + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String filters = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String timefilters = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time >='"+startDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time >='" + startDate + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filters += " and sr.create_time <='" + endDate + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String start = calStart(endDate,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        timefilters += " and sr.create_time >='"+start+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        timefilters += " and sr.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String start = calStart(endDate, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        timefilters += " and sr.create_time >='" + start + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        timefilters += " and sr.create_time <='" + endDate + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //生活照料 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer lifeCareNum = jdbcTemplate.queryForObject(sql+filters,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer lifeCareNumAdd = jdbcTemplate.queryForObject(sql+timefilters,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("lifeCareNum",lifeCareNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("lifeCareNumAdd",lifeCareNumAdd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer lifeCareNum = jdbcTemplate.queryForObject(sql + filters, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer lifeCareNumAdd = jdbcTemplate.queryForObject(sql + timefilters, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("lifeCareNum", lifeCareNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re.put("lifeCareNumAdd", lifeCareNumAdd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 统计安防、生活 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 误报警率完成率 完成率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsOrderResponse(String endDate){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsOrderResponse(String endDate) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //安防总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,defalutArea,2,"46","2","4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+46+"_total",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, defalutArea, 2, "46", "2", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + 46 + "_total", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //安防响应 误报警+完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate, defalutArea, 2, "46", "2", "-2", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            long finish = saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","0","4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate, defalutArea, 2, "46", "2", "0", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            finish += saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+46+"_finish",finish); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + 46 + "_finish", finish); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //安防误报警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+46+"_error",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate, defalutArea, 2, "46", "2", "-2", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + 46 + "_error", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //生活总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,defalutArea,2,"49","2","4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+49+"_total",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, defalutArea, 2, "49", "2", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + 49 + "_total", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //生活完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate,endDate,defalutArea,2,"49","2","2","4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+49+"_finish",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, defalutArea, 2, "49", "2", "2", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + 49 + "_finish", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1182,196 +1190,198 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 根据指标 level arealevel统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsOrderServer(String index,String endDate,Integer level,String areaLevel) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsOrderServer(String index, String endDate, Integer level, String areaLevel) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            long total = 0l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,defalutArea,level,ind,SaveModel.timeLevel_DDL,null,null,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, defalutArea, level, ind, SaveModel.timeLevel_DDL, null, null, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue() == 0 && StringUtils.isBlank(saveModel.getSlaveKey1())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())) {//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total+=saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total += saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+ind+"_total",total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+ind,jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + ind + "_total", total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + ind, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理端首页老人接入情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject olderBindingDeviceStatus(String area){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject olderBindingDeviceStatus(String area) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter = " not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("range",commonUtil.getRange(bindingCount,olderCount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("range", commonUtil.getRange(bindingCount, olderCount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理端安防监护新增分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsSecurityOlder( String endDate, String area, int level, String type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsSecurityOlder(String endDate, String area, int level, String type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String areaLevel = "4"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            areaLevel="4"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "46", SaveModel.timeLevel_DDL,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_"+46+"_total",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        areaLevel = "4"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "46", SaveModel.timeLevel_DDL, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_" + 46 + "_total", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //周/月 增量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String start = statisticsUtilService.calStart(endDate,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevel0(start, endDate, area, level, "46", SaveModel.timeLevel_ZL,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+46+"_add",saveModelAdd.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String start = statisticsUtilService.calStart(endDate, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevel0(start, endDate, area, level, "46", SaveModel.timeLevel_ZL, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + 46 + "_add", saveModelAdd.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray addDetail = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //周/月 增量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String start = statisticsUtilService.calStart(endDate,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String start = statisticsUtilService.calStart(endDate, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> saveModelAdds = elasticsearchUtil.findDateQuotaLevelList(start,endDate, area,level, "46", SaveModel.timeLevel_ZL, "3",null,null,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SaveModel saveModelTmp:saveModelAdds){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> saveModelAdds = elasticsearchUtil.findDateQuotaLevelList(start, endDate, area, level, "46", SaveModel.timeLevel_ZL, "3", null, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SaveModel saveModelTmp : saveModelAdds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveMode2 = elasticsearchUtil.findOneDateQuotaLevels(endDate,endDate, area,level, "46", SaveModel.timeLevel_DDL, "3",null,null,saveModelTmp.getSlaveKey3()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("total",saveMode2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModelTmp.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModelTmp.getSlaveKey3()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModelTmp.getSlaveKey3Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveMode2 = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, area, level, "46", SaveModel.timeLevel_DDL, "3", null, null, saveModelTmp.getSlaveKey3()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("total", saveMode2.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModelTmp.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModelTmp.getSlaveKey3()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModelTmp.getSlaveKey3Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addDetail.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_add_detail",addDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("index_add_detail", addDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  JSONObject deviceGrantAndService(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deviceGrantAndService() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter = " not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql =" select count(DISTINCT device_code) from wlyy_devices "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer deviceTotal  = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select count(DISTINCT device_code) from wlyy_devices "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer deviceTotal = jdbcTemplate.queryForObject(sql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql = " select count(DISTINCT wd.device_code) from wlyy_devices wd INNER JOIN wlyy_patient_device pd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ON pd.device_sn = wd.device_code AND pd.del=0 and pd.user "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer bindingCount  = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ON pd.device_sn = wd.device_code AND pd.del=0 and pd.user " + filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer bindingCount = jdbcTemplate.queryForObject(sql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("deviceTotal",deviceTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("bindingCount",bindingCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("range",commonUtil.getRange(bindingCount,deviceTotal)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceGrant",jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql =" SELECT sde.`value`,COUNT(d.id) count,GROUP_CONCAT(DISTINCT d.category_code SEPARATOR ',') AS category_code," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("deviceTotal", deviceTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("bindingCount", bindingCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("range", commonUtil.getRange(bindingCount, deviceTotal)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceGrant", jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql = " 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` "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> deviceService = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceService",deviceService); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> deviceService = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceService", deviceService); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getAllDeviceLostMessage(String area,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="select GROUP_CONCAT(id) id,type,title,sender,sender_name senderName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getAllDeviceLostMessage(String area, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page > 0 ? page - 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select GROUP_CONCAT(id) id,type,title,sender,sender_name senderName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "receiver,receiver_name receiverName,relation_code relationCode,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "data,is_read isRead,create_time createTime,sender_photo\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where type=43 and del=1 GROUP BY relation_code order by createTime desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(" select count(id) from ("+sql+")A ",Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql +=" limit "+page*size+","+size ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(" select count(id) from (" + sql + ")A ", Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " limit " + page * size + "," + size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功",list,page++,size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功", list, page++, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void delMessageRead(String msgId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(msgId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void delMessageRead(String msgId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(msgId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] ids = msgId.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (ids.length>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (ids.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDao.delMessage(ids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deviceUsingInfo(String area){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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 and user "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer use = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("use",use);//使用中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("putOnFile",total);//采购 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("stock",total-use);//库存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer total = jdbcTemplate.queryForObject(sql, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("use", use);//使用中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("putOnFile", total);//采购 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 and pd.user "+filter;//contact_status = 0   失联 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer lost = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "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);//物联率分母总数 设备总数(包括库存) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("lost",lost);//失联数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("notLost",use);//物联数  被人绑定了就是物联 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceAll2",use);//失联数分母总数  发出的设备数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("iotRange",commonUtil.getRange(use,total)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("LostRange",commonUtil.getRange(lost,use)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceAll", total);//物联率分母总数 设备总数(包括库存) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("lost", lost);//失联数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("notLost", use);//物联数  被人绑定了就是物联 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("deviceAll2", use);//失联数分母总数  发出的设备数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("iotRange", commonUtil.getRange(use, total)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("LostRange", commonUtil.getRange(lost, use)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getSecurityOrderList(String area,String status, String svrDesc,String topicItem, Integer page, Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            testPatients = " not in ('" + orgCodes + "') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>1?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page > 1 ? page - 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray result = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1380,189 +1390,200 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ord.doctor_name,ord.update_user,ord.update_user_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter+=" and ord.status='"+Integer.parseInt(status)+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " and ord.status='" + Integer.parseInt(status) + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(svrDesc)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter+=" and ord.serve_desc='"+svrDesc+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(svrDesc)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " and ord.serve_desc='" + svrDesc + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(topicItem)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter+=" and ord.topic_item='"+topicItem+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object>one:sqlResult){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> one : sqlResult) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject tmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientCode",one.get("patientCode")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientName",one.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("sex",one.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("photo",one.get("photo")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("idcard",one.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("number",one.get("number")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("id",one.get("orderId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("serveDesc",one.get("serve_desc")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date date = (Date)one.get("create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientCode", one.get("patientCode")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientName", one.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("sex", one.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("photo", one.get("photo")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("idcard", one.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("number", one.get("number")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("id", one.get("orderId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("serveDesc", one.get("serve_desc")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date date = (Date) one.get("create_time"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("createTime", DateUtil.dateToStrLong(date)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("status",one.get("status")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("doctor",one.get("doctor")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("doctorName",one.get("doctor_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientPhone",one.get("patient_phone")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("conclusionStatus",one.get("conclusion_status")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer conclusionStatus = Integer.valueOf(one.get("conclusion_status")==null?"0":(one.get("conclusion_status")+"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("status", one.get("status")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("doctor", one.get("doctor")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("doctorName", one.get("doctor_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientPhone", one.get("patient_phone")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("conclusionStatus", one.get("conclusion_status")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer conclusionStatus = Integer.valueOf(one.get("conclusion_status") == null ? "0" : (one.get("conclusion_status") + "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String conclusionStatusName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (conclusionStatus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 1:conclusionStatusName="待补录";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 2:conclusionStatusName="已登记";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (conclusionStatus) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 1: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    conclusionStatusName = "待补录"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 2: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    conclusionStatusName = "已登记"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("conclusionStatusName",conclusionStatusName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer statustemp = Integer.valueOf(one.get("status")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (-2==statustemp||-1==statustemp){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("doctor",one.get("update_user")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("doctorName",one.get("update_user_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("conclusionStatusName", conclusionStatusName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer statustemp = Integer.valueOf(one.get("status") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (-2 == statustemp || -1 == statustemp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("doctor", one.get("update_user")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("doctorName", one.get("update_user_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String statusName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (statustemp){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case -2:statusName="误警报";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case -1:statusName="已取消";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 0:statusName="已完成";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 1:statusName="预警中";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (statustemp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case -2: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    statusName = "误警报"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case -1: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    statusName = "已取消"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    statusName = "已完成"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 1: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    statusName = "预警中"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("statusName",statusName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer age  = IdCardUtil.getAgeForIdcard(tmp.getString("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("age",age); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("statusName", statusName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer age = IdCardUtil.getAgeForIdcard(tmp.getString("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("age", age); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //患者设备 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<DevicePatientDevice> devices = patientDeviceDao.findAllByUser(tmp.get("patientCode").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (devices.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("deviceFlag","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("deviceFlag","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (devices.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("deviceFlag", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("deviceFlag", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("success", result, page, pageSize, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getSecurityTab(String area,String status,String svrDesc,String topicItem){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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+"') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            testPatients = " not in ('" + orgCodes + "') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(area)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(area)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_-2",0);//误报警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_-1",0);//已取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_0",0);//已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_1",0);//预警中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_all",0);// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("svr_all",0);// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_-2", 0);//误报警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_-1", 0);//已取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_0", 0);//已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_1", 0);//预警中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("status_all", 0);// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("svr_all", 0);// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,String> serverTmp = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, String> serverTmp = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select py_code,dict_value from wlyy_hospital_sys_dict where dict_name='security_server_dict' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> servers = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> server:servers){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("svr_"+server.get("py_code").toString(),0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            serverTmp.put(server.get("dict_value").toString(),server.get("py_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> servers = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> server : servers) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("svr_" + server.get("py_code").toString(), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            serverTmp.put(server.get("dict_value").toString(), server.get("py_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql = "select ord.status,ord.serve_desc,count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fliter = "  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter+=" and ord.status='"+Integer.parseInt(status)+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " and ord.status='" + Integer.parseInt(status) + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(svrDesc)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter+=" and ord.serve_desc='"+svrDesc+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(svrDesc)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " and ord.serve_desc='" + svrDesc + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(topicItem)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter+=" and ord.topic_item='"+topicItem+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang3.StringUtils.isNotBlank(topicItem)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " and ord.topic_item='" + topicItem + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        fliter +=" and ord.patient "+testPatients; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        fliter += " and ord.patient " + testPatients; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        fliter+=" group by ord.status,ord.serve_desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        fliter += " group by ord.status,ord.serve_desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> sqlResult = jdbcTemplate.queryForList(sql + fliter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String pyCode = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:sqlResult){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_"+map.get("status"),result.getInteger("status_"+map.get("status"))+Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            pyCode =  serverTmp.get(map.get("serve_desc"))==null?null:serverTmp.get(map.get("serve_desc")).toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (org.apache.commons.lang3.StringUtils.isNotBlank(pyCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("svr_"+pyCode,result.getInteger("svr_"+pyCode)+Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("status_all",result.getInteger("status_all")+Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("svr_all",result.getInteger("svr_all")+Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : sqlResult) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_" + map.get("status"), result.getInteger("status_" + map.get("status")) + Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            pyCode = serverTmp.get(map.get("serve_desc")) == null ? null : serverTmp.get(map.get("serve_desc")).toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (org.apache.commons.lang3.StringUtils.isNotBlank(pyCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("svr_" + pyCode, result.getInteger("svr_" + pyCode) + Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("status_all", result.getInteger("status_all") + Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("svr_all", result.getInteger("svr_all") + Integer.parseInt(map.get("count").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsSecurityWarnInfo(String endDate,String area,Integer level,String index) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject statisticsSecurityWarnInfo(String endDate, String area, Integer level, String index) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(String ind:indexes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String areaLevel="6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select area_level from wlyy_job_config_new where id='"+ind+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<String> areaLevels = jdbcTemplate.queryForList(sql,String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (areaLevels.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String ind : indexes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String areaLevel = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select area_level from wlyy_job_config_new where id='" + ind + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<String> areaLevels = jdbcTemplate.queryForList(sql, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (areaLevels.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                areaLevel = areaLevels.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            long total = 0l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,ind,SaveModel.timeLevel_DDL,null,null,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, ind, SaveModel.timeLevel_DDL, null, null, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue() == 0 && StringUtils.isBlank(saveModel.getSlaveKey1())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total+=saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total += saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+ind+"_total",total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+ind,jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("46".equals(ind)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + ind + "_total", total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_" + ind, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("46".equals(ind)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //安防响应 误报警+完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,area,level,"46","2","-2",areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate, area, level, "46", "2", "-2", areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                long finish = saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,area,level,"46","2","0",areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate, area, level, "46", "2", "0", areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                finish += saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_"+46+"_finish",finish); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_" + 46 + "_finish", finish); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //安防误报警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,area,level,"46","2","-2",areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_"+46+"_error",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate, area, level, "46", "2", "-2", areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("index_" + 46 + "_error", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //误报警率分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray statisticsSecurityTrend(String startDate,String endDate,String area,Integer level,String index) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray statisticsSecurityTrend(String startDate, String endDate, String area, Integer level, String index) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //安防总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(startDate,endDate,area,level,index,SaveModel.timeLevel_DDL,SaveModel.interval_day,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL, SaveModel.interval_day, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (SaveModel tmp:saveModels){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (SaveModel tmp : saveModels) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jsonTmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonTmp.put("count",tmp.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonTmp.put("timeDay",DateUtil.dateToStr(tmp.getQuotaDate(),DateUtil.YYYY_MM_DD)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonTmp.put("time",DateUtil.dateToStr(tmp.getQuotaDate(),DateUtil.yyyy_MM_dd_HH_mm_ss)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonTmp.put("count", tmp.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonTmp.put("timeDay", DateUtil.dateToStr(tmp.getQuotaDate(), DateUtil.YYYY_MM_DD)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonTmp.put("time", DateUtil.dateToStr(tmp.getQuotaDate(), DateUtil.yyyy_MM_dd_HH_mm_ss)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jsonTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jsonArray; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1570,221 +1591,257 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 计算开始时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 1周,2月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type    1周,2月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String calStart(String endDate,int type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isEmpty(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String calStart(String endDate, int type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(endDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return endDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cal.setTime(DateUtil.strToDate(endDate)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(1==type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                cal.add(Calendar.DAY_OF_WEEK,-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (1 == type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                cal.add(Calendar.DAY_OF_WEEK, -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cal.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cal.set(Calendar.DAY_OF_MONTH,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cal.set(Calendar.DAY_OF_MONTH, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return DateUtil.dateToStrShort(cal.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List searchBySql(String sql){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (sql.startsWith("select")||sql.startsWith("SELECT")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List searchBySql(String sql) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (sql.startsWith("select") || sql.startsWith("SELECT")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return elasticsearchUtil.searchBySql(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param esSql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonStr 修改数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public boolean esDataModify(String esSql,String jsonStr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public boolean esDataModify(String esSql, String jsonStr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.containsIgnoreCase(esSql,"limit")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.containsIgnoreCase(esSql, "limit")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean flag=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> objs = elasticsearchUtil.excute(esSql,SaveModel.class,"",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> sourceMap = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int i=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SaveModel tmp:objs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> objs = elasticsearchUtil.excute(esSql, SaveModel.class, "", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> sourceMap = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int i = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SaveModel tmp : objs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String jsonStr1 = JSON.toJSONString(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String,Object> tmpInfo = com.alibaba.fastjson.JSONObject.parseObject(jsonStr1,Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(jsonStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Map<String,Object> modifyInfo = com.alibaba.fastjson.JSONObject.parseObject(jsonStr,Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (String key:modifyInfo.keySet()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> tmpInfo = com.alibaba.fastjson.JSONObject.parseObject(jsonStr1, Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(jsonStr)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Map<String, Object> modifyInfo = com.alibaba.fastjson.JSONObject.parseObject(jsonStr, Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (String key : modifyInfo.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        tmpInfo.put(key, modifyInfo.get(key)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sourceMap.add(tmpInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (i>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                flag = elasticSearchHelper.updateByMap(esIndex,esIndex,sourceMap);//修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (i > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                flag = elasticSearchHelper.updateByMap(esIndex, esIndex, sourceMap);//修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /*大屏 老人云照护 病人分析 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject patientAnalysisDP(String endDate, String area, int level,String index) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject patientAnalysisDP(String endDate, String area, int level, String index) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String areaLevel = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("42".equals(index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("42".equals(index)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            areaLevel = "4"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //新生儿 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //是否入学 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> statusList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL,null,null,areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> statusList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, null, null, areaLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray statusArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<statusList.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < statusList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = statusList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statusArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("statusList",statusArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("statusList", statusArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //能力评估 从签约时服务标签取 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("levelList",cloudCareForTheElderly(null,null,null)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("levelList", cloudCareForTheElderly(null, null, null)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //居民健康标签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"47",SaveModel.timeLevel_DDL,null,null,"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "47", SaveModel.timeLevel_DDL, null, null, "2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray labelArr = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long total = 0l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (saveModel.getResult2().longValue() == 0 && StringUtils.isBlank(saveModel.getSlaveKey1())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())) {//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total+=saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total += saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                labelArr.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject arrTmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelTotal",total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelList",labelArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("patientLabelStatistic",arrTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelTotal", total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            arrTmp.put("patientLabelList", labelArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("patientLabelStatistic", arrTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //年龄分布 50 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL,null,null,"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel>  ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"50",SaveModel.timeLevel_DDL,null,null,"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL, null, null, "2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray ageArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<ageList.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < ageList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = ageList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(saveModel.getSlaveKey1())) {//去除60岁以下老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ageArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("ageList",ageArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("ageList", ageArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //居住小区分布 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter = " not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String  sql = "select count(id) total,residential_area residentialArea  from base_patient where del=1 and id "+filter+"  and archive_type=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "select count(id) total,residential_area residentialArea  from base_patient where del=1 and id " + filter + "  and archive_type=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "GROUP BY residential_area ORDER BY total desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> result = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Iterator<Map<String, Object>> iterator = result.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> tmp = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (iterator.hasNext()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (iterator.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp = iterator.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null==tmp.get("residentialArea")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null == tmp.get("residentialArea")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    iterator.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("residentialArea",result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("residentialArea", result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //性别分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String archiType=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("42".equals(index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType="2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String archiType = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("42".equals(index)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType = "2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("37".equals(index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType="1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("37".equals(index)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            archiType = "1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate,defalutArea, level, "51",SaveModel.timeLevel_DDL,null,archiType,null,null,"2","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate, defalutArea, level, "51", SaveModel.timeLevel_DDL, null, archiType, null, null, "2", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray sexArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;i<sexList.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < sexList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SaveModel saveModel = sexList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num",saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", saveModel.getResult2().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", saveModel.getSlaveKey1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", saveModel.getSlaveKey1Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sexArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("sexList",sexArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("sexList", sexArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /*大屏 老人云照护 评估*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray cloudCareForTheElderly(String endDate, String area, Integer level) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray cloudCareForTheElderly(String endDate, String area, Integer level) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //评估类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 lab.patient not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(orgCodes)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orgCodes = orgCodes.replaceAll(",", "','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter = " and lab.patient not in ('" + orgCodes + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select dict.dict_code,dict_value,count(DISTINCT A.patient) total from wlyy_hospital_sys_dict dict \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN (select distinct lab.patient,lab.label_code from  wlyy_patient_label lab  INNER JOIN base_patient p on p.id = lab.patient AND  lab.label_type='3' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter+"   \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter + "   \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")A on dict.dict_code = A.label_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where  dict.dict_name='older_label'  and  dict.dict_code is not null and dict_code <= 7  \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " GROUP BY dict.dict_code; "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String older = " select count(distinct lab.patient) from  wlyy_patient_label lab  INNER JOIN base_patient p on p.id = lab.patient AND  lab.label_type='1' "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(older,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String older = " select count(distinct lab.patient) from  wlyy_patient_label lab  INNER JOIN base_patient p on p.id = lab.patient AND  lab.label_type='1' " + filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(older, Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DecimalFormat df = new DecimalFormat("0.00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", df.format((Integer.parseInt(map.get("total").toString())*1.00) / count * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("rate", df.format((Integer.parseInt(map.get("total").toString()) * 1.00) / count * 100)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("num", map.get("total")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code",map.get("dict_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",map.get("dict_value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("code", map.get("dict_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name", map.get("dict_value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jsonArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //新生儿 回复  为回复率  总咨询 及时回复率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject newBornReply(String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String index = "28,29,30"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] split = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String ind : split) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            long total = 0l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, "330100", 2, ind, SaveModel.timeLevel_DDL, null, null, "2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total+=saveModel.getResult2().longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("index_"+ind,total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long index_28 = (Long) res.get("index_28"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long index_29 = (Long) res.get("index_29"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long index_30 = (Long) res.get("index_30"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DecimalFormat df=new DecimalFormat("0.00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (index_28!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (index_29!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("noReply",df.format((float) index_29/index_28*100)+"%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("noReply","0.00%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (index_30!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("reply",df.format((float) index_30/index_28*100 )+"%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("reply","0.00%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("reply","0.00%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put("noReply","0.00%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //新生儿上门辅导 类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |