package com.diagbot.enums;

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

/**
 * @Description:标签类型
 * @Author:zhaops
 * @time: 2018/11/21 11:39
 */
public enum QuestionTypeEnum implements KeyedNamed {
    Symptom(1, "症状"),
    Other(3, "其他史"),
    Vital(4, "查体"),
    Lis(5, "化验"),
    Pacs(6, "辅检"),
    Disease(7, "诊断"),
    Drug(8, "药品"),
    DrugClass(9, "药品分类");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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