Prechádzať zdrojové kódy

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 rokov pred
rodič
commit
6282329044

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java

@ -21,7 +21,7 @@ public class DevicePatientDevice extends IdEntity {
    private String deviceName;
    // 用户code
    private String user;
    // 设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器
    // 设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器,12 监控器
    private String categoryCode;
    // 用户类型标准 -1代表单用户
    private String userType;

+ 9 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java

@ -33,6 +33,7 @@ public class EmergencyOrderVO {
    private Integer emergencyCancel;//紧急预警工单误报警原因 字典emergency_cancel
    private String emergencyCancelName;
    private Date updateTime;
    private String sceneImg;//工单发起是现场照片
@ -240,4 +241,12 @@ public class EmergencyOrderVO {
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getSceneImg() {
        return sceneImg;
    }
    public void setSceneImg(String sceneImg) {
        this.sceneImg = sceneImg;
    }
}

+ 28 - 15
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/YsConfig.java

@ -25,7 +25,7 @@ public class YsConfig {
    //获取通道列表
    public static final String surveillanceWayList =baseUrl+ "/api/resource/open-app/surveillance/camera/list/page";
    //获取通道信息(通道默认为1)
    //获取通道信息(通道默认为1,如果视频加密需要调用视频解密接口进行解密)
    public static final String surveillanceWay =baseUrl+ "/api/resource/open-app/surveillance/camera/info";
    //设备抓拍
@ -50,20 +50,33 @@ public class YsConfig {
     * 录像相关
     */
    //获取录像accessKey、上传录像地址
    public static final String videoKey = baseUrl +"/seastart/vod/token";
    //上传录像上传地址通过videoKey接口获取
    public static final String videoUpload = "https://seastart.ss.bscstorage.com";
    //录像列表
    public static final String videoList = baseUrl +"/seastart/vod/list";
    //批量获取录像详情
    public static final String videoDetailList = baseUrl +"/seastart/vod";
    //录像详情
    public static final String videoDetail = baseUrl +"/seastart/vod/get";
    //录像循环覆盖开关(开启后,当内存卡存储满时会覆盖原有录像,不会导致停止录像)
    public static final String coverVideoSwitch = baseUrl + "/seastart/auth/set-vod";
    //获取设备录像存储信息
    public static final String deviceVideoTimeList = iotBaseUrl + "/api/lapp/video/by/time";
    //根据时间获取录像地址//仅rtmp格式
    public static final String deviceVideoUrlByTime = iotBaseUrl + "/api/lapp/v2/live/address/get";
    //录像地址 多格式
    public static final String videoList2 = iotBaseUrl +"/api/lapp/v2/live/address/get";
//    //获取录像accessKey、上传录像地址
//    public static final String videoKey = baseUrl +"/seastart/vod/token";
//
//    //上传录像上传地址通过videoKey接口获取
//    public static final String videoUpload = "https://seastart.ss.bscstorage.com";
//
//    //录像列表
//    public static final String videoList = baseUrl +"/seastart/vod/list";
//
//    //批量获取录像详情
//    public static final String videoDetailList = baseUrl +"/seastart/vod";
//
//    //录像详情
//    public static final String videoDetail = baseUrl +"/seastart/vod/get";
//
    public static final String redisKey = "ysAssesToken";

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientDeviceDao.java

@ -58,5 +58,6 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<DevicePatie
    @Query("select a from DevicePatientDevice a where a.user=?1 and a.del=0")
    List<DevicePatientDevice> findAllByUser(String user);
    @Query("select a from DevicePatientDevice a where a.user=?1 and a.categoryCode =?2 and a.del=0")
    List<DevicePatientDevice> findByUserAndCategoryCode(String user,String categoryCode);
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -345,4 +345,15 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("修改失败");
        }
    }
    @GetMapping(value = "getMonitorUrl")
    @ApiOperation(value = "获取监控录像地址")
    public ObjEnvelop getMonitorUrl(@ApiParam(name="patient")@RequestParam(value = "patient")String patient){
        try {
            return null;
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("获取失败");
        }
    }
}

+ 195 - 62
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/YsDeviceController.java

@ -1,18 +1,20 @@
package com.yihu.jw.care.endpoint.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.sun.corba.se.spi.orb.StringPair;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import netscape.javascript.JSObject;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
@ -44,15 +46,18 @@ public class YsDeviceController extends BaseController {
            @RequestParam(value = "isTrust",required = false,defaultValue = "0") Integer isTrust,
            HttpServletRequest request) {
        try {
            return write(200,"查询成功","data",ysDeviceService.surveillanceWay(deviceSerial,channelNo,isTrust,request));
            JSONObject result = ysDeviceService.surveillanceWay(deviceSerial,channelNo,isTrust,request);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return write(200,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("跌倒检测")
    @ApiOperation("跌倒检测--未使用")
    @RequestMapping(value = "deviceFailConfig", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String surveillanceWayAddress(
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
@ -111,14 +116,21 @@ public class YsDeviceController extends BaseController {
    @ApiOperation("设备有效直播地址")
    @RequestMapping(value = "getDeviceLiveAddress", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String getDeviceLiveAddress(
            @ApiParam(name="patient")@RequestParam(value = "patient",required = false)String patient,
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @RequestParam(value = "deviceSerial",required = false) String deviceSerial,
            @ApiParam(name="channelNo",required = true,value="通道号,IPC设备填1")
            @RequestParam(value = "channelNo",required = true,defaultValue = "1") Integer channelNo,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.getDeviceLiveAddress(deviceSerial,channelNo,request));
            if (StringUtils.isBlank(patient)&&StringUtils.isBlank(deviceSerial)){
                return error(-1,"参数错误");
            }
            JSONObject result = ysDeviceService.getDeviceLiveAddress(patient,deviceSerial,channelNo,request);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
@ -166,86 +178,207 @@ public class YsDeviceController extends BaseController {
        }
    }
    @ApiOperation("获取上传录像授权信息")
    @RequestMapping(value = "getVideoKey", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String getVideoKey(
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.getVideoKey(request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("查询录像列表(无法区分用户)")
    @RequestMapping(value = "videoList", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String videoList(
            @ApiParam(name="name",required = false,value="录像名称,支持模糊搜索")
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name="type",required = false,value="视频类型 默认查询全部视频/录像,type=playback,表示查询直播暂存(录像);type=vod,表示查询上传、剪辑、合并视频。")
            @RequestParam(value = "type",required = false) String type,
            @ApiParam(name="page",required = false,value="page")
            @RequestParam(value = "page",required = false,defaultValue = "1") int page,
            @ApiParam(name="count",required = false,value=",默认为 20")
            @RequestParam(value = "count",required = false,defaultValue = "20") int count,
    @ApiOperation("设备录像循环覆盖开关")
    @RequestMapping(value = "coverVideoSwitch", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String coverVideoSwitch(
            @ApiParam(name="is_vod_cover",required = true,value="is_vod_cove=1,表示开启;is_vod_cove=0,表示关闭")
            @RequestParam(value = "is_vod_cover",required = true) String is_vod_cover,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.videoList(name,type,page,count));
            return write(200,"查询成功","data",ysDeviceService.coverVideoSwitch(is_vod_cover,request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("批量获取录像详情")
    @RequestMapping(value = "videoDetailList", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String videoDetailList(
            @ApiParam(name = "vod_ids",value="录像id",required = true)
            @RequestParam(value="vod_ids")String[] vod_ids,
    @ApiOperation("获取设备录像存储信息")
    @RequestMapping(value = "deviceVideoTimeList", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String deviceVideoTimeList(
            @ApiParam(name="patient")@RequestParam(value = "patient",required = false)String patient,
            @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 = false,defaultValue = "1") Integer channelNo,
            @ApiParam(name="startTime",required = false,value="起始时间,时间格式为:YYYY-MM-DD hh:ss:mm。非必选,默认为当天0点")
            @RequestParam(value = "startTime",required = false) String startTime,
            @ApiParam(name="endTime",required = false,value="结束时间,时间格式为:YYYY-MM-DD hh:ss:mm。非必选,默认为当前时间")
            @RequestParam(value = "endTime",required = false) String endTime,
            @ApiParam(name="recType",required = false,value="回放源,0-系统自动选择,1-云存储,2-本地录像。非必选,默认为0")
            @RequestParam(value = "recType",required = false) Integer recType,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.videoDetailList(vod_ids));
            if (StringUtils.isBlank(patient)&&StringUtils.isBlank(deviceSerial)){
                return error(-1,"参数错误");
            }
            JSONObject result = ysDeviceService.deviceVideoTimeList(patient,deviceSerial,channelNo,startTime,endTime,recType,request);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return error(200,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"查询成功","data",result.getJSONArray(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("查询录像详情")
    @RequestMapping(value = "videoDetail", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String videoDetail(
            @ApiParam(name = "vod_id",value="录像id",required = true)
            @RequestParam(value="vod_id")String vod_id,
    @ApiOperation("根据时间获取录像地址 仅rtmp格式--未使用")
    @RequestMapping(value = "deviceVideoUrlByTime", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String deviceVideoUrlByTime(
            @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 = false,defaultValue = "1") Integer channelNo,
            @ApiParam(name="protocol",required = true,value="流播放协议,3-rtmp")
            @RequestParam(value = "protocol",required = false,defaultValue = "3") String protocol,
            @ApiParam(name="type",required = true,value="rtmp协议地址类型,2-本地录像回放,3-云存储录像回放")
            @RequestParam(value = "type",required = false,defaultValue = "2") String type,
            @ApiParam(name="startTime",required = false,value="起始时间,时间格式为:YYYY-MM-DD hh:ss:mm。")
            @RequestParam(value = "startTime",required = false) String startTime,
            @ApiParam(name="stopTime",required = false,value="结束时间,时间格式为:YYYY-MM-DD hh:ss:mm。")
            @RequestParam(value = "stopTime",required = false) String stopTime,
            @ApiParam(name="expireTime",required = false,value="过期时间")
            @RequestParam(value = "expireTime",required = false) Integer expireTime,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.videoDetail(vod_id));
            JSONObject result = ysDeviceService.deviceVideoUrlByTime(deviceSerial,channelNo,protocol,type,startTime,stopTime,expireTime,request);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return error(200,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("上传录像")
    @RequestMapping(value = "videoUpload", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
//    @ApiOperation("获取上传录像授权信息")
//    @RequestMapping(value = "getVideoKey", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
//    public String getVideoKey(
//            HttpServletRequest request){
//        try {
//
//
//            return write(200,"查询成功","data",ysDeviceService.getVideoKey(request));
//        }catch (Exception e){
//            e.printStackTrace();
//            return error(-1,"error");
//        }
//    }
//
//    @ApiOperation("查询录像列表(无法区分用户)")
//    @RequestMapping(value = "videoList", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
//    public String videoList(
//            @ApiParam(name="name",required = false,value="录像名称,支持模糊搜索")
//            @RequestParam(value = "name",required = false) String name,
//            @ApiParam(name="type",required = false,value="视频类型 默认查询全部视频/录像,type=playback,表示查询直播暂存(录像);type=vod,表示查询上传、剪辑、合并视频。")
//            @RequestParam(value = "type",required = false) String type,
//            @ApiParam(name="page",required = false,value="page")
//            @RequestParam(value = "page",required = false,defaultValue = "1") int page,
//            @ApiParam(name="count",required = false,value=",默认为 20")
//            @RequestParam(value = "count",required = false,defaultValue = "20") int count,
//            HttpServletRequest request){
//        try {
//
//
//            return write(200,"查询成功","data",ysDeviceService.videoList(name,type,page,count));
//        }catch (Exception e){
//            e.printStackTrace();
//            return error(-1,"error");
//        }
//    }
//
//    @ApiOperation("批量获取录像详情")
//    @RequestMapping(value = "videoDetailList", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
//    public String videoDetailList(
//            @ApiParam(name = "vod_ids",value="录像id",required = true)
//            @RequestParam(value="vod_ids")String[] vod_ids,
//            HttpServletRequest request){
//        try {
//
//
//            return write(200,"查询成功","data",ysDeviceService.videoDetailList(vod_ids));
//        }catch (Exception e){
//            e.printStackTrace();
//            return error(-1,"error");
//        }
//    }
//
//    @ApiOperation("查询录像详情")
//    @RequestMapping(value = "videoDetail", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
//    public String videoDetail(
//            @ApiParam(name = "vod_id",value="录像id",required = true)
//            @RequestParam(value="vod_id")String vod_id,
//            HttpServletRequest request){
//        try {
//
//
//            return write(200,"查询成功","data",ysDeviceService.videoDetail(vod_id));
//        }catch (Exception e){
//            e.printStackTrace();
//            return error(-1,"error");
//        }
//    }
//
//    @ApiOperation("上传录像")
//    @RequestMapping(value = "videoUpload", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
//    public String videoUpload(
//            HttpServletRequest request,
//            @ApiParam(value = "文件", required = true)
//            @RequestParam(value = "file", required = true) MultipartFile file){
//        try {
//
//            String originalFilename = file.getOriginalFilename();
//            InputStream inputStream = file.getInputStream();
//
//            return write(200,"查询成功","data",ysDeviceService.videoUpload(request));
//        }catch (Exception e){
//            e.printStackTrace();
//            return error(-1,"error");
//        }
//    }
//
    @ApiOperation("获取视频地址信息(录像获取,直播地址另一个接口)")
    @RequestMapping(value = "videoList2", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String videoUpload(
            HttpServletRequest request,
            @ApiParam(value = "文件", required = true)
            @RequestParam(value = "file", required = true) MultipartFile file){
            @ApiParam(name="patient")@RequestParam(value = "patient",required = false)String patient,
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="channelNo",required = false,value="设备通道号,默认为1")
            @RequestParam(value = "channelNo",required = false,defaultValue = "1") Integer channelNo,
            @ApiParam(name="code",required = false,value="ezopen协议地址的设备的视频加密密码")
            @RequestParam(value = "code",required = false) String code,
            @ApiParam(name="expireTime",required = false,value="过期时长,单位秒;针对hls/rtmp设置有效期,相对时间;30秒-7天")
            @RequestParam(value = "expireTime",required = false) Integer expireTime,
            @ApiParam(name="protocol",required = false,value="流播放协议,1-ezopen、2-hls、3-rtmp、4-flv")
            @RequestParam(value = "protocol",required = false,defaultValue = "4") Integer protocol,
            @ApiParam(name="quality",required = false,value="视频清晰度,1-高清(主码流)、2-流畅(子码流)")
            @RequestParam(value = "quality",required = false) Integer quality,
            @ApiParam(name="startTime",required = false,value="ezopen协议地址的本地录像/云存储录像回放开始时间 2019-12-01 00:00:00")
            @RequestParam(value = "startTime",required = false) String startTime,
            @ApiParam(name="stopTime",required = false,value="ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00")
            @RequestParam(value = "stopTime",required = false) String stopTime,
            @ApiParam(name="type",required = false,value="ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1")
            @RequestParam(value = "type",required = false) String type,
            @ApiParam(name="supportH265",required = false,value="是否要求视频为H265编码格式")
            @RequestParam(value = "supportH265",required = false) Integer supportH265,
            @ApiParam(name="gbchannel",required = false,value="国标设备的通道编号")
            @RequestParam(value = "gbchannel",required = false) String gbchannel,
            HttpServletRequest request
            ){
        try {
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            return write(200,"查询成功","data",ysDeviceService.videoUpload(request));
            if (StringUtils.isBlank(patient)&&StringUtils.isBlank(deviceSerial)){
                return error(-1,"参数错误");
            }
            JSONObject result = ysDeviceService.videoList2(patient,deviceSerial,channelNo,code,expireTime,protocol,quality,startTime,stopTime,type,supportH265,gbchannel,request);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return error(200,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java

@ -228,7 +228,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "cancelConclusion")
    @ResponseBody
    @ObserverRequired
    @ApiOperation("取消登记服务小结")
    @ApiOperation("取消登记服务小结--未使用")
    public ObjEnvelop cancelConclusion(@ApiParam(name = "orderId", value = "工单id", required = true) @RequestParam String orderId) {
        try {
            JSONObject result = securityMonitoringOrderService.cancelConclusion(orderId,getUID());

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -244,6 +245,21 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getEmergencyWarnOrderList")
    @ApiOperation(value = "态势分析紧急预警动态列表")//仅只能查看已完成
    public PageEnvelop getEmergencyWarnOrderList(@ApiParam(name="page",value = "page")
                                            @RequestParam(value = "page") Integer page,
                                                 @ApiParam(name="pageSize",value = "pageSize")
                                            @RequestParam(value = "pageSize") Integer pageSize
    ){
        try {
            return patientInfoPlatFormService.getEmergencyWarnOrderList(page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    public String write(int code, String msg, String key, JSONArray value) {
        try {
            org.json.JSONObject json = new org.json.JSONObject();

+ 42 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -16,6 +16,7 @@ import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.care.service.third.PcManageWebSocketService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.CountDistance;
@ -211,6 +212,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        message.put("content_notice",assistanceDO.getPatientName()+" 发起紧急救助!");
        message.put("sender_code",assistanceDO.getPatient());
        message.put("OrderType",20);
        message.put("OrderStatus","new");
        message.put("order_id",assistanceDO.getId());
        message.put("content_type",40);
        for (BaseDoctorDO doctorDO:doctorDOS){
@ -680,6 +682,18 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        //工单完成 给pc管理端推送完成信息
        JSONObject message = new JSONObject();
        message.put("session_id",assistanceDO.getSessionId());
        message.put("sender_name",assistanceDO.getPatientName());
        message.put("content_notice",assistanceDO.getPatientName()+" 完成紧急救助!");
        message.put("sender_code",assistanceDO.getPatient());
        message.put("OrderType",20);
        message.put("OrderStatus","finish");
        message.put("order_id",assistanceDO.getId());
        message.put("content_type",40);
        PcManageWebSocketService.broadCast(message.toString());
        emergencyAssistanceDao.save(assistanceDO);
        String failMsg = "当前救助工单已取消";
        result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -736,6 +750,18 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        //工单完成 给pc管理端推送完成信息
        JSONObject message = new JSONObject();
        message.put("session_id",assistanceDO.getSessionId());
        message.put("sender_name",assistanceDO.getPatientName());
        message.put("content_notice",assistanceDO.getPatientName()+" 完成紧急救助!");
        message.put("sender_code",assistanceDO.getPatient());
        message.put("OrderType",20);
        message.put("OrderStatus","finish");
        message.put("order_id",assistanceDO.getId());
        message.put("content_type",40);
        PcManageWebSocketService.broadCast(message.toString());
        emergencyAssistanceDao.save(assistanceDO);
        return getOrderDetail(orderId,null);
    }
@ -847,6 +873,18 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        }
        emergencyAssistanceDao.save(assistanceDO);
        //工单完成 给pc管理端推送完成信息
        JSONObject message = new JSONObject();
        message.put("session_id",assistanceDO.getSessionId());
        message.put("sender_name",assistanceDO.getPatientName());
        message.put("content_notice",assistanceDO.getPatientName()+" 完成紧急救助!");
        message.put("sender_code",assistanceDO.getPatient());
        message.put("OrderType",20);
        message.put("OrderStatus","finish");
        message.put("order_id",assistanceDO.getId());
        message.put("content_type",40);
        PcManageWebSocketService.broadCast(message.toString());
        result = getOrderDetail(orderId,null);
        return result;
    }
@ -876,6 +914,10 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return result;
    }
    public JSONObject getMonitorUrl(String patient){
        return null;
    }
    public String test(String doctor,String orderID){
//        JSONObject message = new JSONObject();
//        message.put("session_id","808080eb78b5d8e90178b5fcfa330001_4028030c78f1df510178f217a6c50001_20");

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -449,7 +449,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    public List<Map<String,Object>> patientDeviceListByTopic(String patient,String serviceTopic){
        String sql = "select dd.photo,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime " +
                "from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code\n" +
                "from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code INNER JOIN wlyy_devices wd on dd.model = wd.device_model and pd.device_sn = wd.device_code \n" +
                "where 1=1 and  pd.del=0 ";
        if (StringUtils.isNotBlank(patient)) {
        sql += " and  pd.`user`='" + patient + "' ";

+ 335 - 90
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java

@ -4,6 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.YsConfig;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.encode.Base64;
import org.apache.commons.lang3.StringUtils;
@ -20,10 +25,11 @@ import org.springframework.util.MultiValueMap;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import javax.swing.plaf.basic.BasicScrollPaneUI;
import javax.xml.crypto.Data;
import java.security.Security;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
@ -33,12 +39,13 @@ import java.util.concurrent.TimeUnit;
public class YsDeviceService {
    private static Logger logger = LoggerFactory.getLogger(YsDeviceService.class);
    private Map<String,String> msgType = new HashMap<>();
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    /**
     * 获取萤石设备assesToken
@ -119,6 +126,7 @@ public class YsDeviceService {
     * @throws Exception
     */
    public JSONObject surveillanceWay(String deviceSerial,Integer channelNo,Integer isTrust,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        param.put("deviceSerial",deviceSerial);
@ -126,7 +134,15 @@ public class YsDeviceService {
        param.put("isTrust",0);
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.surveillanceWay,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        if (responseBody.getInteger("code")==200){
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,responseBody.getJSONObject("data"));
        }
        else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,responseBody.getString("msg"));
        }
        return result;
        //https://www.yuque.com/u1400669/kb/os58z7#p9Tfd
    }
@ -176,14 +192,66 @@ public class YsDeviceService {
    /**
     * 获取视频地址
     */
    public JSONObject getDeviceLiveAddress(String deviceSerial,Integer channelNo,HttpServletRequest request) throws Exception {
    public JSONObject getDeviceLiveAddress(String patient,String deviceSerial,Integer channelNo,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        if (StringUtils.isBlank(deviceSerial)){
            if (StringUtils.isNotBlank(patient)){
                List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
                if (devices.size()>0){
                    deviceSerial = devices.get(0).getDeviceSn();
                }
            }
        }
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        param.add("deviceSerial",deviceSerial);
        param.add("channelNo",channelNo+"");
        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.getDeviceLiveAddress,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        if (responseBody.getInteger("code")==200){
            JSONObject tmp = responseBody.getJSONObject("data");
            Integer exception = tmp.getInteger("exception");
            switch (exception){
                case 0:
                    result.put(ResponseContant.resultFlag,200);
                    result.put(ResponseContant.resultMsg,tmp);
                    break;
                case 1:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备不在线");
                    break;
                case 2:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备开启视频加密,请联系管理员先进行解密");
                    break;
                case 3:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备删除");
                    break;
                case 4:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"失效");
                    break;
                case 5:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"未绑定");
                    break;
                case 6:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"账户下流量已超出");
                    break;
                case 7:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备接入限制");
                    break;
            }
        }
        else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,responseBody.getString("msg"));
        }
        return result;
        //https://open.ys7.com/doc/zh/book/index/address.html#address-api2
        /**
@ -201,7 +269,7 @@ public class YsDeviceService {
         *         "flvAddress":"https://flvopen.ys7.com:9188/openlive/99c146f11ab042849fd4b49f7b0d86cf.flv",    FLV流畅直播地址
         *         "hdFlvAddress":"https://flvopen.ys7.com:9188/openlive/99c146f11ab042849fd4b49f7b0d86cf.hd.flv", FLV高清直播地址
         *         "status":1,
         *         "exception":0,
         *         "exception":0,0-正常,1-设备不在线,2-设备开启视频加密,3-设备删除,4-失效,5-未绑定,6-账户下流量已超出,7-设备接入限制,0/1/2/6状态返回地址,其他不返回
         *         "beginTime":1622615659000,
         *         "endTime":1622615659000
         *     }
@ -209,6 +277,31 @@ public class YsDeviceService {
         */
    }
    public JSONObject deviceFailConfig(String deviceSerial,Integer type,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        JSONObject responseBody = new JSONObject();
        String url =MessageFormat.format(YsConfig.deviceFailConfig, deviceSerial,"1");
        if (null==type){//查询
            url += "?accessToken="+getIotAccessToken()+"&key=Alarm_DetectHumanCar";
            MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.GET);
            responseBody = response.getBody();
        }
        else {
            MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
            param.add("accessToken",getIotAccessToken());
            param.add("key","Alarm_DetectHumanCar");
            param.add("value","{\"type\":"+type+"}");
            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.PUT);
            responseBody = response.getBody();
        }
        return responseBody;
        //https://www.yuque.com/u1400669/kb/os58z7#YYazO
    }
    /**
     * 云台控制开始
     * @param deviceSerial
@ -254,104 +347,273 @@ public class YsDeviceService {
    }
    /**
     * 获取上传录像授权信息
     * 设置循环覆盖
     * @param is_vod_cover
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject getVideoKey(HttpServletRequest request) throws Exception {
        JSONObject param = new JSONObject();
    public JSONObject coverVideoSwitch(String is_vod_cover ,HttpServletRequest request) throws Exception {
        JSONObject param  = new JSONObject();
        param.put("accessToken",getAccessToken());
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoKey,param,HttpMethod.POST);
        param.put("is_vod_cover",is_vod_cover);
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.coverVideoSwitch,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/nu22ks#Kj5dG
        //https://open.ys7.com/doc/zh/book/index/device_ptz.html#device_ptz-api2
    }
    /**
     * 录像列表(无法区分用户)
     * 获取设备录像存储信息
     * @param deviceSerial
     * @param channelNo
     * @param startTime
     * @param endTime
     * @param recType
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject videoList(String name,String type,Integer page,Integer count) throws Exception {
        page = page>0?page-1:0;
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        if (StringUtils.isNotBlank(name)){
            param.put("name",name);
        }
        if (StringUtils.isNotBlank(type)){
            param.put("type",type);
    public JSONObject deviceVideoTimeList(String patient,String deviceSerial,Integer channelNo,String startTime,String endTime,Integer recType,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        if (StringUtils.isBlank(deviceSerial)){
            if (StringUtils.isNotBlank(patient)){
                List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
                if (devices.size()>0){
                    deviceSerial = devices.get(0).getDeviceSn();
                }
            }
        }
        param.put("page",page);
        param.put("count",count);
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        param.add("deviceSerial",deviceSerial);
        param.add("channelNo",channelNo+"");
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoList,param,HttpMethod.POST);
        if (StringUtils.isNotBlank(startTime)){
            Date tmp = DateUtil.dateTimeParse(startTime);
            long timeStemp = tmp.getTime();
            param.add("startTime",timeStemp+"");
        }
        if (StringUtils.isNotBlank(endTime)){
            Date tmp = DateUtil.dateTimeParse(startTime);
            long timeStemp = tmp.getTime();
            param.add("endTime",timeStemp+"");
        }
        if (null != recType){
            param.add("recType",recType+"");
        }
        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.deviceVideoTimeList,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/nu22ks#kF97n
        if (responseBody.getInteger("code")==200){
            JSONArray tmp = responseBody.getJSONArray("data");
            tmp.sort(Comparator.comparing(obj -> Long.parseLong(((LinkedHashMap) obj).get("startTime").toString())));
            for (int i=0;i<tmp.size();i++){
                LinkedHashMap mapTmp = tmp.getObject(i,LinkedHashMap.class);
                Long startTimeStr =  Long.parseLong(mapTmp.get("startTime").toString()) ;
                Long endTimeStr = Long.parseLong(mapTmp.get("endTime").toString()) ;
                Date date = new Date(startTimeStr);
                mapTmp.put("startTimeDate",DateUtil.dateToStrLong(date));
                date = new Date(endTimeStr);
                mapTmp.put("endTimeDate",DateUtil.dateToStrLong(date));
            }
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,tmp);
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"查询失败,请联系管理员");
        }
        return result;
        //https://open.ys7.com/doc/zh/book/index/device_select.html#device_select-api9
    }
    /**
     * 批量获取录像详情
     * @param vod_ids
     * 根据时间获取录像地址
     * @param deviceSerial
     * @param channelNo
     * @param protocol
     * @param type
     * @param startTime
     * @param stopTime
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject videoDetailList(String[] vod_ids) throws Exception {
        JSONArray arr = JSONArray.parseArray(JSON.toJSONString(vod_ids));
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        param.put("vod_ids",arr);
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetailList,param,HttpMethod.POST);
    public JSONObject deviceVideoUrlByTime(String deviceSerial,Integer channelNo,String protocol,String type,String startTime,String stopTime,Integer expireTime,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        param.add("deviceSerial",deviceSerial);
        param.add("channelNo",channelNo+"");
        if (StringUtils.isNotBlank(protocol)){
            param.add("protocol",protocol);
        }
        if (StringUtils.isNotBlank(startTime)){
            param.add("startTime",startTime);
        }
        if (StringUtils.isNotBlank(stopTime)){
            param.add("stopTime",stopTime);
        }
        if (StringUtils.isNotBlank(type)){
            param.add("type",type);
        }
        if (null != expireTime){
        }
        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.deviceVideoUrlByTime,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/nu22ks#60Fjf
        if (responseBody.getInteger("code")==200){
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,responseBody.getJSONObject("data"));
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"查询失败");
        }
        return result;
        //https://open.ys7.com/doc/zh/uikit/wechat_miniapp.html?h=%E5%BD%95%E5%83%8F
    }
//    /**
//     * 获取上传录像授权信息
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    public JSONObject getVideoKey(HttpServletRequest request) throws Exception {
//        JSONObject param = new JSONObject();
//        param.put("accessToken",getAccessToken());
//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoKey,param,HttpMethod.POST);
//        JSONObject responseBody = response.getBody();
//        return responseBody;
//        //https://www.yuque.com/u1400669/kb/nu22ks#Kj5dG
//    }
//
//    /**
//     * 录像列表(无法区分用户)
//     * @return
//     * @throws Exception
//     */
//    public JSONObject videoList(String name,String type,Integer page,Integer count) throws Exception {
//        page = page>0?page-1:0;
//        JSONObject param = new JSONObject();
//        param.put("accessToken",getAccessToken());
//        if (StringUtils.isNotBlank(name)){
//            param.put("name",name);
//        }
//        if (StringUtils.isNotBlank(type)){
//            param.put("type",type);
//        }
//        param.put("page",page);
//        param.put("count",count);
//
//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoList,param,HttpMethod.POST);
//        JSONObject responseBody = response.getBody();
//        return responseBody;
//        //https://www.yuque.com/u1400669/kb/nu22ks#kF97n
//    }
//
//    /**
//     * 批量获取录像详情
//     * @param vod_ids
//     * @return
//     * @throws Exception
//     */
//    public JSONObject videoDetailList(String[] vod_ids) throws Exception {
//        JSONArray arr = JSONArray.parseArray(JSON.toJSONString(vod_ids));
//        JSONObject param = new JSONObject();
//        param.put("accessToken",getAccessToken());
//        param.put("vod_ids",arr);
//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetailList,param,HttpMethod.POST);
//        JSONObject responseBody = response.getBody();
//        return responseBody;
//        //https://www.yuque.com/u1400669/kb/nu22ks#60Fjf
//    }
//
//    /**
//     * 获取录像详情
//     * @return
//     * @throws Exception
//     */
//    public JSONObject videoDetail(String vod_id) throws Exception {
//        JSONObject param = new JSONObject();
//        param.put("accessToken",getAccessToken());
//        param.put("vod_id",vod_id);
//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetail,param,HttpMethod.POST);
//        JSONObject responseBody = response.getBody();
//        return responseBody;
//        //https://www.yuque.com/u1400669/kb/nu22ks#xQCVK
//    }
//
//    public JSONObject videoUpload(HttpServletRequest request){
//
//
//        return null;
//        //https://www.yuque.com/u1400669/kb/nu22ks#nQXzO
//    }
    /**
     * 获取录像详情
     * @return
     * @throws Exception
     */
    public JSONObject videoDetail(String vod_id) throws Exception {
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        param.put("vod_id",vod_id);
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetail,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/nu22ks#xQCVK
    }
    public JSONObject deviceFailConfig(String deviceSerial,Integer type,HttpServletRequest request) throws Exception {
        JSONObject responseBody = new JSONObject();
        String url =MessageFormat.format(YsConfig.deviceFailConfig, deviceSerial,"1");
        if (null==type){//查询
            url += "?accessToken="+getIotAccessToken()+"&key=Alarm_DetectHumanCar";
            MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.GET);
            responseBody = response.getBody();
    public JSONObject videoList2(String patient,String deviceSerial,Integer channelNo,String code,Integer expireTime,Integer protocol,
                                 Integer quality,String startTime,String stopTime,String type,Integer supportH265,
                                 String gbchannel,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        if (StringUtils.isBlank(deviceSerial)){
            if (StringUtils.isNotBlank(patient)){
                List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
                if (devices.size()>0){
                    deviceSerial = devices.get(0).getDeviceSn();
                }
            }
        }
        else {
            MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
            param.add("accessToken",getIotAccessToken());
            param.add("key","Alarm_DetectHumanCar");
            param.add("value","{\"type\":"+type+"}");
            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.PUT);
            responseBody = response.getBody();
        if (StringUtils.isNotBlank(deviceSerial)){
            param.add("deviceSerial",deviceSerial);
        }
        return responseBody;
        //https://www.yuque.com/u1400669/kb/os58z7#YYazO
    }
    public JSONObject videoUpload(HttpServletRequest request){
        return null;
        //https://www.yuque.com/u1400669/kb/nu22ks#nQXzO
        if (null!=channelNo){
            param.add("channelNo",channelNo+"");
        }
        if (StringUtils.isNotBlank(code)){
            param.add("code",code);
        }
        if (null !=expireTime){
            param.add("expireTime",expireTime+"");
        }
        if (null !=protocol){
            param.add("protocol",protocol+"");
        }
        if (null !=quality){
            param.add("quality",quality+"");
        }
        if (StringUtils.isNotBlank(startTime)){
            param.add("startTime",startTime);
        }
        if (StringUtils.isNotBlank(stopTime)){
            param.add("stopTime",stopTime);
        }
        if (StringUtils.isNotBlank(type)){
            param.add("type",type);
        }
        if (null!=supportH265){
            param.add("supportH265",supportH265+"");
        }
        if (StringUtils.isNotBlank(gbchannel)){
            param.add("gbchannel",gbchannel+"");
        }
        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.videoList2,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        if (responseBody.getInteger("code")==200){
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,responseBody.getJSONObject("data"));
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"查询失败");
        }
        return result;
        //https://open.ys7.com/doc/zh/book/index/address_v2.html?h=api%2Flapp%2Fv2%2Flive%2Faddress%2Fget
    }
    /**
@ -386,23 +648,6 @@ public class YsDeviceService {
//        System.out.println("1");
//    }
    {
        msgType.put("10001","离岗检测消息");
        msgType.put("10002","身份识别消息");
        msgType.put("10003","回头客消息");
        msgType.put("10004","门禁事件消息");
        msgType.put("10005","设备报警消息");
        msgType.put("10006","设备上线离线消息");
        msgType.put("10007","门禁权限同步消息");
        msgType.put("10008","消防设备消息");
        msgType.put("10009","企业数据变更消息");
        msgType.put("10010","智能联动消息");
        msgType.put("10011","海康设备透传消息");
        msgType.put("10012","通道关联状态上报消息");
        msgType.put("10013","智能控制设备状态消息");
        msgType.put("10014","托管设备增删消息");
        msgType.put("10016","门铃消息");
    }
}

+ 69 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -12,6 +12,7 @@ import com.yihu.jw.care.endpoint.third.platForm.PcManageWebSocketServer;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.service.third.PcManageWebSocketService;
@ -104,6 +105,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private YsDeviceService ysDeviceServicel;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
@ -213,6 +216,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        message.put("content_notice",orderDO.getPatientName()+" "+warnStr+"!");
        message.put("sender_code",orderDO.getPatient());
        message.put("OrderType",22);
        message.put("OrderStatus","new");
        message.put("order_id",orderDO.getId());
        message.put("content_type",40);
        for (BaseDoctorDO doctorDO:doctorDOS){
@ -262,6 +266,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        emergencyOrderVO.setPatient(orderDO.getPatient());
        emergencyOrderVO.setPatientName(orderDO.getPatientName());
        emergencyOrderVO.setSex(patientDO.getSex());
        if (StringUtils.isNotBlank(orderDO.getSceneImg())){
            emergencyOrderVO.setSceneImg(orderDO.getSceneImg());
        }
        if(StringUtils.isNotBlank(patientDO.getIdcard())){
            emergencyOrderVO.setAge((IdCardUtil.getAgeForIdcard(patientDO.getIdcard()))+"");
@ -300,8 +307,18 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            map.put("inFenceName","疑似超出安全区域");
            emergencyOrderVO.setInformation(map);
        }
        if(4==orderDO.getOrderSource()){//todo 监控画面
        if(4==orderDO.getOrderSource()){
            List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(orderDO.getPatient(),"12");
            if (devicePatientDeviceDos.size()==0){
            }
            try {
                JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(orderDO.getPatient(),devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                Map<String,Object> map = new HashMap<>();
                map.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
                emergencyOrderVO.setInformation(map);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        //通知对象
        List<Map<String,Object>> noticePersons = new ArrayList<>();
@ -435,6 +452,18 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        securityMonitoringOrderDao.save(orderDO);
        //完成工单向pc管理端发送消息
        JSONObject message = new JSONObject();
        message.put("session_id",orderDO.getSessionId());
        message.put("sender_name",orderDO.getPatientName());
        message.put("content_notice","完成安防服务工单");
        message.put("sender_code",orderDO.getPatient());
        message.put("OrderType",22);
        message.put("OrderStatus","finish");
        message.put("order_id",orderDO.getId());
        message.put("content_type",40);
        PcManageWebSocketService.broadCast(message.toString());
        result = getSecurityOrderDetail(orderId,null);
        return result;
    }
@ -757,6 +786,18 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        cancelLogDO.setTime(orderDO.getCancelTime());
        emergencyWarnCancelLogDao.save(cancelLogDO);
        //完成工单向pc管理端发送消息
        JSONObject message = new JSONObject();
        message.put("session_id",orderDO.getSessionId());
        message.put("sender_name",orderDO.getPatientName());
        message.put("content_notice","完成安防服务工单");
        message.put("sender_code",orderDO.getPatient());
        message.put("OrderType",22);
        message.put("OrderStatus","finish");
        message.put("order_id",orderDO.getId());
        message.put("content_type",40);
        PcManageWebSocketService.broadCast(message.toString());
//        Consult consult = consultDao.queryByRelationCode(orderId);
//        // 发送微信模板消息,通知居民工单已取消(smyyyqx-上门预约已取消)
//
@ -889,6 +930,19 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());//已完成
        one.setConclusionStatus(2);
        securityMonitoringOrderDao.save(one);
        //完成工单向pc管理端发送消息
        JSONObject message = new JSONObject();
        message.put("session_id",one.getSessionId());
        message.put("sender_name",one.getPatientName());
        message.put("content_notice","完成安防服务工单");
        message.put("sender_code",one.getPatient());
        message.put("OrderType",22);
        message.put("OrderStatus","finish");
        message.put("order_id",one.getId());
        message.put("content_type",40);
        PcManageWebSocketService.broadCast(message.toString());
        return getSecurityOrderDetail(orderId,null);
    }
@ -1041,9 +1095,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        result.put("smoke",null);
        result.put("fire",null);
        result.put("deviceSn",null);
        result.put("monitorInfo",null);
        List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"4");
        if (devicePatientDeviceDos.size()==0){
            return result;
        }
        else {
            DevicePatientDevice device = devicePatientDeviceDos.get(0);
@ -1095,6 +1149,18 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                result.put("location",null);
            }
        }
        devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
        if (devicePatientDeviceDos.size()==0){
        }
        else{
            try {
                JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                result.put("monitorInfo",monitorUrl.getJSONObject("data"));
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return result;
    }

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -12,6 +12,7 @@ import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
@ -193,4 +194,23 @@ public class PatientInfoPlatFormService {
    public JSONObject getMonitoringInfo(String patient){
        return null;
    }
    /**
     * 紧急预警动态
     * @param page
     * @param pageSize
     * @return
     */
    public PageEnvelop getEmergencyWarnOrderList(Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String sql = " select '20' as OrderType,ord.id,ord.patient,p.name,'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order ord INNER JOIN base_patient p on ord.patient = p.id\n" +
                "UNION \n" +
                "select  '22' as 'OrderType',ord.id,ord.patient,p.name,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id\n" +
                "order by create_time desc  ";
        String countSql = "select count(id) from ("+sql+")A ";
        long count = jdbcTemplate.queryForObject(countSql,long.class);
        sql +=" limit "+page*page+","+pageSize;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
}