package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 数据保存url注解
 * @author: songxl
 * @time: 2022/3/4 16:03
 */
public enum DataSaveUrlEnum {
    BEHOSPITAL_INFO("save/saveBehospitalCode", "病历数据"),
    HOME_PAGE("save/saveHomePages", "病案首页"),
    MEDICAL_RECORD("save/saveRecs", "文书记录");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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