Explorar o código

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

yeshijie %!s(int64=4) %!d(string=hai) anos
pai
achega
62ed6653d7
Modificáronse 30 ficheiros con 1606 adicións e 131 borrados
  1. 15 1
      common/common-entity/sql记录
  2. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  3. 70 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/DoctorPatientTmpDO.java
  4. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  5. 24 6
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  6. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/course/DoctorPatientTmpDao.java
  7. 9 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java
  8. 74 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/YsConfig.java
  9. 18 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/DoctorPatientTmpDao.java
  10. 5 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamDao.java
  11. 21 8
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java
  12. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java
  13. 255 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/YsDeviceController.java
  14. 24 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  15. 11 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/team/TeamEndpoint.java
  16. 30 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java
  17. 30 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  18. 408 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java
  19. 132 22
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  20. 14 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  21. 4 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java
  22. 5 0
      svr/svr-cloud-device/pom.xml
  23. 97 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/common/BaseController.java
  24. 74 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/config/YsConfig.java
  25. 49 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/YsDeviceController.java
  26. 123 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java
  27. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java
  28. 73 64
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  29. 5 7
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/web/JobController.java
  30. 10 0
      svr/svr-cloud-job/src/main/resources/application.yml

+ 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='教师医生通讯录埋点数据';

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -24,7 +24,8 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9、16在线复诊咨询(居民直接咨询专家)
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9、16在线复诊咨询(居民直接咨询专家)
	// 10医生发起的求助 11思明区上门服务在线咨询
	// 10医生发起的求助 11思明区上门服务在线咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 23 在线咨询
	// 23 新生儿在线咨询
	// 24 老人在线咨询
	private String patient;         // 提问者标识
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别
	private Integer sex;            // 患者性别

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

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -19,7 +19,9 @@ public class SystemMessageDO extends UuidIdentityEntity {
    /**
    /**
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     * 在线咨询 850
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     */
     */
    private String type;
    private String type;
    /**
    /**

+ 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/dao/course/DoctorPatientTmpDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.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 and t.type=?3")
    Integer findByPatientAndDoctorCodeAndType(String patient,String doctorCode,Integer type);
}

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

@ -1,9 +1,11 @@
package com.yihu.jw.base.service.course;
package com.yihu.jw.base.service.course;
import com.yihu.jw.base.dao.course.DoctorPatientTmpDao;
import com.yihu.jw.base.dao.course.PatientOrderRefundDao;
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 +36,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 +87,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 and t.type=?3")
    Integer findByPatientAndDoctorCodeAndType(String patient,String doctorCode,Integer type);
}

+ 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 and mem.del = '1'  )")
    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);
 }
 }

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

@ -2,6 +2,7 @@ package com.yihu.jw.care.endpoint.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.consult.ConsultService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
@ -10,6 +11,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
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.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
@ -111,12 +113,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "sessionId", value = "会话id")
            @ApiParam(name = "sessionId", value = "会话id")
            @RequestParam(value = "sessionId",required = false) String sessionId,
            @RequestParam(value = "sessionId",required = false) String sessionId,
			@ApiParam(name = "patient", value = "居民CODE")
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
		try {
		try {
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
				return Envelop.getError("参数错误请求失败");
				return Envelop.getError("参数错误请求失败");
			}
			}
			return success("请求成功",consultService.findLastOnlineConsult(patient, orgCode,sessionId));
			return success("请求成功",consultService.findLastOnlineConsult(patient, orgCode,sessionId,type));
		}catch (Exception e){
		}catch (Exception e){
			return failedException(e);
			return failedException(e);
		}
		}
@ -128,9 +132,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "doctor", value = "医生CODE")
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = false) String doctor,
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "patient", value = "居民CODE")
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
		try {
		try {
			String consultCode = consultService.getUnfinishedConsult(patient, doctor);
			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
			return success("请求成功",consultCode);
			return success("请求成功",consultCode);
		}catch (Exception e){
		}catch (Exception e){
			return failedException(e);
			return failedException(e);
@ -150,7 +156,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "images",required = false) String images,
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:23在线咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@RequestParam(value = "type",required = false) Integer type,
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "source", value = "咨询类型来源")
			@ApiParam(name = "source", value = "咨询类型来源")
			@RequestParam(value = "source",required = false) String source)throws Exception{
			@RequestParam(value = "source",required = false) String source)throws Exception{
@ -161,7 +167,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			type = 23;
			type = 23;
		}
		}
		ConsultTeamDo consult = new ConsultTeamDo();
		ConsultTeamDo consult = new ConsultTeamDo();
		// 设置咨询类型:23 在线咨询
		// 设置咨询类型:23 在线咨询 24老人在线咨询
		consult.setType(type);
		consult.setType(type);
		// 设置主要症状
		// 设置主要症状
		consult.setSymptoms(symptoms);
		consult.setSymptoms(symptoms);
@ -179,6 +185,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			systemMessageDO.setTitle("新增在线咨询");
			systemMessageDO.setTitle("新增在线咨询");
			systemMessageDO.setType("850");
			systemMessageDO.setType("850");
			if (type==24){
				systemMessageDO.setType("851");
			}
			systemMessageDO.setReceiver(re.getString("doctor"));
			systemMessageDO.setReceiver(re.getString("doctor"));
			systemMessageDO.setReceiverName(re.getString("doctorName"));
			systemMessageDO.setReceiverName(re.getString("doctorName"));
			systemMessageDO.setRelationCode(re.getString("sessiond_id"));
			systemMessageDO.setRelationCode(re.getString("sessiond_id"));
@ -192,8 +201,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			data.put("question",symptoms);
			data.put("question",symptoms);
			data.put("type",1);
			data.put("type",1);
			systemMessageDO.setData(data.toString());
			systemMessageDO.setData(data.toString());
			consultService.saveMessage(systemMessageDO);
			consultService.saveMessage(systemMessageDO);
		}
		}
		return success("操作成功", consult);
		return success("操作成功", consult);
	}
	}
@ -204,12 +215,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patient",required = true) String patient,
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "orgCode", value = "机构code")
			@ApiParam(name = "orgCode", value = "机构code")
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type,
			@ApiParam(name = "page", value = "第几页")
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@RequestParam(value = "page",required = false) int page,
			@ApiParam(name = "pagesize", value = "分页大小")
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{
			@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{
		try {
		try {
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient, page,pagesize);
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize);
			return success(data);
			return success(data);
		}catch (Exception e){
		}catch (Exception e){
			return failedException(e);
			return failedException(e);
@ -227,7 +240,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "id", value = "咨询ID")
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型")
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = true) String type,
			@RequestParam(value = "type",required = true) String type,
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@RequestParam(value = "status",required = false) Integer status,
			@RequestParam(value = "status",required = false) Integer status,

+ 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 PageEnvelop 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 doctorService.getOrgDoctorByName(getUID(),orgType,name,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.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();

+ 30 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.DoctorPatientTmpDao;
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.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -10,6 +11,7 @@ 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.im.ConsultTeamDoctorDo;
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.course.DoctorPatientTmpDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
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;
@ -69,13 +71,15 @@ public class ConsultService {
    private HibenateUtils hibenateUtils;
    private HibenateUtils hibenateUtils;
    @Autowired
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private DoctorPatientTmpDao doctorPatientTmpDao;
    /**
    /**
     * 获取居民该机构的最近一次在线咨询
     * 获取居民该机构的最近一次在线咨询
     * @param patient
     * @param patient
     * @param orgCode
     * @param orgCode
     */
     */
    public Map<String,Object> findLastOnlineConsult(String patient,String orgCode,String sessionId){
    public Map<String,Object> findLastOnlineConsult(String patient,String orgCode,String sessionId,Integer type){
        Map<String,Object> map = new HashedMap();
        Map<String,Object> map = new HashedMap();
        String sql = "SELECT " +
        String sql = "SELECT " +
                " b.consult,b.doctor, " +
                " b.consult,b.doctor, " +
@ -86,7 +90,7 @@ public class ConsultService {
                "WHERE " +
                "WHERE " +
                " b.doctor = h.doctor_code " +
                " b.doctor = h.doctor_code " +
                "AND b.patient = '"+patient+"' " +
                "AND b.patient = '"+patient+"' " +
                "AND b.type = 23 ";
                "AND b.type = "+type+" ";
        if(StringUtils.isEmpty(orgCode)){
        if(StringUtils.isEmpty(orgCode)){
            String doctor = sessionId.split("_")[1];
            String doctor = sessionId.split("_")[1];
            sql += "AND b.doctor = '"+doctor+"' ";
            sql += "AND b.doctor = '"+doctor+"' ";
@ -97,7 +101,7 @@ public class ConsultService {
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list.size()>0){
        if(list.size()>0){
            map = list.get(0);
            map = list.get(0);
            map.put("sessionId",patient+"_"+String.valueOf(map.get("doctor"))+"_23");
            map.put("sessionId",patient+"_"+String.valueOf(map.get("doctor"))+"_"+type);
            BaseDoctorDO doctorDO = baseDoctorDao.findById(String.valueOf(map.get("doctor")));
            BaseDoctorDO doctorDO = baseDoctorDao.findById(String.valueOf(map.get("doctor")));
            map.put("doctorName",doctorDO.getName());
            map.put("doctorName",doctorDO.getName());
        }
        }
@ -222,7 +226,7 @@ public class ConsultService {
        Map<String,Integer> unreadNum = new HashedMap();
        Map<String,Integer> unreadNum = new HashedMap();
        for (Map<String,Object> map:result){
        for (Map<String,Object> map:result){
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
                String sessionId = patient+"_"+String.valueOf(map.get("doctorCode"))+"_23";
                String sessionId = patient+"_"+String.valueOf(map.get("doctorCode"))+"_"+type;
                //新增未读消息数量
                //新增未读消息数量
                if(unreadNum.containsKey(sessionId)){
                if(unreadNum.containsKey(sessionId)){
                    map.put("count",0);
                    map.put("count",0);
@ -347,7 +351,7 @@ public class ConsultService {
     * @param patient
     * @param patient
     * @return
     * @return
     */
     */
    public List<Map<String,Object>> findConsultDoctor(String orgCode,String patient,int page,int pagesize){
    public List<Map<String,Object>> findConsultDoctor(String orgCode,String patient,Integer type,int page,int pagesize){
        String sql = "SELECT  DISTINCT " +
        String sql = "SELECT  DISTINCT " +
                " a.type AS type, " +
                " a.type AS type, " +
                " d.name AS doctorName, " +
                " d.name AS doctorName, " +
@ -359,7 +363,7 @@ public class ConsultService {
                " FROM wlyy_consult a,wlyy_consult_team b, " +
                " FROM wlyy_consult a,wlyy_consult_team b, " +
                " base_doctor d,base_doctor_hospital h  " +
                " base_doctor d,base_doctor_hospital h  " +
                " WHERE a.id=b.consult and d.id = h.doctor_code  " +
                " WHERE a.id=b.consult and d.id = h.doctor_code  " +
                " AND b.doctor=d.id  AND a.type = 23 and h.org_code = '"+orgCode+"' " +
                " AND b.doctor=d.id  AND a.type = "+type+" and h.org_code = '"+orgCode+"' " +
                " and a.patient = '"+patient +"' "+
                " and a.patient = '"+patient +"' "+
                " ORDER BY a.czrq desc";
                " ORDER BY a.czrq desc";
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize);
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize);
@ -456,7 +460,7 @@ public class ConsultService {
            }
            }
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
                String sessionId = String.valueOf(map.get("patient"))+"_"+doctor+"_23";
                String sessionId = String.valueOf(map.get("patient"))+"_"+doctor+"_"+type;
                //新增未读消息数量
                //新增未读消息数量
                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor);
                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor);
                map.put("sessionId",sessionId);
                map.put("sessionId",sessionId);
@ -495,7 +499,7 @@ public class ConsultService {
     */
     */
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source) throws Exception {
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject re = new JSONObject();
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor));
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()));
        logger.info("boo"+boo);
        logger.info("boo"+boo);
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
        boolean flag = false;
        boolean flag = false;
@ -505,7 +509,7 @@ public class ConsultService {
            }
            }
        }
        }
        if (!flag){
        if (!flag){
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor))) {
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
                throw new RuntimeException("居民还有未结束的在线咨询!");
                throw new RuntimeException("居民还有未结束的在线咨询!");
            }
            }
        }
        }
