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 EncounterStatus {
037
038  /**
039   * The Encounter has not yet started.
040   */
041  PLANNED,
042  /**
043   * The Patient is present for the encounter, however is not currently meeting
044   * with a practitioner.
045   */
046  ARRIVED,
047  /**
048   * The patient has been assessed for the priority of their treatment based on
049   * the severity of their condition.
050   */
051  TRIAGED,
052  /**
053   * The Encounter has begun and the patient is present / the practitioner and the
054   * patient are meeting.
055   */
056  INPROGRESS,
057  /**
058   * The Encounter has begun, but the patient is temporarily on leave.
059   */
060  ONLEAVE,
061  /**
062   * The Encounter has ended.
063   */
064  FINISHED,
065  /**
066   * The Encounter has ended before it has begun.
067   */
068  CANCELLED,
069  /**
070   * This instance should not have been part of this patient's medical record.
071   */
072  ENTEREDINERROR,
073  /**
074   * The encounter status is unknown. Note that "unknown" is a value of last
075   * resort and every attempt should be made to provide a meaningful value other
076   * than "unknown".
077   */
078  UNKNOWN,
079  /**
080   * added to help the parsers
081   */
082  NULL;
083
084  public static EncounterStatus fromCode(String codeString) throws FHIRException {
085    if (codeString == null || "".equals(codeString))
086      return null;
087    if ("planned".equals(codeString))
088      return PLANNED;
089    if ("arrived".equals(codeString))
090      return ARRIVED;
091    if ("triaged".equals(codeString))
092      return TRIAGED;
093    if ("in-progress".equals(codeString))
094      return INPROGRESS;
095    if ("onleave".equals(codeString))
096      return ONLEAVE;
097    if ("finished".equals(codeString))
098      return FINISHED;
099    if ("cancelled".equals(codeString))
100      return CANCELLED;
101    if ("entered-in-error".equals(codeString))
102      return ENTEREDINERROR;
103    if ("unknown".equals(codeString))
104      return UNKNOWN;
105    throw new FHIRException("Unknown EncounterStatus code '" + codeString + "'");
106  }
107
108  public String toCode() {
109    switch (this) {
110    case PLANNED:
111      return "planned";
112    case ARRIVED:
113      return "arrived";
114    case TRIAGED:
115      return "triaged";
116    case INPROGRESS:
117      return "in-progress";
118    case ONLEAVE:
119      return "onleave";
120    case FINISHED:
121      return "finished";
122    case CANCELLED:
123      return "cancelled";
124    case ENTEREDINERROR:
125      return "entered-in-error";
126    case UNKNOWN:
127      return "unknown";
128    case NULL:
129      return null;
130    default:
131      return "?";
132    }
133  }
134
135  public String getSystem() {
136    return "http://hl7.org/fhir/encounter-status";
137  }
138
139  public String getDefinition() {
140    switch (this) {
141    case PLANNED:
142      return "The Encounter has not yet started.";
143    case ARRIVED:
144      return "The Patient is present for the encounter, however is not currently meeting with a practitioner.";
145    case TRIAGED:
146      return "The patient has been assessed for the priority of their treatment based on the severity of their condition.";
147    case INPROGRESS:
148      return "The Encounter has begun and the patient is present / the practitioner and the patient are meeting.";
149    case ONLEAVE:
150      return "The Encounter has begun, but the patient is temporarily on leave.";
151    case FINISHED:
152      return "The Encounter has ended.";
153    case CANCELLED:
154      return "The Encounter has ended before it has begun.";
155    case ENTEREDINERROR:
156      return "This instance should not have been part of this patient's medical record.";
157    case UNKNOWN:
158      return "The encounter status is unknown. Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\".";
159    case NULL:
160      return null;
161    default:
162      return "?";
163    }
164  }
165
166  public String getDisplay() {
167    switch (this) {
168    case PLANNED:
169      return "Planned";
170    case ARRIVED:
171      return "Arrived";
172    case TRIAGED:
173      return "Triaged";
174    case INPROGRESS:
175      return "In Progress";
176    case ONLEAVE:
177      return "On Leave";
178    case FINISHED:
179      return "Finished";
180    case CANCELLED:
181      return "Cancelled";
182    case ENTEREDINERROR:
183      return "Entered in Error";
184    case UNKNOWN:
185      return "Unknown";
186    case NULL:
187      return null;
188    default:
189      return "?";
190    }
191  }
192
193}