package com.lantone.enums.med;

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

/**
 * @Description:
 * @Author:zhaops
 * @time: 2020/9/10 15:51
 */
public enum ConceptTypeEnum implements KeyedNamed {

    LisPack(1, "检验套餐"),
    Lis(2, "检验细项"),
    Pacs(3, "检查"),
    Disease(4, "诊断"),
    Drug(5, "药品"),
    Operation(6, "手术和操作"),
    Dept(7, "科室"),
    Transfusion(8, "输血"),
    Symptom(9, "症状"),
    //PacsSubName(9, "检查子项"),
    Scale(10, "量表"),
    Nurse(11, "护理"),
    Tcmdisease(12, "中医疾病"),
    Tcmsyndrome(13, "中医证候"),
    Anesthesia(14, "麻醉"),
    Form(15, "药品剂型"),
    AdministrationRoute(16, "给药途径");

    @Setter
    private int key;

    @Setter
    private String name;

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

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

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

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

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

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

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