package com.diagbot.enums.data;

import lombok.Setter;

public enum BehospitalWayEnum implements AKeyedNamed{
    EMERGENCY("1", "急诊"),
    OUTPATIENT("2", "门诊"),
    OTHER_MEDICAL("3", "其他医疗机构转入"),
    OTHER("9", "其他");

    @Setter
    private String key;

    @Setter
    private String name;

    BehospitalWayEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static BehospitalWayEnum getEnum(String key) {
        for (BehospitalWayEnum item : BehospitalWayEnum.values()) {
            if (key.equals(item.getKey())) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String key) {
        BehospitalWayEnum item = getEnum(key);
        return item != null ? item.name : null;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getName() {
        return name;
    }
}
