package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 医保类型
 * @author: DingJie
 * @create: 2021/7/2315:55
 */
public enum MdcsType {

    BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES("310", "职工基本医疗保险"),

    MEDICAL_SECURITY_FOR_THE_RETIRED("340", "离休人员医疗保障"),

    MEDICAID_FOR_DISABLED_SOLDIERS("350", "一至六级残疾军人医疗补助"),

    MEDICAID_FOR_ELDERLY_RED_ARMY("360", "老红军医疗保障"),

    NEW_RURAL_COOPERATIVE_MEDICAL_SYSTEM("380", "新型农村合作医疗"),

    BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS("390", "城乡居民基本医疗保险"),

    BASIC_MEDICAL_INSURANCE_FOR_URBAN_RESIDENTS("391", "城镇居民基本医疗保险"),

    OTHER_MEDICAL_INSURANCE("999", "其他医疗保险");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static MdcsType get(String code) {
        if (StringUtil.isBlank(code)) {
            return null;
        }
        for (MdcsType mdcsType : MdcsType.values()) {
            if (code.trim().equals(mdcsType.getCode())) {
                return mdcsType;
            }
        }
        return null;
    }

    public static String getName(String code) {
        if (StringUtil.isBlank(code)) {
            return null;
        }
        for (MdcsType mdcsType : MdcsType.values()) {
            if (code.trim().equals(mdcsType.getCode())) {
                return mdcsType.getName();
            }
        }
        return null;

    }
}
