package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 定点医疗服务机构类型
 * @author: DingJie
 * @create: 2021/8/217:17
 */
public enum FixmedinsType {

    DESIGNATED_MEDICAL_INSTITUTIONS("1", "定点医疗机构"),

    DESIGNATED_RETAIL_PHARMACY("2", "定点零售药店"),

    DESIGNATED_INJURY_RECOVERY_INSTITUTIONS("3", "工伤定点康复机构"),

    AUXILIARY_DEVICE_CONFIGURATION_MECHANISM("4", "辅助器具配置机构"),

    FAMILY_PLANNING_SERVICE_INSTITUTIONS("5", "计划生育服务机构");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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