package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 治疗方式枚举
 * @author: hsh
 * @date: 2022/9/27 10:33
 * @param: code
 * @return: TreatmentMethods
 **/
public enum TreatmentMethods {

    NonOperative("0", "非手术"),

    TraditionalSurgery("1", "传统手术"),

    InterventionalSurgery("2", "介入手术"),

    MinuteSurgery("3", "微创手术"),

    TumorRadioTherapy("4", "恶性肿瘤放射治疗"),

    TumorChemotherapy("5", "恶性肿瘤化学治疗"),

    TumorRAC("6", "恶性肿瘤放疗加化疗"),

    TumorPalliativeTreatment("7", "恶性肿瘤姑息治疗"),

    ELSE("8", "其它");

    private final String code;

    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static TreatmentMethods get(String code) {
        if (StringUtil.isBlank(code)) {
            return ELSE;
        }
        for (TreatmentMethods treatment : TreatmentMethods.values()) {
            if (code.trim().equals(treatment.getCode())) {
                return treatment;
            }
        }
        return ELSE;
    }
}
