|  | @ -552,6 +552,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                 List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
 | 
	
		
			
				|  |  |                 if (devicePatientDeviceDos.size()>0){
 | 
	
		
			
				|  |  |                     Date timeDate = DateUtil.strToDate(time_begin);//当前时间
 | 
	
		
			
				|  |  |                     String dayTime = null;//检测日期
 | 
	
		
			
				|  |  |                     String patient = devicePatientDeviceDos.get(0).getUser();
 | 
	
		
			
				|  |  |                     List<BaseSleepPlan> sleepPlans = sleepPlanDao.findByPatientAndDeviceSn(patient,device);
 | 
	
		
			
				|  |  |                     BaseSleepPlanDetail planDetail = new BaseSleepPlanDetail();
 | 
	
	
		
			
				|  | @ -577,7 +578,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                         String inTime = sleepPlan.getNightRestTime();
 | 
	
		
			
				|  |  |                         Date bedIn = null;// 入睡时间
 | 
	
		
			
				|  |  |                         Date bedBegin = null;// 入睡开始时间
 | 
	
		
			
				|  |  |                         String dayTime = DateUtil.dateToStr(bedUp,DateUtil.YYYY_MM_DD);//监测日期
 | 
	
		
			
				|  |  |                         dayTime = DateUtil.dateToStr(bedUp,DateUtil.YYYY_MM_DD);//监测日期
 | 
	
		
			
				|  |  |                         if (inTime.charAt(0)=='0'&&inTime.charAt(1)!='0') {//0点后为睡觉日期
 | 
	
		
			
				|  |  |                             bedIn = DateUtil.strToDate(dayTime+" "+sleepPlan.getNightRestTime()+":00");
 | 
	
		
			
				|  |  |                             bedIn = DateUtil.getNextDay1(bedIn,1);
 | 
	
	
		
			
				|  | @ -627,7 +628,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                         orderCreate=true;
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                                 else if(1 == planDetail.getSiestaStatus()&&null==planDetail.getSiestaTimeEnd()){//午睡起床
 | 
	
		
			
				|  |  |                                 else if(1 == planDetail.getSiestaStatus()&&null==planDetail.getSiestaLong()){//午睡起床
 | 
	
		
			
				|  |  |                                     planDetail.setSiestaTimeEnd(timeDate);
 | 
	
		
			
				|  |  |                                     timeDiffer = (planDetail.getSiestaTimeEnd().getTime()-planDetail.getSiestaTimeBegin().getTime())/1000;
 | 
	
		
			
				|  |  |                                     planDetail.setSiestaLong(timeDiffer+"");
 | 
	
	
		
			
				|  | @ -686,7 +687,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                     if (timeDiffer>3600*nightLongWarn*1000){
 | 
	
		
			
				|  |  |                                         planDetail.setInStatus(0);
 | 
	
		
			
				|  |  |                                         planDetail.setBedStatus(1);
 | 
	
		
			
				|  |  |                                         planDetail.setSleepNightRecordList(records);
 | 
	
		
			
				|  |  |                                         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));
 | 
	
		
			
				|  |  |                                         orderCreate=true;
 | 
	
		
			
				|  |  |                                     }
 | 
	
	
		
			
				|  | @ -703,7 +704,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                         record = records.get(0);
 | 
	
		
			
				|  |  |                                         timeDiffer = timeDate.getTime()-record.getCreateTime().getTime();
 | 
	
		
			
				|  |  |                                         if (timeDiffer>3600*nightLongWarn*1000&&0==records.get(0).getStatus()){//超过2未回床小时 触发工单
 | 
	
		
			
				|  |  |                                             planDetail.setSleepNightRecordList(records);
 | 
	
		
			
				|  |  |                                             planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
 | 
	
		
			
				|  |  |                                             planDetail.setBedStatus(0);
 | 
	
		
			
				|  |  |                                             outBedOrder(records.get(0),timeDate,devicePatientDeviceDos.get(0),patient,device,"起夜超时未回床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                             orderCreate=true;
 | 
	
	
		
			
				|  | @ -728,6 +729,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                     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;
 | 
	
		
			
				|  |  |                                 }
 | 
	
	
		
			
				|  | @ -738,6 +740,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                     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;
 | 
	
		
			
				|  |  |                                 }
 | 
	
	
		
			
				|  | @ -745,7 +748,6 @@ public class DeviceService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 |