package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 诊断类别
 * @author: DingJie
 * @create: 2021/7/2917:32
 */
public enum DiagType {
    WESTERN_MEDICINE_DIAGNOSIS("1", "西医诊断"),

    TCM_DIAGNOSIS_OF_MAIN_DISEASES("2", "中医主病诊断"),

    TCM_MAIN_SYNDROME_DIAGNOSIS("3", "中医主证诊断");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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