package thyyxxk.webserver.constants.sidicts;

import lombok.Getter;
import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 医疗类别
 * @author: DingJie
 * @create: 2021/7/1010:59
 */
@Getter
public enum MedType {

    SELF_PAY("01", "自费", "hospitalization", "01"),

    GCP_EXPERIMENT("011", "GCP实验", "hospitalization", "a0"),

    GENERAL_CLINIC("11", "普通门诊", "clinic", "aa"),

    EMERGENCY_TREATMENT("13", "急诊", "clinic", "ab"),

    EMERGENCY_RESCUE("1301", "急诊抢救", "clinic", "bb"),

    OUTPATIENT_CHRONIC_IDIOPATHIC_DISEASES("14", "门诊慢特病", "clinic", "ac"),

    GENERAL_HOSPITALIZATION("2101", "普通住院", "hospitalization", "ad"),

    SINGLE_DISEASE_HOSPITALIZATION("2102", "单病种住院", "hospitalization", "ae"),

    RESIDENTS_NORMAL_BIRTH("2106", "生育平产(居民)", "hospitalization", "af"),

    RESIDENTS_BIRTH_CESAREAN_SECTION("2107", "生育剖宫产(居民)", "hospitalization", "ag"),

    TRAUMA_HOSPITALIZATION("22", "外伤住院", "hospitalization", "ah"),

    DESIGNATED_DRUGSTORES_PURCHASE("41", "定点药店购药", "drug", "ai"),

    MATERNITY_CLINIC("51", "生育门诊", "clinic", "aj"),

    MATERNITY_HOSPITALIZATION("52", "生育住院", "hospitalization", "ak"),

    INJURY_HOSPITALIZATION("42", "工伤住院", "hospitalization", "al"),

    OCCUPATIONAL_INJURY_CLINIC("41", "工伤门诊", "clinic", "bl"),

    INJURY_TBD("4X", "工伤待定", "hospitalization", "cl"),

    INJURY_RECOVER_CLINIC("46", "康复门诊", "clinic", "dl"),

    OUTPATIENT_TWO_DISEASES("9901", "门诊两病", "clinic", "am"),

    ACCIDENTAL_INJURY_CLINIC("9903", "意外伤害门诊", "clinic", "an"),

    SPECIAL_MEDICINE_FOR_SERIOUS_ILLNESS("9904", "大病特药", "clinic", "ao");

    private final String code;
    private final String name;
    private final String flag;
    private final String responceType;

    MedType(String code, String name, String flag, String responceType) {
        this.code = code;
        this.name = name;
        this.flag = flag;
        this.responceType = responceType;
    }

    public static MedType get(String code) {
        if (StringUtil.isBlank(code)) {
            return SELF_PAY;
        }
        for (MedType medType : MedType.values()) {
            if (code.trim().equals(medType.getCode())) {
                return medType;
            }
        }
        return SELF_PAY;
    }

    public static String getName(String code) {
        if (StringUtil.isBlank(code)) {
            return SELF_PAY.getName();
        }
        for (MedType medType : MedType.values()) {
            if (code.trim().equals(medType.getCode())) {
                return medType.getName();
            }
        }
        return SELF_PAY.getName();
    }
}
