package com.diagbot.enums;

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

/**
 * @Description:
 * @author: zhaops
 * @time: 2018/9/18 14:25
 */
public enum OrganizationTypeEnum implements KeyedNamed {
    ChainMedical(0, "连锁医疗机构"),
    HealthStatisticsBureau(1, "卫计局"),
    PrimaryMedicalUnit(2, "基础医疗单位"),
    MedicalClinic(3, "医疗诊所"),
    Other(99, "其他");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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