Browse Source

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

liubing 3 years ago
parent
commit
afa9032a36
20 changed files with 647 additions and 79 deletions
  1. 23 1
      common/common-entity/sql记录
  2. 55 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BasePatientOutBed.java
  3. 72 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepNightRecord.java
  4. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java
  5. 1 1
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  6. 9 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserSimple.java
  7. 3 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  8. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/BasePatientOutBedDao.java
  9. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  10. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java
  11. 6 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java
  12. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  13. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  14. 2 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java
  15. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java
  16. 233 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  17. 15 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/dao/device/BasePatientOutBedDao.java
  18. 23 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/dao/device/BaseSleepNightRecordDao.java
  19. 1 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java
  20. 170 61
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

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

@ -1272,4 +1272,26 @@ CREATE TABLE base.`base_sleep_device` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='爱牵挂睡眠带数据';
-- 2021-08-13
alter table base_service_package_item drop  COLUMN team_code;
alter table base_service_package_item drop  COLUMN team_name;
alter table base_service_package_item drop  COLUMN team_name;
-- 20210817 lb
CREATE TABLE `base_sleep_night_record` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '居民id',
  `device_sn` varchar(50) DEFAULT NULL COMMENT '睡眠带sn',
  `status` varchar(50) DEFAULT NULL COMMENT '是否回床,(0/-1)否 1是,-1触发警报',
	 out_time varchar(50) DEFAULT null comment '离床时长',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建日期 即起床时间',
  `update_time` timestamp NULL DEFAULT NULL COMMENT '更新日期',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='睡眠带起夜记录数据';
-- 20210818 lb
CREATE TABLE base_patient_out_bed (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '居民id',
  `device_sn` varchar(50) DEFAULT NULL COMMENT '睡眠带sn',
  `status` varchar(50) DEFAULT NULL COMMENT '在床状态0离床1在床',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建日期 即起床时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='患者离床时间';

+ 55 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BasePatientOutBed.java

@ -0,0 +1,55 @@
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/18.
 */
@Entity
@Table(name="base_patient_out_bed")
public class BasePatientOutBed extends IdEntity {
    private String patient ;
    private String deviceSn;
    private Integer status;//是否回床 0否,1是
    private Date createTime;// 创建日期 即起床时间
    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 Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @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;
    }
}

+ 72 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepNightRecord.java

@ -0,0 +1,72 @@
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/17.
 */
