001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.exceptions.FHIRException;
035
036public enum SubstanceCategory {
037
038  /**
039   * A substance that causes an allergic reaction.
040   */
041  ALLERGEN,
042  /**
043   * A substance that is produced by or extracted from a biological source.
044   */
045  BIOLOGICAL,
046  /**
047   * A substance that comes directly from a human or an animal (e.g. blood, urine,
048   * feces, tears, etc.).
049   */
050  BODY,
051  /**
052   * Any organic or inorganic substance of a particular molecular identity,
053   * including -- (i) any combination of such substances occurring in whole or in
054   * part as a result of a chemical reaction or occurring in nature and (ii) any
055   * element or uncombined radical
056   * (http://www.epa.gov/opptintr/import-export/pubs/importguide.pdf).
057   */
058  CHEMICAL,
059  /**
060   * A food, dietary ingredient, or dietary supplement for human or animal.
061   */
062  FOOD,
063  /**
064   * A substance intended for use in the diagnosis, cure, mitigation, treatment,
065   * or prevention of disease in man or other animals (Federal Food Drug and
066   * Cosmetic Act).
067   */
068  DRUG,
069  /**
070   * A finished product which is not normally ingested, absorbed or injected (e.g.
071   * steel, iron, wood, plastic and paper).
072   */
073  MATERIAL,
074  /**
075   * added to help the parsers
076   */
077  NULL;
078
079  public static SubstanceCategory fromCode(String codeString) throws FHIRException {
080    if (codeString == null || "".equals(codeString))
081      return null;
082    if ("allergen".equals(codeString))
083      return ALLERGEN;
084    if ("biological".equals(codeString))
085      return BIOLOGICAL;
086    if ("body".equals(codeString))
087      return BODY;
088    if ("chemical".equals(codeString))
089      return CHEMICAL;
090    if ("food".equals(codeString))
091      return FOOD;
092    if ("drug".equals(codeString))
093      return DRUG;
094    if ("material".equals(codeString))
095      return MATERIAL;
096    throw new FHIRException("Unknown SubstanceCategory code '" + codeString + "'");
097  }
098
099  public String toCode() {
100    switch (this) {
101    case ALLERGEN:
102      return "allergen";
103    case BIOLOGICAL:
104      return "biological";
105    case BODY:
106      return "body";
107    case CHEMICAL:
108      return "chemical";
109    case FOOD:
110      return "food";
111    case DRUG:
112      return "drug";
113    case MATERIAL:
114      return "material";
115    case NULL:
116      return null;
117    default:
118      return "?";
119    }
120  }
121
122  public String getSystem() {
123    return "http://terminology.hl7.org/CodeSystem/substance-category";
124  }
125
126  public String getDefinition() {
127    switch (this) {
128    case ALLERGEN:
129      return "A substance that causes an allergic reaction.";
130    case BIOLOGICAL:
131      return "A substance that is produced by or extracted from a biological source.";
132    case BODY:
133      return "A substance that comes directly from a human or an animal (e.g. blood, urine, feces, tears, etc.).";
134    case CHEMICAL:
135      return "Any organic or inorganic substance of a particular molecular identity, including -- (i) any combination of such substances occurring in whole or in part as a result of a chemical reaction or occurring in nature and (ii) any element or uncombined radical (http://www.epa.gov/opptintr/import-export/pubs/importguide.pdf).";
136    case FOOD:
137      return "A food, dietary ingredient, or dietary supplement for human or animal.";
138    case DRUG:
139      return "A substance intended for use in the diagnosis, cure, mitigation, treatment, or prevention of disease in man or other animals (Federal Food Drug and Cosmetic Act).";
140    case MATERIAL:
141      return "A finished product which is not normally ingested, absorbed or injected (e.g. steel, iron, wood, plastic and paper).";
142    case NULL:
143      return null;
144    default:
145      return "?";
146    }
147  }
148
149  public String getDisplay() {
150    switch (this) {
151    case ALLERGEN:
152      return "Allergen";
153    case BIOLOGICAL:
154      return "Biological Substance";
155    case BODY:
156      return "Body Substance";
157    case CHEMICAL:
158      return "Chemical";
159    case FOOD:
160      return "Dietary Substance";
161    case DRUG:
162      return "Drug or Medicament";
163    case MATERIAL:
164      return "Material";
165    case NULL:
166      return null;
167    default:
168      return "?";
169    }
170  }
171
172}