| 
					
				 | 
			
			
				@ -979,12 +979,21 @@ public class WlyygcStatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orgCodes = orgCodes.replaceAll(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                filter = " and a.id not in ('"+orgCodes+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "SELECT count(a.id) from base_patient a  WHERE a.archive_type = 1 and a.del = '1' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           /* sql = "SELECT count(a.id) from base_patient a  WHERE a.archive_type = 1 and a.del = '1' AND a.sign_status = 1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and EXISTS ( select 1 from " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8)  = a.id and r.team_code='"+teamId+"' ) "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count =  jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "SELECT count( DISTINCT a.id ) FROM base_patient a LEFT JOIN  base_service_package_record pr ON pr.patient = a.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " LEFT JOIN base_service_package_sign_record sr ON sr.id = pr.sign_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " a.archive_type = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND a.del = '1' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND a.sign_status = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND pr.team_code = '"+teamId+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND sr.`status` = 1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count =  jdbcTemplate.queryForObject(sql+filter,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("oldTotal",count);//照护老人数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  teamList; 
			 |