package com.ywt.outpatient.taihe.rpc.domain.enums;

/**
 * 订单类型枚举
 *
 * @author johnson lin
 * @date 2019/4/29 9:51 PM
 */
public enum OrderType {
    /**
     * 远程会诊
     */
    TREATMENT("远程会诊", 1),
    TRANSFER("双向转诊", 2),
    ATTENDING("外请会诊", 3),
    REGISTERED("预约挂号", 4),
    CONSULT("咨询", 5),
    FOLLOWUP("随访", 6),
    ADDITIONAL_REGISTRATION("加诊预约", 7),
    OUTPATIENT("门诊缴费订单", 8),
    /**
     * 医生推广费
     */
    MARKETING("健康教育", 9),
    TREATMENT_REPORT("远程会诊报告", 10),
    PRESCRIPTION("处方单", 11),
    MED_FIELD_ARTICLE("医学界文章", 12),
    OFFLINE_CONSULT("线下就诊", 13);

    private final String displayName;

    private final int value;

    OrderType(String displayName, int value) {
        this.displayName = displayName;
        this.value = value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public int getValue() {
        return value;
    }

    public static OrderType valueOf(int value) {
        for (OrderType orderTypeEnum : OrderType.values()) {
            if (orderTypeEnum.getValue() == value) {
                return orderTypeEnum;
            }
        }

        return null;
    }

    /**
     * 获取订单显示名称
     *
     * @param value
     * @return
     */
    public static String getOrderDisplayName(int value) {
        OrderType orderTypeEnum = valueOf(value);

        if (orderTypeEnum != null) {
            return orderTypeEnum.getDisplayName();
        }

        return "";
    }
}