Quellcode durchsuchen

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

wangzhinan vor 1 Jahr
Ursprung
Commit
fc65b3e70c

+ 5 - 0
business/base-service/pom.xml

@ -19,6 +19,11 @@
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.7.12</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>

+ 4 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/DsyyPrescriptionService.java

@ -36,10 +36,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
@Service
@Transactional

+ 404 - 11
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java

@ -63,10 +63,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -1681,13 +1680,19 @@ public class DsyyEntranceService {
    /**
     * 获取患者待结算信息
     * 查询待扣费处方信息
     *
     * @param
     * @param cardNo 患者卡号
     * @param cardType 卡类型
     * @param xtgzh0 HIS系统跟踪号(唯一)
     * @param operatorId 操作员ID
     * @param operatorName 操作员姓名
     * @param termNo 终端编号
     * @return
     * @throws Exception
     */
    public String getSettlement(String cardNo,String registerNo) throws  Exception{
        String api = "getSettlement";
    public String getSettlement(String cardNo,String cardType,String xtgzh0,String operatorId,String operatorName,String termNo) throws  Exception{
        String api = "query_recipe_gjyb";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
@ -1696,12 +1701,26 @@ public class DsyyEntranceService {
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(cardNo)){
            condition += "<cardNo>"+cardNo+"</cardNo>";
            object.put("cardNo",cardNo);
        }
        if (StringUtils.isNoneBlank(cardType)){
            object.put("cardType",cardType);
        }
        if (StringUtils.isNoneBlank(xtgzh0)){
            object.put("xtgzh0",xtgzh0);
        }
        if (StringUtils.isNoneBlank(operatorId)){
            object.put("operatorId",operatorId);
        }
        if (StringUtils.isNoneBlank(operatorName)){
            object.put("operatorName",operatorName);
        }
        if (StringUtils.isNoneBlank(registerNo)){
            condition += "<registerNo>"+registerNo+"</registerNo>";
        if (StringUtils.isNoneBlank(termNo)){
            object.put("termNo",termNo);
        }
        condition = object.toJSONString();
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
@ -1716,6 +1735,380 @@ public class DsyyEntranceService {
    }
    /**
     * 结算结果确认
     *
     * @param cardNo 患者卡号
     * @param depositAmount 充值金额 如果是医保卡病人,对应个人支付额
     * @param xtgzh0 HIS系统跟踪号(唯一)
     * @param operatorId 操作员ID
     * @param operatorName 操作员姓名
     * @param termNo 终端编号
     * @return
     * @throws Exception
     */
    public String confirmPayGjyb(String cardNo,String xtgzh0,String depositAmount,String outChargeNo,
                                String operatorId,String operatorName,String termNo) throws  Exception{
        String api = "confirm_pay_gjyb";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(cardNo)){
            object.put("cardNo",cardNo);
        }
        if (StringUtils.isNoneBlank(depositAmount)){
            object.put("depositAmount",depositAmount);
        }
        if (StringUtils.isNoneBlank(xtgzh0)){
            object.put("xtgzh0",xtgzh0);
        }
        if (StringUtils.isNoneBlank(operatorId)){
            object.put("operatorId",operatorId);
        }
        if (StringUtils.isNoneBlank(operatorName)){
            object.put("operatorName",operatorName);
        }
        if (StringUtils.isNoneBlank(termNo)){
            object.put("termNo",termNo);
        }
        if (StringUtils.isNoneBlank(outChargeNo)){
            object.put("outChargeNo",outChargeNo);
        }
        condition = object.toJSONString();
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("confirm_pay_gjyb params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" confirm_pay_gjyb json:"+json);
        return json;
    }
    /**
     * 查询院内卡列表
     *
     * @param userName 姓名
     * @param idNo 身份证
     * @return
     * @throws Exception
     */
    public String queryCardList(String userName,String idNo) throws  Exception{
        String api = "op_query_card_list";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(userName)){
            object.put("userName",userName);
        }
        if (StringUtils.isNoneBlank(idNo)){
            object.put("idNo",idNo);
        }
        condition = object.toJSONString();
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("op_query_card_list params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" op_query_card_list json:"+json);
        return json;
    }
    /**
     * 账户建档接口
     * @param operatorId 操作者id
     * @param operatorName 操作者姓名
     * @param termNo 终端
     * @param userName 姓名
     * @param idNo 身份证
     * @param idType 证件类型 默认01
     * @param gend 性别 1男 2女
     * @param phone 手机号
     * @param brdy 出生日期 yyyy-mm-dd
     * @return
     * @throws Exception
     */
    public String buildAccount(String operatorId,String operatorName,String termNo,String userName,String idNo,String idType,
                               String gend,String phone,String brdy) throws  Exception{
        String api = "build_account";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(operatorId)){
            object.put("operatorId",operatorId);
        }
        if (StringUtils.isNoneBlank(operatorName)){
            object.put("operatorName",operatorName);
        }
        if (StringUtils.isNoneBlank(termNo)){
            object.put("termNo",termNo);
        }
        if (StringUtils.isNoneBlank(userName)){
            object.put("userName",userName);
        }
        if (StringUtils.isNoneBlank(idType)){
            object.put("idType",idType);
        }
        if (StringUtils.isNoneBlank(gend)){
            object.put("gend",gend);
        }
        if (StringUtils.isNoneBlank(phone)){
            object.put("phone",phone);
        }
        if (StringUtils.isNoneBlank(brdy)){
            object.put("brdy",brdy);
        }
        condition = object.toJSONString();
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("build_account params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" build_account json:"+json);
        return json;
    }
    /**
     * 3.12住院申请单保存(门诊收入住院)
     *
     *
     * @param cardNo 就诊卡号
     * @param visitDeptCode 就诊科室代码
     * @param visitDoctor 挂号医生,格式如:刘明/03212
     * @param visitNo 就诊号
     * @param inDeptCode 入院科室代码
     * @param diagnosisCode 入院诊断代码
     * @param diagnosisName 入院诊断名称
     * @param admissionType 入院方式,0-门诊 1-急诊 2-转入 5-留观
     * @param admissionCondition 入院病情,1-病危 2-专科紧急  3-一般  4-急诊 5-专科限期  6-专科普通
     * @param admissionCause 住院目的,0-治疗 1-分娩 2-身体检查 3-计划生育
     * @param trumFlag 是否外伤 0-否 1-是
     * @param relTtpFlag 外伤是否涉及第三方 0-否 1-是
     * @return
     * @throws Exception
     */
    public String SendHospitalizedCard(String cardNo ,String visitDeptCode,String visitDoctor,String visitNo,String inDeptCode,String diagnosisCode,
                               String diagnosisName,String admissionType,String admissionCondition,String admissionCause,
                               String trumFlag,String relTtpFlag) throws  Exception{
        String api = "SendHospitalizedCard";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(cardNo)){
            object.put("cardNo",cardNo);
        }
        if (StringUtils.isNoneBlank(visitDeptCode)){
            object.put("visitDeptCode",visitDeptCode);
        }
        if (StringUtils.isNoneBlank(visitDoctor)){
            object.put("visitDoctor",visitDoctor);
        }
        if (StringUtils.isNoneBlank(visitNo)){
            object.put("visitNo",visitNo);
        }
        if (StringUtils.isNoneBlank(inDeptCode)){
            object.put("inDeptCode",inDeptCode);
        }
        if (StringUtils.isNoneBlank(diagnosisCode)){
            object.put("diagnosisCode",diagnosisCode);
        }
        if (StringUtils.isNoneBlank(diagnosisName)){
            object.put("diagnosisName",diagnosisName);
        }
        if (StringUtils.isNoneBlank(admissionType)){
            object.put("admissionType",admissionType);
        }
        if (StringUtils.isNoneBlank(admissionCondition)){
            object.put("admissionCondition",admissionCondition);
        }
        if (StringUtils.isNoneBlank(admissionCause)){
            object.put("admissionCause",admissionCause);
        }
        if (StringUtils.isNoneBlank(trumFlag)){
            object.put("trumFlag",trumFlag);
        }
        if (StringUtils.isNoneBlank(relTtpFlag)){
            object.put("relTtpFlag",relTtpFlag);
        }
        condition = object.toJSONString();
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("SendHospitalizedCard params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" SendHospitalizedCard json:"+json);
        return json;
    }
    /**
     *  查询住院病人日清单
     *
     * @param operatorId 操作人代码
     * @param operatorName 操作人姓名
     * @param termNo 终端编号
     * @param orgCode 机构编码
     * @param iptNo 住院号
     * @param patientId 病人ID 可为空
     * @param beginDate 开始日期 20230801不能为空
     * @param endData 截止日期 可为空
     * @return
     * @throws Exception
     */
    public String queryDayDetailList(String operatorId ,String operatorName,String termNo,String orgCode,String iptNo,String patientId,
                                       String beginDate,String endData) throws  Exception{
        String api = "query_day_detail_list";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(operatorId)){
            object.put("operatorId",operatorId);
        }
        if (StringUtils.isNoneBlank(operatorName)){
            object.put("operatorName",operatorName);
        }
        if (StringUtils.isNoneBlank(termNo)){
            object.put("termNo",termNo);
        }
        if (StringUtils.isNoneBlank(orgCode)){
            object.put("orgCode",orgCode);
        }
        if (StringUtils.isNoneBlank(iptNo)){
            object.put("iptNo",iptNo);
        }
        if (StringUtils.isNoneBlank(patientId)){
            object.put("patientId",patientId);
        }
        if (StringUtils.isNoneBlank(beginDate)){
            object.put("beginDate",beginDate);
        }
        if (StringUtils.isNoneBlank(endData)){
            object.put("endData",endData);
        }
        condition = object.toJSONString();
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("query_day_detail_list params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" query_day_detail_list json:"+json);
        return json;
    }
    /**
     * 互联网医院通知院内摆药
     *
     * @param hISTradeNo 必填,挂号流水号
     * @param payCardNo 必填,就诊卡号
     * @param isExpress 必填,是否快递
     * @param expressBillNo 必填,快递单号
     * @param expressAddress 快递地址
     * @param expressPhone 快递电话
     * @param remark 注意事项
     * @return
     * @throws Exception
     */
    public String sendDispensingToHis(String hISTradeNo,String payCardNo,String isExpress,String expressBillNo,String expressAddress,String expressPhone,String remark) throws  Exception{
        String api = "sendDispensingToHis";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(hISTradeNo)){
            condition += "<HISTradeNo>"+hISTradeNo+"</HISTradeNo>";
        }
        if (StringUtils.isNoneBlank(payCardNo)){
            condition += "<payCardNo>"+payCardNo+"</payCardNo>";
        }
        if (StringUtils.isNoneBlank(isExpress)){
            condition += "<isExpress>"+isExpress+"</isExpress>";
        }
        if (StringUtils.isNoneBlank(expressBillNo)){
            condition += "<expressBillNo>"+expressBillNo+"</expressBillNo>";
        }
        if (StringUtils.isNoneBlank(expressAddress)){
            condition += "<expressAddress>"+expressAddress+"</expressAddress>";
        }
        if (StringUtils.isNoneBlank(expressPhone)){
            condition += "<expressPhone>"+expressPhone+"</expressPhone>";
        }
        if (StringUtils.isNoneBlank(remark)){
            condition += "<remark>"+remark+"</remark>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("sendDispensingToHis params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" sendDispensingToHis json:"+json);
        return json;
    }
    //=============his webservice 调用结束=========================
    //========================集成平台调用开始===========================

+ 200 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/QsyyEntranceService.java

@ -0,0 +1,200 @@
package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.ca.OauthCaConfigDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationInvoiceDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationInvoiceDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.oauth.OauthRsaKeyDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.encrypt.MD5;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.network.HttpResponse;
import com.yihu.jw.util.network.HttpUtils;
import com.yihu.jw.utils.SM4Utils;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.XmlUtil;
import com.yihu.jw.utils.dsyyUtil.SendMessge_ServiceLocator;
import com.yihu.jw.utils.dsyyUtil.WritebackCvalueInterfaceLocator;
import com.yihu.jw.utils.dsyyUtil.ZoesoftHipServiceLocator;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 七三医院内网his对接服务
 * Created by Trick on 2020/3/18
 */
@Service
@Transactional
public class QsyyEntranceService {
    private static Logger logger = LoggerFactory.getLogger(QsyyEntranceService.class);
    private String webServicePushUrl = "http://192.0.10.137/SOAP_174HIS.dll/soap/ISOAP_174HIS_";
    /**
     * WebService推送报文封装请求推送
     * WebService 接口地址为 http://{ip}:{port}/services/TraderService?wsdl
     * @param   //webServicePushUrl 为 http://{ip}:{port}/services/TraderService
     * @param appCode 接口入参
     * @return
     */
    public JSONObject webServicePush(String appCode,String aParam) {
        logger.info("加密前"+appCode+"===="+aParam);
        aParam = SM4Utils.encryptSm4(aParam);
        String xmlStr = "<AppCode xsi:type=\"xsd:string\">"+appCode+"</AppCode>\n" +
                "         <AParam xsi:type=\"xsd:string\">"+aParam+"</AParam>"+
                "         <AddInfo xsi:type=\"xsd:string\"></AddInfo>";
        InputStream is = null;
        InputStreamReader isr = null;
        BufferedReader br = null;
        OutputStream os = null;
        JSONObject json = null;
        try {
            //第一步:创建服务地址,不是WSDL地址
            URL url = new URL(webServicePushUrl);
            //2:打开到服务地址的一个连接
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            //3:设置连接参数
            //3.1设置发送方式:POST必须大写
            connection.setRequestMethod("POST");
            //3.2设置数据格式:Content-type
            connection.setRequestProperty("content-type", "text/xml;charset=utf-8");
            //3.3设置输入输出,新创建的connection默认是没有读写权限的,
            connection.setDoInput(true);
            connection.setDoOutput(true);
            //4:组织SOAP协议数据,发送给服务端;报文参考SoapUI测试工具的XML请求报文
            String soapXML = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:SOAP_174HIS_Intf-ISOAP_174HIS_\">\n" +
                    "   <soapenv:Header/>\n" +
                    "   <soapenv:Body>\n" +
                    "      <urn:_174HisIntf3 soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n" +
                    xmlStr+
                    "      </urn:_174HisIntf3>\n" +
                    "   </soapenv:Body>\n" +
                    "</soapenv: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, 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");
                String result = resultStringMap.get("return");
                logger.info("解密前"+result);
                if (StringUtils.isNoneBlank(result)){
                    result = SM4Utils.decryptSm4(result);
                    logger.info("解密后"+result);
                    json = JSONObject.parseObject(result);
                }
            }
        } 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;
    }
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -165,7 +165,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        String encryptParams = AESUtils.encrypt(JSONUtils.toString(new String[] { jb.toString() }), AesEncodeKey);
        logger.info("encryptParams"+encryptParams);
        String res = wsapi.invoke(appId, "", api, method, encryptParams);
        logger.info("appId :"+appId);
        logger.info("method :"+method);

+ 408 - 0
business/base-service/src/main/java/com/yihu/jw/utils/HttpClientUtil.java

@ -0,0 +1,408 @@
package com.yihu.jw.utils;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
public class HttpClientUtil {
    private static final Logger logger = LoggerFactory.getLogger(HttpClientUtil.class);
    /**
     * HttpClient 调用 WebService
     *
     * @param wsUrl   webService地址,格式:http://ip:port/xxx/xxx/soap?wsdl
     * @param StrDate 格式的入参StrDate=2023/08/02
     * @return
     */
    public static String callServiceHC(String wsUrl, String StrDate) {
        String xml = createSoapContent(StrDate);
        wsUrl = "";
        String returnDatabase = doPostSoap(wsUrl, xml, "");//urn:hl7-org:v3/ZDYFWTYRK
        // 强制将返回结果转换为 UTF-8 编码
        returnDatabase = convertToUTF8(returnDatabase);
        return returnDatabase;
    }
    /**
     * 强制转换整utp-8
     * @param input
     * @return
     */
    public static String convertToUTF8(String input) {
        try {
            byte[] utf8Bytes = input.getBytes(StandardCharsets.UTF_8);
            return new String(utf8Bytes, StandardCharsets.UTF_8);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return input; // 返回原始字符串,如果转换失败
    }
    /**
     * 根据拼接 xml 字符串
     *
     * @param StrDate
     * @return
     */
    public static String createSoapContent(String StrDate) {
        logger.info("开始拼接请求报文");
        //开始拼接请求报文
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:SOAP_174HIS_Intf-ISOAP_174HIS_\">");
        stringBuilder.append("<soapenv:Header/>");
        stringBuilder.append("<soapenv:Body>");
        stringBuilder.append("<urn:_174HisIntf soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">");
        //传输参数
        stringBuilder.append("<AppCode xsi:type=\"xsd:string\">?</AppCode>");
        stringBuilder.append("<AParam xsi:type=\"xsd:string\">?</AParam>");
        stringBuilder.append("</urn:_174HisIntf>");
        stringBuilder.append("</soapenv:Body>");
        stringBuilder.append("</soapenv:Envelope>");
        logger.info("拼接后的参数\n" + stringBuilder.toString());
        return stringBuilder.toString();
    }
    /**
     * HTTPClient 调用 WebService
     *
     * @param url
     * @param soap
     * @param SOAPAction
     * @return
     */
    public static String doPostSoap(String url, String soap, String SOAPAction) {
        //请求体
        String retStr = "";
        // 创建HttpClientBuilder
        HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
        // HttpClient
        CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
        HttpPost httpPost = new HttpPost(url);
        try {
            httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
            httpPost.setHeader("SOAPAction", SOAPAction);
            StringEntity data = new StringEntity(soap, Charset.forName("UTF-8"));
            httpPost.setEntity(data);
            CloseableHttpResponse response = closeableHttpClient.execute(httpPost);
            HttpEntity httpEntity = response.getEntity();
            if (httpEntity != null) {
                // 打印响应内容
                retStr = httpEntity.toString();
            }
            // 释放资源
            closeableHttpClient.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return retStr;
    }
    public static String analyzeResult(String xmlContent) {
        try {
            // 从 xmlContent 字符串解析 XML
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true); // 启用命名空间感知
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(new InputSource(new StringReader(xmlContent)));
            // 获取根元素 (SOAP-ENV:Envelope)
            Element root = doc.getDocumentElement();
            // 获取 SOAP-ENV:Body 元素
            Element body = null;
            NodeList bodyList = root.getElementsByTagName("SOAP-ENV:Body");
            if (bodyList.getLength() > 0) {
                body = (Element) bodyList.item(0);
            }
            // 获取带有 'urn:hl7-org:v3' 命名空间的 ZDYFWTYRKResponse 元素
            Element zdyfwtyrkResponse = (Element) body.getElementsByTagNameNS("urn:hl7-org:v3", "ZDYFWTYRKResponse").item(0);
            Element zdyfwtyrkResult = (Element) zdyfwtyrkResponse.getElementsByTagNameNS("urn:hl7-org:v3", "ZDYFWTYRKResult").item(0);
            // 获取 ZDYFWTYRKResult 元素中的 CDATA 内容(实际的结果数据)
            String cdataContent = zdyfwtyrkResult.getTextContent();
            // 处理CDATA中的XML内容
            Document cdataDoc = builder.parse(new InputSource(new StringReader(cdataContent)));
            // 将Document转换为不带BOM的字符串
            String cdataXmlString = convertDocumentToStringWithoutBOM(cdataDoc);
            logger.debug("cdataXmlString结果: " + cdataXmlString);
            return cdataXmlString;
        } catch (ParserConfigurationException e) {
            // 记录异常信息到日志
            logger.error("XML解析器配置错误: " + e.getMessage(), e);
        } catch (IOException e) {
            // 记录 IOException 异常信息到日志
            logger.error("发生 IO 异常: " + e.getMessage(), e);
        } catch (SAXException e) {
            // 记录 SAXException 异常信息到日志
            logger.error("SAX 解析异常: " + e.getMessage(), e);
        } catch (TransformerException e) {
            logger.error("XML的转换、解析和转换错误: " + e.getMessage(), e);
        }
        return null;
    }
    /**
     * 将 DOM Document 转换为 UTF-8 无 BOM 格式的字符串。
     *
     * @param doc 要转换的 DOM Document。
     * @return 不带 BOM 的 UTF-8 字符串表示的文档。
     */
    private static String convertDocumentToStringWithoutBOM(Document doc) throws TransformerException, UnsupportedEncodingException {
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer();
        // 设置编码为 UTF-8 且不带 BOM
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); // 省略 XML 声明
        transformer.setOutputProperty(OutputKeys.INDENT, "yes"); // 格式化输出
        // 创建一个 ByteArrayOutputStream 来保存 XML 内容
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        StreamResult result = new StreamResult(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
        // 将 Document 转换为不带 BOM 的字符串
        transformer.transform(new DOMSource(doc), result);
        // 将 ByteArrayOutputStream 转换为字符串
        return outputStream.toString("UTF-8");
    }
    public static List<Map<String, String>> resultMap1(String soapResponse) {
        // 从soapResponse中提取JSON部分
        int startIndex = soapResponse.indexOf("<list>");
        int endIndex = soapResponse.indexOf("</list>");
        String jsonPart = soapResponse.substring(startIndex + "<list>".length(), endIndex);
        // 将JSON转换为Map
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map<String, Object> resultMap = objectMapper.readValue(soapResponse, new TypeReference<Map<String, Object>>() {
            });
            ;
            List<Map<String, Object>> resultJsonList = (List<Map<String, Object>>) resultMap.get("resultJson");
            // 转换为 List<Map<String, String>>
            List<Map<String, String>> resultList = new ArrayList();
            for (Map<String, Object> item : resultJsonList) {
                Map<String, String> newMap = new HashMap();
                for (Map.Entry<String, Object> entry : item.entrySet()) {
                    String key = entry.getKey();
                    String value = entry.getValue().toString();
                    newMap.put(key, value);
                }
                // 添加resultCode和resultMsg到转换后的结果
                newMap.put("resultCode", resultMap.get("resultCode").toString());
                newMap.put("resultMsg", resultMap.get("resultMsg").toString());
                resultList.add(newMap);
            }
            // 输出转换后的结果
            for (Map<String, String> item : resultList) {
                System.out.println("resultCode: " + item.get("resultCode"));
                System.out.println("resultMsg: " + item.get("resultMsg"));
                System.out.println("patientName: " + item.get("patientName"));
                System.out.println("opername: " + item.get("opername"));
                System.out.println("operdate: " + item.get("operdate"));
                System.out.println("doctor: " + item.get("doctor"));
            }
            return resultList;
        } catch (IOException e) {
            // 异常处理
            e.printStackTrace();
        }
        return null;
    }
    public static List<Map<String, String>> resultMap(String soapResponse) {
        // 从soapResponse中提取JSON部分
        int startIndex = soapResponse.indexOf("<list>");
        int endIndex = soapResponse.indexOf("</list>");
        String jsonPart = soapResponse.substring(startIndex + "<list>".length(), endIndex);
        // 将JSON转换为Map
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map<String, Object> resultMap = objectMapper.readValue(jsonPart, new TypeReference<Map<String, Object>>() {
            });
            List<Map<String, Object>> resultJsonList = (List<Map<String, Object>>) resultMap.get("resultJson");
            // 转换为 List<Map<String, String>>
            List<Map<String, String>> resultList = new ArrayList();
            for (Map<String, Object> item : resultJsonList) {
                Map<String, String> newMap = new HashMap();
                for (Map.Entry<String, Object> entry : item.entrySet()) {
                    String key = entry.getKey();
                    String value = entry.getValue().toString();
                    newMap.put(key, value);
                }
                resultList.add(newMap);
            }
            return resultList;
        } catch (IOException e) {
            // 异常处理
            e.printStackTrace();
        }
        return null;
    }
    static String webServicePushUrl = "http://192.0.10.137/SOAP_174HIS.dll/soap/ISOAP_174HIS_";
    /**
     * WebService推送报文封装请求推送
     * WebService 接口地址为 http://{ip}:{port}/services/TraderService?wsdl
     * @param   //webServicePushUrl 为 http://{ip}:{port}/services/TraderService
     * @param appCode 接口入参
     * @return
     */
    public static  JSONObject webServicePush(String appCode,String aParam) {
        logger.info("加密前"+appCode+"===="+aParam);
        aParam = SM4Utils.encryptSm4(aParam);
        String xmlStr = "<AppCode xsi:type=\"xsd:string\">"+appCode+"</AppCode>\n" +
                "         <AParam xsi:type=\"xsd:string\">"+aParam+"</AParam>"+
                "         <AddInfo xsi:type=\"xsd:string\"></AddInfo>";
        InputStream is = null;
        InputStreamReader isr = null;
        BufferedReader br = null;
        OutputStream os = null;
        JSONObject json = null;
        try {
            //第一步:创建服务地址,不是WSDL地址
            URL url = new URL(webServicePushUrl);
            //2:打开到服务地址的一个连接
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            //3:设置连接参数
            //3.1设置发送方式:POST必须大写
            connection.setRequestMethod("POST");
            //3.2设置数据格式:Content-type
            connection.setRequestProperty("content-type", "text/xml;charset=utf-8");
            //3.3设置输入输出,新创建的connection默认是没有读写权限的,
            connection.setDoInput(true);
            connection.setDoOutput(true);
            //4:组织SOAP协议数据,发送给服务端;报文参考SoapUI测试工具的XML请求报文
            String soapXML = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:SOAP_174HIS_Intf-ISOAP_174HIS_\">\n" +
                    "   <soapenv:Header/>\n" +
                    "   <soapenv:Body>\n" +
                    "      <urn:_174HisIntf3 soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n" +
                    xmlStr+
                    "      </urn:_174HisIntf3>\n" +
                    "   </soapenv:Body>\n" +
                    "</soapenv: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, 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");
                String result = resultStringMap.get("return");
                logger.info("解密前"+result);
                if (StringUtils.isNoneBlank(result)){
                    result = SM4Utils.decryptSm4(result);
                    logger.info("解密后"+result);
                    json = JSONObject.parseObject(result);
                }
            }
        } 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;
    }
}

