package thyyxxk.webserver.constants;

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

/**
 * 床位状态:1入院；2：安排；3:待出院;4:转科;5:出院9：召回
 */
public enum BedStatusEnum {
    PRE_ADMISS("0", "待入院"),
    ADMISSION("1","入院"),
    ARRANGE("2","安排"),
    STAY_OUT_OF_THE_HOSPITAL("3","待出院"),
    TRANSFER("4","转科"),
    LEAVE_HOSPITAL("5","出院"),
    RECALL("9","召回");

    public String code;
    public String name;

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

    /**
     * 根据编码查询对应的类型
     * @param code
     * @return
     */
    public static BedStatusEnum geteBedStatusByCode(String code){
        List<BedStatusEnum> classCodeEnums= Arrays.asList(values());
        for (BedStatusEnum classCode:classCodeEnums){
            if(classCode.code.equals(code)){
                return classCode;
            }
        }
        return null;
    }
}
