package thyyxxk.webserver.entity.orderZdMaintain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum SupplyClass {

    口服(1, "口服", "all"),
    输液(2, "输液", "all"),
    出院带药(3, "出院带药", "all"),
    领药临时(4, "领药（临时）", "all"),
    退药(5, "退药", "all"),
    外用(6, "外用", "zy"),
    领药非临时(6, "领药(非临时)", "mz"),
    注射(7, "注射", "all"),
    药物治疗(8, "药物治疗", "all"),
    其他(9, "其他", "all");

    private Integer code;
    private String name;
    private String desc;

    public static String getNameByCode(Integer code, String oppositeDesc) {
        for (SupplyClass spc : SupplyClass.values()) {
            if (spc.getCode().equals(code) && !spc.getDesc().equals(oppositeDesc)) {
                return spc.getName();
            }
        }
        return "";
    }

}
