package thyyxxk.webserver.constants.frntsheet;

import thyyxxk.webserver.utils.StringUtil;

public enum DismissWay {
    DOCTOR_ORDER_DISMISS("0", "1"),

    DOCTOR_ORDER_TRANSFER("1", "2"),

    DOCTOR_ORDER_LOWER_PLACE("2", "3"),

    NONE_DOCTOR_ORDER("3", "4"),

    DEAD("4", "5"),

    OTHER("5", "9");


    private final String hisCode;
    private final String wjwCode;

    DismissWay(String hisCode, String wjwCode) {
        this.hisCode = hisCode;
        this.wjwCode = wjwCode;
    }

    public String getHisCode() {
        return hisCode;
    }

    public String getWjwCode() {
        return wjwCode;
    }

    public static String getWjwCodeByHisCode(String hisCode) {
        if (StringUtil.isBlank(hisCode)) {
            return DOCTOR_ORDER_DISMISS.getWjwCode();
        }
        for (DismissWay way : DismissWay.values()) {
            if (way.getHisCode().equals(hisCode)) {
                return way.getWjwCode();
            }
        }
        return DOCTOR_ORDER_DISMISS.getWjwCode();
    }
}
