package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 目录类别
 * @author: DingJie
 * @create: 2021/8/99:24
 */
public enum ListType {

    WEST_PATENT("101", "西药中成药"),

    HERBAL("102", "中药饮片"),

    SELF_MADE("103", "自制剂"),

    ETHNIC("104", "民族药"),

    SERVICE("201", "医疗服务项目"),

    SUPPLY("301", "医用耗材");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ListType get(String code) {
        if (StringUtil.isBlank(code)) {
            return null;
        }
        for (ListType listType : ListType.values()) {
            if (code.trim().equals(listType.getCode())) {
                return listType;
            }
        }
        return null;
    }
}
