Bladeren bron

代码修改

liubing 3 jaren geleden
bovenliggende
commit
9179900209

+ 6 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java

@ -36,8 +36,14 @@ 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}";
    /**
     * X1定位数据  即轨迹
     */
    public static final String X1_locations = baseUrl+"/api/locationdata/";
    /**
     * 睡眠带 修改心率呼吸率报警阈值
     */
@ -48,11 +54,6 @@ public class AqgConfig {
     */
    public static final String  sleepDevice_info=baseUrl+"/api/sleepdevice/";
    /**
     * X1定位数据  即轨迹
     */
    public static final String X1_locations = baseUrl+"/api/locationdata/";
    public static final String username = "13559485270";
    public static final String password = "zjxl@2021";
    public static final String redisKey = "aqgCooker";

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/BaseSleepPlanDetailDao.java

@ -19,6 +19,6 @@ public interface BaseSleepPlanDetailDao extends PagingAndSortingRepository<BaseS
    List<BaseSleepPlanDetail> findByPatientAndDay(String patient, String day);
    @Query("SELECT a FROM BaseSleepPlanDetail a WHERE a.patient = ?1 AND a.day>=?2 and a.day<=?3")
    @Query("SELECT a FROM BaseSleepPlanDetail a WHERE a.patient = ?1 AND a.day>=?2 and a.day<=?3 ORDER BY a.day desc")
    Page<BaseSleepPlanDetail> findByListByPage(String patient, String begin, String end, Pageable pageRequest);
}

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

@ -1,5 +1,6 @@
package com.yihu.jw.care.endpoint.device;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.endpoint.BaseController;
@ -336,6 +337,19 @@ public class PatientDeviceController extends BaseController {
        }
    }
    @ApiOperation("获取X1手表定位数据列表")
    @RequestMapping(value = "getX1Locations",method = RequestMethod.GET)
    public String getX1Locations(@ApiParam(name = "deviceSn",value = "设备sn码")
                                        @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                        @ApiParam(name = "time_begin",value = "YYYYMMDD 定位日期")
                                        @RequestParam(value = "time_begin",required = false)String time_begin){
        try {
            return write(200,"获取成功","data",patientDeviceService.getX1Locations(deviceSn, time_begin));
        }catch (Exception e){
            return errorResult(e);
        }
    }
    @ApiOperation("获取睡眠带设备信息")
    @RequestMapping(value = "getSleepDeviceInfo",method = RequestMethod.GET)
    public String getSleepDeviceInfo(@ApiParam(name = "deviceSn",value = "睡眠带MAC 去除符号:")
@ -390,7 +404,7 @@ public class PatientDeviceController extends BaseController {
        try {
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn);
            if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
                return write(200,"获取成功","data",result.getJSONObject(ResponseContant.resultMsg));
                return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            }else {
                return error(-1,result.getString(ResponseContant.resultMsg));
            }

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

@ -10,6 +10,7 @@ import com.yihu.jw.care.dao.device.DeviceDetailDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.care.service.wechat.WeiXinAccessTokenUtils;
import com.yihu.jw.care.util.ConcealUtil;
import com.yihu.jw.care.util.MyJdbcTemplate;
@ -109,6 +110,8 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private EmergencyAssistanceService emergencyAssistanceService;
    @Autowired
    private SecurityMonitoringOrderService securityMonitoringOrderService;
    @PostConstruct
    public void init() {
@ -863,7 +866,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @param deviceSn 设备sn码
     * @return
     */
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn){
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn) throws Exception {
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (null==patientDO){
@ -890,8 +893,45 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                if ("4".equals(device.getCategoryCode())||"7".equals(device.getCategoryCode())){
                    devInfo.put("sosContactsDOS",contactsService.getPatientSosContacts(patient));
                }
                com.alibaba.fastjson.JSONObject devInfoObj = JSON.parseObject(JSON.toJSONString(devInfo, SerializerFeature.WriteMapNullValue));
                switch (device.getCategoryCode()){
                    case "1"://血压设备
                        break;
                    case "2"://血糖设备
                        break;
                    case "4"://手表 围栏与轨迹
                        devInfoObj =  securityMonitoringOrderService.patientSignTopicInfo(devInfoObj,patient,"preventLost");
                        //轨迹动态
                        break;
                    case "7"://报警器 紧急工单
                        break;
                    case "12"://监控 视频地址
                        com.alibaba.fastjson.JSONObject tmp =ysDeviceService.getDeviceLiveAddress(patient,deviceSn,1,null);
                        devInfoObj.put("monitorInfoStatus",tmp.getIntValue(ResponseContant.resultFlag));
                        if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                            devInfoObj.put("monitorInfo",tmp.getString(ResponseContant.resultMsg));
                        }
                        else {
                            devInfoObj.put("monitorInfo",tmp.getJSONObject(ResponseContant.resultMsg));
                        }
                        break;
                    case "13"://睡眠带 获取当天睡眠详情
                        securityMonitoringOrderService.preventOutOfBed(devInfoObj,patient,false);
                        break;
                    case "14"://气感报警器 当天监测记录以及最新浓度
                        List<Map<String,Object>> listTmp = gasConcentration(patient,DateUtil.getStringDateShort());
                        devInfoObj.put("monitorInfo",listTmp);
                        devInfoObj.put("day",DateUtil.getStringDateShort());
                        securityMonitoringOrderService.preventGasLeakage(devInfoObj,patient,false);
                        break;
                    case "15"://烟感报警器 获取最新浓度
                        securityMonitoringOrderService.preventFire(devInfoObj,patient,false);
                        devInfoObj.put("day",DateUtil.getStringDateShort());
                        break;
                }
                result.put(ResponseContant.resultFlag,ResponseContant.success);
                result.put(ResponseContant.resultMsg,JSON.parseObject(JSON.toJSONString(devInfo, SerializerFeature.WriteMapNullValue)));
                result.put(ResponseContant.resultMsg,JSON.toJSONString(devInfoObj,SerializerFeature.WriteMapNullValue));
            }
        }
        return result;
