|
|
|
@ -97,105 +97,105 @@ public class methodForEmrMedical {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @RequestMapping(value = "getErweima")
|
|
|
|
|
// @ResponseBody
|
|
|
|
|
// public JSONObject getErweima(String responseType, String clientId, HttpServletRequest request){
|
|
|
|
|
// // 获得Http客户端
|
|
|
|
|
// CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// // 创建Get请求
|
|
|
|
|
// HttpGet httpGet = new HttpGet("https://test.51trust.com/gateway/oauth/authorize?responseType=code&clientId=2017070411003376");
|
|
|
|
|
// // 请求头
|
|
|
|
|
// httpGet.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// // 响应模型
|
|
|
|
|
// CloseableHttpResponse response = null;
|
|
|
|
|
// HttpEntity responseEntity=null;
|
|
|
|
|
// JSONObject jsonObject = null;
|
|
|
|
|
// try {
|
|
|
|
|
// // 由客户端执行(发送)Get请求
|
|
|
|
|
// response = httpClient.execute(httpGet);
|
|
|
|
|
// // 从响应模型中获取响应实体
|
|
|
|
|
// responseEntity = response.getEntity();
|
|
|
|
|
// System.out.println("responseEntity::::"+responseEntity);
|
|
|
|
|
// System.out.println("响应状态为:" + response.getStatusLine());
|
|
|
|
|
// if (responseEntity != null) {
|
|
|
|
|
// jsonObject = JSONObject.parseObject(EntityUtils.toString(responseEntity));
|
|
|
|
|
// String contents = jsonObject.getString("contents");
|
|
|
|
|
// JSONObject contentsObject = JSONObject.parseObject(contents);
|
|
|
|
|
// String userToken = contentsObject.getString("userToken");
|
|
|
|
|
// String verifyStatus = contentsObject.getString("verifyStatus");
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// } catch (ClientProtocolException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// } finally {
|
|
|
|
|
// try {
|
|
|
|
|
// // 释放资源
|
|
|
|
|
// if (httpClient != null) {
|
|
|
|
|
// httpClient.close();
|
|
|
|
|
// }
|
|
|
|
|
// if (response != null) {
|
|
|
|
|
// response.close();
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// return jsonObject;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //return jsonObject;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @RequestMapping(value = "getUser")
|
|
|
|
|
// @ResponseBody
|
|
|
|
|
// public JSONObject getUser(String requestId, HttpServletRequest request){
|
|
|
|
|
// // 获得Http客户端
|
|
|
|
|
// CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// // 创建Get请求
|
|
|
|
|
// HttpGet httpGet = new HttpGet("https://test.51trust.com/gateway/oauth/tokeninfo?clientId=2017070411003376&requestId=" + requestId);
|
|
|
|
|
// // 请求头
|
|
|
|
|
// httpGet.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// // 响应模型
|
|
|
|
|
// CloseableHttpResponse response = null;
|
|
|
|
|
// HttpEntity responseEntity=null;
|
|
|
|
|
// JSONObject jsonObject = null;
|
|
|
|
|
// try {
|
|
|
|
|
// // 由客户端执行(发送)Get请求
|
|
|
|
|
// response = httpClient.execute(httpGet);
|
|
|
|
|
// // 从响应模型中获取响应实体
|
|
|
|
|
// responseEntity = response.getEntity();
|
|
|
|
|
// System.out.println("responseEntity::::"+responseEntity);
|
|
|
|
|
// System.out.println("响应状态为:" + response.getStatusLine());
|
|
|
|
|
// if (responseEntity != null) {
|
|
|
|
|
// jsonObject = JSONObject.parseObject(EntityUtils.toString(responseEntity));
|
|
|
|
|
// String contents = jsonObject.getString("contents");
|
|
|
|
|
// JSONObject contentsObject = JSONObject.parseObject(contents);
|
|
|
|
|
// String userToken = contentsObject.getString("userToken");
|
|
|
|
|
// String verifyStatus = contentsObject.getString("verifyStatus");
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// } catch (ClientProtocolException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// } finally {
|
|
|
|
|
// try {
|
|
|
|
|
// // 释放资源
|
|
|
|
|
// if (httpClient != null) {
|
|
|
|
|
// httpClient.close();
|
|
|
|
|
// }
|
|
|
|
|
// if (response != null) {
|
|
|
|
|
// response.close();
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// return jsonObject;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //return jsonObject;
|
|
|
|
|
// }
|
|
|
|
|
@RequestMapping(value = "getErweima")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JSONObject getErweima(String responseType, String clientId, HttpServletRequest request){
|
|
|
|
|
// 获得Http客户端
|
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// 创建Get请求
|
|
|
|
|
HttpGet httpGet = new HttpGet("https://test.51trust.com/gateway/oauth/authorize?responseType=code&clientId=2017070411003376");
|
|
|
|
|
// 请求头
|
|
|
|
|
httpGet.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// 响应模型
|
|
|
|
|
CloseableHttpResponse response = null;
|
|
|
|
|
HttpEntity responseEntity=null;
|
|
|
|
|
JSONObject jsonObject = null;
|
|
|
|
|
try {
|
|
|
|
|
// 由客户端执行(发送)Get请求
|
|
|
|
|
response = httpClient.execute(httpGet);
|
|
|
|
|
// 从响应模型中获取响应实体
|
|
|
|
|
responseEntity = response.getEntity();
|
|
|
|
|
System.out.println("responseEntity::::"+responseEntity);
|
|
|
|
|
System.out.println("响应状态为:" + response.getStatusLine());
|
|
|
|
|
if (responseEntity != null) {
|
|
|
|
|
jsonObject = JSONObject.parseObject(EntityUtils.toString(responseEntity));
|
|
|
|
|
String contents = jsonObject.getString("contents");
|
|
|
|
|
JSONObject contentsObject = JSONObject.parseObject(contents);
|
|
|
|
|
String userToken = contentsObject.getString("userToken");
|
|
|
|
|
String verifyStatus = contentsObject.getString("verifyStatus");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (ClientProtocolException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
try {
|
|
|
|
|
// 释放资源
|
|
|
|
|
if (httpClient != null) {
|
|
|
|
|
httpClient.close();
|
|
|
|
|
}
|
|
|
|
|
if (response != null) {
|
|
|
|
|
response.close();
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "getUser")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JSONObject getUser(String requestId, HttpServletRequest request){
|
|
|
|
|
// 获得Http客户端
|
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
|
// 创建Get请求
|
|
|
|
|
HttpGet httpGet = new HttpGet("https://test.51trust.com/gateway/oauth/tokeninfo?clientId=2017070411003376&requestId=" + requestId);
|
|
|
|
|
// 请求头
|
|
|
|
|
httpGet.setHeader("Content-Type", "application/json;charset=utf8");
|
|
|
|
|
// 响应模型
|
|
|
|
|
CloseableHttpResponse response = null;
|
|
|
|
|
HttpEntity responseEntity=null;
|
|
|
|
|
JSONObject jsonObject = null;
|
|
|
|
|
try {
|
|
|
|
|
// 由客户端执行(发送)Get请求
|
|
|
|
|
response = httpClient.execute(httpGet);
|
|
|
|
|
// 从响应模型中获取响应实体
|
|
|
|
|
responseEntity = response.getEntity();
|
|
|
|
|
System.out.println("responseEntity::::"+responseEntity);
|
|
|
|
|
System.out.println("响应状态为:" + response.getStatusLine());
|
|
|
|
|
if (responseEntity != null) {
|
|
|
|
|
jsonObject = JSONObject.parseObject(EntityUtils.toString(responseEntity));
|
|
|
|
|
String contents = jsonObject.getString("contents");
|
|
|
|
|
JSONObject contentsObject = JSONObject.parseObject(contents);
|
|
|
|
|
String userToken = contentsObject.getString("userToken");
|
|
|
|
|
String verifyStatus = contentsObject.getString("verifyStatus");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (ClientProtocolException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
try {
|
|
|
|
|
// 释放资源
|
|
|
|
|
if (httpClient != null) {
|
|
|
|
|
httpClient.close();
|
|
|
|
|
}
|
|
|
|
|
if (response != null) {
|
|
|
|
|
response.close();
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|