package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 丢失类型注解
 * @author: songxl
 * @time: 2022/3/4 16:03
 */
public enum LossTypeEnum {
    REC_LOSS("0", "文书丢失"),
    HOMEPAGE_LOSS("1", "病案首页丢失"),
    CODE_LOSS("2", "患者信息丢失");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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