@ -918,24 +958,8 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    case "2"://血糖设备
                        result = getHealthIndex(result,deviceSn,patient,page,pageSize);
                        break;
                    case "4"://手表 紧急工单与安防工单
                        result = getEmeWarn(result,deviceSn,patient,page,pageSize);
                        break;
                    case "7"://报警器 紧急工单
                        result = getEmeWarn(result,deviceSn,patient,page,pageSize);
                        break;
                    case "12"://监控
                        com.alibaba.fastjson.JSONObject tmp =ysDeviceService.getDeviceLiveAddress(patient,deviceSn,1,null);
                        result.put("monitorInfoStatus",tmp.getIntValue(ResponseContant.resultFlag));
                        if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                            result.put("monitorInfo",tmp.getString(ResponseContant.resultMsg));
                        }
                        else {
                            result.put("monitorInfo",tmp.getJSONObject(ResponseContant.resultMsg));
                        }
                        break;
                    default://安防设备
                        result = null;
                        result  = getEmeWarn(result,deviceSn,patient,page,pageSize);
                        break;
                }
            }
@ -1150,6 +1174,27 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        return response.getBody();
    }
    /**
     *获取设备轨迹
     * @param deviceSn
     * @param time_begin YYYYMMDD 日期
     * @return
     */
    public com.alibaba.fastjson.JSONObject getX1Locations(String deviceSn,String time_begin){
        String url =AqgConfig.X1_locations;
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("device", deviceSn);
        param.add("depth", "1");
        param.add("rows_per_page", "300");
        if (StringUtils.isNotBlank(time_begin)){
            param.add("time_begin", time_begin);
        }
        HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(url, param, HttpMethod.GET, getCookie());
        return response.getBody();
    }
    public com.alibaba.fastjson.JSONObject getSleepDeviceInfo(String deviceSn){
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("mac", deviceSn);

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

@ -1336,7 +1336,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
    }
    public void preventOutOfBed(JSONObject result,String patient){
    public void preventOutOfBed(JSONObject result,String patient,boolean video){
        List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"13");
        if (devicePatientDeviceDos.size()==0){}
        else {
@ -1349,11 +1349,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    result.put("sleepStatus",true);
                    JSONObject tmp = objInfo.getJSONObject(0);
                    JSONObject sleepInfo = new JSONObject();
                    List<BaseSleepPlanDetail> planDetails = sleepPlanDetailDao.findByPatientAndDay(patient,getSleepMonitoringDay(new Date(),patient));
                    String dayTime = getSleepMonitoringDay(new Date(),patient);
                    List<BaseSleepPlanDetail> planDetails = sleepPlanDetailDao.findByPatientAndDay(patient,dayTime);
                    if (planDetails.size()>0){
                        BaseSleepPlanDetail planDetail =  planDetails.get(0);
                        String jsonStr = JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue);
                        sleepInfo = JSONObject.parseObject(jsonStr);
                        sleepInfo.put("day",dayTime);
                    }
                    List<BaseSleepPlan> sleepPlans = sleepPlanDao.findByPatient(patient);
                    if (sleepPlans.size()>0){
@ -1364,14 +1366,17 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                        sleepInfo.put("siestaTime",sleepPlan.getNapTime());
                        sleepInfo.put("nightRestTime",sleepPlan.getNightRestTime());
                        sleepInfo.put("nightRecordTime",sleepPlan.getNightRestTime()+"-隔日"+endTime);
                    }else {
                        sleepInfo.put("sleepPlan",false);
                    }
                    sleepInfo.put("online",tmp.getBooleanValue("online"));
                    sleepInfo.put("onbed",tmp.getBooleanValue("onbed"));
                    sleepInfo.put("heartrate",tmp.getString("heartrate"));
                    sleepInfo.put("breathrate",tmp.getString("breathrate"));
                    if(tmp.getBooleanValue("onbed")){
                        sleepInfo.put("bedStatus",1);
                    }else {
                        sleepInfo.put("bedStatus",0);
                    }
                    sleepInfo.put("heartRate",tmp.getString("heartrate"));
                    sleepInfo.put("breath",tmp.getString("breathrate"));
                    BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSnAndStatus(patient,deviceDo.getDeviceSn(),0);
                    if (null!=outBed){
                        String outBedTime = "";
@ -1397,10 +1402,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                result.put("sleepInfo","获取睡眠带数据失败");
            }
        }
        monitorInfo(result, patient);
        if (video){
            monitorInfo(result, patient);
        }
    }
    public void preventFire(JSONObject result,String patient){
    public void preventFire(JSONObject result,String patient,boolean video){
        String sql = "SELECT r.value from wlyy_patient_device pd,base_device_health_index r " +
                "WHERE pd.device_sn = r.device_sn and pd.`user` = '"+patient+"' ";
        sql += " and pd.category_code='15' ORDER BY r.create_time desc LIMIT 1";
@ -1412,7 +1419,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            result.put("smoke",list1.get(0).get("value"));
        }
        result.put("smokeOrderNum",getOrder(patient,"preventFire"));
        monitorInfo(result, patient);
        if (video){
            monitorInfo(result, patient);
        }
    }
    public Integer getOrder(String patient,String topicItem){
@ -1422,7 +1431,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return num;
    }
    public void preventGasLeakage(JSONObject result,String patient){
    public void preventGasLeakage(JSONObject result,String patient,boolean video){
        String sql = "SELECT r.value from wlyy_patient_device pd,base_device_health_index r " +
                "WHERE pd.device_sn = r.device_sn and pd.`user` = '"+patient+"' ";
        sql += " and pd.category_code='14' ORDER BY r.create_time desc LIMIT 1";
@ -1434,7 +1443,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            result.put("methane",list1.get(0).get("value"));
        }
        result.put("methaneOrderNum",getOrder(patient,"preventGasLeakage"));
        monitorInfo(result, patient);
        if (video){
            monitorInfo(result, patient);
        }
    }
    public void monitorInfo(JSONObject result,String patient){
@ -1472,13 +1483,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            monitorInfo(result, patient);
        }
        if ("preventOutOfBed".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventOutOfBed(result, patient);
            preventOutOfBed(result, patient,true);
        }
        if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventFire(result, patient);
            preventFire(result, patient,true);
        }
        if ("preventGasLeakage".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventGasLeakage(result, patient);
            preventGasLeakage(result, patient,true);
        }
        return result;
    }

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

