package cn.hnthyy.thmz.enums;

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

/**
 * 用药频次枚举 mz_order_frequency
 */
public enum OrderFrequencyEnum {
    ALWAYS("ALWAYS","持续",1),
    BID("BID"," 2 次/日",2),
    IRREG("IRREG","需要时",1),
    ONCE("ONCE"," 1 次",1),
    Q12H("Q12H","二次/日",2),
    Q1H("Q1H","一次/h",24),
    Q2H("Q2H","一次/2h",12),
    Q30FZ ("Q30FZ","一次/三十分钟",48),
    Q3H("Q3H","一次/3h",8),
    Q4H("Q4H","一次/4h",6),
    //Q4H1("Q4H1","一次/5h",4),
    Q5H("Q5H","一次/5h",4),
    Q6H("Q6H","一次/6h",4),
    Q7H("Q7H","一次/7h",3),
    Q8H("Q8H"," 一次/8h",3),
    QD("QD","  1 次/日",1),
    QID("QID"," 4 次/日",4),
    QN("QN"," 1 次/晚",1),
    QOD("QOD"," 1 次/隔日",1),
    QWD("QWD","一次/周",1),
    TID("TID"," 3 次/日",3),
    W1D("W1D","周一",1),
    W1D2("W1D2","周二",1),
    W1D3("W1D3","周三",1),
    W1D4("W1D4","周四",1),
    W1D5("W1D5","周五",1),
    W1D6("W1D6","周六",1),
    W2D("W2D","周一.四",1),
    W2D1("W2D1","周一.五",1),
    W2D2("W2D2","周一.三",1),
    W2D3("W2D3","周二.五",1),
    W2D4("W2D4","周二.四",1),
    W3D("W3D","周二.四.六",1),
    W3D1("W3D1","周一.三.五",1),
    W3D2("W3D2","周一.二.三",1),
    W3D3("W3D3","周一.二.五",1),
    W3D4("W3D4","周二.五.日",1),
    W5D("W5D","周一~~五",1),
    PBG_BID("餐后BID","2次/日餐后",2),
    BM_BID("餐前BID","2次/日餐前",2),
    AFTER_MEALS("三餐后","三餐后",3),
    BEFORE_MEALS("三餐前","三餐前",3),
    ONCE_A_DAY("一次/单日","一次/单日",1),
    ONCE_TWO_DAY("一次/双日","一次./双日",2);

    public String code;
    public String name;
    public Integer times;

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

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