|
@@ -19,6 +19,7 @@ import com.diagbot.util.HttpUtils;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.HospitalVO;
|
|
|
import com.diagbot.vo.InquiryTriageMechVO;
|
|
|
+import com.diagbot.vo.SaveDisDeptVO;
|
|
|
import com.diagbot.vo.SaveInquiryTriageVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -67,6 +69,7 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
|
|
|
inquiryInfo.setIp(HttpUtils.getIpAddress());
|
|
|
boolean res = save(inquiryInfo);
|
|
|
|
|
|
+
|
|
|
HospitalVO hospitalVO = new HospitalVO();
|
|
|
hospitalVO.setHospitalCode(saveInquiryVO.getHospitalCode());
|
|
|
hospitalVO.setSysType(saveInquiryVO.getSysType());
|
|
@@ -74,22 +77,28 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
|
|
|
optInfoFacade.saveOptOnfo(hospitalVO, "2");
|
|
|
//邵逸夫医院 分诊对接纳里时,返回科室编码
|
|
|
SaveInquiryTriageDTO saveInquiryDTO = new SaveInquiryTriageDTO();
|
|
|
-
|
|
|
- if (saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
|
|
|
- && saveInquiryVO.getIdType().equals(1)) {
|
|
|
- //去咨询
|
|
|
- List<Object> naliRetList = getUrl(saveInquiryVO);
|
|
|
- saveInquiryDTO.setBodyMap((Map)naliRetList.get(0));
|
|
|
- saveInquiryDTO.setResponse(naliRetList.get(1).toString());
|
|
|
- saveInquiryDTO.setRequest(naliRetList.get(2).toString());
|
|
|
- saveInquiryDTO.setRequestBodys(naliRetList.get(3).toString());
|
|
|
- }else if(saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
|
|
|
- && saveInquiryVO.getIdType().equals(2)){
|
|
|
- //去挂号。2期
|
|
|
- //TODO
|
|
|
+ if (res) {
|
|
|
+ if (saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
|
|
|
+ && saveInquiryVO.getIdType().equals(1)) {
|
|
|
+ //去咨询
|
|
|
+ List<Object> naliRetList = getUrl(saveInquiryVO);
|
|
|
+ saveInquiryDTO.setBodyMap((Map) naliRetList.get(0));
|
|
|
+ saveInquiryDTO.setResponse(naliRetList.get(1).toString());
|
|
|
+ saveInquiryDTO.setRequest(naliRetList.get(2).toString());
|
|
|
+ saveInquiryDTO.setRequestBodys(naliRetList.get(3).toString());
|
|
|
+ } else if (saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
|
|
|
+ && saveInquiryVO.getIdType().equals(2)) {
|
|
|
+ //去挂号。2期
|
|
|
+ List<String> naliRetList = getUrlGh(saveInquiryVO, inquiryInfo.getId());
|
|
|
+ String retUrl = naliRetList.get(0);
|
|
|
+ saveInquiryDTO.setBody(retUrl);
|
|
|
+ saveInquiryDTO.setResponse(naliRetList.get(1).toString());
|
|
|
+ saveInquiryDTO.setRequest(naliRetList.get(2).toString());
|
|
|
+ saveInquiryDTO.setRequestBodys(naliRetList.get(3).toString());
|
|
|
+ }
|
|
|
}
|
|
|
return saveInquiryDTO;
|
|
|
- }
|
|
|
+}
|
|
|
|
|
|
public List<InquiryTriageDTO> getInquirysByMech(InquiryTriageMechVO inquiryTriageMechVO) {
|
|
|
QueryWrapper<InquiryTriage> inquiryTriageQuery = new QueryWrapper<>();
|
|
@@ -102,10 +111,17 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
|
|
|
dataNew = BeanUtil.listCopyTo(data, InquiryTriageDTO.class);
|
|
|
return dataNew;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 咨询医生
|
|
|
+ *
|
|
|
+ * @param saveInquiryVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private List<Object> getUrl(SaveInquiryTriageVO saveInquiryVO) {
|
|
|
//TODO 待定
|
|
|
List<Object> ret = Lists.newArrayList();
|
|
|
-// Map<String,Object> retUrl = null;
|
|
|
+ // Map<String,Object> retUrl = null;
|
|
|
Request request = null;
|
|
|
Response response = null;
|
|
|
try {
|
|
@@ -127,10 +143,49 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
|
|
|
ret.add(FastJsonUtils.getBeanToJson(request.getBodys()));
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预约挂号
|
|
|
+ *
|
|
|
+ * @param saveInquiryVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<String> getUrlGh(SaveInquiryTriageVO saveInquiryVO, Long id) {
|
|
|
+ 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 = getltcsGh(saveInquiryVO, id);
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 咨询医生
|
|
|
+ *
|
|
|
+ * @param saveInquiryVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private Request getltcs(SaveInquiryTriageVO saveInquiryVO) {
|
|
|
List bodyList = new ArrayList<>();
|
|
|
Map<String, Object> body = new HashMap<>();
|
|
|
- body.put("disDeptist",saveInquiryVO.getDisDeptist() );
|
|
|
+ body.put("disDeptist", saveInquiryVO.getDisDeptist());
|
|
|
body.put("hospitalCode", saveInquiryVO.getHospitalCode());
|
|
|
body.put("patAge", saveInquiryVO.getPatAge());
|
|
|
body.put("patSex", saveInquiryVO.getPatSex());
|
|
@@ -146,4 +201,36 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
|
|
|
String method = "findConsultDocByDiagnose";
|
|
|
return new Request(serviceId, method, bodyList);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预约挂号
|
|
|
+ *
|
|
|
+ * @param saveInquiryVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Request getltcsGh(SaveInquiryTriageVO saveInquiryVO, Long id) {
|
|
|
+ List bodyList = new ArrayList<>();
|
|
|
+ Map<String, Object> body = new HashMap<>();
|
|
|
+ List<SaveDisDeptVO> disDeptist = saveInquiryVO.getDisDeptist();
|
|
|
+ //纳里技术能力有限,不会从List里去科室编码,要求朗通帮忙取出;appointDepartCode
|
|
|
+ body.put("appointDepartCode", saveInquiryVO.getAppointDepartCode());
|
|
|
+ body.put("triageId", id);
|
|
|
+ body.put("disDeptist", saveInquiryVO.getDisDeptist());
|
|
|
+ body.put("hospitalCode", saveInquiryVO.getHospitalCode());
|
|
|
+ body.put("patAge", saveInquiryVO.getPatAge());
|
|
|
+ body.put("patSex", saveInquiryVO.getPatSex());
|
|
|
+ body.put("idType", saveInquiryVO.getIdType());
|
|
|
+ body.put("symptom", saveInquiryVO.getSymptom());
|
|
|
+ body.put("supplement", saveInquiryVO.getSupplement());
|
|
|
+ body.put("appId", saveInquiryVO.getAppId());
|
|
|
+ body.put("from", saveInquiryVO.getFrom());
|
|
|
+
|
|
|
+ bodyList.add(body);
|
|
|
+
|
|
|
+ //X-Service-Id对应的值
|
|
|
+ String serviceId = "appoint.triageService";
|
|
|
+ //X-Service-Method对应的值
|
|
|
+ String method = "saveTriageRecord";
|
|
|
+ return new Request(serviceId, method, bodyList);
|
|
|
+ }
|
|
|
}
|