package cn.hnthyy.thmz.enums;

import java.util.Arrays;
import java.util.List;

/**
 * 科室分类
 */
public enum ClassCodeEnum {
    HOSPITAL_WIDE(0,"全院"),
    CLINIC(1,"临床"),
    MEDICAL_LABORATORY(2,"医技"),
    ADMINISTRATIVE(3,"行政"),
    LOGISTICS(5,"后勤"),
    COLLEGE(6,"院级"),
    OTHER(7,"其他"),
    NURSE(8,"护理");

    public Integer code;
    public String name;

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

    /**
     * 根据编码查询对应的类型
     * @param code
     * @return
     */
    public static ClassCodeEnum getClassCodeByCode(Integer code){
        List<ClassCodeEnum> classCodeEnums= Arrays.asList(values());
        for (ClassCodeEnum classCode:classCodeEnums){
            if(classCode.code.equals(code)){
                return classCode;
            }
        }
        return null;
    }
}
