|  | @ -81,17 +81,17 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
 | 
												
													
														
															|  | 		}
 |  | 		}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		if (isFirst){
 |  | 		if (isFirst){
 | 
												
													
														
															|  | 			String updateFirstSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.grant_time = ?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?,dd.is_binding=1 where dd.device_code=?";
 |  | 
 | 
												
													
														
															|  | 
 |  | 			String updateFirstSql ="update wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.grant_time = ?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?,dd.is_binding=1 where dd.device_code=?";
 | 
												
													
														
															|  | 			jdbcTemplate.update(updateFirstSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,grantTime,hospitalName,doctorCode, doctorName, devicePatientDevice.getDeviceSn()});
 |  | 			jdbcTemplate.update(updateFirstSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,grantTime,hospitalName,doctorCode, doctorName, devicePatientDevice.getDeviceSn()});
 | 
												
													
														
															|  | 		}else {
 |  | 		}else {
 | 
												
													
														
															|  | 			List<DevicePatientDevice> devicePatientDeviceList = patientDeviceDao.findByDeviceSn(devicePatientDevice.getDeviceSn());
 |  | 			List<DevicePatientDevice> devicePatientDeviceList = patientDeviceDao.findByDeviceSn(devicePatientDevice.getDeviceSn());
 | 
												
													
														
															|  | 			int patientDeviceSize = devicePatientDeviceList.size();
 |  | 			int patientDeviceSize = devicePatientDeviceList.size();
 | 
												
													
														
															|  | 			String updateSql = "";
 |  | 			String updateSql = "";
 | 
												
													
														
															|  | 			if (bind == 0){
 |  | 			if (bind == 0){
 | 
												
													
														
															|  | 				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.is_binding=?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?  where dd.device_code=?";
 |  | 
 | 
												
													
														
															|  | 
 |  | 				updateSql ="update wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.is_binding=?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?  where dd.device_code=?";
 | 
												
													
														
															|  | 				jdbcTemplate.update(updateSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,patientDeviceSize,hospitalName,doctorCode,doctorName, devicePatientDevice.getDeviceSn()});
 |  | 				jdbcTemplate.update(updateSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,patientDeviceSize,hospitalName,doctorCode,doctorName, devicePatientDevice.getDeviceSn()});
 | 
												
													
														
															|  | 			}else if (bind>0){
 |  | 			}else if (bind>0){
 | 
												
													
														
															|  | 				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.binding_count=?,dd.is_binding=? where dd.device_code=?";
 |  | 
 | 
												
													
														
															|  | 
 |  | 				updateSql ="update wlyy_devices dd set dd.is_grant=1,dd.binding_count=?,dd.is_binding=? where dd.device_code=?";
 | 
												
													
														
															|  | 				jdbcTemplate.update(updateSql,new Object[]{isFirstBind,patientDeviceSize, devicePatientDevice.getDeviceSn()});
 |  | 				jdbcTemplate.update(updateSql,new Object[]{isFirstBind,patientDeviceSize, devicePatientDevice.getDeviceSn()});
 | 
												
													
														
															|  | 			}
 |  | 			}
 | 
												
													
														
															|  | 		}
 |  | 		}
 |