package cn.hnthyy.thmz.enums;

import java.util.Arrays;
import java.util.List;

/**
 * 医技预约状态
 */
public enum ScheduleOfMedicalEnum {
    FREE(0,"空闲"),
    HOLDING (1,"占用"),
    ALREADY (2,"已预约");

    public Integer code;
    public String name;

    ScheduleOfMedicalEnum(Integer code, String name){
        this.code=code;
        this.name=name;
    }

    /**
     * 根据编码查询对应的类型
     * @param code
     * @return
     */
    public static ScheduleOfMedicalEnum getYesNoByCode(Integer code){
        List<ScheduleOfMedicalEnum> yesNoEnums= Arrays.asList(values());
        for (ScheduleOfMedicalEnum yesNoEnum:yesNoEnums){
            if(yesNoEnum.code.equals(code)){
                return yesNoEnum;
            }
        }
        return null;
    }
}
