diff --git a/power-admin/src/main/java/com/manage/controller/methodForEmrMedical.java b/power-admin/src/main/java/com/manage/controller/methodForEmrMedical.java index 3a87664..dc963e3 100644 --- a/power-admin/src/main/java/com/manage/controller/methodForEmrMedical.java +++ b/power-admin/src/main/java/com/manage/controller/methodForEmrMedical.java @@ -1,6 +1,7 @@ package com.manage.controller; +import com.alibaba.fastjson.JSONObject; import com.manage.encrypt.Base64; import com.manage.encrypt.MD5; import com.manage.entity.Power_Dept; @@ -17,6 +18,13 @@ import com.manage.vo.User_Dept_Menu; import org.apache.commons.lang3.StringUtils; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -27,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.*; /** @@ -88,6 +97,106 @@ 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; +// } + /* * 单点登录 diff --git a/power-admin/src/main/webapp/WEB-INF/views/loginDir/login.jsp b/power-admin/src/main/webapp/WEB-INF/views/loginDir/login.jsp index a6adc7f..41d7fc2 100644 --- a/power-admin/src/main/webapp/WEB-INF/views/loginDir/login.jsp +++ b/power-admin/src/main/webapp/WEB-INF/views/loginDir/login.jsp @@ -50,8 +50,11 @@