package thyyxxk.webserver.constants.sidicts;


import thyyxxk.webserver.utils.StringUtil;

public enum ChargeStatus {

    /**
     * 费用状态
     */
    INPUT("1", "录入"),
    ACCOUNT("2", "上账"),
    CLOSE_AN_ACCOUNT("3", "结算"),
    MEDICATION_LIST_NOT_CONFIRMED("5", "未确认药单"),
    NOT_RECEIVED("6", "未接收"),
    REFUSE_TO_CONFIRM("7", "拒绝确认"),
    MEDICAL_TECHNOLOGY_DEPARTMENT("8", "医技科室"),
    MEDICATION_ORDER_NOT_SUBMITTED("9", "未提交药单");

    private final String code;
    private final String name;

    ChargeStatus(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getValue(String code) {
        if (StringUtil.isBlank(code)) {
            return "";
        }
        for (ChargeStatus item : ChargeStatus.values()) {
            if (code.trim().equals(item.getCode())) {
                return item.getName();
            }
        }
        return "";
    }


    public static ChargeStatus getEnum(String code) {
        if (StringUtil.isBlank(code)) {
            return null;
        }
        for (ChargeStatus item : ChargeStatus.values()) {
            if (code.trim().equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }


}
