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"),

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

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

    MEN_ZHEN_MAN("140104", "门诊慢性病", "clinic", "ac"),

    MEN_ZHEN_TE("1402", "门诊特性病", "clinic", "ad"),

    GENERAL_HOSPITALIZATION("21", "普通住院", "hospitalization", "ae"),

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

    ZHUAN_WAI_ZHU("2301", "转外住院", "hospitalization", "ag"),

    YI_DI("2302", "异地就医", "clinic", "ah"),

    YUAN_QIAN_JI("24", "院前急诊", "hospitalization", "ai"),

    DING_DIAN_YAO("4101", "定点药店购药", "clinic", "aj"),

    DING_DIAN_TE_YAO("4102", "定点特殊药品", "clinic", "ak"),

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

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

    JI_HUA_SHENG_YU_2("5301", "计划生育门诊", "clinic", "an"),

    JI_HUA_SHENG_YU_ZHU("530202", "计划生育住院", "hospitalization", "ao"),

    JIA_TING_BING_CHUANG("9902", "家庭病床", "hospitalization", "ap"),

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

    MEN_ZHEN_TE_YIN("9904", "门诊特检特治(阴性)", "clinic", "ar"),

    MEN_ZHEN_TE_YANG("9907", "门诊特检特制(阳性)", "clinic", "as"),

    JIA_YI_FU_WU("9908", "家庭医师服务包", "clinic", "at"),

    FU_ZHU_SHENG_ZHI("108", "辅助生殖门诊", "clinic", "au"),

    ZHUYUAN_ZHITI_CAN("gs21", "住院肢体残", "hospitalization", "gc"),  // 医疗类别21：住院肢体残

    ZHUYUAN_ZHIYE_BING("gs22", "住院职业病", "hospitalization", "gb"),  // 医疗类别22：住院职业病

    ZHUYUAN_KANGFU("gs23", "住院康复", "hospitalization", "gf");  // 医疗类别23：住院康复


    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();
    }
}
