|  | @ -5,16 +5,19 @@ import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.serializer.SerializerFeature;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.assistance.EmergencyAssistanceDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.device.PatientDeviceDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.sign.ServicePackageItemDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.consult.ConsultTeamService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.device.PatientDeviceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.CountDistance;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.im.ConsultTeamDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultTeamDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.util.ImUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
	
		
			
				|  | @ -61,6 +64,10 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
 | 
	
		
			
				|  |  |     private ConsultTeamDao consultTeamDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HttpClientUtil httpClientUtil;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientDeviceService patientDeviceService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientDeviceDao patientDeviceDao;
 | 
	
		
			
				|  |  |     @Value("${baiduApi.AK}")
 | 
	
		
			
				|  |  |     private String baiduAk;
 | 
	
		
			
				|  |  |     @Value("${baiduApi.url}")
 | 
	
	
		
			
				|  | @ -196,6 +203,32 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg,failMsg);
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (assistanceDO.getOrderSource()==2){//手环发起的获取手环坐标
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(assistanceDO.getPatient(),"4");
 | 
	
		
			
				|  |  |                 if (devicePatientDeviceDos.size()>0){
 | 
	
		
			
				|  |  |                     JSONObject resultTmp =  patientDeviceService.getDeviceLastLocation(devicePatientDeviceDos.get(0).getDeviceSn(),null);
 | 
	
		
			
				|  |  |                     if (resultTmp.getBooleanValue("success")==true&&resultTmp.containsKey("obj")&&resultTmp.getJSONObject("obj")!=null){
 | 
	
		
			
				|  |  |                         JSONObject resultTmp1 = resultTmp.getJSONObject("obj");
 | 
	
		
			
				|  |  |                         if (resultTmp1!=null&&resultTmp1.containsKey("locationdata")){
 | 
	
		
			
				|  |  |                             JSONObject resultTmp2 = resultTmp1.getJSONObject("locationdata");
 | 
	
		
			
				|  |  |                             if (resultTmp2!=null&&resultTmp2.containsKey("point")){
 | 
	
		
			
				|  |  |                                 JSONObject pointJsonObject = resultTmp2.getJSONObject("point");
 | 
	
		
			
				|  |  |                                 if (pointJsonObject!=null){
 | 
	
		
			
				|  |  |                                     Double lat = pointJsonObject.getDouble("lat");
 | 
	
		
			
				|  |  |                                     Double lon = pointJsonObject.getDouble("lon");
 | 
	
		
			
				|  |  |                                     assistanceDO.setServeLat(lat+"");
 | 
	
		
			
				|  |  |                                     assistanceDO.setServeLon(lon+"");
 | 
	
		
			
				|  |  |                                     emergencyAssistanceDao.save(assistanceDO);
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<BaseDoctorDO> doctorDOS = baseTeamMemberDao.findAllMembers(assistanceDO.getTeamCode());
 | 
	
		
			
				|  |  |         double distance = 0.0;
 | 
	
		
			
				|  |  |         JSONArray otherDoctorDistance = new JSONArray();
 |