| 
					
				 | 
			
			
				@ -206,13 +206,13 @@ public class WlyygcStatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        statusMap.put("0","已完成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        statusMap.put("1","申请中"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT * from ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "select o.id,p.name,p.idcard,p.residential_area,'1' type,o.serve_address,'紧急呼叫' serve_desc,o.status,o.create_time  FROM  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' orderType,'1' type,o.serve_address,'紧急呼叫' serve_desc,o.status,o.create_time  FROM  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_patient p INNER JOIN base_service_package_sign_record sr on p.id = sr.patient and sr.`status`=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ", base_service_package_record r, base_emergency_assistance_order o    " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE p.del = 1 and p.archive_type =1 and r.patient = p.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and p.id = o.patient " + filter + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "UNION ALL " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "select o.id,p.name,p.idcard,p.residential_area,'2' type,o.serve_address,o.serve_desc,o.status,o.create_time FROM  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' orderType,'2' type,o.serve_address,o.serve_desc,o.status,o.create_time FROM  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_patient p INNER JOIN base_service_package_sign_record sr on p.id = sr.patient and sr.`status`=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ", base_service_package_record r, base_security_monitoring_order o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE p.del = 1 and p.archive_type =1 and r.patient = p.id " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -243,6 +243,9 @@ public class WlyygcStatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> res = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map : res){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("id",map.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("patient",map.get("patient")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("orderType",map.get("orderType")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("name",map.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard")+"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("residentialArea",map.get("residential_area")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -271,7 +274,7 @@ public class WlyygcStatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (size == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            size = 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT DISTINCT p.`name`, p.mobile, p.idcard,(CASE WHEN p.sex = 1 THEN  '男' ELSE '女' END ) AS sex,p.address, TIMESTAMPDIFF(YEAR, p.birthday, CURDATE()) years,p.residential_area AS residentialArea" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT DISTINCT p.id,p.`name`, p.mobile, p.idcard,(CASE WHEN p.sex = 1 THEN  '男' ELSE '女' END ) AS sex,p.address, TIMESTAMPDIFF(YEAR, p.birthday, CURDATE()) years,p.residential_area AS residentialArea" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM base_patient p INNER JOIN base_service_package_sign_record br ON p.id = br.patient, base_service_package_record r" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE p.del = 1 AND br.`status` = 1 AND p.archive_type = 1 AND r.patient = p.id "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "SELECT count(DISTINCT p.id) " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -361,9 +364,10 @@ public class WlyygcStatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return PageEnvelop.getSuccess("查询成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deviceSql = "SELECT DISTINCT" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deviceSql = "SELECT DISTINCT p.id patient,pd.device_sn sn," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " pd.device_name as deviceName," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "pd.device_type as deviceType," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "pd.category_code type," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "IFNULL(wd.collect_num,0) as collectNum " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_patient p " + 
			 |