ソースを参照

Merge branch 'dev' of huangwenjie/patient-co-management into dev

trick9191 7 年 前
コミット
5637eff7ee

+ 144 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/AmoutUtils.java

@ -0,0 +1,144 @@
package com.yihu.wlyy.service.common.util;
import org.springframework.stereotype.Component;
/**
 * 金额工具类
 * @author huangwenjie
 * @date 2017/8/19 13:52
 */
@Component
public class AmoutUtils {
    /**
     *
     * 功能描述:金额字符串转换:单位分转成单元
     * @param o 传入需要转换的金额字符串
     * @return 转换后的金额字符串
     */
    public String fenToYuan(Object o) {
        if(o == null)
            return "0.00";
        String s = o.toString();
        int len = -1;
        StringBuilder sb = new StringBuilder();
        if (s != null && s.trim().length()>0 && !s.equalsIgnoreCase("null")){
            s = removeZero(s);
            if (s != null && s.trim().length()>0 && !s.equalsIgnoreCase("null")){
                len = s.length();
                int tmp = s.indexOf("-");
                if(tmp>=0){
                    if(len==2){
                        sb.append("-0.0").append(s.substring(1));
                    }else if(len==3){
                        sb.append("-0.").append(s.substring(1));
                    }else{
                        sb.append(s.substring(0, len-2)).append(".").append(s.substring(len-2));
                    }
                }else{
                    if(len==1){
                        sb.append("0.0").append(s);
                    }else if(len==2){
                        sb.append("0.").append(s);
                    }else{
                        sb.append(s.substring(0, len-2)).append(".").append(s.substring(len-2));
                    }
                }
            }else{
                sb.append("0.00");
            }
        }else{
            sb.append("0.00");
        }
        return sb.toString();
    }
    /**
     *
     * 功能描述:金额字符串转换:单位元转成单分
     * @param o 传入需要转换的金额字符串
     * @return 转换后的金额字符串
     */
    public String yuanToFen(Object o) {
        if(o == null)
            return "0";
        String s = o.toString();
        int posIndex = -1;
        String str = "";
        StringBuilder sb = new StringBuilder();
        if (s != null && s.trim().length()>0 && !s.equalsIgnoreCase("null")){
            posIndex = s.indexOf(".");
            if(posIndex>0){
                int len = s.length();
                if(len == posIndex+1){
                    str = s.substring(0,posIndex);
                    if(str == "0"){
                        str = "";
                    }
                    sb.append(str).append("00");
                }else if(len == posIndex+2){
                    str = s.substring(0,posIndex);
                    if(str == "0"){
                        str = "";
                    }
                    sb.append(str).append(s.substring(posIndex+1,posIndex+2)).append("0");
                }else if(len == posIndex+3){
                    str = s.substring(0,posIndex);
                    if(str == "0"){
                        str = "";
                    }
                    sb.append(str).append(s.substring(posIndex+1,posIndex+3));
                }else{
                    str = s.substring(0,posIndex);
                    if(str == "0"){
                        str = "";
                    }
                    sb.append(str).append(s.substring(posIndex+1,posIndex+3));
                }
            }else{
                sb.append(s).append("00");
            }
        }else{
            sb.append("0");
        }
        str = removeZero(sb.toString());
        if(str != null && str.trim().length()>0 && !str.trim().equalsIgnoreCase("null")){
            return str;
        }else{
            return "0";
        }
    }
    /**
     *
     * 功能描述:去除字符串首部为"0"字符
     * @param str 传入需要转换的字符串
     * @return 转换后的字符串
     */
    public String removeZero(String str){
        char  ch;
        String result = "";
        if(str != null && str.trim().length()>0 && !str.trim().equalsIgnoreCase("null")){
            try{
                for(int i=0;i<str.length();i++){
                    ch = str.charAt(i);
                    if(ch != '0'){
                        result = str.substring(i);
                        break;
                    }
                }
            }catch(Exception e){
                result = "";
            }
        }else{
            result = "";
        }
        return result;
    }
}