@ -584,6 +588,21 @@ public class ConsultService {
            consultTeamDoctorDao.save(cd);
            consultTeamDoctorDao.save(cd);
        }
        }
        if (ct.getType()==23){
            if(doctorPatientTmpDao.findByPatientAndDoctorCodeAndType(patient,doctor,1)==0){
                DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
                tmpDO.setDoctorCode(doctor);
                tmpDO.setPatient(patient);
                tmpDO.setType(1);
                tmpDO.setDel(1);
                tmpDO.setRelationCode(ct.getConsult());
                doctorPatientTmpDao.save(tmpDO);
            }
        }
        // 保存医生咨询信息
        // 保存医生咨询信息
        // 添加咨询转发记录
        // 添加咨询转发记录
        // 添加医生咨询日志
        // 添加医生咨询日志
@ -607,7 +626,7 @@ public class ConsultService {
     * @param doctor  医生
     * @param doctor  医生
     * @return
     * @return
     */
     */
    public String  getUnfinishedConsult(String patient, String doctor) {
    public String  getUnfinishedConsult(String patient, String doctor,Integer type) {
        String totalSql = "SELECT a.consult as \"consultCode\" " +
        String totalSql = "SELECT a.consult as \"consultCode\" " +
                "FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
                "FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
@ -615,7 +634,7 @@ public class ConsultService {
                "AND a.patient= '" +patient+"' "+
                "AND a.patient= '" +patient+"' "+
//                "AND b.to_doctor='" +doctor+"' "+
//                "AND b.to_doctor='" +doctor+"' "+
                "AND a.del='1' " +
                "AND a.del='1' " +
                "AND type = 23 " +
                "AND type = "+type+" " +
                "AND a.status=0";
                "AND a.status=0";
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);

+ 30 - 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,15 @@ public class CourseService {
        //这个机构收到新的在线报名申请时,给机构联系人发送一条短信
        //这个机构收到新的在线报名申请时,给机构联系人发送一条短信
        messageUtil.sendOnlineRegistSms(recruitStudentsDO.getOrgCode());
        messageUtil.sendOnlineRegistSms(recruitStudentsDO.getOrgCode());
        DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
        tmpDO.setPatient(recordDO.getPatient());
        tmpDO.setType(3);
        tmpDO.setStatus(0);//未入取
        tmpDO.setDel(1);
        tmpDO.setDoctorCode(recordDO.getOrgCode());
        tmpDO.setRelationCode(recordDO.getId());
        doctorPatientTmpDao.save(tmpDO);
        return result;
        return result;
    }
    }
@ -834,6 +855,15 @@ 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.setDel(1);
        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","门铃消息");
    }
}

