Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into baseCopy1

# Conflicts:
#	common/common-entity/sql记录
#	common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
wangjun 3 years ago
parent
commit
f9ffc85bd3
29 changed files with 1249 additions and 212 deletions
  1. 15 1
      common/common-entity/sql记录
  2. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  3. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java
  4. 58 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/message/BaseServiceNews.java
  5. 9 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java
  6. 0 7
      svr/svr-cloud-care/pom.xml
  7. 29 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/YsConfig.java
  8. 1 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientDeviceDao.java
  9. 23 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/BaseServiceNewsDao.java
  10. 11 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  11. 6 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java
  12. 220 58
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/YsDeviceController.java
  13. 29 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java
  14. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  15. 3 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  16. 100 7
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java
  17. 42 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  18. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java
  19. 11 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  20. 362 87
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java
  21. 34 20
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  22. 5 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  23. 10 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java
  24. 124 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/BaseServiceNewsService.java
  25. 36 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  26. 81 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  27. 4 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java
  28. 22 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java
  29. 1 1
      svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java

+ 15 - 1
common/common-entity/sql记录

@ -1051,4 +1051,18 @@ ALTER TABLE base_security_monitoring_order add column scene_img VARCHAR(1000) de
--2021-06-21
ALTER table base_patient add column idcard_front varchar(1000) default NULL  COMMENT '身份证正面';
ALTER table base_patient add column idcard_back varchar(1000) default NULL  COMMENT '身份证反面';
ALTER table base_patient add column idcard_back varchar(1000) default NULL  COMMENT '身份证反面';
-- 2021-06-17 ysj
ALTER table base_patient ADD COLUMN `lat_lon` varchar(100) DEFAULT NULL COMMENT '定位经纬度';
CREATE TABLE `base_service_news` (
  `id` varchar(50) NOT NULL,
  `content` varchar(200) DEFAULT NULL COMMENT '内容',
  `create_time` datetime DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `type` varchar(2) DEFAULT NULL COMMENT '类型',
  `code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='服务动态信息';

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -297,6 +297,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setIdcardBack(String idcardBack) {
        this.idcardBack = idcardBack;
    }
    private String latLon;//定位经纬度
    public String getCardType() {
        return cardType;
@ -857,4 +858,13 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setMarriageName(String marriageName) {
        this.marriageName = marriageName;
    }
    @Column(name = "lat_lon")
    public String getLatLon() {
        return latLon;
    }
    public void setLatLon(String latLon) {
        this.latLon = latLon;
    }
}

+ 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智能手表
    // 设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器,12 监控器
    private String categoryCode;
    // 用户类型标准 -1代表单用户
    private String userType;

+ 58 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/message/BaseServiceNews.java

@ -0,0 +1,58 @@
package com.yihu.jw.entity.care.message;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/17
 * @Description:
 */
@Entity
@Table(name="base_service_news")
public class BaseServiceNews extends UuidIdentityEntityWithCreateTime {
    //内容
    private String content;
    //姓名
    private String name;
    private String code;
    //类型 1上门辅导、2发起咨询、3发起生活照料、4代预约
    private String type;
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

+ 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;
    }
}

+ 0 - 7
svr/svr-cloud-care/pom.xml

@ -256,13 +256,6 @@
            <artifactId>es-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!--oracle驱动-->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <build>

+ 29 - 11
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,38 @@ public class YsConfig {
     * 录像相关
     */
    //获取录像accessKey、上传录像地址
    public static final String videoKey = baseUrl +"/seastart/vod/token";
    //录像循环覆盖开关(开启后,当内存卡存储满时会覆盖原有录像,不会导致停止录像)
    public static final String coverVideoSwitch = baseUrl + "/seastart/auth/set-vod";
    //上传录像上传地址通过videoKey接口获取
    public static final String videoUpload = "https://seastart.ss.bscstorage.com";
    //获取设备录像存储信息
    public static final String deviceVideoTimeList = iotBaseUrl + "/api/lapp/video/by/time";
    //录像列表
    public static final String videoList = baseUrl +"/seastart/vod/list";
    //根据时间获取录像地址//仅rtmp格式
    public static final String deviceVideoUrlByTime = iotBaseUrl + "/api/lapp/v2/live/address/get";
    //批量获取录像详情
    public static final String videoDetailList = baseUrl +"/seastart/vod";
    //录像地址 多格式
    public static final String videoList2 = iotBaseUrl +"/api/lapp/v2/live/address/get";
    //录像详情
    public static final String videoDetail = baseUrl +"/seastart/vod/get";
    //全天录像
    public static final String fullDayVideo = iotBaseUrl +"/api/lapp/device/fullday/record/switch/set";
//    //获取录像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);
}

+ 23 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/BaseServiceNewsDao.java

@ -0,0 +1,23 @@
package com.yihu.jw.care.dao.message;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.care.message.BaseServiceNews;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/18
 * @Description:
 */
public interface BaseServiceNewsDao extends PagingAndSortingRepository<BaseServiceNews,String>, JpaSpecificationExecutor<BaseServiceNews> {
    @Query("select a from BaseServiceNews a ")
    List<BaseServiceNews> findNews(Pageable pageRequest);
}

+ 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("获取失败");
        }
    }
}

+ 6 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -2,8 +2,8 @@ package com.yihu.jw.care.endpoint.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.DoctorPatientTmpDao;
import com.yihu.jw.care.service.consult.ConsultService;
import com.yihu.jw.care.service.message.BaseServiceNewsService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
@ -11,7 +11,6 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
@ -105,6 +104,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private ConsultService consultService;
	@Autowired
	private BaseServiceNewsService serviceNewsService;
	@GetMapping(value = "findLastOnlineConsult")
	@ApiOperation(value = "获取居民该机构的最近一次在线咨询")
	public Envelop findLastOnlineConsult(
@ -203,6 +205,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			systemMessageDO.setData(data.toString());
			consultService.saveMessage(systemMessageDO);
			serviceNewsService.addServiceNews(re.getString("patientName"),patient,"2",null);
		}
		return success("操作成功", consult);

+ 220 - 58
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="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="patient")@RequestParam(value = "patient",required = false)String patient,
            @ApiParam(name="deviceSerial",required = false,value="设备序列号")
            @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,236 @@ 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(
    @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.getVideoKey(request));
            return write(200,"查询成功","data",ysDeviceService.coverVideoSwitch(is_vod_cover,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 = "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 = false,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = false) 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.videoList(name,type,page,count));
            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 = "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("根据时间获取录像地址 仅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.videoDetailList(vod_ids));
            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 = "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));
//    @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(
            @ApiParam(name="patient")
            @RequestParam(value = "patient",required = false)String patient,
            @ApiParam(name="deviceSerial",required = false,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = false) 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 {
            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");
        }
    }
    @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){
    @ApiOperation("全天录像开关")
    @RequestMapping(value = "fullDayVideo", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String fullDayVideo(
            @ApiParam(name="patient")
            @RequestParam(value = "patient",required = false)String patient,
            @ApiParam(name="deviceSerial",required = false,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = false) String deviceSerial,
            @ApiParam(name="channelNo",required = false,value="设备通道号,默认为1")
            @RequestParam(value = "channelNo",required = false,defaultValue = "1") Integer channelNo,
            @ApiParam(name="enable",required = false,value="状态:0-关闭,1-开启")
            @RequestParam(value = "enable",required = false,defaultValue = "1") Integer enable,
            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.fullDayVideo(deviceSerial,channelNo,enable,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");

+ 29 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -134,6 +134,20 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "updLatLon")
    @ApiOperation(value = "修改居民经纬度信息")
    public Envelop updLatLon(@ApiParam(name = "latLon", value = "经纬度24.48923061,118.10388605")
                              @RequestParam(value = "latLon", required = true)String latLon,
                              @ApiParam(name = "patientId", value = "居民id")
                              @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
        try{
            patientService.updLatLon(latLon, patientId);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = "updPatient")
    @ApiOperation(value = "修改居民信息")
    public Envelop updPatient(@ApiParam(name = "jsonData", value = "json格式")
@ -250,4 +264,19 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "deleteUser")
    @ApiOperation("注销账号")
    public Envelop deleteUser(@ApiParam(name="patient",required = true)
                                 @RequestParam(value = "patient")String patient){
        try {
            JSONObject result = patientService.deleteUser(patient);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return Envelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return Envelop.getSuccess("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败");
        }
    }
}

+ 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());

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -53,10 +53,12 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop findSignOrg (
            @ApiParam(name = "patient", value = "医生code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @RequestParam(value = "type",required = false) String type) throws Exception {
        try{
            return ListEnvelop.getSuccess("查询成功",servicePackageService.findSignOrg(patient,type));
            return ListEnvelop.getSuccess("查询成功",servicePackageService.findSignOrg(patient,name,type));
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");

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

@ -1,27 +1,35 @@
package com.yihu.jw.care.endpoint.third.platForm;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.care.service.lifeCare.LifeCareOrderService;
import com.yihu.jw.care.service.message.BaseServiceNewsService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.care.service.third.PatientInfoPlatFormService;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
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;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by Bing on 2021/6/16.
 * 管理端pc端 居民详情大屏
@ -43,7 +51,51 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
    private SecurityMonitoringOrderService securityMonitoringOrderService;
    @Autowired
    private EmergencyAssistanceService assistanceService;
    @Autowired
    private BaseServiceNewsService baseServiceNewsService;
    @GetMapping(value = "findOrgLocations")
    @ApiParam("查找机构坐标")
    public ListEnvelop findOrgLocations(){
        try {
            return ListEnvelop.getSuccess("查询成功",baseServiceNewsService.findOrgLocations());
        }catch (Exception e){
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "findPatinetLocations")
    @ApiParam("查找所有居民坐标")
    public ListEnvelop findPatinetLocations(){
        try {
            return ListEnvelop.getSuccess("查询成功",baseServiceNewsService.findPatinetLocations());
        }catch (Exception e){
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "findPatinetByName")
    @ApiParam("获取居民详情页")
    public ListEnvelop findPatinetByName(@ApiParam(name="name",value = "居民姓名",required = true)
                                @RequestParam(value = "name")String  name){
        try {
            return ListEnvelop.getSuccess("查询成功",baseServiceNewsService.findPatinetByName(name));
        }catch (Exception e){
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "findNews")
    @ApiParam("获取居民详情页")
    public ListEnvelop findNews(@ApiParam(name="size",value = "页面大小",required = true)
                                     @RequestParam(value = "size")Integer size){
        try {
            return ListEnvelop.getSuccess("查询成功",baseServiceNewsService.findNews(size));
        }catch (Exception e){
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "getPatientInfo")
    @ApiParam("获取居民详情页")
@ -97,21 +149,21 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getHealthIndexInfo")
    @ApiParam("获取居民体征信息")
    public ObjEnvelop getHealthIndexInfo(@ApiParam(name="patient",value="患者代码",defaultValue = "eb0b478fbe9245428ecf63cd7517206f")
    public String getHealthIndexInfo(@ApiParam(name="patient",value="患者代码",defaultValue = "eb0b478fbe9245428ecf63cd7517206f")
                                             @RequestParam(value="patient",required = true) String patient,
                                         @ApiParam(name="type",value="指标类型",defaultValue = "1")
                                      @ApiParam(name="type",value="指标类型",defaultValue = "1")
                                             @RequestParam(value="type",required = true) int type,
                                         @ApiParam(name="gi_type",value="就餐类型",defaultValue = "1")
                                      @ApiParam(name="gi_type",value="就餐类型",defaultValue = "0")
                                             @RequestParam(value = "gi_type",required = false) int gi_type,
                                         @ApiParam(name="begin",value="开始时间",defaultValue = "2017-05-22 00:00:00")
                                      @ApiParam(name="begin",value="开始时间",defaultValue = "2017-05-22 00:00:00")
                                             @RequestParam(value="begin",required = true) String begin,
                                         @ApiParam(name="end",value="结束时间",defaultValue = "2017-06-02 00:00:00")
                                      @ApiParam(name="end",value="结束时间",defaultValue = "2017-06-02 00:00:00")
                                             @RequestParam(value="end",required = true) String end){
        try {
            return ObjEnvelop.getSuccess("查询成功",patientInfoPlatFormService.getHealthIndexInfo(patient,type,gi_type,begin,end));
            return write (200,"查询成功","data",patientInfoPlatFormService.getHealthIndexInfo(patient,type,gi_type,begin,end));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("获取失败");
            return error(-1,"查询失败");
        }
    }
@ -193,4 +245,45 @@ 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();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

+ 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/contacts/ContactsService.java

@ -160,7 +160,7 @@ public class ContactsService {
        List<Map<String,Object>> result = new ArrayList<>();
        List<Map<String,Object>> result1 = new ArrayList<>();
        BasePatientContactsOrgDO contactsOrgDO = contactsOrgDao.findByPatient(patient);
        List<BaseOrgDO> orgDOList = servicePackageService.findSignOrg(patient,"3");
        List<BaseOrgDO> orgDOList = servicePackageService.findSignOrg(patient,null,"3");
        for (BaseOrgDO orgDO : orgDOList){
            Map<String,Object> map = new HashedMap();
            map.put("distance", LatitudeUtils.getDistance(lat,lng,orgDO.getLatitude(),orgDO.getLongitude()));

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

@ -264,8 +264,10 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    }
    public List<Map<String , Object>> findDeviceFromAdmin(String patientName, int page, int pageSize) {
        String sql = "select p.id,p.`name`,dd.photo,pd.device_id deviceId,pd.category_code categoryCode,pd.device_name deviceName,pd.device_sn deviceSn,pd.czrq,pd.doctor,\n" +
                "pd.doctor_name doctorName,pd.agent,pd.agent_name agentName from wlyy_patient_device pd,base_patient p,dm_device dd where p.id = pd.`user` and pd.del = 0 and pd.category_code = dd.category_code";
        String sql = "select Distinct p.id,p.`name`,dd.photo,pd.device_id deviceId,pd.category_code categoryCode,pd.device_name deviceName, " +
                " pd.device_sn deviceSn,pd.czrq,pd.doctor,pd.doctor_name doctorName,pd.agent,pd.agent_name agentName " +
                " from wlyy_patient_device pd,wlyy_devices wd,base_patient p,dm_device dd where p.id = pd.`user`  and pd.del = 0 " +
                " and pd.device_sn = wd.device_code and pd.category_code = dd.category_code and dd.model = wd.device_model";
        if (StringUtils.isNotBlank(patientName)){
            sql += " AND (p.`name` LIKE '%" + patientName +"%' or  p.idcard LIKE '%" + patientName + "%') ";
        }
@ -276,8 +278,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    public List<Map<String , Object>> getDeviceType() {
        String sql = "select *,case \n" +
                "when category_code=1 then '血糖仪'\n" +
                "when category_code=2 then '血压计'\n" +
                "when category_code=4 then '智能手表'\n" +
                "when category_code=7 then '报警器'\n" +
                "when category_code=12 then '监控器'\n" +
                "else '未知'\n" +
                "end as categoryName\n" +
                " from dm_device where del=1 GROUP BY category_code ";
@ -288,8 +293,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    public List<Map<String , Object>> getDeviceTypeSmall(String category_code) {
        String sql = "select *,case \n" +
                "when category_code=1 then '血糖仪'\n" +
                "when category_code=2 then '血压计'\n" +
                "when category_code=4 then '智能手表'\n" +
                "when category_code=7 then '报警器'\n" +
                "when category_code=12 then '监控器'\n" +
                "else '未知'\n" +
                "end as categoryName\n" +
                " from dm_device where del=1 and category_code='"+category_code+"' GROUP BY model ";
@ -441,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 + "' ";

+ 362 - 87
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,ResponseContant.success);
                    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,303 @@ 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);
    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();
                }
            }
        }
        if (StringUtils.isNotBlank(type)){
            param.put("type",type);
        }
        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(endTime);
            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");
            if (tmp==null){
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"未获取到当天录像信息");
                return result;
            }
            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,responseBody.getString("msg"));
        }
        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);
    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();
                }
            }
        }
        if (StringUtils.isNotBlank(deviceSerial)){
            param.add("deviceSerial",deviceSerial);
        }
        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();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/nu22ks#xQCVK
        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
    }
    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 fullDayVideo(String deviceSerial,Integer channelNo,Integer enable,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        if (StringUtils.isNotBlank(deviceSerial)){
            param.add("deviceSerial",deviceSerial);
        }
        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 (channelNo!=null){
            param.add("channelNo",channelNo+"");
        }
        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 (enable!=null){
            param.add("enable",enable+"");
        }
        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,"操作成功");
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,responseBody.getString("msg"));
        }
        return result;
    }
    /**
@ -386,23 +678,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","门铃消息");
    }
}

+ 34 - 20
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -426,34 +426,49 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    public PageEnvelop getArchiveList(Integer type,Integer signStatus,String name,Integer page,Integer size){
        page = page>0?page-1:0;
        String countSql  ="select count(DISTINCT p.id) from base_patient p where 1=1 ";
        String sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,null as sign_status from base_patient p where 1=1 ";
        String sql = "";
        String sqlCondition = "";
        if (null!=signStatus&&1==type){
            countSql  ="select count(DISTINCT p.id) from base_patient p,wlyy_archive a where a.patient = p.id ";
            sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,a.sign_status as sign_status from base_patient p,wlyy_archive a where a.patient = p.id ";
        String countSql = "";
        if (StringUtils.isNotBlank(name)){
            sqlCondition +=" and p.name like '%"+name+"%' ";
        }
        if(1==type){//老人
            if (0==signStatus){//未签约
                countSql  ="select count(DISTINCT p.id) from base_patient p where 1=1  ";
                sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,0 as sign_status from base_patient p where 1=1 ";
                sqlCondition +=" and NOT EXISTS(select sr.id from base_service_package_sign_record sr " +
                        " INNER JOIN base_service_package_record pr on sr.id = pr.sign_id and sr.status=1 " +
                        " INNER JOIN base_service_package pack on pr.service_package_id = pack.id and pack.del=1 " +
                        " where sr.patient = p.id) ";
            }
            else if (1==signStatus){//已签约
                        " where sr.patient = p.id)  and p.del=1 and p.archive_type=1 ";
                sql += sqlCondition;
            }else if (1==signStatus){//已签约
                countSql  ="select count(DISTINCT p.id) from base_patient p,wlyy_archive a where a.patient = p.id  ";
                sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,1 as sign_status from base_patient p,wlyy_archive a where a.patient = p.id ";
                sqlCondition +=" and EXISTS(select sr.id from base_service_package_sign_record sr " +
                        " INNER JOIN base_service_package_record pr on sr.id = pr.sign_id and sr.status=1 " +
                        " INNER JOIN base_service_package pack on pr.service_package_id = pack.id and pack.del=1 " +
                        " where sr.patient = p.id) ";
                        " where sr.patient = p.id) and p.del=1 and p.archive_type=1 ";
                sql += sqlCondition;
            }
        }
        if (null!=type){//档案类型
            sqlCondition +=" and p.del=1 and p.archive_type="+type+" ";
        }
        if (StringUtils.isNotBlank(name)){
            sqlCondition +=" and p.name like '%"+name+"%' ";
        }
        if(1==type){
            sqlCondition += " order by a.sign_status desc ";
            else {
                countSql = "select count(DISTINCT p.id) from base_patient p where 1=1 and p.del=1 and p.archive_type=1 ";
                sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,0 as sign_status from base_patient p where 1=1 "+
                        " and NOT EXISTS(select sr.id from base_service_package_sign_record sr " +
                        " INNER JOIN base_service_package_record pr on sr.id = pr.sign_id and sr.status=1 " +
                        " INNER JOIN base_service_package pack on pr.service_package_id = pack.id and pack.del=1 " +
                        " where sr.patient = p.id) and  p.del=1 and p.archive_type=1 "+sqlCondition+
                        " union "+
                        "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,1 as sign_status from base_patient p,wlyy_archive a where a.patient = p.id "+
                        " and EXISTS(select sr.id from base_service_package_sign_record sr " +
                        " INNER JOIN base_service_package_record pr on sr.id = pr.sign_id and sr.status=1 " +
                        " INNER JOIN base_service_package pack on pr.service_package_id = pack.id and pack.del=1 " +
                        " where sr.patient = p.id) and p.del=1 and p.archive_type=1 "+sqlCondition;
            }
        }else if (2==type){//新生儿
            countSql  ="select count(DISTINCT p.id) from base_patient p where 1=1 ";
            sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard,null as sign_status from base_patient p where 1=1  ";
            sqlCondition +=" and p.del=1 and p.archive_type="+2+" ";//新生儿
            sql += sqlCondition;
        }
        Long count = jdbcTemplate.queryForObject(countSql+sqlCondition,Long.class);
@ -473,7 +488,6 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }
        }
        return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count);
    }

+ 5 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.doorCoach.*;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.message.BaseServiceNewsService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -23,8 +24,6 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.mysql.query.BaseJpaService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -34,8 +33,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.util.*;
@ -95,6 +92,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    private ConsultTeamService consultTeamService;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private BaseServiceNewsService serviceNewsService;
    /**
     * 创建上门辅导服务工单
@ -226,6 +225,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            sendOrderToDoctor(orderDO.getId(),null,"system","系统",transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName());
        }
        serviceNewsService.addServiceNews(orderDO.getPatientName(),orderDO.getPatient(),"1",null);
        return result;
    }

+ 10 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -7,6 +7,7 @@ import com.yihu.jw.care.dao.lifeCare.LifeCareFeeDetailDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareItemDictDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareOrderDao;
import com.yihu.jw.care.service.common.OrderNoService;
import com.yihu.jw.care.service.message.BaseServiceNewsService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -76,6 +77,9 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    private BaseDoctorDao doctorDao;
    @Autowired
    private OrderNoService orderNoService;
    @Autowired
    private BaseServiceNewsService serviceNewsService;
    /**
     * 记录完成情况
@ -510,6 +514,12 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, orderDO);
        if(orderDO.getType() == 3){
            serviceNewsService.addServiceNews(orderDO.getProxyPatientName(),orderDO.getProxyPatient(),"4",orderDO.getPatientName());
        }else {
            serviceNewsService.addServiceNews(orderDO.getPatientName(),orderDO.getPatient(),"3",null);
        }
        return result;
    }

+ 124 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/BaseServiceNewsService.java

@ -0,0 +1,124 @@
package com.yihu.jw.care.service.message;
import com.yihu.jw.care.dao.message.BaseServiceNewsDao;
import com.yihu.jw.entity.care.message.BaseServiceNews;
import com.yihu.jw.util.common.IdCardUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/18
 * @Description:
 */
@Service
public class BaseServiceNewsService {
    @Autowired
    private BaseServiceNewsDao baseServiceNewsDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查找机构坐标
     * @return
     */
    public List<Map<String,Object>> findOrgLocations(){
        String sql = "SELECT code,name,brief,address,photo,mobile,longitude,latitude from base_org WHERE type in ('3','4') and del =1";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 按名字查找居民坐标
     * @return
     */
    public List<Map<String,Object>> findPatinetByName(String name){
        String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,CAST(archive_type AS char) type from base_patient p\n" +
                "WHERE p.del = 1 and p.name like '%"+name+"%'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:list){
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        return list;
    }
    /**
     * 查找所有居民坐标
     * 已入学儿童+ 已签约老人
     * @return
     */
    public List<Map<String,Object>> findPatinetLocations(){
        String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type from base_doctor_patient_tmp t,base_patient p " +
                "WHERE t.patient = p.id and t.del=1 and t.`status`=1 and p.del =1 " +
                "UNION  " +
                "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type from base_service_package_sign_record t,base_patient p " +
                "WHERE t.patient = p.id and t.`status`=1 and p.del =1";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:list){
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        return list;
    }
    /**
     * 服务动态
     * @param size
     * @return
     */
    public List<BaseServiceNews> findNews(Integer size){
        if(size==null||size<1){
            size = 9;
        }
        Sort sort = new Sort(Direction.DESC, "createTime");
        PageRequest pageRequest = new PageRequest(0, size, sort);
        List<BaseServiceNews> list = baseServiceNewsDao.findNews(pageRequest);
        return list;
    }
    /**
     * 添加服务动态信息-大屏展示用
     * @param name
     * @param code
     * @param type 类型 1上门辅导、2发起咨询、3发起生活照料、4代预约
     */
    public void addServiceNews(String name,String code,String type,String patientName){
        BaseServiceNews serviceNews = new BaseServiceNews();
        serviceNews.setName(name);
        serviceNews.setCode(code);
        serviceNews.setType(type);
        String content = "";
        switch (type){
            case "1":
                content = "发起上门辅导";
                break;
            case "2":
                content = "发起咨询";
                break;
            case "3":
                content = "发起生活照料";
                break;
            case "4":
                content = "为"+patientName+"代预约";
                break;
            default:
                content = "";
                break;
        }
        serviceNews.setContent(content);
        baseServiceNewsDao.save(serviceNews);
    }
}

+ 36 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -150,6 +150,17 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        return res;
    }
    /**
     * 修改居民经纬度信息
     * @param latLon
     * @param patientId
     */
    public void updLatLon(String latLon,String patientId){
        BasePatientDO patientDO = patientDao.findById(patientId);
        patientDO.setLatLon(latLon);
        patientDao.save(patientDO);
    }
    /**
     * 修改居民信息
     * @param jsonData
@ -185,7 +196,9 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        patientBrief.setArchiveType(patientDetail.getArchiveType());
        patientBrief.setSsc(patientDetail.getSsc());
        patientBrief.setMedicareNumber(patientDetail.getMedicareNumber());
        patientBrief.setMobile(patientDetail.getMobile());
        if (StringUtils.isNotBlank(patientDetail.getMobile())){
            patientBrief.setMobile(patientDetail.getMobile());
        }
        patientBrief.setMobileRemarks(patientDetail.getMobileRemarks());
        patientDao.save(patientBrief);
        JSONObject jsonObject1 = null;
@ -306,4 +319,26 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        return result;
    }
    public JSONObject deleteUser(String patient){
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO==null){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"账号不存在");
        }
        if (StringUtils.isNotBlank(patientDO.getIdcard())){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"账号已完成注册,无法注销");
        }else if (patientDO.getArchiveType()!=null){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"账号已完成注册,无法注销");
        } else {
            patientDao.delete(patient);
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,"操作成功");
        }
        return result;
    }
}

+ 81 - 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,24 @@ 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("monitorInfoStatus",result.getIntValue(ResponseContant.resultFlag));
                if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                    map.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                }
                else {
                    map.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
                }
                emergencyOrderVO.setInformation(map);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        //通知对象
        List<Map<String,Object>> noticePersons = new ArrayList<>();
@ -435,6 +458,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 +792,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 +936,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 +1101,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 +1155,24 @@ 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("monitorInfoStatus",result.getIntValue(ResponseContant.resultFlag));
                if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                    result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                }
                else {
                    result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return result;
    }

+ 4 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -79,7 +79,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
     *  type 3 养老 4 教育,1 医疗
     * @return
     */
    public List<BaseOrgDO> findSignOrg(String patient,String type){
    public List<BaseOrgDO> findSignOrg(String patient,String name,String type){
        String sql = "SELECT " +
                " DISTINCT o.* " +
                "FROM " +
@ -98,6 +98,9 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        }else if("3".equals(type)){
            sql += " and o.type =3 ";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " and o.name like '%"+name+"%' ";
        }
        //type =4 新生儿
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));

+ 22 - 2
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;
@ -78,7 +79,7 @@ public class PatientInfoPlatFormService {
            //标签类型
            List<String> labelList = new ArrayList<>();
            Integer sex = patientDO.getSex();
            String sexName = sex!=null?(1==sex?"男":"女"):"未知";
            String sexName = sex!=null?(1==sex?"男性":"女性"):"未知";
            labelList.add(sexName);
            List<WlyyPatientLabelDO> labelDOS = patientLabelDao.findByPatient(patient);
            List<String> labeltmp = labelDOS.stream().map(WlyyPatientLabelDO::getLabelName).collect(Collectors.toList());
@ -91,7 +92,7 @@ public class PatientInfoPlatFormService {
                result.put("MonitoringInfo",getPatientMonitoringInfo(patient));//安防监护信息
            }
            if (2==patientType){
                result.put("signService",getSignService(patient));//入园机构列表(报名且录取机构)
                result.put("entranceOrgList",getEntranceOrgList(patient));//入园机构列表(报名且录取机构)
                result.put("MonitoringInfo",getMonitoringInfo(patient)); //新生儿入院信息
            }
            return result;
@ -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);
    }
}

+ 1 - 1
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java

@ -176,7 +176,7 @@ public class ComputeHelper {
                " WHERE bdh.doctor_code = bd.id  " +
                "AND hd.code= bdh.dept_code " +
                "AND o.code = bdh.org_code " +
                "AND bdh.del=1 and o.code not in('fxty')";
                "AND bdh.del=1 and o.del=1 and o.code not in('fxty')";
        if(StringUtils.isNotBlank(orgType)){
            sql += " and o.type = '"+orgType+"'";
        }