+ 20 - 16
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.util.AmoutUtils;
import com.yihu.wlyy.service.common.util.CommonUtil;
import com.yihu.wlyy.service.common.util.DateUtil;
import com.yihu.wlyy.service.dao.*;
@ -69,6 +70,9 @@ public class PrescriptionService extends ZysoftBaseService{
    private String channelTopic;
//    private String channelTopic = "redisPrescription";
    @Autowired
    private AmoutUtils amoutUtils;
    /**
     * 新增续方日志
     * @param prescription
@ -711,28 +715,28 @@ public class PrescriptionService extends ZysoftBaseService{
        //医保支付需要组装以下参数
        if (1 == prescriptionPay.getType()){
            JSONObject insurResult = new JSONObject();
            insurResult.put("zhzfe0",prescriptionPay.getAccountPay());//个人账户支付(医保个人账户支付)
            insurResult.put("jjzfe0",prescriptionPay.getFundPay());//基金支付(医保统筹基金支付)
            insurResult.put("sybxzf",prescriptionPay.getCommercePay());//商业保险支付
            insurResult.put("bjjjzf",prescriptionPay.getHealthCarePay());//保健基金支付(保健支付)
            insurResult.put("mzbzje",prescriptionPay.getCivilPay());//民政补助金额(民政医疗救助金额)
            insurResult.put("ylzfe0",prescriptionPay.getBdrugPay());//医保乙类支付
            insurResult.put("Cfdxje",prescriptionPay.getExceedAmount());//超封顶线金额
            insurResult.put("gwybz0",prescriptionPay.getCadresPay());//超公务员补助支付
            insurResult.put("grzhye",prescriptionPay.getAccountBalance());//个人账户余额
            insurResult.put("zhzfe0",amoutUtils.fenToYuan(prescriptionPay.getAccountPay()));//个人账户支付(医保个人账户支付)
            insurResult.put("jjzfe0",amoutUtils.fenToYuan(prescriptionPay.getFundPay()));//基金支付(医保统筹基金支付)
            insurResult.put("sybxzf",amoutUtils.fenToYuan(prescriptionPay.getCommercePay()));//商业保险支付
            insurResult.put("bjjjzf",amoutUtils.fenToYuan(prescriptionPay.getHealthCarePay()));//保健基金支付(保健支付)
            insurResult.put("mzbzje",amoutUtils.fenToYuan(prescriptionPay.getCivilPay()));//民政补助金额(民政医疗救助金额)
            insurResult.put("ylzfe0",amoutUtils.fenToYuan(prescriptionPay.getBdrugPay()));//医保乙类支付
            insurResult.put("Cfdxje",amoutUtils.fenToYuan(prescriptionPay.getExceedAmount()));//超封顶线金额
            insurResult.put("gwybz0",amoutUtils.fenToYuan(prescriptionPay.getCadresPay()));//超公务员补助支付
            insurResult.put("grzhye",amoutUtils.fenToYuan(prescriptionPay.getAccountBalance()));//个人账户余额
            insurResult.put("mzlsh0",prescriptionPay.getMiRegisterNo());//医保挂号号(门诊流水号)
            insurResult.put("djlsh0",prescriptionPay.getMiSettleNo());//医保收费单据号(单据流水号)
            insurResult.put("jkzhzf",prescriptionPay.getHeathPay());//健康账户支付
            insurResult.put("Jkzhye",prescriptionPay.getHealthBalance());//健康账户余额
            insurResult.put("gjzhzf",prescriptionPay.getFamilyPay());//共济账户支付
            insurResult.put("bckbcs","");//医保挂号接口返回结果中的本次看病次数
            insurResult.put("jkzhzf",amoutUtils.fenToYuan(prescriptionPay.getHeathPay()));//健康账户支付
            insurResult.put("Jkzhye",amoutUtils.fenToYuan(prescriptionPay.getHealthBalance()));//健康账户余额
            insurResult.put("gjzhzf",amoutUtils.fenToYuan(prescriptionPay.getFamilyPay()));//共济账户支付
            insurResult.put("bckbcs",1);//医保挂号接口返回结果中的本次看病次数
            insurResult.put("gzztmc","");//医保挂号接口返回结果中的工作状态名称
            insurResult.put("grsfen","");//医保挂号接口返回结果中的个人身份名称
            insurResult.put("bjjbie","");//医保挂号接口返回结果中的保健级别
            insurResult.put("dispOverLimit",0);//门诊超限制标志,1是,0否
            insurResult.put("bcbxf0",prescriptionPay.getMiTotalFee());//本次报销总额
            insurResult.put("grzfe0",prescriptionPay.getSelfPay());//个人自付额
            insurResult.put("fybfy0",prescriptionPay.getUnlessAmount());//非医保费用
            insurResult.put("bcbxf0",amoutUtils.fenToYuan(prescriptionPay.getMiTotalFee()));//本次报销总额
            insurResult.put("grzfe0",amoutUtils.fenToYuan(prescriptionPay.getSelfPay()));//个人自付额
            insurResult.put("fybfy0",amoutUtils.fenToYuan(prescriptionPay.getUnlessAmount()));//非医保费用
            json.put("insurResult",insurResult);
        }