package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 生育类别
 * @author: DingJie
 * @create: 2021/7/915:35
 */
public enum MatnType {

    NORMAL("1", "正常产"),

    ASSISTED("2", "助娩产"),

    CESAREAN("3", "剖宫产"),

    DYSTOCIA("4", "难产"),

    ABORTION("5", "流产"),

    INDUCED("6", "引产"),

    PRENATAL_EXAMINATION("7", "产前检查"),

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

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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