Parcourir la source

1.8.2 消息推送管理

wsl il y a 2 ans
Parent
commit
4c7d8d35bd
21 fichiers modifiés avec 376 ajouts et 110 suppressions
  1. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java
  2. 19 1
      common/common-entity/sql记录
  3. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  4. 0 1
      common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushRecordLogEntity.java
  5. 7 0
      svr/svr-base/src/main/java/com/yihu/SvrBaseApplication.java
  6. 71 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/ManageMessagePush/ManageSystemPushMessageController.java
  7. 28 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/ManageMessagePush/ManageSystemPushMessageService.java
  8. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/log/BasePushRecordLogDao.java
  9. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/log/BasePushrecordLogInfoDao.java
  10. 24 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java
  11. 26 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  12. 15 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  13. 1 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  14. 8 0
      svr/svr-cloud-job/src/main/java/com/yihu/CloudApplicationJob.java
  15. 3 3
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java
  16. 14 7
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceOffLoneJob.java
  17. 12 7
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceWatchOffWearJob.java
  18. 12 7
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PressureGlucoseNotJob.java
  19. 4 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/pushRecord/PushRecordJob.java
  20. 92 56
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java
  21. 3 3
      svr/svr-cloud-job/src/main/resources/system.properties

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java

@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.List;
@ -53,5 +54,10 @@ public interface WlyyHospitalSysDictDao extends PagingAndSortingRepository<WlyyH
    @Query("from WlyyHospitalSysDictDO where dictName = ?1 and sort>?2")
    @Query("from WlyyHospitalSysDictDO where dictName = ?1 and sort>?2")
    List<WlyyHospitalSysDictDO> findByDictNameAndSortNear(String dictName,Integer sort);
    List<WlyyHospitalSysDictDO> findByDictNameAndSortNear(String dictName,Integer sort);
    @Modifying
    @Transactional
    @Query("update WlyyHospitalSysDictDO set pyCode =?1 where id=?2 and dictName =?3")
    void updatePyCode(String pyCode,String id,String dictName);
}
}

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

@ -1924,4 +1924,22 @@ CREATE TABLE `base_pushrecord_log_info` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='推送记录日志明细';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='推送记录日志明细';
ALTER TABLE base_system_message ADD audio_url VARCHAR(500) COMMENT '语音地址';
ALTER TABLE base_system_message ADD audio_url VARCHAR(500) COMMENT '语音地址';
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageStatus1', NULL, 'pushMessageStatus', '1', '待发送', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageStatus2', NULL, 'pushMessageStatus', '2', '已发送', NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType0', NULL, 'pushMessageType', '0', '全部', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType1', NULL, 'pushMessageType', '1', '主动推送', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType2', NULL, 'pushMessageType', '2', '生日祝福', NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType3', NULL, 'pushMessageType', '3', '智能手表佩戴提示', NULL, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType4', NULL, 'pushMessageType', '4', '智能手表电量提示', NULL, 4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType5', NULL, 'pushMessageType', '5', '报警器电量提示', NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushMessageType6', NULL, 'pushMessageType', '6', '设备离线提示', NULL, 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushOnOff1', NULL, 'pushOnOff', '1', '生日祝福', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushOnOff2', NULL, 'pushOnOff', '2', '智能手表佩戴提示', NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushOnOff3', NULL, 'pushOnOff', '3', '智能手表电量提示', NULL, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushOnOff4', NULL, 'pushOnOff', '4', '报警器电量提示', NULL, 4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushOnOff5', NULL, 'pushOnOff', '5', '设备离线提示', NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('pushOnOff6', NULL, 'pushOnOff', '6', '体征监测提醒', NULL, 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

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

@ -21,7 +21,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     * 人文关怀系统消息 41
     * 人文关怀系统消息 41
     * 体征设备测量系统消息 42
     * 体征设备测量系统消息 42
     * 设备离线系统消息 43
     * 设备离线系统消息 43   推送给家属 社工  助老员
     * 监护确认消息 44
     * 监护确认消息 44
     * 家属紧急预警系统消息 50
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 新生儿在线咨询 850
@ -31,7 +31,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     * 智能手表佩戴提示 991
     * 智能手表佩戴提示 991
     * 智能手表电量提示 992
     * 智能手表电量提示 992
     * 报警器电量提示 993
     * 报警器电量提示 993
     * 设备离线提示 994
     * 设备离线提示 994   推送给 老人Pad
     * 人工手动系统推送 999
     * 人工手动系统推送 999
     */
     */
    private String type;
    private String type;

+ 0 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushRecordLogEntity.java

@ -54,7 +54,6 @@ public class BasePushRecordLogEntity extends UuidIdentityEntity {
        this.content = content;
        this.content = content;
    }
    }
    @Column(name = "push_type")
    public String getPushType() {
    public String getPushType() {
        return pushType;
        return pushType;
    }
    }

+ 7 - 0
svr/svr-base/src/main/java/com/yihu/SvrBaseApplication.java

@ -8,6 +8,7 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate;
import javax.servlet.MultipartConfigElement;
import javax.servlet.MultipartConfigElement;
@ -35,4 +36,10 @@ public class SvrBaseApplication extends SpringBootServletInitializer {
        return factory.createMultipartConfig();
        return factory.createMultipartConfig();
    }
    }
    @Bean//将RestTemplate注册到容器
    public RestTemplate RestTemplate(){
        return new RestTemplate();
    }
}
}

+ 71 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/ManageMessagePush/ManageSystemPushMessageController.java

