package thyyxxk.webserver.entity.medicalinsurance.setllistupldTemp;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import thyyxxk.webserver.constants.sidicts.MedChrgitmType;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 收费项目信息
 */
@Data
public class IteminfoUpldTemp {
    /**
     * 医疗收费项目
     */
    @JSONField(name = "med_chrgitm")
    private String medChrgitm;

    /**
     * 金额
     */
    @JSONField(name = "amt")
    private String amt;

    /**
     * 甲类费用合计
     */
    @JSONField(name = "claa_sumfee")
    private String claaSumfee;

    /**
     * 乙类金额
     */
    @JSONField(name = "clab_amt")
    private String clabAmt;

    /**
     * 全自费金额
     */
    @JSONField(name = "fulamt_ownpay_amt")
    private String fulamtOwnpayAmt;

    /**
     * 其他金额
     */
    @JSONField(name = "oth_amt")
    private String othAmt;

    public String getMedChrgitmName() {
        if (medChrgitm != null) {
            if (medChrgitm.equals("99")) {
                return "合计";
            }
            return MedChrgitmType.getMedName(medChrgitm);
        }
        return "";
    }

    public String getAmt() {
        if (null == amt) {
            return "0.00";
        }
        BigDecimal decimal = new BigDecimal(amt);
        return decimal.setScale(2, RoundingMode.HALF_UP).toString();
    }

    public String getClaaSumfee() {
        if (null == claaSumfee) {
            return "0.00";
        }
        BigDecimal decimal = new BigDecimal(claaSumfee);
        return decimal.setScale(2, RoundingMode.HALF_UP).toString();
    }

    public String getClabAmt() {
        if (null == clabAmt) {
            return "0.00";
        }
        BigDecimal decimal = new BigDecimal(clabAmt);
        return decimal.setScale(2, RoundingMode.HALF_UP).toString();
    }

    public String getFulamtOwnpayAmt() {
        if (null == fulamtOwnpayAmt) {
            return "0.00";
        }
        BigDecimal decimal = new BigDecimal(fulamtOwnpayAmt);
        return decimal.setScale(2, RoundingMode.HALF_UP).toString();
    }
}
