瀏覽代碼

第三医院版本开发

wangzhinan 1 年之前
父節點
當前提交
03da0a09d1

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

@ -14,6 +14,7 @@ import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
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.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
@ -87,6 +88,8 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    //请求内网服务
    public static String entranceUrl = "http://192.168.101.2:10024/dsyy/";
    private final static String updateUrl="http://127.0.0.1:10023/dsyy/updateBySql";
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
@ -788,16 +791,54 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    }
    /**
     * 回调his预缴金充值
     *
     * @param orderNo
     * @throws Exception
     */
    public JSONObject rechargeHis(String orderNo) throws Exception {
        JSONObject jsonObject1 = new JSONObject();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        if (businessOrderDO.getUploadStatus()==null||businessOrderDO.getStatus()==0){
            String cardNo = "";
            if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode()).get();
                cardNo = outpatientDO.getCardNo();
            }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode()).get();
                cardNo = outpatientDO.getCardNo();
            }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findById(businessOrderDO.getRelationCode()).orElse(null);
                cardNo=ylzMedicalRelationDO.getCardNo();
            }
            String depositType = "HL";
            String channelType="11";
            String amount=businessOrderDO.getPayPrice()+"";
            String outChargeNo=businessOrderDO.getOrderNo();
            String extra="";
            String notes="预缴金充值";
            String traceNo=businessOrderDO.getTraceNo();
            logger.info("发起预缴金充值接口开始======");
            JSONObject jsonObject = startRechargeToHospital("01",cardNo,depositType,channelType,amount,outChargeNo,extra,notes,traceNo,"");
            logger.info("发起预缴金充值接口结束======");
            logger.info("确认预缴金充值接口开始======");
            jsonObject1 = rechargeToHospital("01",cardNo,depositType,channelType,amount,outChargeNo,extra,notes,traceNo,"");
            logger.info("确认预缴金充值接口结束======");
            businessOrderDO.setUploadStatus(1);
            businessOrderDao.save(businessOrderDO);
        }
        return jsonObject1;
    }
    /**
     *
     * 发起充值接口
     *
     * @param operatorId 操作人代码
     * @param operatorName 操作人姓名
     * @param termNo 终端编号
     * @param cardType 卡类型 01
     * @param cardNo 卡号 不为空
     * @param accountType 充值类型 01门诊 02住院
     * @param depositType 充值类型
     * @param channelType 渠道 CASH-现金 POS-pos机 ONE_CREDIT-信用就医 L-移动支付
     * @param amount 充值金额
@ -809,18 +850,17 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public JSONObject startRechargeToHospital(String operatorId ,String operatorName,String termNo,String cardType,String cardNo,String accountType,
                                                     String depositType,String channelType,String amount,String outChargeNo,
    public JSONObject startRechargeToHospital(String cardType,String cardNo,String depositType,String channelType,String amount,String outChargeNo,
                                                     String extra,String notes,String traceNo,String status) throws Exception {
        String url = entranceUrl +"startRecharge";
        JSONObject object = new JSONObject();
        Map<String,Object> params = new HashedMap();
        params.put("operatorId",operatorId);
        params.put("operatorName",operatorName);
        params.put("termNo",termNo);
        params.put("operatorId","HLWYY");
        params.put("operatorName","互联网医院");
        params.put("termNo","");
        params.put("cardType",cardType);
        params.put("cardNo",cardNo);
        params.put("accountType",accountType);
        params.put("accountType","01");
        params.put("depositType",depositType);
        params.put("channelType",channelType);
        params.put("amount",amount);
@ -833,15 +873,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status1 = rs.getInteger("status");
        if (status1==200){
            if(rs.get("obj") instanceof JSONObject){
                object = rs.getJSONObject("obj");
            }else {
                throw new ServiceException(rs.getString("obj"));
            }
        }
        return object;
        return rs;
    }
@ -849,12 +881,9 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     *
     * 充值确认接口
     *
     * @param operatorId 操作人代码
     * @param operatorName 操作人姓名
     * @param termNo 终端编号
     * @param cardType 卡类型 01
     * @param cardNo 卡号 不为空
     * @param accountType 充值类型 01门诊 02住院
     * @param depositType 充值类型
     * @param channelType 渠道 CASH-现金 POS-pos机 ONE_CREDIT-信用就医 L-移动支付
     * @param amount 充值金额
@ -866,18 +895,17 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public JSONObject rechargeToHospital(String operatorId ,String operatorName,String termNo,String cardType,String cardNo,String accountType,
                                              String depositType,String channelType,String amount,String outChargeNo,
    public JSONObject rechargeToHospital(String cardType,String cardNo,String depositType,String channelType,String amount,String outChargeNo,
                                              String extra,String notes,String traceNo,String status) throws Exception {
        String url = entranceUrl +"recharge";
        JSONObject object = new JSONObject();
        Map<String,Object> params = new HashedMap();
        params.put("operatorId",operatorId);
        params.put("operatorName",operatorName);
        params.put("termNo",termNo);
        params.put("operatorId","HLWYY");
        params.put("operatorName","互联网医院");
        params.put("termNo","");
        params.put("cardType",cardType);
        params.put("cardNo",cardNo);
        params.put("accountType",accountType);
        params.put("accountType","01");
        params.put("depositType",depositType);
        params.put("channelType",channelType);
        params.put("amount",amount);
@ -890,15 +918,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status1 = rs.getInteger("status");
        if (status1==200){
            if(rs.get("obj") instanceof JSONObject){
                object = rs.getJSONObject("obj");
            }else {
                throw new ServiceException(rs.getString("obj"));
            }
        }
        return object;
        return rs;
    }
    /**
@ -958,6 +978,56 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return result;
    }
    /**
     * 获取医生签名图片
     * @param doctor
     * @return
     */
    public JSONObject getSignPicture(String doctor){
        try {
            BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(doctor);
            if (doctorDO==null){
                throw new Exception("医生信息不存在!");
            }
            JSONObject response = synDoctorSearch(doctorDO.getIdcard());
            JSONObject object = new JSONObject();
            if (response!=null){
                JSONObject data = response.getJSONObject("data");
                object.put("code","1000");
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("image",data.getString("stamp"));
                object.put("data",jsonObject);
            }
            logger.info("医生签名图片 getSignPicture :"+response.toJSONString());
            return object;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 查询ca用户信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONObject synDoctorSearch(String idcard) throws Exception {
        String url = entranceUrl +"synDoctorSearch";
        JSONObject object = new JSONObject();
        Map<String,Object> params = new HashedMap();
        params.put("userIdcardNum",idcard);
        HttpResponse response = HttpUtils.doPost(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            object = rs.getJSONObject("message");
        }
        return object;
    }
    /**
     * 数据哈希计算接口
     *
@ -976,7 +1046,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            object = rs.getJSONObject("obj");
            object = rs.getJSONObject("message");
        }
        return object;
    }
@ -1016,7 +1086,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            object = rs.getJSONObject("obj");
            object = rs.getJSONObject("message");
        }
        return object;
    }
@ -1687,8 +1757,20 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    }
    public String updateUrl(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql语句:"+sql);
        HttpResponse response = HttpUtils.doGet(updateUrl,params);
        String content = response.getContent();
        logger.info("response:"+content);
        return content;
    }
    /**
     * 确认医保结算
     * 确认his结算
     *
     *
     * @param outpatientId
     * @return
@ -1719,35 +1801,124 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                orderNo = businessOrderDO.getOrderNo();
            }
            if (ylzMedicalRelationDO.getMedicalState()==null||(ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0)){
                String sql = "update SST_JSDP_JBXX_GJYB\n" +
                        "   set SETL_ID           = '', \n" +
                        "       ACCT_PAY          = '0',\n" +
                        "       PSN_CASH_PAY      = '"+ylzMedicalRelationDO.getPersonCash()+"',\n" +
                        "       FUND_PAY_SUMAMT   = '0',\n" +
                        "       CVLSERV_PAY       = '0',\n" +
                        "       PSN_PART_AMT      = '0',\n" +
                        "       HIFMI_PAY         = '0',\n" +
                        "       MEDFEE_SUMAMT     = '"+ylzMedicalRelationDO.getBcwkje()+"',\n" +
                        "       SETL_TIME         = '0',\n" +
                        "       BALC              = '0',\n" +
                        "       ACCT_MULAID_PAY   = '0',\n" +
                        "       HIFOB_PAY         = '0',\n" +
                        "       MDTRT_ID          = '',\n" +
                        "       HIFP_PAY          = '0',\n" +
                        "       MAF_PAY           = '',\n" +
                        "       OTH_PAY           = '0',\n" +
                        "       HIFES_PAY         = '0',\n" +
                        "       OUTCHARGENO       = '"+orderNo+"',\n" +
                        "       PSN_CERT_TYPE     = '0',\n" +
                        "       NATY              = '0',\n" +
                        "       BRDY              = '0',\n" +
                        "       CVLSERV_FLAG      = '0',\n" +
                        "       ACT_PAY_DEDC      = '0',\n" +
                        "       PSN_TYPE          = '0',\n" +
                        "       HOSP_PART_AMT     = '0',\n" +
                        "       CLR_OPTINS        = '0',\n" +
                        "       CLR_WAY           = '0',\n" +
                        "       CLR_TYPE          = '0',\n" +
                        "       POOL_PROP_SELFPAY = '0',\n" +
                        "       INSUPLC_ADMDVS    = '',\n" +
                        "       INSUTYPE          = '',\n" +
                        "       PSN_NO            = '',\n" +
                        "       CHANNEL_TYPE      = '',\n" +
                        "       ACSIGN_TYPE       = 'null',\n" +
                        "       MDTRT_CERT_TYPE   = '03',\n" +
                        "       CVL_ACCT_PAY      = '0',\n" +
                        "       CVL_ACCT_BALC     = '0',\n" +
                        "       HL_ACCT_PAY       = '0',\n" +
                        "       HL_ACCT_BALC      = '0',\n" +
                        "       FM_ACCT_BALC      = '0',\n" +
                        "       PUR_ACCT_PAY      = '0'\n" +
                        " where 1 = 1\n" +
                        "   and LOG_NO = '"+ylzMedicalRelationDO.getLogNo()+"'";
                //结算更新
                System.out.println("sql=="+sql);
                String res = updateUrl(sql);
            }else {
                String sql = "update SST_JSDP_JBXX_GJYB\n" +
                        "   set SETL_ID      = '"+ylzMedicalRelationDO.getBillSerial()+"',\n" +
                        "       PSN_CASH_PAY      = '"+ylzMedicalRelationDO.getPersonCash()+"',\n" +
                        "       MEDFEE_SUMAMT     = '"+ylzMedicalRelationDO.getBcwkje()+"',\n" +
                        "       HIFOB_PAY         = '0',\n" +
                        "       OUTCHARGENO       = '"+orderNo+"',\n" +
                        "       BRDY              = '0',\n" +
                        "       CVLSERV_FLAG      = '0',\n" +
                        "       HOSP_PART_AMT     = '0',\n" +
                        "       POOL_PROP_SELFPAY = '0',\n" +
                        "       INSUPLC_ADMDVS    = '"+ylzMedicalRelationDO.getAdministrativeArea()+"',\n" +
                        "       INSUTYPE          = '"+ylzMedicalRelationDO.getInsuranceType()+"',\n" +
                        "       PSN_NO            = '',\n" +
                        "       CHANNEL_TYPE      = '',\n" +
                        "       ACSIGN_TYPE       = 'null',\n" +
                        "       MDTRT_CERT_TYPE   = '03',\n" +
                        "       CVL_ACCT_PAY      = '0',\n" +
                        "       CVL_ACCT_BALC     = '0',\n" +
                        "       HL_ACCT_PAY       = '0',\n" +
                        "       HL_ACCT_BALC      = '0',\n" +
                        "       FM_ACCT_BALC      = '0',\n" +
                        "       PUR_ACCT_PAY      = '0',\n" +
                        "       CHRG_BCHNO      = '"+ylzMedicalRelationDO.getBillSerial()+"',\n" +
                        "       MDTRT_ID      = '"+ylzMedicalRelationDO.getInsuranceSerial()+"',\n" +
                        "       PSN_CERT_TYPE      = '"+ylzMedicalRelationDO.getCertType()+"',\n" +
                        "       NATY      = '"+ylzMedicalRelationDO.getCertType()+"',\n" +
                        "       PSN_TYPE      = '"+ylzMedicalRelationDO.getTreatmentType()+"',\n" +
                        "       RYDYMC      = '"+ylzMedicalRelationDO.getTreatmentTypeName()+"',\n" +
                        "       YBDYZT      = '"+(StringUtils.isNoneBlank(ylzMedicalRelationDO.getTreatmentStatus())?ylzMedicalRelationDO.getTreatmentStatus():0)+"',\n" +
                        "       YBDYMC      = '"+(StringUtils.isNoneBlank(ylzMedicalRelationDO.getTreatmentStatusName())?ylzMedicalRelationDO.getTreatmentStatusName():"")+"',\n" +
                        "       YDJYLX      = '"+ylzMedicalRelationDO.getAllopatryType()+"',\n" +
                        "       YDLXMC      = '"+ylzMedicalRelationDO.getAllopatryTypeName()+"',\n" +
                        "       ACT_PAY_DEDC = '"+ylzMedicalRelationDO.getPayStandard()+"',\n" +
                        "       HIFP_PAY      = '"+ylzMedicalRelationDO.getTcjjPay()+"',\n" +
                        "       CVLSERV_PAY = '"+ylzMedicalRelationDO.getGwyPay()+"',\n" +
                        "       HIFES_PAY      = '"+ylzMedicalRelationDO.getEnterpriseSupplement()+"',\n" +
                        "       HIFMI_PAY      = '"+ylzMedicalRelationDO.getSbjjPay()+"',\n" +
                        "       MAF_PAY      = '"+ylzMedicalRelationDO.getYljzPay()+"',\n" +
                        "       OTH_PAY      = '"+ylzMedicalRelationDO.getOtherPay()+"',\n" +
                        "       PSN_PART_AMT      = '"+ylzMedicalRelationDO.getPersonCash()+"',\n" +
                        "       ACCT_PAY      = '"+ylzMedicalRelationDO.getPersonAccount()+"',\n" +
                        "       BALC      = '"+ylzMedicalRelationDO.getAccountBalance()+"',\n" +
                        "       ACCT_MULAID_PAY = '"+ylzMedicalRelationDO.getJtgjPay()+"',\n" +
                        "       CLR_WAY = '"+(StringUtils.isNoneBlank(ylzMedicalRelationDO.getClrWay())?ylzMedicalRelationDO.getClrWay():0)+"',\n" +
                        "       CLR_OPTINS = '"+(StringUtils.isNoneBlank(ylzMedicalRelationDO.getClrOptins())?ylzMedicalRelationDO.getClrOptins():0)+"',\n" +
                        "       CLR_TYPE = '"+(StringUtils.isNoneBlank(ylzMedicalRelationDO.getClrType())?ylzMedicalRelationDO.getClrType():0)+"',\n" +
                        "       FUND_PAY_SUMAMT = '"+ylzMedicalRelationDO.getMedicalPrice()+"',\n" +
                        "       SETL_TIME = '"+DateUtil.dateToStrShort(ylzMedicalRelationDO.getPayDate())+"',\n" +
                        "       OUTYBSFJSON = '"+ylzMedicalRelationDO.getOutJson()+"'\n" +
                        " where 1 = 1\n" +
                        "   and LOG_NO = '"+ylzMedicalRelationDO.getLogNo()+"'";
                //结算更新
                System.out.println("sql=="+sql);
                String res = updateUrl(sql);
            }
            Map<String,Object> params = new HashedMap();
            String url ="" +"comfirmSettleMent";
            params.put("mct","03");
            params.put("mcn",ylzMedicalRelationDO.getCardNo());
            params.put("xtgzh0",ylzMedicalRelationDO.getLogNo());
            HttpResponse response = HttpUtils.doGet(url,params);
            System.out.println("response=="+response.getContent());
            String res = response.getContent();
            String operatorId = "HLWYY";
            String operatorName = "互联网医院";
            String termNo = "DSYYHLWYY";
            JSONObject rsObj = confirmPayGjybToHospital(ylzMedicalRelationDO.getCardNo(),ylzMedicalRelationDO.getLogNo(),depositAmount,outChargeNo, operatorId,operatorName,termNo);
            logger.info("");
            boolean flag = true;
            if (StringUtils.isNoneBlank(res)){
                JSONObject jsonObject = JSONObject.parseObject(res);
                String status = jsonObject.getString("status");
                if (status.equalsIgnoreCase("200")){
                    JSONObject obj = jsonObject.getJSONObject("obj");
                    String rs = obj.getString("rs");
                    JSONObject rsObj = JSONObject.parseObject(rs);
                    String retCode = rsObj.getString("retCode");
                    if (retCode.equalsIgnoreCase("99")){
                        flag=false;
                        throw new Exception(rsObj.getString("retMsg"));
                    }
                }else {
                    flag = false;
            if (rsObj!=null){
                String retCode = rsObj.getString("retCode");
                if (retCode.equalsIgnoreCase("99")){
                    flag=false;
                    throw new Exception(rsObj.getString("retMsg"));
                }
            }else {
                flag=false;
            }
            if (flag){
                ylzMedicalRelationDO.setState(1);
@ -1784,7 +1955,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                }
                try {
                    logger.info("=================电子发票开具开始=================");
               /*     dsyyEntranceService.OutpatientInvoicing(ylzMedicalRelationDO.getHisBillSerial(),"lb");*/
                   /* hcyyEntranceService.OutpatientInvoicing(ylzMedicalRelationDO.getHisBillSerial(),"lb");*/
                    logger.info("=================电子发票开具结束=================");
                }catch (Exception e){
                    e.printStackTrace();
@ -1799,4 +1970,6 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            throw new Exception(e.getMessage());
        }
    }
}

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