+ 55 - 0
business/base-service/src/main/java/com/yihu/jw/utils/SM4Utils.java

@ -0,0 +1,55 @@
package com.yihu.jw.utils;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.symmetric.SM4;
import java.io.IOException;
/**
 * Sm4 加密解密ECB模式,PKCS5Padding补码方式
 */
public class SM4Utils {
    private static final String KEY = "INTERMED20231234";
   //key必须是16字节,即128位
//   public static String key ;
    public SM4Utils() {
    }
    //加密为16进制,也可以加密成base64/字节数组
    public static String encryptSm4(String plaintext) {
        SM4 sm4 = new SM4("ECB", "PKCS5Padding", KEY.getBytes());
        return sm4.encryptBase64(plaintext);
    }
    //解密
    public static String decryptSm4(String ciphertext) {
        SM4 sm4 = new SM4("ECB", "PKCS5Padding", KEY.getBytes());
        return sm4.decryptStr(ciphertext, CharsetUtil.CHARSET_UTF_8);
    }
    public static void main(String[] args) throws IOException {
        String plainText = "{\n" +
                "\t\"Name\": \"张三\",\n" +
                "\t\"idCardNum\": \"XXXXXXX\",\n" +
                "\t\"nation\": \"汉\",\n" +
                "\t\"address\": \"xx省xx县\",\n" +
                "\t\"headImage\": \"data:image/jpeg;base64,xxxxxxxxxx\",\n" +
                "\t\"grantOrg\": \"xx县\",\n" +
                "\t\"startDate\": \"2019-01-30\",\n" +
                "\t\"expiryDate\": \"2029-01-30\",\n" +
                "}";
        SM4Utils sm4 = new SM4Utils();
/*        System.out.println("ECB模式加密");
        String cipherText = sm4.encryptSm4(plainText,key);
        System.out.println("密文: " + cipherText);
        System.out.println();*/
        System.out.println("ECB模式解密");
        String plainText1 = sm4.decryptSm4("cGpzgEwAsKtx+3YbO/PWYg==");
        System.out.println("明文: " + plainText1);
        System.out.println();
    }
}

