wsl 2 年之前
父节点
当前提交
fe1a1edcd7

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

@ -2381,4 +2381,20 @@ CREATE TABLE `pad_use_time` (
  `create_time` datetime DEFAULT NULL COMMENT '统计时间',
  `create_time` datetime DEFAULT NULL COMMENT '统计时间',
  `time` int(2) DEFAULT NULL COMMENT '使用时间',
  `time` int(2) DEFAULT NULL COMMENT '使用时间',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8mb4 COMMENT='pad使用时间';
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8mb4 COMMENT='pad使用时间';
alter table base_zhaohui_daily_watch add column locations varchar(5000) default null comment '轨迹';
CREATE TABLE `base_zhaohui_fire_gas_sec` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `daily_id` varchar(50) NOT NULL COMMENT '朝晖日报id',
  `online` int(2) DEFAULT NULL COMMENT '在线状态0 不在线 1在线',
  `sec_status` int(2) DEFAULT NULL COMMENT '预警状态0无 1有',
  `order_id` varchar(50) DEFAULT NULL COMMENT '工单id',
  `fire_curve` varchar(5000) DEFAULT NULL COMMENT '曲线',
  `type` INT(2) DEFAULT NULL COMMENT '1 烟感 2气感',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='朝晖日报-烟感气感预警';

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

@ -76,6 +76,19 @@ public class ZhaohuiDailyEntity extends IdEntity {
    private String familyCode;
    private String familyCode;
    //所属社区
    private String orgCode;
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Column(name = "eme_num")
    @Column(name = "eme_num")
    public Integer getEmeNum() {
    public Integer getEmeNum() {
        return emeNum;
        return emeNum;

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/ZhaohuiDailyWatchEntity.java

@ -56,6 +56,19 @@ public class ZhaohuiDailyWatchEntity extends IdEntity {
    private String serveDesc;
    private String serveDesc;
    //轨迹
    private String locations;
    @Column(name = "locations")
    public String getLocations() {
        return locations;
    }
    public void setLocations(String locations) {
        this.locations = locations;
    }
    @Column(name = "daily_id")
    @Column(name = "daily_id")
    public String getDailyId() {
    public String getDailyId() {
        return dailyId;
        return dailyId;

+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/ZhaohuifireGasSecEntity.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.log;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by wsl on 2022/11/28
 */
@Entity
@Table(name = "base_zhaohui_fire_gas_sec")
public class ZhaohuifireGasSecEntity extends IdEntity {
    /**
     * 朝晖日报id
     */
    private String dailyId;
    /**
     * 在线状态0 不在线 1在线
     */
    private Integer online;
    /**
     * 预警状态0无 1有
     */
    private Integer secStatus;
    /**
     * 工单id
     */
    private String orderId;
    /**
     * 曲线
     */
    private String fireCurve;
    /**
     * 1 烟感 2气感
     */
    private Integer type;
    @Column(name = "daily_id")
    public String getDailyId() {
        return dailyId;
    }
    public void setDailyId(String dailyId) {
        this.dailyId = dailyId;
    }
    @Column(name = "online")
    public Integer getOnline() {
        return online;
    }
    public void setOnline(Integer online) {
        this.online = online;
    }
    @Column(name = "sec_status")
    public Integer getSecStatus() {
        return secStatus;
    }
    public void setSecStatus(Integer secStatus) {
        this.secStatus = secStatus;
    }
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    @Column(name = "fire_curve")
    public String getFireCurve() {
        return fireCurve;
    }
    public void setFireCurve(String fireCurve) {
        this.fireCurve = fireCurve;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -240,8 +240,8 @@ public class ConsultTeamService {
                systemMessageDao.save(messageDO);
                systemMessageDao.save(messageDO);
                BasePatientDO family3 = patientDao.findById(patientId);
                BasePatientDO family3 = patientDao.findById(patientId);
                messageUtil.putTemplateWxMessage(wxId,"template_error_notice","jjhjyctz",family3.getOpenid(),patientDO.getName()+"发起紧急呼叫",null,null,3,templateJson, DateUtil.getStringDate(),"紧急呼叫",title+",请及时核实处理");
                String url = "https://zhyzh.gongshu.gov.cn/medical-care-patient/sos/info?id="+orderId+"&OrderType=20";
                messageUtil.putTemplateWxMessage(wxId,"template_error_notice","jjhjyctz",family3.getOpenid(),patientDO.getName()+"发起紧急呼叫",url,null,3,templateJson, DateUtil.getStringDate(),"紧急呼叫",title+",请及时核实处理");
            }
            }
        }
        }

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

@ -125,6 +125,7 @@ public class MessageUtil {
     * type 1 安防紧急预警 2紧急呼叫 4im 5生日祝福
     * type 1 安防紧急预警 2紧急呼叫 4im 5生日祝福
     * msgtype 消息类型 text
     * msgtype 消息类型 text
     */
     */
    @Async
    public void sendDoctorDingdingMessage(BaseDoctorDO doctorDO,String doctorCode,String msgtype,String type,String content,String title,String url){
    public void sendDoctorDingdingMessage(BaseDoctorDO doctorDO,String doctorCode,String msgtype,String type,String content,String title,String url){
        try {
        try {
            if(doctorDO == null){
            if(doctorDO == null){

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

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

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

@ -1,6 +1,7 @@
package com.yihu.jw.care.service.device;
package com.yihu.jw.care.service.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.DeviceDao;
import com.yihu.jw.care.dao.device.DeviceDao;
@ -14,6 +15,7 @@ import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,6 +23,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
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.transaction.annotation.Transactional;
@ -412,6 +415,40 @@ public class PatientDeviceService {
    }
    }
    public static final String X1_locations = baseUrl+"/api/locationdata/";
    public JSONArray getX1Locations(String deviceSn, String time_begin){
        JSONArray result = new JSONArray();
        String url = X1_locations+"?device="+deviceSn+"&depth="+1+"&rows_per_page="+300;
        if (StringUtils.isNotBlank(time_begin)){
            url += "&time_begin="+time_begin;
        }
        Map<String,Object> headers = new HashMap<>();
        headers.put("Accept", MediaType.APPLICATION_JSON.toString());
        headers.put("Cookie", getCookie());
        String  responseStr = httpClientUtil.get(url,"utf-8",headers);
        com.alibaba.fastjson.JSONObject resObj = JSON.parseObject(responseStr);
        if (resObj.getBooleanValue("success")){
            com.alibaba.fastjson.JSONArray arr = resObj.getJSONArray("objs");
            arr.sort(Comparator.comparing(obj -> ((com.alibaba.fastjson.JSONObject) obj).getJSONObject("created_at").getLong("$date")));
            for (int i=0;i<arr.size();i++){
                try {
                    com.alibaba.fastjson.JSONObject obj = arr.getJSONObject(i);
                    com.alibaba.fastjson.JSONArray pointArr = obj.getJSONObject("point").getJSONArray("coordinates");
                    Double lon = pointArr.getDouble(0);
                    Double lat = pointArr.getDouble(1);
                    com.alibaba.fastjson.JSONObject pointJson = gpsUtil.gcj02_To_Bd09(lat,lon);
                    result.put(pointJson);
                }catch (Exception e){
                }
            }
        }
        return result;
    }

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

@ -1,11 +1,14 @@
package com.yihu.jw.care.service.message;
package com.yihu.jw.care.service.message;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.pushLog.*;
import com.yihu.jw.care.dao.pushLog.*;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.log.*;
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;
@ -55,6 +58,8 @@ public class ZhaohuiDailyService {
    private ZhaohuiDailySleepDao zhaohuiDailySleepDao;
    private ZhaohuiDailySleepDao zhaohuiDailySleepDao;
    @Autowired
    @Autowired
    private ZhaohuiDailyEmeDao zhaohuiDailyEmeDao;
    private ZhaohuiDailyEmeDao zhaohuiDailyEmeDao;
    @Autowired
    private ZhaohuifireGasSecDao zhaohuifireGasSecDao;
    public void allRound() {
    public void allRound() {
@ -86,6 +91,12 @@ public class ZhaohuiDailyService {
    }
    }
    public String messageDict(String dictCode){
        String sql = "select * from base_yujing_dict where dict_name = 'zhaohui' ";
    }
    @Autowired
    @Autowired
    private PadUseTimeDao padUseTimeDao;
    private PadUseTimeDao padUseTimeDao;
@ -97,6 +108,7 @@ public class ZhaohuiDailyService {
        List<ZhaohuiDailySleepEntity> zhaohuiDailySleepList = new ArrayList<>();
        List<ZhaohuiDailySleepEntity> zhaohuiDailySleepList = new ArrayList<>();
        List<ZhaohuiDailyVideoEntity> zhaohuiDailyVideoList = new ArrayList<>();
        List<ZhaohuiDailyVideoEntity> zhaohuiDailyVideoList = new ArrayList<>();
        List<ZhaohuiDailyEmeEntity> zhaohuiDailyEmeList = new ArrayList<>();
        List<ZhaohuiDailyEmeEntity> zhaohuiDailyEmeList = new ArrayList<>();
        List<ZhaohuifireGasSecEntity> zhaohuifireGasSecEntityList = new ArrayList<>();
@ -114,16 +126,22 @@ public class ZhaohuiDailyService {
        zhaohuiDailyEntity.setCreateTime(new Date());
        zhaohuiDailyEntity.setCreateTime(new Date());
        zhaohuiDailyEntity.setFamilyCode(familyCode);
        zhaohuiDailyEntity.setFamilyCode(familyCode);
        String orgCodeSql = "SELECT d.org_code as orgCode FROM base_patient p INNER JOIN base_service_package_sign_record r ON p.id = r.patient INNER JOIN base_doctor_hospital d ON r.sign_doctor = d.doctor_code WHERE d.del =1 and = p.id = '"+oldId+"' ";
        List<Map<String, Object>> orgCodeList = jdbcTemplate.queryForList(orgCodeSql);
        if (orgCodeList.size()>0) {
            zhaohuiDailyEntity.setOrgCode(orgCodeList.get(0).get("orgCode").toString());
        }
        String message = "";
        String message = "";
        String emeSql = "select count(id) from base_emergency_assistance_order where patient='"+oldId+"'  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+"' and status <> -1";
        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+"' ";
        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 <> -1 ";
        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)) {
@ -135,14 +153,14 @@ public class ZhaohuiDailyService {
        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(message)) {
        if (StringUtils.isBlank(message)) {
            message = old.getName()+sex+"今日状态正常,未发生异常情况";
            message = old.getName()+sex+"今日状态正常,未发生异常情况,今日家中设备工作正常";
        }
        }
        zhaohuiDailyEntity.setMessage(message);
        zhaohuiDailyEntity.setMessage(message);
        String lifeSql = "select count(id) from base_life_care_order where patient = '" + oldId + "' and status = 1 and create_time>= '" + stateDate + "' and create_time<= '" + endDate + "'";
        String lifeSql = "select count(id) from base_life_care_order where patient = '" + oldId + "' and status = 1 and create_time>= '" + stateDate + "' and create_time<= '" + endDate + "' and status <> -1";
        String lifeInfoSql = "select d.name,d.create_time create_time from base_life_care_order o INNER JOIN base_life_care_fee_detail d ON o.id=d.order_id where o.patient = '" + oldId + "' and o.status = 1 and o.create_time>= '" + stateDate + "' and o.create_time<= '" + endDate + "' order by o.create_time DESC limit 1";
        String lifeInfoSql = "select d.name,d.create_time create_time from base_life_care_order o INNER JOIN base_life_care_fee_detail d ON o.id=d.order_id where o.patient = '" + oldId + "' and o.status = 1 and o.create_time>= '" + stateDate + "' and o.create_time<= '" + endDate + "' order by o.create_time DESC limit 1";
        List<Map<String, Object>> lifeList = jdbcTemplate.queryForList(lifeInfoSql);
        List<Map<String, Object>> lifeList = jdbcTemplate.queryForList(lifeInfoSql);
        Integer lifeTotal = jdbcTemplate.queryForObject(lifeSql, Integer.class);
        Integer lifeTotal = jdbcTemplate.queryForObject(lifeSql, Integer.class);
@ -178,7 +196,7 @@ public class ZhaohuiDailyService {
        String sql = "SELECT pd.device_sn,pd.category_code FROM base.wlyy_patient_device pd  where pd.del=0 AND  category_code in ('7','12','4','13') AND user = '" + oldId + "'  ";
        String sql = "SELECT pd.device_sn,pd.category_code FROM base.wlyy_patient_device pd  where pd.del=0 AND  category_code in ('7','12','4','13') AND user = '" + oldId + "'  ";
        List<Map<String, Object>> oldDeviceList = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> oldDeviceList = jdbcTemplate.queryForList(sql);
        String zhaohuiID = zhaohuiDailyEntity.getId().toString();
        for (Map<String, Object> device : oldDeviceList) {
        for (Map<String, Object> device : oldDeviceList) {
            String deviceSn = device.get("device_sn").toString();
            String deviceSn = device.get("device_sn").toString();
@ -187,7 +205,7 @@ public class ZhaohuiDailyService {
                case 7: //居家报警器
                case 7: //居家报警器
                    ZhaohuiDailyEmeEntity zhaohuiDailyEmeEntity = new ZhaohuiDailyEmeEntity();
                    ZhaohuiDailyEmeEntity zhaohuiDailyEmeEntity = new ZhaohuiDailyEmeEntity();
                    zhaohuiDailyEmeEntity.setDailyId(zhaohuiDailyEntity.getId().toString());
                    zhaohuiDailyEmeEntity.setDailyId(zhaohuiID);
                    sql = "  select o.id,o.create_time from base_emergency_assistance_order o " +
                    sql = "  select o.id,o.create_time from base_emergency_assistance_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 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+"'  ORDER BY create_time desc  limit 1 ";
@ -218,7 +236,7 @@ public class ZhaohuiDailyService {
                case 4: //智能手表
                case 4: //智能手表
                    ZhaohuiDailyWatchEntity zhaohuiDailyWatchEntity = new ZhaohuiDailyWatchEntity();
                    ZhaohuiDailyWatchEntity zhaohuiDailyWatchEntity = new ZhaohuiDailyWatchEntity();
                    zhaohuiDailyWatchEntity.setDailyId(zhaohuiDailyEntity.getId().toString());
                    zhaohuiDailyWatchEntity.setDailyId(zhaohuiID);
                    JSONObject response = patientDeviceService.getAqgDeviceInfo2(deviceSn);
                    JSONObject response = patientDeviceService.getAqgDeviceInfo2(deviceSn);
                    if (null != response) {
                    if (null != response) {
@ -277,6 +295,11 @@ public class ZhaohuiDailyService {
                        zhaohuiDailyWatchEntity.setServeDesc("无");
                        zhaohuiDailyWatchEntity.setServeDesc("无");
                    }
                    }
                    JSONArray x1Locations = getX1Locations(oldId, stateDate);
                    if (null!=x1Locations&&x1Locations.size()>0) {
                        zhaohuiDailyWatchEntity.setLocations(x1Locations.toJSONString());
                    }
                    zhaohuiDailyWatchList.add(zhaohuiDailyWatchEntity);
                    zhaohuiDailyWatchList.add(zhaohuiDailyWatchEntity);
                    break;
                    break;
                case 12: //防跌倒视频监测
                case 12: //防跌倒视频监测
@ -296,13 +319,13 @@ public class ZhaohuiDailyService {
                    }
                    }
                    zhaohuiDailyVideoEntity.setDeviceSn(deviceSn);
                    zhaohuiDailyVideoEntity.setDeviceSn(deviceSn);
                    zhaohuiDailyVideoEntity.setDailyId(zhaohuiDailyEntity.getId().toString());
                    zhaohuiDailyVideoEntity.setDailyId(zhaohuiID);
                    zhaohuiDailyVideoEntity.setTime(stateDate + "," + endDate);
                    zhaohuiDailyVideoEntity.setTime(stateDate + "," + endDate);
                    zhaohuiDailyVideoList.add(zhaohuiDailyVideoEntity);
                    zhaohuiDailyVideoList.add(zhaohuiDailyVideoEntity);
                    break;
                    break;
                case 13: //睡眠带
                case 13: //睡眠带
                    ZhaohuiDailySleepEntity zhaohuiDailySleep = new ZhaohuiDailySleepEntity();
                    ZhaohuiDailySleepEntity zhaohuiDailySleep = new ZhaohuiDailySleepEntity();
                    zhaohuiDailySleep.setDailyId(zhaohuiDailyEntity.getId().toString());
                    zhaohuiDailySleep.setDailyId(zhaohuiID);
                    JSONObject sleepDeviceInfo = patientDeviceService.getSleepDeviceInfo(deviceSn);
                    JSONObject sleepDeviceInfo = patientDeviceService.getSleepDeviceInfo(deviceSn);
                    if (sleepDeviceInfo.getBooleanValue("success")) {
                    if (sleepDeviceInfo.getBooleanValue("success")) {
                        JSONArray objs = sleepDeviceInfo.getJSONArray("objs");
                        JSONArray objs = sleepDeviceInfo.getJSONArray("objs");
@ -351,6 +374,48 @@ public class ZhaohuiDailyService {
                    }
                    }
                    zhaohuiDailySleepList.add(zhaohuiDailySleep);
                    zhaohuiDailySleepList.add(zhaohuiDailySleep);
                    break;
                    break;
                case 14: //烟感
                    ZhaohuifireGasSecEntity yg = new ZhaohuifireGasSecEntity();
                    sql = " select count(o.id) as total 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 create_time desc    ";
                    Integer ygTotal = jdbcTemplate.queryForObject(sql, Integer.class);
                    sql = " select value, DATE_FORMAT( record_time, '%H:%i:%S' ) as record_time  from base_device_health_index where device_sn='" + deviceSn + "' and record_time >= '" + stateDate + "' and record_time <= '" + endDate + "' ORDER BY record_time desc";
                    List<Map<String, Object>> ygList = jdbcTemplate.queryForList(sql);
                    JSONArray ygJsonArray = JSONArray.parseArray(ygList.toString());
                    yg.setDailyId(zhaohuiID);
                    yg.setOnline(1);
                    yg.setType(1);
                    if (ygTotal>0) {
                        yg.setSecStatus(1);
                    }else {
                        yg.setSecStatus(0);
                    }
                    yg.setFireCurve(ygJsonArray.toJSONString());
                    zhaohuifireGasSecEntityList.add(yg);
                    break;
                case 15: //气感
                    sql = " select count(o.id) as total 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 create_time desc  limit 1 ";
                    Integer qgTotal = jdbcTemplate.queryForObject(sql, Integer.class);
                    ZhaohuifireGasSecEntity qg = new ZhaohuifireGasSecEntity();
                    qg.setDailyId(zhaohuiID);
                    qg.setOnline(1);
                    qg.setType(2);
                    if (qgTotal>0) {
                        qg.setSecStatus(1);
                    }else {
                        qg.setSecStatus(0);
                    }
                    sql = " select value,DATE_FORMAT( record_time, '%H:%i:%S' ) as record_time  from base_device_health_index where device_sn='"+deviceSn+"' and record_time >='"+stateDate+"' and record_time <= '"+endDate+"'  ORDER BY record_time desc limit 1 ";
                    List<Map<String, Object>> qgList = jdbcTemplate.queryForList(sql);
                    JSONArray qgJsonArray = JSONArray.parseArray(qgList.toString());
                    qg.setFireCurve(qgJsonArray.toJSONString());
                    zhaohuifireGasSecEntityList.add(qg);
                    break;
            }
            }
        }
        }
@ -373,6 +438,7 @@ public class ZhaohuiDailyService {
        zhaohuiDailyWatchDao.save(zhaohuiDailyWatchList);
        zhaohuiDailyWatchDao.save(zhaohuiDailyWatchList);
        zhaohuiDailyVideoDao.save(zhaohuiDailyVideoList);
        zhaohuiDailyVideoDao.save(zhaohuiDailyVideoList);
        zhaohuiDailyEmeDao.save(zhaohuiDailyEmeList);
        zhaohuiDailyEmeDao.save(zhaohuiDailyEmeList);
        zhaohuifireGasSecDao.save(zhaohuifireGasSecEntityList);
    }
    }
@ -390,6 +456,18 @@ public class ZhaohuiDailyService {
    }
    }
    //行动轨迹
    public JSONArray getX1Locations(String patient, String date){
        String sql = "select * from wlyy_patient_device where user = '"+patient+"' and category_code = '4' and del = 0";
        List<DevicePatientDevice> byUserAndCategoryCode = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(DevicePatientDevice.class));
        if (byUserAndCategoryCode.size()==0){
            return null;
        }
        JSONArray x1Locations = JSON.parseArray(JSON.toJSONString(patientDeviceService.getX1Locations(byUserAndCategoryCode.get(0).getDeviceSn(), date), SerializerFeature.WriteMapNullValue));
        return x1Locations;
    }
    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(",");
@ -401,4 +479,6 @@ public class ZhaohuiDailyService {
    }
    }
}
}