@ -14801,11 +14801,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            throw new Exception("门诊信息为空");
        }
        if (StringUtils.isNoneBlank(code)){
            logger.info("医保结算结果获取start!");
            result = healthCareService.getSettlementResult(code);
            logger.info("医保结算结果获取end!");
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                logger.info("医保结算结果获取start!");
                result = healthCareService.getSettlementResult(code);
                logger.info("医保结算结果获取end!");
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
            }else {
                logger.info("医保结算结果获取start!");
                result = healthCareNewService.getSettlementResult(code);
                logger.info("医保结算结果获取end!");
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
            }
        }/*else{
        }
        /*else{
            logger.info("医保结算页面start!");
            String registerNo = outpatientDO.getRegisterNo();
            result = healthCareService.getSettlementResultUrl(registerNo);

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

@ -64,6 +64,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.print.DocFlavor;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
@ -316,6 +317,10 @@ public class DsyyEntranceService {
        return content;
    }
    public void updateBySql(String sql){
        hibenateUtils.updateBySql(sql);
    }
    /**
     * 同步科室信息
     * @return
@ -2171,7 +2176,6 @@ public class DsyyEntranceService {
        return json;
    }
    /**
     * 发起充值接口
     *
@ -2342,9 +2346,9 @@ public class DsyyEntranceService {
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("startRecharge params:"+params.toString());
        logger.info("recharge params:"+params.toString());
        String xml = getDsyyWebServiceInfo("CallInterface",params,getOperateUrl());
        logger.info(" startRecharge json:"+xml);
        logger.info(" recharge json:"+xml);
        return xml;
    }
@ -2380,6 +2384,34 @@ public class DsyyEntranceService {
    }
    /**
     * 同步医师结果查询接口
     *
     * @param openId 用户开放标识
     * @param phone 用户手机号
     * @param userIdcardNum 证件号
     * @param employeeNumber 员工号
     * @return
     * @throws Exception
     */
    public String synDoctorSearch(String openId,String phone,String userIdcardNum,String employeeNumber)throws Exception{
        OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findById("oauth_ca_config").get();
        JSONObject head = new JSONObject();
        head.put("clientId",oauthCaConfigDO.getClientId());
        JSONObject body = new JSONObject();
        body.put("openId",openId);
        body.put("phone",phone);
        body.put("userIdcardNum",userIdcardNum);
        body.put("employeeNumber",employeeNumber);
        JSONObject requestJosn = new JSONObject();
        requestJosn.put("head",head);
        requestJosn.put("body",body);
        WritebackCvalueInterfaceLocator locator = new WritebackCvalueInterfaceLocator();
        String returnStr = locator.getWritebackCvalueInterfaceSoap().synDoctorSearch(requestJosn.toJSONString());
        return returnStr;
    }
    /**
     * 数据哈希计算接口
     * @param content
@ -2390,6 +2422,8 @@ public class DsyyEntranceService {
            WritebackCvalueInterfaceLocator locator = new WritebackCvalueInterfaceLocator();
            JSONObject object = new JSONObject();
            object.put("originData",content);
            object.put("hashAlg","SM3");
            logger.info("object"+object.toJSONString());
            String response = locator.getWritebackCvalueInterfaceSoap().computeDigestForAlg(object.toJSONString());
            logger.info("数据哈希计算接口 :"+response);
            return JSONObject.parseObject(response);
@ -2398,6 +2432,10 @@ public class DsyyEntranceService {
        }
        return null;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
    /***
     * 数据签名接口
@ -2442,8 +2480,9 @@ public class DsyyEntranceService {
            body.put("openId",openId);
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            object.put("signType","0");
            logger.info("请求参数:"+object);
            logger.info("object"+object.toJSONString());
            WritebackCvalueInterfaceLocator locator = new WritebackCvalueInterfaceLocator();
            String response = locator.getWritebackCvalueInterfaceSoap().synRecipeInfo(object.toJSONString());
            logger.info("数据签名接口 :"+response);
@ -2454,6 +2493,7 @@ public class DsyyEntranceService {
        return null;
    }
    /***
     * 获取签名结果接口
     * uniqueId 签名数据唯一标识
@ -2522,6 +2562,211 @@ public class DsyyEntranceService {
        return json;
    }
    /**
     * 处方签名
     * @param prescriptionId
     * @throws Exception
     */
    public String SOF_SignDataWithExtraInfo(String prescriptionId) throws Exception {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).get();
        List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = diagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
        JSONObject object = new JSONObject();
        String baseSign="";
        object.put("infos",infoDOS);
        object.put("registerSn",outpatientDO.getRegisterNo());
        object.put("diagnosiss",diagnosisDOS);
        JSONObject jsonObject = computeDigestForAlg(object.toJSONString());
        String hashValue = null;
        String hashType = null;
        if (jsonObject.getString("status").equalsIgnoreCase("0")){
            JSONObject data = jsonObject.getJSONObject("data");
            hashValue= data.getString("hashValue");
            hashType = data.getString("hashType");
        }
        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient()).orElse(null);
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(outpatientDO.getDoctor());
        if (patientDO!=null&&doctorDO!=null){
            String patientName = patientDO.getName();
            Integer patientAge = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
            String patientSex = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            String recipeTime = DateUtil.dateToStrLong(prescriptionDO.getCreateTime());
            String openId = doctorDO.getOpenid();
            String idcard = patientDO.getIdcard();
            if (hashType!=null&&hashValue!=null){
                JSONObject object1 = synRecipeInfo("hash_004",getCode(),patientName,patientAge.toString(),patientSex,"SF",recipeTime,hashValue,hashType,openId,idcard);
                if (object1.getString("status").equalsIgnoreCase("0")){
                    logger.info("西药处方签名成功"+object1);
                    JSONObject jsonObject1 = JSONObject.parseObject(object1.getString("data"));
                    if (jsonObject1!=null){
                        baseSign=jsonObject1.getString("stamp");
                    }
                }
            }
        }
        return baseSign;
    }
    /**
     * 病历签名
     *
     * @param prescriptionId
     * @throws Exception
     */
    public String SOF_SignDataWithExtraInfoEmr(String prescriptionId) throws Exception {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
        if (prescriptionDO==null){
            throw new Exception("该处方不存在");
        }
        WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(prescriptionDO.getPatientCode());
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).get();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor()).get();
        String caDoctor = synDoctorSearch("","",doctorDO.getIdcard(),"");
        String stamp = "";
        if (StringUtils.isNoneBlank(caDoctor)){
            JSONObject caJson = JSONObject.parseObject(caDoctor);
            if (caJson.getString("status").equalsIgnoreCase("0")){
                JSONObject data = caJson.getJSONObject("data");
                stamp = data.getString("stamp");
            }
        }
        if (!StringUtils.isNoneBlank(stamp)){
            throw new Exception("ca签名获取不到不能写病历");
        }
        String condition = "<MESSAGE>\n" +
                "    <PATIENT_ID>"+patientMappingDO.getMappingCode()+"</PATIENT_ID>\n" +
                "    <HIS_REGISTER_PK>"+outpatientDO.getRegisterNo()+"</HIS_REGISTER_PK>\n" +
                "    <VISIT_ID>"+outpatientDO.getRegisterNo()+"</VISIT_ID>"+
                "    <IS_MR_CREATE>1</IS_MR_CREATE>\n" +
                "    <SYNC_WAY>1</SYNC_WAY>"+
                "    <CREATE_USER_ID>"+doctorMappingDO.getMappingCode()+"</CREATE_USER_ID>\n" +
                "    <CREATE_USER_NAME>"+prescriptionDO.getDoctorName()+"</CREATE_USER_NAME>\n" +
                "    <CREATE_DATE_TIME>"+DateUtil.dateToStrLong(prescriptionDO.getCreateTime())+"</CREATE_DATE_TIME>\n" +
                "    <MR_CODE>EMR10.00.18_36</MR_CODE>\n" +
                "    <TOPIC>嘉和提供</TOPIC>\n" +
                "    <HOSPITAL_NO>医院编码</HOSPITAL_NO>\n" +
                "    <DEPT_CODE>"+prescriptionDO.getDept()+"</DEPT_CODE>\n" +
                "    <DEPT_NAME>"+prescriptionDO.getDeptName()+"</DEPT_NAME>\n" +
                "    <FILE_FLAG>1</FILE_FLAG>\n" +
                "    <SHCZZT_FLAG>"+doctorMappingDO.getMappingCode()+"</SHCZZT_FLAG>\n" +
                "    <CA_SIGN_PIC>"+stamp+"</CA_SIGN_PIC>\n" +
                "    <Structured_medical>\n" +
                "      <主诉>"+prescriptionEmrDO.getComplaint()+"</主诉>\n" +
                "      <流行病学史>"+prescriptionEmrDO.getPopularHistory()+"</流行病学史>\n" +
                "      <主要病史>"+prescriptionEmrDO.getPastHistory()+"</主要病史>\n" +
                "      <体格检查>"+prescriptionEmrDO.getPhysicalExamination()+"</体格检查>\n" +
                "      <辅助检查>"+prescriptionEmrDO.getAssistExamination()+"</辅助检查>\n" +
                "      <初步诊断>门诊诊断内容(诊断名称|诊断代码)</初步诊断>\n" +
                "      <门诊处置>药品内容(序号|药品名称|用量|单位|用法|频次|天数|总量|单位)</门诊处置>\n" +
                "      <检验></检验>\n" +
                "      <检查></检查>\n" +
                "    </Structured_medical>\n" +
                "  </MESSAGE>";
        JSONObject jsonObject = computeDigestForAlg(condition);
        String hashValue = null;
        String hashType = null;
        if (jsonObject.getString("status").equalsIgnoreCase("0")){
            JSONObject data = jsonObject.getJSONObject("data");
            hashValue= data.getString("hashValue");
            hashType = data.getString("hashType");
        }
        String baseSign="";
        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient()).get();
        if (patientDO!=null&&doctorDO!=null){
            String patientName = patientDO.getName();
            Integer patientAge = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
            String patientSex = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            String recipeTime = DateUtil.dateToStrLong(prescriptionDO.getCreateTime());
            String openId = doctorDO.getOpenid();
            String idcard = patientDO.getIdcard();
            if (hashType!=null&&hashValue!=null){
                JSONObject object1 = synRecipeInfo("hash_002",getCode(),patientName,patientAge.toString(),patientSex,"SF",recipeTime,hashValue,hashType,openId,idcard);
                if (object1.getString("status").equalsIgnoreCase("0")){
                    logger.info("门诊病历签名成功"+object1);
                    JSONObject jsonObject1 = JSONObject.parseObject(object1.getString("data"));
                    if (jsonObject1!=null){
                        baseSign=jsonObject1.getString("stamp");
                    }
                }
            }
        }
        return baseSign;
    }
    /**
     * 电子病历保存
     * *
     * @return
     * @throws Exception
     */
    public String dzblSave(String prescriptionId)throws Exception{
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
        if (prescriptionDO==null){
            throw new Exception("该处方不存在");
        }
        WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(prescriptionDO.getPatientCode());
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).get();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor()).get();
        String caDoctor = synDoctorSearch("","",doctorDO.getIdcard(),"");
        String stamp = "";
        if (StringUtils.isNoneBlank(caDoctor)){
            JSONObject caJson = JSONObject.parseObject(caDoctor);
            if (caJson.getString("status").equalsIgnoreCase("0")){
                JSONObject data = caJson.getJSONObject("data");
                stamp = data.getString("stamp");
            }
        }
        if (!StringUtils.isNoneBlank(stamp)){
            throw new Exception("ca签名获取不到不能写病历");
        }
        String condition = "<MESSAGE>\n" +
                "    <PATIENT_ID>"+patientMappingDO.getMappingCode()+"</PATIENT_ID>\n" +
                "    <HIS_REGISTER_PK>"+outpatientDO.getRegisterNo()+"</HIS_REGISTER_PK>\n" +
                "    <VISIT_ID>"+outpatientDO.getRegisterNo()+"</VISIT_ID>\n"+
                "    <IS_MR_CREATE>1</IS_MR_CREATE>\n" +
                "    <SYNC_WAY>1</SYNC_WAY>\n"+
                "    <CREATE_USER_ID>"+doctorMappingDO.getMappingCode()+"</CREATE_USER_ID>\n" +
                "    <CREATE_USER_NAME>"+prescriptionDO.getDoctorName()+"</CREATE_USER_NAME>" +
                "    <CREATE_DATE_TIME>"+DateUtil.dateToStrLong(prescriptionDO.getCreateTime())+"</CREATE_DATE_TIME>\n" +
                "    <MR_CODE>EMR10.00.18_36</MR_CODE>\n" +
                "    <TOPIC>嘉和提供</TOPIC>\n" +
                "    <HOSPITAL_NO>医院编码</HOSPITAL_NO>\n" +
                "    <DEPT_CODE>"+prescriptionDO.getDept()+"</DEPT_CODE>\n" +
                "    <DEPT_NAME>"+prescriptionDO.getDeptName()+"</DEPT_NAME>\n" +
                "    <FILE_FLAG>1</FILE_FLAG>\n" +
                "    <SHCZZT_FLAG>"+doctorMappingDO.getMappingCode()+"</SHCZZT_FLAG>\n" +
                "    <CA_SIGN_PIC>"+stamp+"</CA_SIGN_PIC>\n" +
                "    <Structured_medical>\n" +
                "      <主诉>"+prescriptionEmrDO.getComplaint()+"</主诉>\n" +
                "      <流行病学史>"+prescriptionEmrDO.getPopularHistory()+"</流行病学史>\n" +
                "      <主要病史>"+prescriptionEmrDO.getPastHistory()+"</主要病史>\n" +
                "      <体格检查>"+prescriptionEmrDO.getPhysicalExamination()+"</体格检查>\n" +
                "      <辅助检查>"+prescriptionEmrDO.getAssistExamination()+"</辅助检查>\n" +
                "      <初步诊断>门诊诊断内容(诊断名称|诊断代码)</初步诊断>\n" +
                "      <门诊处置>药品内容(序号|药品名称|用量|单位|用法|频次|天数|总量|单位)</门诊处置>\n" +
                "      <检验></检验>\n" +
                "      <检查></检查>\n" +
                "    </Structured_medical>\n" +
                "  </MESSAGE>";
        String pInput="<![CDATA["+condition+"]]>";
        logger.info("电子病历保存入参"+pInput);
        ServiceLocator locator = new ServiceLocator();
        String returnStr = locator.getServiceSoap().send(pInput);
        logger.info("电子病历保存出参"+returnStr);
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(returnStr).toString();
        return json;
    }
   /* public String selectEmrByPatientId(String patientId,String visitId){
        ServiceLocator locator = new ServiceLocator();
        String returnStr = locator.getServiceSoap("http://10.95.8.41:80/csp/jhip/JHIPLIB.SOAP.BS.Service.cls?CfgItem=JH1221查询病历接口BS").send()

+ 47 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -15,6 +15,7 @@ import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
@ -24,6 +25,7 @@ import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
@ -36,6 +38,8 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
@ -150,6 +154,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private HttpClientUtil httpClientUtil;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    /**
@ -1416,10 +1424,47 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @param tradeType
     * @return
     */
    public JSONObject tradeQuery(String orderNo,String tradeType){
    public JSONObject tradeQuery(String orderNo,String tradeType) throws Exception {
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        String response = ylzPayService.tradeQuery(null,null,businessOrderDO.getPatientName(),orderNo,tradeType,businessOrderDO.getRematk());
        String operatorId = "";
        String operatorName = "";
        if(wechatId.equalsIgnoreCase("xm_dsyy_wx")){
            operatorId = "HLWCS";
            operatorName = "互联网医院";
        }
        String response = ylzPayService.tradeQuery(operatorId,operatorName,orderNo,tradeType,businessOrderDO.getRematk());
        JSONObject object = JSONObject.parseObject(response);
        if (object.getString("respCode").equalsIgnoreCase("000000")){
            JSONObject param = object.getJSONObject("param");
            if (param.getString("result").equalsIgnoreCase("succ")){
                if(wechatId.equalsIgnoreCase("xm_dsyy_wx")){
                    logger.info("his充值开始");
                    dsyyPrescriptionService.rechargeHis(businessOrderDO.getOrderNo());
                    logger.info("his充值结束");
                }
                if (businessOrderDO.getStatus()!=1){
                   if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode()).get();
                        wlyyOutpatientDO.setPayStatus(1);
                        WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
                    }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode()).get();
                        wlyyOutpatientDO.setPayStatus(1);
                        WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
                    }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findById(businessOrderDO.getRelationCode()).orElse(null);
                        if (wechatId.equalsIgnoreCase("xm_dsyy_wx")){
                            dsyyPrescriptionService.confirmSettlement(ylzMedicalRelationDO.getRelationCode());
                        }
                    }
                }
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setStatus(1);
                businessOrderDO.setPayTime(new Date());
                businessOrderDao.save(businessOrderDO);
            }
        }
        return object;
    }

