| 
					
				 | 
			
			
				@ -11,6 +11,7 @@ import com.yihu.iot.datainput.util.ConstantUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.common.ElasticSearchQueryGenerator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.dict.IotSystemDictService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.useragent.UserAgent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.util.excel.HibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.device.LocationDataDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.iot.device.IotDeviceDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -30,6 +31,7 @@ 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; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -65,6 +67,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private UserAgent userAgent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private IotCompanyDao iotCompanyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HibenateUtils hibernateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新增 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -257,6 +261,35 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JestResult esResult = elasticSearchHelper.search(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,queryStr.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return getESResultBeanList(esResult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<LocationDataVO> addNameAndCodeToList(List<LocationDataVO> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(null!=list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (LocationDataVO locationDataVO:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sql = "select t.code as \"code\",t.name as \"name\" from wlyy.wlyy_patient t where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sqlEqt="select t.device_name as\"device_name\" from device.wlyy_devices t where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String idCard = locationDataVO.getIdCard(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String snCoed = locationDataVO.getDeviceSn(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotEmpty(idCard)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql = sql +" and t.idcard = '"+idCard+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }if (StringUtils.isNotEmpty(snCoed)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Map<String,Object>> nameList = hibernateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Map<String,Object>> deviceList = hibernateUtils.createSQLQuery(sqlEqt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(nameList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String name = null==nameList.get(0).get("name")?"":nameList.get(0).get("name").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    locationDataVO.setCode(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    locationDataVO.setName(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (deviceList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String equipmentName = null==deviceList.get(0).get("device_name")?"":deviceList.get(0).get("device_name").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    locationDataVO.setEquimentName(equipmentName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 根据设备SN码查询设备地址 
			 |