Datei-Diff unterdrückt, da er zu groß ist
+ 79 - 0
business/base-service/src/main/java/com/yihu/jw/utils/XmlUtil.java


+ 167 - 3
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/DsyyController.java

@ -8,6 +8,7 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.utils.HttpClientUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -161,11 +162,159 @@ public class DsyyController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取患者待结算信息")
    public ObjEnvelop getSettlement(@ApiParam(name = "cardNo", value = "卡号", required = false)
                                    @RequestParam(value = "cardNo",required = false)String cardNo,
                                    @ApiParam(name = "registerNo", value = "挂号号", required = false)
                                    @RequestParam(value = "registerNo",required = false)String registerNo) throws Exception {
        return success("请求成功",dsyyEntranceService.getSettlement(cardNo,registerNo));
                                    @ApiParam(name = "cardType", value = "卡类型", required = false)
                                    @RequestParam(value = "cardType",required = false)String cardType,
                                    @ApiParam(name = "xtgzh0", value = "单据号", required = false)
                                        @RequestParam(value = "xtgzh0",required = false)String xtgzh0,
                                    @ApiParam(name = "operatorId", value = "操作者id", required = false)
                                        @RequestParam(value = "operatorId",required = false)String operatorId,
                                    @ApiParam(name = "operatorName", value = "操作者姓名", required = false)
                                        @RequestParam(value = "operatorName",required = false)String operatorName,
                                    @ApiParam(name = "termNo", value = "终端编号", required = false)
                                        @RequestParam(value = "termNo",required = false)String termNo) throws Exception {
        return success("请求成功",dsyyEntranceService.getSettlement(cardNo,cardType,xtgzh0,operatorId,operatorName,termNo));
    }
    @PostMapping(value = "/confirmPayGjyb")
    @ApiOperation(value = "结算结果确认")
    public ObjEnvelop confirmPayGjyb(@ApiParam(name = "cardNo", value = "卡号", required = false)
                                    @RequestParam(value = "cardNo",required = false)String cardNo,
                                    @ApiParam(name = "depositAmount", value = "充值金额 如果是医保卡病人,对应个人支付额", required = false)
                                    @RequestParam(value = "depositAmount",required = false)String depositAmount,
                                    @ApiParam(name = "outChargeNo", value = "平台结算流水号", required = false)
                                    @RequestParam(value = "outChargeNo",required = false)String outChargeNo,
                                    @ApiParam(name = "xtgzh0", value = "单据号", required = false)
                                    @RequestParam(value = "xtgzh0",required = false)String xtgzh0,
                                    @ApiParam(name = "operatorId", value = "操作者id", required = false)
                                    @RequestParam(value = "operatorId",required = false)String operatorId,
                                    @ApiParam(name = "operatorName", value = "操作者姓名", required = false)
                                    @RequestParam(value = "operatorName",required = false)String operatorName,
                                    @ApiParam(name = "termNo", value = "终端编号", required = false)
                                    @RequestParam(value = "termNo",required = false)String termNo) throws Exception {
        return success("请求成功",dsyyEntranceService.confirmPayGjyb(cardNo,xtgzh0,depositAmount,outChargeNo,operatorId,
                operatorName,termNo));
    }
    @PostMapping(value = "/queryCardList")
    @ApiOperation(value = "查询院内卡列表")
    public ObjEnvelop queryCardList(@ApiParam(name = "userName", value = "姓名", required = false)
                                     @RequestParam(value = "userName",required = false)String userName,
                                     @ApiParam(name = "idNo", value = "身份证", required = false)
                                     @RequestParam(value = "idNo",required = false)String idNo) throws Exception {
        return success("请求成功",dsyyEntranceService.queryCardList(userName,idNo));
    }
    @PostMapping(value = "/buildAccount")
    @ApiOperation(value = "账户建档接口")
    public ObjEnvelop buildAccount(@ApiParam(name = "userName", value = "姓名", required = false)
                                    @RequestParam(value = "userName",required = false)String userName,
                                    @ApiParam(name = "idNo", value = "身份证", required = false)
                                    @RequestParam(value = "idNo",required = false)String idNo,
                                   @ApiParam(name = "operatorId", value = "操作者id", required = false)
                                       @RequestParam(value = "operatorId",required = false)String operatorId,
                                   @ApiParam(name = "operatorName", value = "操作者姓名", required = false)
                                       @RequestParam(value = "operatorName",required = false)String operatorName,
                                   @ApiParam(name = "termNo", value = "终端编号", required = false)
                                       @RequestParam(value = "termNo",required = false)String termNo,
                                   @ApiParam(name = "idType", value = "证件类型 默认01", required = false)
                                       @RequestParam(value = "idType",required = false)String idType,
                                   @ApiParam(name = "gend", value = "性别 1男 2女", required = false)
                                       @RequestParam(value = "gend",required = false)String gend,
                                   @ApiParam(name = "phone", value = "电话号码", required = false)
                                       @RequestParam(value = "phone",required = false)String phone,
                                   @ApiParam(name = "brdy", value = "出生日期 yyyy-mm-dd", required = false)
                                       @RequestParam(value = "brdy",required = false)String brdy) throws Exception {
        return success("请求成功",dsyyEntranceService.buildAccount(operatorId,operatorName,termNo,userName,idNo,idType,
                gend,phone,brdy));
    }
    /**
     * 3.12住院申请单保存(门诊收入住院)
     *
     *
     * @param cardNo 就诊卡号
     * @param visitDeptCode 就诊科室代码
     * @param visitDoctor 挂号医生,格式如:刘明/03212
     * @param visitNo 就诊号
     * @param inDeptCode 入院科室代码
     * @param diagnosisCode 入院诊断代码
     * @param diagnosisName 入院诊断名称
     * @param admissionType 入院方式,0-门诊 1-急诊 2-转入 5-留观
     * @param admissionCondition 入院病情,1-病危 2-专科紧急  3-一般  4-急诊 5-专科限期  6-专科普通
     * @param admissionCause 住院目的,0-治疗 1-分娩 2-身体检查 3-计划生育
     * @param trumFlag 是否外伤 0-否 1-是
     * @param relTtpFlag 外伤是否涉及第三方 0-否 1-是
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/SendHospitalizedCard")
    @ApiOperation(value = "住院申请单保存(门诊收入住院)")
    public ObjEnvelop SendHospitalizedCard(@ApiParam(name = "cardNo", value = "就诊卡号", required = false)
                                   @RequestParam(value = "cardNo",required = false)String cardNo,
                                   @ApiParam(name = "visitDeptCode", value = "就诊科室代码", required = false)
                                   @RequestParam(value = "visitDeptCode",required = false)String visitDeptCode,
                                   @ApiParam(name = "visitDoctor", value = "挂号医生,格式如:刘明/03212", required = false)
                                   @RequestParam(value = "visitDoctor",required = false)String visitDoctor,
                                   @ApiParam(name = "visitNo", value = "就诊号", required = false)
                                   @RequestParam(value = "visitNo",required = false)String visitNo,
                                   @ApiParam(name = "inDeptCode", value = "入院科室代码", required = false)
                                   @RequestParam(value = "inDeptCode",required = false)String inDeptCode,
                                   @ApiParam(name = "diagnosisCode", value = "入院诊断代码", required = false)
                                   @RequestParam(value = "diagnosisCode",required = false)String diagnosisCode,
                                   @ApiParam(name = "diagnosisName", value = "入院诊断名称", required = false)
                                   @RequestParam(value = "diagnosisName",required = false)String diagnosisName,
                                   @ApiParam(name = "admissionType", value = "入院方式,0-门诊 1-急诊 2-转入 5-留观", required = false)
                                   @RequestParam(value = "admissionType",required = false)String admissionType,
                                   @ApiParam(name = "admissionCondition", value = "入院病情,1-病危 2-专科紧急  3-一般  4-急诊 5-专科限期  6-专科普通", required = false)
                                   @RequestParam(value = "admissionCondition",required = false)String admissionCondition,
                                   @ApiParam(name = "admissionCause", value = "住院目的,0-治疗 1-分娩 2-身体检查 3-计划生育", required = false)
                                       @RequestParam(value = "admissionCause",required = false)String admissionCause,
                                   @ApiParam(name = "trumFlag", value = "是否外伤 0-否 1-是", required = false)
                                       @RequestParam(value = "trumFlag",required = false)String trumFlag,
                                   @ApiParam(name = "relTtpFlag", value = "外伤是否涉及第三方 0-否 1-是", required = false)
                                       @RequestParam(value = "relTtpFlag",required = false)String relTtpFlag) throws Exception {
        return success("请求成功",dsyyEntranceService.SendHospitalizedCard(cardNo ,visitDeptCode,visitDoctor,
                visitNo,inDeptCode,diagnosisCode,diagnosisName,admissionType,admissionCondition,admissionCause,trumFlag,relTtpFlag));
    }
    /**
     *  查询住院病人日清单
     *
     * @param operatorId 操作人代码
     * @param operatorName 操作人姓名
     * @param termNo 终端编号
     * @param orgCode 机构编码
     * @param iptNo 住院号
     * @param patientId 病人ID 可为空
     * @param beginDate 开始日期 20230801不能为空
     * @param endData 截止日期 可为空
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/queryDayDetailList")
    @ApiOperation(value = "查询住院病人日清单")
    public ObjEnvelop queryDayDetailList(@ApiParam(name = "operatorId", value = "操作者id", required = false)
                                   @RequestParam(value = "operatorId",required = false)String operatorId,
                                   @ApiParam(name = "operatorName", value = "操作者姓名", required = false)
                                   @RequestParam(value = "operatorName",required = false)String operatorName,
                                   @ApiParam(name = "termNo", value = "终端编号", required = false)
                                   @RequestParam(value = "termNo",required = false)String termNo,
                                   @ApiParam(name = "orgCode", value = "机构编码", required = false)
                                   @RequestParam(value = "orgCode",required = false)String orgCode,
                                   @ApiParam(name = "iptNo", value = "住院号", required = false)
                                   @RequestParam(value = "iptNo",required = false)String iptNo,
                                   @ApiParam(name = "patientId", value = "病人ID 可为空", required = false)
                                   @RequestParam(value = "patientId",required = false)String patientId,
                                   @ApiParam(name = "beginDate", value = "开始日期 20230801不能为空", required = false)
                                   @RequestParam(value = "beginDate",required = false)String beginDate,
                                   @ApiParam(name = "endData", value = "截止日期 可为空", required = false)
                                   @RequestParam(value = "endData",required = false)String endData) throws Exception {
        return success("请求成功",dsyyEntranceService.queryDayDetailList(operatorId ,operatorName,termNo,orgCode,
                iptNo,patientId,beginDate,endData));
    }
    @GetMapping(value = "/authorize")
    @ApiOperation(value = "ca认证")
    public Envelop authorize() throws Exception {
@ -281,4 +430,19 @@ public class DsyyController extends EnvelopRestEndpoint {
        }
        return Envelop.getError("发送失败");
    }
    @GetMapping(value = "/callServiceHC")
    @ApiOperation(value = "七十三医院调用")
    public Envelop callServiceHC(@ApiParam(name = "appCode", value = "appCode", required = false)
                                 @RequestParam(value = "appCode",required = false)String appCode,
                                 @ApiParam(name = "aParam", value = "aParam", required = false)
                                 @RequestParam(value = "aParam",required = false)String aParam) throws Exception {
        try {
            return success(HttpClientUtil.webServicePush(appCode,"aParam"));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
}

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

@ -0,0 +1,61 @@
package com.yihu.jw.entrance.controller;
import com.alibaba.fastjson.JSONArray;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.QsyyEntranceService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.utils.HttpClientUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2020/1/19.
 */
