package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 患者证件类别
 * @author: DingJie
 * @create: 2021/7/2411:30
 */
public enum PatnCertType {

    RESIDENT_IDENTITY_CARD("01", "居民身份证"),

    HOUSEHOLD_REGISTER("02", "居民户口簿"),

    PASSPORT("03", "护照"),

    CERTIFICATE_OF_OFFICERS("04", "军官证"),

    DRIVERS_LICENSE("05", "驾驶证"),

    HK_MACAO_SAR_PASSPORT("06", "港澳居民来往内地通行证"),

    TAIWAN_RESIDENT_PASS("07", "台湾居民来往内地通行证"),

    OTHER_IDENTITY_DOCUMENTS("99", "其他身份证件");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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