parent
159af0dfdb
commit
807b381437
@ -0,0 +1,43 @@ |
|||||||
|
package digital.laboratory.platform.entrustment.enums; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Getter |
||||||
|
public enum EntrustBiologyType { |
||||||
|
|
||||||
|
HAIR(0, "毛发", CollUtil.newArrayList("黑色头发", "毛发")), |
||||||
|
URINE(1, "尿液", CollUtil.newArrayList("黄色尿液")), |
||||||
|
OTHER(2, "其他", CollUtil.newArrayList()), |
||||||
|
; |
||||||
|
|
||||||
|
private final Integer code; |
||||||
|
|
||||||
|
private final String desc; |
||||||
|
|
||||||
|
private final List<String> alias; |
||||||
|
|
||||||
|
EntrustBiologyType(Integer code, String desc, List<String> alias) { |
||||||
|
this.code = code; |
||||||
|
this.desc = desc; |
||||||
|
this.alias = alias; |
||||||
|
} |
||||||
|
|
||||||
|
// 根据名称或别名判断是否存在对应枚举
|
||||||
|
public static EntrustBiologyType isExist(String desc) { |
||||||
|
for (EntrustBiologyType entrustStatisticType : values()) { |
||||||
|
// 先匹配描述字段
|
||||||
|
if (entrustStatisticType.getDesc().equals(desc)) { |
||||||
|
return entrustStatisticType; |
||||||
|
} |
||||||
|
// 然后匹配别名
|
||||||
|
if (entrustStatisticType.getAlias().contains(desc)) { |
||||||
|
return entrustStatisticType; |
||||||
|
} |
||||||
|
} |
||||||
|
return OTHER; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue