|
@ -208,21 +208,22 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
params.add(new BasicNameValuePair("output", "json"));
|
|
|
params.add(new BasicNameValuePair("ak", baiduAk));
|
|
|
|
|
|
String url = baiduUrl+"routematrix/v2/driving";
|
|
|
String response = httpClientUtil.get(url,params,"UTF-8");
|
|
|
JSONObject responseObj = JSONObject.parseObject(response);
|
|
|
if (responseObj.getInteger("status")==0){
|
|
|
JSONArray resultArr = responseObj.getJSONArray("result");
|
|
|
int length = resultArr.size()>otherDoctorDistance.size()?resultArr.size():otherDoctorDistance.size();
|
|
|
for (int i=0;i<length;i++){
|
|
|
JSONObject disTmp = resultArr.getJSONObject(i);
|
|
|
JSONObject docTmp = otherDoctorDistance.getJSONObject(i);
|
|
|
docTmp.put("time",disTmp.getJSONObject("duration").getString("text"));
|
|
|
docTmp.put("distance",disTmp.getJSONObject("distance").getInteger("value")/1000.0);//实际路线距离
|
|
|
docTmp.put("distanceMeter",disTmp.getJSONObject("distance").getInteger("value"));
|
|
|
}
|
|
|
otherDoctorDistance.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("distance")));
|
|
|
}
|
|
|
//前端做距离计算
|
|
|
// String url = baiduUrl+"routematrix/v2/driving";
|
|
|
// String response = httpClientUtil.get(url,params,"UTF-8");
|
|
|
// JSONObject responseObj = JSONObject.parseObject(response);
|
|
|
// if (responseObj.getInteger("status")==0){
|
|
|
// JSONArray resultArr = responseObj.getJSONArray("result");
|
|
|
// int length = resultArr.size()>otherDoctorDistance.size()?resultArr.size():otherDoctorDistance.size();
|
|
|
// for (int i=0;i<length;i++){
|
|
|
// JSONObject disTmp = resultArr.getJSONObject(i);
|
|
|
// JSONObject docTmp = otherDoctorDistance.getJSONObject(i);
|
|
|
// docTmp.put("time",disTmp.getJSONObject("duration").getString("text"));
|
|
|
// docTmp.put("distance",disTmp.getJSONObject("distance").getInteger("value")/1000.0);//实际路线距离
|
|
|
// docTmp.put("distanceMeter",disTmp.getJSONObject("distance").getInteger("value"));
|
|
|
// }
|
|
|
// otherDoctorDistance.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("distance")));
|
|
|
// }
|
|
|
}
|
|
|
assistanceDO.setOtherDoctorDistance(otherDoctorDistance.toJSONString());
|
|
|
BasePatientDO patientDO = patientDao.findById(assistanceDO.getPatient());
|