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 MedicationAdminStatus {
037
038  /**
039   * The administration has started but has not yet completed.
040   */
041  INPROGRESS,
042  /**
043   * The administration was terminated prior to any impact on the subject (though
044   * preparatory actions may have been taken)
045   */
046  NOTDONE,
047  /**
048   * Actions implied by the administration have been temporarily halted, but are
049   * expected to continue later. May also be called 'suspended'.
050   */
051  ONHOLD,
052  /**
053   * All actions that are implied by the administration have occurred.
054   */
055  COMPLETED,
056  /**
057   * The administration was entered in error and therefore nullified.
058   */
059  ENTEREDINERROR,
060  /**
061   * Actions implied by the administration have been permanently halted, before
062   * all of them occurred.
063   */
064  STOPPED,
065  /**
066   * The authoring system does not know which of the status values currently
067   * applies for this request. Note: This concept is not to be used for 'other' -
068   * one of the listed statuses is presumed to apply, it's just not known which
069   * one.
070   */
071  UNKNOWN,
072  /**
073   * added to help the parsers
074   */
075  NULL;
076
077  public static MedicationAdminStatus fromCode(String codeString) throws FHIRException {
078    if (codeString == null || "".equals(codeString))
079      return null;
080    if ("in-progress".equals(codeString))
081      return INPROGRESS;
082    if ("not-done".equals(codeString))
083      return NOTDONE;
084    if ("on-hold".equals(codeString))
085      return ONHOLD;
086    if ("completed".equals(codeString))
087      return COMPLETED;
088    if ("entered-in-error".equals(codeString))
089      return ENTEREDINERROR;
090    if ("stopped".equals(codeString))
091      return STOPPED;
092    if ("unknown".equals(codeString))
093      return UNKNOWN;
094    throw new FHIRException("Unknown MedicationAdminStatus code '" + codeString + "'");
095  }
096
097  public String toCode() {
098    switch (this) {
099    case INPROGRESS:
100      return "in-progress";
101    case NOTDONE:
102      return "not-done";
103    case ONHOLD:
104      return "on-hold";
105    case COMPLETED:
106      return "completed";
107    case ENTEREDINERROR:
108      return "entered-in-error";
109    case STOPPED:
110      return "stopped";
111    case UNKNOWN:
112      return "unknown";
113    case NULL:
114      return null;
115    default:
116      return "?";
117    }
118  }
119
120  public String getSystem() {
121    return "http://terminology.hl7.org/CodeSystem/medication-admin-status";
122  }
123
124  public String getDefinition() {
125    switch (this) {
126    case INPROGRESS:
127      return "The administration has started but has not yet completed.";
128    case NOTDONE:
129      return "The administration was terminated prior to any impact on the subject (though preparatory actions may have been taken)";
130    case ONHOLD:
131      return "Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called 'suspended'.";
132    case COMPLETED:
133      return "All actions that are implied by the administration have occurred.";
134    case ENTEREDINERROR:
135      return "The administration was entered in error and therefore nullified.";
136    case STOPPED:
137      return "Actions implied by the administration have been permanently halted, before all of them occurred.";
138    case UNKNOWN:
139      return "The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, it's just not known which one.";
140    case NULL:
141      return null;
142    default:
143      return "?";
144    }
145  }
146
147  public String getDisplay() {
148    switch (this) {
149    case INPROGRESS:
150      return "In Progress";
151    case NOTDONE:
152      return "Not Done";
153    case ONHOLD:
154      return "On Hold";
155    case COMPLETED:
156      return "Completed";
157    case ENTEREDINERROR:
158      return "Entered in Error";
159    case STOPPED:
160      return "Stopped";
161    case UNKNOWN:
162      return "Unknown";
163    case NULL:
164      return null;
165    default:
166      return "?";
167    }
168  }
169
170}