package cn.hnthyy.thmz.enums;

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

/**
 * 单位枚举
 */
public enum UnitTypeEnum {
    SLICE("01","片"),
    PILL("02","丸"),
    GRANULE("03","粒"),
    GRAM_LETTER("04","g"),
    MILLIGRAM_LETTER("05","mg"),
    MILLILITER_LETTER("06","ml"),
    KILOGRAM_LETTER("07","kg"),
    CAPSULE("08","小盒"),
    BOX("09","盒"),
    BRANCH("10","支"),
    PACKAGES("11","包"),
    INTERNATIONAL_UNIT("12","IU"),
    POCKET("13","大袋"),
    BAG("14","袋"),
    VASE("15","瓶"),
    UNIT("16","单位"),
    ALL_UNITS("18","万单位"),
    MICROGRAMME_LETTER("19","ug"),
    STRETCH("20","张"),
    PIECE("21","块"),
    LITRE("22","L"),
    INDIVIDUAL("24","个"),
    TWIG("25","条"),
    CENTIMETER("26","cm"),
    MILLIMETER("27","mm"),
    PRESS("28","揿"),
    SPRINKLE("29","喷"),
    ACCEPT("30","听"),
    BOARD("31","板"),
    BU("32","BU"),
    PASTE("33","贴"),
    GRAM("34","克"),
    KILOGRAM("35","公斤"),
    thousand_units("36","千单位"),
    LITER("37","公升"),
    MILLIGRAM("38","毫克"),
    MILLILITER("39","大袋"),
    MILLION("40","百万"),
    OTHER("41","其它"),
    MICROGRAMME("42","微克"),
    MICROLITRE("43","微升"),
    TRUNK("44","枚"),
    MCI("45","mci"),
    CURATIVE_DOSE("47","治疗量"),
    DRIP("48","滴"),
    PNA_UNIT("49","PNA单位"),
    ABSORB("50","吸"),
    RIGHT("51","对"),
    BASIN("52","盆"),
    LSU("53","LSU"),
    B_U("54","Bu"),
    AXAIU("55","aXaIU"),
    KE("56","KE"),
    EU("57","EU");

    public String code;
    public String name;

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

    /**
     * 根据编码查询对应的类型
     * @param code
     * @return
     */
    public static UnitTypeEnum getUnitTypeByCode(String code){
        List<UnitTypeEnum> gongnksEnums= Arrays.asList(values());
        for (UnitTypeEnum gongnksEnum:gongnksEnums){
            if(gongnksEnum.code.equals(code)){
                return gongnksEnum;
            }
        }
        return UnitTypeEnum.SLICE;
    }
}
