package com.diagbot.enums;

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

/**
 * @Description:
 * @Author:zhaops
 * @time: 2019/3/11 13:32
 */
public enum TypeEnum implements KeyedNamed {
    Lis(5, "检查"),

    Pacs(6, "检验");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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