Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

yeshijie 3 năm trước cách đây
mục cha
commit
9c6be172fb

+ 10 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PadDeviceController.java

@ -144,9 +144,17 @@ public class PadDeviceController extends BaseController {
            device.setAgentName(doctor.getName());
            String sn = device.getDeviceSn();
            synchronized (sn.intern()){
                Boolean flagDevice = patientDeviceService.saveDevice(device,sleepPlan,iotDeviceSn,safeAreaGz);
                if (flagDevice == false){
                int flagDevice = patientDeviceService.saveDevice(device,sleepPlan,iotDeviceSn,safeAreaGz);
                if (flagDevice == 0){
                    return write(-1,"请填写投放地址");
                } else if (flagDevice == -1) {
                    return write(-1,"设备不存在");
                } else if (flagDevice == -2) {
                    return write(-1,"请完善睡眠时间规划");
                } else if (flagDevice == -3) {
                    return write(-1,"sn码已被使用");
                } else if (flagDevice == -4) {
                    return write(-1,"不存在该条记录");
                }
                //注册设备地址
                deviceDetailService.registerToWlyy(device);

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

@ -12,6 +12,7 @@ import com.yihu.jw.entity.care.device.BaseSleepPlan;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.entity.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -130,9 +131,17 @@ public class PatientDeviceController extends BaseController {
            String sn = device.getDeviceSn();
            synchronized (sn.intern()){
//                patientDeviceService.saveDevice(device);
                Boolean flagDevice = patientDeviceService.saveDevice(device,sleepPlan,iotDeviceSn,safeAreaGz);
                if (flagDevice == false){
                int flagDevice = patientDeviceService.saveDevice(device,sleepPlan,iotDeviceSn,safeAreaGz);
                if (flagDevice == 0){
                    return write(-1,"请填写投放地址");
                } else if (flagDevice == -1) {
                    return write(-1,"设备不存在");
                } else if (flagDevice == -2) {
                    return write(-1,"请完善睡眠时间规划");
                } else if (flagDevice == -3) {
                    return write(-1,"sn码已被使用");
                } else if (flagDevice == -4) {
                    return write(-1,"不存在该条记录");
                }
                //注册设备地址
                deviceDetailService.registerToWlyy(device);

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

@ -26,6 +26,7 @@ import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.ServiceException;
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
@ -199,7 +200,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    /**
     * 保存患者设备
     */
    public boolean saveDevice(DevicePatientDevice devicePatientDevice, BaseSleepPlan sleepPlan, String iotDeviceSn, String safeAreaGz) throws Exception {
    public int saveDevice(DevicePatientDevice devicePatientDevice, BaseSleepPlan sleepPlan, String iotDeviceSn, String safeAreaGz) throws Exception {
        //判断sn码是否被使用
        String sn = devicePatientDevice.getDeviceSn();
        String type = devicePatientDevice.getCategoryCode();
@ -214,13 +215,13 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        if (type.equals("7")){
            if (StringUtils.isBlank(devicePatientDevice.getSosAddress())){
                return false;
                return 0;
            }
        }
        if (type.equals("13")){
            if (StringUtils.isBlank(devicePatientDevice.getSosAddress())){
                return false;
                return 0;
            }
        }
@ -233,7 +234,8 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    needVerify = false;
                }
            } else {
                throw new Exception("不存在该条记录!");
//                throw new Exception("不存在该条记录!");
                return -4;
            }
        }
@ -246,8 +248,10 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                //监控器 12   报警器 7  14  15
                if ("12".equals(type) || "14".equals(type) || "15".equals(type) || "7".equals(type) ) {
                    System.out.println("此类设备支持多绑定");
                } else {
                    System.out.println("sn码" + sn + "已被使用!");
                    return -3;
                }
                throw new Exception("sn码" + sn + "已被使用!");
            }
        }
        devicePatientDevice.setCzrq(new Date());
@ -262,7 +266,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            if ("13".equals(type)){ //睡眠带
                if (StringUtils.isBlank(sleepPlan.getGetUpTime()) || StringUtils.isBlank(sleepPlan.getNightRestTime())) {
                    String message = "请完善睡眠时间规划";
                    throw new Exception(message);
                    return -2;
                }
                sleepPlanDao.save(sleepPlan);
            }
@ -276,10 +280,10 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            patientDeviceDao.save(devicePatientDevice);
        }else {
            String message = "设备不存在";
            throw new Exception(message);
            return -1;
        }
        return true;
        return 1;
    }
    public int delDeviceByDeviceSn(String deviceSn){

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

@ -1353,6 +1353,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    List<BaseSleepPlanDetail> planDetails = sleepPlanDetailDao.findByPatientAndDay(patient,dayTime);
                    if (planDetails.size()>0){
                        BaseSleepPlanDetail planDetail =  planDetails.get(0);
                        List<BaseSleepNightRecord> sleepNightRecordList = nightRecordDao.findByPatientAndDayOrderByCreateTimeDesc(patient,dayTime);
                        planDetail.setSleepNightRecordList(sleepNightRecordList);
                        String jsonStr = JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue);
                        sleepInfo = JSONObject.parseObject(jsonStr);
                        sleepInfo.put("day",dayTime);
@ -1372,11 +1374,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    sleepInfo.put("online",tmp.getBooleanValue("online"));
                    if(tmp.getBooleanValue("onbed")){
                        sleepInfo.put("bedStatus",1);
                        sleepInfo.put("heartRate",tmp.getString("heartrate"));
                        sleepInfo.put("breath",tmp.getString("breathrate"));
                    }else {
                        sleepInfo.put("bedStatus",0);
                        sleepInfo.put("heartRate",null);
                        sleepInfo.put("breath",null);
                    }
                    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 = "";

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

@ -618,7 +618,7 @@ public class DeviceService {
                            if ("1".equals(bed_status)){//还在床
                                if (null==planDetail.getUpStatus()) {
                                    planDetail.setUpStatus(0);
                                    planDetail.setBedStatus(0);
                                    planDetail.setBedStatus(1);
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
                                    outBedOrder(null, timeDate,devicePatientDeviceDos.get(0), patient, device, "超时未起床", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
@ -652,12 +652,14 @@ public class DeviceService {
                                }
                                else if(1==planDetail.getSiestaStatus()&&null==planDetail.getSiestaTimeEnd()){
                                    timeDiffer = timeDate.getTime() - planDetail.getSiestaTimeBegin().getTime();
                                    if(3600*siestaLongWarn*1000<timeDiffer&&timeDiffer<(3600*siestaLongWarn+600)*1000){//午睡超时未起床
                                        planDetail.setBedStatus(0);
                                        planDetail.setBreath(breath);
                                        planDetail.setHeartRate(heartrate);
                                        outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"午睡超时未起床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                        orderCreate=true;
                                    if(3600*siestaLongWarn*1000<timeDiffer){//午睡超时未起床
                                        if (planDetail.getSiestaStatus()==1){
                                            planDetail.setBedStatus(1);
                                            planDetail.setBreath(breath);
                                            planDetail.setHeartRate(heartrate);
                                            outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"午睡超时未起床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
                                            orderCreate=true;
                                        }
                                    }
                                }
                            }