package cn.hnthyy.thmz.enums;

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

/**
 * 草药服用说明
 */
public enum CyFysmEnum {
    WARM_CLOTHING_BEFORE_MEALS("1","饭前温服"),
    WARM_CLOTHING_AFTER_MEALS("2","饭后温服"),
    COOL_SUIT_BEFORE_MEALS("3","饭前凉服"),
    COOL_SUIT_AFTER_MEALS("4","饭后凉服"),
    TAKEN_AT_DRAUGHT("5","顿服"),
    MEDICINE("6","冲服"),
    EXTERNAL_USE("7","外用");

    public String code;
    public String name;

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

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