package com.ruoyi.info.patient.exception;

import com.ruoyi.common.enums.IIntegerEnum;
import java.util.Objects;


/**
 * 异常枚举
 */
public enum PatientExceptionEnum implements IIntegerEnum {

    // TODO 注意检查错误码，保证系统内唯一
    Patient_IS_NOT_EXISTS(120001, "就诊人不存在"),
    OPTION_USER_PATIENT_IS_EXISTS(120002, "只能操作自己的就诊人信息"),
    ;

    private Integer code;

    private String msg;

    PatientExceptionEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static PatientExceptionEnum getByCode(int code, PatientExceptionEnum[] values) {
        for (PatientExceptionEnum value : values) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }

}