+ 132 - 22
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,73 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return tmpList;
        return tmpList;
    }
    }
    public PageEnvelop getOrgDoctorByName(String doctor,String orgType,String name,Integer page ,Integer size){
        page = page>0?page-1:0;
        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+") ";
           String countSql = "select count(doc.id)\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+") ";
            String sqlCondition = "";
            if (StringUtils.isNotBlank(name)){
                sqlCondition += " and doc.name like '%"+name+"%' ";
            }
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){//查询通讯录机构与医生身份相同,只查询医生机构下的医生
                sqlCondition += " and dh.org_code= '"+doctorOrg.get(0)+"' ";
            }
            Long count = jdbcTemplate.queryForObject(countSql+sqlCondition,Long.class);
            sqlCondition +=" limit "+page*size+","+size;
            List<Map<String,Object>> tmpList = jdbcTemplate.queryForList(sql+sqlCondition);
            result.put("doctorList",tmpList);
            return PageEnvelop.getSuccessListWithPage("查询成功",tmpList,page,size,0L);
        }
       return PageEnvelop.getSuccessListWithPage("查询成功",new ArrayList(),page,size,0L);
    }
    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 +310,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,'1' as type from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select Distinct patient,'2' as type from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select Distinct patient,'4' as type from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " +
                " UNION " +
                " select tmp.patient,'3' as type 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,null as type 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 " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat(tmp.type) type,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 limit "+page*size+","+size;
        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(tmp.type) type,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 limit "+page*size+","+size;
             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,12 +382,19 @@ 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 " +
                " 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+"' " +
