瀏覽代碼

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

liubing 3 年之前
父節點
當前提交
12fb0ef3a5

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

@ -1244,3 +1244,29 @@ ALTER table base.base_patient_sos_contacts add column phone_seqid int(2) default
ALTER table base_emergency_assistance_order add column device_sn varchar(50) DEFAULT NULL COMMENT '设备触发工单时有该字段';
ALTER table base_security_monitoring_order add column device_sn varchar(50) DEFAULT NULL COMMENT '设备触发工单时有该字段';
ALTER table base_service_package_record add column team_code varchar(50) DEFAULT NULL COMMENT '团队id';
--2021-08-12
ALTER table wlyy_patient_device add column online_status TINYINT(4) default '0' COMMENT '设备在线状态';
CREATE TABLE base.`base_sleep_device` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '居民id',
  `device_sn` varchar(50) DEFAULT NULL COMMENT '睡眠带sn',
  `falla_sleep` varchar(50) DEFAULT NULL COMMENT '入睡时长 分钟',
  `sleep_time` varchar(50) DEFAULT NULL COMMENT '睡眠时长 分钟',
  `rest_time` varchar(50) DEFAULT NULL COMMENT '休息时长 分钟',
  `awake_time` varchar(50) DEFAULT NULL COMMENT '清醒时长 分钟',
  `light_time` varchar(50) DEFAULT NULL COMMENT '浅睡时长 分钟',
  `rem_time` varchar(50) DEFAULT NULL COMMENT 'rem时长 分钟',
  `deep_time` varchar(50) DEFAULT NULL COMMENT '深睡时长 分钟',
  `bucket` varchar(50) DEFAULT NULL COMMENT '睡眠时段',
  `avghr` varchar(50) DEFAULT NULL COMMENT '平均心率',
  `avgbr` varchar(50) DEFAULT NULL COMMENT '平均呼吸率',
  `awake_per` varchar(50) DEFAULT NULL COMMENT '清醒百分比',
  `rem_per` varchar(50) DEFAULT NULL COMMENT 'rem百分比',
  `light_per` varchar(50) DEFAULT NULL COMMENT '浅睡百分比',
  `deep_per` varchar(50) DEFAULT NULL COMMENT '深睡百分比',
  `efficiency` varchar(50) DEFAULT NULL COMMENT '睡眠效率',
  `score` varchar(50) DEFAULT NULL COMMENT '睡眠评分 <=0无睡眠数据,<60待改善,<70一般,<85良好 其他,非常好',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '产生日期',
  `del` int(1) DEFAULT NULL COMMENT '是否有效 1有效 0无效',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='爱牵挂睡眠带数据';

+ 199 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepDeviceReport.java

@ -0,0 +1,199 @@
package com.yihu.jw.entity.care.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Bing on 2021/8/12.
 * 睡眠带
 */
