| 
					
				 | 
			
			
				@ -388,7 +388,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return page; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String , Object>> findDeviceFromAdmin(String patientName, int page, int pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String , Object>> findDeviceFromAdmin(String doctor,String patientName, int page, int pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select Distinct p.id,p.`name`,dd.photo,pd.device_id deviceId,pd.category_code categoryCode,pd.device_name deviceName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " pd.device_sn deviceSn,pd.czrq,pd.doctor,pd.doctor_name doctorName,pd.agent,pd.agent_name agentName " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from wlyy_patient_device pd,wlyy_devices wd,base_patient p,dm_device dd where p.id = pd.`user`  and pd.del = 0 " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -396,6 +396,12 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patientName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND (p.`name` LIKE '%" + patientName +"%' or  p.idcard LIKE '%" + patientName + "%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(doctor)){//著老远查看时之查看签约居民的绑定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_team_member m " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE sr.patient = p.id and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " and m.doctor_code = '"+doctor+"' and m.del = '1') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " ORDER BY pd.czrq DESC LIMIT "+ (page-1)*pageSize +" , " + pageSize + " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 |