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 AllergyIntoleranceCategory {
037
038  /**
039   * Any substance consumed to provide nutritional support for the body.
040   */
041  FOOD,
042  /**
043   * Substances administered to achieve a physiological effect.
044   */
045  MEDICATION,
046  /**
047   * Any substances that are encountered in the environment, including any
048   * substance not already classified as food, medication, or biologic.
049   */
050  ENVIRONMENT,
051  /**
052   * A preparation that is synthesized from living organisms or their products,
053   * especially a human or animal protein, such as a hormone or antitoxin, that is
054   * used as a diagnostic, preventive, or therapeutic agent. Examples of biologic
055   * medications include: vaccines; allergenic extracts, which are used for both
056   * diagnosis and treatment (for example, allergy shots); gene therapies;
057   * cellular therapies. There are other biologic products, such as tissues, which
058   * are not typically associated with allergies.
059   */
060  BIOLOGIC,
061  /**
062   * added to help the parsers
063   */
064  NULL;
065
066  public static AllergyIntoleranceCategory fromCode(String codeString) throws FHIRException {
067    if (codeString == null || "".equals(codeString))
068      return null;
069    if ("food".equals(codeString))
070      return FOOD;
071    if ("medication".equals(codeString))
072      return MEDICATION;
073    if ("environment".equals(codeString))
074      return ENVIRONMENT;
075    if ("biologic".equals(codeString))
076      return BIOLOGIC;
077    throw new FHIRException("Unknown AllergyIntoleranceCategory code '" + codeString + "'");
078  }
079
080  public String toCode() {
081    switch (this) {
082    case FOOD:
083      return "food";
084    case MEDICATION:
085      return "medication";
086    case ENVIRONMENT:
087      return "environment";
088    case BIOLOGIC:
089      return "biologic";
090    case NULL:
091      return null;
092    default:
093      return "?";
094    }
095  }
096
097  public String getSystem() {
098    return "http://hl7.org/fhir/allergy-intolerance-category";
099  }
100
101  public String getDefinition() {
102    switch (this) {
103    case FOOD:
104      return "Any substance consumed to provide nutritional support for the body.";
105    case MEDICATION:
106      return "Substances administered to achieve a physiological effect.";
107    case ENVIRONMENT:
108      return "Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.";
109    case BIOLOGIC:
110      return "A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies.  There are other biologic products, such as tissues, which are not typically associated with allergies.";
111    case NULL:
112      return null;
113    default:
114      return "?";
115    }
116  }
117
118  public String getDisplay() {
119    switch (this) {
120    case FOOD:
121      return "Food";
122    case MEDICATION:
123      return "Medication";
124    case ENVIRONMENT:
125      return "Environment";
126    case BIOLOGIC:
127      return "Biologic";
128    case NULL:
129      return null;
130    default:
131      return "?";
132    }
133  }
134
135}