package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 离院方式
 * @author: DingJie
 * @create: 2021/7/915:57
 */
public enum DscgWay {

    ORDER_TO_LEAVE_HOSPITAL("1", "医嘱离院"),

    ORDER_TO_TRANSFER_HOSPITAL("2", "医嘱转院"),

    ORDER_TO_TRANSFER_COMMUNITY("3", "医嘱转社区卫生服务机构/乡镇卫生院"),

    LEAVE_HOSPITAL_WITHOUT_ORDER("4", "非医嘱离院"),

    DEAD("5", "死亡"),

    OTHERS("9", "其他");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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