wsl 2 years ago
parent
commit
962150910e

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.care.service.device.DevicePatientFaceService;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.util.DingdingUtil;
import com.yihu.jw.care.util.HongLingJinUtil;
import com.yihu.jw.care.util.PatientPushOnOffUtil;
import com.yihu.jw.care.util.SpeechTtsUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
@ -61,6 +62,8 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
    private SpeechTtsUtil speechTtsUtil;
    @Autowired
    private HongLingJinUtil hongLingJinUtil;
    @Autowired
    private PatientPushOnOffUtil patientPushOnOffUtil;
    @GetMapping(value = "open/getToken")
@ -86,6 +89,20 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "open/patienPushOnOff")
    @ApiOperation(value = "初始化居民消息订阅开关")
    public Envelop patienPushOnOff(){
        try {
            patientPushOnOffUtil.patientPushOnOff();
            return success("初始化成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "open/findFaceRecord")
    @ApiOperation(value = "获取人脸数据")

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

@ -336,7 +336,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                        messageDO.setData(one.getContent());
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        messageDO.setAudioUrl(speechTtsUtil.wordToVoice(title));
                        String url = speechTtsUtil.wordToVoice(title);
                        messageDO.setAudioUrl(url);
                        systemMessageDao.save(messageDO);
                        //推送socket
                        com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
@ -346,6 +347,7 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                        message.put("relation_code",messageDO.getRelationCode());
                        message.put("content_type",41);
                        message.put("content_notice","");
                        message.put("audioUrl",url);
                        String content_notice = null;
                        imUtil.sendPatientSystemMessage(messageDO.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue));
                    }

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

@ -121,8 +121,8 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    @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) {
                                               @ApiParam(name = "type", value = "类型", required = false)
                                               @RequestParam(value = "type", required = false) String type) {
        try {
            return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessageListPad(patient, type));
        } catch (Exception e) {

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

@ -152,6 +152,9 @@ public class PatientMessageService {
    public List<Map<String,Object>> getSystemMessageListPad(String patient,String type){
        if (!StringUtils.isNotBlank(type)) {
            type = "41,42,991,992,993,994,995,996,999";
        }
        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 ";

+ 79 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/PatientPushOnOffUtil.java

@ -0,0 +1,79 @@
package com.yihu.jw.care.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.log.BasePatientPadPushOnOffDao;
import com.yihu.jw.entity.log.BasePatientPadPushOnOffEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by wsl on 2022/8/2
 */
@Component
public class PatientPushOnOffUtil {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BasePatientPadPushOnOffDao basePatientPadPushOnOffDao;
    //初始化居民推送开关
    @Transactional(rollbackFor = Exception.class)
    public String patientPushOnOff(){
        JSONObject jsonObject = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        jsonObject.put("1","时间整点报时");
        jsonArray.add(jsonObject);
        jsonObject.put("2","智能安居设备状态播报(必选)");
        jsonArray.add(jsonObject);
        jsonObject.put("3","体征测量消息");
        jsonArray.add(jsonObject);
        jsonObject.put("4","用药提醒");
        jsonArray.add(jsonObject);
        jsonObject.put("5","天气预报");
        jsonArray.add(jsonObject);
        jsonObject.put("6","服务预约提醒");
        jsonArray.add(jsonObject);
        jsonObject.put("7","生日祝福提醒");
        jsonArray.add(jsonObject);
        jsonObject.put("8","热点新闻播报");
        jsonArray.add(jsonObject);
        String sql = "SELECT p.id FROM  base_patient p WHERE  p.sign_status = 1 AND p.del = 1  ";
        List<String> patientList = jdbcTemplate.queryForList(sql, String.class);
        List<BasePatientPadPushOnOffEntity> onOffEntityList = new ArrayList<>();
        patientList.forEach(patientId -> {
            for (int i = 1; i <= jsonArray.size(); i++) {
                BasePatientPadPushOnOffEntity onOffEntity = new BasePatientPadPushOnOffEntity();
                onOffEntity.setPatient(patientId);
                onOffEntity.setType(i);
                onOffEntity.setTypeName(jsonArray.getJSONObject(0).getString(i+""));
                if (jsonArray.getJSONObject(0).getString(i+"").equals("智能安居设备状态播报(必选)")){
                    onOffEntity.setOnOff(1);
                }else {
                    onOffEntity.setOnOff(0);
                }
                onOffEntity.setCreateTime(new Date());
                onOffEntityList.add(onOffEntity);
            }
        });
        basePatientPadPushOnOffDao.save(onOffEntityList);
        return null;
    }
}

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

@ -131,7 +131,7 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("OVERTIME_VISIT_JOB exist");
            }
            //归集数据定时推送 每天晚上十一点
            //归集数据定时推送 每天凌晨两点
            if (!quartzHelper.isExistJob("SAVE_DATA_PUSH_JOB")){
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("SAVE_DATA_PUSH_JOB");
                quartzHelper.addJob(SaveDataPushJob.class, trigger, "SAVE_DATA_PUSH_JOB", new HashMap<String, Object>());

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

@ -362,7 +362,6 @@ public class PatientDeviceService {
                }
                Thread.sleep(1000);
            }
            System.out.println("离线居民人数:"+rslist.size());
            if (rslist.size()>0) {
                deviceLostMessageUtil.watchRemainingPower(rslist);
            }
@ -372,32 +371,6 @@ public class PatientDeviceService {
        }
    }
   /* //爱牵挂报警器电量获取判断
    public void deviceSoSAlarmRemainIngPower() {
        try {
            List<JSONObject> rslist = new ArrayList();
            String deviceWatchSql = "SELECT p.id,p.`name`,p.sex,d.device_sn,p.photo FROM base_patient p INNER JOIN wlyy_patient_device d ON p.id = d.`user` WHERE category_code = 7 AND p.del = 1 ";
            List<Map<String, Object>> patientList = jdbcTemplate.queryForList(deviceWatchSql);
            for (Map<String, Object> map : patientList) {
                JSONObject response = getAqgDeviceInfo2(map.get("device_sn").toString());
                if (response.containsKey("remaining_power") && response.get("remaining_power") != null && response.getInteger("remaining_power") <= 20) {
                    JSONObject patients = new JSONObject();
                    patients.put("patient", map.get("id"));
                    patients.put("name", map.get("name"));
                    patients.put("sex", map.get("sex"));
                    rslist.add(patients);
                }
                Thread.sleep(1000);
            }
            if (rslist.size() > 0) {
                deviceLostMessageUtil.sosAlarmRemainIngPower(rslist);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }*/
    public static final String baseUrl = "http://api.aiqiangua.com:8888";// 正式环境
    public static final String deviceInfo = baseUrl +"/api/device/{0}";

+ 4 - 4
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/message/PushTimeIntegerPointService.java

@ -27,7 +27,7 @@ public class PushTimeIntegerPointService {
    @Autowired
    private SystemMessageDao systemMessageDao;
    private static String message = "现在是北京时间{Time}点整";
    private static String message = "现在是北京时间{Time}点整!";
    public void pushTimeIntegerPoint() {
        int i = DateUtil.integerTime();
@ -35,13 +35,13 @@ public class PushTimeIntegerPointService {
        List<SystemMessageDO> systemMessageDOList = new ArrayList<>();
        List<Map<String, Object>> signOldPatientList = systemPushMessageUtil.signOldPatient();
        String url = deviceLostMessageUtil.audioUrl(content);
        int num = 0;
        //int num = 0;
        for (Map<String, Object> map : signOldPatientList) {
            String patient = map.get("id").toString();
            if (!systemPushMessageUtil.findPatientPushOnOff(patient,1)){
                continue;
            }
            num+=1;
          //num+=1;
            SystemMessageDO messageDO = systemPushMessageUtil.systemMessageDOSave("整点报时", content,"996","0","system","整点报时通知助手",patient,map.get("name").toString(),"1",map.get("photo").toString(),url);
            /*socket 推送*/
            deviceLostMessageUtil.patientMessageSocket(messageDO,null);
@ -49,7 +49,7 @@ public class PushTimeIntegerPointService {
        }
        systemMessageDao.save(systemMessageDOList);
        systemPushMessageUtil.basePushRecordLogEntitySave(content,"2",new Date(),num,1,"签约老人",1,8);
        systemPushMessageUtil.basePushRecordLogEntitySave(content,"2",new Date(),systemMessageDOList.size(),1,"签约老人",1,8);
    }

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/message/PushWeatherForecastService.java

@ -64,7 +64,7 @@ public class PushWeatherForecastService {
        }
        systemMessageDao.save(messageDOList);
        systemPushMessageUtil.basePushRecordLogEntitySave(content,"2",new Date(),list.size(),1,"签约老人",1,7);
        systemPushMessageUtil.basePushRecordLogEntitySave(content,"2",new Date(),messageDOList.size(),1,"签约老人",1,7);
    }

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

@ -44,8 +44,8 @@ PUSHRECORD_LOG_INFO_JOB= 0 0/5 * * * ? *
PUSH_DEVICE_OFF_LONE_JOB= 0 30 9 * * ?
#\u6BCF\u5929\u65E9\u4E0A\u5341\u4E00\u70B9 \u624B\u8868\u4F69\u6234\u63D0\u9192
DEVICE_WATCH_OFF_WEAR_JOB= 0 0 11 * * ?
#\u624B\u8868\u7535\u91CF\u4F4E \u6BCF\u4E00\u4E2A\u5C0F\u65F6\u83B7\u53D6\u4E00\u6B21 \u7535\u91CF
DEVICE_WATCH_REMAINING_POWER_JOB= 0 0 8,9,10,14,15,16,17,18,19,20 * * ?
#\u624B\u8868\u7535\u91CF\u4F4E 8,14,21\u70B9\u63A8\u9001 \u7535\u91CF
DEVICE_WATCH_REMAINING_POWER_JOB= 0 0 8,14,21 * * ?
#\u65F6\u95F4\u6574\u70B9\u62A5\u65F6\uFF1A\u65E9\u4E0A10\u70B9\u5230\u4E0B\u534818\u70B9\u8FDB\u884C\u51C6\u70B9\u64AD\u62A5
PUSH_MASSAGE_TIME_INTEGER_POINT_JOB= 0 0 10,11,12,13,14,15,16,17,18 * * ?
#\u5929\u6C14\u9884\u62A5\uFF1A\u6BCF\u5929\u65E9\u4E0A11\u70B9\u64AD\u62A5