瀏覽代碼

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

liubing 3 年之前
父節點
當前提交
532880559c

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

@ -11,5 +11,6 @@ public interface BasePatientOutBedDao extends PagingAndSortingRepository<BasePat
        JpaSpecificationExecutor<BasePatientOutBed> {
    BasePatientOutBed findByPatientAndDeviceSnAndStatus(String patient,String deviceSn,Integer status);
    BasePatientOutBed findByPatientAndDeviceSn(String patient,String deviceSn);
}

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

@ -724,37 +724,37 @@ public class DeviceService {
                    }
                    //更新患者在床状态
                    updatePatientSleepStatus(device,patient,time_begin,bed_status);
                    if (!orderCreate){
                        if ("1".equals(bed_status)){//呼吸 心率检测
                            Integer theshold_breath_h = 25;
                            Integer theshold_breath_l = 8;
                            Integer theshold_heartrate_h = 100;
                            Integer theshold_heartrate_l = 50;
                            if (StringUtils.isNotBlank(breath)){
                                Integer breath1 = Integer.parseInt(breath);
                                if (breath1>theshold_breath_h||breath1<theshold_breath_l){
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
                                    planDetail.setBedStatus(1);
                                    planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                    return null;
                                }
                            }
                            if (StringUtils.isNotBlank(heartrate)){
                                Integer heartrate1 = Integer.parseInt(heartrate);
                                if (heartrate1>theshold_heartrate_h||theshold_heartrate_h<theshold_heartrate_l){
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
                                    planDetail.setBedStatus(1);
                                    planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                    return null;
                                }
                            }
                        }
                    }
//                    if (!orderCreate){
//                        if ("1".equals(bed_status)){//呼吸 心率检测
//                            Integer theshold_breath_h = 25;
//                            Integer theshold_breath_l = 8;
//                            Integer theshold_heartrate_h = 100;
//                            Integer theshold_heartrate_l = 50;
//                            if (StringUtils.isNotBlank(breath)){
//                                Integer breath1 = Integer.parseInt(breath);
//                                if (breath1>theshold_breath_h||breath1<theshold_breath_l){
//                                    planDetail.setBreath(breath);
//                                    planDetail.setHeartRate(heartrate);
//                                    planDetail.setBedStatus(1);
//                                    planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
//                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
//                                    return null;
//                                }
//                            }
//                            if (StringUtils.isNotBlank(heartrate)){
//                                Integer heartrate1 = Integer.parseInt(heartrate);
//                                if (heartrate1>theshold_heartrate_h||theshold_heartrate_h<theshold_heartrate_l){
//                                    planDetail.setBreath(breath);
//                                    planDetail.setHeartRate(heartrate);
//                                    planDetail.setBedStatus(1);
//                                    planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
//                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"心率和呼吸频率异常",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
//                                    return null;
//                                }
//                            }
//
//                        }
//                    }
                }
            }
        } catch (Exception e) {
@ -818,26 +818,15 @@ public class DeviceService {
    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;
        BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSn(patient,device);
        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);
    }
    @Async