|  | @ -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;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 新增
 | 
	
	
		
			
				|  | @ -296,18 +299,12 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
 | 
	
		
			
				|  |  |                 String snCoed = locationDataVO.getDeviceSn();
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> nameList = new ArrayList<>();
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> deviceList = new ArrayList<>();
 | 
	
		
			
				|  |  |                 System.out.println("idCard:="+idCard);
 | 
	
		
			
				|  |  |                 System.out.println("snCode:="+snCoed);
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotEmpty(idCard)){
 | 
	
		
			
				|  |  |                     sql = sql +" and t.idcard = '"+idCard+"'";
 | 
	
		
			
				|  |  |                     System.out.println("查询患者name和code开始");
 | 
	
		
			
				|  |  |                     nameList = jdbcTempalte.queryForList(sql);
 | 
	
		
			
				|  |  |                     System.out.println("查询患者name和code结束:"+nameList);
 | 
	
		
			
				|  |  |                 }if (StringUtils.isNotEmpty(snCoed)){
 | 
	
		
			
				|  |  |                     sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
 | 
	
		
			
				|  |  |                     System.out.println("查询设备名称开始");
 | 
	
		
			
				|  |  |                     deviceList = jdbcTempalte.queryForList(sqlEqt);
 | 
	
		
			
				|  |  |                     System.out.println("查询设备名称结束:"+deviceList);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if(nameList.size()>0){
 | 
	
		
			
				|  |  |                     String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
 | 
	
	
		
			
				|  | @ -530,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 ";
 | 
	
	
		
			
				|  | @ -550,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) {
 |