Browse Source

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

chinawu123 2 years ago
parent
commit
df9759488a

+ 5 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushrecordLogInfoEntity.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.log;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -24,6 +25,8 @@ public class BasePushrecordLogInfoEntity extends IdEntity {
    private Date sendTime; //发送时间
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
@ -32,6 +35,7 @@ public class BasePushrecordLogInfoEntity extends IdEntity {
        this.patientName = patientName;
    }
    @Column(name = "push_id")
    public String getPushId() {
        return pushId;
    }
@ -65,6 +69,7 @@ public class BasePushrecordLogInfoEntity extends IdEntity {
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "send_time")
    public Date getSendTime() {
        return sendTime;
    }

+ 8 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/ManageMessagePush/ManageSystemPushMessageController.java

@ -4,6 +4,7 @@ import com.yihu.jw.base.service.ManageMessagePush.ManageSystemPushMessageService
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.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -61,19 +62,19 @@ public class ManageSystemPushMessageController extends EnvelopRestEndpoint {
    @ApiOperation("获取推送记录列表")
    @PostMapping(value = "/pushMessageList")
    public ListEnvelop pushMessageList(@ApiParam(name = "messageType",value = "消息类型",required = false)
    public ObjEnvelop pushMessageList(@ApiParam(name = "messageType",value = "消息类型",required = false)
                                       @RequestParam(value = "messageType",required = false)Integer messageType,
                                       @ApiParam(name = "status",value = "状态",required = false)
                                      @ApiParam(name = "status",value = "状态",required = false)
                                       @RequestParam(value = "status",required = false)Integer status,
                                       @ApiParam(name = "name",value = "名字查找",required = false)
                                      @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){
                                      @RequestParam(value = "page",required = true)Integer page,
                                      @RequestParam(value = "pageSize",required = true)Integer pageSize){
        try {
            return success(mspmservice.pushMessageList(messageType,status,name,page,pageSize));
            return ObjEnvelop.getSuccess("获取成功!",mspmservice.pushMessageList(messageType,status,name,page,pageSize),200);
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
    }

+ 17 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/service/ManageMessagePush/ManageSystemPushMessageService.java

@ -106,10 +106,11 @@ public class ManageSystemPushMessageService {
            //创建定时任务记录
            basePatientDOS.forEach(logInfoDO->{
                String data = content;
                if (StringUtils.containsIgnoreCase(content,"【姓名】"))data.replace("【姓名】",logInfoDO.getName());
                if (StringUtils.containsIgnoreCase(content,"【称谓】"))data.replace("【称谓】",logInfoDO.getSex()==1?"大爷":"大妈");
                if (StringUtils.containsIgnoreCase(content,"【姓名】"))data = data.replace("【姓名】",logInfoDO.getName());
                if (StringUtils.containsIgnoreCase(content,"【称谓】"))data = data.replace("【称谓】",logInfoDO.getSex()==1?"大爷":"大妈");
                BasePushrecordLogInfoEntity basePushrecordLogInfoEntity = new BasePushrecordLogInfoEntity();
                basePushrecordLogInfoEntity.setPatient(logInfoDO.getId());
                basePushrecordLogInfoEntity.setPatientName(logInfoDO.getName());
                basePushrecordLogInfoEntity.setContent(data);
                basePushrecordLogInfoEntity.setStatus(0);
                basePushrecordLogInfoEntity.setSendTime(date);
@ -132,14 +133,15 @@ public class ManageSystemPushMessageService {
        if (null!=basePushrecordLogInfoEntityList&&basePushrecordLogInfoEntityList.size()>0) {
            basePushrecordLogInfoEntityList.forEach(basePushLogInfoEntity -> basePushLogInfoEntity.setPushId(basePushRecordLogEntity.getId()));
            basePushrecordLogInfoDao.save(basePushrecordLogInfoEntityList);
        }
    }
    //获取列表
    public List<BasePushRecordLogEntity> pushMessageList(Integer messageType,Integer status,String name,Integer page,Integer pageSize){
    public JSONObject pushMessageList(Integer messageType,Integer status,String name,Integer page,Integer pageSize){
        JSONObject result = new JSONObject();
        if(page==null){
            page = 1;
@ -149,23 +151,29 @@ public class ManageSystemPushMessageService {
        }
        String sql = "SELECT * FROM base_pushrecord_log where 1=1 ";
        String countSql = "Select  count(id) from base_pushrecord_log where 1=1 ";
        String filite = " ";
        if(null!=messageType){
            sql +=" and message_type ='"+messageType+"' ";
            filite +=" and message_type ='"+messageType+"' ";
        }
        if (null!=status) {
            sql +=" and status = '"+status+"'";
            filite +=" and status = '"+status+"'";
        }
        if (StringUtils.isNotBlank(name)){
            sql +=" and  send_object like '%"+name+"%'";
            filite +=" and  send_object like '%"+name+"%'";
        }
        sql += " ORDER BY send_time DESC  LIMIT  " + (page - 1) * pageSize + "," + pageSize + "";
        List<BasePushRecordLogEntity> entityList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
        return entityList;
        List<BasePushRecordLogEntity> entityList = jdbcTemplate.query(sql + filite, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
        result.put("obj",entityList);
        Integer count = jdbcTemplate.queryForObject(countSql + filite, Integer.class);
        result.put("count",count);
        return result;
    }

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/lifeCare/LifeCareService.java

@ -36,7 +36,7 @@ public class LifeCareService {
                ",GROUP_CONCAT( DISTINCT dict.org_name SEPARATOR ',' ) AS orgName FROM " +
                "base_life_care_item_dict dict INNER JOIN base_org org ON dict.org_code = org.CODE WHERE  org.del = 1" ;
        String sqlCount = " select count(dict.id) from base_life_care_item_dict dict INNER JOIN base_org org on dict.org_code = org.code  where  org.del=1  ";
        String sqlCount = " select count(dict.id) AS size  from base_life_care_item_dict dict INNER JOIN base_org org on dict.org_code = org.code  where  org.del=1  GROUP BY dict.`code`  ";
        String filter = " ";
        if (StringUtils.isNotBlank(orgName)){
            filter +=" and org.name like '%"+orgName+"%' ";
@ -44,7 +44,7 @@ public class LifeCareService {
        if (StringUtils.isNotBlank(itemName)){
            filter +=" and dict.name like '%"+itemName+"%' ";
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+filter,Long.class);
        List<Map<String, Object>> conuntList = jdbcTemplate.queryForList(sqlCount + filter);
        filter +=" GROUP BY dict.`code` ";
@ -53,7 +53,7 @@ public class LifeCareService {
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filter);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,Long.parseLong(conuntList.size()+""));
    }
    @Transactional(rollbackFor = Exception.class)

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

@ -8,6 +8,7 @@ import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.SpeechTtsUtil;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
@ -255,17 +256,27 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                json.put("content", content);
                json.put("isSave", 0);
            }
            String sql = "select py_code from wlyy_hospital_sys_dict where dict_name = 'pushOnOff' and dict_code = '1' ";
            String flagString = jdbcTemplate.queryForObject(sql, String.class);
            Boolean flage = Boolean.parseBoolean(flagString);
            List<BirthDayWishesToPatient> birthDayWishesToPatientESList = birthdayWishesService.saveBirthdayWishesES(json);
            new Thread(() -> {
                sender(birthDayWishesToPatientESList);
            }).start();
            savePushLog(patient);
            if (flage){
                new Thread(() -> {
                    sender(birthDayWishesToPatientESList);
                }).start();
                savePushLog(patient);
            }
            return write(200, "发送成功!");
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @Autowired
    private SpeechTtsUtil speechTtsUtil;
    /**
     * 发送消息
     *
@ -305,7 +316,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                    }
                    if (success||demoFlag){
                        SystemMessageDO messageDO = new SystemMessageDO();
                        messageDO.setTitle("收到来自"+one.getDoctorName()+"的关怀祝福:祝您"+tmp.get("name").toString()+"节日快乐!");
                        String title = "收到来自"+one.getDoctorName()+"的关怀祝福:祝您"+tmp.get("name").toString()+"节日快乐!";
                        messageDO.setTitle(title);
                        messageDO.setType("41");//41人文关怀
                        messageDO.setSender(one.getDoctorCode());
                        messageDO.setSenderName(one.getDoctorName());
@ -317,6 +329,7 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                        messageDO.setData(one.getContent());
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        messageDO.setAudioUrl(speechTtsUtil.wordToVoice(title));
                        systemMessageDao.save(messageDO);
                        //推送socket
                        com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();

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

@ -15,7 +15,6 @@ import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -149,14 +148,10 @@ public class PatientMessageService {
    }
    @Autowired
    private ImUtil imUtil;
    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);
    }

+ 2 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceWatchRemainingPowerJob.java

@ -20,10 +20,12 @@ public class DeviceWatchRemainingPowerJob implements Job {
    private PatientDeviceService patientDeviceService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("====================系统推送设备电量低start==================");
        logger.info("DeviceWatchRemainingPowerJob start");
        try {
            patientDeviceService.deviceWatchRemainingPower();
            logger.info("DeviceWatchRemainingPowerJob end");
            System.out.println("====================系统推送设备电量低end==================");
        } catch (Exception e) {
            logger.info("DeviceWatchRemainingPowerJob --ERROR MSG:"+e.getMessage());
            e.printStackTrace();

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

@ -45,39 +45,45 @@ public class PushRecordJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        String sql = "SELECT * FROM base_pushrecord_log_info WHERE `status` = 0 AND sendTime <= '"+DateUtil.getNowDate()+"'";
        List<BasePushrecordLogInfoEntity> logInfoEntityList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePushrecordLogInfoEntity.class));
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        System.out.println("====================人工推送start==================");
        try {
            String sql = "SELECT * FROM base_pushrecord_log_info WHERE `status` = 0 AND send_Time <= '"+ DateUtil.getStringDate()+"'";
            List<BasePushrecordLogInfoEntity> logInfoEntityList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePushrecordLogInfoEntity.class));
            List<SystemMessageDO> messageDOS = new ArrayList<>();
        if (logInfoEntityList.size()>0) {
            for (BasePushrecordLogInfoEntity basePushrecordLogInfoEntity : logInfoEntityList) {
                //记录表设置已发送
                basePushrecordLogInfoEntity.setStatus(1);
                //新增推送记录
                SystemMessageDO systemMessageDO = new SystemMessageDO();
                systemMessageDO.setId(UUID.randomUUID().toString().replace("-", ""));
                systemMessageDO.setTitle("系统消息推送");
                systemMessageDO.setType("999");
                systemMessageDO.setIsRead("0");
                systemMessageDO.setSender("system");
                systemMessageDO.setSenderName("人工推送助手");
                systemMessageDO.setReceiver(basePushrecordLogInfoEntity.getPatient());
                systemMessageDO.setReceiverName(basePushrecordLogInfoEntity.getPatientName());
                systemMessageDO.setContent(basePushrecordLogInfoEntity.getContent());
                systemMessageDO.setOver("1");
                systemMessageDO.setDel("1");
                systemMessageDO.setAudioUrl(devicelostMessageUtil.audioUrl(basePushrecordLogInfoEntity.getContent()));
                systemMessageDO.setCreateTime(new Date());
                messageDOS.add(systemMessageDO);
            }
            if (logInfoEntityList.size()>0) {
                for (BasePushrecordLogInfoEntity basePushrecordLogInfoEntity : logInfoEntityList) {
                    //记录表设置已发送
                    basePushrecordLogInfoEntity.setStatus(1);
                    //新增推送记录
                    SystemMessageDO systemMessageDO = new SystemMessageDO();
                    systemMessageDO.setId(UUID.randomUUID().toString().replace("-", ""));
                    systemMessageDO.setTitle("系统消息推送");
                    systemMessageDO.setType("999");
                    systemMessageDO.setIsRead("0");
                    systemMessageDO.setSender("system");
                    systemMessageDO.setSenderName("人工推送助手");
                    systemMessageDO.setReceiver(basePushrecordLogInfoEntity.getPatient());
                    systemMessageDO.setReceiverName(basePushrecordLogInfoEntity.getPatientName());
                    systemMessageDO.setContent(basePushrecordLogInfoEntity.getContent());
                    systemMessageDO.setOver("1");
                    systemMessageDO.setDel("1");
                    systemMessageDO.setAudioUrl(devicelostMessageUtil.audioUrl(basePushrecordLogInfoEntity.getContent()));
                    systemMessageDO.setCreateTime(new Date());
                    messageDOS.add(systemMessageDO);
                }
            String basePushLogSatusSql = "select * from base_pushrecord_log where id = '"+logInfoEntityList.get(0).getPushId()+"' ";
            BasePushRecordLogEntity logEntity = jdbcTemplate.queryForObject(basePushLogSatusSql, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
            logEntity.setStatus(1);
                String basePushLogSatusSql = "select * from base_pushrecord_log where id = '"+logInfoEntityList.get(0).getPushId()+"' ";
                BasePushRecordLogEntity logEntity = jdbcTemplate.queryForObject(basePushLogSatusSql, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
                logEntity.setStatus(1);
            basePushRecordLogDao.save(logEntity);
            systemMessageDao.save(messageDOS);
            basePushrecordLogInfoDao.save(logInfoEntityList);
                basePushRecordLogDao.save(logEntity);
                systemMessageDao.save(messageDOS);
                basePushrecordLogInfoDao.save(logInfoEntityList);
            }
            System.out.println("====================人工推送end==================");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

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

@ -360,7 +360,6 @@ public class PatientDeviceService {
                }
                Thread.sleep(1000);
            }
            if (rslist.size()>0) {
                deviceLostMessageUtil.watchRemainingPower(rslist);
            }

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

@ -260,7 +260,7 @@ public class DeviceLostMessageUtil {
            SystemMessageDO messageDO = new SystemMessageDO();
            String contentTwo = contentOne;
            contentTwo = contentTwo.replace("{name}",jsonObject.getString("name"));
            contentTwo.replace("{sex}",1==jsonObject.getInteger("sex")?"大爷":"大妈");
            contentTwo = contentTwo.replace("{sex}",1==jsonObject.getInteger("sex")?"大爷":"大妈");
            String s = audioUrl(contentTwo);
            messageDO.setTitle("设备未佩戴通知");

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

@ -45,4 +45,4 @@ 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 0/1 * * ? 
DEVICE_WATCH_REMAINING_POWER_JOB= 0 0 0/1 * * ?