/*
 * Copyright ©2023 CJB-CNIT Team. All rights reserved
 */
package com.openhis.common.enums.ybenums;

import com.github.pagehelper.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 医保医疗类别
 *
 * @author SunJQ
 * @date 2025-04-14
 */
@Getter
@AllArgsConstructor
public enum YbMedType {

    // 异地住院
    CROSS_PROVINCIAL_HOSPITALIZATION("25", "异地住院",YbMedMdtrtType.INPATIENT_CARE),
    // 单病种住院
    SINGLE_DISEASE_HOSPITALIZATION("26", "单病种住院",YbMedMdtrtType.INPATIENT_CARE),
    // 自主就医
    SELF_MEDICATION("27", "自主就医",YbMedMdtrtType.OTHER),
    // 意外伤害门诊
    ACCIDENTAL_INJURY_OUTPATIENT("81", "意外伤害门诊",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 特药
    SPECIAL_MEDICATION("15", "特药",YbMedMdtrtType.PHARMACY_PURCHASE),
    // 日间手术
    DAY_SURGERY("28", "日间手术",YbMedMdtrtType.OTHER),
    // 照护保险
    CARE_INSURANCE("61", "照护保险",YbMedMdtrtType.OTHER),
    // 普通门诊
    GENERAL_OUTPATIENT("11", "普通门诊",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 门诊挂号
    OUTPATIENT_REGISTRATION("12", "门诊挂号",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 急诊
    EMERGENCY("13", "急诊",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 门诊慢特病
    CHRONIC_SPECIAL_DISEASE_OUTPATIENT("14", "门诊慢特病",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 门诊特检特治（限吉林市）
    SPECIAL_EXAMINATION_TREATMENT_OUTPATIENT_JILIN("990404", "门诊特检特治（限吉林市）",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 普通住院
    GENERAL_HOSPITALIZATION("21", "普通住院",YbMedMdtrtType.INPATIENT_CARE),
    // 外伤住院
    TRAUMA_HOSPITALIZATION("22", "外伤住院",YbMedMdtrtType.INPATIENT_CARE),
    // 转外诊治住院
    EXTERNAL_TREATMENT_HOSPITALIZATION("23", "转外诊治住院",YbMedMdtrtType.INPATIENT_CARE),
    // 急诊转住院
    EMERGENCY_TO_HOSPITALIZATION("24", "急诊转住院",YbMedMdtrtType.INPATIENT_CARE),
    // 定点药店购药
    DESIGNATED_PHARMACY_PURCHASE("41", "定点药店购药",YbMedMdtrtType.PHARMACY_PURCHASE),
    // 生育门诊
    MATERNITY_OUTPATIENT("51", "生育门诊",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 生育住院
    MATERNITY_HOSPITALIZATION("52", "生育住院",YbMedMdtrtType.INPATIENT_CARE),
    // 生育新生儿费用
    NEWBORN_MATERNITY_EXPENSES("5212", "生育新生儿费用",YbMedMdtrtType.OTHER),
    // 中医特色门诊
    TRADITIONAL_CHINESE_MEDICINE_OUTPATIENT("16", "中医特色门诊",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 起付线治疗
    DEDUCTIBLE_TREATMENT("29", "起付线治疗",YbMedMdtrtType.OTHER),
    // 体检
    PHYSICAL_EXAMINATION("9107", "体检",YbMedMdtrtType.OTHER),
    // 低自付住院
    LOW_COPAY_HOSPITALIZATION("3101", "低自付住院",YbMedMdtrtType.INPATIENT_CARE),
    // 低自付门诊
    LOW_COPAY_OUTPATIENT("3102", "低自付门诊",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 门诊慢病
    CHRONIC_DISEASE_OUTPATIENT("140104", "门诊慢病",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 门诊特病
    SPECIAL_DISEASE_OUTPATIENT("140201", "门诊特病",YbMedMdtrtType.OUTPATIENT_CLINIC),
    // 舒缓疗护住院
    PALLIATIVE_CARE_HOSPITALIZATION("2114", "舒缓疗护住院",YbMedMdtrtType.INPATIENT_CARE);

    private String value;
    private String description;
    private YbMedMdtrtType ybMedMdtrtType;

    public static YbMedType getByValue(String value) {
        if (StringUtil.isEmpty(value)) {
            return null;
        }
        for (YbMedType val : values()) {
            if (val.getValue().equals(value)) {
                return val;
            }
        }
        return null;
    }
}
