| 
					
				 | 
			
			
				@ -177,9 +177,9 @@ public class BirthdayWishesService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "p.idcard, p.photo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END date " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_service_package pack, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_service_package_item i,base_team_member m " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id and r.service_package_id = pack.id  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and i.del = 1 and m.team_code = r.team_code and m.doctor_code = '"+doctor+"' ) "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and (p.archive_status<>2 or p.archive_status is null) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "' " ; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -258,9 +258,9 @@ public class BirthdayWishesService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "SELECT count(distinct p.idcard) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String whereSql = "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_service_package pack , " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_service_package_item i,base_team_member m " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id and and r.service_package_id = pack.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and i.del = 1 and m.team_code = r.team_code "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //根据权限获取生日居民列表 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -269,19 +269,19 @@ public class BirthdayWishesService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else {//管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (currentUserRoleLevel) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case "1": {//省 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and i.org_code in ( select org.code from base_org org where org.province_code = '"+currentUserRole+"' and org.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and pack.org_code in ( select org.code from base_org org where org.province_code = '"+currentUserRole+"' and org.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case "2": {//市 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and i.org_code in ( select org.code from base_org org where org.city_code = '"+currentUserRole+"' and org.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and pack.org_code in ( select org.code from base_org org where org.city_code = '"+currentUserRole+"' and org.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case "3": {//区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and i.org_code in ( select org.code from base_org org where org.town_code = '"+currentUserRole+"' and org.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and pack.org_code in ( select org.code from base_org org where org.town_code = '"+currentUserRole+"' and org.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case "4": {//社区机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and i.org_code = '" + currentUserRole + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    whereSql += " and pack.org_code = '" + currentUserRole + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 |