package com.diagbot.enums;

import com.diagbot.core.KeyedNamed;
import lombok.Setter;

/**
 * 
 * @author zhoutg
 * @Description: 诊断类型
 * @date 2018年11月21日 下午2:31:42
 */
public enum DisTypeEnum implements KeyedNamed {
    CHRONIC(0, "慢病"),
    EMERGENCY(1, "急诊");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

    public static DisTypeEnum getEnum(Integer key) {
        for (DisTypeEnum item : DisTypeEnum.values()) {
            if (item.key == key) {
                return item;
            }
        }
        return null;
    }

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

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

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