@ -313,7 +422,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            object.put("unreadMessageCount",unreadMessageCount);//未读消息数量
            object.put("unreadMessageCount",unreadMessageCount);//未读消息数量
            object.put("doorCoachOrder",coachOrderDOList.size());//上门辅导待完成数量
            object.put("doorCoachOrder",coachOrderDOList.size());//上门辅导待完成数量
            Integer unConsultMsgCount = imService.SessionsUnreadMessageCount(doctor,"23");
            Integer unConsultMsgCount = imService.SessionsUnreadMessageCount(doctor,"23");
            object.put("unConsultMsgCount",unConsultMsgCount);//咨询未读消息数量
            Integer unConsultMsgCount2 = imService.SessionsUnreadMessageCount(doctor,"24");
            object.put("unConsultMsgCount",unConsultMsgCount+unConsultMsgCount2);//咨询未读消息数量
            return object;
            return object;
//        }
//        }

+ 14 - 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,16 @@ 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.findByPatientAndDoctorCodeAndType(doorServiceOrder.getPatient(),doorServiceOrder.getDoctor(),2)==0){
            DoctorPatientTmpDO tmpDO = new DoctorPatientTmpDO();
            tmpDO.setDoctorCode(doorServiceOrder.getDoctor());
            tmpDO.setPatient(doorServiceOrder.getPatient());
            tmpDO.setType(2);
            tmpDO.setDel(1);
            tmpDO.setRelationCode(doorServiceOrder.getId());
            doctorPatientTmpDao.save(tmpDO);
        }
    }
    }
    /**
    /**

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

@ -83,7 +83,7 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
    }
    }
    public PageEnvelop<List<Map<String,Object>>> archiveList(String doctorId, int page, int size,Integer signStatus,String name){
    public PageEnvelop<List<Map<String,Object>>> archiveList(String doctorId, int page, int size,Integer signStatus,String name){
        String sql = "SELECT a.create_time,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status ";
        String sql = " select * from ( SELECT a.create_time,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status ";
        String countSql = "SELECT count(*) from ( ";
        String countSql = "SELECT count(*) from ( ";
        String filters = "from wlyy_archive a,base_patient p " +
        String filters = "from wlyy_archive a,base_patient p " +
@ -97,7 +97,7 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        if(StringUtils.isNotBlank(name)){
        if(StringUtils.isNotBlank(name)){
            filters += " and p.name like '%"+name+"%'";
            filters += " and p.name like '%"+name+"%'";
        }
        }
        if (signStatus!=null&&signStatus==1){//已签约不按建档查询,是要该居民服务医生就在列表中
        if (signStatus!=null&&signStatus==1){//已签约不按建档查询,只要该居民服务医生就在列表中
            filters+=" UNION " +
            filters+=" UNION " +
                    " SELECT a.create_time,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status \n" +
                    " SELECT a.create_time,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status \n" +
                    "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                    "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
@ -113,8 +113,9 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
            }
            }
            filters+= " and m.del = '1' and sr.`status`=1 ) ";
            filters+= " and m.del = '1' and sr.`status`=1 ) ";
        }
        }
        filters+= " )tmp GROUP BY tmp.id ";
        String orderBy = " ORDER BY create_time DESC " +
        String orderBy = "  ORDER BY tmp.create_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);

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

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 123 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java


+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java

@ -59,7 +59,7 @@ public class FinishConsultJob implements Job {
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("WHERE s.id = t.session_id AND s.type=23  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("ORDER BY t.create_time");
            .append("ORDER BY t.create_time");
@ -82,7 +82,7 @@ public class FinishConsultJob implements Job {
            sql = new StringBuffer();
            sql = new StringBuffer();
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("WHERE s.id = t.session_id AND s.type=23 AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
            StringBuffer sql2 = new StringBuffer();
            StringBuffer sql2 = new StringBuffer();

+ 73 - 64
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -14,6 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
/**
/**
@ -32,75 +33,80 @@ public class MessageUtil {
    @Autowired
    @Autowired
    private TXYSmsService txySmsService;
    private TXYSmsService txySmsService;
    @Value("${sendTXMessage.flag}")
    private Boolean sendTXMessageFlag;
    private static Logger logger = LoggerFactory.getLogger(MessageUtil.class);
    private static Logger logger = LoggerFactory.getLogger(MessageUtil.class);
    public void putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first
    public void putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first
            ,String url, String remark, Integer type,JSONObject json,String ...keywords) {
            ,String url, String remark, Integer type,JSONObject json,String ...keywords) {
        try {
        try {
            System.out.println(wechatId);
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (sendTXMessageFlag){
                System.out.println(wechatId);
                WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (wxAccessTokenDO == null) {
                logger.info("wx_access_token表获取为空,wechatId" + wechatId);
                return;
            }
            WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            BeanUtils.copyProperties(templateConfig,newConfig);
            if (newConfig == null) {
                logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
                return;
            }
            logger.info("微信模板推送前");
            if (StringUtils.isNoneBlank(first)){
                newConfig.setFirst(first);
            }
            if (StringUtils.isNoneBlank(url)){
                newConfig.setUrl(url);
            }
            if (StringUtils.isNoneBlank(remark)){
                newConfig.setRemark(remark);
            }
            newConfig = setTemPlateUrl(newConfig,type,openId,json);
            int keyLength = keywords.length;
            if (keyLength >= 1) {
                if(StringUtils.isNoneBlank(keywords[0])){
                    newConfig.setKeyword1(keywords[0]);
                if (wxAccessTokenDO == null) {
                    logger.info("wx_access_token表获取为空,wechatId" + wechatId);
                    return;
                }
                }
            }
            if (keyLength >= 2) {
                if(StringUtils.isNoneBlank(keywords[1])){
                    newConfig.setKeyword2(keywords[1]);
                WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
                WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                BeanUtils.copyProperties(templateConfig,newConfig);
                if (newConfig == null) {
                    logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
                    return;
                }
                }
            }
            if (keyLength >= 3) {
                if(StringUtils.isNoneBlank(keywords[2])){
                    newConfig.setKeyword3(keywords[2]);
                logger.info("微信模板推送前");
                if (StringUtils.isNoneBlank(first)){
                    newConfig.setFirst(first);
                }
                }
            }
            if (keyLength >= 4) {
                if(StringUtils.isNoneBlank(keywords[3])){
                    newConfig.setKeyword4(keywords[3]);
                if (StringUtils.isNoneBlank(url)){
                    newConfig.setUrl(url);
                }
                }
            }
            if (keyLength >= 5) {
                if(StringUtils.isNoneBlank(keywords[4])){
                    newConfig.setKeyword5(keywords[4]);
                if (StringUtils.isNoneBlank(remark)){
                    newConfig.setRemark(remark);
                }
                }
            }
            if (keyLength >= 6) {
                if(StringUtils.isNoneBlank(keywords[5])){
                    newConfig.setKeyword6(keywords[5]);
                newConfig = setTemPlateUrl(newConfig,type,openId,json);
                int keyLength = keywords.length;
                if (keyLength >= 1) {
                    if(StringUtils.isNoneBlank(keywords[0])){
                        newConfig.setKeyword1(keywords[0]);
                    }
                }
                }
            }
            if (keyLength >= 7) {
                if(StringUtils.isNoneBlank(keywords[6])){
                    newConfig.setKeyword7(keywords[6]);
                if (keyLength >= 2) {
                    if(StringUtils.isNoneBlank(keywords[1])){
                        newConfig.setKeyword2(keywords[1]);
                    }
                }
                if (keyLength >= 3) {
                    if(StringUtils.isNoneBlank(keywords[2])){
                        newConfig.setKeyword3(keywords[2]);
                    }
                }
                if (keyLength >= 4) {
                    if(StringUtils.isNoneBlank(keywords[3])){
                        newConfig.setKeyword4(keywords[3]);
                    }
                }
                }
                if (keyLength >= 5) {
                    if(StringUtils.isNoneBlank(keywords[4])){
                        newConfig.setKeyword5(keywords[4]);
                    }
                }
                if (keyLength >= 6) {
                    if(StringUtils.isNoneBlank(keywords[5])){
                        newConfig.setKeyword6(keywords[5]);
                    }
                }
                if (keyLength >= 7) {
                    if(StringUtils.isNoneBlank(keywords[6])){
                        newConfig.setKeyword7(keywords[6]);
                    }
                }
                //发起微信消息模板推送
                weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), openId, newConfig);
                logger.info("微信模板消息推送后");
            }
            }
            //发起微信消息模板推送
            weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), openId, newConfig);
            logger.info("微信模板消息推送后");
        } catch (Exception e) {
        } catch (Exception e) {
            logger.info("微信模板推送异常");
            logger.info("微信模板推送异常");
            e.printStackTrace();
            e.printStackTrace();
@ -121,15 +127,18 @@ public class MessageUtil {
    }
    }
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
        JSONObject sendObj = new JSONObject();
        sendObj.put("templateCode",templateCode);
        if (params.length>0){
            JSONArray paramArr =JSONArray.parseArray(JSON.toJSONString(params));
            sendObj.put("templateParamArr",paramArr);
        }else {
            JSONArray paramArr =new JSONArray();
            sendObj.put("templateParamArr",paramArr);
        if (sendTXMessageFlag){
            JSONObject sendObj = new JSONObject();
            sendObj.put("templateCode",templateCode);
            if (params.length>0){
                JSONArray paramArr =JSONArray.parseArray(JSON.toJSONString(params));
                sendObj.put("templateParamArr",paramArr);
            }else {
                JSONArray paramArr =new JSONArray();
                sendObj.put("templateParamArr",paramArr);
            }
            return txySmsService.sendMessageJson(mobile,sendObj);
        }
        }
        return txySmsService.sendMessageJson(mobile,sendObj);
        return null;
    }
    }
}
}

+ 5 - 7
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/web/JobController.java

@ -257,14 +257,12 @@ public class JobController extends BaseController {
    @RequestMapping(value = "/testNow", method = RequestMethod.POST)
    @RequestMapping(value = "/testNow", method = RequestMethod.POST)
    @ApiOperation("立即执行")
    @ApiOperation("立即执行")
    public String executeSignFamilyPayResultJob() {
    public String executeSignFamilyPayResultJob(String className) {
        try {
        try {
//            quartzHelper.removeJob("finish_consult_job3");
//            quartzHelper.removeJob("finish_consult_job4");
            quartzHelper.removeJob("PATIENT_SEND_UNREAD_MES_JOB3");
//            quartzHelper.startNow(FinishConsultJob.class, "finish_consult_job3", null);
//            quartzHelper.startNow(DoctorSendUnreadJob.class, "finish_consult_job4", null);
            quartzHelper.startNow(PatientSendUnreadJob.class, "PATIENT_SEND_UNREAD_MES_JOB3", null);
            String uuid = getUID();
            Class c1 = Class.forName(className);//com.yihu.jw.care.job.consult.FinishConsultJob
            quartzHelper.startNow(c1, uuid, null);
            quartzHelper.removeJob(uuid);
            return write(200, "启动成功");
            return write(200, "启动成功");
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);

+ 10 - 0
svr/svr-cloud-job/src/main/resources/application.yml

@ -100,6 +100,10 @@ cloudServer:
  server_url: http://172.26.0.107:10301/
  server_url: http://172.26.0.107:10301/
pay:
pay:
  flag: true
  flag: true
##是否发送短信消息 无测试公众号测试线也不发送模板消息
sendTXMessage:
  flag: false
---
---
spring:
spring:
  profiles: jwprod
  profiles: jwprod
@ -142,6 +146,9 @@ cloudServer:
  server_url: http://172.26.0.12:10301/
  server_url: http://172.26.0.12:10301/
pay:
pay:
  flag: true
  flag: true
##是否发送短信消息
sendTXMessage:
  flag: true
---
---
spring:
spring:
  profiles: hzprod
  profiles: hzprod
@ -197,3 +204,6 @@ cloudServer:
  server_url: http://10.18.43.41:10301/
  server_url: http://10.18.43.41:10301/
pay:
pay:
  flag: true
  flag: true
##是否发送短信消息
sendTXMessage:
  flag: true