wsl 2 jaren geleden
bovenliggende
commit
d98cbfba83

+ 26 - 13
common/common-entity/sql/sql记录

@ -2305,19 +2305,20 @@ CREATE TABLE `base_urge_reminder_record` (
CREATE TABLE `base_zhaohui_daily` (
CREATE TABLE `base_zhaohui_daily` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '老人code',
  `patient` varchar(50) DEFAULT NULL COMMENT '老人code',
  `patientName` varchar(50) DEFAULT NULL COMMENT '老人',
  `photo` varchar(50) DEFAULT NULL COMMENT '头像',
  `patient_name` varchar(50) DEFAULT NULL COMMENT '老人',
  `photo` varchar(100) DEFAULT NULL COMMENT '头像',
  `message` varchar(200) DEFAULT NULL COMMENT '总结消息',
  `message` varchar(200) DEFAULT NULL COMMENT '总结消息',
  `service` int(2) DEFAULT NULL COMMENT '服务次数',
  `service` int(2) DEFAULT NULL COMMENT '服务次数',
  `service_time` varchar(20) DEFAULT NULL COMMENT '最近服务时间',
  `service_time` varchar(50) DEFAULT NULL COMMENT '最近服务时间',
  `service_name` varchar(20) DEFAULT NULL COMMENT '最近服务类型',
  `service_name` varchar(20) DEFAULT NULL COMMENT '最近服务类型',
  `pad_time` varchar(20) DEFAULT NULL COMMENT 'pad使用时长',
  `pad_time` varchar(20) DEFAULT NULL COMMENT 'pad使用时长',
  `pad_last_time` varchar(20) DEFAULT NULL COMMENT 'pad上一次时间',
  `pad_last_time` varchar(20) DEFAULT NULL COMMENT 'pad上一次时间',
  `pad_last_total_time` varchar(20) DEFAULT NULL COMMENT 'pad上一次时长',
  `pad_last_total_time` varchar(50) DEFAULT NULL COMMENT 'pad上一次时长',
  `create_time` datetime DEFAULT NULL COMMENT '统计时间',
  `create_time` datetime DEFAULT NULL COMMENT '统计时间',
  `family_code` varchar(50) DEFAULT NULL COMMENT '家属code',
  `family_code` varchar(50) DEFAULT NULL COMMENT '家属code',
  `eme_num` int(2) DEFAULT NULL COMMENT '预警次数',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报';
) ENGINE=InnoDB AUTO_INCREMENT=170 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报';
@ -2325,15 +2326,15 @@ CREATE TABLE `base_zhaohui_daily` (
CREATE TABLE `base_zhaohui_daily_watch` (
CREATE TABLE `base_zhaohui_daily_watch` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `daily_id` varchar(50) NOT NULL COMMENT '朝晖日报id',
  `daily_id` varchar(50) NOT NULL COMMENT '朝晖日报id',
  `wear` INT(2) DEFAULT NULL COMMENT '是否佩戴 1 未佩戴 0 佩戴',
  `power` VARCHAR(20) DEFAULT NULL COMMENT '电量',
  `online` INT(2) DEFAULT NULL COMMENT '在线状态0 不在线 1在线',
  `wear` int(2) DEFAULT NULL COMMENT '是否佩戴 1 未佩戴 0 佩戴',
  `power` varchar(20) DEFAULT NULL COMMENT '电量',
  `online` int(2) DEFAULT NULL COMMENT '在线状态0 不在线 1在线',
  `heart` varchar(20) DEFAULT NULL COMMENT '心率',
  `heart` varchar(20) DEFAULT NULL COMMENT '心率',
  `hearts` varchar(500) DEFAULT NULL COMMENT '心率图',
  `hearts` varchar(500) DEFAULT NULL COMMENT '心率图',
  `steps` varchar(20) DEFAULT NULL COMMENT '步数',
  `steps` varchar(20) DEFAULT NULL COMMENT '步数',
  `serve_desc` varchar(20) DEFAULT NULL COMMENT '检测异常',
  `serve_desc` varchar(20) DEFAULT NULL COMMENT '检测异常',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-防走失检测';
) ENGINE=InnoDB AUTO_INCREMENT=158 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-防走失检测';
CREATE TABLE `base_zhaohui_daily_video` (
CREATE TABLE `base_zhaohui_daily_video` (
@ -2343,8 +2344,10 @@ CREATE TABLE `base_zhaohui_daily_video` (
  `device_sn` varchar(20) DEFAULT NULL COMMENT '设备SN码',
  `device_sn` varchar(20) DEFAULT NULL COMMENT '设备SN码',
  `time` varchar(50) DEFAULT NULL COMMENT '时间',
  `time` varchar(50) DEFAULT NULL COMMENT '时间',
  `serve_desc` varchar(20) DEFAULT NULL COMMENT '检测异常',
  `serve_desc` varchar(20) DEFAULT NULL COMMENT '检测异常',
  `eme_status` int(2) DEFAULT NULL COMMENT '预警信息0无 1有',
  `order_id` varchar(50) DEFAULT NULL COMMENT '工单id',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-防跌倒监测';
) ENGINE=InnoDB AUTO_INCREMENT=239 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-防跌倒监测';
CREATE TABLE `base_zhaohui_daily_sleep` (
CREATE TABLE `base_zhaohui_daily_sleep` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `id` int(50) NOT NULL AUTO_INCREMENT,
@ -2359,13 +2362,23 @@ CREATE TABLE `base_zhaohui_daily_sleep` (
  `heart_curve` varchar(500) DEFAULT NULL COMMENT '心率曲线',
  `heart_curve` varchar(500) DEFAULT NULL COMMENT '心率曲线',
  `serve_desc` varchar(20) DEFAULT NULL COMMENT '检测异常',
  `serve_desc` varchar(20) DEFAULT NULL COMMENT '检测异常',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-睡眠监测';
) ENGINE=InnoDB AUTO_INCREMENT=158 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-睡眠监测';
CREATE TABLE `base_zhaohui_daily_eme` (
CREATE TABLE `base_zhaohui_daily_eme` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `daily_id` varchar(50) NOT NULL COMMENT '朝晖日报id',
  `daily_id` varchar(50) NOT NULL COMMENT '朝晖日报id',
  `message` varchar(20) DEFAULT NULL COMMENT '消息',
  `message` varchar(20) DEFAULT NULL COMMENT '消息',
  `online` int(2) DEFAULT NULL COMMENT '在线状态0 不在线 1在线',
  `online` int(2) DEFAULT NULL COMMENT '在线状态0 不在线 1在线',
  `order_id` varchar(20) DEFAULT NULL COMMENT '工单id',
  `mem_status` int(2) DEFAULT NULL COMMENT '预警状态0 无1有',
  `order_id` varchar(50) DEFAULT NULL COMMENT '工单id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=143 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-紧急呼叫';
CREATE TABLE `pad_use_time` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '老人code',
  `create_time` datetime DEFAULT NULL COMMENT '统计时间',
  `time` int(2) DEFAULT NULL COMMENT '使用时间',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-紧急呼叫';
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8mb4 COMMENT='pad使用时间';

+ 65 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/PadUseTimeEntity.java

@ -0,0 +1,65 @@
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;
/**
 * Created by wsl on 2022/11/16
 */
@Entity
@Table(name = "pad_use_time")
public class PadUseTimeEntity extends IdEntity {
    /**
     * 老人code
     */
    private String patient;
    /**
     * 统计时间
     */
    private Date createTime;
    /**
     * 使用时间
     */
    private Integer time;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "time")
    public Integer getTime() {
        return time;
    }
    public void setTime(Integer time) {
        this.time = time;
    }
}

+ 16 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/ZhaohuiDailyEmeEntity.java

@ -28,11 +28,27 @@ public class ZhaohuiDailyEmeEntity extends IdEntity {
     */
     */
    private Integer online;
    private Integer online;
    /**
     * 预警状态 0无  1有
     */
    private Integer memStatus;
    /**
    /**
     * 工单id
     * 工单id
     */
     */
    private String orderId;
    private String orderId;
    @Column(name = "mem_status")
    public Integer getMemStatus() {
        return memStatus;
    }
    public void setMemStatus(Integer memStatus) {
        this.memStatus = memStatus;
    }
    @Column(name = "daily_id")
    @Column(name = "daily_id")
    public String getDailyId() {
    public String getDailyId() {
        return dailyId;
        return dailyId;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/ZhaohuiDailyEntity.java

@ -1,5 +1,6 @@
package com.yihu.jw.entity.log;
package com.yihu.jw.entity.log;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Column;
@ -183,6 +184,7 @@ public class ZhaohuiDailyEntity extends IdEntity {
        this.padLastTotalTime = padLastTotalTime;
        this.padLastTotalTime = padLastTotalTime;
    }
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time")
    @Column(name = "create_time")
    public Date getCreateTime() {
    public Date getCreateTime() {
        return createTime;
        return createTime;

+ 27 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/ZhaohuiDailyVideoEntity.java

@ -36,11 +36,38 @@ public class ZhaohuiDailyVideoEntity extends IdEntity {
     */
     */
    private String time;
    private String time;
    /**
     * 预警状态 0无  1有
     */
    private Integer emeStatus;
    /**
    /**
     * 检测异常
     * 检测异常
     */
     */
    private String serveDesc;
    private String serveDesc;
    private String orderId;
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    @Column(name = "eme_status")
    public Integer getEmeStatus() {
        return emeStatus;
    }
    public void setEmeStatus(Integer emeStatus) {
        this.emeStatus = emeStatus;
    }
    @Column(name = "daily_id")
    @Column(name = "daily_id")
    public String getDailyId() {
    public String getDailyId() {
        return dailyId;
        return dailyId;

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/PadUseTimeDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.care.dao.message;
import com.yihu.jw.entity.log.PadUseTimeEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/11/16
 */
public interface PadUseTimeDao extends PagingAndSortingRepository<PadUseTimeEntity, String>, JpaSpecificationExecutor<PadUseTimeEntity> {
}

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

@ -277,6 +277,20 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @PostMapping(value = "/padUseTime")
    @ApiOperation(value = "pad使用时常")
    public Envelop padUseTime(@ApiParam(name = "patient", required = false)
                              @RequestParam(value = "patient") String patient){
        try {
            patientMessageService.padUseTime(patient);
            return success("成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("系统异常");
        }
    }
    @GetMapping(value = "/getSystemMessageListNew")
    @GetMapping(value = "/getSystemMessageListNew")
    @ApiOperation(value = "获取系统消息")
    @ApiOperation(value = "获取系统消息")
    public ListEnvelop getSystemMessageListNew(@ApiParam(name = "type", required = false)
    public ListEnvelop getSystemMessageListNew(@ApiParam(name = "type", required = false)

+ 5 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -2082,11 +2082,11 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        eme.put("status_-1",0);//已取消
        eme.put("status_-1",0);//已取消
        eme.put("status_0",0);//已完成
        eme.put("status_0",0);//已完成
        eme.put("status_1",0);//预警中
        eme.put("status_1",0);//预警中
        String sql = " select ord.status,count(distinct ord.id) count from base_emergency_assistance_order ord INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 ";
        String sql = " select ord.status,count(distinct ord.id) count from base_emergency_assistance_order ord INNER JOIN base_patient ph on ord.patient = ph.id and ph.del=1 ";
        if (StringUtils.isNotBlank(status)){
        if (StringUtils.isNotBlank(status)){
            sql += " and ord.status='"+status+"' ";
            sql += " and ord.status='"+status+"' ";
        }
        }
        sql +=  "  where ph.doctor='"+doctor+"' "+olderFilter.replace("{patient}","ph.patient")+" group by ord.status  ";
        sql +=  "  where 1=1 "+olderFilter.replace("{patient}","ph.id")+" group by ord.status  ";
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:sqlResult){
        for (Map<String,Object> map:sqlResult){
            eme.put("status_"+map.get("status"),map.get("count"));
            eme.put("status_"+map.get("status"),map.get("count"));
@ -2114,7 +2114,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            serverTmp.put(server.get("dict_value").toString(), server.get("py_code").toString());
            serverTmp.put(server.get("dict_value").toString(), server.get("py_code").toString());
        }
        }
        sql = "select ord.status,ord.serve_desc,count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
        sql = "select ord.status,ord.serve_desc,count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                " INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1  where ph.doctor='"+doctor+"'  ";
                " INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1  where 1=1 ";
        String fliter = " group by ord.status";
        String fliter = " group by ord.status";
        sqlResult = jdbcTemplate.queryForList(sql +olderFilter.replace("{patient}","ph.patient")+ fliter);
        sqlResult = jdbcTemplate.queryForList(sql +olderFilter.replace("{patient}","ph.patient")+ fliter);
@ -2141,11 +2141,11 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        /************************ 安防、紧急总数********/
        /************************ 安防、紧急总数********/
        sql = " select count(distinct ord.id)  from base_emergency_assistance_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " +
        sql = " select count(distinct ord.id)  from base_emergency_assistance_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " +
                "  where ph.doctor='"+doctor+"' " ;
                "  where 1=1 " ;
        Long emeCount = jdbcTemplate.queryForObject(sql+olderFilter.replace("{patient}","p.id"),Long.class);
        Long emeCount = jdbcTemplate.queryForObject(sql+olderFilter.replace("{patient}","p.id"),Long.class);
        emeAndSecu.put("emeAll",emeCount);
        emeAndSecu.put("emeAll",emeCount);
        sql = "select count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 " +
        sql = "select count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 " +
                " INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1  where ph.doctor='"+doctor+"'  ";
                " INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1  where 1=1 ";
        fliter = "  ";
        fliter = "  ";
        Long secuCount = jdbcTemplate.queryForObject(sql+olderFilter.replace("{patient}","p.id"),Long.class);
        Long secuCount = jdbcTemplate.queryForObject(sql+olderFilter.replace("{patient}","p.id"),Long.class);
        emeAndSecu.put("secuAll",secuCount);
        emeAndSecu.put("secuAll",secuCount);

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

@ -71,6 +71,21 @@ public class PatientMessageService {
    BaseConsultWaresManageDao baseConsultWaresManageDao;
    BaseConsultWaresManageDao baseConsultWaresManageDao;
    @Autowired
    @Autowired
    private BaseFamilyPushOnOffDao baseFamilyPushOnOffDao;
    private BaseFamilyPushOnOffDao baseFamilyPushOnOffDao;
    @Autowired
    private ZhaohuiDailySleepDao zhaohuiDailySleepDao;
    @Autowired
    private ZhaohuiDailyVideoDao zhaohuiDailyVideoDao;
    @Autowired
    private ZhaohuiDailyWatchDao zhaohuiDailyWatchDao;
    @Autowired
    private ZhaohuiDailyEmeDao zhaohuiDailyEmeDao;
    @Autowired
    private ZhaohuiDailyDao zhaohuiDailyDao;
    @Autowired
    private YsDeviceService ysDeviceService;
    @Autowired
    private PadUseTimeDao padUseTimeDao;
    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) {
@ -313,18 +328,6 @@ public class PatientMessageService {
    }
    }
    @Autowired
    private ZhaohuiDailySleepDao zhaohuiDailySleepDao;
    @Autowired
    private ZhaohuiDailyVideoDao zhaohuiDailyVideoDao;
    @Autowired
    private ZhaohuiDailyWatchDao zhaohuiDailyWatchDao;
    @Autowired
    private ZhaohuiDailyEmeDao zhaohuiDailyEmeDao;
    @Autowired
    private ZhaohuiDailyDao zhaohuiDailyDao;
    @Autowired
    private YsDeviceService ysDeviceService;
    public JSONObject getZHaohuiRiBaoInfo(String patient, String dailyId){
    public JSONObject getZHaohuiRiBaoInfo(String patient, String dailyId){
@ -350,19 +353,19 @@ public class PatientMessageService {
        JSONObject videoObject = new JSONObject();
        JSONObject videoObject = new JSONObject();
        List<ZhaohuiDailyVideoEntity> videoEntityList = zhaohuiDailyVideoDao.findByDailyId(dailyId);
        List<ZhaohuiDailyVideoEntity> videoEntityList = zhaohuiDailyVideoDao.findByDailyId(dailyId);
        if (videoEntityList.size()>0) {
        if (videoEntityList.size()>0) {
            //取之前时间的监控
            try {
            try {
                    videoObject.put("status", 1);
                    String[] time = videoEntityList.get(0).getTime().split(",");
                    JSONObject tmp = ysDeviceService.videoList2(patient, videoEntityList.get(0).getDeviceSn(), 1, null, null, 4, null, time[0], time[1], "2", null, null, null);
                    videoObject.put("monitorInfoStatus", tmp.getIntValue(ResponseContant.resultFlag));
                    if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                        videoObject.put("monitorInfo", tmp.getString(ResponseContant.resultMsg));
                    } else {
                        JSONObject js1 = tmp.getJSONObject(ResponseContant.resultMsg);
                        js1.put("hdAddress", js1.getString("url"));
                        videoObject.put("monitorInfo", js1);
                    }
                videoObject.put("status", 1);
                JSONObject tmp = ysDeviceService.getDeviceLiveAddress(patient, "F56826706", 1, null);
                videoObject.put("deviceSn", "F56826706");
                videoObject.put("monitorInfoStatus", tmp.getIntValue(ResponseContant.resultFlag));
                if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                    videoObject.put("monitorInfo", tmp.getString(ResponseContant.resultMsg));
                } else {
                    videoObject.put("monitorInfo", tmp.getJSONObject(ResponseContant.resultMsg));
                }
                videoObject.put("eme_Status",videoEntityList.get(0).getEmeStatus());
                videoObject.put("order_id",videoEntityList.get(0).getOrderId());
            } catch (Exception e) {
            } catch (Exception e) {
                e.printStackTrace();
                e.printStackTrace();
                videoObject.put("monitorInfoStatus", 0);
                videoObject.put("monitorInfoStatus", 0);
@ -403,10 +406,12 @@ public class PatientMessageService {
            StringBuffer sql = new StringBuffer("SELECT  id,eme_num,service,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time,patient_name FROM base_zhaohui_daily WHERE family_code = '" + patient + "' ");
            StringBuffer sql = new StringBuffer("SELECT  id,eme_num,service,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time,patient_name FROM base_zhaohui_daily WHERE family_code = '" + patient + "' ");
            if (StringUtils.isNotBlank(start)) {
            if (StringUtils.isNotBlank(start)) {
                start+=" 00:00:00";
                sql.append(" and create_time >='" + start + "' ");
                sql.append(" and create_time >='" + start + "' ");
            }
            }
            if (StringUtils.isNotBlank(end)) {
            if (StringUtils.isNotBlank(end)) {
                end +=" 23:59:59";
                sql.append(" and create_time <= '" + end + "' ");
                sql.append(" and create_time <= '" + end + "' ");
            }
            }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
@ -415,6 +420,15 @@ public class PatientMessageService {
        return list;
        return list;
    }
    }
    public void padUseTime(String patient){
        PadUseTimeEntity padUseTimeEntity = new PadUseTimeEntity();
        padUseTimeEntity.setTime(1);
        padUseTimeEntity.setPatient(patient);
        padUseTimeEntity.setCreateTime(new Date());
        padUseTimeDao.save(padUseTimeEntity);
    }
    public List<Map<String, Object>> getFamilySystemMessageList(String type, String patient, String startTime, String endTime) {
    public List<Map<String, Object>> getFamilySystemMessageList(String type, String patient, String startTime, String endTime) {
        StringBuffer sql = new StringBuffer("select id,code,type,title,sender,sender_name,receiver,receiver_name,data,is_read,del,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time ,content,user_type from base_system_message where user_type = 3 and type in (" + type + ") and receiver = '" + patient + "' ");
        StringBuffer sql = new StringBuffer("select id,code,type,title,sender,sender_name,receiver,receiver_name,data,is_read,del,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time ,content,user_type from base_system_message where user_type = 3 and type in (" + type + ") and receiver = '" + patient + "' ");

+ 20 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/dao/pushLog/PadUseTimeDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.care.dao.pushLog;
import com.yihu.jw.entity.log.PadUseTimeEntity;
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/11/17
 */
public interface PadUseTimeDao extends PagingAndSortingRepository<PadUseTimeEntity, String>, JpaSpecificationExecutor<PadUseTimeEntity> {
    @Query("select a from PadUseTimeEntity a where a.patient = ?1 and a.createTime>= ?2 and a.createTime<= ?3 ")
    List<PadUseTimeEntity> findByPatient(String patient,String startTime,String endTime);
}

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

@ -60,14 +60,11 @@ public class WechatPushService {
    }
    }
    private void wxPush(String openid,JSONObject watch,String online,String name){
    private void wxPush(String openid,JSONObject watch,String online,String name){
        if (name.equals("姜云")){
        String first = "您好,您的亲属【"+name+"】当前设备状态如下";
        String first = "您好,您的亲属【"+name+"】当前设备状态如下";
        String content = "智能手表:"+watch.get("WatchWear")+"\r\n智能手表:"+watch.get("pwoer")+"\r\n离线设备:"+online;
        String content = "智能手表:"+watch.get("WatchWear")+"\r\n智能手表:"+watch.get("pwoer")+"\r\n离线设备:"+online;
        String url = "https://zhyzh.gongshu.gov.cn/medical-care-patient/healthRecords/index?active=1";
        String url = "https://zhyzh.gongshu.gov.cn/medical-care-patient/healthRecords/index?active=1";
        //o_DJs59V7MKJ5ea-YW__LoccEn50
        //o_DJs59V7MKJ5ea-YW__LoccEn50
           messageUtil.putTemplateWxMessage(wxId,"template_system_family","jsxtxx",openid,first,url,null,1,null,content,"【推送完成】", com.yihu.jw.util.date.DateUtil.getStringDate());
           messageUtil.putTemplateWxMessage(wxId,"template_system_family","jsxtxx",openid,first,url,null,1,null,content,"【推送完成】", com.yihu.jw.util.date.DateUtil.getStringDate());
        }
    }
    }

+ 60 - 14
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/message/ZhaohuiDailyService.java

@ -10,6 +10,8 @@ import com.yihu.jw.entity.log.*;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.BeanPropertyRowMapper;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -29,6 +31,9 @@ import java.util.Map;
@Component
@Component
public class ZhaohuiDailyService {
public class ZhaohuiDailyService {
    private static Logger logger = LoggerFactory.getLogger(ZhaohuiDailyService.class);
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
@ -75,7 +80,6 @@ public class ZhaohuiDailyService {
    private void getOldFamily(BasePatientDO old) {
    private void getOldFamily(BasePatientDO old) {
        String sql = "select family_member from base_patient_family_member where patient ='" + old.getId() + "' and del = 1 ";
        String sql = "select family_member from base_patient_family_member where patient ='" + old.getId() + "' and del = 1 ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List result = new ArrayList<>();
        for (Map<String, Object> map : list) {
        for (Map<String, Object> map : list) {
             getFamilyOldInfo(old,map.get("family_member").toString());
             getFamilyOldInfo(old,map.get("family_member").toString());
        }
        }
@ -83,6 +87,8 @@ public class ZhaohuiDailyService {
    @Autowired
    private PadUseTimeDao padUseTimeDao;
    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public void getFamilyOldInfo(BasePatientDO old,String familyCode) {
    public void getFamilyOldInfo(BasePatientDO old,String familyCode) {
@ -96,8 +102,8 @@ public class ZhaohuiDailyService {
        String oldId = old.getId();
        String oldId = old.getId();
        String date = DateUtil.getStringDateShort();
        String date = DateUtil.getStringDateShort();
        String stateDate = "2022-01-01" + " 00:00:00";
        String endDate = "2022-11-15" + " 23:59:59";
        String stateDate = "2022-11-17" + " 00:00:00";
        String endDate = "2022-11-17" + " 23:59:59";
        String sex = old.getSex()==1?"爷爷":"奶奶";
        String sex = old.getSex()==1?"爷爷":"奶奶";
@ -111,13 +117,13 @@ public class ZhaohuiDailyService {
        String message = "";
        String message = "";
        String emeSql = "select count(id) from base_emergency_assistance_order where patient='"+oldId+"' and status in (0,1) and create_time>='"+stateDate+"' and create_time<='"+endDate+"'";
        String emeSql = "select count(id) from base_emergency_assistance_order where patient='"+oldId+"'  and create_time>='"+stateDate+"' and create_time<='"+endDate+"'";
        Integer emeTotal = jdbcTemplate.queryForObject(emeSql, Integer.class);
        Integer emeTotal = jdbcTemplate.queryForObject(emeSql, Integer.class);
        if (emeTotal>0){
        if (emeTotal>0){
            message += old.getName()+sex+"今日发起"+emeTotal+"次紧急呼叫";
            message += old.getName()+sex+"今日发起"+emeTotal+"次紧急呼叫";
        }
        }
        String secSql ="select count(id) total,serve_desc from  base_security_monitoring_order where patient= '"+oldId+"' and create_time>='"+stateDate+"' and create_time<='"+endDate+"'and status in (0,1)";
        String secSql ="select count(id) total,serve_desc from  base_security_monitoring_order where patient= '"+oldId+"' and create_time>='"+stateDate+"' and create_time<='"+endDate+"' ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(secSql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(secSql);
        if (list.size()>0&&0>Integer.parseInt(list.get(0).get("total").toString())) {
        if (list.size()>0&&0>Integer.parseInt(list.get(0).get("total").toString())) {
            if (StringUtils.isNotBlank(message)) {
            if (StringUtils.isNotBlank(message)) {
@ -126,9 +132,9 @@ public class ZhaohuiDailyService {
                message = "监护到"+old.getName()+sex+"今日存在安全预警:【"+list.get(0).get("serve_desc")+"】";
                message = "监护到"+old.getName()+sex+"今日存在安全预警:【"+list.get(0).get("serve_desc")+"】";
            }
            }
        }
        }
        zhaohuiDailyEntity.setEmeNum(emeTotal+list.size()>0?Integer.parseInt(list.get(0).get("total").toString()):0);
        zhaohuiDailyEntity.setEmeNum(emeTotal+(list.size()>0?Integer.parseInt(list.get(0).get("total").toString()):0));
        if (StringUtils.isBlank("")) {
        if (StringUtils.isBlank(message)) {
            message = old.getName()+sex+"今日状态正常,未发生异常情况";
            message = old.getName()+sex+"今日状态正常,未发生异常情况";
        }
        }
@ -145,9 +151,26 @@ public class ZhaohuiDailyService {
            zhaohuiDailyEntity.setServiceTime(lifeList.get(0).get("create_time").toString());
            zhaohuiDailyEntity.setServiceTime(lifeList.get(0).get("create_time").toString());
            zhaohuiDailyEntity.setServiceName(lifeList.get(0).get("name").toString());
            zhaohuiDailyEntity.setServiceName(lifeList.get(0).get("name").toString());
        }
        }
        zhaohuiDailyEntity.setPadTime("10");
        zhaohuiDailyEntity.setPadLastTime("15");
        zhaohuiDailyEntity.setPadLastTotalTime("2022-10-15 23:15:12");
        String abcd = "select * from pad_use_time where patient = '"+oldId+"' and create_time>= '"+stateDate+"' and create_time<='"+endDate+"' ";
        List<Map<String, Object>> padUseTimeList = jdbcTemplate.queryForList(abcd);
        Integer padNum = padUseTimeList.stream().mapToInt(padUserTime->Integer.parseInt(padUserTime.get("time").toString())).sum();
        /*List<PadUseTimeEntity> padTimeList = padUseTimeDao.findByPatient(oldId,stateDate,endDate);
        Integer padNum = padTimeList.stream().mapToInt(PadUseTimeEntity::getTime).sum();*/
        zhaohuiDailyEntity.setPadTime(padNum.toString());
        if (padUseTimeList.size()>0) {
            padUseTimeList.get(padUseTimeList.size()-1).get("time");
            zhaohuiDailyEntity.setPadLastTime(padUseTimeList.get(padUseTimeList.size()-1).get("time").toString());
            zhaohuiDailyEntity.setPadLastTotalTime(padUseTimeList.get(padUseTimeList.size()-1).get("create_time").toString());
        }else {
            zhaohuiDailyEntity.setPadLastTime("0");
            zhaohuiDailyEntity.setPadLastTotalTime("无");
        }
        zhaohuiDailyEntity = zhaohuiDailyDao.save(zhaohuiDailyEntity);
        zhaohuiDailyEntity = zhaohuiDailyDao.save(zhaohuiDailyEntity);
@ -171,8 +194,10 @@ public class ZhaohuiDailyService {
                    if (jjbjqList.size()>0) {
                    if (jjbjqList.size()>0) {
                        zhaohuiDailyEmeEntity.setMessage("发出紧急呼叫");
                        zhaohuiDailyEmeEntity.setMessage("发出紧急呼叫");
                        zhaohuiDailyEmeEntity.setOrderId(jjbjqList.get(0).get("id").toString());
                        zhaohuiDailyEmeEntity.setOrderId(jjbjqList.get(0).get("id").toString());
                        zhaohuiDailyEmeEntity.setMemStatus(1);
                    }else {
                    }else {
                        zhaohuiDailyEmeEntity.setMessage("未发出主动报警");
                        zhaohuiDailyEmeEntity.setMessage("未发出主动报警");
                        zhaohuiDailyEmeEntity.setMemStatus(0);
                    }
                    }
                    JSONObject aqgDeviceInfo2 = patientDeviceService.getAqgDeviceInfo2(deviceSn);
                    JSONObject aqgDeviceInfo2 = patientDeviceService.getAqgDeviceInfo2(deviceSn);
@ -223,7 +248,7 @@ public class ZhaohuiDailyService {
                    if (sqlResult.size() > 0) {
                    if (sqlResult.size() > 0) {
                        Integer num = sqlResult.stream().mapToInt(obj -> Integer.parseInt(obj.get("value1").toString())).sum();
                        Integer num = sqlResult.stream().mapToInt(obj -> Integer.parseInt(obj.get("value1").toString())).sum();
                        zhaohuiDailyWatchEntity.setHeart((num / sqlResult.size()) + "");
                        zhaohuiDailyWatchEntity.setHeart((num / sqlResult.size()) + "");
                        zhaohuiDailyWatchEntity.setHearts(JSONObject.toJSONString(sqlResult.get(0)));
                        zhaohuiDailyWatchEntity.setHearts(JSONObject.toJSONString(sqlResult));
                    }
                    }
                    //手表步数数据
                    //手表步数数据
@ -256,18 +281,22 @@ public class ZhaohuiDailyService {
                case 12: //防跌倒视频监测
                case 12: //防跌倒视频监测
                    ZhaohuiDailyVideoEntity zhaohuiDailyVideoEntity = new ZhaohuiDailyVideoEntity();
                    ZhaohuiDailyVideoEntity zhaohuiDailyVideoEntity = new ZhaohuiDailyVideoEntity();
                    sql = " select o.serve_desc  " +
                    sql = " select o.serve_desc,o.id  " +
                            "  from base_security_monitoring_order o " +
                            "  from base_security_monitoring_order o " +
                            " INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1  and o.create_time >= '"+stateDate+"' and o.create_time <= '"+endDate+"' ORDER BY o.create_time desc  limit 1   ";
                            " INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1  and o.create_time >= '"+stateDate+"' and o.create_time <= '"+endDate+"' and topic_item = 'preventFall' ORDER BY o.create_time desc  limit 1   ";
                    sqlResult = jdbcTemplate.queryForList(sql);
                    sqlResult = jdbcTemplate.queryForList(sql);
                    if (sqlResult.size()>0){
                    if (sqlResult.size()>0){
                        zhaohuiDailyVideoEntity.setServeDesc(sqlResult.get(0).get("serve_desc").toString());
                        zhaohuiDailyVideoEntity.setServeDesc(sqlResult.get(0).get("serve_desc").toString());
                        zhaohuiDailyVideoEntity.setOrderId(sqlResult.get(0).get("id").toString());
                        zhaohuiDailyVideoEntity.setEmeStatus(1);
                    }else {
                        zhaohuiDailyVideoEntity.setEmeStatus(0);
                        zhaohuiDailyVideoEntity.setServeDesc("无");
                    }
                    }
                    zhaohuiDailyVideoEntity.setDeviceSn(deviceSn);
                    zhaohuiDailyVideoEntity.setDeviceSn(deviceSn);
                    zhaohuiDailyVideoEntity.setDailyId(zhaohuiDailyEntity.getId().toString());
                    zhaohuiDailyVideoEntity.setDailyId(zhaohuiDailyEntity.getId().toString());
                    zhaohuiDailyVideoEntity.setTime(stateDate + "," + endDate);
                    zhaohuiDailyVideoEntity.setTime(stateDate + "," + endDate);
                    zhaohuiDailyVideoEntity.setServeDesc("无");
                    zhaohuiDailyVideoList.add(zhaohuiDailyVideoEntity);
                    zhaohuiDailyVideoList.add(zhaohuiDailyVideoEntity);
                    break;
                    break;
                case 13: //睡眠带
                case 13: //睡眠带
@ -325,6 +354,7 @@ public class ZhaohuiDailyService {
        }
        }
        wxPush(old.getName(),familyCode, zhaohuiDailyEntity.getService(), emeTotal);
@ -345,6 +375,22 @@ public class ZhaohuiDailyService {
    }
    }
    private void wxPush(String name, String familyCode,Integer lift,Integer eme) {
        String sql = "select openid from base_patient where id = '" + familyCode + "' and openid is not null ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list.size() > 0) {
            if (name.equals("姜云")) {
                String first = "您好,您的亲属【" + name + "】今日照护日报已生成";
                String content = "紧急预警:" + eme + "\r\n生活照料:" + lift + "";
                String url = "https://zhyzh.gongshu.gov.cn/medical-care-patient/healthRecords/index?active=1";
                //o_DJs59V7MKJ5ea-YW__LoccEn50
                messageUtil.putTemplateWxMessage(wxId, "template_system_family", "jsxtxx", list.get(0).get("openid").toString(), first, url, null, 1, null, content, "【推送完成】", com.yihu.jw.util.date.DateUtil.getStringDate());
            }
        }
    }
    public static void main(String[] args) {
    public static void main(String[] args) {
        String abc = "[\"12:30-14:09\",\"22:00-04:06\",\"05:09-05:24\"]";
        String abc = "[\"12:30-14:09\",\"22:00-04:06\",\"05:09-05:24\"]";
        String[] split = abc.split(",");
        String[] split = abc.split(",");

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

@ -56,5 +56,5 @@ DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB = 0 5 0 * * ?
PUSH_ZHAO_HUI_RI_BAO_JOB = 0 0 20 * * ?
PUSH_ZHAO_HUI_RI_BAO_JOB = 0 0 20 * * ?
#\u5BB6\u5C5E\u5FAE\u4FE1\u63A8\u9001 \u6BCF\u5929\u65E9\u4E0A\u5341\u70B9
#\u5BB6\u5C5E\u5FAE\u4FE1\u63A8\u9001 \u6BCF\u5929\u65E9\u4E0A\u5341\u70B9
FAMILY_WECHAT_PUSH_DEVICE_JOB = 0 0 10 * * ?
FAMILY_WECHAT_PUSH_DEVICE_JOB = 0 0 10 * * ?
#\u6BCF\u5929 \u7269\u8054\u8BBE\u5907\u5BF9\u63A5 \u63A8\u6B7B
#\u6BCF\u5929 \u7269\u8054\u8BBE\u5907\u5BF9\u63A5
DEVICE_SYNC_JOB = 0 0 23 * * ?
DEVICE_SYNC_JOB = 0 0 23 * * ?