|  | @ -13,13 +13,18 @@ import com.yihu.jw.entity.care.device.DeviceDetail;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.http.HttpClientUtil;
 | 
	
		
			
				|  |  | import com.yihu.mysql.query.BaseJpaService;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.apache.http.NameValuePair;
 | 
	
		
			
				|  |  | import org.apache.http.message.BasicNameValuePair;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.ArrayList;
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -43,6 +48,10 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
 | 
	
		
			
				|  |  | 	private PatientDeviceDao patientDeviceDao;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private HttpClientUtil httpClientUtil;
 | 
	
		
			
				|  |  | 	@Value("${cloudCare.url}")
 | 
	
		
			
				|  |  | 	private String cloudDeviceUrl;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	/**
 | 
	
	
		
			
				|  | @ -182,4 +191,22 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
 | 
	
		
			
				|  |  | 	public DeviceDetail findByDeviceSn(String deviceSn){
 | 
	
		
			
				|  |  | 		return deviceDetailDao.findBySn(deviceSn);
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	 * 注册设备,通过iot项目进行数据推送
 | 
	
		
			
				|  |  | 	 * @return
 | 
	
		
			
				|  |  | 	 */
 | 
	
		
			
				|  |  | 	public void registerToWlyy(DevicePatientDevice device){
 | 
	
		
			
				|  |  | 		//判断设备类型
 | 
	
		
			
				|  |  | 		Device deviceDO = deviceDao.findOne(device.getDeviceId());
 | 
	
		
			
				|  |  | 		if (1==deviceDO.getNeedRegister()){
 | 
	
		
			
				|  |  | 			// 设备注册至iot后 通过iot将设备数据转发
 | 
	
		
			
				|  |  | 			String url = "http://www.cityihealth.com:43210/deviceManage/register";
 | 
	
		
			
				|  |  | 			List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  | 			params.add(new BasicNameValuePair("deviceSN", device.getDeviceSn()));
 | 
	
		
			
				|  |  | 			params.add(new BasicNameValuePair("pushAddress", cloudDeviceUrl));
 | 
	
		
			
				|  |  | 			String response = httpClientUtil.post(url, params,"UTF-8");
 | 
	
		
			
				|  |  | 			//注册日志
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | }
 |