Ver código fonte

73医院及第三医院第三方对接

wangzhinan 1 ano atrás
pai
commit
f57c72b396

+ 124 - 13
business/base-service/src/main/java/com/yihu/jw/utils/HttpClientUtil.java

@ -1,5 +1,6 @@
package com.yihu.jw.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -31,7 +32,6 @@ import javax.xml.transform.stream.StreamResult;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@ -318,7 +318,7 @@ public class HttpClientUtil {
            //3.1设置发送方式:POST必须大写
            connection.setRequestMethod("POST");
            //3.2设置数据格式:Content-type
            connection.setRequestProperty("content-type", "text/xml;charset=utf-8");
            connection.setRequestProperty("content-type", "text/xml;charset=gb2312");
            //3.3设置输入输出,新创建的connection默认是没有读写权限的,
            connection.setDoInput(true);
            connection.setDoOutput(true);
@ -347,17 +347,6 @@ public class HttpClientUtil {
                    sb.append(temp);
                }
                logger.warn("[WebService]:推送结果{}", sb);
              /*  Map<String, Map> bodyMap = XmlUtils.xm(sb.toString());
                Map<String, Map> sendMessageResponseMap = bodyMap.get("Body");
                Map<String, String> resultStringMap = sendMessageResponseMap.get("sendMessageResponse");
                String stringXML = resultStringMap.get("String");
                stringXML = "<root>" + stringXML + "</root>";
                Map<String, String> stringMap = XmlUtils.xmlTOMap(stringXML);*/
                // String -> <resident>1694505193442</resident><rescode>1</rescode><resmsg>ok</resmsg>
                // String -> <resident>1678862927956</resident><rescode>0</rescode><resmsg>数据处理错误!</resmsg>
                // 0失败,1成功
                /*resultMap.put("code", stringMap.get("rescode"));
                resultMap.put("msg", stringMap.get("resmsg"));*/
                Map<String, Object> map = XmlUtil.xmlToMap(sb.toString());
                Map<String, Map> sendMessageResponseMap = (Map<String, Map>) map.get("Body");
                Map<String, String> resultStringMap = sendMessageResponseMap.get("_174HisIntf3Response");
@ -404,5 +393,127 @@ public class HttpClientUtil {
        return json;
    }
    private static String jlUrl = "http://192.0.10.145:8090/api/JLTransApi/JLTransApi";
    /**
     * 巨浪预约调用方式
     *
     * @param ACode 功能码
     * @param AInParams 请求参数
     * @param AType Xml
     * @param ASign 空值
     * @return
     * @throws Exception
     */
    public static JSONObject JLTransApi(String ACode, String AInParams, String AType, String ASign) throws Exception {
        JSONObject map = new JSONObject();
        map.put("ACode",ACode);
        map.put("AParams",AInParams);
        map.put("AType",AType);
        map.put("ASign",ASign);
        String url = jlUrl+"?ACode="+ACode+"&AParams="+AInParams+"&AType="+AType;
        String response = com.yihu.jw.util.http.HttpClientUtil.postBody(url,map);
        logger.info("请求entrance的参数:"+map.toString());
        logger.info("请求JLTransApi:" + response);
        String res = response.replace("\\","");
        JSONObject result = JSONObject.parseObject(res);
        return result;
    }
    /**
     * WebService推送报文封装请求推送
     * WebService 接口地址为 http://{ip}:{port}/services/TraderService?wsdl
     * @param   //webServicePushUrl 为 http://{ip}:{port}/services/TraderService
     * @param ACode 接口入参
     * @return
     */
    public static  String webServicePushJm(String ACode,String AInParams,String AType,String ASign) {
        logger.info("入参"+ACode+"===="+AInParams);
        InputStream is = null;
        InputStreamReader isr = null;
        BufferedReader br = null;
        OutputStream os = null;
        String json = null;
        try {
            //第一步:创建服务地址,不是WSDL地址
            URL url = new URL(jlUrl);
            //2:打开到服务地址的一个连接
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            //3:设置连接参数
            //3.1设置发送方式:POST必须大写
            connection.setRequestMethod("POST");
            //3.2设置数据格式:Content-type
            connection.setRequestProperty("content-type", "text/xml;charset=gb2312");
            //3.3设置输入输出,新创建的connection默认是没有读写权限的,
            connection.setDoInput(true);
            connection.setDoOutput(true);
            //4:组织SOAP协议数据,发送给服务端;报文参考SoapUI测试工具的XML请求报文
            String soapXML = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
                    "  <soap:Body>\n" +
                    "    <JLTrans xmlns=\"http://tempuri.org/\">\n" +
                    "      <ACode>"+ACode+"</ACode>\n" +
                    "      <AInParams>string</AInParams>\n" +
                    "      <AType>string</AType>\n" +
                    "      <ASign>string</ASign>\n" +
                    "    </JLTrans>\n" +
                    "  </soap:Body>\n" +
                    "</soap:Envelope>";
            logger.warn("[WebService]:推送请求{}", soapXML);
            os = connection.getOutputStream();
            os.write(soapXML.getBytes());
            //5:接收服务端的响应
            int responseCode = connection.getResponseCode();
            if(200 == responseCode){//表示服务端响应成功
                is = connection.getInputStream();
                isr = new InputStreamReader(is);
                br = new BufferedReader(isr);
                StringBuilder sb = new StringBuilder();
                String temp = null;
                while(null != (temp = br.readLine())){
                    sb.append(temp);
                }
                logger.warn("[WebService]:推送结果{}", sb);
                Map<String, Object> map = XmlUtil.xmlToMap(sb.toString());
                Map<String, Map> sendMessageResponseMap = (Map<String, Map>) map.get("Body");
                logger.info(sendMessageResponseMap.toString());
                json = map.toString();
            }
        } catch (Exception e) {
            logger.error("[WebService]推送异常", e);
        } finally {
            if (null != is) {
                try {
                    is.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (null != isr) {
                try {
                    isr.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (null != br) {
                try {
                    br.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (null != os) {
                try {
                    os.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        return json;
    }
}

+ 7 - 6
business/base-service/src/main/java/com/yihu/jw/utils/SM4Utils.java

@ -4,6 +4,7 @@ import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.symmetric.SM4;
import java.io.IOException;
import java.nio.charset.Charset;
/**
 * Sm4 加密解密ECB模式,PKCS5Padding补码方式
@ -19,13 +20,13 @@ public class SM4Utils {
    //加密为16进制,也可以加密成base64/字节数组
    public static String encryptSm4(String plaintext) {
        SM4 sm4 = new SM4("ECB", "PKCS5Padding", KEY.getBytes());
        return sm4.encryptBase64(plaintext);
        return sm4.encryptBase64(plaintext, CharsetUtil.CHARSET_GBK);
    }
    //解密
    public static String decryptSm4(String ciphertext) {
        SM4 sm4 = new SM4("ECB", "PKCS5Padding", KEY.getBytes());
        return sm4.decryptStr(ciphertext, CharsetUtil.CHARSET_UTF_8);
        return sm4.decryptStr(ciphertext, CharsetUtil.CHARSET_GBK);
    }
@ -42,13 +43,13 @@ public class SM4Utils {
                "}";
        SM4Utils sm4 = new SM4Utils();
/*        System.out.println("ECB模式加密");
        String cipherText = sm4.encryptSm4(plainText,key);
        System.out.println("ECB模式加密");
        String cipherText = sm4.encryptSm4(plainText);
        System.out.println("密文: " + cipherText);
        System.out.println();*/
        System.out.println();
        System.out.println("ECB模式解密");
        String plainText1 = sm4.decryptSm4("cGpzgEwAsKtx+3YbO/PWYg==");
        String plainText1 = sm4.decryptSm4(cipherText);
        System.out.println("明文: " + plainText1);
        System.out.println();
    }

Diferenças do arquivo suprimidas por serem muito extensas
+ 5 - 8
business/base-service/src/main/java/com/yihu/jw/utils/XmlUtil.java


+ 1 - 1
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -414,7 +414,7 @@ public class HttpClientUtil {
        return buffer.toString();
    }
    
    public  String postBody(String url, com.alibaba.fastjson.JSONObject params) {
    public static String postBody(String url, com.alibaba.fastjson.JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");

+ 5 - 5
server/svr-authentication/src/main/resources/application.yml

@ -847,8 +847,8 @@ spring:
        dialect: org.hibernate.dialect.DmDialect
      show_sql: true
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6390 # Redis server port.
    host: 192.0.25.33 # Redis server host.
    port: 6379 # Redis server port.
    password: Kb6wKDQP1W4
## i健康用户信息接口,开放出来给互联网医院登录同步用户信息用
@ -857,19 +857,19 @@ iHealth:
zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://192.0.25.33:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 192.0.25.33:10023/open/fileUpload/upload_stream
wechat:
  id: xm_qsyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
  im_list_get: http://127.0.0.1:3000/
kick:
  ##互踢 1开通 0关闭
  eachOther: 0

+ 6 - 6
svr/svr-base/src/main/resources/application.yml

@ -1180,10 +1180,10 @@ spring:
      show_sql: true
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    cluster-nodes: 192.0.25.33:9300,192.0.25.33:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      uris: http://192.0.25.33:9201
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
@ -1191,8 +1191,8 @@ spring:
    user: admin
    password: admin
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6390
    host: 192.0.25.33 # Redis server host.
    port: 6379
    password: Kb6wKDQP1W4 # Redis server port.
#basedb: #base数据基础数据数据源,用于跨库查询
@ -1225,7 +1225,7 @@ pay:
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 192.0.25.33:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
  im_list_get: http://127.0.0.1:3000/
  data_base_name: 1

+ 20 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/QsyyController.java

@ -58,4 +58,24 @@ public class QsyyController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "/JLTransApi")
    @ApiOperation(value = "七十三医院巨浪预约调用接口测试")
    public Envelop JLTransApi(@ApiParam(name = "ACode", value = "功能码", required = false)
                              @RequestParam(value = "ACode",required = false)String ACode,
                              @ApiParam(name = "AInParams", value = "请求参数", required = false)
                              @RequestParam(value = "AInParams",required = false)String AInParams,
                              @ApiParam(name = "AType", value = "Xml", required = false)
                              @RequestParam(value = "AType",required = false)String AType,
                              @ApiParam(name = "ASign", value = "空值", required = false)
                                  @RequestParam(value = "ASign",required = false)String ASign) throws Exception {
        try {
            return success(HttpClientUtil.JLTransApi(ACode,AInParams,AType,ASign));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 2 - 2
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -661,10 +661,10 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.153:3000/
  im_list_get: http://127.0.0.1:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://192.0.25.33:8888/
wlyy:
  url: https://www.xmtyw.cn/wlyytest/
wechat:

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-internet-hospital-job-wangzinan
    name: svr-internet-hospital-job
  cloud:
    config:
      failFast: true

+ 7 - 7
svr/svr-internet-hospital/src/main/resources/application.yml

@ -1585,13 +1585,13 @@ spring:
    user: admin
    password: admin
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6390 # Redis server port.
    host: 192.0.25.33 # Redis server host.
    port: 6379 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://192.0.25.33:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
  tracker-server: 192.0.25.33:22122 #服务器地址
wechat:
  id: xm_qsyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
@ -1625,8 +1625,8 @@ es:
    Statistics: hlw_quota_test
  #  host:  http://172.26.0.55:9000
  #  tHost: 172.26.0.55:9300
  host: http://172.26.0.112:9200
  tHost: http://172.26.0.112:9200
  host: http://192.0.25.33:9201
  tHost: http://192.0.25.33:9201
  clusterName: jkzl
  securityUser: lion:jkzlehr
  user: lion
@ -1641,7 +1641,7 @@ FileTempPath:
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 192.0.25.33:10023/open/fileUpload/upload_stream
wlyy:
  url: http://ehr.yihu.com/wlyy/

+ 1 - 1
svr/svr-internet-hospital/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-internet-hospital-wangzhinan
    name:  svr-internet-hospital
  cloud:
    config:
      failFast: true