package com.lantone.security.enums;

import com.lantone.common.constant.KeyedNamed;
import lombok.Setter;

/**
 * @ClassName: CRUDEnum
 * @Description: 组织类型注解
 * @Author songxl
 * @Date 2021/7/21
 * @Version 1.0
 */
public enum HospitalTypeEnum implements KeyedNamed {
    AI_PLATFORM(0, "AI病案质控平台"),
    GROUP_HOSPITAL(1, "集团医院"),
    COMMON_HOSPITAL(2, "医共体"),
    UNION_HOSPITAL(3, "医联体"),
    SINGLE_HOSPITAL(4, "单家医院"),
    DEPT(5, "科室"),
    REGION(6, "病区");

    @Setter
    private int key;

    @Setter
    private String name;

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

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

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

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

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