package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 清算类别
 * @author: DingJie
 * @create: 2021/7/1010:54
 */
public enum ClrType {

    OUTPATIENT("11", "门诊"),

    REMOTE_OUTPATIENT("9901", "异地门诊"),

    OUTPATIENT_SLOW_SPECIAL_DSS("14", "门诊慢特病"),

    BIRTH_OUTPATIENT("53", "生育门诊"),

    INPATIENT("21", "住院"),

    REMOTE_INPATIENT("9902", "异地住院"),

    MATERNITY_INPATIENT("99940", "生育住院"),

    ACCIDENT_INJURY_INPATIENT("22", "意外伤害住院"),

    SINGLE_DSS_INPATIENT("27", "单病种住院"),

    EMPLOYEE_DRG("100008", "职工DRG"),

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

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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

    public static boolean mzClrType(String code) {
        ClrType clrType = get(code);
        if (clrType == null) {
            return false;
        }
        return clrType == OUTPATIENT ||
                clrType == REMOTE_OUTPATIENT ||
                clrType == OUTPATIENT_SLOW_SPECIAL_DSS ||
                clrType == BIRTH_OUTPATIENT;
    }
}
