Ver código fonte

Merge branch 'develop' into dev/mix20200401_icss6.0

gaodm 5 anos atrás
pai
commit
2bdafb0d4a

+ 4 - 0
config-server/src/main/resources/shared/tran-service-dev.yml

@@ -118,3 +118,7 @@ nalizx:
   apiUrl: http://ssltest.ngarihealth.com/openapi-feature5/gateway
   appKey: ngari5e7dd28111dc391a
   appSecret: 11dc391a123e1002
+naligh:
+  apiUrl: http://ssltest.ngarihealth.com/openapi-prerelease/gateway
+  appKey: ngari5e48d9ec11dc3978
+  appSecret: 11dc397869c2d24a

+ 5 - 1
config-server/src/main/resources/shared/tran-service-local.yml

@@ -117,4 +117,8 @@ io.github.lvyahui8.spring:
 nalizx:
   apiUrl: http://ssltest.ngarihealth.com/openapi-feature5/gateway
   appKey: ngari5e7dd28111dc391a
-  appSecret: 11dc391a123e1002
+  appSecret: 11dc391a123e1002
+naligh:
+  apiUrl: http://ssltest.ngarihealth.com/openapi-prerelease/gateway
+  appKey: ngari5e48d9ec11dc3978
+  appSecret: 11dc397869c2d24a

+ 5 - 1
config-server/src/main/resources/shared/tran-service-pre.yml

@@ -117,4 +117,8 @@ io.github.lvyahui8.spring:
 nalizx:
   apiUrl: http://ssltest.ngarihealth.com/openapi-feature5/gateway
   appKey: ngari5e7dd28111dc391a
-  appSecret: 11dc391a123e1002
+  appSecret: 11dc391a123e1002
+naligh:
+  apiUrl: http://ssltest.ngarihealth.com/openapi-prerelease/gateway
+  appKey: ngari5e48d9ec11dc3978
+  appSecret: 11dc397869c2d24a

+ 5 - 1
config-server/src/main/resources/shared/tran-service-pro.yml

@@ -117,4 +117,8 @@ io.github.lvyahui8.spring:
 nalizx:
   apiUrl: http://ssltest.ngarihealth.com/openapi-feature5/gateway
   appKey: ngari5e7dd28111dc391a
-  appSecret: 11dc391a123e1002
+  appSecret: 11dc391a123e1002
+naligh:
+  apiUrl: http://ssltest.ngarihealth.com/openapi-prerelease/gateway
+  appKey: ngari5e48d9ec11dc3978
+  appSecret: 11dc397869c2d24a

+ 5 - 1
config-server/src/main/resources/shared/tran-service-test.yml

@@ -117,4 +117,8 @@ io.github.lvyahui8.spring:
 nalizx:
   apiUrl: http://ssltest.ngarihealth.com/openapi-feature5/gateway
   appKey: ngari5e7dd28111dc391a
-  appSecret: 11dc391a123e1002
+  appSecret: 11dc391a123e1002
+naligh:
+  apiUrl: http://ssltest.ngarihealth.com/openapi-prerelease/gateway
+  appKey: ngari5e48d9ec11dc3978
+  appSecret: 11dc397869c2d24a

+ 121 - 16
tran-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java

@@ -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;
@@ -50,6 +52,13 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
     @Value("${nalizx.appSecret}")
     private String appSecret;
 
+    @Value("${naligh.apiUrl}")
+    private String apiUrlg;
+    @Value("${naligh.appKey}")
+    private String appKeyg;
+    @Value("${naligh.appSecret}")
+    private String appSecretg;
+
     /**
      * @param saveInquiryVO
      * @return
@@ -67,6 +76,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 +84,37 @@ 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());
+            }else if (saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
+                    && saveInquiryVO.getIdType().equals(4)) {
+                //去挂号4。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 +127,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 +159,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(apiUrlg, appKeyg, appSecretg, 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 +217,38 @@ 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());
+        body.put("mpiId", saveInquiryVO.getMpiId());
+
+        bodyList.add(body);
+
+        //X-Service-Id对应的值
+        String serviceId = "appoint.triageService";
+        //X-Service-Method对应的值
+        String method = "saveTriageRecord";
+        return new Request(serviceId, method, bodyList);
+    }
 }

+ 13 - 0
tran-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java

@@ -48,4 +48,17 @@ public class SaveInquiryTriageVO {
      */
     @ApiModelProperty(value = "访问的系统类型")
     private Integer sysType;
+
+    @ApiModelProperty(value = "公众号Id")
+    private String appId;
+
+    @ApiModelProperty(value = "链接来源 菜单问诊from=1,菜单挂号from=2,公众号问诊from=3,当日挂号from=4,门诊心理测试from=6", required = true)
+    @NotBlank(message = "链接来源必传")
+    private String from;
+
+    @ApiModelProperty(value = "大科室编码")
+    private String appointDepartCode;
+
+    @ApiModelProperty(value = "用户Id")
+    private String mpiId;
 }

+ 13 - 0
triage-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java

@@ -7,6 +7,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
 import java.util.List;
 
 @ApiModel(value = "分诊记录保存接口传参")
@@ -48,4 +49,16 @@ public class SaveInquiryTriageVO {
      */
     @ApiModelProperty(hidden = true)
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+    @ApiModelProperty(value = "公众号Id")
+    private String appId;
+
+    @ApiModelProperty(value = "链接来源 菜单问诊from=1,菜单挂号from=2,公众号问诊from=3,当日挂号from=4,门诊心理测试from=6", required = true)
+    @NotBlank(message = "链接来源必传")
+    private String from;
+
+    @ApiModelProperty(value = "大科室编码")
+    private String appointDepartCode;
+
+    @ApiModelProperty(value = "用户Id")
+    private String mpiId;
 }