|  | @ -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){
 |