|
@@ -5,14 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.diagbot.dto.InquiryDTO;
|
|
|
import com.diagbot.dto.InquiryPatDTO;
|
|
|
import com.diagbot.dto.SaveInquiryDTO;
|
|
|
+import com.diagbot.entity.Client;
|
|
|
import com.diagbot.entity.InquiryDetail;
|
|
|
import com.diagbot.entity.InquiryInfo;
|
|
|
+import com.diagbot.entity.JSONResponseBean;
|
|
|
+import com.diagbot.entity.Request;
|
|
|
+import com.diagbot.entity.Response;
|
|
|
import com.diagbot.enums.IdTypeEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.service.impl.InquiryDetailServiceImpl;
|
|
|
import com.diagbot.service.impl.InquiryInfoServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.GsonUtil;
|
|
|
import com.diagbot.util.HttpUtils;
|
|
|
import com.diagbot.util.IdCard;
|
|
@@ -32,8 +37,11 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @Description:
|
|
@@ -67,12 +75,6 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
SaveInquiryDTO saveInquiryDTO = new SaveInquiryDTO();
|
|
|
- // List<String> naliRetList = getUrl(saveInquiryVO);
|
|
|
- // String retUrl = naliRetList.get(0);
|
|
|
- // saveInquiryDTO.setBody(retUrl);
|
|
|
- // saveInquiryDTO.setResponse(naliRetList.get(1));
|
|
|
- // saveInquiryDTO.setRequest(naliRetList.get(2));
|
|
|
- // saveInquiryDTO.setRequestBodys(naliRetList.get(3));
|
|
|
|
|
|
Date now = DateUtil.now();
|
|
|
InquiryInfo inquiryInfo = null;
|
|
@@ -114,12 +116,14 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getPhone()), "phone", saveInquiryVO.getPhone())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getPersonnel()), "personnel", saveInquiryVO.getPersonnel())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getAnxietyPoint()), "anxiety_point", saveInquiryVO.getAnxietyPoint())
|
|
|
+ .set(StringUtil.isNotBlank(saveInquiryVO.getAnxietyRange()), "anxiety_range", saveInquiryVO.getAnxietyRange())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getAnxietyJudge()), "anxiety_judge", saveInquiryVO.getAnxietyJudge())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getAnxietyAdvise()), "anxiety_advise", saveInquiryVO.getAnxietyAdvise())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getDepressionPoint()), "depression_point", saveInquiryVO.getDepressionPoint())
|
|
|
+ .set(StringUtil.isNotBlank(saveInquiryVO.getDepressionRange()), "depression_range", saveInquiryVO.getDepressionRange())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getDepressionJudge()), "depression_judge", saveInquiryVO.getDepressionJudge())
|
|
|
.set(StringUtil.isNotBlank(saveInquiryVO.getDepressionAdvise()), "depression_advise", saveInquiryVO.getDepressionAdvise())
|
|
|
- .set("user_id", saveInquiryVO.getUserId())
|
|
|
+ .set("mpi_id", saveInquiryVO.getMpiId())
|
|
|
.set("app_id", saveInquiryVO.getAppId())
|
|
|
.eq("id", inquiryInfo.getId())
|
|
|
);
|
|
@@ -132,6 +136,7 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
);
|
|
|
}
|
|
|
Long id = inquiryInfo.getId();
|
|
|
+ saveInquiryVO.setInquiryId(id);
|
|
|
List<InquiryDetail> inquiryDetailList = Lists.newArrayList();
|
|
|
for (SaveInquiryDetailVO saveInquiryDetailVO : saveInquiryVO.getDetailList()) {
|
|
|
InquiryDetail inquiryDetail = new InquiryDetail();
|
|
@@ -151,6 +156,18 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
// 保存记录表
|
|
|
optInfoFacade.saveOptOnfo(hospitalVO, "2");
|
|
|
|
|
|
+ //邵逸夫医院 心理测试 对接纳里时,返回url
|
|
|
+ if (saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
|
|
|
+ && saveInquiryVO.getFrom().equals("5")
|
|
|
+ && saveInquiryVO.getDest().equals("1")) {
|
|
|
+ List<String> naliRetList = getUrl(saveInquiryVO);
|
|
|
+ String retUrl = naliRetList.get(0);
|
|
|
+ saveInquiryDTO.setBody(retUrl);
|
|
|
+ saveInquiryDTO.setResponse(naliRetList.get(1));
|
|
|
+ saveInquiryDTO.setRequest(naliRetList.get(2));
|
|
|
+ saveInquiryDTO.setRequestBodys(naliRetList.get(3));
|
|
|
+ }
|
|
|
+
|
|
|
return saveInquiryDTO;
|
|
|
}
|
|
|
|
|
@@ -173,64 +190,72 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// private List<String> getUrl(SaveInquiryVO saveInquiryVO) {
|
|
|
-// List<String> ret = Lists.newArrayList();
|
|
|
-// String retUrl = null;
|
|
|
-// Request request = null;
|
|
|
-// Response response = null;
|
|
|
-// try {
|
|
|
-// String encodingAesKey = "";
|
|
|
-// Client client = new Client(apiUrl, appKey, appSecret, encodingAesKey);
|
|
|
-// request = getltcs(saveInquiryVO);
|
|
|
-// response = client.execute(request);
|
|
|
-// log.info("request:" + FastJsonUtils.getBeanToJson(request));
|
|
|
-// log.info("requestBodys:" + FastJsonUtils.getBeanToJson(request.getBodys()));
|
|
|
-// log.info("response:" + FastJsonUtils.getBeanToJson(response));
|
|
|
-// if (response.isSuccess()) {
|
|
|
-// JSONResponseBean result = response.getJsonResponseBean();
|
|
|
-// retUrl = result.getBody().toString();
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// }
|
|
|
-// ret.add(retUrl);
|
|
|
-// ret.add(FastJsonUtils.getBeanToJson(response));
|
|
|
-// ret.add(FastJsonUtils.getBeanToJson(request));
|
|
|
-// ret.add(FastJsonUtils.getBeanToJson(request.getBodys()));
|
|
|
-// return ret;
|
|
|
-// }
|
|
|
-//
|
|
|
-// private Request getltcs(SaveInquiryVO saveInquiryVO) {
|
|
|
-// List bodyList = new ArrayList<>();
|
|
|
-//
|
|
|
-// List<Map<String, Object>> details = new ArrayList<>();
|
|
|
-// saveInquiryVO.getDetailList().forEach(i -> {
|
|
|
-// Map<String, Object> detail = new HashMap<>();
|
|
|
-// detail.put("question", i.getQuestion());
|
|
|
-// detail.put("answer", i.getAnswer());
|
|
|
-// List<Map<String, Object>> optionMapList = Lists.newArrayList();
|
|
|
-// i.getOptions().forEach(option -> {
|
|
|
-// optionMapList.add(FastJsonUtils.getJsonToMap(option));
|
|
|
-// });
|
|
|
-// detail.put("options", optionMapList);
|
|
|
-// details.add(detail);
|
|
|
-// });
|
|
|
-//
|
|
|
-// Map<String, Object> body = new HashMap<>();
|
|
|
-// body.put("details", details);
|
|
|
-// body.put("doctorId", Integer.parseInt(saveInquiryVO.getDoctorId()));
|
|
|
-// body.put("mpiId", saveInquiryVO.getMpiId());
|
|
|
-// body.put("appId", saveInquiryVO.getAppId());
|
|
|
-// body.put("fromId", saveInquiryVO.getFrom());
|
|
|
-// body.put("sources", "langtong");
|
|
|
-// body.put("supplement", saveInquiryVO.getSupplement());
|
|
|
-// body.put("pushList", saveInquiryVO.getPushList());
|
|
|
-// body.put("inquiryId", saveInquiryVO.getInquiryId());
|
|
|
-// bodyList.add(body);
|
|
|
-//
|
|
|
-// //X-Service-Id对应的值
|
|
|
-// String serviceId = "consult.questionRecordService";
|
|
|
-// //X-Service-Method对应的值
|
|
|
-// String method = "saveQuestionRecord";
|
|
|
-// return new Request(serviceId, method, bodyList);
|
|
|
-// }
|
|
|
+ private List<String> getUrl(SaveInquiryVO saveInquiryVO) {
|
|
|
+ List<String> ret = Lists.newArrayList();
|
|
|
+ String retUrl = null;
|
|
|
+ Request request = null;
|
|
|
+ Response response = null;
|
|
|
+ try {
|
|
|
+ String encodingAesKey = "";
|
|
|
+ Client client = new Client(apiUrl, appKey, appSecret, encodingAesKey);
|
|
|
+ request = getltcs(saveInquiryVO);
|
|
|
+ response = client.execute(request);
|
|
|
+ log.info("request:" + FastJsonUtils.getBeanToJson(request));
|
|
|
+ log.info("requestBodys:" + FastJsonUtils.getBeanToJson(request.getBodys()));
|
|
|
+ log.info("response:" + FastJsonUtils.getBeanToJson(response));
|
|
|
+ if (response.isSuccess()) {
|
|
|
+ JSONResponseBean result = response.getJsonResponseBean();
|
|
|
+ retUrl = result.getBody().toString();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ ret.add(retUrl);
|
|
|
+ ret.add(FastJsonUtils.getBeanToJson(response));
|
|
|
+ ret.add(FastJsonUtils.getBeanToJson(request));
|
|
|
+ ret.add(FastJsonUtils.getBeanToJson(request.getBodys()));
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Request getltcs(SaveInquiryVO saveInquiryVO) {
|
|
|
+ List bodyList = new ArrayList<>();
|
|
|
+
|
|
|
+ List<Map<String, Object>> details = new ArrayList<>();
|
|
|
+ saveInquiryVO.getDetailList().forEach(i -> {
|
|
|
+ Map<String, Object> detail = new HashMap<>();
|
|
|
+ detail.put("question", i.getQuestion());
|
|
|
+ detail.put("answer", i.getAnswer());
|
|
|
+ List<Map<String, Object>> optionMapList = Lists.newArrayList();
|
|
|
+ if (ListUtil.isNotEmpty(i.getOptions())) {
|
|
|
+ i.getOptions().forEach(option -> {
|
|
|
+ optionMapList.add(FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(option)));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ detail.put("options", optionMapList);
|
|
|
+ details.add(detail);
|
|
|
+ });
|
|
|
+
|
|
|
+ Map<String, Object> body = new HashMap<>();
|
|
|
+ body.put("details", details);
|
|
|
+ body.put("mpiId", saveInquiryVO.getMpiId());
|
|
|
+ body.put("appId", saveInquiryVO.getAppId());
|
|
|
+ body.put("fromId", saveInquiryVO.getFrom());
|
|
|
+ body.put("sources", "langtong");
|
|
|
+ body.put("inquiryId", saveInquiryVO.getInquiryId());
|
|
|
+ body.put("anxietyPoint", saveInquiryVO.getAnxietyPoint());
|
|
|
+ body.put("anxietyRange", saveInquiryVO.getAnxietyRange());
|
|
|
+ body.put("anxietyJudge", saveInquiryVO.getAnxietyJudge());
|
|
|
+ body.put("anxietyAdvise", saveInquiryVO.getAnxietyAdvise());
|
|
|
+ body.put("depressionPoint", saveInquiryVO.getDepressionPoint());
|
|
|
+ body.put("depressionRange", saveInquiryVO.getDepressionRange());
|
|
|
+ body.put("depressionJudge", saveInquiryVO.getDepressionJudge());
|
|
|
+ body.put("depressionAdvise", saveInquiryVO.getDepressionAdvise());
|
|
|
+
|
|
|
+ bodyList.add(body);
|
|
|
+
|
|
|
+ //X-Service-Id对应的值
|
|
|
+ String serviceId = "consult.questionRecordService";
|
|
|
+ //X-Service-Method对应的值
|
|
|
+ String method = "saveQuestionRecord";
|
|
|
+ return new Request(serviceId, method, bodyList);
|
|
|
+ }
|
|
|
}
|