+ 55 - 42
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -194,47 +194,7 @@ public class YlzPayService {
    }
    public String tradeQuery(String termNo,String operatorId,String operatorName,String outTradeNo,String tradeType,String notes){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config").orElse(null);
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        TradeQueryParams param = new TradeQueryParams();
        try {
            param.setTermNo("123456");
            param.setOperatorId("123456");
            param.setOperatorName(operatorName);
            param.setTradeType(tradeType);
            param.setOutTradeNo(outTradeNo);
            param.setNotes(notes);
            ResponseParams<TradeQueryResult> response = onepayClient.tradeQuery(param);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.tradeQuery", "互联网医院查询订单", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        return object;
    }
    /**
@ -400,7 +360,7 @@ public class YlzPayService {
        RechargeParams param = new RechargeParams();
        String error = null;
        try {
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config").orElse(null);
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config").get();
            if(oauthYlzConfigDO==null){
                return "未找到支付配置文件";
            }
@ -541,6 +501,58 @@ public class YlzPayService {
        return jsonObject;
    }
    /**
     * 查询是否支付成功
     * @param termNo
     * @param operatorId
     * @param operatorName
     * @param outTradeNo
     * @param tradeType
     * @param notes
     * @return
     */
    public String tradeQuery(String operatorId,String operatorName,String outTradeNo,String tradeType,String notes){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config").orElse(null);
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        TradeQueryParams param = new TradeQueryParams();
        try {
            param.setTermNo("");
            param.setOperatorId(operatorId);
            param.setOperatorName(operatorName);
            param.setTradeType(tradeType);
            param.setOutTradeNo(outTradeNo);
            param.setNotes(notes);
            ResponseParams<TradeQueryResult> response = onepayClient.tradeQuery(param);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.tradeQuery", "互联网医院查询订单", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        return object;
    }
    /**
     * 预交金查询余额
@ -592,6 +604,7 @@ public class YlzPayService {
        return jsonObject;
    }
//============================================预交金充值 end======================================================

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/utils/dsyyUtil/ServiceLocator.java

@ -22,7 +22,7 @@ public class ServiceLocator extends org.apache.axis.client.Service implements Se
    }
    // Use to get a proxy class for ServiceSoap
    private String ServiceSoap_address = "http://10.95.8.41:80/csp/jhip/JHIPLIB.SOAP.BS.Service.cls?CfgItem=JH1221查询病历接口BS";
    private String ServiceSoap_address = "http://10.95.8.41:80/csp/jhip/JHIPLIB.SOAP.BS.Service.cls?CfgItem=JH1224%E4%BA%92%E8%81%94%E7%BD%91%E4%BF%9D%E5%AD%98%E7%97%85%E5%8E%86%E6%8E%A5%E5%8F%A3BS";
    public String getServiceSoapAddress() {
        return ServiceSoap_address;

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/DsyyService.java

@ -91,7 +91,7 @@ public class DsyyService {
     */
    public JSONObject getTokeninfo(String requestId){
        try {
            String url = entranceUrl+"tokeninfo";
            String url = entranceUrl+"tokeninfo?requestId="+requestId;
            String response = httpClientUtil.get(url,"utf-8");
            logger.info("验证二维码 getQueryQRCode :"+response);
            JSONObject object = JSONObject.parseObject(response);

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

@ -434,6 +434,28 @@ public class DsyyController extends EnvelopRestEndpoint {
        return success(dsyyEntranceService.tokeninfo(requestId));
    }
    /**
     *
     * @param openId 用户开放标识
     * @param phone 用户手机号
     * @param userIdcardNum 证件号
     * @param employeeNumber 员工号
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/synDoctorSearch")
    @ApiOperation(value = "同步医师结果查询接口")
    public Envelop synDoctorSearch( @ApiParam(name = "openId", value = "用户开放标识", required = false)
                              @RequestParam(value = "openId",required = false)String openId,
                                    @ApiParam(name = "phone", value = "用户手机号", required = false)
                                    @RequestParam(value = "phone",required = false)String phone,
                                    @ApiParam(name = "userIdcardNum", value = "证件号", required = false)
                                    @RequestParam(value = "userIdcardNum",required = false)String userIdcardNum,
                                    @ApiParam(name = "employeeNumber", value = "员工号", required = false)
                                    @RequestParam(value = "employeeNumber",required = false)String employeeNumber) throws Exception {
        return success(dsyyEntranceService.synDoctorSearch(openId,phone,userIdcardNum,employeeNumber));
    }
    @PostMapping(value = "/computeDigestForAlg")
    @ApiOperation(value = "数据哈希计算接口")
    public Envelop computeDigestForAlg(@ApiParam(name = "content", value = "内容", required = false)
@ -525,6 +547,27 @@ public class DsyyController extends EnvelopRestEndpoint {
        return Envelop.getError("发送失败");
    }
    @PostMapping(value = "/dzblSave")
    @ApiOperation(value = "电子病历保存")
    public ObjEnvelop dzblSave(@ApiParam(name = "prescriptionId", value = "处方id", required = false)
                               @RequestParam(value = "prescriptionId",required = false)String prescriptionId) throws Exception {
        return success("请求成功",dsyyEntranceService.dzblSave(prescriptionId));
    }
    @PostMapping(value = "/SOF_SignDataWithExtraInfo")
    @ApiOperation(value = "处方签名")
    public ObjEnvelop SOF_SignDataWithExtraInfo(@ApiParam(name = "prescriptionId", value = "处方id", required = false)
                               @RequestParam(value = "prescriptionId",required = false)String prescriptionId) throws Exception {
        return success("请求成功",dsyyEntranceService.SOF_SignDataWithExtraInfo(prescriptionId));
    }
    @PostMapping(value = "/SOF_SignDataWithExtraInfoEmr")
    @ApiOperation(value = "病历签名")
    public ObjEnvelop SOF_SignDataWithExtraInfoEmr(@ApiParam(name = "prescriptionId", value = "处方id", required = false)
                                                @RequestParam(value = "prescriptionId",required = false)String prescriptionId) throws Exception {
        return success("请求成功",dsyyEntranceService.SOF_SignDataWithExtraInfoEmr(prescriptionId));
    }
    @GetMapping(value = "/queryDzfp")
    @ApiOperation(value = "电子发票查询")
    public Envelop queryDzfp(@ApiParam(name = "id", value = "结算id", required = false)
@ -585,4 +628,14 @@ public class DsyyController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "/updateBySql")
    @ApiOperation(value = "更新语句")
    public ObjEnvelop updateBySql(@ApiParam(name = "sql", value = "sql语句", required = true)
                                  @RequestParam(value = "sql",required = true)String sql){
        ObjEnvelop envelop = new ObjEnvelop();
        dsyyEntranceService.updateBySql(sql);
        return success(envelop);
    }
}

+ 13 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -267,6 +267,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    @GetMapping(value = "orgInfo")
    @ApiOperation(value = "机构详情", notes = "机构详情")
@ -737,7 +740,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
//                boolean isVerify = client.verifyResponseSign(decryptRes);
                boolean isVerify = true;
                logger.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
@ -748,6 +752,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                    String traceNo = param.getString("outChargeNo");
                    //im处方发消息
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(traceNo);
                    if(wxId.equalsIgnoreCase("xm_dsyy_wx")){
                        logger.info("his充值开始");
                        dsyyPrescriptionService.rechargeHis(businessOrderDO.getOrderNo());
                        logger.info("his充值结束");
                    }
                    if (businessOrderDO.getStatus()!=1){
                        if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(businessOrderDO.getRelationCode()).orElse(null);
@ -781,7 +790,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                            hospitalSystemMessageService.sendImMessage(systemMessageDO);
                        }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findById(businessOrderDO.getRelationCode()).orElse(null);
                            prescriptionService.confirmSettlementService(ylzMedicalRelationDO.getRelationCode());
                            if (wxId.equalsIgnoreCase("xm_dsyy_wx")){
                                dsyyPrescriptionService.confirmSettlement(ylzMedicalRelationDO.getRelationCode());
                            }
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);
@ -897,7 +908,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return appId;
    }
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.findWorkTimeRule)
    @ApiOperation(value = "查询排班规则")
    public ObjEnvelop findWorkTimeRule(@ApiParam(name = "hospital", value = "医院code")

+ 52 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/DsyyPrescriptionCotroller.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.HcyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
@ -47,6 +48,8 @@ public class DsyyPrescriptionCotroller extends EnvelopRestEndpoint {
    private ImService imService;
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    @GetMapping(value = "/updateDept")
@ -63,7 +66,56 @@ public class DsyyPrescriptionCotroller extends EnvelopRestEndpoint {
        return ObjEnvelop.getSuccess("ok",dsyyEntranceService.updateDoctor(idcard));
    }
    @GetMapping(value= "rechargeHis")
    @ApiOperation(value = "回调his预缴金充值")
    public ObjEnvelop rechargeHis(@ApiParam(name = "orderNo", value = "订单编码")
                                  @RequestParam(value = "orderNo",required = true)String orderNo) throws Exception {
        return success(dsyyPrescriptionService.rechargeHis(orderNo));
    }
    /**
     * 合理用药审核
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/hcyyCheckInfo")
    @ApiOperation(value = "合理用药审核")
    public Envelop hcyyCheckInfo(
            @ApiParam(name = "outpatient", value = "就诊表id")
            @RequestParam(value = "outpatient", defaultValue = "") String outpatient,
            @ApiParam(name = "prescriptionOnly", value = "处方唯一标识")
            @RequestParam(value = "prescriptionOnly", defaultValue = "") String prescriptionOnly,
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
            @RequestParam(value = "payType", defaultValue = "") String payType,
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", defaultValue = "") String doctor,
            @ApiParam(name = "patient", value = "病人id")
            @RequestParam(value = "patient", defaultValue = "") String patient,
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS", defaultValue = "") String diagnosisDOS,
            @ApiParam(name = "infos", value = "药品json")
            @RequestParam(value = "infos", defaultValue = "") String infos) throws Exception {
        JSONArray druginfos = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i = 0; i < druginfos.size(); i++) {
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(), WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONArray diagnosis = JSONArray.parseArray(diagnosisDOS);
        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = new ArrayList<>();
        for (int i = 0; i < diagnosis.size(); i++) {
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(), WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(dsyyEntranceService.checkPrescriptions(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
}

+ 9 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -1849,6 +1849,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(ykyyService.getSignPicture(doctor));
        }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            return success(hcyyEntranceService.getSignPicture(doctor));
        }else if (wxId.equalsIgnoreCase("xm_dsyy_wx")){
            return success(dsyyPrescriptionService.getSignPicture(doctor));
        }else {
            return success("功能尚未开通","500");
        }
@ -2322,7 +2324,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.tradeQuery)
    @ApiOperation("易联众统一订单查询")
    public ObjEnvelop tradeQuery(
            @ApiParam(name = "tradeType", value = "tradeType", required = true)
            @ApiParam(name = "tradeType", value = "交易hop.trade.recharge退款hop.trade.refund", required = true)
            @RequestParam(required = true) String tradeType,
            @ApiParam(name = "orderNo", value = "orderNo", required = true)
            @RequestParam(required = true) String orderNo) throws Exception {
@ -3696,7 +3698,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
        try {
            return success("操作成功", prescriptionService.confirmSettlementService(outpatientId));
            if (wxId.equalsIgnoreCase("xm_dsyy_wx")){
                return success("操作成功", dsyyPrescriptionService.confirmSettlement(outpatientId));
            }else {
                return success("操作成功", prescriptionService.confirmSettlementService(outpatientId));
            }
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }