Parcourir la source

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

liubing il y a 3 ans
Parent
commit
86644ee1d3
22 fichiers modifiés avec 1426 ajouts et 26 suppressions
  1. 15 1
      common/common-entity/sql记录
  2. 70 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/DoctorPatientTmpDO.java
  3. 24 6
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  4. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/course/DoctorPatientTmpDao.java
  5. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java
  6. 74 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/YsConfig.java
  7. 18 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/DoctorPatientTmpDao.java
  8. 5 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamDao.java
  9. 1 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java
  10. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java
  11. 255 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/YsDeviceController.java
  12. 24 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  13. 11 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/team/TeamEndpoint.java
  14. 27 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  15. 408 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java
  16. 106 14
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  17. 13 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  18. 5 0
      svr/svr-cloud-device/pom.xml
  19. 97 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/common/BaseController.java
  20. 74 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/config/YsConfig.java
  21. 49 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/YsDeviceController.java
  22. 123 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java

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

@ -992,7 +992,6 @@ alter table wlyy_outpatient ADD is_agree  varchar(2);
alter table base_doctor ADD is_sign  varchar(2);
alter table base_doctor ADD is_sign  varchar(2);
alter table base_doctor ADD last_sign_time  timestamp;
alter table base_doctor ADD last_sign_time  timestamp;
-- 2021-06-02 ysj
-- 2021-06-02 ysj
CREATE TABLE `base_seq` (
CREATE TABLE `base_seq` (
  `val` int(11) NOT NULL,
  `val` int(11) NOT NULL,
@ -1017,3 +1016,18 @@ alter table base_life_care_order add column conclusion_imgs varchar(3000) DEFAUL
alter table base_life_care_order add column conclusion_time datetime DEFAULT NULL COMMENT '小结时间';
alter table base_life_care_order add column conclusion_time datetime DEFAULT NULL COMMENT '小结时间';
alter table base_life_care_order add column conclusion_remark varchar(1200) DEFAULT NULL COMMENT '小结内容';
alter table base_life_care_order add column conclusion_remark varchar(1200) DEFAULT NULL COMMENT '小结内容';
-- 2021-06-07 lb
CREATE TABLE `base_doctor_patient_tmp` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `type` tinyint(2) DEFAULT NULL COMMENT '1在线咨询,2上门辅导,3入学报名,4购买课程',
  `relation_code` varchar(50) DEFAULT NULL COMMENT '1:咨询code,2上门辅导工单id,3入学订单id,4课程订单id',
  `doctor_code` varchar(50) DEFAULT NULL COMMENT 'type=(1,2,4为医生id;3机构code) ',
  `status` tinyint(2) DEFAULT '0' COMMENT '入学字段 1已入学,0未入学',
  `del` tinyint(1) DEFAULT '1' COMMENT '1有效 0无效',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `patient` (`patient`),
  KEY `type_doc_code` (`type`,`doctor_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教师医生通讯录埋点数据';

+ 70 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/DoctorPatientTmpDO.java

@ -0,0 +1,70 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/6/7.
 * 教师通讯录幼儿数据埋点
 */
@Entity
@Table(name="base_doctor_patient_tmp")
public class DoctorPatientTmpDO extends UuidIdentityEntityWithCreateTime {
    private String patient;
    private Integer type; //1在线咨询,2上门辅导,3入学报名,4购买课程
    private String relationCode; //1:咨询code,2上门辅导工单id,3入学订单id,4课程订单id
    private String doctorCode;// type=(1,2,4为医生id;3机构code)
    private Integer status; //入学字段 1已入学,0未入学
    private Integer del;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 24 - 6
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -595,10 +595,28 @@ public class HttpClientUtil {
        return response;
        return response;
    }
    }
//    public static void main(String[] args) {
//        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
//        org.springframework.http.HttpEntity<JSONObject> response = aqgCookieHttp("http://api.aiqiangua.com:8888/api/device/868219010321351",null,HttpMethod.GET,
//                "user=2|1:0|10:1620279813|4:user|16:MTM1NTk0ODUyNzA=|9d8d1403e854d37b551b57c9e53581b2ba7c491ba394a2b3a1b83f4ebc3c2d34");
//        System.out.println(response.getBody().toString());
//    }
    public org.springframework.http.HttpEntity<JSONObject> assesTokenPostHttp(String url, JSONObject params,HttpMethod method){
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType(MediaType.APPLICATION_JSON_VALUE);
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> request = new org.springframework.http.HttpEntity<>(params.toString(), headers);
        org.springframework.http.HttpEntity<JSONObject> response = restTemplate.exchange(url, method, request, JSONObject.class);
        return response;
    }
    public  org.springframework.http.HttpEntity<JSONObject> iotAssesTokenPostHttp(String url, MultiValueMap<String, String> params,HttpMethod method){
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType(MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<MultiValueMap<String, String>> request = new org.springframework.http.HttpEntity<>(params, headers);
        org.springframework.http.HttpEntity<JSONObject> response = restTemplate.exchange(url, method, request, JSONObject.class);
        return response;
    }
    public static void main(String[] args)  {
    }
}
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/course/DoctorPatientTmpDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.service.course;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/6/7.
 */
public interface DoctorPatientTmpDao extends PagingAndSortingRepository<DoctorPatientTmpDO,String>,
        JpaSpecificationExecutor<DoctorPatientTmpDO> {
    DoctorPatientTmpDO findByRelationCode(String relationCode);
    @Query(value = "select count(1) from DoctorPatientTmpDO t where t.patient=?1 and t.doctorCode = ?2 ")
    Integer findByPatientAndDoctorCode(String patient,String doctorCode);
}

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java

@ -4,6 +4,7 @@ import com.yihu.jw.base.dao.course.PatientOrderRefundDao;
import com.yihu.jw.base.dao.course.RecruitStudentsDao;
import com.yihu.jw.base.dao.course.RecruitStudentsDao;
import com.yihu.jw.base.dao.course.RecruitStudentsRecordDao;
import com.yihu.jw.base.dao.course.RecruitStudentsRecordDao;
import com.yihu.jw.base.util.WxMessageUtil;
import com.yihu.jw.base.util.WxMessageUtil;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.care.course.PatientOrderRefundDO;
import com.yihu.jw.entity.care.course.PatientOrderRefundDO;
import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
@ -34,6 +35,8 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
    private RecruitStudentsDao recruitStudentsDao;
    private RecruitStudentsDao recruitStudentsDao;
    @Autowired
    @Autowired
    private WxMessageUtil wxMessageUtil;
    private WxMessageUtil wxMessageUtil;
    @Autowired
    private DoctorPatientTmpDao doctorPatientTmpDao;
    /**
    /**
     * 退费操作
     * 退费操作
@ -83,6 +86,11 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
            }else{
            }else{
                re += recruitStudentsRecordDO.getPatientName()+",";
                re += recruitStudentsRecordDO.getPatientName()+",";
            }
            }
            DoctorPatientTmpDO tmpDO = doctorPatientTmpDao.findByRelationCode(id);
            if (tmpDO!=null){
                tmpDO.setStatus(1);
                doctorPatientTmpDao.save(tmpDO);
            }
        }
        }
        recruitStudentsRecordDao.save(list);
        recruitStudentsRecordDao.save(list);
        wxMessageUtil.sengdWxTemplates(list);
        wxMessageUtil.sengdWxTemplates(list);

+ 74 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/YsConfig.java

@ -0,0 +1,74 @@
package com.yihu.jw.care.config;
/**
 * Created by Bing on 2021/6/1.
 * 萤石摄像头配置
 */
public class YsConfig {
    //文档地址 https://www.yuque.com/u1400669/kb/lmfp6u
    public static final String AppKey="43e44c2071114743925eda34088045f8";
    public static final String Secret="82051725cf0547208f8bc8ae2bff1323";
    public static final String baseUrl = "https://esopen.ys7.com";
    public static final String iotBaseUrl = "https://open.ys7.com";
   //saas平台 https://www.yuque.com/u1400669/kb/wdvi3b#9ZP70
    public static final String saasAssesToken =baseUrl+ "/api/user/open-app/auth/gettoken";
    //开放平台  https://open.ys7.com/doc/zh/book/index/user.html
    public static final String iotAssesToken =baseUrl+ "/api/user/component-open/sso/oauth2/getEZAccessToken";
    //获取通道列表
    public static final String surveillanceWayList =baseUrl+ "/api/resource/open-app/surveillance/camera/list/page";
    //获取通道信息(通道默认为1)
    public static final String surveillanceWay =baseUrl+ "/api/resource/open-app/surveillance/camera/info";
    //设备抓拍
    public static final String deviceCapture =baseUrl +"/api/resource/device/capture";
    //获取设备有效直播地址
    public static final String getDeviceLiveAddress = iotBaseUrl+ "/api/lapp/live/address/limited";
    //设备视频加解密开关
    public static final String deviceEncrypt = baseUrl+ "/api/resource/device/encrypt/switch";
    //跌倒检测功能查询、设置(立即检测!判断是否有跌倒通过推送消息)
    public static final String deviceFailConfig = iotBaseUrl + "/api/route/device/devconfig/keyValue/{0}/{1}/op";
    //云台控制
    public static final String ptzStart = iotBaseUrl +"/api/lapp/device/ptz/start";
    //云台停止
    public static final String ptzStop = iotBaseUrl +"/api/lapp/device/ptz/stop";
    /**
     * 录像相关
     */
    //获取录像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";
    public static final String iotRedisKey = "iotYsAssesToken";
    public static final String secretKey = "secretKey"; //设备的解密秘钥  通过iotAssesToken接口获取的
    public static final String msgDataKey = "HZADP68PNSNVZ4UW"; //消息解密密钥
}

+ 18 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/DoctorPatientTmpDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/6/7.
 */
public interface DoctorPatientTmpDao extends PagingAndSortingRepository<DoctorPatientTmpDO,String>,
        JpaSpecificationExecutor<DoctorPatientTmpDO> {
    DoctorPatientTmpDO findByRelationCode(String relationCode);
    @Query(value = "select count(1) from DoctorPatientTmpDO t where t.patient=?1 and t.doctorCode = ?2 ")
    Integer findByPatientAndDoctorCode(String patient,String doctorCode);
}

+ 5 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamDao.java

@ -37,6 +37,11 @@ public interface BaseTeamDao extends PagingAndSortingRepository<BaseTeamDO, Stri
            "AND t.id = m.teamCode AND t.del = '1' AND m.del = '1'")
            "AND t.id = m.teamCode AND t.del = '1' AND m.del = '1'")
    List<BaseTeamDO> findDoctorTeams(@Param(value = "doctorCode") String doctorCode);
    List<BaseTeamDO> findDoctorTeams(@Param(value = "doctorCode") String doctorCode);
    @Query("SELECT t FROM BaseTeamMemberDO m, BaseTeamDO t WHERE m.doctorCode =:doctorCode " +
            "AND t.id = m.teamCode  AND t.del = '1' AND m.del = '1' and exists (select doc.id from BaseDoctorDO doc,BaseTeamMemberDO mem " +
            " where mem.teamCode = m.teamCode and doc.id = mem.doctorCode and doc.name like :name )")
    List<BaseTeamDO> findDoctorTeamsByDoctorName(@Param(value = "doctorCode") String doctorCode,@Param(value = "name") String name);
    @Query("from BaseTeamDO t WHERE t.del = '1'  AND t.orgCode = ?1 ")
    @Query("from BaseTeamDO t WHERE t.del = '1'  AND t.orgCode = ?1 ")
    List<BaseTeamDO> findByOrgCode(String orgCode);
    List<BaseTeamDO> findByOrgCode(String orgCode);
 }
 }

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

@ -194,6 +194,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			systemMessageDO.setData(data.toString());
			systemMessageDO.setData(data.toString());
			consultService.saveMessage(systemMessageDO);
			consultService.saveMessage(systemMessageDO);
		}
		}
		return success("操作成功", consult);
		return success("操作成功", consult);
	}
	}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java

@ -292,7 +292,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    //申请退款
    //申请退款 //todo 退款需要把数据失效 base_doctor_patient_tmp表
    //直播间
    //直播间
}
}

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

@ -0,0 +1,255 @@
package com.yihu.jw.care.endpoint.device;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.device.YsDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
 * Created by Bing on 2021/6/1.
 */
@RestController
@RequestMapping("ys/device")
@Api(description = "萤石设备设备相关服务")
public class YsDeviceController extends BaseController {
    private static org.slf4j.Logger logger = LoggerFactory.getLogger(YsDeviceController.class);
    @Autowired
    private YsDeviceService ysDeviceService;
    @ApiOperation("摄像机通道详情")
    @RequestMapping(value = "surveillanceWay", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String surveillanceWay(
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="channelNo",required = false,value="设备通道号,默认为1")
            @RequestParam(value = "channelNo",required = false,defaultValue = "1") Integer channelNo,
            @ApiParam(name="isTrust",required = false,value="是否托管设备:0-非托管,1-托管,默认0")
            @RequestParam(value = "isTrust",required = false,defaultValue = "0") Integer isTrust,
            HttpServletRequest request) {
        try {
            return write(200,"查询成功","data",ysDeviceService.surveillanceWay(deviceSerial,channelNo,isTrust,request));
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @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="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="type",required = false,value="0-人或车检测,1-人形检测,2-车检测,3-画面变化检测,4-人脸检测,5-智能人体检测,6-宠物检测,7-跌倒检测")
            @RequestParam(value = "type",required = false) Integer type,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.deviceFailConfig(deviceSerial,type,request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("视频加解密")
    @RequestMapping(value = "deviceEncrypt", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String deviceEncrypt(
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="isEncrypt",required = true,value="0-关闭,1-开启")
            @RequestParam(value = "isEncrypt",required = true) Integer isEncrypt,
            @ApiParam(name="validateCode",required = false,value="设备验证码,当isEncrypt=0时,需要传递此参数")
            @RequestParam(value = "validateCode",required = false) String validateCode,
            HttpServletRequest request){
        try {
            if (0==isEncrypt&& StringUtils.isBlank(validateCode)){
                return error(-1,"参数错误");
            }
            return write(200,"查询成功","data",ysDeviceService.deviceEncrypt(deviceSerial,isEncrypt,validateCode,request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("设备抓拍")
    @RequestMapping(value = "deviceCapture", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String deviceCapture(
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="channelNo",required = true,value="通道号,IPC设备填1")
            @RequestParam(value = "channelNo",required = true) Integer channelNo,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.deviceCapture(deviceSerial,channelNo,request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @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="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));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("设备云台控制开始")//操作后都需要调用停止接口 才会停止转动
    @RequestMapping(value = "ptzStart", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String ptzStart(
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="channelNo",required = true,value="通道号,IPC设备填1")
            @RequestParam(value = "channelNo",required = true) Integer channelNo,
            @ApiParam(name="direction",required = true,value="0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距")
            @RequestParam(value = "direction",required = true) Integer direction,
            @ApiParam(name="speed",required = true,value="云台速度:0-慢,1-适中,2-快,海康设备参数不可为0")
            @RequestParam(value = "speed",required = true) Integer speed,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.ptzStart(deviceSerial,channelNo,direction,speed,request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @ApiOperation("设备云台控制结束")
    @RequestMapping(value = "ptzStop", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String ptzStop(
            @ApiParam(name="deviceSerial",required = true,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = true) String deviceSerial,
            @ApiParam(name="channelNo",required = true,value="通道号,IPC设备填1")
            @RequestParam(value = "channelNo",required = true) Integer channelNo,
            @ApiParam(name="direction",required = true,value="0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距")
            @RequestParam(value = "direction",required = true) Integer direction,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.ptzStop(deviceSerial,channelNo,direction,request));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
    @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");
        }
    }
}

+ 24 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java

@ -139,6 +139,27 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @GetMapping(value = "getOrgDoctorBySearch")
    @ApiOperation(value = "医生通讯录根据名字获取机构医生")
    public ObjEnvelop getOrgDoctorBySearch(
            @ApiParam(name = "orgType", value = "搜索时使用 1,2医疗机构 3养老机构,4托育机构")
            @RequestParam(value = "orgType",defaultValue = " 1,2") String orgType,
            @ApiParam(name="name",required = false,value = "搜索时使用")
            @RequestParam(value = "name",required = false)String name,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size
    ){
        try {
            return ObjEnvelop.getSuccess("查询成功", doctorService.getOrgDoctorByName(getUID(),orgType,name));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "getTeacherChildren")
    @GetMapping(value = "getTeacherChildren")
    @ApiOperation(value = "教师通讯录-我的儿童")
    @ApiOperation(value = "教师通讯录-我的儿童")
    public PageEnvelop getTeacherChildren(
    public PageEnvelop getTeacherChildren(
@ -146,13 +167,15 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "doctor",required = true) String doctor,
            @RequestParam(value = "doctor",required = true) String doctor,
            @ApiParam(name = "searchType", value = "0未入学 1已入学")
            @ApiParam(name = "searchType", value = "0未入学 1已入学")
            @RequestParam(value = "searchType",defaultValue = "0") int searchType,
            @RequestParam(value = "searchType",defaultValue = "0") int searchType,
            @ApiParam(name="name",required = false,value = "名称")
            @RequestParam(value = "name",required = false)String name,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size
            @RequestParam(value = "size") int size
    ){
    ){
        try {
        try {
            return doctorService.getTeacherChildren(doctor,searchType,page,size);
            return doctorService.getTeacherChildren(doctor,searchType,name,page,size);
        }catch (Exception e){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
            return PageEnvelop.getError("查询失败");

+ 11 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/team/TeamEndpoint.java

@ -11,10 +11,12 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
/**
/**
@ -171,9 +173,16 @@ public class TeamEndpoint extends EnvelopRestEndpoint {
     */
     */
    @RequestMapping(value = "/team/{doctorCode}/teams", method = RequestMethod.GET)
    @RequestMapping(value = "/team/{doctorCode}/teams", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生团队列表")
    @ApiOperation(value = "获取医生团队列表")
    public ListEnvelop getDoctorTeams(@PathVariable("doctorCode") String doctorCode) {
    public ListEnvelop getDoctorTeams(@PathVariable("doctorCode") String doctorCode,
                                      @ApiParam(name="name",required = false)
                                      @RequestParam(value = "name",required = false)String name) {
        try {
        try {
            List<BaseTeamDO> teamList = teamDao.findDoctorTeams(doctorCode);
            List<BaseTeamDO> teamList = new ArrayList<>();
            if (StringUtils.isNotBlank(name)){
                teamList = teamDao.findDoctorTeamsByDoctorName(doctorCode,"%" + name + "%");
            }else {
                teamList = teamDao.findDoctorTeams(doctorCode);
            }
            return ListEnvelop.getSuccess("获取成功",teamList);
            return ListEnvelop.getSuccess("获取成功",teamList);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

+ 27 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.course.*;
import com.yihu.jw.care.dao.course.*;
import com.yihu.jw.care.dao.course.DoctorPatientTmpDao;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -12,6 +13,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.course.*;
import com.yihu.jw.entity.care.course.*;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.org.dao.BaseOrgDao;
@ -68,6 +70,8 @@ public class CourseService {
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    @Autowired
    private MessageUtil messageUtil;
    private MessageUtil messageUtil;
    @Autowired
    private DoctorPatientTmpDao doctorPatientTmpDao;
    public String getOrderNo(String type){
    public String getOrderNo(String type){
        return type + System.currentTimeMillis()+(int)(Math.random() * 900)+100 +"";
        return type + System.currentTimeMillis()+(int)(Math.random() * 900)+100 +"";
@ -88,6 +92,10 @@ public class CourseService {
            }
            }
            recordDO.setStatus("7");
            recordDO.setStatus("7");
            recruitStudentsRecordDao.save(recordDO);
            recruitStudentsRecordDao.save(recordDO);
            DoctorPatientTmpDO tmpDO = doctorPatientTmpDao.findByRelationCode(recordDO.getId());
            tmpDO.setDel(0);
            doctorPatientTmpDao.save(tmpDO);
        }else  if("2".equals(type)){
        }else  if("2".equals(type)){
            //课程
            //课程
            CourseSalesOrderRecordDO recordDO = courseSalesOrderRecordDao.findOne(id);
            CourseSalesOrderRecordDO recordDO = courseSalesOrderRecordDao.findOne(id);
@ -96,6 +104,10 @@ public class CourseService {
            }
            }
            recordDO.setStatus("7");
            recordDO.setStatus("7");
            courseSalesOrderRecordDao.save(recordDO);
            courseSalesOrderRecordDao.save(recordDO);
            DoctorPatientTmpDO tmpDO = doctorPatientTmpDao.findByRelationCode(recordDO.getId());
            tmpDO.setDel(0);
            doctorPatientTmpDao.save(tmpDO);
        }
        }
        return null;
        return null;
    }
    }
@ -800,6 +812,13 @@ public class CourseService {
        //这个机构收到新的在线报名申请时,给机构联系人发送一条短信
        //这个机构收到新的在线报名申请时,给机构联系人发送一条短信
        messageUtil.sendOnlineRegistSms(recruitStudentsDO.getOrgCode());
        messageUtil.sendOnlineRegistSms(recruitStudentsDO.getOrgCode());
        DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
        tmpDO.setPatient(recordDO.getPatient());
        tmpDO.setType(3);
        tmpDO.setDoctorCode(recordDO.getOrgCode());
        tmpDO.setRelationCode(recordDO.getId());
        doctorPatientTmpDao.save(tmpDO);
        return result;
        return result;
    }
    }
@ -834,6 +853,14 @@ public class CourseService {
        recordDO.setPayType(payType);
        recordDO.setPayType(payType);
        recordDO.setOrderNo(getOrderNo("2"));
        recordDO.setOrderNo(getOrderNo("2"));
        courseSalesOrderRecordDao.save(recordDO);
        courseSalesOrderRecordDao.save(recordDO);
        DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
        tmpDO.setPatient(recordDO.getPatient());
        tmpDO.setType(4);
        tmpDO.setDoctorCode(courseDO.getDoctor());
        tmpDO.setRelationCode(recordDO.getId());
        doctorPatientTmpDao.save(tmpDO);
        return recordDO;
        return recordDO;
    }
    }

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

@ -0,0 +1,408 @@
package com.yihu.jw.care.service.device;
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.util.http.HttpClientUtil;
import com.yihu.jw.utils.encode.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.security.Security;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
 * Created by Bing on 2021/6/1.
 */
@Service
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;
    /**
     * 获取萤石设备assesToken
     */
    public String getAccessToken() throws Exception {
        if(redisTemplate.hasKey(YsConfig.redisKey)){
            return redisTemplate.opsForValue().get(YsConfig.redisKey);
        }
        JSONObject param = new JSONObject();
        param.put("appKey",YsConfig.AppKey);
        param.put("appSecret",YsConfig.Secret);
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.saasAssesToken,param, HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        String assToken = null;
        if (responseBody.getInteger("code")==200){
            assToken = responseBody.getJSONObject("data").getString("accessToken");
            Long expireTime = responseBody.getJSONObject("data").getLong("expiresIn");//token有效期
            redisTemplate.opsForValue().set(YsConfig.redisKey,assToken,expireTime, TimeUnit.MILLISECONDS);
        }else {
            throw new Exception("获取token失败");
        }
        return assToken;
    }
    /**
     * 获取IOT开放平台assesToken
     * @return
     * @throws Exception
     */
    public String getIotAccessToken() throws Exception {
        if(redisTemplate.hasKey(YsConfig.iotRedisKey)){
            return redisTemplate.opsForValue().get(YsConfig.iotRedisKey);
        }
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.iotAssesToken,param, HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        String assToken = null;
        if (responseBody.getInteger("code")==200){
            assToken = responseBody.getJSONObject("data").getString("ezOpenAccessToken");
            Long expireTime = responseBody.getJSONObject("data").getLong("expireTime");//token有效期
            redisTemplate.opsForValue().set(YsConfig.iotRedisKey,assToken,expireTime, TimeUnit.MILLISECONDS);
            //设备解密密钥
            String secretKey = responseBody.getJSONObject("data").getString("secretKey");
            redisTemplate.opsForValue().set(YsConfig.secretKey,secretKey,expireTime, TimeUnit.MILLISECONDS);
        }else {
            throw new Exception("获取token失败");
        }
        return assToken;
    }
    /**
     * 获取设备解密密钥
     * @return
     * @throws Exception
     */
    public String getSecretKey() throws Exception {
        if(redisTemplate.hasKey(YsConfig.secretKey)){
            return redisTemplate.opsForValue().get(YsConfig.secretKey);
        }
        else {
            getIotAccessToken();
            return redisTemplate.opsForValue().get(YsConfig.secretKey);
        }
    }
    /**
     * 萤石摄像机获取通道详情
     * @param deviceSerial
     * @param channelNo
     * @param isTrust
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject surveillanceWay(String deviceSerial,Integer channelNo,Integer isTrust,HttpServletRequest request) throws Exception {
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        param.put("deviceSerial",deviceSerial);
        param.put("channelNo",channelNo);
        param.put("isTrust",0);
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.surveillanceWay,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/os58z7#p9Tfd
    }
    /**
     * 视频加解密开关
     * @param deviceSerial
     * @param isEncrypt
     * @param validateCode
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject deviceEncrypt(String deviceSerial,Integer isEncrypt,String validateCode,HttpServletRequest request) throws Exception {
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        param.put("deviceSerial",deviceSerial);
        param.put("isEncrypt",isEncrypt);
        if (0==isEncrypt){//PU4eJqa7j9GMst8P
            validateCode = messageDecrypt(validateCode,getSecretKey());
            param.put("validateCode",validateCode);
        }
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.deviceEncrypt,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/os58z7#zfqzn
    }
    /**
     * 设备抓拍
     * @param deviceSerial
     * @param channelNo
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject deviceCapture(String deviceSerial,Integer channelNo,HttpServletRequest request) throws Exception {
        JSONObject param = new JSONObject();
        param.put("accessToken",getAccessToken());
        param.put("deviceSerial",deviceSerial);
        param.put("channelNo",channelNo+"");
        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.deviceCapture,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://www.yuque.com/u1400669/kb/os58z7#K2AHX
    }
    /**
     * 获取视频地址
     */
    public JSONObject getDeviceLiveAddress(String deviceSerial,Integer channelNo,HttpServletRequest request) throws Exception {
        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;
        //https://open.ys7.com/doc/zh/book/index/address.html#address-api2
        /**
         * {
         *     "msg":"操作成功!",
         *     "code":"200",
         *     "data":{
         *         "deviceSerial":"F56826706",
         *         "channelNo":1,
         *         "deviceName":"C6Wi(F56826706)",
         *         "liveAddress":"http://hls01open.ys7.com/openlive/99c146f11ab042849fd4b49f7b0d86cf.m3u8",  HLS流畅直播地址
         *         "hdAddress":"http://hls01open.ys7.com/openlive/99c146f11ab042849fd4b49f7b0d86cf.hd.m3u8",  HLS高清直播地址
         *         "rtmp":"rtmp://rtmp01open.ys7.com/openlive/99c146f11ab042849fd4b49f7b0d86cf",               RTMP流畅直播地址
         *         "rtmpHd":"rtmp://rtmp01open.ys7.com/openlive/99c146f11ab042849fd4b49f7b0d86cf.hd",           RTMP高清直播地址
         *         "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,
         *         "beginTime":1622615659000,
         *         "endTime":1622615659000
         *     }
         * }
         */
    }
    /**
     * 云台控制开始
     * @param deviceSerial
     * @param channelNo
     * @param direction
     * @param speed
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject ptzStart(String deviceSerial,Integer channelNo,Integer direction,Integer speed,HttpServletRequest request) throws Exception {
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        param.add("deviceSerial",deviceSerial);
        param.add("channelNo",channelNo+"");
        param.add("direction",direction+"");
        param.add("speed",speed+"");
        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.ptzStart,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://open.ys7.com/doc/zh/book/index/device_ptz.html#device_ptz-api1
    }
    /**
     * 云台控制结束
     * @param deviceSerial
     * @param channelNo
     * @param direction
     * @param request
     * @return
     * @throws Exception
     */
    public JSONObject ptzStop(String deviceSerial,Integer channelNo,Integer direction,HttpServletRequest request) throws Exception {
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        param.add("deviceSerial",deviceSerial);
        param.add("channelNo",channelNo+"");
        param.add("direction",direction+"");
        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.ptzStop,param,HttpMethod.POST);
        JSONObject responseBody = response.getBody();
        return responseBody;
        //https://open.ys7.com/doc/zh/book/index/device_ptz.html#device_ptz-api2
    }
    /**
     * 获取上传录像授权信息
     * @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 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();
        }
        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
    }
    public JSONObject videoUpload(HttpServletRequest request){
        return null;
        //https://www.yuque.com/u1400669/kb/nu22ks#nQXzO
    }
    /**
     * 消息解密
     * @param sSrc
     * @param sKey
     * @return
     * @throws Exception
     */
    public String messageDecrypt(String sSrc, String sKey) throws Exception {
        try {
            byte[] raw = sKey.getBytes("utf-8");
            Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding");
            cipher.init(Cipher.DECRYPT_MODE, skeySpec);
            byte[] encrypted1 = Base64.decode(sSrc);//先用base64解密
            byte[] original = cipher.doFinal(encrypted1);
            return new String(original, "utf-8");
        } catch (Exception ex) {
            logger.error("AES解密异常:Str"+sSrc+"\nkey:"+sKey);
            throw new Exception("解密失败");
        }
    }
//    public static void main(String[] args) throws Exception {
//        String mess = "9uFqSq7m0HCj0vboHqVI5XLmnlS+ZB4S2k2gH6CZyUMXIod2OP+UK7ibjP27v9OX";
//        String skey="PU4eJqa7j9GMst8P";
//        String response = messageDecrypt(mess,skey);
//        System.out.println(response);
//        JSONObject tmp = JSONObject.parseObject(response);
//        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","门铃消息");
    }
}

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

@ -161,6 +161,19 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                isSearchDoctorOrgType=true;
                isSearchDoctorOrgType=true;
            }
            }
        }
        }
        if (1==doctorLevel) {//专科医生
            doctorOrgType=1;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        if (2==doctorLevel) {//社区医生
            doctorOrgType=2;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        //医生机构
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
        List<String> doctorOrg = jdbcTemplate.queryForList(sql,String.class);
        List<String> doctorOrg = jdbcTemplate.queryForList(sql,String.class);
@ -177,7 +190,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        else if (orgType.equals("1,2")){//医疗机构
        else if (orgType.equals("1,2")){//医疗机构
           sql+=" and org.type in(1,2) ";
           sql+=" and org.type in(1,2) ";
        }
        }
        else {
        else {//养老
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
            }else {
            }else {
@ -198,6 +211,63 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return tmpList;
        return tmpList;
    }
    }
    public JSONObject getOrgDoctorByName(String doctor,String orgType,String name){
        JSONObject result = new JSONObject();
        if (StringUtils.isNotBlank(doctor)){
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
            //教师角色登录时为本机构科室列表,点击展开人员列表
            //助老员角色登录时为本机构科室列表,点击展开人员列表
            Integer doctorLevel = doctorDO.getLevel();
            Integer doctorOrgType =0 ;
            boolean isSearchDoctorOrgType=false;
            if (3==doctorLevel){//教师
                doctorOrgType=4;
                if ("4".equals(orgType)){
                    isSearchDoctorOrgType=true;
                }
            }
            if (2==doctorLevel) {//助老员
                doctorOrgType=3;
                if ("3".equals(orgType)){
                    isSearchDoctorOrgType=true;
                }
            }
            if (1==doctorLevel) {//专科医生
                doctorOrgType=1;
                if ("1,2".equals(orgType)){
                    isSearchDoctorOrgType=true;
                }
            }
            if (2==doctorLevel) {//社区医生
                doctorOrgType=2;
                if ("1,2".equals(orgType)){
                    isSearchDoctorOrgType=true;
                }
            }
            //医生机构
            String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
                    "and dh.doctor_code='"+doctor+"' and org.type in ("+doctorOrgType+") ORDER BY dh.create_time desc limit 1";
            List<String> doctorOrg = jdbcTemplate.queryForList(sql,String.class);
            sql = "select dh.org_code,dh.org_name,doc.id,doc.name,doc.mobile,doc.photo,dict.code deptCode,dict.name deptName,dh.doctor_duty_code job,dh.doctor_duty_name jobName\n" +
                    " from base_doctor_hospital dh INNER JOIN base_org org on org.`code` = dh.org_code and org.del=1 INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
                    " and dh.del=1 LEFT JOIN " +
                    " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where org.type in ("+orgType+") ";
            if (StringUtils.isNotBlank(name)){
                sql += " and doc.name like '%"+name+"%' ";
            }
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){//查询通讯录机构与医生身份相同,只查询医生机构下的医生
                sql += " and dh.org_code= '"+doctorOrg.get(0)+"' ";
            }
            List<Map<String,Object>> tmpList = jdbcTemplate.queryForList(sql);
            result.put("doctorList",tmpList);
            return result;
        }
        return result;
    }
    public JSONObject getOrgDoctor(String orgCode,String deptCode,int page,int size){
    public JSONObject getOrgDoctor(String orgCode,String deptCode,int page,int size){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        String count = "select count(Distinct doc.id)\n" +
        String count = "select count(Distinct doc.id)\n" +
@ -230,31 +300,53 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return result;
        return result;
    }
    }
    public PageEnvelop getTeacherChildren(String doctor,int searchType,int page,int size){
    public PageEnvelop getTeacherChildren(String doctor,int searchType,String name,int page,int size){
        page = page>0?page-1:0;
        page = page>0?page-1:0;
        List<Map<String,Object>> list = new ArrayList<>();
        List<Map<String,Object>> list = new ArrayList<>();
        //未入学
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =2 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2  )";
        String sql0 = "select * from  " +
                " (select Distinct patient from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select Distinct patient from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select Distinct patient from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select tmp.patient from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.doctor_code " +
                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0)B where  " +
                " not EXISTS (select DISTINCT rsr.patient  from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                " and org.del=1  INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=B.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2 )";
        //已入学
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 2   ";
                "and rsr.del<>0  and rsr.`status` = 2   ";
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
                " Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
        Long count = 0L;
        Long count = 0L;
        if (0==searchType){
        if (StringUtils.isNotBlank(name)){
             sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
                     " Inner JOIN base_patient p on tmp.patient  = p.id and p.name like '%"+name+"%' " +
                     " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 " +
                     " GROUP BY p.id ";
             sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                    " and p.name like '%"+name+"%' LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
        }
        if (1==searchType){//
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql1));
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
            list .addAll(jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql1)));
            count += jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
        }else {
            if (0==searchType){
                list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
                count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
            }
            if (1==searchType){//
                list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql1));
                count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
            }
        }
        }
        for (Map<String,Object>map:list){
        for (Map<String,Object>map:list){
            if (map.get("idcard")!=null){
            if (map.get("idcard")!=null){
@ -280,7 +372,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    public Map<String,Long> getTeacherChildrenCount(String doctor){
    public Map<String,Long> getTeacherChildrenCount(String doctor){
        Map<String,Long> result = new HashMap<>();
        Map<String,Long> result = new HashMap<>();
        //未入学
        //未入学 (发起咨询的幼儿列表,发起上门辅导的幼儿列表,已报名但是未录取的幼儿)
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =2 and not EXISTS (select DISTINCT rsr.patient " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =2 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +

+ 13 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -4,19 +4,20 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.doorCoach.*;
import com.yihu.jw.care.dao.doorCoach.*;
import com.yihu.jw.care.dao.course.DoctorPatientTmpDao;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.care.doorCoach.*;
import com.yihu.jw.entity.care.doorCoach.*;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
@ -119,6 +120,8 @@ public class DoctorDoorCoachOrderService {
    private BasePatientWechatDao basePatientWechatDao;
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    private BaseDoctorRoleDao baseDoctorRoleDao;
    @Autowired
    private DoctorPatientTmpDao doctorPatientTmpDao;
    /**
    /**
     * 根据id获取服务工单信息
     * 根据id获取服务工单信息
@ -454,6 +457,15 @@ public class DoctorDoorCoachOrderService {
        }
        }
        //  待接单消息设为已操作, 434 医生接单-- 王五接受了服务工单12345678
        //  待接单消息设为已操作, 434 医生接单-- 王五接受了服务工单12345678
        messageUtil.updateDoorCoachMessage(doorServiceOrder,new String[]{"703","707"},"734",null,null);
        messageUtil.updateDoorCoachMessage(doorServiceOrder,new String[]{"703","707"},"734",null,null);
        if(doctorPatientTmpDao.findByPatientAndDoctorCode(doorServiceOrder.getPatient(),doorServiceOrder.getDoctor())==0){
            DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
            tmpDO.setDoctorCode(doorServiceOrder.getDoctor());
            tmpDO.setPatient(doorServiceOrder.getPatient());
            tmpDO.setType(2);
            tmpDO.setRelationCode(doorServiceOrder.getId());
            doctorPatientTmpDao.save(tmpDO);
        }
    }
    }
    /**
    /**

+ 5 - 0
svr/svr-cloud-device/pom.xml

@ -140,6 +140,11 @@
                </exclusion>
                </exclusion>
            </exclusions>
            </exclusions>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-ext-jdk16</artifactId>
            <version>1.46</version>
        </dependency>
    </dependencies>
    </dependencies>

+ 97 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/common/BaseController.java

@ -0,0 +1,97 @@
package com.yihu.jw.care.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.util.date.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 *
 */
public class BaseController {
    private static Logger logger = LoggerFactory.getLogger("error_logger");
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("code", code);
            map.put("msg", msg);
            map.put("success", false);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 接口处理成功
     * @return
     */
    public String success() {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("code", 200);
            map.put("success", true);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("code", code);
            map.put("msg", msg);
            map.put("success", true);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Object value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("code", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    public void error(Exception e) {
        logger.error(DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")+":"+getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
}

+ 74 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/config/YsConfig.java

@ -0,0 +1,74 @@
package com.yihu.jw.care.config;
/**
 * Created by Bing on 2021/6/1.
 * 萤石摄像头配置
 */
public class YsConfig {
    //文档地址 https://www.yuque.com/u1400669/kb/lmfp6u
    public static final String AppKey="43e44c2071114743925eda34088045f8";
    public static final String Secret="82051725cf0547208f8bc8ae2bff1323";
    public static final String baseUrl = "https://esopen.ys7.com";
    public static final String iotBaseUrl = "https://open.ys7.com";
   //saas平台 https://www.yuque.com/u1400669/kb/wdvi3b#9ZP70
    public static final String saasAssesToken =baseUrl+ "/api/user/open-app/auth/gettoken";
    //开放平台  https://open.ys7.com/doc/zh/book/index/user.html
    public static final String iotAssesToken =baseUrl+ "/api/user/component-open/sso/oauth2/getEZAccessToken";
    //获取通道列表
    public static final String surveillanceWayList =baseUrl+ "/api/resource/open-app/surveillance/camera/list/page";
    //获取通道信息(通道默认为1)
    public static final String surveillanceWay =baseUrl+ "/api/resource/open-app/surveillance/camera/info";
    //设备抓拍
    public static final String deviceCapture =baseUrl +"/api/resource/device/capture";
    //获取设备有效直播地址
    public static final String getDeviceLiveAddress = iotBaseUrl+ "/api/lapp/live/address/limited";
    //设备视频加解密开关
    public static final String deviceEncrypt = baseUrl+ "/api/resource/device/encrypt/switch";
    //跌倒检测功能查询、设置(立即检测!判断是否有跌倒通过推送消息)
    public static final String deviceFailConfig = iotBaseUrl + "/api/route/device/devconfig/keyValue/{0}/{1}/op";
    //云台控制
    public static final String ptzStart = iotBaseUrl +"/api/lapp/device/ptz/start";
    //云台停止
    public static final String ptzStop = iotBaseUrl +"/api/lapp/device/ptz/stop";
    /**
     * 录像相关
     */
    //获取录像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";
    public static final String iotRedisKey = "iotYsAssesToken";
    public static final String secretKey = "secretKey"; //设备的解密秘钥  通过iotAssesToken接口获取的
    public static final String msgDataKey = "HZADP68PNSNVZ4UW"; //消息解密密钥
}

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

@ -0,0 +1,49 @@
package com.yihu.jw.care.endpoint;
import com.yihu.jw.care.common.BaseController;
import com.yihu.jw.care.service.YsDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
 * Created by Bing on 2021/6/1.
 */
@RestController
@RequestMapping("ys/device")
@Api(value = "萤石设备设备相关服务", description = "设备相关服务")
public class YsDeviceController  extends BaseController {
    private static org.slf4j.Logger logger = LoggerFactory.getLogger(YsDeviceController.class);
    @Autowired
    private YsDeviceService ysDeviceService;
    @ApiOperation("萤石摄像机消息通知数据接收")
    @RequestMapping(value = "pushdata", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String pushdata(
            HttpServletRequest request) {
        try {
            StringBuilder sb = new StringBuilder();
            BufferedReader in=new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));
            String line = null;
            while ((line = in.readLine()) != null) {
                sb.append(line);
            }
            return write(200,"查询成功","data",ysDeviceService.pushdata(sb.toString(),request));
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"error");
        }
    }
}

Fichier diff supprimé car celui-ci est trop grand
+ 123 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java