|  | @ -277,6 +277,12 @@ public class DeviceService {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(deviceid)){
 | 
	
		
			
				|  |  |                 if (type==4){
 | 
	
		
			
				|  |  |                     String sqlDesc = "SELECT dict_value from wlyy_hospital_sys_dict WHERE dict_code = '"+1+"' and dict_name = 'security_server_dict' and saas_id=1 ";
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> listTmp = jdbcTemplate.queryForList(sqlDesc);
 | 
	
		
			
				|  |  |                     if (listTmp!=null&&listTmp.size()>0){
 | 
	
		
			
				|  |  |                     }else{
 | 
	
		
			
				|  |  |                         return;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(deviceid);
 | 
	
		
			
				|  |  |                     if (devicePatientDeviceDos.size()>0){
 | 
	
		
			
				|  |  |                         DevicePatientDevice deviceDO = devicePatientDeviceDos.get(0);
 | 
	
	
		
			
				|  | @ -646,7 +652,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                         planDetail.setBreath(breath);
 | 
	
		
			
				|  |  |                                         planDetail.setHeartRate(heartrate);
 | 
	
		
			
				|  |  |                                         sleepPlanDetailDao.save(planDetail);
 | 
	
		
			
				|  |  |                                         outBedOrder(null, timeDate,devicePatientDeviceDos.get(0), patient, device, "超时未起床", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         outBedOrder(null, timeDate,devicePatientDeviceDos.get(0), patient, device, "3", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         orderCreate = true;
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }
 | 
	
	
		
			
				|  | @ -661,7 +667,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                         planDetail.setSiestaStatus(0);
 | 
	
		
			
				|  |  |                                         planDetail.setBedStatus(0);
 | 
	
		
			
				|  |  |                                         sleepPlanDetailDao.save(planDetail);
 | 
	
		
			
				|  |  |                                         outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"超时未午睡",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"7",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         orderCreate=true;
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }
 | 
	
	
		
			
				|  | @ -686,7 +692,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                             planDetail.setBreath(breath);
 | 
	
		
			
				|  |  |                                             planDetail.setHeartRate(heartrate);
 | 
	
		
			
				|  |  |                                             sleepPlanDetailDao.save(planDetail);
 | 
	
		
			
				|  |  |                                             outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"午睡超时未起床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                             outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"8",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                             orderCreate=true;
 | 
	
		
			
				|  |  |                                         }
 | 
	
		
			
				|  |  |                                     }
 | 
	
	
		
			
				|  | @ -727,7 +733,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                         planDetail.setBedStatus(1);
 | 
	
		
			
				|  |  |                                         planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
 | 
	
		
			
				|  |  |                                         sleepPlanDetailDao.save(planDetail);
 | 
	
		
			
				|  |  |                                         outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"超时未上床晚休",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"6",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         orderCreate=true;
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }
 | 
	
	
		
			
				|  | @ -746,7 +752,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                             planDetail.setSleepNightRecordList(nightRecord.findBySnPaTime(device,patient,dayTime));
 | 
	
		
			
				|  |  |                                             planDetail.setBedStatus(0);
 | 
	
		
			
				|  |  |                                             sleepPlanDetailDao.save(planDetail);
 | 
	
		
			
				|  |  |                                             outBedOrder(records.get(0),timeDate,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,"4",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                             orderCreate=true;
 | 
	
		
			
				|  |  |                                         }
 | 
	
		
			
				|  |  |                                     }
 | 
	
	
		
			
				|  | @ -770,7 +776,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  | //                                    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));
 | 
	
		
			
				|  |  | //                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"5",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  | //                                    return null;
 | 
	
		
			
				|  |  | //                                }
 | 
	
		
			
				|  |  | //                            }
 | 
	
	
		
			
				|  | @ -781,7 +787,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  | //                                    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));
 | 
	
		
			
				|  |  | //                                    outBedOrder(null,timeDate,devicePatientDeviceDos.get(0),patient,device,"5",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  | //                                    return null;
 | 
	
		
			
				|  |  | //                                }
 | 
	
		
			
				|  |  | //                            }
 | 
	
	
		
			
				|  | @ -796,9 +802,18 @@ public class DeviceService {
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void outBedOrder(BaseSleepNightRecord record,Date time_date,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 dictCode,String warnInfo)throws Exception{
 | 
	
		
			
				|  |  |         // //夜间十二点 起床半小时后未回床 触发安防工单
 | 
	
		
			
				|  |  |             BasePatientDO patientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         String serveDesc = "";
 | 
	
		
			
				|  |  |         String sqlDesc = "SELECT dict_value from wlyy_hospital_sys_dict WHERE dict_code = '"+dictCode+"' and dict_name = 'security_server_dict' and saas_id=1 ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listTmp = jdbcTemplate.queryForList(sqlDesc);
 | 
	
		
			
				|  |  |         if (listTmp!=null&&listTmp.size()>0){
 | 
	
		
			
				|  |  |             serveDesc = listTmp.get(0).get("dict_value")+"";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             return ;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         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" +
 | 
	
	
		
			
				|  | @ -823,7 +838,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                     jsonObject.put("patient",patientDO.getId());
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",patientDO.getName());
 | 
	
		
			
				|  |  |                     jsonObject.put("patientPhone",patientDO.getMobile());
 | 
	
		
			
				|  |  |                     jsonObject.put("serveDesc",serverName);
 | 
	
		
			
				|  |  |                     jsonObject.put("serveDesc",serveDesc);
 | 
	
		
			
				|  |  |                     jsonObject.put("hospital",sqlResult.get(0).get("org_code"));
 | 
	
		
			
				|  |  |                     jsonObject.put("serveAddress",address.replace(" ",""));
 | 
	
		
			
				|  |  |                     jsonObject.put("serveLat",lat);
 | 
	
	
		
			
				|  | @ -836,7 +851,7 @@ public class DeviceService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("jsonData", jsonObjectParam.toJSONString()));
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("warnStr", serverName));
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("warnStr", serveDesc));
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("orderSource", "5"));
 | 
	
		
			
				|  |  |                     String response = httpClientUtil.post(url, params,"UTF-8");
 | 
	
		
			
				|  |  |                     System.out.println(response);
 |