package cn.hnthyy.thmz.enums;

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

/**
 *  初诊复诊
 */
public enum FirstOrNotEnum {
    FIRST("F","是"),
    NOT("N","否");

    public String code;
    public String name;

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

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