package com.ywt.outpatient.domain.models.enums;

/**
 * 挂号日期时段
 *
 * @author johnson lin
 * @date 2019/5/13 11:24 AM
 */
public enum RegisteredDatePeriod {
    /**
     * 全天
     */
    ALL_DAY("全天", 1),
    MORNING("上午", 2),
    AFTERNOON("下午", 3),
    NIGHT("夜间", 4),
    LATE_NIGHT("下半夜", 5),
    MIDNOON("午间", 6),
    ;

    private final String displayName;

    private final int value;

    RegisteredDatePeriod(String displayName, int value) {
        this.displayName = displayName;
        this.value = value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public int getValue() {
        return value;
    }

    public static RegisteredDatePeriod valueOf(int value) {
        for (RegisteredDatePeriod period : RegisteredDatePeriod.values()) {
            if (period.getValue() == value) {
                return period;
            }
        }
        return null;
    }

    public static String getDisplayName(int value) {
        for (RegisteredDatePeriod period : RegisteredDatePeriod.values()) {
            if (period.getValue() == value) {
                return period.displayName;
            }
        }
        return "";
    }
}