@Entity
@Table(name="base_sleep_device")
public class BaseSleepDeviceReport extends IdEntity {
    public String patient;
    public String deviceSN; //睡眠带MAC地址
    public String fallaSleep;   //入睡时长 (分钟)
    public String sleepTime;    //睡眠时长 (分钟)
    public String restTime;     //休息时长 (分钟)
    public String awakeTime;    //清醒时长 (分钟)
    public String lightTime;//浅睡时长 (分钟)
    public String remTime;  //rem时长  (分钟)
    public String deepTime; //深睡时长 (分钟)
    public String bucket;   //睡眠时段
    public String avghr;    //平均心率
    public String avgbr;    //平均呼吸率
    public String awakePer; //清醒百分比
    public String remPer;   //rem百分比
    public String lightPer; //浅睡百分比
    public String deepPer;  //深睡百分比
    public String efficiency;   //睡眠效率
    public String score;    //睡眠评分
    public Date createTime; // //日期
    public Integer del; //是否有效 1有效 0无效
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getDeviceSN() {
        return deviceSN;
    }
    public void setDeviceSN(String deviceSN) {
        this.deviceSN = deviceSN;
    }
    public String getFallaSleep() {
        return fallaSleep;
    }
    public void setFallaSleep(String fallaSleep) {
        this.fallaSleep = fallaSleep;
    }
    public String getSleepTime() {
        return sleepTime;
    }
    public void setSleepTime(String sleepTime) {
        this.sleepTime = sleepTime;
    }
    public String getRestTime() {
        return restTime;
    }
    public void setRestTime(String restTime) {
        this.restTime = restTime;
    }
    public String getAwakeTime() {
        return awakeTime;
    }
    public void setAwakeTime(String awakeTime) {
        this.awakeTime = awakeTime;
    }
    public String getLightTime() {
        return lightTime;
    }
    public void setLightTime(String lightTime) {
        this.lightTime = lightTime;
    }
    public String getRemTime() {
        return remTime;
    }
    public void setRemTime(String remTime) {
        this.remTime = remTime;
    }
    public String getDeepTime() {
        return deepTime;
    }
    public void setDeepTime(String deepTime) {
        this.deepTime = deepTime;
    }
    public String getBucket() {
        return bucket;
    }
    public void setBucket(String bucket) {
        this.bucket = bucket;
    }
    public String getAvghr() {
        return avghr;
    }
    public void setAvghr(String avghr) {
        this.avghr = avghr;
    }
    public String getAvgbr() {
        return avgbr;
    }
    public void setAvgbr(String avgbr) {
        this.avgbr = avgbr;
    }
    public String getAwakePer() {
        return awakePer;
    }
    public void setAwakePer(String awakePer) {
        this.awakePer = awakePer;
    }
    public String getRemPer() {
        return remPer;
    }
    public void setRemPer(String remPer) {
        this.remPer = remPer;
    }
    public String getLightPer() {
        return lightPer;
    }
    public void setLightPer(String lightPer) {
        this.lightPer = lightPer;
    }
    public String getDeepPer() {
        return deepPer;
    }
    public void setDeepPer(String deepPer) {
        this.deepPer = deepPer;
    }
    public String getEfficiency() {
        return efficiency;
    }
    public void setEfficiency(String efficiency) {
        this.efficiency = efficiency;
    }
    public String getScore() {
        return score;
    }
    public void setScore(String score) {
        this.score = score;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 11 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java

@ -21,7 +21,7 @@ public class DevicePatientDevice extends IdEntity {
    private String deviceName;
    // 用户code
    private String user;
    // 设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器,12 监控器
    // 设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器,12 监控器 13 睡眠带
    private String categoryCode;
    // 用户类型标准 -1代表单用户
    private String userType;
@ -68,6 +68,8 @@ public class DevicePatientDevice extends IdEntity {
    //设备类型为报警器时,需要填写投放地址 category_code = 7
    private String sosAddress;
    private Integer onlineStatus;// 0不在线 1在线
  //========================非表字段======================
    //患者居住地址
    private String address;
@ -318,4 +320,12 @@ public class DevicePatientDevice extends IdEntity {
    public void setDeviceImgUrl(String deviceImgUrl) {
        this.deviceImgUrl = deviceImgUrl;
    }
    public Integer getOnlineStatus() {
        return onlineStatus;
    }
    public void setOnlineStatus(Integer onlineStatus) {
        this.onlineStatus = onlineStatus;
    }
}

+ 10 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java

@ -38,6 +38,16 @@ public class AqgConfig {
    public static final String S3fence_area = baseUrl +"/api/device/{0}/fences/{1}";
    public static final String X1fence_area = baseUrl +"/api/device/{0}/4g/fences/{1}";
    /**
     * 睡眠带 修改心率呼吸率报警阈值
     */
    public static final String  sleepDevice_edit=baseUrl+ "/api/sleepdevice/{0}/edit/";
    /**
     * 睡眠带 查询睡眠带信息
     */
    public static final String  sleepDevice_info=baseUrl+"/api/sleepdevice/";
    public static final String username = "13559485270";
    public static final String password = "zjxl@2021";

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

@ -0,0 +1,12 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BaseSleepDeviceReport;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/8/12.
 */
public interface BaseSleepDeviceReportDao extends PagingAndSortingRepository<BaseSleepDeviceReport,Long> ,
        JpaSpecificationExecutor<BaseSleepDeviceReport> {
}

+ 44 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -305,6 +305,50 @@ public class PatientDeviceController extends BaseController {
        }
    }
    @ApiOperation("获取睡眠带设备信息")
    @RequestMapping(value = "getSleepDeviceInfo",method = RequestMethod.GET)
    public String getSleepDeviceInfo(@ApiParam(name = "deviceSn",value = "睡眠带MAC 去除符号:")
                                        @RequestParam(value = "deviceSn",required = true)String deviceSn){
        try {
            return write(200,"获取成功","data",patientDeviceService.getSleepDeviceInfo(deviceSn));
        }catch (Exception e){
            return errorResult(e);
        }
    }
    @ApiOperation("修改心率呼吸率报警阈值")
    @RequestMapping(value = "sleepDeviceEdit",method = RequestMethod.GET)
    public String sleepDeviceEdit(@ApiParam(name = "deviceSn",value = "睡眠带MAC 去除符号:")
                                        @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                        @ApiParam(name = "heart_check_enable",value = "心率异常检查开关0是关,1是开 ")
                                        @RequestParam(value = "heart_check_enable",required = false)Integer heart_check_enable,
                                        @ApiParam(name = "breath_check_enable",value = "呼吸率异常检查开关")
                                        @RequestParam(value = "breath_check_enable",required = false)Integer breath_check_enable,
                                        @ApiParam(name = "offbed_check_enable",value = "离床异常检查开关")
                                        @RequestParam(value = "offbed_check_enable",required = false)Integer offbed_check_enable,
                                        @ApiParam(name = "theshold_heartrate_h",value = "心率上限 默认100")
                                        @RequestParam(value = "theshold_heartrate_h",required = false)Integer theshold_heartrate_h,
                                        @ApiParam(name = "theshold_heartrate_l",value = "心率下限  默认50")
                                        @RequestParam(value = "theshold_heartrate_l",required = false)Integer theshold_heartrate_l,
                                        @ApiParam(name = "theshold_breath_h",value = "呼吸率上限  默认25")
                                        @RequestParam(value = "theshold_breath_h",required = false)Integer theshold_breath_h,
                                        @ApiParam(name = "theshold_breath_l",value = "呼吸率下限  默认8")
                                        @RequestParam(value = "theshold_breath_l",required = false)Integer theshold_breath_l,
                                        @ApiParam(name = "offbed_long",value = "离床报警时长(分钟)  默认10,最低5")
                                        @RequestParam(value = "offbed_long",required = false)Integer offbed_long,
                                        @ApiParam(name = "check_time_begin",value = "监控开始时间(秒数)  默认79200")
                                        @RequestParam(value = "check_time_begin",required = false)Integer check_time_begin,
                                        @ApiParam(name = "check_time_end",value = "监控结束时间(秒数)  默认21600")
                                        @RequestParam(value = "check_time_end",required = false)Integer check_time_end
                                        ){
        try {
            return write(200,"获取成功","data",patientDeviceService.sleepDeviceEdit(deviceSn,heart_check_enable,breath_check_enable,offbed_check_enable,
                    theshold_heartrate_h,theshold_heartrate_l,theshold_breath_h,theshold_breath_l,offbed_long,check_time_begin,check_time_end));
        }catch (Exception e){
            return errorResult(e);
        }
    }
    @ApiOperation("获取设备详情信息")
    @RequestMapping(value = "getPatientDeviceDetail",method = RequestMethod.GET)
    public String getPatientDeviceDetail(@ApiParam(name="patient")

+ 12 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/YsDeviceController.java

@ -145,10 +145,14 @@ public class YsDeviceController extends BaseController {
            @RequestParam(value = "speed",required = true) Integer speed,
            HttpServletRequest request){
        try {
            JSONObject result = ysDeviceService.ptzStart(deviceSerial,channelNo,direction,speed,request);
            if ("200".equals(result.getString("code"))){
                return write(200,"查询成功","data",result);
            }else {
                return write(-1,result.getString("msg"));
            }
            return write(200,"查询成功","data",ysDeviceService.ptzStart(deviceSerial,channelNo,direction,speed,request));
        }catch (Exception e){
            return errorResult(e);
        }
    }
@ -164,8 +168,12 @@ public class YsDeviceController extends BaseController {
            @RequestParam(value = "direction",required = true) Integer direction,
            HttpServletRequest request){
        try {
            return write(200,"查询成功","data",ysDeviceService.ptzStop(deviceSerial,channelNo,direction,request));
            JSONObject result = ysDeviceService.ptzStop(deviceSerial,channelNo,direction,request);
            if ("200".equals(result.getString("code"))){
                return write(200,"查询成功","data",result);
            }else {
                return write(-1,result.getString("msg"));
            }
        }catch (Exception e){
            return errorResult(e);
        }

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

@ -966,10 +966,10 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
     */
    public PageEnvelop getEmergencyAssistanceList(Integer page, Integer size,String doctor){
        page = page>0?page-1:0;
        String sql = " select '20' as OrderType,ord.id,ord.doctor,ord.status,p.name,'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time" +
        String sql = " select '20' as OrderType,ord.id,ord.doctor,ord.status,ord.patient,ord.patient_name as name,p.name as doctorName,'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time" +
                " from base_emergency_assistance_order ord INNER JOIN base_doctor p on ord.doctor = p.id where ord.doctor='"+doctor+"'" ;
        sql +="UNION " +
                "select  '22' as 'OrderType',ord.id,ord.doctor,ord.status,p.name,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "select  '22' as 'OrderType',ord.id,ord.doctor,ord.status,ord.patient,ord.patient_name as name,p.name as doctorName,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_security_monitoring_order ord INNER JOIN base_doctor p on ord.doctor = p.id  where ord.doctor='"+doctor+"'" ;
        String countSql = "select count(id) from ("+sql+")A ";
        long count = jdbcTemplate.queryForObject(countSql,long.class);

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

@ -1065,6 +1065,52 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        return response.getBody();
    }
    public com.alibaba.fastjson.JSONObject getSleepDeviceInfo(String deviceSn){
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("mac", deviceSn);
        HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(AqgConfig.sleepDevice_info, param, HttpMethod.GET, getCookie());
        return response.getBody();
    }
    public com.alibaba.fastjson.JSONObject sleepDeviceEdit(String deviceSn,Integer heart_check_enable,Integer breath_check_enable,Integer offbed_check_enable,
                                                           Integer theshold_heartrate_h,Integer theshold_heartrate_l,Integer theshold_breath_h,Integer theshold_breath_l,
                                                           Integer offbed_long,Integer check_time_begin,Integer check_time_end){
        String url = MessageFormat.format(AqgConfig.sleepDevice_edit, deviceSn);
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        if (null!=heart_check_enable){
            param.add("heart_check_enable", heart_check_enable+"");
        }
        if (null!=breath_check_enable){
            param.add("breath_check_enable", breath_check_enable+"");
        }
        if (null!=offbed_check_enable){
            param.add("offbed_check_enable", offbed_check_enable+"");
        }
        if (null!=theshold_heartrate_h){
            param.add("theshold_heartrate_h", theshold_heartrate_h+"");
        }
        if (null!=theshold_heartrate_l){
            param.add("theshold_heartrate_l", theshold_heartrate_l+"");
        }
        if (null!=theshold_breath_h){
            param.add("theshold_breath_h", theshold_breath_h+"");
        }
        if (null!=theshold_breath_l){
            param.add("theshold_breath_l", theshold_breath_l+"");
        }
        if (null!=offbed_long){
            param.add("offbed_long", offbed_long+"");
        }
        if (null!=check_time_begin){
            param.add("check_time_begin", check_time_begin+"");
        }
        if (null!=check_time_end){
            param.add("check_time_end", check_time_end+"");
        }
        HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(url, param, HttpMethod.GET, getCookie());
        return response.getBody();
    }
    /******************************************* 爱牵挂设备end *****************************************************/
}

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

@ -0,0 +1,12 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BaseSleepDeviceReport;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/8/12.
 */
public interface BaseSleepDeviceReportDao extends PagingAndSortingRepository<BaseSleepDeviceReport,Long> ,
        JpaSpecificationExecutor<BaseSleepDeviceReport> {
}

+ 29 - 4
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java

@ -248,7 +248,8 @@ public class DeviceController {
        }
    }
    @ApiOperation("爱牵挂设备睡眠接收")
    /*******************************************睡眠带begin****************************************************************/
    @ApiOperation("爱牵挂-睡眠带睡眠接收")
    @RequestMapping(value = "bySleep", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
@ -269,7 +270,7 @@ public class DeviceController {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂睡眠接收,请求参数:"+paraString);
            logger.info("爱牵挂-睡眠带接收,请求参数:"+paraString);
            deviceService.bySleep(device,time_begin,heartrate,breath,turn_over,is_warn);
            return success();
@ -279,7 +280,7 @@ public class DeviceController {
        }
    }
    @ApiOperation("爱牵挂设备睡眠报告接收")
    @ApiOperation("爱牵挂-睡眠带睡眠报告接收")
    @RequestMapping(value = "bySleepReport", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
@ -325,7 +326,7 @@ public class DeviceController {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂睡眠接收,请求参数:"+paraString);
            logger.info("爱牵挂-睡眠带睡眠报考,请求参数:"+paraString);
            deviceService.bySleepReport(device,date,fallasleep,sleepTime,restTime,awakeTime,lightTime,remTime,deepTime,bucket,
                    avghr,avgbr,awakePer,remPer,lightPer,efficiency,score);
@ -336,7 +337,31 @@ public class DeviceController {
        }
    }
    @ApiOperation("爱牵挂-睡眠带wifi在线状态接收")
    @RequestMapping(value = "byOnlineStatus", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byOnlineStatus(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
            @RequestParam(value = "device",required = true) String device,
            @ApiParam(name="onlinestatu",required = false,value="在线状态(0不在线,1在线)")
            @RequestParam(value = "onlinestatu",required = false) String onlinestatu,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            HttpServletRequest request) {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂-睡眠带wifi在线状态接收:"+paraString);
            deviceService.byOnlineStatus(device,onlinestatu,time_begin);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    /*******************************************睡眠带end****************************************************************/
    /**
     * 返回接口处理结果
     *

+ 45 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.BaseSleepDeviceReportDao;
import com.yihu.jw.care.dao.device.DevicePatientHealthIndexDao;
import com.yihu.jw.care.dao.device.DeviceSosLogDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.BaseSleepDeviceReport;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DeviceSosLogDO;
@ -76,6 +78,8 @@ public class DeviceService {
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private ImUtil imUtil;
    @Autowired
    private BaseSleepDeviceReportDao sleepDeviceReportDao;
    /**
     * 获取爱牵挂管理员cookie
@ -561,12 +565,52 @@ public class DeviceService {
    @Async
    public void bySleepReport(String device,String date,String fallasleep,String sleepTime,String restTime,String awakeTime,String lightTime,
    public void bySleepReport(String device,String dateStr,String fallasleep,String sleepTime,String restTime,String awakeTime,String lightTime,
                              String remTime,String deepTime,String[] bucket,String avghr,String avgbr,String awakePer,String remPer,String lightPer,
                              String efficiency,String score) {
        try {
            if(StringUtils.isNotBlank(device)){
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
                if (devicePatientDeviceDos.size()>0){
                    String patient = devicePatientDeviceDos.get(0).getUser();
                    BaseSleepDeviceReport report = new BaseSleepDeviceReport();
                    report.setPatient(patient);
                    Date date = DateUtil.strToDate(dateStr,DateUtil.YYYYMMDD);
                    report.setCreateTime(date);
                    report.setFallaSleep(fallasleep);
                    report.setSleepTime(sleepTime);
                    report.setRestTime(restTime);
                    report.setAwakeTime(awakeTime);
                    report.setLightTime(lightTime);
                    report.setRemTime(remTime);
                    report.setDeepTime(deepTime);
                    String buckets =JSON.toJSONString(bucket);
                    report.setBucket(buckets);
                    report.setAvghr(avghr);
                    report.setAvgbr(avgbr);
                    report.setAwakePer(awakePer);
                    report.setRemPer(remPer);
                    report.setLightPer(lightPer);
                    report.setEfficiency(efficiency);
                    report.setScore(score);
                    sleepDeviceReportDao.save(report);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Async
    public void byOnlineStatus(String device,String onlinestatu,String time_begin){
        try {
            if(StringUtils.isNotBlank(device)){
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
                if (devicePatientDeviceDos.size()>0){
                    DevicePatientDevice tmp = devicePatientDeviceDos.get(0);
                    tmp.setOnlineStatus(Integer.parseInt(onlinestatu));
                    patientDeviceDao.save(tmp);
                }
            }
        } catch (Exception e) {