package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 术语类型
 * @author: zhanghang
 * @time: 2022/3/11 16:03
 */
public enum ConceptLibraryTypeEnum {
    DISEASE("1", "诊断"),
    OPERATION("2", "手术"),
    DRUG("3", "药品");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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