package cn.hnthyy.thmz.enums;

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

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

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

    /**
     * 根据编码查询对应的类型
     * @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;
    }
}
