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 MedicationdispenseStatus {
037
038  /**
039   * The core event has not started yet, but some staging activities have begun
040   * (e.g. initial compounding or packaging of medication). Preparation stages may
041   * be tracked for billing purposes.
042   */
043  PREPARATION,
044  /**
045   * The dispensed product is ready for pickup.
046   */
047  INPROGRESS,
048  /**
049   * The dispensed product was not and will never be picked up by the patient.
050   */
051  CANCELLED,
052  /**
053   * The dispense process is paused while waiting for an external event to
054   * reactivate the dispense. For example, new stock has arrived or the prescriber
055   * has called.
056   */
057  ONHOLD,
058  /**
059   * The dispensed product has been picked up.
060   */
061  COMPLETED,
062  /**
063   * The dispense was entered in error and therefore nullified.
064   */
065  ENTEREDINERROR,
066  /**
067   * Actions implied by the dispense have been permanently halted, before all of
068   * them occurred.
069   */
070  STOPPED,
071  /**
072   * The dispense was declined and not performed.
073   */
074  DECLINED,
075  /**
076   * The authoring system does not know which of the status values applies for
077   * this medication dispense. Note: this concept is not to be used for other -
078   * one of the listed statuses is presumed to apply, it's just now known which
079   * one.
080   */
081  UNKNOWN,
082  /**
083   * added to help the parsers
084   */
085  NULL;
086
087  public static MedicationdispenseStatus fromCode(String codeString) throws FHIRException {
088    if (codeString == null || "".equals(codeString))
089      return null;
090    if ("preparation".equals(codeString))
091      return PREPARATION;
092    if ("in-progress".equals(codeString))
093      return INPROGRESS;
094    if ("cancelled".equals(codeString))
095      return CANCELLED;
096    if ("on-hold".equals(codeString))
097      return ONHOLD;
098    if ("completed".equals(codeString))
099      return COMPLETED;
100    if ("entered-in-error".equals(codeString))
101      return ENTEREDINERROR;
102    if ("stopped".equals(codeString))
103      return STOPPED;
104    if ("declined".equals(codeString))
105      return DECLINED;
106    if ("unknown".equals(codeString))
107      return UNKNOWN;
108    throw new FHIRException("Unknown MedicationdispenseStatus code '" + codeString + "'");
109  }
110
111  public String toCode() {
112    switch (this) {
113    case PREPARATION:
114      return "preparation";
115    case INPROGRESS:
116      return "in-progress";
117    case CANCELLED:
118      return "cancelled";
119    case ONHOLD:
120      return "on-hold";
121    case COMPLETED:
122      return "completed";
123    case ENTEREDINERROR:
124      return "entered-in-error";
125    case STOPPED:
126      return "stopped";
127    case DECLINED:
128      return "declined";
129    case UNKNOWN:
130      return "unknown";
131    case NULL:
132      return null;
133    default:
134      return "?";
135    }
136  }
137
138  public String getSystem() {
139    return "http://terminology.hl7.org/CodeSystem/medicationdispense-status";
140  }
141
142  public String getDefinition() {
143    switch (this) {
144    case PREPARATION:
145      return "The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes.";
146    case INPROGRESS:
147      return "The dispensed product is ready for pickup.";
148    case CANCELLED:
149      return "The dispensed product was not and will never be picked up by the patient.";
150    case ONHOLD:
151      return "The dispense process is paused while waiting for an external event to reactivate the dispense.  For example, new stock has arrived or the prescriber has called.";
152    case COMPLETED:
153      return "The dispensed product has been picked up.";
154    case ENTEREDINERROR:
155      return "The dispense was entered in error and therefore nullified.";
156    case STOPPED:
157      return "Actions implied by the dispense have been permanently halted, before all of them occurred.";
158    case DECLINED:
159      return "The dispense was declined and not performed.";
160    case UNKNOWN:
161      return "The authoring system does not know which of the status values applies for this medication dispense.  Note: this concept is not to be used for other - one of the listed statuses is presumed to apply, it's just now known which one.";
162    case NULL:
163      return null;
164    default:
165      return "?";
166    }
167  }
168
169  public String getDisplay() {
170    switch (this) {
171    case PREPARATION:
172      return "Preparation";
173    case INPROGRESS:
174      return "In Progress";
175    case CANCELLED:
176      return "Cancelled";
177    case ONHOLD:
178      return "On Hold";
179    case COMPLETED:
180      return "Completed";
181    case ENTEREDINERROR:
182      return "Entered in Error";
183    case STOPPED:
184      return "Stopped";
185    case DECLINED:
186      return "Declined";
187    case UNKNOWN:
188      return "Unknown";
189    case NULL:
190      return null;
191    default:
192      return "?";
193    }
194  }
195
196}