|
@@ -1,10 +1,9 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.diagbot.dto.GetTopPatientInfoDjDTO;
|
|
|
-import com.diagbot.dto.RegisterInfoDTO;
|
|
|
-import com.diagbot.dto.SignInDTO;
|
|
|
+import com.diagbot.dto.*;
|
|
|
import com.diagbot.entity.DoctorInfo;
|
|
|
import com.diagbot.entity.HospitalDept;
|
|
|
import com.diagbot.entity.HospitalInfo;
|
|
@@ -28,10 +27,25 @@ import com.diagbot.vo.GetTopPatientInfoDjVO;
|
|
|
import com.diagbot.vo.InquiryQuoteVO;
|
|
|
import com.diagbot.vo.SignInVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import org.apache.commons.httpclient.HttpClient;
|
|
|
+import org.apache.commons.httpclient.methods.PostMethod;
|
|
|
+import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
+import org.apache.http.entity.ContentType;
|
|
|
+import org.apache.http.entity.StringEntity;
|
|
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+import springfox.documentation.spring.web.json.Json;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -64,6 +78,9 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
@Qualifier("patientInfoServiceImpl")
|
|
|
private PatientInfoService patientInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 对接-页面顶部病人医生科室信息——查询
|
|
|
*
|
|
@@ -384,10 +401,57 @@ public class PatientInfoDjFacade extends PatientInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
private List<RegisterInfoDTO> getRegisterInfo(SignInVO signInVO) {
|
|
|
+ List<RegisterInfoDTO> registerInfoDTOS = new ArrayList<>();
|
|
|
+ //调用第三方的url
|
|
|
+ String url = "http://192.168.2.241:1234/a/a";
|
|
|
+ //调用第三方的入参并得到返回的出参
|
|
|
+ String json = doPostJson(url,JSONObject.toJSONString(signInVO));
|
|
|
+ //把返回的参数转换成需要的格式
|
|
|
+ RespDTO respDTO = JSONObject.parseObject(json,RespDTO.class);
|
|
|
+ if (respDTO.code.equals("0")){
|
|
|
+ List<SignInDTO> signInDTOS= JSONObject.parseArray(JSONObject.toJSONString(respDTO.data),SignInDTO.class);
|
|
|
+ signInDTOS.forEach(signInDTO -> {
|
|
|
+ RegisterInfoDTO registerInfoDTO = new RegisterInfoDTO();
|
|
|
+ PatientInfo patientInfo =new PatientInfo();
|
|
|
+ BeanUtil.copyProperties(signInDTO,patientInfo);
|
|
|
+ BeanUtil.copyProperties(signInDTO,registerInfoDTO);
|
|
|
+ registerInfoDTO.setPatientInfo(patientInfo);
|
|
|
+ registerInfoDTOS.add(registerInfoDTO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return registerInfoDTOS;
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- return null;
|
|
|
+ /**
|
|
|
+ * 调用
|
|
|
+ * @param url
|
|
|
+ * @param json
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String doPostJson(String url, String json) {
|
|
|
+ // 创建Httpclient对象
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
+ CloseableHttpResponse response = null;
|
|
|
+ String resultString = "";
|
|
|
+ try {
|
|
|
+ // 创建Http Post请求
|
|
|
+ HttpPost httpPost = new HttpPost(url);
|
|
|
+ // 创建请求内容
|
|
|
+ StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
|
|
|
+ httpPost.setEntity(entity);
|
|
|
+ // 执行http请求
|
|
|
+ response = httpClient.execute(httpPost);
|
|
|
+ resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ response.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resultString;
|
|
|
}
|
|
|
|
|
|
/**
|