@Entity
@Table(name="base_sleep_night_record")
public class BaseSleepNightRecord extends IdEntity {
    private String patient ;
    private String deviceSn;
    private String outTime;//离床时长
    private Integer status;//是否回床 0否,1是
    private Date createTime;// 创建日期 即起床时间
    private Date updateTime;// 更新日期
    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 getOutTime() {
        return outTime;
    }
    public void setOutTime(String outTime) {
        this.outTime = outTime;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @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;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 1 - 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 监控器 13 睡眠带
    // 设备类型标识 1血糖仪,2.血压计,3药盒,4智能手表,7 = 居家报警器,12 监控器 13 睡眠带 14火灾报警器
    private String categoryCode;
    // 用户类型标准 -1代表单用户
    private String userType;

+ 1 - 1
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -79,7 +79,7 @@ public class DateUtil {
    }
    public static String dateToChineseTime(Date date) {
        SimpleDateFormat formatter =   new SimpleDateFormat( "yyyy年MM月dd日 hh:mm:ss", Locale.CHINA);
        SimpleDateFormat formatter =   new SimpleDateFormat( "yyyy年MM月dd日 HH:mm:ss", Locale.CHINA);
        return formatter.format(date);
    }

+ 9 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserSimple.java

@ -46,6 +46,7 @@ WlyyUserSimple implements Serializable {
    private int expiresIn;
    private String state;
    private String openid; //患者openid
    private String archiveType;//档案类型 1老人 2新生儿
    public String getId() {
        return id;
@ -171,4 +172,12 @@ WlyyUserSimple implements Serializable {
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    public String getArchiveType() {
        return archiveType;
    }
    public void setArchiveType(String archiveType) {
        this.archiveType = archiveType;
    }
}

+ 3 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -339,6 +339,9 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        if ("pad".equals(parameters.get("clientType"))&&!("1".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
            throw new InvalidGrantException("不允许登录该平台");
        }
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
        wlyyUserSimple.setExpiresIn(token.getExpiresIn());

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

@ -0,0 +1,14 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BasePatientOutBed;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/8/18.
 */
public interface BasePatientOutBedDao extends PagingAndSortingRepository<BasePatientOutBed,Long>,
        JpaSpecificationExecutor<BasePatientOutBed> {
    BasePatientOutBed findByPatientAndDeviceSnAndStatus(String patient,String deviceSn,Integer status);
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -112,7 +112,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "existApplyStatus")
    @ApiOperation(value = "查看居民救助状态是否在申请中")
    public ObjEnvelop existApplyStatus(@ApiParam(name="patient",value = "患者(代预约家人为主)")
    public ObjEnvelop existApplyStatus(@ApiParam(name="patient",value = "服务对象id")
                                    @RequestParam(value = "patient") String patient){
        try {
            JSONObject result = assistanceService.existApplyStatus(patient);

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

@ -247,7 +247,7 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                    boolean success=false;
                    if (null!=tmp.get("openid")&&StringUtils.isNotBlank(tmp.get("openid").toString())) {
                        success = messageUtil.putTemplateWxMessage(wxId, "template_success_notice", "srzf", tmp.get("openid").toString(), first,
                                null, one.getContent(), 26, json, "已发送", DateUtil.dateToChineseTime(new Date()));
                                null, one.getContent().replace("<br>",""), 26, json, "已发送", DateUtil.dateToChineseTime(new Date()));
                    }else {
                        success=true;
                    }

+ 6 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -47,7 +47,8 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
    public Envelop addFamilyMember(@RequestParam("member") String member,
                                   @RequestParam(value = "captcha", required = false) String captcha,
                                   @RequestParam(value = "password", required = false) String password,
                                   @RequestParam("relation") int relation) {
                                   @RequestParam("relation") int relation,
                                   @RequestParam("client_id") String client_id) {
        try {
            if (StringUtils.isEmpty(member)) {
                return failed("添加成员不能为空",-1);
@ -59,7 +60,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return failed( "家庭关系无效",-1);
            }
            int result = familyMemberService.addMember(getUID(), member, captcha, password, relation);
            int result = familyMemberService.addMember(client_id,getUID(), member, captcha, password, relation);
            if (result == -1) {
                return failed( "居民信息查询失败",-1);
@ -345,7 +346,8 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam("mobile") String mobile,
                                      @RequestParam("archiveType") Integer archiveType,
                                     @RequestParam("captcha") String captcha,
                                     @RequestParam("relation") int relation){
                                     @RequestParam("relation") int relation,
                                      @RequestParam("client_id") String client_id){
        try {
            if (StringUtils.isEmpty(idcard)) {
                return failed( "添加成员身份证不能为空",-1);
@ -363,7 +365,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return failed( "家庭关系无效",-1);
            }
            int result = familyMemberService.addMemberByCaptcha(getUID(),idcard,name,mobile,archiveType,captcha,relation);
            int result = familyMemberService.addMemberByCaptcha(client_id,getUID(),idcard,name,mobile,archiveType,captcha,relation);
            if(result==0){
                return failed( "不能添加自己",-1);

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

@ -332,6 +332,20 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
    }
    @ApiOperation("获取居民签约专题信息")
    @RequestMapping(value = "patientSignTopicInfo", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public ObjEnvelop patientSignTopicInfo(@ApiParam(name = "patient", value = "patient")
                                            @RequestParam(value = "patient") String patient,
                                            @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                            @RequestParam(value = "topicItem") String topicItem) {
        try {
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.patientSignTopicInfo(patient,topicItem));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("responseOrder")
    @ApiOperation(value = "医生响应紧急预警(点击立即前往)")
    @ObserverRequired

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

@ -575,7 +575,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    public JSONObject existApplyStatus(String patient){
        JSONObject result = new JSONObject();
        JSONObject tmpObj = new JSONObject();
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByProxyPatientAndStatus(patient,1);
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        if (assistanceDO.size()==0){
            tmpObj.put("exist","false");
            result.put(ResponseContant.resultFlag, ResponseContant.success);

+ 2 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java

@ -317,9 +317,8 @@ public class ContactsService {
                        }
                    }
                    if (StringUtils.isNotBlank(del_num)) {
//                        String response = networkCardService.setPatientContacts(sim, null, null, "4", del_num, null);
//                        if (StringUtils.isNotBlank(response)) {
                        if (StringUtils.isNotBlank("111")) {//todo 对接时不做
                        String response = networkCardService.setPatientContacts(sim, null, null, "4", del_num, null);
                        if (StringUtils.isNotBlank(response)) {//todo 对接时不做
                            String[] DelNums = del_num.split("_");
                            for (String tmp:DelNums){
                                if (!delSuccess.contains(tmp)){//本次已删除过 不再作删除操作

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -130,7 +130,7 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
     * @param member  成员
     * @return
     */
    public int addMember(String patient, String member, String captcha, String password, int relation) throws Exception {
    public int addMember(String client_id,String patient, String member, String captcha, String password, int relation) throws Exception {
        if (patient.equals(member)) {
            return 0;
        }
@ -815,7 +815,7 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
    }
    @Transactional
    public int addMemberByCaptcha(String patient, String idcard, String name, String mobile, Integer archiveType, String captcha, int relation) throws Exception {
    public int addMemberByCaptcha(String client_id,String patient, String idcard, String name, String mobile, Integer archiveType, String captcha, int relation) throws Exception {
        BasePatientDO p = patientDao.findById(patient);
        if (p == null) {

+ 233 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.BasePatientOutBedDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.security.*;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
@ -20,6 +21,7 @@ import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.care.contacts.PatientSosContactsDO;
import com.yihu.jw.entity.care.device.BasePatientOutBed;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
@ -52,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
 * Created by Bing on 2021/4/6.
@ -111,6 +114,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private BaseEmergencyWarnLogDao logDao;
    @Autowired
    private ContactsService contactsService;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BasePatientOutBedDao outBedDao;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
@ -342,6 +349,19 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                e.printStackTrace();
            }
        }
        if (5==orderDO.getOrderSource()){//睡眠带工单
            try {
                JSONObject monitorInfo = patientSignTopicInfo(orderDO.getPatient(),"preventOutOfBed");
                Map<String,Object> tmp = JSONObject.parseObject(objectMapper.writeValueAsString(monitorInfo));
                if ("true".equals( tmp.get("sleepStatus").toString())){
                    Map<String,Object> sleepInfo = (Map<String, Object>) tmp.get("sleepInfo");
                    sleepInfo.put("outBedTime","30分钟");
                }
                emergencyOrderVO.setInformation(tmp);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        //TODO 火灾、燃气、离床专题返回值
        // http://192.168.1.103:85/%E5%8C%BB%E5%85%BB%E7%BB%93%E5%90%88/V0.7.0/#g=1&p=%E6%96%B0%E5%AE%89%E9%98%B2%E5%8C%85
@ -1255,9 +1275,157 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            }
            else{
                try {
                    JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                    DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
                    JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
                    result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
                    result.put("patientAddress",deviceDo.getSosAddress());
                    if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                        result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                    }
                    else {
                        result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        if ((StringUtils.isNotBlank(topicItem)&&"preventOutOfBed".equals(topicItem))){
            List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"13");
            if (devicePatientDeviceDos.size()==0){
            }else {
                DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
                JSONObject deviceInfo =  patientDeviceService.getSleepDeviceInfo(deviceDo.getDeviceSn());
                if(deviceInfo.getBooleanValue("success")){
                    result.put("patientAddress",deviceDo.getSosAddress());
                    JSONArray objInfo = deviceInfo.getJSONArray("objs");
                    if (objInfo.size()>0){
                        result.put("sleepStatus",true);
                        JSONObject tmp = objInfo.getJSONObject(0);
                        JSONObject sleepInfo = new JSONObject();
                        sleepInfo.put("online",tmp.getBooleanValue("online"));
                        sleepInfo.put("onbed",tmp.getBooleanValue("onbed"));
                        sleepInfo.put("heartrate",tmp.getString("heartrate"));
                        sleepInfo.put("breathrate",tmp.getString("breathrate"));
                        BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSnAndStatus(patient,deviceDo.getDeviceSn(),0);
                        if (null!=outBed){
                            String outBedTime = "";
                            Date date = new Date();
                            long millisecondsDiff = date.getTime() - outBed.getCreateTime().getTime();
                            long minutesDiff = millisecondsDiff / TimeUnit.MINUTES.toMillis(1L);
                            long hoursDiff = millisecondsDiff / TimeUnit.HOURS.toMillis(1L);
                            if (hoursDiff > 0L) {
                                outBedTime += String.format("%d小时", hoursDiff);
                            }
                            if (minutesDiff>0){
                                outBedTime +=String.format("%d分钟", minutesDiff);
                            }
                            sleepInfo.put("outBedTime",outBedTime);
                        }else {
                            sleepInfo.put("outBedTime","无");
                        }
                        result.put("sleepInfo",sleepInfo);
                    }
                }else {
                    result.put("sleepStatus",false);
                    result.put("sleepInfo","获取睡眠带数据失败");
                }
            }
            //监控
            devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
            if (devicePatientDeviceDos.size()==0){
            }
            else{
                try {
                    DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
                    JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
                    result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
                    result.put("patientAddress",deviceDo.getSosAddress());
                    if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                        result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                    }
                    else {
                        result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        return result;
    }
    public JSONObject patientSignTopicInfo(String patient,String topicItem){
        JSONObject result = new JSONObject();
        if ((StringUtils.isNotBlank(topicItem)&&"preventLost".equals(topicItem))){
            List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"4");
            if (devicePatientDeviceDos.size()==0){
            }
            else {
                DevicePatientDevice device = devicePatientDeviceDos.get(0);
                result.put("deviceSn",device.getDeviceSn());
                try {
                    JSONObject response= patientDeviceService.getAqgDeviceInfo(device.getDeviceSn());
                    if (response!=null){
                        //定位信息
                        if (response.containsKey("last_location")&&response.get("last_location")!=null){
                            JSONObject locationTmp = response.getJSONObject("last_location");
                            Double lon = locationTmp.getJSONArray("coordinates").getDouble(0);
                            Double lat = locationTmp.getJSONArray("coordinates").getDouble(1);
                            JSONObject tmp = gpsUtil.gcj02_To_Bd09(lat,lon);
                            tmp.put("city",response.getString("last_city"));
                            tmp.put("province",response.getString("last_province"));
                            tmp.put("address",response.getString("last_address"));
                            result.put("location",tmp);
                        }
                        //围栏信息
                        if (response.containsKey("fences")&&response.get("fences")!=null){
                            JSONArray fencesArr = response.getJSONArray("fences");
                            JSONArray fencesEnables = new JSONArray();
                            for (int i=0;i<fencesArr.size();i++){
                                JSONObject tmp = fencesArr.getJSONObject(i);
                                if (tmp.getBooleanValue("enable")){//围栏生效
                                    JSONObject fenceTmp = new JSONObject();
                                    fenceTmp.put("fenceNO",tmp.getInteger("seqid").toString());
                                    fenceTmp.put("name",tmp.getString("name"));
                                    JSONArray fenceLocationTmp = tmp.getJSONObject("safe_area").getJSONArray("coordinates").getJSONArray(0);
                                    JSONArray fenceLocation = new JSONArray();
                                    for (int j=0;j<fenceLocationTmp.size();j++){
                                        Double lon = fenceLocationTmp.getJSONArray(j).getDouble(0);
                                        Double lat = fenceLocationTmp.getJSONArray(j).getDouble(1);
                                        JSONObject positionTmp = gpsUtil.gcj02_To_Bd09(lat,lon);
                                        fenceLocation.add(positionTmp);
                                    }
                                    fenceTmp.put("location",fenceLocation);
                                    fenceTmp.put("inFenceStatus",countDistance.isInPolygon(result.getJSONObject("location").getDouble("lon"),result.getJSONObject("location").getDouble("lat"),fenceLocation));
                                    fencesEnables.add(fenceTmp);
                                }
                            }
                            if (fencesEnables.size()>0){
                                result.put("fences",fencesEnables);
                            }
                        }
                    }
                }catch (Exception e){
                    e.printStackTrace();
                    result.put("location",null);
                }
            }
        }
        if ((StringUtils.isNotBlank(topicItem)&&"preventFall".equals(topicItem))){
            List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
            if (devicePatientDeviceDos.size()==0){
            }
            else{
                try {
                    DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
                    JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
                    result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
                    result.put("patientAddress",devicePatientDeviceDos.get(0).getSosAddress());
                    result.put("patientAddress",deviceDo.getSosAddress());
                    if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                        result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                    }
@ -1269,7 +1437,70 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                }
            }
        }
        if ((StringUtils.isNotBlank(topicItem)&&"preventOutOfBed".equals(topicItem))){
            List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"13");
            if (devicePatientDeviceDos.size()==0){
            }else {
                DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
                JSONObject deviceInfo =  patientDeviceService.getSleepDeviceInfo(deviceDo.getDeviceSn());
                if(deviceInfo.getBooleanValue("success")){
                    result.put("patientAddress",deviceDo.getSosAddress());
                    JSONArray objInfo = deviceInfo.getJSONArray("objs");
                    if (objInfo.size()>0){
                        result.put("sleepStatus",true);
                        JSONObject tmp = objInfo.getJSONObject(0);
                        JSONObject sleepInfo = new JSONObject();
                        sleepInfo.put("online",tmp.getBooleanValue("online"));
                        sleepInfo.put("onbed",tmp.getBooleanValue("onbed"));
                        sleepInfo.put("heartrate",tmp.getString("heartrate"));
                        sleepInfo.put("breathrate",tmp.getString("breathrate"));
                        BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSnAndStatus(patient,deviceDo.getDeviceSn(),0);
                        if (null!=outBed){
                            String outBedTime = "";
                            Date date = new Date();
                            long millisecondsDiff = date.getTime() - outBed.getCreateTime().getTime();
                            long minutesDiff = millisecondsDiff / TimeUnit.MINUTES.toMillis(1L);
                            long hoursDiff = millisecondsDiff / TimeUnit.HOURS.toMillis(1L);
                            if (hoursDiff > 0L) {
                                outBedTime += String.format("%d小时", hoursDiff);
                            }
                            if (minutesDiff>0){
                                outBedTime +=String.format("%d分钟", minutesDiff);
                            }
                            sleepInfo.put("outBedTime",outBedTime);
                        }else {
                            sleepInfo.put("outBedTime","无");
                        }
                        result.put("sleepInfo",sleepInfo);
                    }
                }else {
                    result.put("sleepStatus",false);
                    result.put("sleepInfo","获取睡眠带数据失败");
                }
            }
            //监控
            devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
            if (devicePatientDeviceDos.size()==0){
            }
            else{
                try {
                    DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
                    JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
                    result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
                    result.put("patientAddress",deviceDo.getSosAddress());
                    if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                        result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                    }
                    else {
                        result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        return result;
    }

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

@ -0,0 +1,15 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BasePatientOutBed;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/8/18.
 */
public interface BasePatientOutBedDao extends PagingAndSortingRepository<BasePatientOutBed,Long>,
        JpaSpecificationExecutor<BasePatientOutBed> {
    BasePatientOutBed findByPatientAndDeviceSnAndStatus(String patient,String deviceSn,Integer status);
}

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

@ -0,0 +1,23 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BaseSleepNightRecord;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
 * Created by Bing on 2021/8/17.
 */
public interface BaseSleepNightRecordDao extends PagingAndSortingRepository<BaseSleepNightRecord,Long>,
        JpaSpecificationExecutor<BaseSleepNightRecord> {
    @Query(value = "select r from BaseSleepNightRecord r where r.deviceSn=?1 and r.patient=?2 order by r.createTime desc")
    List<BaseSleepNightRecord> findByDeviceSnAndPatient(String deviceSn, String patient);
    @Query(value = "select r from BaseSleepNightRecord r where r.deviceSn=?1 and r.patient=?2 and r.status=?3 and r.createTime>?4 order by r.createTime desc")
    List<BaseSleepNightRecord> findBySnStaPaTime(String deviceSn,String patient,Integer status, Date benIn);
}

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

@ -272,7 +272,7 @@ public class DeviceController {
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂-睡眠带接收,请求参数:"+paraString);
            deviceService.bySleep(device,time_begin,heartrate,breath,turn_over,is_warn);
            deviceService.bySleep(device,time_begin,heartrate,breath,bed_status,turn_over,is_warn);
            return success();
        } catch (Exception e) {
            e.printStackTrace();

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

@ -5,15 +5,9 @@ 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.care.dao.device.*;
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;
import com.yihu.jw.entity.care.device.*;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
@ -80,6 +74,10 @@ public class DeviceService {
    private ImUtil imUtil;
    @Autowired
    private BaseSleepDeviceReportDao sleepDeviceReportDao;
    @Autowired
    private BaseSleepNightRecordDao nightRecord;
    @Autowired
    private BasePatientOutBedDao outBedDao;
    /**
     * 获取爱牵挂管理员cookie
@ -121,12 +119,12 @@ public class DeviceService {
     * 柏颐sos 接收
     * @param imei  15位设备唯一序号
     * @param time_begin  发生时间YYYY-MM-DD HH:mm:SS
     * @param heartrate   心率 int
     * @param city  城市 String
     * @param address  地址 String
     * @param lon  经度 double
     * @param lat  纬度 double
     * @param type  类型   0:Gps定位; 1:基站定位 String
     * @param //heartrate   心率 int
     * @param //city  城市 String
     * @param //address  地址 String
     * @param //lon  经度 double
     * @param //lat  纬度 double
     * @param //type  类型   0:Gps定位; 1:基站定位 String
     */
    @Async
    public void aqgsos(String imei,String label_mac,String time_begin, HttpServletRequest request) {
@ -241,8 +239,8 @@ public class DeviceService {
     * @param type  type=1 SOS,type=2 fall,type=3 new 新成员加入 ,type=4 电子围栏触发, type=5 设备低电,type=6 环境音
     * @param deviceid 15位设备唯一序号
     * @param communityid 机构ID
     * @param url  String 环境音下载地址 只有环境音(type=6)为必填,其他type都为非必填
     * @param name String 设备名称
     * @param //url  String 环境音下载地址 只有环境音(type=6)为必填,其他type都为非必填
     * @param //name String 设备名称
     */
    @Async
@ -552,67 +550,178 @@ public class DeviceService {
     * @param is_warn
     */
    @Async
    public void bySleep(String device,String time_begin,String heartrate,String breath,String turn_over,String is_warn) {
    public String bySleep(String device,String time_begin,String heartrate,String breath,String bed_status,String turn_over,String is_warn) {
        try {
            if(StringUtils.isNotBlank(device)){
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
                if (devicePatientDeviceDos.size()>0){
                    if ("1".equals(is_warn)){//触发安防工单
                        BasePatientDO patientDO = patientDao.findById(devicePatientDeviceDos.get(0).getUser());
                        if(null!=patientDO){
                            String sql ="select DISTINCT pack.org_code,pack.org_name\n" +
                                    " from base_service_package_sign_record sr,base_service_package_record pr,base_service_package_item item ,base_service_package pack\n" +
                                    "where pr.patient = '"+patientDO.getId()+"' and sr.id = pr.sign_id and pr.service_package_id = item.service_package_id \tand  item.`code`='preventOutOfBed'  and item.service_package_id = pack.id \n" +
                                    "  and pack.del=1";
                            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
                            if (sqlResult.size()>0){
                                Map<String, String> json = null;
                                String address= devicePatientDeviceDos.get(0).getSosAddress();
                                if (StringUtils.isNotBlank(devicePatientDeviceDos.get(0).getSosAddress())) {
                                    json = LatitudeUtils.getGeocoderLatitude(address.replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                    String patient = devicePatientDeviceDos.get(0).getUser();
                    //更新患者在床状态
                    //12点以后
                    Date bedIn = DateUtil.getDateStart();//入睡时间
                    Calendar today = Calendar.getInstance();
                    today.set(Calendar.HOUR_OF_DAY, 5);
                    today.set(Calendar.MINUTE, 59);
                    today.set(Calendar.SECOND, 59);
                    today.set(Calendar.MILLISECOND, 999);
                    Date bedUp = today.getTime();//起床时间
                    Date timeDate = DateUtil.strToDate(time_begin);
                    Long timeDiffer = timeDate.getTime() - bedIn.getTime();
                    if (timeDiffer>0&&timeDate.before(bedUp)){ //起夜记录
                        BaseSleepNightRecord record = new BaseSleepNightRecord();
                        if ("0".equals(bed_status)){//离床
                            List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedIn);
                            if (records.size()==0){
                                record.setPatient(devicePatientDeviceDos.get(0).getUser());
                                record.setDeviceSn(device);
                                record.setStatus(0);
                                record.setCreateTime(timeDate);
                                nightRecord.save(record);
                            }else {//是否触发工单
                                record = records.get(0);
                                timeDiffer = timeDate.getTime()-record.getCreateTime().getTime();
                                if (timeDiffer>1800*1000){//超过半小时 触发工单
                                    outBedOrder(records.get(0),devicePatientDeviceDos.get(0),patient,device,"起夜超时未回床");
                                    return null;
                                }
                                String lat=null;
                                String lng=null;
                                if (json != null) {
                                    lat= json.get("lat".toString());
                                    lng = json.get("lng".toString());
                            }
                        }
                        if ("1".equals(bed_status)){//在床记录起夜时长
                            timeDiffer = bedUp.getTime()-timeDate.getTime();
                            if (timeDiffer>0){//6点之前入睡时间
                             List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedIn);
                                if (records.size()>0){//
                                    record = records.get(0);
                                    record.setStatus(1);
                                    record.setUpdateTime(timeDate);
                                    Date outDate = record.getCreateTime();
                                    timeDiffer = (timeDate.getTime() - outDate.getTime())/1000;
                                    record.setOutTime(timeDiffer+"");
                                    nightRecord.save(record);
                                }
                                Map<String,Object> map = new HashMap();
                                String url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
                                JSONObject jsonObject = new JSONObject();
                                jsonObject.put("patient",patientDO.getId());
                                jsonObject.put("patientName",patientDO.getName());
                                jsonObject.put("patientPhone",patientDO.getMobile());
                                jsonObject.put("serveDesc","疑似发生意外");
                                jsonObject.put("hospital",sqlResult.get(0).get("org_code"));
                                jsonObject.put("serveAddress",address.replace(" ",""));
                                jsonObject.put("serveLat",lat);
                                jsonObject.put("serveLon",lng);
                                jsonObject.put("topicItem","preventOutOfBed");
                                jsonObject.put("deviceSn",device);
                                JSONObject jsonObjectParam = new JSONObject();
                                jsonObjectParam.put("order", jsonObject);
                                map.put("jsonData", jsonObjectParam.toJSONString());
                                map.put("orderSource", 5);
                                map.put("warnStr", "疑似发生意外");
                                String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
                                String postParams = AesEncryptUtils.agEncrypt(content);
                                String response = httpClientUtil.postBodyRawForm(url,postParams);
                                JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
                                JSONObject jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
                                System.out.println(jsonObjectData.toJSONString());
                            }
                        }
                    }
                    else {
                        if ("1".equals(bed_status)){
                            timeDiffer = timeDate.getTime() - bedUp.getTime();
                            if (1800*1000<timeDiffer&&timeDiffer<3600*1000){//超过半小时未起床
                                outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"超时未起床");
                                return null;
                            }
                        }
                    }
                    if ("1".equals(bed_status)){//呼吸 心率检测
                        Integer theshold_breath_h = 100;
                        Integer theshold_breath_l = 50;
                        Integer theshold_heartrate_h = 25;
                        Integer theshold_heartrate_l = 8;
                        if (StringUtils.isNotBlank(breath)){
                          Integer breath1 = Integer.parseInt(breath);
                          if (breath1>theshold_breath_h||breath1<theshold_breath_l){
                              outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常");
                              return null;
                          }
                        }
                        if (StringUtils.isNotBlank(heartrate)){
                            Integer heartrate1 = Integer.parseInt(heartrate);
                            if (heartrate1>theshold_heartrate_h||theshold_heartrate_h<theshold_heartrate_l){
                                outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常");
                                return null;
                            }
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public void outBedOrder(BaseSleepNightRecord record,DevicePatientDevice patientDevice,String patient ,String device,String serverName)throws Exception{
        // //夜间十二点 起床半小时后未回床 触发安防工单
            BasePatientDO patientDO = patientDao.findById(patient);
            if(null!=patientDO){
                String sql ="select DISTINCT pack.org_code,pack.org_name\n" +
                        " from base_service_package_sign_record sr,base_service_package_record pr,base_service_package_item item ,base_service_package pack\n" +
                        "where pr.patient = '"+patientDO.getId()+"' and sr.id = pr.sign_id and pr.service_package_id = item.service_package_id \tand  item.`code`='preventOutOfBed'  and item.service_package_id = pack.id \n" +
                        "  and pack.del=1";
                List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
                if (sqlResult.size()>0){
                    Map<String, String> json = null;
                    String address= patientDevice.getSosAddress();
                    if (StringUtils.isNotBlank(patientDevice.getSosAddress())) {
                        json = LatitudeUtils.getGeocoderLatitude(address.replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                    }
                    String lat=null;
                    String lng=null;
                    if (json != null) {
                        lat= json.get("lat".toString());
                        lng = json.get("lng".toString());
                    }
                    Map<String,Object> map = new HashMap();
                    String url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("patient",patientDO.getId());
                    jsonObject.put("patientName",patientDO.getName());
                    jsonObject.put("patientPhone",patientDO.getMobile());
                    jsonObject.put("serveDesc",serverName);
                    jsonObject.put("hospital",sqlResult.get(0).get("org_code"));
                    jsonObject.put("serveAddress",address.replace(" ",""));
                    jsonObject.put("serveLat",lat);
                    jsonObject.put("serveLon",lng);
                    jsonObject.put("topicItem","preventOutOfBed");
                    jsonObject.put("deviceSn",device);
                    JSONObject jsonObjectParam = new JSONObject();
                    jsonObjectParam.put("order", jsonObject);
                    map.put("jsonData", jsonObjectParam.toJSONString());
                    map.put("orderSource", 5);
                    map.put("warnStr", serverName);
                    String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
                    String postParams = AesEncryptUtils.agEncrypt(content);
                    String response = httpClientUtil.postBodyRawForm(url,postParams);
                    JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
                    JSONObject jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
                    System.out.println(jsonObjectData.toJSONString());
                }
            }
            if (null!=record){
                record.setStatus(-1);
                nightRecord.save(record);
            }
    }
    public void updatePatientSleepStatus(String device,String patient,String time_begin,String bed_status){
        Integer status = Integer.parseInt(bed_status);
        BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSnAndStatus(patient,device,0);
        switch (status){
            case 0://离床
                if (null==outBed){
                    outBed = new BasePatientOutBed();
                    outBed.setPatient(patient);
                    outBed.setDeviceSn(device);
                    outBed.setStatus(status);
                    outBed.setCreateTime(DateUtil.strToDate(time_begin,DateUtil.YYYY_MM_DD_HH_MM_SS));
                    outBedDao.save(outBed);
                }
                break;
            case 1://在床
                if (null!=outBed){
                   outBed.setStatus(status);
                   outBed.setCreateTime(DateUtil.strToDate(time_begin,DateUtil.YYYY_MM_DD_HH_MM_SS));
                   outBedDao.save(outBed);
                }
                break;
        }
    }
    @Async
    public void bySleepReport(String device,String dateStr,String fallasleep,String sleepTime,String restTime,String awakeTime,String lightTime,