| 
					
				 | 
			
			
				@ -9,6 +9,7 @@ import com.yihu.iot.dao.device.IotDeviceSimDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.dao.device.IotPatientDeviceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.datainput.util.ConstantUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.common.ElasticSearchQueryGenerator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.common.OrgUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.dict.IotSystemDictService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.useragent.UserAgent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.util.excel.HibenateUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -31,7 +32,6 @@ import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.Pageable; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.jpa.provider.HibernateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -69,6 +69,9 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private IotCompanyDao iotCompanyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HibenateUtils hibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OrgUserService orgUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新增 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -524,7 +527,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotPatientDeviceVO,IotPatientDeviceVO> getPatientDeviceList(String deviceSn, String deviceName, String categoryCode, String patientName, String hospitalName, Integer isDel, Integer page, Integer pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotPatientDeviceVO,IotPatientDeviceVO> getPatientDeviceList(String deviceSn, String deviceName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String categoryCode, String patientName, String hospitalName, Integer isDel, Integer page, Integer pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT DISTINCT d.* FROM `iot_patient_device` d  where 1=1  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(isDel != null &&isDel == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += "and d.del != 1 "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -544,6 +548,11 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(hospitalName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += "and d.hospital_name like '%" + hospitalName + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<String> list = orgUserService.getUserOrgById(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!list.contains(userAgent.commonHospital)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.hospital in ("+orgUserService.getUserOrg(list)+") "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += "order by d.update_time desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断是否需要分页 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (page != null && pageSize != null) { 
			 |