Просмотр исходного кода

家庭签约支付同步基卫代码修改

huangwenjie 7 лет назад
Родитель
Сommit
9cdc37b7a7

+ 40 - 33
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/ChargeZYService.java

@ -120,23 +120,28 @@ public class ChargeZYService {
            Patient patient = patientDao.findByCode(sign.getPatient());
            try {
                hm = getHospitalMapping(sign.getHospital()); //获取机构映射
    
                com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
                
                Map<String, String> params = new HashMap<>();
                params.put("IDENTITY_CARD_NO", idcard);  //身份证
                params.put("SIGN_MANAGE_YEAR", year);  //签约年度
                params.put("SICK_NAME", patient.getName());  //姓名
                jsonObject.put("IDENTITY_CARD_NO", idcard);//身份证
                jsonObject.put("SIGN_MANAGE_YEAR", year);//签约年度
                jsonObject.put("SICK_NAME", patient.getName());//姓名
                
                if(sign.getExpensesTime() == null){
                    //如果签约表的支付时间为空,则从支付表获取支付时间
                    Date newdate = DateUtil.formatCharDateYMD(charge.getChargeTime(),"yyyyMMddHHmmss");
                    params.put("CHARGE_TIME", DateUtil.dateToStrLong(newdate));  //缴费时间
//                    params.put("CHARGE_TIME", DateUtil.dateToStrLong(newdate));  //缴费时间
                    jsonObject.put("CHARGE_TIME", DateUtil.dateToStrLong(newdate));//缴费时间
                    sign.setExpensesTime(newdate);
                    sign.setExpensesStatus("1");//已支付
                }else{
                    params.put("CHARGE_TIME", DateUtil.dateToStrLong(sign.getExpensesTime()));  //缴费时间
//                    params.put("CHARGE_TIME", DateUtil.dateToStrLong(sign.getExpensesTime()));  //缴费时间
                    jsonObject.put("CHARGE_TIME",DateUtil.dateToStrLong(sign.getExpensesTime()));//缴费时间
                }
                
               
                params.put("INSUR_PRO_ID", charge.getMiRegisterNo());  //医保签约号
    
                jsonObject.put("INSUR_PRO_ID",charge.getMiRegisterNo());//医保签约号
//                params.put("INSUR_PRO_ID", charge.getMiRegisterNo());  //医保签约号
                if("1".equals(sign.getRenewFlag())||"2".equals(sign.getRenewFlag())){
@ -178,41 +183,43 @@ public class ChargeZYService {
                        return true;
                    }
                }
                params.put("PRO_ID", proId);  //标志(智业签约主键)
    
                jsonObject.put("PRO_ID",proId);////标志(智业签约主键)
//                params.put("PRO_ID", proId);  //标志(智业签约主键)
                operator = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(operator,hm[0]);  //【医生映射】
                if(operator==null)
                {
                    System.out.print("operator:"+operator+","+hm[0]);
                }
                params.put("CHARGE_OPERATOR", operator);  //收费医生
                jsonObject.put("CHARGE_OPERATOR",operator);////收费医生
//                params.put("CHARGE_OPERATOR", operator);  //收费医生
    
                //缴费明细---2017.12.12---黄文杰
                Map<String, String> INSUR_FEE_INFO = new HashMap<>();
//                Map<String, String> INSUR_FEE_INFO = new HashMap<>();
                com.alibaba.fastjson.JSONObject infoobj = new com.alibaba.fastjson.JSONObject();
                HospitalMapping hospitalMapping = hospitalMappingDao.getMappingCode(sign.getHospital(), "1");  //转换成基卫机构代码
                INSUR_FEE_INFO.put("qyjg00",hospitalMapping.getSbCode());//签约机构
                INSUR_FEE_INFO.put("qyys00",sign.getDoctorName());//签约医生
                INSUR_FEE_INFO.put("btlx00",sign.getExpensesType());//补贴类型
                INSUR_FEE_INFO.put("djjg00",hospitalMapping.getSbCode());//登记机构
                INSUR_FEE_INFO.put("djr000",sign.getDoctorName());//登记人
                INSUR_FEE_INFO.put("djsj00",DateUtil.dateToStrShort(sign.getBegin()));//登记时间
                INSUR_FEE_INFO.put("qyzt00",charge.getMiRegisterStatus());//登记状态
                INSUR_FEE_INFO.put("kfjg00",hospitalMapping.getSbCode());//扣费机构
                INSUR_FEE_INFO.put("kfrxm0",sign.getDoctorName());//扣费人
                INSUR_FEE_INFO.put("kfsj00",charge.getChargeTime());//扣费时间
                INSUR_FEE_INFO.put("kfzt00",charge.getMiCollectStatus());//扣费状态
                INSUR_FEE_INFO.put("kfdjh0",charge.getMiSettleNo());//扣费单据号
                INSUR_FEE_INFO.put("zje000",String.valueOf(charge.getMiTotalFee()));//扣费总额
                INSUR_FEE_INFO.put("zfbtzf",charge.getCadresPay());//政府补贴支付
                INSUR_FEE_INFO.put("tcjjzf",charge.getHealthCarePay());//医保统筹支付
                INSUR_FEE_INFO.put("jkzhzf",charge.getHeathPay());//健康账户支付
                INSUR_FEE_INFO.put("zhzfe0",charge.getAccountPay());//医保账户支付
                INSUR_FEE_INFO.put("xjzfe0",charge.getSelfPay());//个人现金自付
                INSUR_FEE_INFO.put("INSUR_FEE_INFO",JSONObject.fromObject(INSUR_FEE_INFO).toString());
                infoobj.put("qyjg00",hospitalMapping.getSbCode());//签约机构
                infoobj.put("qyys00",sign.getDoctorName());//签约医生
                infoobj.put("btlx00",sign.getExpensesType());//补贴类型
                infoobj.put("djjg00",hospitalMapping.getSbCode());//登记机构
                infoobj.put("djr000",sign.getDoctorName());//登记人
                infoobj.put("djsj00",DateUtil.dateToStrShort(sign.getBegin()));//登记时间
                infoobj.put("qyzt00",charge.getMiRegisterStatus());//登记状态
                infoobj.put("kfjg00",hospitalMapping.getSbCode());//扣费机构
                infoobj.put("kfrxm0",sign.getDoctorName());//扣费人
                infoobj.put("kfsj00",charge.getChargeTime());//扣费时间
                infoobj.put("kfzt00",charge.getMiCollectStatus());//扣费状态
                infoobj.put("kfdjh0",charge.getMiSettleNo());//扣费单据号
                infoobj.put("zje000",String.valueOf(charge.getMiTotalFee()));//扣费总额
                infoobj.put("zfbtzf",charge.getCadresPay());//政府补贴支付
                infoobj.put("tcjjzf",charge.getHealthCarePay());//医保统筹支付
                infoobj.put("jkzhzf",charge.getHeathPay());//健康账户支付
                infoobj.put("zhzfe0",charge.getAccountPay());//医保账户支付
                infoobj.put("xjzfe0",charge.getSelfPay());//个人现金自付
                jsonObject.put("INSUR_FEE_INFO",infoobj);
                
                String response = zysoftService.uploadChargeInfo(params, hm[0], hm[1], operator);
                String response = zysoftService.uploadChargeInfo(jsonObject, hm[0], hm[1], operator);
                Map<String, String> map = zysoftService.getJwOne(response);
                msg = map.get("MESSAGE");

+ 75 - 2
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/ZysoftService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.sign.service;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.sign.common.http.HttpApiException;
import com.yihu.wlyy.sign.common.util.StringUtil;
@ -171,6 +172,78 @@ public class ZysoftService {
        return re;
    }
    
    /**
     * 基卫二次封装Post接口
     */
    private String postSecondJson(String api, String content, com.alibaba.fastjson.JSONObject jsonParams, Map<String,String> headers,boolean needRetry) throws Exception
    {
        String re = "";
        headers.put("INTERFACE",api);
        
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = com.alibaba.fastjson.JSONObject.toJSONString(jsonParams, SerializerFeature.WriteMapNullValue);
        String msgHeader = JSONObject.fromObject(headers).toString();
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
    
    
        //System.out.print("msgHeader:"+msgHeader+"\r\n");
        //System.out.print("msgBody:"+msgBody+"\r\n");
    
        //新增日志
        String method = "POST";
        Boolean isSuccess = true;
        String error = "";
    
        int times = 0;
        try {
            re = ZysoftApi.getSingleton().post("base/CallEhrInterface", paramsList, null, true);
            if(needRetry)
            {
                int maxTimes = retryTimes;
                while(maxTimes>0 && re.contains("接口调用传入的参数[msgHeader]格式不正确"))    //基卫bug预防,重调接口
                {
                    re = ZysoftApi.getSingleton().post("base/CallEhrInterface", paramsList, null,true);
                    maxTimes --;
                    times++;
                }
            }
        
            Map<String,String> map = objectMapper.readValue(re, Map.class);
            String code = map.get("CODE");
        
            if(!code.equals("1"))
            {
                throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
            }
        
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
        }
        catch (Exception ex)
        {
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
        
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
        
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
    
        return re;
    }
    /**
@ -479,14 +552,14 @@ public class ZysoftService {
    /**
     * 上传缴费记录
     */
    public String uploadChargeInfo(Map<String,String> params,String hospital,String licence,String operator)  throws Exception
    public String uploadChargeInfo(com.alibaba.fastjson.JSONObject jsonParams,String hospital,String licence,String operator)  throws Exception
    {
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        header.put("OPERATOR",operator);
        String response = postSecond("uploadPaymentInformation","上传缴费记录",params,header,true);
        String response = postSecondJson("uploadPaymentInformation","上传缴费记录",jsonParams,header,true);
        return response;
    }