@RestController
@RequestMapping(value ="/qsyy")
@Api(value = "73集团军医院视图解析", description = "73集团军医院视图解析", tags = {"73集团军医院视图解析"})
public class QsyyController extends EnvelopRestEndpoint {
    @Autowired
    private QsyyEntranceService qsyyEntranceService;
    @GetMapping(value = "/webServicePush")
    @ApiOperation(value = "七十三医院his调用接口")
    public Envelop webServicePush(@ApiParam(name = "appCode", value = "appCode", required = false)
                                 @RequestParam(value = "appCode",required = false)String appCode,
                                 @ApiParam(name = "aParam", value = "aParam", required = false)
                                 @RequestParam(value = "aParam",required = false)String aParam) throws Exception {
        try {
            return success(qsyyEntranceService.webServicePush(appCode,aParam));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = "/webServicePushTest")
    @ApiOperation(value = "七十三医院his调用接口测试")
    public Envelop webServicePushTest(@ApiParam(name = "appCode", value = "appCode", required = false)
                                 @RequestParam(value = "appCode",required = false)String appCode,
                                 @ApiParam(name = "aParam", value = "aParam", required = false)
                                 @RequestParam(value = "aParam",required = false)String aParam) throws Exception {
        try {
            return success(HttpClientUtil.webServicePush(appCode,aParam));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
}

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

@ -599,7 +599,7 @@ spring:
  profiles: dsyyProd
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.110.96:3306/base?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    url: jdbc:mysql://192.168.101.2:3306/base?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    password: 2oEq3Kf7@zjxl
@ -619,7 +619,7 @@ im:
  im_list_get: http://127.0.0.1:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.168.110.98:8888/
  fastdfs_file_url: http://192.168.101.2:8888/
wlyy:
  url: https://www.xmtyw.cn/wlyytest/
wechat: