package thyyxxk.webserver.constants.frntsheet;

public enum Provinces {
    BEIJING("11", "1"),
    TIANJIN("12", "2"),
    HEBEI("13", "3"),
    SHANXI("14", "4"),
    INNER_MONGOLIA("15", "5"),
    LIAONING("21", "6"),
    JILIN("22", "7"),
    HEILONGJIANG("23", "8"),
    SHANGHAI("31", "9"),
    JIANGSU("32", "10"),
    ZHEJIANG("33", "11"),
    ANHUI("34", "12"),
    FUJIAN("35", "13"),
    JIANGXI("36", "14"),
    SHANDONG("37", "15"),
    HENAN("41", "16"),
    HUBEI("42", "17"),
    HUNAN("43", "18"),
    GUANGDONG("44", "19"),
    GUANGXI("45", "20"),
    HAINAN("46", "21"),
    SICHUAN("51", "22"),
    CHONGQING("50", "23"),
    GUIZHOU("52", "24"),
    YUNNAN("53", "25"),
    XIZANG("54", "26"),
    SHANXI2("61", "27"),
    GANSU("62", "28"),
    QINGHAI("63", "29"),
    NINGXIA("64", "30"),
    XINJIANG("65", "31"),
    TAIWAN("71", "32"),
    HONG_KONG("81", "33"),
    MACAO("82", "34"),
    FOREIGN("99", "35");

    private final String code;
    private final String wjwCode;

    Provinces(String code, String wjwCode) {
        this.code = code;
        this.wjwCode = wjwCode;
    }

    public String getCode() {
        return code;
    }

    public String getWjwCode() {
        return wjwCode;
    }

    public static String getWjwCodeByHisCode(String hisCode) {
        if (null == hisCode) {
            return null;
        }
        for (Provinces item : Provinces.values()) {
            if (item.getCode().equals(hisCode)) {
                return item.getWjwCode();
            }
        }
        return null;
    }
}