@ -2,6 +2,7 @@ package com.yihu.jw.base.endpoint.ManageMessagePush;
import com.yihu.jw.base.service.ManageMessagePush.ManageSystemPushMessageService;
import com.yihu.jw.base.service.ManageMessagePush.ManageSystemPushMessageService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -9,10 +10,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.List;
@ -43,6 +41,75 @@ public class ManageSystemPushMessageController extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @ApiOperation("开关")
    @PostMapping(value = "/pushOnOff")
    public Envelop pushOnOff(@ApiParam(name = "pyCode",value = "开关状态",required = true)
                             @RequestParam(value = "pyCode",required = true)String pyCode,
                             @ApiParam(name = "dictName",value = "字典名字",required = true)
                             @RequestParam(value = "dictName",required = true)String dictName,
                             @ApiParam(name = "id",value = "字典id",required = true)
                             @RequestParam(value = "id",required = true)String id){
        try {
            mspmservice.pushOnOff(id,dictName,pyCode);
            return success("修改成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException(e);
        }
    }
    @ApiOperation("获取推送记录列表")
    @PostMapping(value = "/pushMessageList")
    public ListEnvelop pushMessageList(@ApiParam(name = "messageType",value = "消息类型",required = false)
                                       @RequestParam(value = "messageType",required = false)Integer messageType,
                                       @ApiParam(name = "status",value = "状态",required = false)
                                       @RequestParam(value = "status",required = false)Integer status,
                                       @ApiParam(name = "name",value = "名字查找",required = false)
                                       @RequestParam(value = "name",required = false)String name,
                                       @RequestParam(value = "page",required = true)Integer page,
                                       @RequestParam(value = "pageSize",required = true)Integer pageSize){
        try {
            return success(mspmservice.pushMessageList(messageType,status,name,page,pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException2(e);
        }
    }
    @ApiOperation("删除列表")
    @PostMapping(value = "/delPushMessageLog")
    public Envelop delPushMessageLog(@RequestParam(value = "id",required = true)String id){
        try {
            mspmservice.delPushMessageLog(id);
            return success("删除成功");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException(e);
        }
    }
    @ApiOperation("添加推送")
    @PostMapping(value = "/addPushMessage")
    public Envelop addPushMessage(@ApiParam(name = "content", value = "推送消息", required = true)
                                  @RequestParam(value = "content", required = true) String content,
                                  @ApiParam(name = "pushObjectType", value = "推送对象类型 1签约老人,2部分签约老人", required = true)
                                  @RequestParam(value = "pushObjectType", required = true) Integer pushObjectType,
                                  @ApiParam(name = "pushObjectJson", value = "推送对象", required = false)
                                  @RequestParam(value = "pushObjectJson", required = false) String pushObjectJson,
                                  @ApiParam(name = "pushDateType", value = "推送类型 1立即发送 2 定时发送", required = true)
                                  @RequestParam(value = "pushDateType", required = true) Integer pushDateType,
                                  @ApiParam(name = "pushDate", value = "推送时间 定时发送才传", required = false)
                                  @RequestParam(value = "pushDate", required = false) String pushDate) {
        try {
            mspmservice.addPushMessage(content,pushObjectType,pushObjectJson,pushDateType,pushDate);
            return success("添加成功");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException(e);
        }
    }
}
}

+ 28 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/ManageMessagePush/ManageSystemPushMessageService.java

@ -7,14 +7,17 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.Date;
@ -36,6 +39,10 @@ public class ManageSystemPushMessageService {
    private BasePushRecordLogDao basePushRecordLogDao;
    private BasePushRecordLogDao basePushRecordLogDao;
    @Autowired
    @Autowired
    private BasePushrecordLogInfoDao basePushrecordLogInfoDao;
    private BasePushrecordLogInfoDao basePushrecordLogInfoDao;
    @Autowired
    private WlyyHospitalSysDictDao dictDao;
    @Autowired
    private RestTemplate restTemplate;
    /*   SELECT p.id,p.name  FROM base_patient p INNER JOIN wlyy_patient_device d ON p.id = d.`user`
    /*   SELECT p.id,p.name  FROM base_patient p INNER JOIN wlyy_patient_device d ON p.id = d.`user`
    WHERE p.sign_status = 0 AND p.del = 1 AND d.del = 0 AND p.id NOT IN ( SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` WHERE `dict_name` = 'jkzl_older' OR dict_name = 'jkzl_child' )*/
    WHERE p.sign_status = 0 AND p.del = 1 AND d.del = 0 AND p.id NOT IN ( SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` WHERE `dict_name` = 'jkzl_older' OR dict_name = 'jkzl_child' )*/
@ -69,7 +76,7 @@ public class ManageSystemPushMessageService {
     * @param pushDate
     * @param pushDate
     */
     */
    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public void addMessage(String content, Integer pushObjectType, String pushObjectJson, Integer pushDateType, String pushDate) {
    public void addPushMessage(String content, Integer pushObjectType, String pushObjectJson, Integer pushDateType, String pushDate) {
        BasePushRecordLogEntity basePushRecordLogEntity = new BasePushRecordLogEntity();
        BasePushRecordLogEntity basePushRecordLogEntity = new BasePushRecordLogEntity();
        List<BasePatientDO> basePatientDOS = null;
        List<BasePatientDO> basePatientDOS = null;
        List<BasePushrecordLogInfoEntity> basePushrecordLogInfoEntityList = null;
        List<BasePushrecordLogInfoEntity> basePushrecordLogInfoEntityList = null;
@ -94,6 +101,7 @@ public class ManageSystemPushMessageService {
            SystemMessageDOListSave(basePatientDOS,content);
            SystemMessageDOListSave(basePatientDOS,content);
            basePushRecordLogEntity.setStatus(1);
            basePushRecordLogEntity.setStatus(1);
            basePushRecordLogEntity.setSendTime(new Date());
            basePushRecordLogEntity.setSendTime(new Date());
            basePushRecordLogEntity.setPushType("1");
        }else {
        }else {
            //创建定时任务记录
            //创建定时任务记录
            basePatientDOS.forEach(logInfoDO->{
            basePatientDOS.forEach(logInfoDO->{
@ -109,13 +117,15 @@ public class ManageSystemPushMessageService {
            });
            });
            basePushRecordLogEntity.setSendTime(date);
            basePushRecordLogEntity.setSendTime(date);
            basePushRecordLogEntity.setStatus(0);
            basePushRecordLogEntity.setStatus(0);
            basePushRecordLogEntity.setPushType("2");
        }
        }
        //日志保存
        //日志保存
        //basePushRecordLogEntity.setId(UUID.randomUUID().toString().replace("-", ""));
        //basePushRecordLogEntity.setId(UUID.randomUUID().toString().replace("-", ""));
        basePushRecordLogEntity.setContent(content);
        basePushRecordLogEntity.setContent(content);
        basePushRecordLogEntity.setPushType("人工推送");
        basePushRecordLogEntity.setNum(basePatientDOS.size());
        basePushRecordLogEntity.setNum(basePatientDOS.size());
        basePushRecordLogEntity.setMessageType(1);
        basePushRecordLogDao.save(basePushRecordLogEntity);
        basePushRecordLogDao.save(basePushRecordLogEntity);
        if (basePushrecordLogInfoEntityList.size()>0) {
        if (basePushrecordLogInfoEntityList.size()>0) {
@ -175,13 +185,14 @@ public class ManageSystemPushMessageService {
            systemMessageDO.setType("999");
            systemMessageDO.setType("999");
            systemMessageDO.setIsRead("0");
            systemMessageDO.setIsRead("0");
            systemMessageDO.setSender("system");
            systemMessageDO.setSender("system");
            systemMessageDO.setSenderName("人工推送助手");
            systemMessageDO.setSenderName("系统推送助手");
            systemMessageDO.setReceiver(basePatientDO.getId());
            systemMessageDO.setReceiver(basePatientDO.getId());
            systemMessageDO.setReceiverName(basePatientDO.getName());
            systemMessageDO.setReceiverName(basePatientDO.getName());
            systemMessageDO.setData(content);
            systemMessageDO.setData(content);
            systemMessageDO.setOver("1");
            systemMessageDO.setOver("1");
            systemMessageDO.setDel("1");
            systemMessageDO.setDel("1");
            systemMessageDO.setCreateTime(new Date());
            systemMessageDO.setCreateTime(new Date());
            systemMessageDO.setAudioUrl(audioUrl(content));
            messageDOS.add(systemMessageDO);
            messageDOS.add(systemMessageDO);
        }
        }
        systemMessageDao.save(messageDOS);
        systemMessageDao.save(messageDOS);
@ -202,7 +213,21 @@ public class ManageSystemPushMessageService {
    //推送开关修改
    public void pushOnOff(String id,String dictName,String pyCode) {
        dictDao.updatePyCode(pyCode,id,dictName);
    }
    public String audioUrl(String content){
        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://svr-cloud-care:10301/common/open/wordToVoice?text={1}", String.class, content);
        JSONObject jsonObject = JSONObject.parseObject(forEntity.getBody());
        if (jsonObject.getInteger("status") == 200){
            return jsonObject.getString("message");
        }else {
            return null;
        }
    }

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/log/BasePushRecordLogDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.log;
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by wsl on 2022/7/4
 */
public interface BasePushRecordLogDao extends PagingAndSortingRepository<BasePushRecordLogEntity, String>, JpaSpecificationExecutor<BasePushRecordLogEntity> {
    @Query("from BasePushRecordLogEntity")
    List<BasePushRecordLogEntity> findAll();
}

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/log/BasePushrecordLogInfoDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.care.dao.log;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/7/5
 */
public interface BasePushrecordLogInfoDao extends PagingAndSortingRepository<BasePushrecordLogInfoEntity, String>, JpaSpecificationExecutor<BasePushrecordLogInfoEntity> {
}

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

@ -3,17 +3,17 @@ package com.yihu.jw.care.endpoint.doctor;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.dao.log.BasePushRecordLogDao;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -23,6 +23,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestParam;
@ -58,6 +59,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    private PermissionService permissionService;
    private PermissionService permissionService;
    @Value("${demo.flag}")
    @Value("${demo.flag}")
    private Boolean demoFlag;
    private Boolean demoFlag;
    @Autowired
    private BasePushRecordLogDao pushRecordLogDao;
    @RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
    @RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "创建模板")
    @ApiOperation(value = "创建模板")
@ -256,6 +259,7 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
            new Thread(() -> {
            new Thread(() -> {
                sender(birthDayWishesToPatientESList);
                sender(birthDayWishesToPatientESList);
            }).start();
            }).start();
            savePushLog(patient);
            return write(200, "发送成功!");
            return write(200, "发送成功!");
        } catch (Exception e) {
        } catch (Exception e) {
            return errorResult(e);
            return errorResult(e);
@ -332,6 +336,24 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    }
    }
    @Transactional(rollbackFor = Exception.class)
    public void savePushLog(String patient){
        String[] split = patient.split(",");
        BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
        logEntity.setCreateTime(new Date());
        logEntity.setPushType("3");
        logEntity.setContent("生日祝福");
        logEntity.setMessageType(2);
        logEntity.setSendTime(new Date());
        logEntity.setNum(split.length);
        logEntity.setSendObject(patient);
        logEntity.setSendObjectType(2);
        logEntity.setStatus(1);
        logEntity.setMessageType(2);
        pushRecordLogDao.save(logEntity);
    }
    /*******************************************助老员部分*********************************************************************/
    /*******************************************助老员部分*********************************************************************/
    @ApiOperation("获取生日居民列表")
    @ApiOperation("获取生日居民列表")
    @RequestMapping(value = "helper/getBirthdayPatientList", method = RequestMethod.GET)
    @RequestMapping(value = "helper/getBirthdayPatientList", method = RequestMethod.GET)

+ 26 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java

@ -15,8 +15,6 @@ import io.swagger.annotations.ApiParam;
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.List;
/**
/**
 * Created by Bing on 2021/5/19.
 * Created by Bing on 2021/5/19.
 */
 */
@ -90,7 +88,7 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    }
    }
    @GetMapping(value = "getSystemMessageListPad")
    @GetMapping(value = "getSystemMessageListPad")
    @ApiOperation("居民平板端获取消息列表(生日祝福,体征设备)")
    @ApiOperation("居民平板端获取消息列表(生日祝福,体征设备) ")
    public ListEnvelop getUnreadSystemMessageListPad(@ApiParam(name = "patient",required = true)
    public ListEnvelop getUnreadSystemMessageListPad(@ApiParam(name = "patient",required = true)
                                            @RequestParam(value = "patient")String patient,
                                            @RequestParam(value = "patient")String patient,
                                            @ApiParam(name = "type",required = true)
                                            @ApiParam(name = "type",required = true)
@ -105,6 +103,31 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @GetMapping(value ="/envMessagePad")
    @ApiOperation("居民端Pad获取天气信息")
    public ObjEnvelop envMessagePad(){
        try {
            return ObjEnvelop.getSuccess("查询成功",patientMessageService.envMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException2(e);
        }
    }
    @ApiOperation("pad端获取消息列表  1.8.2 新增接口")
    @GetMapping(value = "/getSystemMessageListPadTwo")
    public ListEnvelop getSystemMessageListPad(@ApiParam(name = "patient", required = true)
                                               @RequestParam(value = "patient", required = true) String patient,
                                               @ApiParam(name = "type", value = "类型", required = true)
                                               @RequestParam(value = "type", required = true) String type) {
        try {
            return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessageListPad(patient, type));
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException2(e);
        }
    }
    @PostMapping(value = "/updateMessageRead")
    @PostMapping(value = "/updateMessageRead")
    @ApiOperation("已读消息")
    @ApiOperation("已读消息")
    @ObserverRequired
    @ObserverRequired

+ 15 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -1,20 +1,15 @@
package com.yihu.jw.care.service.message;
package com.yihu.jw.care.service.message;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaConfirmDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaConfirmDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.security.BaseEmergencyWarnLogDao;
import com.yihu.jw.care.dao.security.BaseEmergencyWarnLogDao;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.PatientSafeAreaConfirm;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
@ -26,15 +21,10 @@ import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.text.MessageFormat;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -62,6 +52,8 @@ public class PatientMessageService {
    private PatientSafeAreaConfirmDao patientSafeAreaConfirmDao;
    private PatientSafeAreaConfirmDao patientSafeAreaConfirmDao;
    @Autowired
    @Autowired
    private PatientDeviceService patientDeviceService;
    private PatientDeviceService patientDeviceService;
    @Autowired
    private EmergencyAssistanceService emergencyAssistanceService;
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
        page = page>0?page-1:0;
        page = page>0?page-1:0;
@ -150,6 +142,18 @@ public class PatientMessageService {
        return jdbcTemplate.queryForList(sql);
        return jdbcTemplate.queryForList(sql);
    }
    }
    //获取天气
    public JSONObject envMessage(){
        return emergencyAssistanceService.getBaiduWeather();
    }
    public List<Map<String,Object>> getSystemMessageListPad(String patient,String type){
        String sql = "SELECT id,type,title,sender_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,is_read,data,content,audio_url FROM base_system_message WHERE type IN ("+type+") and receiver = '"+patient+"'" +
                " AND del = 1  ORDER BY create_time DESC ";
        return  jdbcTemplate.queryForList(sql);
    }
    public void updateMessageRead(String messageId){
    public void updateMessageRead(String messageId){
        SystemMessageDO messageDO = systemMessageDao.findOne(messageId);
        SystemMessageDO messageDO = systemMessageDao.findOne(messageId);
        messageDO.setIsRead("1");
        messageDO.setIsRead("1");

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -87,6 +87,7 @@ public class MessageUtil {
        }
        }
    }
    }
    /**
    /**
     * 发送医生个推推送消息
     * 发送医生个推推送消息
     * type 1 安防紧急预警 2紧急呼叫 4im 5生日祝福
     * type 1 安防紧急预警 2紧急呼叫 4im 5生日祝福

+ 8 - 0
svr/svr-cloud-job/src/main/java/com/yihu/CloudApplicationJob.java

@ -4,8 +4,10 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
/**
/**
 * Created by yeshijie on 2021/5/28.
 * Created by yeshijie on 2021/5/28.
@ -23,4 +25,10 @@ public class CloudApplicationJob extends SpringBootServletInitializer {
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(CloudApplicationJob.class);
        return builder.sources(CloudApplicationJob.class);
    }
    }
    @Bean//将RestTemplate注册到容器
    public RestTemplate RestTemplate(){
        return new RestTemplate();
    }
}
}

+ 3 - 3
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java

@ -240,10 +240,10 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            //手表未佩戴
            //手表未佩戴
            if (!quartzHelper.isExistJob("DEVICE_WATCH_OFF_WEAR_JOB")){
            if (!quartzHelper.isExistJob("DEVICE_WATCH_OFF_WEAR_JOB")){
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("DEVICE_WATCH_OFF_WEAR_JOB");
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("DEVICE_WATCH_OFF_WEAR_JOB");
                quartzHelper.addJob(DeviceOffLoneJob.class,trigger,"PUSH_DEVICE_OFF_LONE_JOB",new HashMap<String, Object>() );
                logger.info("PUSH_DEVICE_OFF_LONE_JOB success");
                quartzHelper.addJob(DeviceOffLoneJob.class,trigger,"DEVICE_WATCH_OFF_WEAR_JOB",new HashMap<String, Object>() );
                logger.info("DEVICE_WATCH_OFF_WEAR_JOB success");
            }else {
            }else {
                logger.info("PUSH_DEVICE_OFF_LONE_JOB exist");
                logger.info("DEVICE_WATCH_OFF_WEAR_JOB exist");
            }
            }
            //手表 报警器 合并 电量低
            //手表 报警器 合并 电量低

+ 14 - 7
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceOffLoneJob.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.job.device;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import org.quartz.Job;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobExecutionException;
@ -19,15 +20,21 @@ public class DeviceOffLoneJob implements Job {
    @Autowired
    @Autowired
    private PatientDeviceService patientDeviceService;
    private PatientDeviceService patientDeviceService;
    @Autowired
    private DeviceLostMessageUtil deviceLostMessageUtil;
    @Override
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("DeviceOffLoneJob start");
        try {
            patientDeviceService.selectAndUpdate(false);
            logger.info("DeviceOffLoneJob end");
        } catch (Exception e) {
            logger.info("DeviceOffLoneJob --ERROR MSG:"+e.getMessage());
            e.printStackTrace();
        if (deviceLostMessageUtil.messageOnOff(5) ) {
            logger.info("DeviceOffLoneJob start");
            try {
                patientDeviceService.selectAndUpdate(false);
                logger.info("DeviceOffLoneJob end");
            } catch (Exception e) {
                logger.info("DeviceOffLoneJob --ERROR MSG:"+e.getMessage());
                e.printStackTrace();
            }
        }
        }
    }
    }

+ 12 - 7
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceWatchOffWearJob.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.job.device;
package com.yihu.jw.care.job.device;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import org.quartz.Job;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobExecutionException;
@ -18,15 +19,19 @@ public class DeviceWatchOffWearJob implements Job {
    @Autowired
    @Autowired
    private PatientDeviceService patientDeviceService;
    private PatientDeviceService patientDeviceService;
    @Autowired
    private DeviceLostMessageUtil deviceLostMessageUtil;
    @Override
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("DeviceWatchOffWearJob start");
        try {
            patientDeviceService.deviceWatchWearInfo();
            logger.info("DeviceWatchOffWearJob end");
        } catch (Exception e) {
            logger.info("DeviceWatchOffWearJob --ERROR MSG:"+e.getMessage());
            e.printStackTrace();
        if (deviceLostMessageUtil.messageOnOff(2)){
            logger.info("DeviceWatchOffWearJob start");
            try {
                patientDeviceService.deviceWatchWearInfo();
                logger.info("DeviceWatchOffWearJob end");
            } catch (Exception e) {
                logger.info("DeviceWatchOffWearJob --ERROR MSG:"+e.getMessage());
                e.printStackTrace();
            }
        }
        }
    }
    }
}
}

+ 12 - 7
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PressureGlucoseNotJob.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.job.device;
package com.yihu.jw.care.job.device;
import com.yihu.jw.care.service.device.PressureGlucoseNotService;
import com.yihu.jw.care.service.device.PressureGlucoseNotService;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionContext;
@ -19,16 +20,20 @@ public class PressureGlucoseNotJob implements Job {
    @Autowired
    @Autowired
    private PressureGlucoseNotService pressureGlucoseNotService;
    private PressureGlucoseNotService pressureGlucoseNotService;
    @Autowired
    private DeviceLostMessageUtil deviceLostMessageUtil;
    @Override
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED job start");
        try {
            pressureGlucoseNotService.sendNotice();
            logger.info("BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED job end");
        }catch (Exception e){
            e.printStackTrace();
            logger.info("BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED job end===ERROE===,message:"+e.getMessage());
        if (deviceLostMessageUtil.messageOnOff(6)) {
            logger.info("BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED job start");
            try {
                pressureGlucoseNotService.sendNotice();
                logger.info("BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED job end");
            }catch (Exception e){
                e.printStackTrace();
                logger.info("BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED job end===ERROE===,message:"+e.getMessage());
            }
        }
        }
    }
    }
}
}

+ 4 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/pushRecord/PushRecordJob.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.job.pushRecord;
import com.yihu.jw.care.dao.pushLog.BasePushRecordLogDao;
import com.yihu.jw.care.dao.pushLog.BasePushRecordLogDao;
import com.yihu.jw.care.dao.pushLog.BasePushrecordLogInfoDao;
import com.yihu.jw.care.dao.pushLog.BasePushrecordLogInfoDao;
import com.yihu.jw.care.util.DateUtil;
import com.yihu.jw.care.util.DateUtil;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
@ -38,6 +39,8 @@ public class PushRecordJob implements Job {
    private BasePushrecordLogInfoDao basePushrecordLogInfoDao;
    private BasePushrecordLogInfoDao basePushrecordLogInfoDao;
    @Autowired
    @Autowired
    private SystemMessageDao systemMessageDao;
    private SystemMessageDao systemMessageDao;
    @Autowired
    private DeviceLostMessageUtil devicelostMessageUtil;
    @Override
    @Override
@ -63,6 +66,7 @@ public class PushRecordJob implements Job {
                systemMessageDO.setContent(basePushrecordLogInfoEntity.getContent());
                systemMessageDO.setContent(basePushrecordLogInfoEntity.getContent());
                systemMessageDO.setOver("1");
                systemMessageDO.setOver("1");
                systemMessageDO.setDel("1");
                systemMessageDO.setDel("1");
                systemMessageDO.setAudioUrl(devicelostMessageUtil.audioUrl(basePushrecordLogInfoEntity.getContent()));
                systemMessageDO.setCreateTime(new Date());
                systemMessageDO.setCreateTime(new Date());
                messageDOS.add(systemMessageDO);
                messageDOS.add(systemMessageDO);
            }
            }

+ 92 - 56
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -12,9 +12,12 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.Date;
@ -42,6 +45,9 @@ public class DeviceLostMessageUtil {
    @Autowired
    @Autowired
    BasePushRecordLogDao basePushRecordLogDao;
    BasePushRecordLogDao basePushRecordLogDao;
    @Autowired
    private RestTemplate restTemplate;
    /**
    /**
     * 设备离线通知--家属 、社工、助老元
     * 设备离线通知--家属 、社工、助老元
@ -150,6 +156,7 @@ public class DeviceLostMessageUtil {
     * 设备离通知-用户自己
     * 设备离通知-用户自己
     * @param devices
     * @param devices
     */
     */
    @Transactional(rollbackFor = Exception.class)
    public void deviceLostMessagePatient(List<String> devices){
    public void deviceLostMessagePatient(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        String content = "{name}{sex}您好,您的{device}设备已离线,请保持设备连接通畅。";
        String content = "{name}{sex}您好,您的{device}设备已离线,请保持设备连接通畅。";
@ -162,10 +169,12 @@ public class DeviceLostMessageUtil {
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(sql);
        System.out.println(devices);
        //所有居民的设备
        //所有居民的设备
        for (Map<String, Object> patient : patientList) {
        for (Map<String, Object> patient : patientList) {
            String deviceSns = patient.get("deviceSn").toString();
            String deviceSns = patient.get("deviceSn").toString();
            String[] deviceSplit = deviceSns.split(",");
            String[] deviceSplit = deviceSns.split(",");
            System.out.println(patient.get("id"));
            String deivceName = "";
            String deivceName = "";
            for (String deviceSn : deviceSplit) {
            for (String deviceSn : deviceSplit) {
                //离线的设备  offLineDevice
                //离线的设备  offLineDevice
@ -176,12 +185,14 @@ public class DeviceLostMessageUtil {
                            systemMessageDao.delete(sendMessageBefore);
                            systemMessageDao.delete(sendMessageBefore);
                        }
                        }
                        String deviceInfoSql = "SELECT device_sn,device_name,category_code FROM wlyy_patient_device WHERE device_sn = '"+offLineDeviceSn+"'";
                        String deviceInfoSql = "SELECT device_sn,device_name,category_code FROM wlyy_patient_device WHERE device_sn = '"+offLineDeviceSn+"'";
                        DevicePatientDevice devicePatientDevice = jdbcTemplate.queryForObject(deviceInfoSql, new BeanPropertyRowMapper<>(DevicePatientDevice.class));
                        System.out.println("SN吗 "+offLineDeviceSn);
                        List<DevicePatientDevice> query = jdbcTemplate.query(deviceInfoSql, new BeanPropertyRowMapper<>(DevicePatientDevice.class));
                        if (StringUtils.isNotBlank(deivceName)){
                        if (StringUtils.isNotBlank(deivceName)){
                            deivceName+=devicePatientDevice.getDeviceName();
                            deivceName+=","+query.get(0).getDeviceName();
                        }else {
                        }else {
                            deivceName+=","+devicePatientDevice.getAgentName();
                            deivceName+= query.get(0).getDeviceName();
                        }
                        }
                        System.out.println(deivceName);
                    }
                    }
                }
                }
            }
            }
@ -191,7 +202,6 @@ public class DeviceLostMessageUtil {
                sContent = sContent.replace("{name}",patient.get("name").toString());
                sContent = sContent.replace("{name}",patient.get("name").toString());
                sContent = sContent.replace("{sex}",Integer.parseInt(patient.get("sex").toString())==1?"大爷":"大妈");
                sContent = sContent.replace("{sex}",Integer.parseInt(patient.get("sex").toString())==1?"大爷":"大妈");
                sContent = sContent.replace("{device}",deivceName);
                sContent = sContent.replace("{device}",deivceName);
                SystemMessageDO messageDO = new SystemMessageDO();
                SystemMessageDO messageDO = new SystemMessageDO();
                messageDO.setTitle("设备离线通知");
                messageDO.setTitle("设备离线通知");
                messageDO.setContent(sContent);
                messageDO.setContent(sContent);
@ -206,15 +216,14 @@ public class DeviceLostMessageUtil {
                messageDO.setDel("1");
                messageDO.setDel("1");
                messageDO.setCreateTime(new Date());
                messageDO.setCreateTime(new Date());
                messageDO.setSenderPhoto(patient.get("photo").toString());
                messageDO.setSenderPhoto(patient.get("photo").toString());
                messageDO.setAudioUrl(audioUrl(content));
                messageDOS.add(messageDO);
                messageDOS.add(messageDO);
            }
            }
        }
        }
        if (messageDOS.size()>0){
        if (messageDOS.size()>0){
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            logEntity.setContent(content);
            logEntity.setContent(content);
            logEntity.setPushType("1");
            logEntity.setPushType("3");
            logEntity.setSendTime(new Date());
            logEntity.setSendTime(new Date());
            logEntity.setNum(messageDOS.size());
            logEntity.setNum(messageDOS.size());
            logEntity.setStatus(1);
            logEntity.setStatus(1);
@ -224,7 +233,6 @@ public class DeviceLostMessageUtil {
            logEntity.setMessageType(6);
            logEntity.setMessageType(6);
            systemMessageDao.save(messageDOS);
            systemMessageDao.save(messageDOS);
            basePushRecordLogDao.save(logEntity);
            basePushRecordLogDao.save(logEntity);
            systemMessageDao.save(messageDOS);
        }
        }
    }
    }
@ -257,13 +265,14 @@ public class DeviceLostMessageUtil {
            messageDO.setDel("1");
            messageDO.setDel("1");
            messageDO.setCreateTime(new Date());
            messageDO.setCreateTime(new Date());
            messageDO.setSenderPhoto(jsonObject.getString("photo"));
            messageDO.setSenderPhoto(jsonObject.getString("photo"));
            messageDO.setAudioUrl(audioUrl(contentTwo));
            messageDOS.add(messageDO);
            messageDOS.add(messageDO);
        }
        }
        if (messageDOS.size() > 0) {
        if (messageDOS.size() > 0) {
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            logEntity.setContent(contentOne);
            logEntity.setContent(contentOne);
            logEntity.setPushType("1");
            logEntity.setPushType("3");
            logEntity.setSendTime(new Date());
            logEntity.setSendTime(new Date());
            logEntity.setNum(messageDOS.size());
            logEntity.setNum(messageDOS.size());
            logEntity.setStatus(1);
            logEntity.setStatus(1);
@ -298,52 +307,61 @@ public class DeviceLostMessageUtil {
        for (JSONObject jsonObject : patientList) {
        for (JSONObject jsonObject : patientList) {
            switch (jsonObject.getInteger("category_code")){
            switch (jsonObject.getInteger("category_code")){
                case 4:
                case 4:
                    SystemMessageDO messageDOWatch = new SystemMessageDO();
                    messageDOWatch.setTitle("设备电量低通知");
                    messageDOWatch.setContent(watchContent);
                    messageDOWatch.setType("992");
                    messageDOWatch.setIsRead("0");
                    messageDOWatch.setSender("system");
                    messageDOWatch.setSenderName("设备电量通知助手");
                    messageDOWatch.setReceiver(jsonObject.getString("patient"));
                    messageDOWatch.setReceiverName(jsonObject.getString("name"));
                    messageDOWatch.setOver("1");
                    // messageDO.setData(deviceName+"离线");
                    messageDOWatch.setDel("1");
                    messageDOWatch.setCreateTime(new Date());
                    messageDOWatch.setSenderPhoto(jsonObject.getString("photo"));
                    messageDOSWatch.add(messageDOWatch);
                    watchSize+=1;
                    if (StringUtils.isNotBlank(watchName)){
                        watchName+=","+jsonObject.getString("patient");
                    if (messageOnOff(3)){
                        SystemMessageDO messageDOWatch = new SystemMessageDO();
                        messageDOWatch.setTitle("设备电量低通知");
                        messageDOWatch.setContent(watchContent);
                        messageDOWatch.setType("992");
                        messageDOWatch.setIsRead("0");
                        messageDOWatch.setSender("system");
                        messageDOWatch.setSenderName("设备电量通知助手");
                        messageDOWatch.setReceiver(jsonObject.getString("patient"));
                        messageDOWatch.setReceiverName(jsonObject.getString("name"));
                        messageDOWatch.setOver("1");
                        // messageDO.setData(deviceName+"离线");
                        messageDOWatch.setDel("1");
                        messageDOWatch.setCreateTime(new Date());
                        messageDOWatch.setSenderPhoto(jsonObject.getString("photo"));
                        messageDOWatch.setAudioUrl(audioUrl(watchContent));
                        messageDOSWatch.add(messageDOWatch);
                        watchSize+=1;
                        if (StringUtils.isNotBlank(watchName)){
                            watchName+=","+jsonObject.getString("patient");
                        }else {
                            watchName+=jsonObject.getString("patient");
                        }
                        break;
                    }else {
                    }else {
                        watchName+=jsonObject.getString("patient");
                        break;
                    }
                    }
                    break;
                case 7:
                case 7:
                    SystemMessageDO messageDO = new SystemMessageDO();
                    messageDO.setTitle("设备电量低通知");
                    messageDO.setContent(SosContent);
                    messageDO.setType("993");
                    messageDO.setIsRead("0");
                    messageDO.setSender("system");
                    messageDO.setSenderName("设备电量通知助手");
                    messageDO.setReceiver(jsonObject.getString("patient"));
                    messageDO.setReceiverName(jsonObject.getString("name"));
                    messageDO.setOver("1");
                    // messageDO.setData(deviceName+"离线");
                    messageDO.setDel("1");
                    messageDO.setCreateTime(new Date());
                    messageDO.setSenderPhoto(jsonObject.getString("photo"));
                    messageDOSSOS.add(messageDO);
                    SOSSize+=1;
                    if (StringUtils.isNotBlank(SOSName)){
                        SOSName+=","+jsonObject.getString("patient");
                    if (messageOnOff(4)){
                        SystemMessageDO messageDO = new SystemMessageDO();
                        messageDO.setTitle("设备电量低通知");
                        messageDO.setContent(SosContent);
                        messageDO.setType("993");
                        messageDO.setIsRead("0");
                        messageDO.setSender("system");
                        messageDO.setSenderName("设备电量通知助手");
                        messageDO.setReceiver(jsonObject.getString("patient"));
                        messageDO.setReceiverName(jsonObject.getString("name"));
                        messageDO.setOver("1");
                        // messageDO.setData(deviceName+"离线");
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        messageDO.setSenderPhoto(jsonObject.getString("photo"));
                        messageDO.setAudioUrl(audioUrl(SosContent));
                        messageDOSSOS.add(messageDO);
                        SOSSize+=1;
                        if (StringUtils.isNotBlank(SOSName)){
                            SOSName+=","+jsonObject.getString("patient");
                        }else {
                            SOSName+=jsonObject.getString("patient");
                        }
                        break;
                    }else {
                    }else {
                        SOSName+=jsonObject.getString("patient");
                        break;
                    }
                    }
                    break;
            }
            }
        }
        }
@ -351,7 +369,7 @@ public class DeviceLostMessageUtil {
        if (messageDOSWatch.size() > 0) {
        if (messageDOSWatch.size() > 0) {
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            logEntity.setContent(watchContent);
            logEntity.setContent(watchContent);
            logEntity.setPushType("1");
            logEntity.setPushType("3");
            logEntity.setSendTime(new Date());
            logEntity.setSendTime(new Date());
            logEntity.setNum(watchSize);
            logEntity.setNum(watchSize);
            logEntity.setStatus(1);
            logEntity.setStatus(1);
@ -366,7 +384,7 @@ public class DeviceLostMessageUtil {
        if (messageDOSSOS.size() > 0) {
        if (messageDOSSOS.size() > 0) {
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            BasePushRecordLogEntity logEntity = new BasePushRecordLogEntity();
            logEntity.setContent(SosContent);
            logEntity.setContent(SosContent);
            logEntity.setPushType("1");
            logEntity.setPushType("3");
            logEntity.setSendTime(new Date());
            logEntity.setSendTime(new Date());
            logEntity.setNum(SOSSize);
            logEntity.setNum(SOSSize);
            logEntity.setStatus(1);
            logEntity.setStatus(1);
@ -428,9 +446,9 @@ public class DeviceLostMessageUtil {
            for (int i = 0; i < patients.size(); i++) {
            for (int i = 0; i < patients.size(); i++) {
                String name =patients.get(i).get("name").toString();
                String name =patients.get(i).get("name").toString();
                if (StringUtils.isNotBlank(names)) {
                if (StringUtils.isNotBlank(names)) {
                    names += name;
                } else {
                    names += "," + name;
                    names += "," + name;
                } else {
                    names += name;
                }
                }
            }
            }
        } else if (type == 2) {
        } else if (type == 2) {
@ -438,9 +456,9 @@ public class DeviceLostMessageUtil {
            for (int i = 0; i < patients.size(); i++) {
            for (int i = 0; i < patients.size(); i++) {
                String name = patients.get(i).getString("name");
                String name = patients.get(i).getString("name");
                if (StringUtils.isNotBlank(names)) {
                if (StringUtils.isNotBlank(names)) {
                    names += name;
                } else {
                    names += "," + name;
                    names += "," + name;
                } else {
                    names += name;
                }
                }
            }
            }
        }
        }
@ -448,5 +466,23 @@ public class DeviceLostMessageUtil {
    }
    }
    //开关判断
    public Boolean messageOnOff(Integer code){
        String sql = "SELECT py_code FROM wlyy_hospital_sys_dict WHERE dict_name = 'pushOnOff' AND dict_code ='"+code+"' ";
        String onOff= jdbcTemplate.queryForObject(sql,String.class);
        Boolean kg = Boolean.parseBoolean(onOff);
        return kg;
    }
    public String audioUrl(String content){
        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://svr-cloud-care:10301/common/open/wordToVoice?text={1}", String.class, content);
        JSONObject jsonObject = JSONObject.parseObject(forEntity.getBody());
        if (jsonObject.getInteger("status") == 200){
            return jsonObject.getString("message");
        }else {
            return null;
        }
    }
}
}

+ 3 - 3
svr/svr-cloud-job/src/main/resources/system.properties

@ -41,8 +41,8 @@ SYN_ELECTRIC_RECORD_JOB= 0 0 8 * * ? *
#\u63A8\u9001\u8BB0\u5165\u624B\u52A8\u5B9A\u65F6 \u6BCF\u4E94\u5206\u949F\u8DD1\u4E00\u6B21
#\u63A8\u9001\u8BB0\u5165\u624B\u52A8\u5B9A\u65F6 \u6BCF\u4E94\u5206\u949F\u8DD1\u4E00\u6B21
PUSHRECORD_LOG_INFO_JOB= 0 0/5 * * * ? *
PUSHRECORD_LOG_INFO_JOB= 0 0/5 * * * ? *
#\u6BCF\u5929\u65E9\u4E0A\u4E5D\u70B9\u534A\u8DD1\u4E00\u6B21
#\u6BCF\u5929\u65E9\u4E0A\u4E5D\u70B9\u534A\u8DD1\u4E00\u6B21
PUSH_DEVICE_OFF_LONE_JOB = 0 30 9 * * ?
PUSH_DEVICE_OFF_LONE_JOB= 0 30 9 * * ?
#\u6BCF\u5929\u65E9\u4E0A\u5341\u4E00\u70B9 \u624B\u8868\u4F69\u6234\u63D0\u9192
#\u6BCF\u5929\u65E9\u4E0A\u5341\u4E00\u70B9 \u624B\u8868\u4F69\u6234\u63D0\u9192
DEVICE_WATCH_OFF_WEAR_JOB = 0 0 11 * * ?
DEVICE_WATCH_OFF_WEAR_JOB= 0 0 11 * * ?
#\u624B\u8868\u7535\u91CF\u4F4E  \u6BCF\u4E00\u4E2A\u5C0F\u65F6\u83B7\u53D6\u4E00\u6B21 \u7535\u91CF
#\u624B\u8868\u7535\u91CF\u4F4E  \u6BCF\u4E00\u4E2A\u5C0F\u65F6\u83B7\u53D6\u4E00\u6B21 \u7535\u91CF
DEVICE_WATCH_REMAINING_POWER_JOB = 0 0 0/1 * * ? 
DEVICE_WATCH_REMAINING_POWER_JOB= 0 0 0/1 * * ?