|  | @ -81,6 +81,66 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |         return res;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject serviceResources(){
 | 
	
		
			
				|  |  | //        String sql = "SELECT type , COUNT(1) count FROM base_org WHERE del = 1 GROUP BY type";
 | 
	
		
			
				|  |  | //        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |         String medicalInstitutionSql = "SELECT COUNT(1) FROM base_org WHERE (type = 1 OR type = 2) AND del = 1;";
 | 
	
		
			
				|  |  |         String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1";
 | 
	
		
			
				|  |  |         String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1";
 | 
	
		
			
				|  |  |         String doctorSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 1";
 | 
	
		
			
				|  |  |         String helperSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 2";
 | 
	
		
			
				|  |  |         String teacherSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 3";
 | 
	
		
			
				|  |  |         Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer doctorNum = jdbcTemplate.queryForObject(doctorSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer helperNum = jdbcTemplate.queryForObject(helperSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer teacherNum = jdbcTemplate.queryForObject(teacherSql,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;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     // v0.7.0实时数据 照护对象、检测设备、紧急救助
 | 
	
		
			
				|  |  |     public JSONObject realTimeDataNew() throws Exception {
 | 
	
		
			
				|  |  |         JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |         Integer olderTotal = 0;
 | 
	
		
			
				|  |  |         Integer childTotal = 0;
 | 
	
		
			
				|  |  |         String sql1 = "SELECT COUNT(*) c,archive_type from base_patient WHERE archive_type is  not null and del='1' GROUP BY archive_type";
 | 
	
		
			
				|  |  |         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)){
 | 
	
		
			
				|  |  |                 olderTotal = num;
 | 
	
		
			
				|  |  |                 continue;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             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);
 | 
	
		
			
				|  |  |         String securityEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND category_code > 2";
 | 
	
		
			
				|  |  |         Integer securityEquipmentNum = jdbcTemplate.queryForObject(securityEquipmentSql,Integer.class);
 | 
	
		
			
				|  |  |         String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0";
 | 
	
		
			
				|  |  |         Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
 | 
	
		
			
				|  |  |         String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order";
 | 
	
		
			
				|  |  |         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;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 服务排名分析
 | 
	
		
			
				|  |  |      * @param endDate
 |