@ -18,6 +18,6 @@ public interface BaseSleepNightRecordDao extends PagingAndSortingRepository<Base
    @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);
    @Query(value = "select r from BaseSleepNightRecord r where r.deviceSn=?1 and r.patient=?2 and r.status=?3 and r.createTime>?4 and r.day=?5 order by r.createTime desc")
    List<BaseSleepNightRecord> findBySnStaPaTime(String deviceSn,String patient,Integer status, Date benIn,String day);
}

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

@ -562,6 +562,7 @@ public class DeviceService {
                Integer nightLongWarn=2;//起夜预警时长
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
                if (devicePatientDeviceDos.size()>0){
                    Date timeDate = DateUtil.strToDate(time_begin);//当前时间
                    String patient = devicePatientDeviceDos.get(0).getUser();
                    List<BaseSleepPlan> sleepPlans = sleepPlanDao.findByPatientAndDeviceSn(patient,device);
                    BaseSleepPlanDetail planDetail = new BaseSleepPlanDetail();
@ -570,8 +571,7 @@ public class DeviceService {
                        sleepPlan = sleepPlans.get(0);
                    }
                    if (null!=sleepPlan){
                        Date timeDate = DateUtil.strToDate(time_begin);//当前时间
                        Date bedUp = DateUtil.strToDate(DateUtil.getStringDateShort()+" "+sleepPlan.getGetUpTime()+":00");// 起床时间 起床前一小时内算为起床
                        Date bedUp = DateUtil.strToDate(DateUtil.dateToStrShort(timeDate)+" "+sleepPlan.getGetUpTime()+":00");// 起床时间 起床前一小时内算为起床
                        if (timeDate.before(bedUp)&&bedUp.getTime()-timeDate.getTime()>1000*1*3600){
                            bedUp = DateUtil.getNextDay1(bedUp,-1);
                        }
@ -582,7 +582,7 @@ public class DeviceService {
                        Date SiestaBegin = null;// 午睡开始时间
                        if (StringUtils.isNotBlank(sleepPlan.getNapTime())){
                            needSiesta=true;
                            SiestaTime = DateUtil.strToDate(DateUtil.getStringDateShort()+" "+sleepPlan.getNapTime()+":00");
                            SiestaTime = DateUtil.strToDate(DateUtil.dateToStrShort(timeDate)+" "+sleepPlan.getNapTime()+":00");
                            SiestaBegin = DateUtil.getNextMin(SiestaTime,-60);// 午睡开始时间
                        }
                        String inTime = sleepPlan.getNightRestTime();
@ -621,7 +621,7 @@ public class DeviceService {
                                    planDetail.setBedStatus(0);
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
                                    outBedOrder(null, devicePatientDeviceDos.get(0), patient, device, "超时未起床", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
                                    outBedOrder(null, timeDate,devicePatientDeviceDos.get(0), patient, device, "超时未起床", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
                                    orderCreate = true;
                                }
                            }
@ -634,7 +634,7 @@ public class DeviceService {
                                    if (timeDiffer>3600*siestaLongWarn*1000){
                                        planDetail.setSiestaStatus(0);
                                        planDetail.setBedStatus(0);
                                        outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"超时未午睡",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"超时未午睡",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        orderCreate=true;
                                    }
                                }
@ -656,7 +656,7 @@ public class DeviceService {
                                        planDetail.setBedStatus(0);
                                        planDetail.setBreath(breath);
                                        planDetail.setHeartRate(heartrate);
                                        outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"午睡超时未起床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"午睡超时未起床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        orderCreate=true;
                                    }
                                }
@ -672,7 +672,7 @@ public class DeviceService {
                                    planDetail.setInTimeBegin(timeDate);
                                }
                                else if (1==planDetail.getInStatus()){//在床记录起夜时长
                                    List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedBegin);
                                    List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedBegin,dayTime);
                                    if (records.size()>0){//
                                        record = records.get(0);
                                        record.setStatus(1);
@ -685,14 +685,14 @@ public class DeviceService {
                                }
                            }
                            if ("0".equals(bed_status)){//离床
                                List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedBegin);
                                List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedBegin,dayTime);
                                if(null==planDetail.getInStatus()){
                                    timeDiffer = timeDate.getTime() - bedIn.getTime();
                                    if (timeDiffer>3600*nightLongWarn*1000){
                                        planDetail.setInStatus(0);
                                        planDetail.setBedStatus(1);
                                        planDetail.setSleepNightRecordList(records);
                                        outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"超时未上床晚休",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"超时未上床晚休",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        orderCreate=true;
                                    }
                                }
@ -710,7 +710,7 @@ public class DeviceService {
                                        if (timeDiffer>3600*nightLongWarn*1000){//超过2未回床小时 触发工单
                                            planDetail.setSleepNightRecordList(records);
                                            planDetail.setBedStatus(0);
                                            outBedOrder(records.get(0),devicePatientDeviceDos.get(0),patient,device,"起夜超时未回床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                            outBedOrder(records.get(0),timeDate,devicePatientDeviceDos.get(0),patient,device,"起夜超时未回床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                            orderCreate=true;
                                        }
                                    }
@ -733,7 +733,7 @@ public class DeviceService {
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
                                    planDetail.setBedStatus(1);
                                    outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                    return null;
                                }
                            }
@ -743,7 +743,7 @@ public class DeviceService {
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
                                    planDetail.setBedStatus(1);
                                    outBedOrder(null,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                    return null;
                                }
                            }
@ -759,7 +759,7 @@ public class DeviceService {
        return null;
    }
    public void outBedOrder(BaseSleepNightRecord record,DevicePatientDevice patientDevice,String patient ,String device,String serverName,String warnInfo)throws Exception{
    public void outBedOrder(BaseSleepNightRecord record,Date time_date,DevicePatientDevice patientDevice,String patient ,String device,String serverName,String warnInfo)throws Exception{
        // //夜间十二点 起床半小时后未回床 触发安防工单
            BasePatientDO patientDO = patientDao.findById(patient);
            if(null!=patientDO){
@ -810,6 +810,9 @@ public class DeviceService {
            }
            if (null!=record){
                record.setStatus(-1);
                record.setUpdateTime(time_date);
                Long timeDiffer = (time_date.getTime() - record.getCreateTime().getTime())/1000;
                record.setOutTime(timeDiffer+"");
                nightRecord.save(record);
            }
    }