|  | @ -1,5 +1,6 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.care.endpoint.third.device;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.aop.ObserverRequired;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.device.PatientDeviceDao;
 | 
	
	
		
			
				|  | @ -7,6 +8,7 @@ import com.yihu.jw.care.endpoint.BaseController;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.device.DeviceDetailService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.device.PatientDeviceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.device.PatientHealthIndexService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.device.YsDeviceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
	
		
			
				|  | @ -15,7 +17,6 @@ import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.json.JSONObject;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
		
			
				|  |  | import java.util.HashMap;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
	
		
			
				|  | @ -43,6 +45,8 @@ public class PDeviceController extends BaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientDeviceService patientDeviceService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YsDeviceService ysDeviceService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @ApiOperation("获取居民的设备任务信息")
 | 
	
	
		
			
				|  | @ -135,4 +139,51 @@ public class PDeviceController extends BaseController {
 | 
	
		
			
				|  |  |             return error(-1,"安全区域设置失败");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @ApiOperation("设备云台控制开始")//操作后都需要调用停止接口 才会停止转动
 | 
	
		
			
				|  |  |     @RequestMapping(value = "ptzStart", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
 | 
	
		
			
				|  |  |     public String ptzStart(
 | 
	
		
			
				|  |  |             @ApiParam(name="deviceSerial",required = true,value="设备序列号")
 | 
	
		
			
				|  |  |             @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
 | 
	
		
			
				|  |  |             @ApiParam(name="channelNo",required = true,value="通道号,IPC设备填1")
 | 
	
		
			
				|  |  |             @RequestParam(value = "channelNo",required = true) Integer channelNo,
 | 
	
		
			
				|  |  |             @ApiParam(name="direction",required = true,value="0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距")
 | 
	
		
			
				|  |  |             @RequestParam(value = "direction",required = true) Integer direction,
 | 
	
		
			
				|  |  |             @ApiParam(name="speed",required = true,value="云台速度:0-慢,1-适中,2-快,海康设备参数不可为0")
 | 
	
		
			
				|  |  |             @RequestParam(value = "speed",required = true) Integer speed,
 | 
	
		
			
				|  |  |             HttpServletRequest request){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject result = ysDeviceService.ptzStart(deviceSerial,channelNo,direction,speed,request);
 | 
	
		
			
				|  |  |             if ("200".equals(result.getString("code"))){
 | 
	
		
			
				|  |  |                 return write(200,"查询成功","data",result);
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 return write(-1,result.getString("msg"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             return errorResult(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @ApiOperation("设备云台控制结束")
 | 
	
		
			
				|  |  |     @RequestMapping(value = "ptzStop", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
 | 
	
		
			
				|  |  |     public String ptzStop(
 | 
	
		
			
				|  |  |             @ApiParam(name="deviceSerial",required = true,value="设备序列号")
 | 
	
		
			
				|  |  |             @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
 | 
	
		
			
				|  |  |             @ApiParam(name="channelNo",required = true,value="通道号,IPC设备填1")
 | 
	
		
			
				|  |  |             @RequestParam(value = "channelNo",required = true) Integer channelNo,
 | 
	
		
			
				|  |  |             @ApiParam(name="direction",required = true,value="0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距")
 | 
	
		
			
				|  |  |             @RequestParam(value = "direction",required = true) Integer direction,
 | 
	
		
			
				|  |  |             HttpServletRequest request){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject result = ysDeviceService.ptzStop(deviceSerial,channelNo,direction,request);
 | 
	
		
			
				|  |  |             if ("200".equals(result.getString("code"))){
 | 
	
		
			
				|  |  |                 return write(200,"查询成功","data",result);
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 return write(-1,result.getString("msg"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             return errorResult(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |