001package org.hl7.fhir.dstu3.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu3
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
053import java.util.ArrayList;
054import java.util.List;
055
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
058
059import ca.uhn.fhir.model.api.annotation.Block;
060import ca.uhn.fhir.model.api.annotation.Child;
061import ca.uhn.fhir.model.api.annotation.Description;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064/**
065 * An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.
066 */
067@ResourceDef(name="Encounter", profile="http://hl7.org/fhir/Profile/Encounter")
068public class Encounter extends DomainResource {
069
070    public enum EncounterStatus {
071        /**
072         * The Encounter has not yet started.
073         */
074        PLANNED, 
075        /**
076         * The Patient is present for the encounter, however is not currently meeting with a practitioner.
077         */
078        ARRIVED, 
079        /**
080         * The patient has been assessed for the priority of their treatment based on the severity of their condition.
081         */
082        TRIAGED, 
083        /**
084         * The Encounter has begun and the patient is present / the practitioner and the patient are meeting.
085         */
086        INPROGRESS, 
087        /**
088         * The Encounter has begun, but the patient is temporarily on leave.
089         */
090        ONLEAVE, 
091        /**
092         * The Encounter has ended.
093         */
094        FINISHED, 
095        /**
096         * The Encounter has ended before it has begun.
097         */
098        CANCELLED, 
099        /**
100         * This instance should not have been part of this patient's medical record.
101         */
102        ENTEREDINERROR, 
103        /**
104         * 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".
105         */
106        UNKNOWN, 
107        /**
108         * added to help the parsers with the generic types
109         */
110        NULL;
111        public static EncounterStatus fromCode(String codeString) throws FHIRException {
112            if (codeString == null || "".equals(codeString))
113                return null;
114        if ("planned".equals(codeString))
115          return PLANNED;
116        if ("arrived".equals(codeString))
117          return ARRIVED;
118        if ("triaged".equals(codeString))
119          return TRIAGED;
120        if ("in-progress".equals(codeString))
121          return INPROGRESS;
122        if ("onleave".equals(codeString))
123          return ONLEAVE;
124        if ("finished".equals(codeString))
125          return FINISHED;
126        if ("cancelled".equals(codeString))
127          return CANCELLED;
128        if ("entered-in-error".equals(codeString))
129          return ENTEREDINERROR;
130        if ("unknown".equals(codeString))
131          return UNKNOWN;
132        if (Configuration.isAcceptInvalidEnums())
133          return null;
134        else
135          throw new FHIRException("Unknown EncounterStatus code '"+codeString+"'");
136        }
137        public String toCode() {
138          switch (this) {
139            case PLANNED: return "planned";
140            case ARRIVED: return "arrived";
141            case TRIAGED: return "triaged";
142            case INPROGRESS: return "in-progress";
143            case ONLEAVE: return "onleave";
144            case FINISHED: return "finished";
145            case CANCELLED: return "cancelled";
146            case ENTEREDINERROR: return "entered-in-error";
147            case UNKNOWN: return "unknown";
148            default: return "?";
149          }
150        }
151        public String getSystem() {
152          switch (this) {
153            case PLANNED: return "http://hl7.org/fhir/encounter-status";
154            case ARRIVED: return "http://hl7.org/fhir/encounter-status";
155            case TRIAGED: return "http://hl7.org/fhir/encounter-status";
156            case INPROGRESS: return "http://hl7.org/fhir/encounter-status";
157            case ONLEAVE: return "http://hl7.org/fhir/encounter-status";
158            case FINISHED: return "http://hl7.org/fhir/encounter-status";
159            case CANCELLED: return "http://hl7.org/fhir/encounter-status";
160            case ENTEREDINERROR: return "http://hl7.org/fhir/encounter-status";
161            case UNKNOWN: return "http://hl7.org/fhir/encounter-status";
162            default: return "?";
163          }
164        }
165        public String getDefinition() {
166          switch (this) {
167            case PLANNED: return "The Encounter has not yet started.";
168            case ARRIVED: return "The Patient is present for the encounter, however is not currently meeting with a practitioner.";
169            case TRIAGED: return "The patient has been assessed for the priority of their treatment based on the severity of their condition.";
170            case INPROGRESS: return "The Encounter has begun and the patient is present / the practitioner and the patient are meeting.";
171            case ONLEAVE: return "The Encounter has begun, but the patient is temporarily on leave.";
172            case FINISHED: return "The Encounter has ended.";
173            case CANCELLED: return "The Encounter has ended before it has begun.";
174            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
175            case UNKNOWN: 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\".";
176            default: return "?";
177          }
178        }
179        public String getDisplay() {
180          switch (this) {
181            case PLANNED: return "Planned";
182            case ARRIVED: return "Arrived";
183            case TRIAGED: return "Triaged";
184            case INPROGRESS: return "In Progress";
185            case ONLEAVE: return "On Leave";
186            case FINISHED: return "Finished";
187            case CANCELLED: return "Cancelled";
188            case ENTEREDINERROR: return "Entered in Error";
189            case UNKNOWN: return "Unknown";
190            default: return "?";
191          }
192        }
193    }
194
195  public static class EncounterStatusEnumFactory implements EnumFactory<EncounterStatus> {
196    public EncounterStatus fromCode(String codeString) throws IllegalArgumentException {
197      if (codeString == null || "".equals(codeString))
198            if (codeString == null || "".equals(codeString))
199                return null;
200        if ("planned".equals(codeString))
201          return EncounterStatus.PLANNED;
202        if ("arrived".equals(codeString))
203          return EncounterStatus.ARRIVED;
204        if ("triaged".equals(codeString))
205          return EncounterStatus.TRIAGED;
206        if ("in-progress".equals(codeString))
207          return EncounterStatus.INPROGRESS;
208        if ("onleave".equals(codeString))
209          return EncounterStatus.ONLEAVE;
210        if ("finished".equals(codeString))
211          return EncounterStatus.FINISHED;
212        if ("cancelled".equals(codeString))
213          return EncounterStatus.CANCELLED;
214        if ("entered-in-error".equals(codeString))
215          return EncounterStatus.ENTEREDINERROR;
216        if ("unknown".equals(codeString))
217          return EncounterStatus.UNKNOWN;
218        throw new IllegalArgumentException("Unknown EncounterStatus code '"+codeString+"'");
219        }
220        public Enumeration<EncounterStatus> fromType(Base code) throws FHIRException {
221          if (code == null)
222            return null;
223          if (code.isEmpty())
224            return new Enumeration<EncounterStatus>(this);
225          String codeString = ((PrimitiveType) code).asStringValue();
226          if (codeString == null || "".equals(codeString))
227            return null;
228        if ("planned".equals(codeString))
229          return new Enumeration<EncounterStatus>(this, EncounterStatus.PLANNED);
230        if ("arrived".equals(codeString))
231          return new Enumeration<EncounterStatus>(this, EncounterStatus.ARRIVED);
232        if ("triaged".equals(codeString))
233          return new Enumeration<EncounterStatus>(this, EncounterStatus.TRIAGED);
234        if ("in-progress".equals(codeString))
235          return new Enumeration<EncounterStatus>(this, EncounterStatus.INPROGRESS);
236        if ("onleave".equals(codeString))
237          return new Enumeration<EncounterStatus>(this, EncounterStatus.ONLEAVE);
238        if ("finished".equals(codeString))
239          return new Enumeration<EncounterStatus>(this, EncounterStatus.FINISHED);
240        if ("cancelled".equals(codeString))
241          return new Enumeration<EncounterStatus>(this, EncounterStatus.CANCELLED);
242        if ("entered-in-error".equals(codeString))
243          return new Enumeration<EncounterStatus>(this, EncounterStatus.ENTEREDINERROR);
244        if ("unknown".equals(codeString))
245          return new Enumeration<EncounterStatus>(this, EncounterStatus.UNKNOWN);
246        throw new FHIRException("Unknown EncounterStatus code '"+codeString+"'");
247        }
248    public String toCode(EncounterStatus code) {
249      if (code == EncounterStatus.PLANNED)
250        return "planned";
251      if (code == EncounterStatus.ARRIVED)
252        return "arrived";
253      if (code == EncounterStatus.TRIAGED)
254        return "triaged";
255      if (code == EncounterStatus.INPROGRESS)
256        return "in-progress";
257      if (code == EncounterStatus.ONLEAVE)
258        return "onleave";
259      if (code == EncounterStatus.FINISHED)
260        return "finished";
261      if (code == EncounterStatus.CANCELLED)
262        return "cancelled";
263      if (code == EncounterStatus.ENTEREDINERROR)
264        return "entered-in-error";
265      if (code == EncounterStatus.UNKNOWN)
266        return "unknown";
267      return "?";
268      }
269    public String toSystem(EncounterStatus code) {
270      return code.getSystem();
271      }
272    }
273
274    public enum EncounterLocationStatus {
275        /**
276         * The patient is planned to be moved to this location at some point in the future.
277         */
278        PLANNED, 
279        /**
280         * The patient is currently at this location, or was between the period specified.
281
282A system may update these records when the patient leaves the location to either reserved, or completed
283         */
284        ACTIVE, 
285        /**
286         * This location is held empty for this patient.
287         */
288        RESERVED, 
289        /**
290         * The patient was at this location during the period specified.
291
292Not to be used when the patient is currently at the location
293         */
294        COMPLETED, 
295        /**
296         * added to help the parsers with the generic types
297         */
298        NULL;
299        public static EncounterLocationStatus fromCode(String codeString) throws FHIRException {
300            if (codeString == null || "".equals(codeString))
301                return null;
302        if ("planned".equals(codeString))
303          return PLANNED;
304        if ("active".equals(codeString))
305          return ACTIVE;
306        if ("reserved".equals(codeString))
307          return RESERVED;
308        if ("completed".equals(codeString))
309          return COMPLETED;
310        if (Configuration.isAcceptInvalidEnums())
311          return null;
312        else
313          throw new FHIRException("Unknown EncounterLocationStatus code '"+codeString+"'");
314        }
315        public String toCode() {
316          switch (this) {
317            case PLANNED: return "planned";
318            case ACTIVE: return "active";
319            case RESERVED: return "reserved";
320            case COMPLETED: return "completed";
321            default: return "?";
322          }
323        }
324        public String getSystem() {
325          switch (this) {
326            case PLANNED: return "http://hl7.org/fhir/encounter-location-status";
327            case ACTIVE: return "http://hl7.org/fhir/encounter-location-status";
328            case RESERVED: return "http://hl7.org/fhir/encounter-location-status";
329            case COMPLETED: return "http://hl7.org/fhir/encounter-location-status";
330            default: return "?";
331          }
332        }
333        public String getDefinition() {
334          switch (this) {
335            case PLANNED: return "The patient is planned to be moved to this location at some point in the future.";
336            case ACTIVE: return "The patient is currently at this location, or was between the period specified.\r\rA system may update these records when the patient leaves the location to either reserved, or completed";
337            case RESERVED: return "This location is held empty for this patient.";
338            case COMPLETED: return "The patient was at this location during the period specified.\r\rNot to be used when the patient is currently at the location";
339            default: return "?";
340          }
341        }
342        public String getDisplay() {
343          switch (this) {
344            case PLANNED: return "Planned";
345            case ACTIVE: return "Active";
346            case RESERVED: return "Reserved";
347            case COMPLETED: return "Completed";
348            default: return "?";
349          }
350        }
351    }
352
353  public static class EncounterLocationStatusEnumFactory implements EnumFactory<EncounterLocationStatus> {
354    public EncounterLocationStatus fromCode(String codeString) throws IllegalArgumentException {
355      if (codeString == null || "".equals(codeString))
356            if (codeString == null || "".equals(codeString))
357                return null;
358        if ("planned".equals(codeString))
359          return EncounterLocationStatus.PLANNED;
360        if ("active".equals(codeString))
361          return EncounterLocationStatus.ACTIVE;
362        if ("reserved".equals(codeString))
363          return EncounterLocationStatus.RESERVED;
364        if ("completed".equals(codeString))
365          return EncounterLocationStatus.COMPLETED;
366        throw new IllegalArgumentException("Unknown EncounterLocationStatus code '"+codeString+"'");
367        }
368        public Enumeration<EncounterLocationStatus> fromType(Base code) throws FHIRException {
369          if (code == null)
370            return null;
371          if (code.isEmpty())
372            return new Enumeration<EncounterLocationStatus>(this);
373          String codeString = ((PrimitiveType) code).asStringValue();
374          if (codeString == null || "".equals(codeString))
375            return null;
376        if ("planned".equals(codeString))
377          return new Enumeration<EncounterLocationStatus>(this, EncounterLocationStatus.PLANNED);
378        if ("active".equals(codeString))
379          return new Enumeration<EncounterLocationStatus>(this, EncounterLocationStatus.ACTIVE);
380        if ("reserved".equals(codeString))
381          return new Enumeration<EncounterLocationStatus>(this, EncounterLocationStatus.RESERVED);
382        if ("completed".equals(codeString))
383          return new Enumeration<EncounterLocationStatus>(this, EncounterLocationStatus.COMPLETED);
384        throw new FHIRException("Unknown EncounterLocationStatus code '"+codeString+"'");
385        }
386    public String toCode(EncounterLocationStatus code) {
387      if (code == EncounterLocationStatus.PLANNED)
388        return "planned";
389      if (code == EncounterLocationStatus.ACTIVE)
390        return "active";
391      if (code == EncounterLocationStatus.RESERVED)
392        return "reserved";
393      if (code == EncounterLocationStatus.COMPLETED)
394        return "completed";
395      return "?";
396      }
397    public String toSystem(EncounterLocationStatus code) {
398      return code.getSystem();
399      }
400    }
401
402    @Block()
403    public static class StatusHistoryComponent extends BackboneElement implements IBaseBackboneElement {
404        /**
405         * planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
406         */
407        @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
408        @Description(shortDefinition="planned | arrived | triaged | in-progress | onleave | finished | cancelled +", formalDefinition="planned | arrived | triaged | in-progress | onleave | finished | cancelled +." )
409        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-status")
410        protected Enumeration<EncounterStatus> status;
411
412        /**
413         * The time that the episode was in the specified status.
414         */
415        @Child(name = "period", type = {Period.class}, order=2, min=1, max=1, modifier=false, summary=false)
416        @Description(shortDefinition="The time that the episode was in the specified status", formalDefinition="The time that the episode was in the specified status." )
417        protected Period period;
418
419        private static final long serialVersionUID = -1893906736L;
420
421    /**
422     * Constructor
423     */
424      public StatusHistoryComponent() {
425        super();
426      }
427
428    /**
429     * Constructor
430     */
431      public StatusHistoryComponent(Enumeration<EncounterStatus> status, Period period) {
432        super();
433        this.status = status;
434        this.period = period;
435      }
436
437        /**
438         * @return {@link #status} (planned | arrived | triaged | in-progress | onleave | finished | cancelled +.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
439         */
440        public Enumeration<EncounterStatus> getStatusElement() { 
441          if (this.status == null)
442            if (Configuration.errorOnAutoCreate())
443              throw new Error("Attempt to auto-create StatusHistoryComponent.status");
444            else if (Configuration.doAutoCreate())
445              this.status = new Enumeration<EncounterStatus>(new EncounterStatusEnumFactory()); // bb
446          return this.status;
447        }
448
449        public boolean hasStatusElement() { 
450          return this.status != null && !this.status.isEmpty();
451        }
452
453        public boolean hasStatus() { 
454          return this.status != null && !this.status.isEmpty();
455        }
456
457        /**
458         * @param value {@link #status} (planned | arrived | triaged | in-progress | onleave | finished | cancelled +.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
459         */
460        public StatusHistoryComponent setStatusElement(Enumeration<EncounterStatus> value) { 
461          this.status = value;
462          return this;
463        }
464
465        /**
466         * @return planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
467         */
468        public EncounterStatus getStatus() { 
469          return this.status == null ? null : this.status.getValue();
470        }
471
472        /**
473         * @param value planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
474         */
475        public StatusHistoryComponent setStatus(EncounterStatus value) { 
476            if (this.status == null)
477              this.status = new Enumeration<EncounterStatus>(new EncounterStatusEnumFactory());
478            this.status.setValue(value);
479          return this;
480        }
481
482        /**
483         * @return {@link #period} (The time that the episode was in the specified status.)
484         */
485        public Period getPeriod() { 
486          if (this.period == null)
487            if (Configuration.errorOnAutoCreate())
488              throw new Error("Attempt to auto-create StatusHistoryComponent.period");
489            else if (Configuration.doAutoCreate())
490              this.period = new Period(); // cc
491          return this.period;
492        }
493
494        public boolean hasPeriod() { 
495          return this.period != null && !this.period.isEmpty();
496        }
497
498        /**
499         * @param value {@link #period} (The time that the episode was in the specified status.)
500         */
501        public StatusHistoryComponent setPeriod(Period value)  { 
502          this.period = value;
503          return this;
504        }
505
506        protected void listChildren(List<Property> children) {
507          super.listChildren(children);
508          children.add(new Property("status", "code", "planned | arrived | triaged | in-progress | onleave | finished | cancelled +.", 0, 1, status));
509          children.add(new Property("period", "Period", "The time that the episode was in the specified status.", 0, 1, period));
510        }
511
512        @Override
513        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
514          switch (_hash) {
515          case -892481550: /*status*/  return new Property("status", "code", "planned | arrived | triaged | in-progress | onleave | finished | cancelled +.", 0, 1, status);
516          case -991726143: /*period*/  return new Property("period", "Period", "The time that the episode was in the specified status.", 0, 1, period);
517          default: return super.getNamedProperty(_hash, _name, _checkValid);
518          }
519
520        }
521
522      @Override
523      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
524        switch (hash) {
525        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EncounterStatus>
526        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
527        default: return super.getProperty(hash, name, checkValid);
528        }
529
530      }
531
532      @Override
533      public Base setProperty(int hash, String name, Base value) throws FHIRException {
534        switch (hash) {
535        case -892481550: // status
536          value = new EncounterStatusEnumFactory().fromType(castToCode(value));
537          this.status = (Enumeration) value; // Enumeration<EncounterStatus>
538          return value;
539        case -991726143: // period
540          this.period = castToPeriod(value); // Period
541          return value;
542        default: return super.setProperty(hash, name, value);
543        }
544
545      }
546
547      @Override
548      public Base setProperty(String name, Base value) throws FHIRException {
549        if (name.equals("status")) {
550          value = new EncounterStatusEnumFactory().fromType(castToCode(value));
551          this.status = (Enumeration) value; // Enumeration<EncounterStatus>
552        } else if (name.equals("period")) {
553          this.period = castToPeriod(value); // Period
554        } else
555          return super.setProperty(name, value);
556        return value;
557      }
558
559      @Override
560      public Base makeProperty(int hash, String name) throws FHIRException {
561        switch (hash) {
562        case -892481550:  return getStatusElement();
563        case -991726143:  return getPeriod(); 
564        default: return super.makeProperty(hash, name);
565        }
566
567      }
568
569      @Override
570      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
571        switch (hash) {
572        case -892481550: /*status*/ return new String[] {"code"};
573        case -991726143: /*period*/ return new String[] {"Period"};
574        default: return super.getTypesForProperty(hash, name);
575        }
576
577      }
578
579      @Override
580      public Base addChild(String name) throws FHIRException {
581        if (name.equals("status")) {
582          throw new FHIRException("Cannot call addChild on a primitive type Encounter.status");
583        }
584        else if (name.equals("period")) {
585          this.period = new Period();
586          return this.period;
587        }
588        else
589          return super.addChild(name);
590      }
591
592      public StatusHistoryComponent copy() {
593        StatusHistoryComponent dst = new StatusHistoryComponent();
594        copyValues(dst);
595        dst.status = status == null ? null : status.copy();
596        dst.period = period == null ? null : period.copy();
597        return dst;
598      }
599
600      @Override
601      public boolean equalsDeep(Base other_) {
602        if (!super.equalsDeep(other_))
603          return false;
604        if (!(other_ instanceof StatusHistoryComponent))
605          return false;
606        StatusHistoryComponent o = (StatusHistoryComponent) other_;
607        return compareDeep(status, o.status, true) && compareDeep(period, o.period, true);
608      }
609
610      @Override
611      public boolean equalsShallow(Base other_) {
612        if (!super.equalsShallow(other_))
613          return false;
614        if (!(other_ instanceof StatusHistoryComponent))
615          return false;
616        StatusHistoryComponent o = (StatusHistoryComponent) other_;
617        return compareValues(status, o.status, true);
618      }
619
620      public boolean isEmpty() {
621        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, period);
622      }
623
624  public String fhirType() {
625    return "Encounter.statusHistory";
626
627  }
628
629  }
630
631    @Block()
632    public static class ClassHistoryComponent extends BackboneElement implements IBaseBackboneElement {
633        /**
634         * inpatient | outpatient | ambulatory | emergency +.
635         */
636        @Child(name = "class", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
637        @Description(shortDefinition="inpatient | outpatient | ambulatory | emergency +", formalDefinition="inpatient | outpatient | ambulatory | emergency +." )
638        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActEncounterCode")
639        protected Coding class_;
640
641        /**
642         * The time that the episode was in the specified class.
643         */
644        @Child(name = "period", type = {Period.class}, order=2, min=1, max=1, modifier=false, summary=false)
645        @Description(shortDefinition="The time that the episode was in the specified class", formalDefinition="The time that the episode was in the specified class." )
646        protected Period period;
647
648        private static final long serialVersionUID = 1331020311L;
649
650    /**
651     * Constructor
652     */
653      public ClassHistoryComponent() {
654        super();
655      }
656
657    /**
658     * Constructor
659     */
660      public ClassHistoryComponent(Coding class_, Period period) {
661        super();
662        this.class_ = class_;
663        this.period = period;
664      }
665
666        /**
667         * @return {@link #class_} (inpatient | outpatient | ambulatory | emergency +.)
668         */
669        public Coding getClass_() { 
670          if (this.class_ == null)
671            if (Configuration.errorOnAutoCreate())
672              throw new Error("Attempt to auto-create ClassHistoryComponent.class_");
673            else if (Configuration.doAutoCreate())
674              this.class_ = new Coding(); // cc
675          return this.class_;
676        }
677
678        public boolean hasClass_() { 
679          return this.class_ != null && !this.class_.isEmpty();
680        }
681
682        /**
683         * @param value {@link #class_} (inpatient | outpatient | ambulatory | emergency +.)
684         */
685        public ClassHistoryComponent setClass_(Coding value)  { 
686          this.class_ = value;
687          return this;
688        }
689
690        /**
691         * @return {@link #period} (The time that the episode was in the specified class.)
692         */
693        public Period getPeriod() { 
694          if (this.period == null)
695            if (Configuration.errorOnAutoCreate())
696              throw new Error("Attempt to auto-create ClassHistoryComponent.period");
697            else if (Configuration.doAutoCreate())
698              this.period = new Period(); // cc
699          return this.period;
700        }
701
702        public boolean hasPeriod() { 
703          return this.period != null && !this.period.isEmpty();
704        }
705
706        /**
707         * @param value {@link #period} (The time that the episode was in the specified class.)
708         */
709        public ClassHistoryComponent setPeriod(Period value)  { 
710          this.period = value;
711          return this;
712        }
713
714        protected void listChildren(List<Property> children) {
715          super.listChildren(children);
716          children.add(new Property("class", "Coding", "inpatient | outpatient | ambulatory | emergency +.", 0, 1, class_));
717          children.add(new Property("period", "Period", "The time that the episode was in the specified class.", 0, 1, period));
718        }
719
720        @Override
721        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
722          switch (_hash) {
723          case 94742904: /*class*/  return new Property("class", "Coding", "inpatient | outpatient | ambulatory | emergency +.", 0, 1, class_);
724          case -991726143: /*period*/  return new Property("period", "Period", "The time that the episode was in the specified class.", 0, 1, period);
725          default: return super.getNamedProperty(_hash, _name, _checkValid);
726          }
727
728        }
729
730      @Override
731      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
732        switch (hash) {
733        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // Coding
734        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
735        default: return super.getProperty(hash, name, checkValid);
736        }
737
738      }
739
740      @Override
741      public Base setProperty(int hash, String name, Base value) throws FHIRException {
742        switch (hash) {
743        case 94742904: // class
744          this.class_ = castToCoding(value); // Coding
745          return value;
746        case -991726143: // period
747          this.period = castToPeriod(value); // Period
748          return value;
749        default: return super.setProperty(hash, name, value);
750        }
751
752      }
753
754      @Override
755      public Base setProperty(String name, Base value) throws FHIRException {
756        if (name.equals("class")) {
757          this.class_ = castToCoding(value); // Coding
758        } else if (name.equals("period")) {
759          this.period = castToPeriod(value); // Period
760        } else
761          return super.setProperty(name, value);
762        return value;
763      }
764
765      @Override
766      public Base makeProperty(int hash, String name) throws FHIRException {
767        switch (hash) {
768        case 94742904:  return getClass_(); 
769        case -991726143:  return getPeriod(); 
770        default: return super.makeProperty(hash, name);
771        }
772
773      }
774
775      @Override
776      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
777        switch (hash) {
778        case 94742904: /*class*/ return new String[] {"Coding"};
779        case -991726143: /*period*/ return new String[] {"Period"};
780        default: return super.getTypesForProperty(hash, name);
781        }
782
783      }
784
785      @Override
786      public Base addChild(String name) throws FHIRException {
787        if (name.equals("class")) {
788          this.class_ = new Coding();
789          return this.class_;
790        }
791        else if (name.equals("period")) {
792          this.period = new Period();
793          return this.period;
794        }
795        else
796          return super.addChild(name);
797      }
798
799      public ClassHistoryComponent copy() {
800        ClassHistoryComponent dst = new ClassHistoryComponent();
801        copyValues(dst);
802        dst.class_ = class_ == null ? null : class_.copy();
803        dst.period = period == null ? null : period.copy();
804        return dst;
805      }
806
807      @Override
808      public boolean equalsDeep(Base other_) {
809        if (!super.equalsDeep(other_))
810          return false;
811        if (!(other_ instanceof ClassHistoryComponent))
812          return false;
813        ClassHistoryComponent o = (ClassHistoryComponent) other_;
814        return compareDeep(class_, o.class_, true) && compareDeep(period, o.period, true);
815      }
816
817      @Override
818      public boolean equalsShallow(Base other_) {
819        if (!super.equalsShallow(other_))
820          return false;
821        if (!(other_ instanceof ClassHistoryComponent))
822          return false;
823        ClassHistoryComponent o = (ClassHistoryComponent) other_;
824        return true;
825      }
826
827      public boolean isEmpty() {
828        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(class_, period);
829      }
830
831  public String fhirType() {
832    return "Encounter.classHistory";
833
834  }
835
836  }
837
838    @Block()
839    public static class EncounterParticipantComponent extends BackboneElement implements IBaseBackboneElement {
840        /**
841         * Role of participant in encounter.
842         */
843        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
844        @Description(shortDefinition="Role of participant in encounter", formalDefinition="Role of participant in encounter." )
845        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-participant-type")
846        protected List<CodeableConcept> type;
847
848        /**
849         * The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period.
850         */
851        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
852        @Description(shortDefinition="Period of time during the encounter that the participant participated", formalDefinition="The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period." )
853        protected Period period;
854
855        /**
856         * Persons involved in the encounter other than the patient.
857         */
858        @Child(name = "individual", type = {Practitioner.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=true)
859        @Description(shortDefinition="Persons involved in the encounter other than the patient", formalDefinition="Persons involved in the encounter other than the patient." )
860        protected Reference individual;
861
862        /**
863         * The actual object that is the target of the reference (Persons involved in the encounter other than the patient.)
864         */
865        protected Resource individualTarget;
866
867        private static final long serialVersionUID = 317095765L;
868
869    /**
870     * Constructor
871     */
872      public EncounterParticipantComponent() {
873        super();
874      }
875
876        /**
877         * @return {@link #type} (Role of participant in encounter.)
878         */
879        public List<CodeableConcept> getType() { 
880          if (this.type == null)
881            this.type = new ArrayList<CodeableConcept>();
882          return this.type;
883        }
884
885        /**
886         * @return Returns a reference to <code>this</code> for easy method chaining
887         */
888        public EncounterParticipantComponent setType(List<CodeableConcept> theType) { 
889          this.type = theType;
890          return this;
891        }
892
893        public boolean hasType() { 
894          if (this.type == null)
895            return false;
896          for (CodeableConcept item : this.type)
897            if (!item.isEmpty())
898              return true;
899          return false;
900        }
901
902        public CodeableConcept addType() { //3
903          CodeableConcept t = new CodeableConcept();
904          if (this.type == null)
905            this.type = new ArrayList<CodeableConcept>();
906          this.type.add(t);
907          return t;
908        }
909
910        public EncounterParticipantComponent addType(CodeableConcept t) { //3
911          if (t == null)
912            return this;
913          if (this.type == null)
914            this.type = new ArrayList<CodeableConcept>();
915          this.type.add(t);
916          return this;
917        }
918
919        /**
920         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
921         */
922        public CodeableConcept getTypeFirstRep() { 
923          if (getType().isEmpty()) {
924            addType();
925          }
926          return getType().get(0);
927        }
928
929        /**
930         * @return {@link #period} (The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period.)
931         */
932        public Period getPeriod() { 
933          if (this.period == null)
934            if (Configuration.errorOnAutoCreate())
935              throw new Error("Attempt to auto-create EncounterParticipantComponent.period");
936            else if (Configuration.doAutoCreate())
937              this.period = new Period(); // cc
938          return this.period;
939        }
940
941        public boolean hasPeriod() { 
942          return this.period != null && !this.period.isEmpty();
943        }
944
945        /**
946         * @param value {@link #period} (The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period.)
947         */
948        public EncounterParticipantComponent setPeriod(Period value)  { 
949          this.period = value;
950          return this;
951        }
952
953        /**
954         * @return {@link #individual} (Persons involved in the encounter other than the patient.)
955         */
956        public Reference getIndividual() { 
957          if (this.individual == null)
958            if (Configuration.errorOnAutoCreate())
959              throw new Error("Attempt to auto-create EncounterParticipantComponent.individual");
960            else if (Configuration.doAutoCreate())
961              this.individual = new Reference(); // cc
962          return this.individual;
963        }
964
965        public boolean hasIndividual() { 
966          return this.individual != null && !this.individual.isEmpty();
967        }
968
969        /**
970         * @param value {@link #individual} (Persons involved in the encounter other than the patient.)
971         */
972        public EncounterParticipantComponent setIndividual(Reference value)  { 
973          this.individual = value;
974          return this;
975        }
976
977        /**
978         * @return {@link #individual} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Persons involved in the encounter other than the patient.)
979         */
980        public Resource getIndividualTarget() { 
981          return this.individualTarget;
982        }
983
984        /**
985         * @param value {@link #individual} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Persons involved in the encounter other than the patient.)
986         */
987        public EncounterParticipantComponent setIndividualTarget(Resource value) { 
988          this.individualTarget = value;
989          return this;
990        }
991
992        protected void listChildren(List<Property> children) {
993          super.listChildren(children);
994          children.add(new Property("type", "CodeableConcept", "Role of participant in encounter.", 0, java.lang.Integer.MAX_VALUE, type));
995          children.add(new Property("period", "Period", "The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period.", 0, 1, period));
996          children.add(new Property("individual", "Reference(Practitioner|RelatedPerson)", "Persons involved in the encounter other than the patient.", 0, 1, individual));
997        }
998
999        @Override
1000        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1001          switch (_hash) {
1002          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Role of participant in encounter.", 0, java.lang.Integer.MAX_VALUE, type);
1003          case -991726143: /*period*/  return new Property("period", "Period", "The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period.", 0, 1, period);
1004          case -46292327: /*individual*/  return new Property("individual", "Reference(Practitioner|RelatedPerson)", "Persons involved in the encounter other than the patient.", 0, 1, individual);
1005          default: return super.getNamedProperty(_hash, _name, _checkValid);
1006          }
1007
1008        }
1009
1010      @Override
1011      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1012        switch (hash) {
1013        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1014        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1015        case -46292327: /*individual*/ return this.individual == null ? new Base[0] : new Base[] {this.individual}; // Reference
1016        default: return super.getProperty(hash, name, checkValid);
1017        }
1018
1019      }
1020
1021      @Override
1022      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1023        switch (hash) {
1024        case 3575610: // type
1025          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1026          return value;
1027        case -991726143: // period
1028          this.period = castToPeriod(value); // Period
1029          return value;
1030        case -46292327: // individual
1031          this.individual = castToReference(value); // Reference
1032          return value;
1033        default: return super.setProperty(hash, name, value);
1034        }
1035
1036      }
1037
1038      @Override
1039      public Base setProperty(String name, Base value) throws FHIRException {
1040        if (name.equals("type")) {
1041          this.getType().add(castToCodeableConcept(value));
1042        } else if (name.equals("period")) {
1043          this.period = castToPeriod(value); // Period
1044        } else if (name.equals("individual")) {
1045          this.individual = castToReference(value); // Reference
1046        } else
1047          return super.setProperty(name, value);
1048        return value;
1049      }
1050
1051      @Override
1052      public Base makeProperty(int hash, String name) throws FHIRException {
1053        switch (hash) {
1054        case 3575610:  return addType(); 
1055        case -991726143:  return getPeriod(); 
1056        case -46292327:  return getIndividual(); 
1057        default: return super.makeProperty(hash, name);
1058        }
1059
1060      }
1061
1062      @Override
1063      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1064        switch (hash) {
1065        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1066        case -991726143: /*period*/ return new String[] {"Period"};
1067        case -46292327: /*individual*/ return new String[] {"Reference"};
1068        default: return super.getTypesForProperty(hash, name);
1069        }
1070
1071      }
1072
1073      @Override
1074      public Base addChild(String name) throws FHIRException {
1075        if (name.equals("type")) {
1076          return addType();
1077        }
1078        else if (name.equals("period")) {
1079          this.period = new Period();
1080          return this.period;
1081        }
1082        else if (name.equals("individual")) {
1083          this.individual = new Reference();
1084          return this.individual;
1085        }
1086        else
1087          return super.addChild(name);
1088      }
1089
1090      public EncounterParticipantComponent copy() {
1091        EncounterParticipantComponent dst = new EncounterParticipantComponent();
1092        copyValues(dst);
1093        if (type != null) {
1094          dst.type = new ArrayList<CodeableConcept>();
1095          for (CodeableConcept i : type)
1096            dst.type.add(i.copy());
1097        };
1098        dst.period = period == null ? null : period.copy();
1099        dst.individual = individual == null ? null : individual.copy();
1100        return dst;
1101      }
1102
1103      @Override
1104      public boolean equalsDeep(Base other_) {
1105        if (!super.equalsDeep(other_))
1106          return false;
1107        if (!(other_ instanceof EncounterParticipantComponent))
1108          return false;
1109        EncounterParticipantComponent o = (EncounterParticipantComponent) other_;
1110        return compareDeep(type, o.type, true) && compareDeep(period, o.period, true) && compareDeep(individual, o.individual, true)
1111          ;
1112      }
1113
1114      @Override
1115      public boolean equalsShallow(Base other_) {
1116        if (!super.equalsShallow(other_))
1117          return false;
1118        if (!(other_ instanceof EncounterParticipantComponent))
1119          return false;
1120        EncounterParticipantComponent o = (EncounterParticipantComponent) other_;
1121        return true;
1122      }
1123
1124      public boolean isEmpty() {
1125        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, period, individual
1126          );
1127      }
1128
1129  public String fhirType() {
1130    return "Encounter.participant";
1131
1132  }
1133
1134  }
1135
1136    @Block()
1137    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1138        /**
1139         * Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.
1140         */
1141        @Child(name = "condition", type = {Condition.class, Procedure.class}, order=1, min=1, max=1, modifier=false, summary=false)
1142        @Description(shortDefinition="Reason the encounter takes place (resource)", formalDefinition="Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure." )
1143        protected Reference condition;
1144
1145        /**
1146         * The actual object that is the target of the reference (Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.)
1147         */
1148        protected Resource conditionTarget;
1149
1150        /**
1151         * Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).
1152         */
1153        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1154        @Description(shortDefinition="Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …)", formalDefinition="Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …)." )
1155        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diagnosis-role")
1156        protected CodeableConcept role;
1157
1158        /**
1159         * Ranking of the diagnosis (for each role type).
1160         */
1161        @Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1162        @Description(shortDefinition="Ranking of the diagnosis (for each role type)", formalDefinition="Ranking of the diagnosis (for each role type)." )
1163        protected PositiveIntType rank;
1164
1165        private static final long serialVersionUID = 1005913665L;
1166
1167    /**
1168     * Constructor
1169     */
1170      public DiagnosisComponent() {
1171        super();
1172      }
1173
1174    /**
1175     * Constructor
1176     */
1177      public DiagnosisComponent(Reference condition) {
1178        super();
1179        this.condition = condition;
1180      }
1181
1182        /**
1183         * @return {@link #condition} (Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.)
1184         */
1185        public Reference getCondition() { 
1186          if (this.condition == null)
1187            if (Configuration.errorOnAutoCreate())
1188              throw new Error("Attempt to auto-create DiagnosisComponent.condition");
1189            else if (Configuration.doAutoCreate())
1190              this.condition = new Reference(); // cc
1191          return this.condition;
1192        }
1193
1194        public boolean hasCondition() { 
1195          return this.condition != null && !this.condition.isEmpty();
1196        }
1197
1198        /**
1199         * @param value {@link #condition} (Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.)
1200         */
1201        public DiagnosisComponent setCondition(Reference value)  { 
1202          this.condition = value;
1203          return this;
1204        }
1205
1206        /**
1207         * @return {@link #condition} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.)
1208         */
1209        public Resource getConditionTarget() { 
1210          return this.conditionTarget;
1211        }
1212
1213        /**
1214         * @param value {@link #condition} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.)
1215         */
1216        public DiagnosisComponent setConditionTarget(Resource value) { 
1217          this.conditionTarget = value;
1218          return this;
1219        }
1220
1221        /**
1222         * @return {@link #role} (Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).)
1223         */
1224        public CodeableConcept getRole() { 
1225          if (this.role == null)
1226            if (Configuration.errorOnAutoCreate())
1227              throw new Error("Attempt to auto-create DiagnosisComponent.role");
1228            else if (Configuration.doAutoCreate())
1229              this.role = new CodeableConcept(); // cc
1230          return this.role;
1231        }
1232
1233        public boolean hasRole() { 
1234          return this.role != null && !this.role.isEmpty();
1235        }
1236
1237        /**
1238         * @param value {@link #role} (Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).)
1239         */
1240        public DiagnosisComponent setRole(CodeableConcept value)  { 
1241          this.role = value;
1242          return this;
1243        }
1244
1245        /**
1246         * @return {@link #rank} (Ranking of the diagnosis (for each role type).). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
1247         */
1248        public PositiveIntType getRankElement() { 
1249          if (this.rank == null)
1250            if (Configuration.errorOnAutoCreate())
1251              throw new Error("Attempt to auto-create DiagnosisComponent.rank");
1252            else if (Configuration.doAutoCreate())
1253              this.rank = new PositiveIntType(); // bb
1254          return this.rank;
1255        }
1256
1257        public boolean hasRankElement() { 
1258          return this.rank != null && !this.rank.isEmpty();
1259        }
1260
1261        public boolean hasRank() { 
1262          return this.rank != null && !this.rank.isEmpty();
1263        }
1264
1265        /**
1266         * @param value {@link #rank} (Ranking of the diagnosis (for each role type).). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
1267         */
1268        public DiagnosisComponent setRankElement(PositiveIntType value) { 
1269          this.rank = value;
1270          return this;
1271        }
1272
1273        /**
1274         * @return Ranking of the diagnosis (for each role type).
1275         */
1276        public int getRank() { 
1277          return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue();
1278        }
1279
1280        /**
1281         * @param value Ranking of the diagnosis (for each role type).
1282         */
1283        public DiagnosisComponent setRank(int value) { 
1284            if (this.rank == null)
1285              this.rank = new PositiveIntType();
1286            this.rank.setValue(value);
1287          return this;
1288        }
1289
1290        protected void listChildren(List<Property> children) {
1291          super.listChildren(children);
1292          children.add(new Property("condition", "Reference(Condition|Procedure)", "Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.", 0, 1, condition));
1293          children.add(new Property("role", "CodeableConcept", "Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).", 0, 1, role));
1294          children.add(new Property("rank", "positiveInt", "Ranking of the diagnosis (for each role type).", 0, 1, rank));
1295        }
1296
1297        @Override
1298        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1299          switch (_hash) {
1300          case -861311717: /*condition*/  return new Property("condition", "Reference(Condition|Procedure)", "Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.", 0, 1, condition);
1301          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).", 0, 1, role);
1302          case 3492908: /*rank*/  return new Property("rank", "positiveInt", "Ranking of the diagnosis (for each role type).", 0, 1, rank);
1303          default: return super.getNamedProperty(_hash, _name, _checkValid);
1304          }
1305
1306        }
1307
1308      @Override
1309      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1310        switch (hash) {
1311        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // Reference
1312        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1313        case 3492908: /*rank*/ return this.rank == null ? new Base[0] : new Base[] {this.rank}; // PositiveIntType
1314        default: return super.getProperty(hash, name, checkValid);
1315        }
1316
1317      }
1318
1319      @Override
1320      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1321        switch (hash) {
1322        case -861311717: // condition
1323          this.condition = castToReference(value); // Reference
1324          return value;
1325        case 3506294: // role
1326          this.role = castToCodeableConcept(value); // CodeableConcept
1327          return value;
1328        case 3492908: // rank
1329          this.rank = castToPositiveInt(value); // PositiveIntType
1330          return value;
1331        default: return super.setProperty(hash, name, value);
1332        }
1333
1334      }
1335
1336      @Override
1337      public Base setProperty(String name, Base value) throws FHIRException {
1338        if (name.equals("condition")) {
1339          this.condition = castToReference(value); // Reference
1340        } else if (name.equals("role")) {
1341          this.role = castToCodeableConcept(value); // CodeableConcept
1342        } else if (name.equals("rank")) {
1343          this.rank = castToPositiveInt(value); // PositiveIntType
1344        } else
1345          return super.setProperty(name, value);
1346        return value;
1347      }
1348
1349      @Override
1350      public Base makeProperty(int hash, String name) throws FHIRException {
1351        switch (hash) {
1352        case -861311717:  return getCondition(); 
1353        case 3506294:  return getRole(); 
1354        case 3492908:  return getRankElement();
1355        default: return super.makeProperty(hash, name);
1356        }
1357
1358      }
1359
1360      @Override
1361      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1362        switch (hash) {
1363        case -861311717: /*condition*/ return new String[] {"Reference"};
1364        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1365        case 3492908: /*rank*/ return new String[] {"positiveInt"};
1366        default: return super.getTypesForProperty(hash, name);
1367        }
1368
1369      }
1370
1371      @Override
1372      public Base addChild(String name) throws FHIRException {
1373        if (name.equals("condition")) {
1374          this.condition = new Reference();
1375          return this.condition;
1376        }
1377        else if (name.equals("role")) {
1378          this.role = new CodeableConcept();
1379          return this.role;
1380        }
1381        else if (name.equals("rank")) {
1382          throw new FHIRException("Cannot call addChild on a primitive type Encounter.rank");
1383        }
1384        else
1385          return super.addChild(name);
1386      }
1387
1388      public DiagnosisComponent copy() {
1389        DiagnosisComponent dst = new DiagnosisComponent();
1390        copyValues(dst);
1391        dst.condition = condition == null ? null : condition.copy();
1392        dst.role = role == null ? null : role.copy();
1393        dst.rank = rank == null ? null : rank.copy();
1394        return dst;
1395      }
1396
1397      @Override
1398      public boolean equalsDeep(Base other_) {
1399        if (!super.equalsDeep(other_))
1400          return false;
1401        if (!(other_ instanceof DiagnosisComponent))
1402          return false;
1403        DiagnosisComponent o = (DiagnosisComponent) other_;
1404        return compareDeep(condition, o.condition, true) && compareDeep(role, o.role, true) && compareDeep(rank, o.rank, true)
1405          ;
1406      }
1407
1408      @Override
1409      public boolean equalsShallow(Base other_) {
1410        if (!super.equalsShallow(other_))
1411          return false;
1412        if (!(other_ instanceof DiagnosisComponent))
1413          return false;
1414        DiagnosisComponent o = (DiagnosisComponent) other_;
1415        return compareValues(rank, o.rank, true);
1416      }
1417
1418      public boolean isEmpty() {
1419        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(condition, role, rank);
1420      }
1421
1422  public String fhirType() {
1423    return "Encounter.diagnosis";
1424
1425  }
1426
1427  }
1428
1429    @Block()
1430    public static class EncounterHospitalizationComponent extends BackboneElement implements IBaseBackboneElement {
1431        /**
1432         * Pre-admission identifier.
1433         */
1434        @Child(name = "preAdmissionIdentifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false)
1435        @Description(shortDefinition="Pre-admission identifier", formalDefinition="Pre-admission identifier." )
1436        protected Identifier preAdmissionIdentifier;
1437
1438        /**
1439         * The location from which the patient came before admission.
1440         */
1441        @Child(name = "origin", type = {Location.class}, order=2, min=0, max=1, modifier=false, summary=false)
1442        @Description(shortDefinition="The location from which the patient came before admission", formalDefinition="The location from which the patient came before admission." )
1443        protected Reference origin;
1444
1445        /**
1446         * The actual object that is the target of the reference (The location from which the patient came before admission.)
1447         */
1448        protected Location originTarget;
1449
1450        /**
1451         * From where patient was admitted (physician referral, transfer).
1452         */
1453        @Child(name = "admitSource", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1454        @Description(shortDefinition="From where patient was admitted (physician referral, transfer)", formalDefinition="From where patient was admitted (physician referral, transfer)." )
1455        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-admit-source")
1456        protected CodeableConcept admitSource;
1457
1458        /**
1459         * Whether this hospitalization is a readmission and why if known.
1460         */
1461        @Child(name = "reAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1462        @Description(shortDefinition="The type of hospital re-admission that has occurred (if any). If the value is absent, then this is not identified as a readmission", formalDefinition="Whether this hospitalization is a readmission and why if known." )
1463        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v2-0092")
1464        protected CodeableConcept reAdmission;
1465
1466        /**
1467         * Diet preferences reported by the patient.
1468         */
1469        @Child(name = "dietPreference", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1470        @Description(shortDefinition="Diet preferences reported by the patient", formalDefinition="Diet preferences reported by the patient." )
1471        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-diet")
1472        protected List<CodeableConcept> dietPreference;
1473
1474        /**
1475         * Special courtesies (VIP, board member).
1476         */
1477        @Child(name = "specialCourtesy", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1478        @Description(shortDefinition="Special courtesies (VIP, board member)", formalDefinition="Special courtesies (VIP, board member)." )
1479        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-special-courtesy")
1480        protected List<CodeableConcept> specialCourtesy;
1481
1482        /**
1483         * Any special requests that have been made for this hospitalization encounter, such as the provision of specific equipment or other things.
1484         */
1485        @Child(name = "specialArrangement", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1486        @Description(shortDefinition="Wheelchair, translator, stretcher, etc.", formalDefinition="Any special requests that have been made for this hospitalization encounter, such as the provision of specific equipment or other things." )
1487        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-special-arrangements")
1488        protected List<CodeableConcept> specialArrangement;
1489
1490        /**
1491         * Location to which the patient is discharged.
1492         */
1493        @Child(name = "destination", type = {Location.class}, order=8, min=0, max=1, modifier=false, summary=false)
1494        @Description(shortDefinition="Location to which the patient is discharged", formalDefinition="Location to which the patient is discharged." )
1495        protected Reference destination;
1496
1497        /**
1498         * The actual object that is the target of the reference (Location to which the patient is discharged.)
1499         */
1500        protected Location destinationTarget;
1501
1502        /**
1503         * Category or kind of location after discharge.
1504         */
1505        @Child(name = "dischargeDisposition", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
1506        @Description(shortDefinition="Category or kind of location after discharge", formalDefinition="Category or kind of location after discharge." )
1507        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-discharge-disposition")
1508        protected CodeableConcept dischargeDisposition;
1509
1510        private static final long serialVersionUID = -1165804076L;
1511
1512    /**
1513     * Constructor
1514     */
1515      public EncounterHospitalizationComponent() {
1516        super();
1517      }
1518
1519        /**
1520         * @return {@link #preAdmissionIdentifier} (Pre-admission identifier.)
1521         */
1522        public Identifier getPreAdmissionIdentifier() { 
1523          if (this.preAdmissionIdentifier == null)
1524            if (Configuration.errorOnAutoCreate())
1525              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.preAdmissionIdentifier");
1526            else if (Configuration.doAutoCreate())
1527              this.preAdmissionIdentifier = new Identifier(); // cc
1528          return this.preAdmissionIdentifier;
1529        }
1530
1531        public boolean hasPreAdmissionIdentifier() { 
1532          return this.preAdmissionIdentifier != null && !this.preAdmissionIdentifier.isEmpty();
1533        }
1534
1535        /**
1536         * @param value {@link #preAdmissionIdentifier} (Pre-admission identifier.)
1537         */
1538        public EncounterHospitalizationComponent setPreAdmissionIdentifier(Identifier value)  { 
1539          this.preAdmissionIdentifier = value;
1540          return this;
1541        }
1542
1543        /**
1544         * @return {@link #origin} (The location from which the patient came before admission.)
1545         */
1546        public Reference getOrigin() { 
1547          if (this.origin == null)
1548            if (Configuration.errorOnAutoCreate())
1549              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.origin");
1550            else if (Configuration.doAutoCreate())
1551              this.origin = new Reference(); // cc
1552          return this.origin;
1553        }
1554
1555        public boolean hasOrigin() { 
1556          return this.origin != null && !this.origin.isEmpty();
1557        }
1558
1559        /**
1560         * @param value {@link #origin} (The location from which the patient came before admission.)
1561         */
1562        public EncounterHospitalizationComponent setOrigin(Reference value)  { 
1563          this.origin = value;
1564          return this;
1565        }
1566
1567        /**
1568         * @return {@link #origin} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The location from which the patient came before admission.)
1569         */
1570        public Location getOriginTarget() { 
1571          if (this.originTarget == null)
1572            if (Configuration.errorOnAutoCreate())
1573              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.origin");
1574            else if (Configuration.doAutoCreate())
1575              this.originTarget = new Location(); // aa
1576          return this.originTarget;
1577        }
1578
1579        /**
1580         * @param value {@link #origin} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The location from which the patient came before admission.)
1581         */
1582        public EncounterHospitalizationComponent setOriginTarget(Location value) { 
1583          this.originTarget = value;
1584          return this;
1585        }
1586
1587        /**
1588         * @return {@link #admitSource} (From where patient was admitted (physician referral, transfer).)
1589         */
1590        public CodeableConcept getAdmitSource() { 
1591          if (this.admitSource == null)
1592            if (Configuration.errorOnAutoCreate())
1593              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.admitSource");
1594            else if (Configuration.doAutoCreate())
1595              this.admitSource = new CodeableConcept(); // cc
1596          return this.admitSource;
1597        }
1598
1599        public boolean hasAdmitSource() { 
1600          return this.admitSource != null && !this.admitSource.isEmpty();
1601        }
1602
1603        /**
1604         * @param value {@link #admitSource} (From where patient was admitted (physician referral, transfer).)
1605         */
1606        public EncounterHospitalizationComponent setAdmitSource(CodeableConcept value)  { 
1607          this.admitSource = value;
1608          return this;
1609        }
1610
1611        /**
1612         * @return {@link #reAdmission} (Whether this hospitalization is a readmission and why if known.)
1613         */
1614        public CodeableConcept getReAdmission() { 
1615          if (this.reAdmission == null)
1616            if (Configuration.errorOnAutoCreate())
1617              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.reAdmission");
1618            else if (Configuration.doAutoCreate())
1619              this.reAdmission = new CodeableConcept(); // cc
1620          return this.reAdmission;
1621        }
1622
1623        public boolean hasReAdmission() { 
1624          return this.reAdmission != null && !this.reAdmission.isEmpty();
1625        }
1626
1627        /**
1628         * @param value {@link #reAdmission} (Whether this hospitalization is a readmission and why if known.)
1629         */
1630        public EncounterHospitalizationComponent setReAdmission(CodeableConcept value)  { 
1631          this.reAdmission = value;
1632          return this;
1633        }
1634
1635        /**
1636         * @return {@link #dietPreference} (Diet preferences reported by the patient.)
1637         */
1638        public List<CodeableConcept> getDietPreference() { 
1639          if (this.dietPreference == null)
1640            this.dietPreference = new ArrayList<CodeableConcept>();
1641          return this.dietPreference;
1642        }
1643
1644        /**
1645         * @return Returns a reference to <code>this</code> for easy method chaining
1646         */
1647        public EncounterHospitalizationComponent setDietPreference(List<CodeableConcept> theDietPreference) { 
1648          this.dietPreference = theDietPreference;
1649          return this;
1650        }
1651
1652        public boolean hasDietPreference() { 
1653          if (this.dietPreference == null)
1654            return false;
1655          for (CodeableConcept item : this.dietPreference)
1656            if (!item.isEmpty())
1657              return true;
1658          return false;
1659        }
1660
1661        public CodeableConcept addDietPreference() { //3
1662          CodeableConcept t = new CodeableConcept();
1663          if (this.dietPreference == null)
1664            this.dietPreference = new ArrayList<CodeableConcept>();
1665          this.dietPreference.add(t);
1666          return t;
1667        }
1668
1669        public EncounterHospitalizationComponent addDietPreference(CodeableConcept t) { //3
1670          if (t == null)
1671            return this;
1672          if (this.dietPreference == null)
1673            this.dietPreference = new ArrayList<CodeableConcept>();
1674          this.dietPreference.add(t);
1675          return this;
1676        }
1677
1678        /**
1679         * @return The first repetition of repeating field {@link #dietPreference}, creating it if it does not already exist
1680         */
1681        public CodeableConcept getDietPreferenceFirstRep() { 
1682          if (getDietPreference().isEmpty()) {
1683            addDietPreference();
1684          }
1685          return getDietPreference().get(0);
1686        }
1687
1688        /**
1689         * @return {@link #specialCourtesy} (Special courtesies (VIP, board member).)
1690         */
1691        public List<CodeableConcept> getSpecialCourtesy() { 
1692          if (this.specialCourtesy == null)
1693            this.specialCourtesy = new ArrayList<CodeableConcept>();
1694          return this.specialCourtesy;
1695        }
1696
1697        /**
1698         * @return Returns a reference to <code>this</code> for easy method chaining
1699         */
1700        public EncounterHospitalizationComponent setSpecialCourtesy(List<CodeableConcept> theSpecialCourtesy) { 
1701          this.specialCourtesy = theSpecialCourtesy;
1702          return this;
1703        }
1704
1705        public boolean hasSpecialCourtesy() { 
1706          if (this.specialCourtesy == null)
1707            return false;
1708          for (CodeableConcept item : this.specialCourtesy)
1709            if (!item.isEmpty())
1710              return true;
1711          return false;
1712        }
1713
1714        public CodeableConcept addSpecialCourtesy() { //3
1715          CodeableConcept t = new CodeableConcept();
1716          if (this.specialCourtesy == null)
1717            this.specialCourtesy = new ArrayList<CodeableConcept>();
1718          this.specialCourtesy.add(t);
1719          return t;
1720        }
1721
1722        public EncounterHospitalizationComponent addSpecialCourtesy(CodeableConcept t) { //3
1723          if (t == null)
1724            return this;
1725          if (this.specialCourtesy == null)
1726            this.specialCourtesy = new ArrayList<CodeableConcept>();
1727          this.specialCourtesy.add(t);
1728          return this;
1729        }
1730
1731        /**
1732         * @return The first repetition of repeating field {@link #specialCourtesy}, creating it if it does not already exist
1733         */
1734        public CodeableConcept getSpecialCourtesyFirstRep() { 
1735          if (getSpecialCourtesy().isEmpty()) {
1736            addSpecialCourtesy();
1737          }
1738          return getSpecialCourtesy().get(0);
1739        }
1740
1741        /**
1742         * @return {@link #specialArrangement} (Any special requests that have been made for this hospitalization encounter, such as the provision of specific equipment or other things.)
1743         */
1744        public List<CodeableConcept> getSpecialArrangement() { 
1745          if (this.specialArrangement == null)
1746            this.specialArrangement = new ArrayList<CodeableConcept>();
1747          return this.specialArrangement;
1748        }
1749
1750        /**
1751         * @return Returns a reference to <code>this</code> for easy method chaining
1752         */
1753        public EncounterHospitalizationComponent setSpecialArrangement(List<CodeableConcept> theSpecialArrangement) { 
1754          this.specialArrangement = theSpecialArrangement;
1755          return this;
1756        }
1757
1758        public boolean hasSpecialArrangement() { 
1759          if (this.specialArrangement == null)
1760            return false;
1761          for (CodeableConcept item : this.specialArrangement)
1762            if (!item.isEmpty())
1763              return true;
1764          return false;
1765        }
1766
1767        public CodeableConcept addSpecialArrangement() { //3
1768          CodeableConcept t = new CodeableConcept();
1769          if (this.specialArrangement == null)
1770            this.specialArrangement = new ArrayList<CodeableConcept>();
1771          this.specialArrangement.add(t);
1772          return t;
1773        }
1774
1775        public EncounterHospitalizationComponent addSpecialArrangement(CodeableConcept t) { //3
1776          if (t == null)
1777            return this;
1778          if (this.specialArrangement == null)
1779            this.specialArrangement = new ArrayList<CodeableConcept>();
1780          this.specialArrangement.add(t);
1781          return this;
1782        }
1783
1784        /**
1785         * @return The first repetition of repeating field {@link #specialArrangement}, creating it if it does not already exist
1786         */
1787        public CodeableConcept getSpecialArrangementFirstRep() { 
1788          if (getSpecialArrangement().isEmpty()) {
1789            addSpecialArrangement();
1790          }
1791          return getSpecialArrangement().get(0);
1792        }
1793
1794        /**
1795         * @return {@link #destination} (Location to which the patient is discharged.)
1796         */
1797        public Reference getDestination() { 
1798          if (this.destination == null)
1799            if (Configuration.errorOnAutoCreate())
1800              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.destination");
1801            else if (Configuration.doAutoCreate())
1802              this.destination = new Reference(); // cc
1803          return this.destination;
1804        }
1805
1806        public boolean hasDestination() { 
1807          return this.destination != null && !this.destination.isEmpty();
1808        }
1809
1810        /**
1811         * @param value {@link #destination} (Location to which the patient is discharged.)
1812         */
1813        public EncounterHospitalizationComponent setDestination(Reference value)  { 
1814          this.destination = value;
1815          return this;
1816        }
1817
1818        /**
1819         * @return {@link #destination} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Location to which the patient is discharged.)
1820         */
1821        public Location getDestinationTarget() { 
1822          if (this.destinationTarget == null)
1823            if (Configuration.errorOnAutoCreate())
1824              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.destination");
1825            else if (Configuration.doAutoCreate())
1826              this.destinationTarget = new Location(); // aa
1827          return this.destinationTarget;
1828        }
1829
1830        /**
1831         * @param value {@link #destination} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Location to which the patient is discharged.)
1832         */
1833        public EncounterHospitalizationComponent setDestinationTarget(Location value) { 
1834          this.destinationTarget = value;
1835          return this;
1836        }
1837
1838        /**
1839         * @return {@link #dischargeDisposition} (Category or kind of location after discharge.)
1840         */
1841        public CodeableConcept getDischargeDisposition() { 
1842          if (this.dischargeDisposition == null)
1843            if (Configuration.errorOnAutoCreate())
1844              throw new Error("Attempt to auto-create EncounterHospitalizationComponent.dischargeDisposition");
1845            else if (Configuration.doAutoCreate())
1846              this.dischargeDisposition = new CodeableConcept(); // cc
1847          return this.dischargeDisposition;
1848        }
1849
1850        public boolean hasDischargeDisposition() { 
1851          return this.dischargeDisposition != null && !this.dischargeDisposition.isEmpty();
1852        }
1853
1854        /**
1855         * @param value {@link #dischargeDisposition} (Category or kind of location after discharge.)
1856         */
1857        public EncounterHospitalizationComponent setDischargeDisposition(CodeableConcept value)  { 
1858          this.dischargeDisposition = value;
1859          return this;
1860        }
1861
1862        protected void listChildren(List<Property> children) {
1863          super.listChildren(children);
1864          children.add(new Property("preAdmissionIdentifier", "Identifier", "Pre-admission identifier.", 0, 1, preAdmissionIdentifier));
1865          children.add(new Property("origin", "Reference(Location)", "The location from which the patient came before admission.", 0, 1, origin));
1866          children.add(new Property("admitSource", "CodeableConcept", "From where patient was admitted (physician referral, transfer).", 0, 1, admitSource));
1867          children.add(new Property("reAdmission", "CodeableConcept", "Whether this hospitalization is a readmission and why if known.", 0, 1, reAdmission));
1868          children.add(new Property("dietPreference", "CodeableConcept", "Diet preferences reported by the patient.", 0, java.lang.Integer.MAX_VALUE, dietPreference));
1869          children.add(new Property("specialCourtesy", "CodeableConcept", "Special courtesies (VIP, board member).", 0, java.lang.Integer.MAX_VALUE, specialCourtesy));
1870          children.add(new Property("specialArrangement", "CodeableConcept", "Any special requests that have been made for this hospitalization encounter, such as the provision of specific equipment or other things.", 0, java.lang.Integer.MAX_VALUE, specialArrangement));
1871          children.add(new Property("destination", "Reference(Location)", "Location to which the patient is discharged.", 0, 1, destination));
1872          children.add(new Property("dischargeDisposition", "CodeableConcept", "Category or kind of location after discharge.", 0, 1, dischargeDisposition));
1873        }
1874
1875        @Override
1876        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1877          switch (_hash) {
1878          case -965394961: /*preAdmissionIdentifier*/  return new Property("preAdmissionIdentifier", "Identifier", "Pre-admission identifier.", 0, 1, preAdmissionIdentifier);
1879          case -1008619738: /*origin*/  return new Property("origin", "Reference(Location)", "The location from which the patient came before admission.", 0, 1, origin);
1880          case 538887120: /*admitSource*/  return new Property("admitSource", "CodeableConcept", "From where patient was admitted (physician referral, transfer).", 0, 1, admitSource);
1881          case 669348630: /*reAdmission*/  return new Property("reAdmission", "CodeableConcept", "Whether this hospitalization is a readmission and why if known.", 0, 1, reAdmission);
1882          case -1360641041: /*dietPreference*/  return new Property("dietPreference", "CodeableConcept", "Diet preferences reported by the patient.", 0, java.lang.Integer.MAX_VALUE, dietPreference);
1883          case 1583588345: /*specialCourtesy*/  return new Property("specialCourtesy", "CodeableConcept", "Special courtesies (VIP, board member).", 0, java.lang.Integer.MAX_VALUE, specialCourtesy);
1884          case 47410321: /*specialArrangement*/  return new Property("specialArrangement", "CodeableConcept", "Any special requests that have been made for this hospitalization encounter, such as the provision of specific equipment or other things.", 0, java.lang.Integer.MAX_VALUE, specialArrangement);
1885          case -1429847026: /*destination*/  return new Property("destination", "Reference(Location)", "Location to which the patient is discharged.", 0, 1, destination);
1886          case 528065941: /*dischargeDisposition*/  return new Property("dischargeDisposition", "CodeableConcept", "Category or kind of location after discharge.", 0, 1, dischargeDisposition);
1887          default: return super.getNamedProperty(_hash, _name, _checkValid);
1888          }
1889
1890        }
1891
1892      @Override
1893      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1894        switch (hash) {
1895        case -965394961: /*preAdmissionIdentifier*/ return this.preAdmissionIdentifier == null ? new Base[0] : new Base[] {this.preAdmissionIdentifier}; // Identifier
1896        case -1008619738: /*origin*/ return this.origin == null ? new Base[0] : new Base[] {this.origin}; // Reference
1897        case 538887120: /*admitSource*/ return this.admitSource == null ? new Base[0] : new Base[] {this.admitSource}; // CodeableConcept
1898        case 669348630: /*reAdmission*/ return this.reAdmission == null ? new Base[0] : new Base[] {this.reAdmission}; // CodeableConcept
1899        case -1360641041: /*dietPreference*/ return this.dietPreference == null ? new Base[0] : this.dietPreference.toArray(new Base[this.dietPreference.size()]); // CodeableConcept
1900        case 1583588345: /*specialCourtesy*/ return this.specialCourtesy == null ? new Base[0] : this.specialCourtesy.toArray(new Base[this.specialCourtesy.size()]); // CodeableConcept
1901        case 47410321: /*specialArrangement*/ return this.specialArrangement == null ? new Base[0] : this.specialArrangement.toArray(new Base[this.specialArrangement.size()]); // CodeableConcept
1902        case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference
1903        case 528065941: /*dischargeDisposition*/ return this.dischargeDisposition == null ? new Base[0] : new Base[] {this.dischargeDisposition}; // CodeableConcept
1904        default: return super.getProperty(hash, name, checkValid);
1905        }
1906
1907      }
1908
1909      @Override
1910      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1911        switch (hash) {
1912        case -965394961: // preAdmissionIdentifier
1913          this.preAdmissionIdentifier = castToIdentifier(value); // Identifier
1914          return value;
1915        case -1008619738: // origin
1916          this.origin = castToReference(value); // Reference
1917          return value;
1918        case 538887120: // admitSource
1919          this.admitSource = castToCodeableConcept(value); // CodeableConcept
1920          return value;
1921        case 669348630: // reAdmission
1922          this.reAdmission = castToCodeableConcept(value); // CodeableConcept
1923          return value;
1924        case -1360641041: // dietPreference
1925          this.getDietPreference().add(castToCodeableConcept(value)); // CodeableConcept
1926          return value;
1927        case 1583588345: // specialCourtesy
1928          this.getSpecialCourtesy().add(castToCodeableConcept(value)); // CodeableConcept
1929          return value;
1930        case 47410321: // specialArrangement
1931          this.getSpecialArrangement().add(castToCodeableConcept(value)); // CodeableConcept
1932          return value;
1933        case -1429847026: // destination
1934          this.destination = castToReference(value); // Reference
1935          return value;
1936        case 528065941: // dischargeDisposition
1937          this.dischargeDisposition = castToCodeableConcept(value); // CodeableConcept
1938          return value;
1939        default: return super.setProperty(hash, name, value);
1940        }
1941
1942      }
1943
1944      @Override
1945      public Base setProperty(String name, Base value) throws FHIRException {
1946        if (name.equals("preAdmissionIdentifier")) {
1947          this.preAdmissionIdentifier = castToIdentifier(value); // Identifier
1948        } else if (name.equals("origin")) {
1949          this.origin = castToReference(value); // Reference
1950        } else if (name.equals("admitSource")) {
1951          this.admitSource = castToCodeableConcept(value); // CodeableConcept
1952        } else if (name.equals("reAdmission")) {
1953          this.reAdmission = castToCodeableConcept(value); // CodeableConcept
1954        } else if (name.equals("dietPreference")) {
1955          this.getDietPreference().add(castToCodeableConcept(value));
1956        } else if (name.equals("specialCourtesy")) {
1957          this.getSpecialCourtesy().add(castToCodeableConcept(value));
1958        } else if (name.equals("specialArrangement")) {
1959          this.getSpecialArrangement().add(castToCodeableConcept(value));
1960        } else if (name.equals("destination")) {
1961          this.destination = castToReference(value); // Reference
1962        } else if (name.equals("dischargeDisposition")) {
1963          this.dischargeDisposition = castToCodeableConcept(value); // CodeableConcept
1964        } else
1965          return super.setProperty(name, value);
1966        return value;
1967      }
1968
1969      @Override
1970      public Base makeProperty(int hash, String name) throws FHIRException {
1971        switch (hash) {
1972        case -965394961:  return getPreAdmissionIdentifier(); 
1973        case -1008619738:  return getOrigin(); 
1974        case 538887120:  return getAdmitSource(); 
1975        case 669348630:  return getReAdmission(); 
1976        case -1360641041:  return addDietPreference(); 
1977        case 1583588345:  return addSpecialCourtesy(); 
1978        case 47410321:  return addSpecialArrangement(); 
1979        case -1429847026:  return getDestination(); 
1980        case 528065941:  return getDischargeDisposition(); 
1981        default: return super.makeProperty(hash, name);
1982        }
1983
1984      }
1985
1986      @Override
1987      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1988        switch (hash) {
1989        case -965394961: /*preAdmissionIdentifier*/ return new String[] {"Identifier"};
1990        case -1008619738: /*origin*/ return new String[] {"Reference"};
1991        case 538887120: /*admitSource*/ return new String[] {"CodeableConcept"};
1992        case 669348630: /*reAdmission*/ return new String[] {"CodeableConcept"};
1993        case -1360641041: /*dietPreference*/ return new String[] {"CodeableConcept"};
1994        case 1583588345: /*specialCourtesy*/ return new String[] {"CodeableConcept"};
1995        case 47410321: /*specialArrangement*/ return new String[] {"CodeableConcept"};
1996        case -1429847026: /*destination*/ return new String[] {"Reference"};
1997        case 528065941: /*dischargeDisposition*/ return new String[] {"CodeableConcept"};
1998        default: return super.getTypesForProperty(hash, name);
1999        }
2000
2001      }
2002
2003      @Override
2004      public Base addChild(String name) throws FHIRException {
2005        if (name.equals("preAdmissionIdentifier")) {
2006          this.preAdmissionIdentifier = new Identifier();
2007          return this.preAdmissionIdentifier;
2008        }
2009        else if (name.equals("origin")) {
2010          this.origin = new Reference();
2011          return this.origin;
2012        }
2013        else if (name.equals("admitSource")) {
2014          this.admitSource = new CodeableConcept();
2015          return this.admitSource;
2016        }
2017        else if (name.equals("reAdmission")) {
2018          this.reAdmission = new CodeableConcept();
2019          return this.reAdmission;
2020        }
2021        else if (name.equals("dietPreference")) {
2022          return addDietPreference();
2023        }
2024        else if (name.equals("specialCourtesy")) {
2025          return addSpecialCourtesy();
2026        }
2027        else if (name.equals("specialArrangement")) {
2028          return addSpecialArrangement();
2029        }
2030        else if (name.equals("destination")) {
2031          this.destination = new Reference();
2032          return this.destination;
2033        }
2034        else if (name.equals("dischargeDisposition")) {
2035          this.dischargeDisposition = new CodeableConcept();
2036          return this.dischargeDisposition;
2037        }
2038        else
2039          return super.addChild(name);
2040      }
2041
2042      public EncounterHospitalizationComponent copy() {
2043        EncounterHospitalizationComponent dst = new EncounterHospitalizationComponent();
2044        copyValues(dst);
2045        dst.preAdmissionIdentifier = preAdmissionIdentifier == null ? null : preAdmissionIdentifier.copy();
2046        dst.origin = origin == null ? null : origin.copy();
2047        dst.admitSource = admitSource == null ? null : admitSource.copy();
2048        dst.reAdmission = reAdmission == null ? null : reAdmission.copy();
2049        if (dietPreference != null) {
2050          dst.dietPreference = new ArrayList<CodeableConcept>();
2051          for (CodeableConcept i : dietPreference)
2052            dst.dietPreference.add(i.copy());
2053        };
2054        if (specialCourtesy != null) {
2055          dst.specialCourtesy = new ArrayList<CodeableConcept>();
2056          for (CodeableConcept i : specialCourtesy)
2057            dst.specialCourtesy.add(i.copy());
2058        };
2059        if (specialArrangement != null) {
2060          dst.specialArrangement = new ArrayList<CodeableConcept>();
2061          for (CodeableConcept i : specialArrangement)
2062            dst.specialArrangement.add(i.copy());
2063        };
2064        dst.destination = destination == null ? null : destination.copy();
2065        dst.dischargeDisposition = dischargeDisposition == null ? null : dischargeDisposition.copy();
2066        return dst;
2067      }
2068
2069      @Override
2070      public boolean equalsDeep(Base other_) {
2071        if (!super.equalsDeep(other_))
2072          return false;
2073        if (!(other_ instanceof EncounterHospitalizationComponent))
2074          return false;
2075        EncounterHospitalizationComponent o = (EncounterHospitalizationComponent) other_;
2076        return compareDeep(preAdmissionIdentifier, o.preAdmissionIdentifier, true) && compareDeep(origin, o.origin, true)
2077           && compareDeep(admitSource, o.admitSource, true) && compareDeep(reAdmission, o.reAdmission, true)
2078           && compareDeep(dietPreference, o.dietPreference, true) && compareDeep(specialCourtesy, o.specialCourtesy, true)
2079           && compareDeep(specialArrangement, o.specialArrangement, true) && compareDeep(destination, o.destination, true)
2080           && compareDeep(dischargeDisposition, o.dischargeDisposition, true);
2081      }
2082
2083      @Override
2084      public boolean equalsShallow(Base other_) {
2085        if (!super.equalsShallow(other_))
2086          return false;
2087        if (!(other_ instanceof EncounterHospitalizationComponent))
2088          return false;
2089        EncounterHospitalizationComponent o = (EncounterHospitalizationComponent) other_;
2090        return true;
2091      }
2092
2093      public boolean isEmpty() {
2094        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(preAdmissionIdentifier, origin
2095          , admitSource, reAdmission, dietPreference, specialCourtesy, specialArrangement, destination
2096          , dischargeDisposition);
2097      }
2098
2099  public String fhirType() {
2100    return "Encounter.hospitalization";
2101
2102  }
2103
2104  }
2105
2106    @Block()
2107    public static class EncounterLocationComponent extends BackboneElement implements IBaseBackboneElement {
2108        /**
2109         * The location where the encounter takes place.
2110         */
2111        @Child(name = "location", type = {Location.class}, order=1, min=1, max=1, modifier=false, summary=false)
2112        @Description(shortDefinition="Location the encounter takes place", formalDefinition="The location where the encounter takes place." )
2113        protected Reference location;
2114
2115        /**
2116         * The actual object that is the target of the reference (The location where the encounter takes place.)
2117         */
2118        protected Location locationTarget;
2119
2120        /**
2121         * The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.
2122         */
2123        @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2124        @Description(shortDefinition="planned | active | reserved | completed", formalDefinition="The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time." )
2125        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-location-status")
2126        protected Enumeration<EncounterLocationStatus> status;
2127
2128        /**
2129         * Time period during which the patient was present at the location.
2130         */
2131        @Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
2132        @Description(shortDefinition="Time period during which the patient was present at the location", formalDefinition="Time period during which the patient was present at the location." )
2133        protected Period period;
2134
2135        private static final long serialVersionUID = -322984880L;
2136
2137    /**
2138     * Constructor
2139     */
2140      public EncounterLocationComponent() {
2141        super();
2142      }
2143
2144    /**
2145     * Constructor
2146     */
2147      public EncounterLocationComponent(Reference location) {
2148        super();
2149        this.location = location;
2150      }
2151
2152        /**
2153         * @return {@link #location} (The location where the encounter takes place.)
2154         */
2155        public Reference getLocation() { 
2156          if (this.location == null)
2157            if (Configuration.errorOnAutoCreate())
2158              throw new Error("Attempt to auto-create EncounterLocationComponent.location");
2159            else if (Configuration.doAutoCreate())
2160              this.location = new Reference(); // cc
2161          return this.location;
2162        }
2163
2164        public boolean hasLocation() { 
2165          return this.location != null && !this.location.isEmpty();
2166        }
2167
2168        /**
2169         * @param value {@link #location} (The location where the encounter takes place.)
2170         */
2171        public EncounterLocationComponent setLocation(Reference value)  { 
2172          this.location = value;
2173          return this;
2174        }
2175
2176        /**
2177         * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The location where the encounter takes place.)
2178         */
2179        public Location getLocationTarget() { 
2180          if (this.locationTarget == null)
2181            if (Configuration.errorOnAutoCreate())
2182              throw new Error("Attempt to auto-create EncounterLocationComponent.location");
2183            else if (Configuration.doAutoCreate())
2184              this.locationTarget = new Location(); // aa
2185          return this.locationTarget;
2186        }
2187
2188        /**
2189         * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The location where the encounter takes place.)
2190         */
2191        public EncounterLocationComponent setLocationTarget(Location value) { 
2192          this.locationTarget = value;
2193          return this;
2194        }
2195
2196        /**
2197         * @return {@link #status} (The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2198         */
2199        public Enumeration<EncounterLocationStatus> getStatusElement() { 
2200          if (this.status == null)
2201            if (Configuration.errorOnAutoCreate())
2202              throw new Error("Attempt to auto-create EncounterLocationComponent.status");
2203            else if (Configuration.doAutoCreate())
2204              this.status = new Enumeration<EncounterLocationStatus>(new EncounterLocationStatusEnumFactory()); // bb
2205          return this.status;
2206        }
2207
2208        public boolean hasStatusElement() { 
2209          return this.status != null && !this.status.isEmpty();
2210        }
2211
2212        public boolean hasStatus() { 
2213          return this.status != null && !this.status.isEmpty();
2214        }
2215
2216        /**
2217         * @param value {@link #status} (The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2218         */
2219        public EncounterLocationComponent setStatusElement(Enumeration<EncounterLocationStatus> value) { 
2220          this.status = value;
2221          return this;
2222        }
2223
2224        /**
2225         * @return The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.
2226         */
2227        public EncounterLocationStatus getStatus() { 
2228          return this.status == null ? null : this.status.getValue();
2229        }
2230
2231        /**
2232         * @param value The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.
2233         */
2234        public EncounterLocationComponent setStatus(EncounterLocationStatus value) { 
2235          if (value == null)
2236            this.status = null;
2237          else {
2238            if (this.status == null)
2239              this.status = new Enumeration<EncounterLocationStatus>(new EncounterLocationStatusEnumFactory());
2240            this.status.setValue(value);
2241          }
2242          return this;
2243        }
2244
2245        /**
2246         * @return {@link #period} (Time period during which the patient was present at the location.)
2247         */
2248        public Period getPeriod() { 
2249          if (this.period == null)
2250            if (Configuration.errorOnAutoCreate())
2251              throw new Error("Attempt to auto-create EncounterLocationComponent.period");
2252            else if (Configuration.doAutoCreate())
2253              this.period = new Period(); // cc
2254          return this.period;
2255        }
2256
2257        public boolean hasPeriod() { 
2258          return this.period != null && !this.period.isEmpty();
2259        }
2260
2261        /**
2262         * @param value {@link #period} (Time period during which the patient was present at the location.)
2263         */
2264        public EncounterLocationComponent setPeriod(Period value)  { 
2265          this.period = value;
2266          return this;
2267        }
2268
2269        protected void listChildren(List<Property> children) {
2270          super.listChildren(children);
2271          children.add(new Property("location", "Reference(Location)", "The location where the encounter takes place.", 0, 1, location));
2272          children.add(new Property("status", "code", "The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.", 0, 1, status));
2273          children.add(new Property("period", "Period", "Time period during which the patient was present at the location.", 0, 1, period));
2274        }
2275
2276        @Override
2277        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2278          switch (_hash) {
2279          case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location where the encounter takes place.", 0, 1, location);
2280          case -892481550: /*status*/  return new Property("status", "code", "The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.", 0, 1, status);
2281          case -991726143: /*period*/  return new Property("period", "Period", "Time period during which the patient was present at the location.", 0, 1, period);
2282          default: return super.getNamedProperty(_hash, _name, _checkValid);
2283          }
2284
2285        }
2286
2287      @Override
2288      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2289        switch (hash) {
2290        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2291        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EncounterLocationStatus>
2292        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
2293        default: return super.getProperty(hash, name, checkValid);
2294        }
2295
2296      }
2297
2298      @Override
2299      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2300        switch (hash) {
2301        case 1901043637: // location
2302          this.location = castToReference(value); // Reference
2303          return value;
2304        case -892481550: // status
2305          value = new EncounterLocationStatusEnumFactory().fromType(castToCode(value));
2306          this.status = (Enumeration) value; // Enumeration<EncounterLocationStatus>
2307          return value;
2308        case -991726143: // period
2309          this.period = castToPeriod(value); // Period
2310          return value;
2311        default: return super.setProperty(hash, name, value);
2312        }
2313
2314      }
2315
2316      @Override
2317      public Base setProperty(String name, Base value) throws FHIRException {
2318        if (name.equals("location")) {
2319          this.location = castToReference(value); // Reference
2320        } else if (name.equals("status")) {
2321          value = new EncounterLocationStatusEnumFactory().fromType(castToCode(value));
2322          this.status = (Enumeration) value; // Enumeration<EncounterLocationStatus>
2323        } else if (name.equals("period")) {
2324          this.period = castToPeriod(value); // Period
2325        } else
2326          return super.setProperty(name, value);
2327        return value;
2328      }
2329
2330      @Override
2331      public Base makeProperty(int hash, String name) throws FHIRException {
2332        switch (hash) {
2333        case 1901043637:  return getLocation(); 
2334        case -892481550:  return getStatusElement();
2335        case -991726143:  return getPeriod(); 
2336        default: return super.makeProperty(hash, name);
2337        }
2338
2339      }
2340
2341      @Override
2342      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2343        switch (hash) {
2344        case 1901043637: /*location*/ return new String[] {"Reference"};
2345        case -892481550: /*status*/ return new String[] {"code"};
2346        case -991726143: /*period*/ return new String[] {"Period"};
2347        default: return super.getTypesForProperty(hash, name);
2348        }
2349
2350      }
2351
2352      @Override
2353      public Base addChild(String name) throws FHIRException {
2354        if (name.equals("location")) {
2355          this.location = new Reference();
2356          return this.location;
2357        }
2358        else if (name.equals("status")) {
2359          throw new FHIRException("Cannot call addChild on a primitive type Encounter.status");
2360        }
2361        else if (name.equals("period")) {
2362          this.period = new Period();
2363          return this.period;
2364        }
2365        else
2366          return super.addChild(name);
2367      }
2368
2369      public EncounterLocationComponent copy() {
2370        EncounterLocationComponent dst = new EncounterLocationComponent();
2371        copyValues(dst);
2372        dst.location = location == null ? null : location.copy();
2373        dst.status = status == null ? null : status.copy();
2374        dst.period = period == null ? null : period.copy();
2375        return dst;
2376      }
2377
2378      @Override
2379      public boolean equalsDeep(Base other_) {
2380        if (!super.equalsDeep(other_))
2381          return false;
2382        if (!(other_ instanceof EncounterLocationComponent))
2383          return false;
2384        EncounterLocationComponent o = (EncounterLocationComponent) other_;
2385        return compareDeep(location, o.location, true) && compareDeep(status, o.status, true) && compareDeep(period, o.period, true)
2386          ;
2387      }
2388
2389      @Override
2390      public boolean equalsShallow(Base other_) {
2391        if (!super.equalsShallow(other_))
2392          return false;
2393        if (!(other_ instanceof EncounterLocationComponent))
2394          return false;
2395        EncounterLocationComponent o = (EncounterLocationComponent) other_;
2396        return compareValues(status, o.status, true);
2397      }
2398
2399      public boolean isEmpty() {
2400        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(location, status, period
2401          );
2402      }
2403
2404  public String fhirType() {
2405    return "Encounter.location";
2406
2407  }
2408
2409  }
2410
2411    /**
2412     * Identifier(s) by which this encounter is known.
2413     */
2414    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2415    @Description(shortDefinition="Identifier(s) by which this encounter is known", formalDefinition="Identifier(s) by which this encounter is known." )
2416    protected List<Identifier> identifier;
2417
2418    /**
2419     * planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
2420     */
2421    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
2422    @Description(shortDefinition="planned | arrived | triaged | in-progress | onleave | finished | cancelled +", formalDefinition="planned | arrived | triaged | in-progress | onleave | finished | cancelled +." )
2423    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-status")
2424    protected Enumeration<EncounterStatus> status;
2425
2426    /**
2427     * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.
2428     */
2429    @Child(name = "statusHistory", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2430    @Description(shortDefinition="List of past encounter statuses", formalDefinition="The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them." )
2431    protected List<StatusHistoryComponent> statusHistory;
2432
2433    /**
2434     * inpatient | outpatient | ambulatory | emergency +.
2435     */
2436    @Child(name = "class", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
2437    @Description(shortDefinition="inpatient | outpatient | ambulatory | emergency +", formalDefinition="inpatient | outpatient | ambulatory | emergency +." )
2438    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActEncounterCode")
2439    protected Coding class_;
2440
2441    /**
2442     * The class history permits the tracking of the encounters transitions without needing to go  through the resource history.
2443
2444This would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.
2445     */
2446    @Child(name = "classHistory", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2447    @Description(shortDefinition="List of past encounter classes", formalDefinition="The class history permits the tracking of the encounters transitions without needing to go  through the resource history.\n\nThis would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient." )
2448    protected List<ClassHistoryComponent> classHistory;
2449
2450    /**
2451     * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).
2452     */
2453    @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2454    @Description(shortDefinition="Specific type of encounter", formalDefinition="Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)." )
2455    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-type")
2456    protected List<CodeableConcept> type;
2457
2458    /**
2459     * Indicates the urgency of the encounter.
2460     */
2461    @Child(name = "priority", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
2462    @Description(shortDefinition="Indicates the urgency of the encounter", formalDefinition="Indicates the urgency of the encounter." )
2463    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActPriority")
2464    protected CodeableConcept priority;
2465
2466    /**
2467     * The patient ro group present at the encounter.
2468     */
2469    @Child(name = "subject", type = {Patient.class, Group.class}, order=7, min=0, max=1, modifier=false, summary=true)
2470    @Description(shortDefinition="The patient ro group present at the encounter", formalDefinition="The patient ro group present at the encounter." )
2471    protected Reference subject;
2472
2473    /**
2474     * The actual object that is the target of the reference (The patient ro group present at the encounter.)
2475     */
2476    protected Resource subjectTarget;
2477
2478    /**
2479     * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).
2480     */
2481    @Child(name = "episodeOfCare", type = {EpisodeOfCare.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2482    @Description(shortDefinition="Episode(s) of care that this encounter should be recorded against", formalDefinition="Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years)." )
2483    protected List<Reference> episodeOfCare;
2484    /**
2485     * The actual objects that are the target of the reference (Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).)
2486     */
2487    protected List<EpisodeOfCare> episodeOfCareTarget;
2488
2489
2490    /**
2491     * The referral request this encounter satisfies (incoming referral).
2492     */
2493    @Child(name = "incomingReferral", type = {ReferralRequest.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2494    @Description(shortDefinition="The ReferralRequest that initiated this encounter", formalDefinition="The referral request this encounter satisfies (incoming referral)." )
2495    protected List<Reference> incomingReferral;
2496    /**
2497     * The actual objects that are the target of the reference (The referral request this encounter satisfies (incoming referral).)
2498     */
2499    protected List<ReferralRequest> incomingReferralTarget;
2500
2501
2502    /**
2503     * The list of people responsible for providing the service.
2504     */
2505    @Child(name = "participant", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2506    @Description(shortDefinition="List of participants involved in the encounter", formalDefinition="The list of people responsible for providing the service." )
2507    protected List<EncounterParticipantComponent> participant;
2508
2509    /**
2510     * The appointment that scheduled this encounter.
2511     */
2512    @Child(name = "appointment", type = {Appointment.class}, order=11, min=0, max=1, modifier=false, summary=true)
2513    @Description(shortDefinition="The appointment that scheduled this encounter", formalDefinition="The appointment that scheduled this encounter." )
2514    protected Reference appointment;
2515
2516    /**
2517     * The actual object that is the target of the reference (The appointment that scheduled this encounter.)
2518     */
2519    protected Appointment appointmentTarget;
2520
2521    /**
2522     * The start and end time of the encounter.
2523     */
2524    @Child(name = "period", type = {Period.class}, order=12, min=0, max=1, modifier=false, summary=false)
2525    @Description(shortDefinition="The start and end time of the encounter", formalDefinition="The start and end time of the encounter." )
2526    protected Period period;
2527
2528    /**
2529     * Quantity of time the encounter lasted. This excludes the time during leaves of absence.
2530     */
2531    @Child(name = "length", type = {Duration.class}, order=13, min=0, max=1, modifier=false, summary=false)
2532    @Description(shortDefinition="Quantity of time the encounter lasted (less time absent)", formalDefinition="Quantity of time the encounter lasted. This excludes the time during leaves of absence." )
2533    protected Duration length;
2534
2535    /**
2536     * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.
2537     */
2538    @Child(name = "reason", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2539    @Description(shortDefinition="Reason the encounter takes place (code)", formalDefinition="Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis." )
2540    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-reason")
2541    protected List<CodeableConcept> reason;
2542
2543    /**
2544     * The list of diagnosis relevant to this encounter.
2545     */
2546    @Child(name = "diagnosis", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2547    @Description(shortDefinition="The list of diagnosis relevant to this encounter", formalDefinition="The list of diagnosis relevant to this encounter." )
2548    protected List<DiagnosisComponent> diagnosis;
2549
2550    /**
2551     * The set of accounts that may be used for billing for this Encounter.
2552     */
2553    @Child(name = "account", type = {Account.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2554    @Description(shortDefinition="The set of accounts that may be used for billing for this Encounter", formalDefinition="The set of accounts that may be used for billing for this Encounter." )
2555    protected List<Reference> account;
2556    /**
2557     * The actual objects that are the target of the reference (The set of accounts that may be used for billing for this Encounter.)
2558     */
2559    protected List<Account> accountTarget;
2560
2561
2562    /**
2563     * Details about the admission to a healthcare service.
2564     */
2565    @Child(name = "hospitalization", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
2566    @Description(shortDefinition="Details about the admission to a healthcare service", formalDefinition="Details about the admission to a healthcare service." )
2567    protected EncounterHospitalizationComponent hospitalization;
2568
2569    /**
2570     * List of locations where  the patient has been during this encounter.
2571     */
2572    @Child(name = "location", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2573    @Description(shortDefinition="List of locations where the patient has been", formalDefinition="List of locations where  the patient has been during this encounter." )
2574    protected List<EncounterLocationComponent> location;
2575
2576    /**
2577     * An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.
2578     */
2579    @Child(name = "serviceProvider", type = {Organization.class}, order=19, min=0, max=1, modifier=false, summary=false)
2580    @Description(shortDefinition="The custodian organization of this Encounter record", formalDefinition="An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization." )
2581    protected Reference serviceProvider;
2582
2583    /**
2584     * The actual object that is the target of the reference (An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.)
2585     */
2586    protected Organization serviceProviderTarget;
2587
2588    /**
2589     * Another Encounter of which this encounter is a part of (administratively or in time).
2590     */
2591    @Child(name = "partOf", type = {Encounter.class}, order=20, min=0, max=1, modifier=false, summary=false)
2592    @Description(shortDefinition="Another Encounter this encounter is part of", formalDefinition="Another Encounter of which this encounter is a part of (administratively or in time)." )
2593    protected Reference partOf;
2594
2595    /**
2596     * The actual object that is the target of the reference (Another Encounter of which this encounter is a part of (administratively or in time).)
2597     */
2598    protected Encounter partOfTarget;
2599
2600    private static final long serialVersionUID = 2124102382L;
2601
2602  /**
2603   * Constructor
2604   */
2605    public Encounter() {
2606      super();
2607    }
2608
2609  /**
2610   * Constructor
2611   */
2612    public Encounter(Enumeration<EncounterStatus> status) {
2613      super();
2614      this.status = status;
2615    }
2616
2617    /**
2618     * @return {@link #identifier} (Identifier(s) by which this encounter is known.)
2619     */
2620    public List<Identifier> getIdentifier() { 
2621      if (this.identifier == null)
2622        this.identifier = new ArrayList<Identifier>();
2623      return this.identifier;
2624    }
2625
2626    /**
2627     * @return Returns a reference to <code>this</code> for easy method chaining
2628     */
2629    public Encounter setIdentifier(List<Identifier> theIdentifier) { 
2630      this.identifier = theIdentifier;
2631      return this;
2632    }
2633
2634    public boolean hasIdentifier() { 
2635      if (this.identifier == null)
2636        return false;
2637      for (Identifier item : this.identifier)
2638        if (!item.isEmpty())
2639          return true;
2640      return false;
2641    }
2642
2643    public Identifier addIdentifier() { //3
2644      Identifier t = new Identifier();
2645      if (this.identifier == null)
2646        this.identifier = new ArrayList<Identifier>();
2647      this.identifier.add(t);
2648      return t;
2649    }
2650
2651    public Encounter addIdentifier(Identifier t) { //3
2652      if (t == null)
2653        return this;
2654      if (this.identifier == null)
2655        this.identifier = new ArrayList<Identifier>();
2656      this.identifier.add(t);
2657      return this;
2658    }
2659
2660    /**
2661     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2662     */
2663    public Identifier getIdentifierFirstRep() { 
2664      if (getIdentifier().isEmpty()) {
2665        addIdentifier();
2666      }
2667      return getIdentifier().get(0);
2668    }
2669
2670    /**
2671     * @return {@link #status} (planned | arrived | triaged | in-progress | onleave | finished | cancelled +.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2672     */
2673    public Enumeration<EncounterStatus> getStatusElement() { 
2674      if (this.status == null)
2675        if (Configuration.errorOnAutoCreate())
2676          throw new Error("Attempt to auto-create Encounter.status");
2677        else if (Configuration.doAutoCreate())
2678          this.status = new Enumeration<EncounterStatus>(new EncounterStatusEnumFactory()); // bb
2679      return this.status;
2680    }
2681
2682    public boolean hasStatusElement() { 
2683      return this.status != null && !this.status.isEmpty();
2684    }
2685
2686    public boolean hasStatus() { 
2687      return this.status != null && !this.status.isEmpty();
2688    }
2689
2690    /**
2691     * @param value {@link #status} (planned | arrived | triaged | in-progress | onleave | finished | cancelled +.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2692     */
2693    public Encounter setStatusElement(Enumeration<EncounterStatus> value) { 
2694      this.status = value;
2695      return this;
2696    }
2697
2698    /**
2699     * @return planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
2700     */
2701    public EncounterStatus getStatus() { 
2702      return this.status == null ? null : this.status.getValue();
2703    }
2704
2705    /**
2706     * @param value planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
2707     */
2708    public Encounter setStatus(EncounterStatus value) { 
2709        if (this.status == null)
2710          this.status = new Enumeration<EncounterStatus>(new EncounterStatusEnumFactory());
2711        this.status.setValue(value);
2712      return this;
2713    }
2714
2715    /**
2716     * @return {@link #statusHistory} (The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.)
2717     */
2718    public List<StatusHistoryComponent> getStatusHistory() { 
2719      if (this.statusHistory == null)
2720        this.statusHistory = new ArrayList<StatusHistoryComponent>();
2721      return this.statusHistory;
2722    }
2723
2724    /**
2725     * @return Returns a reference to <code>this</code> for easy method chaining
2726     */
2727    public Encounter setStatusHistory(List<StatusHistoryComponent> theStatusHistory) { 
2728      this.statusHistory = theStatusHistory;
2729      return this;
2730    }
2731
2732    public boolean hasStatusHistory() { 
2733      if (this.statusHistory == null)
2734        return false;
2735      for (StatusHistoryComponent item : this.statusHistory)
2736        if (!item.isEmpty())
2737          return true;
2738      return false;
2739    }
2740
2741    public StatusHistoryComponent addStatusHistory() { //3
2742      StatusHistoryComponent t = new StatusHistoryComponent();
2743      if (this.statusHistory == null)
2744        this.statusHistory = new ArrayList<StatusHistoryComponent>();
2745      this.statusHistory.add(t);
2746      return t;
2747    }
2748
2749    public Encounter addStatusHistory(StatusHistoryComponent t) { //3
2750      if (t == null)
2751        return this;
2752      if (this.statusHistory == null)
2753        this.statusHistory = new ArrayList<StatusHistoryComponent>();
2754      this.statusHistory.add(t);
2755      return this;
2756    }
2757
2758    /**
2759     * @return The first repetition of repeating field {@link #statusHistory}, creating it if it does not already exist
2760     */
2761    public StatusHistoryComponent getStatusHistoryFirstRep() { 
2762      if (getStatusHistory().isEmpty()) {
2763        addStatusHistory();
2764      }
2765      return getStatusHistory().get(0);
2766    }
2767
2768    /**
2769     * @return {@link #class_} (inpatient | outpatient | ambulatory | emergency +.)
2770     */
2771    public Coding getClass_() { 
2772      if (this.class_ == null)
2773        if (Configuration.errorOnAutoCreate())
2774          throw new Error("Attempt to auto-create Encounter.class_");
2775        else if (Configuration.doAutoCreate())
2776          this.class_ = new Coding(); // cc
2777      return this.class_;
2778    }
2779
2780    public boolean hasClass_() { 
2781      return this.class_ != null && !this.class_.isEmpty();
2782    }
2783
2784    /**
2785     * @param value {@link #class_} (inpatient | outpatient | ambulatory | emergency +.)
2786     */
2787    public Encounter setClass_(Coding value)  { 
2788      this.class_ = value;
2789      return this;
2790    }
2791
2792    /**
2793     * @return {@link #classHistory} (The class history permits the tracking of the encounters transitions without needing to go  through the resource history.
2794
2795This would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.)
2796     */
2797    public List<ClassHistoryComponent> getClassHistory() { 
2798      if (this.classHistory == null)
2799        this.classHistory = new ArrayList<ClassHistoryComponent>();
2800      return this.classHistory;
2801    }
2802
2803    /**
2804     * @return Returns a reference to <code>this</code> for easy method chaining
2805     */
2806    public Encounter setClassHistory(List<ClassHistoryComponent> theClassHistory) { 
2807      this.classHistory = theClassHistory;
2808      return this;
2809    }
2810
2811    public boolean hasClassHistory() { 
2812      if (this.classHistory == null)
2813        return false;
2814      for (ClassHistoryComponent item : this.classHistory)
2815        if (!item.isEmpty())
2816          return true;
2817      return false;
2818    }
2819
2820    public ClassHistoryComponent addClassHistory() { //3
2821      ClassHistoryComponent t = new ClassHistoryComponent();
2822      if (this.classHistory == null)
2823        this.classHistory = new ArrayList<ClassHistoryComponent>();
2824      this.classHistory.add(t);
2825      return t;
2826    }
2827
2828    public Encounter addClassHistory(ClassHistoryComponent t) { //3
2829      if (t == null)
2830        return this;
2831      if (this.classHistory == null)
2832        this.classHistory = new ArrayList<ClassHistoryComponent>();
2833      this.classHistory.add(t);
2834      return this;
2835    }
2836
2837    /**
2838     * @return The first repetition of repeating field {@link #classHistory}, creating it if it does not already exist
2839     */
2840    public ClassHistoryComponent getClassHistoryFirstRep() { 
2841      if (getClassHistory().isEmpty()) {
2842        addClassHistory();
2843      }
2844      return getClassHistory().get(0);
2845    }
2846
2847    /**
2848     * @return {@link #type} (Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).)
2849     */
2850    public List<CodeableConcept> getType() { 
2851      if (this.type == null)
2852        this.type = new ArrayList<CodeableConcept>();
2853      return this.type;
2854    }
2855
2856    /**
2857     * @return Returns a reference to <code>this</code> for easy method chaining
2858     */
2859    public Encounter setType(List<CodeableConcept> theType) { 
2860      this.type = theType;
2861      return this;
2862    }
2863
2864    public boolean hasType() { 
2865      if (this.type == null)
2866        return false;
2867      for (CodeableConcept item : this.type)
2868        if (!item.isEmpty())
2869          return true;
2870      return false;
2871    }
2872
2873    public CodeableConcept addType() { //3
2874      CodeableConcept t = new CodeableConcept();
2875      if (this.type == null)
2876        this.type = new ArrayList<CodeableConcept>();
2877      this.type.add(t);
2878      return t;
2879    }
2880
2881    public Encounter addType(CodeableConcept t) { //3
2882      if (t == null)
2883        return this;
2884      if (this.type == null)
2885        this.type = new ArrayList<CodeableConcept>();
2886      this.type.add(t);
2887      return this;
2888    }
2889
2890    /**
2891     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2892     */
2893    public CodeableConcept getTypeFirstRep() { 
2894      if (getType().isEmpty()) {
2895        addType();
2896      }
2897      return getType().get(0);
2898    }
2899
2900    /**
2901     * @return {@link #priority} (Indicates the urgency of the encounter.)
2902     */
2903    public CodeableConcept getPriority() { 
2904      if (this.priority == null)
2905        if (Configuration.errorOnAutoCreate())
2906          throw new Error("Attempt to auto-create Encounter.priority");
2907        else if (Configuration.doAutoCreate())
2908          this.priority = new CodeableConcept(); // cc
2909      return this.priority;
2910    }
2911
2912    public boolean hasPriority() { 
2913      return this.priority != null && !this.priority.isEmpty();
2914    }
2915
2916    /**
2917     * @param value {@link #priority} (Indicates the urgency of the encounter.)
2918     */
2919    public Encounter setPriority(CodeableConcept value)  { 
2920      this.priority = value;
2921      return this;
2922    }
2923
2924    /**
2925     * @return {@link #subject} (The patient ro group present at the encounter.)
2926     */
2927    public Reference getSubject() { 
2928      if (this.subject == null)
2929        if (Configuration.errorOnAutoCreate())
2930          throw new Error("Attempt to auto-create Encounter.subject");
2931        else if (Configuration.doAutoCreate())
2932          this.subject = new Reference(); // cc
2933      return this.subject;
2934    }
2935
2936    public boolean hasSubject() { 
2937      return this.subject != null && !this.subject.isEmpty();
2938    }
2939
2940    /**
2941     * @param value {@link #subject} (The patient ro group present at the encounter.)
2942     */
2943    public Encounter setSubject(Reference value)  { 
2944      this.subject = value;
2945      return this;
2946    }
2947
2948    /**
2949     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient ro group present at the encounter.)
2950     */
2951    public Resource getSubjectTarget() { 
2952      return this.subjectTarget;
2953    }
2954
2955    /**
2956     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient ro group present at the encounter.)
2957     */
2958    public Encounter setSubjectTarget(Resource value) { 
2959      this.subjectTarget = value;
2960      return this;
2961    }
2962
2963    /**
2964     * @return {@link #episodeOfCare} (Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).)
2965     */
2966    public List<Reference> getEpisodeOfCare() { 
2967      if (this.episodeOfCare == null)
2968        this.episodeOfCare = new ArrayList<Reference>();
2969      return this.episodeOfCare;
2970    }
2971
2972    /**
2973     * @return Returns a reference to <code>this</code> for easy method chaining
2974     */
2975    public Encounter setEpisodeOfCare(List<Reference> theEpisodeOfCare) { 
2976      this.episodeOfCare = theEpisodeOfCare;
2977      return this;
2978    }
2979
2980    public boolean hasEpisodeOfCare() { 
2981      if (this.episodeOfCare == null)
2982        return false;
2983      for (Reference item : this.episodeOfCare)
2984        if (!item.isEmpty())
2985          return true;
2986      return false;
2987    }
2988
2989    public Reference addEpisodeOfCare() { //3
2990      Reference t = new Reference();
2991      if (this.episodeOfCare == null)
2992        this.episodeOfCare = new ArrayList<Reference>();
2993      this.episodeOfCare.add(t);
2994      return t;
2995    }
2996
2997    public Encounter addEpisodeOfCare(Reference t) { //3
2998      if (t == null)
2999        return this;
3000      if (this.episodeOfCare == null)
3001        this.episodeOfCare = new ArrayList<Reference>();
3002      this.episodeOfCare.add(t);
3003      return this;
3004    }
3005
3006    /**
3007     * @return The first repetition of repeating field {@link #episodeOfCare}, creating it if it does not already exist
3008     */
3009    public Reference getEpisodeOfCareFirstRep() { 
3010      if (getEpisodeOfCare().isEmpty()) {
3011        addEpisodeOfCare();
3012      }
3013      return getEpisodeOfCare().get(0);
3014    }
3015
3016    /**
3017     * @deprecated Use Reference#setResource(IBaseResource) instead
3018     */
3019    @Deprecated
3020    public List<EpisodeOfCare> getEpisodeOfCareTarget() { 
3021      if (this.episodeOfCareTarget == null)
3022        this.episodeOfCareTarget = new ArrayList<EpisodeOfCare>();
3023      return this.episodeOfCareTarget;
3024    }
3025
3026    /**
3027     * @deprecated Use Reference#setResource(IBaseResource) instead
3028     */
3029    @Deprecated
3030    public EpisodeOfCare addEpisodeOfCareTarget() { 
3031      EpisodeOfCare r = new EpisodeOfCare();
3032      if (this.episodeOfCareTarget == null)
3033        this.episodeOfCareTarget = new ArrayList<EpisodeOfCare>();
3034      this.episodeOfCareTarget.add(r);
3035      return r;
3036    }
3037
3038    /**
3039     * @return {@link #incomingReferral} (The referral request this encounter satisfies (incoming referral).)
3040     */
3041    public List<Reference> getIncomingReferral() { 
3042      if (this.incomingReferral == null)
3043        this.incomingReferral = new ArrayList<Reference>();
3044      return this.incomingReferral;
3045    }
3046
3047    /**
3048     * @return Returns a reference to <code>this</code> for easy method chaining
3049     */
3050    public Encounter setIncomingReferral(List<Reference> theIncomingReferral) { 
3051      this.incomingReferral = theIncomingReferral;
3052      return this;
3053    }
3054
3055    public boolean hasIncomingReferral() { 
3056      if (this.incomingReferral == null)
3057        return false;
3058      for (Reference item : this.incomingReferral)
3059        if (!item.isEmpty())
3060          return true;
3061      return false;
3062    }
3063
3064    public Reference addIncomingReferral() { //3
3065      Reference t = new Reference();
3066      if (this.incomingReferral == null)
3067        this.incomingReferral = new ArrayList<Reference>();
3068      this.incomingReferral.add(t);
3069      return t;
3070    }
3071
3072    public Encounter addIncomingReferral(Reference t) { //3
3073      if (t == null)
3074        return this;
3075      if (this.incomingReferral == null)
3076        this.incomingReferral = new ArrayList<Reference>();
3077      this.incomingReferral.add(t);
3078      return this;
3079    }
3080
3081    /**
3082     * @return The first repetition of repeating field {@link #incomingReferral}, creating it if it does not already exist
3083     */
3084    public Reference getIncomingReferralFirstRep() { 
3085      if (getIncomingReferral().isEmpty()) {
3086        addIncomingReferral();
3087      }
3088      return getIncomingReferral().get(0);
3089    }
3090
3091    /**
3092     * @deprecated Use Reference#setResource(IBaseResource) instead
3093     */
3094    @Deprecated
3095    public List<ReferralRequest> getIncomingReferralTarget() { 
3096      if (this.incomingReferralTarget == null)
3097        this.incomingReferralTarget = new ArrayList<ReferralRequest>();
3098      return this.incomingReferralTarget;
3099    }
3100
3101    /**
3102     * @deprecated Use Reference#setResource(IBaseResource) instead
3103     */
3104    @Deprecated
3105    public ReferralRequest addIncomingReferralTarget() { 
3106      ReferralRequest r = new ReferralRequest();
3107      if (this.incomingReferralTarget == null)
3108        this.incomingReferralTarget = new ArrayList<ReferralRequest>();
3109      this.incomingReferralTarget.add(r);
3110      return r;
3111    }
3112
3113    /**
3114     * @return {@link #participant} (The list of people responsible for providing the service.)
3115     */
3116    public List<EncounterParticipantComponent> getParticipant() { 
3117      if (this.participant == null)
3118        this.participant = new ArrayList<EncounterParticipantComponent>();
3119      return this.participant;
3120    }
3121
3122    /**
3123     * @return Returns a reference to <code>this</code> for easy method chaining
3124     */
3125    public Encounter setParticipant(List<EncounterParticipantComponent> theParticipant) { 
3126      this.participant = theParticipant;
3127      return this;
3128    }
3129
3130    public boolean hasParticipant() { 
3131      if (this.participant == null)
3132        return false;
3133      for (EncounterParticipantComponent item : this.participant)
3134        if (!item.isEmpty())
3135          return true;
3136      return false;
3137    }
3138
3139    public EncounterParticipantComponent addParticipant() { //3
3140      EncounterParticipantComponent t = new EncounterParticipantComponent();
3141      if (this.participant == null)
3142        this.participant = new ArrayList<EncounterParticipantComponent>();
3143      this.participant.add(t);
3144      return t;
3145    }
3146
3147    public Encounter addParticipant(EncounterParticipantComponent t) { //3
3148      if (t == null)
3149        return this;
3150      if (this.participant == null)
3151        this.participant = new ArrayList<EncounterParticipantComponent>();
3152      this.participant.add(t);
3153      return this;
3154    }
3155
3156    /**
3157     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist
3158     */
3159    public EncounterParticipantComponent getParticipantFirstRep() { 
3160      if (getParticipant().isEmpty()) {
3161        addParticipant();
3162      }
3163      return getParticipant().get(0);
3164    }
3165
3166    /**
3167     * @return {@link #appointment} (The appointment that scheduled this encounter.)
3168     */
3169    public Reference getAppointment() { 
3170      if (this.appointment == null)
3171        if (Configuration.errorOnAutoCreate())
3172          throw new Error("Attempt to auto-create Encounter.appointment");
3173        else if (Configuration.doAutoCreate())
3174          this.appointment = new Reference(); // cc
3175      return this.appointment;
3176    }
3177
3178    public boolean hasAppointment() { 
3179      return this.appointment != null && !this.appointment.isEmpty();
3180    }
3181
3182    /**
3183     * @param value {@link #appointment} (The appointment that scheduled this encounter.)
3184     */
3185    public Encounter setAppointment(Reference value)  { 
3186      this.appointment = value;
3187      return this;
3188    }
3189
3190    /**
3191     * @return {@link #appointment} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The appointment that scheduled this encounter.)
3192     */
3193    public Appointment getAppointmentTarget() { 
3194      if (this.appointmentTarget == null)
3195        if (Configuration.errorOnAutoCreate())
3196          throw new Error("Attempt to auto-create Encounter.appointment");
3197        else if (Configuration.doAutoCreate())
3198          this.appointmentTarget = new Appointment(); // aa
3199      return this.appointmentTarget;
3200    }
3201
3202    /**
3203     * @param value {@link #appointment} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The appointment that scheduled this encounter.)
3204     */
3205    public Encounter setAppointmentTarget(Appointment value) { 
3206      this.appointmentTarget = value;
3207      return this;
3208    }
3209
3210    /**
3211     * @return {@link #period} (The start and end time of the encounter.)
3212     */
3213    public Period getPeriod() { 
3214      if (this.period == null)
3215        if (Configuration.errorOnAutoCreate())
3216          throw new Error("Attempt to auto-create Encounter.period");
3217        else if (Configuration.doAutoCreate())
3218          this.period = new Period(); // cc
3219      return this.period;
3220    }
3221
3222    public boolean hasPeriod() { 
3223      return this.period != null && !this.period.isEmpty();
3224    }
3225
3226    /**
3227     * @param value {@link #period} (The start and end time of the encounter.)
3228     */
3229    public Encounter setPeriod(Period value)  { 
3230      this.period = value;
3231      return this;
3232    }
3233
3234    /**
3235     * @return {@link #length} (Quantity of time the encounter lasted. This excludes the time during leaves of absence.)
3236     */
3237    public Duration getLength() { 
3238      if (this.length == null)
3239        if (Configuration.errorOnAutoCreate())
3240          throw new Error("Attempt to auto-create Encounter.length");
3241        else if (Configuration.doAutoCreate())
3242          this.length = new Duration(); // cc
3243      return this.length;
3244    }
3245
3246    public boolean hasLength() { 
3247      return this.length != null && !this.length.isEmpty();
3248    }
3249
3250    /**
3251     * @param value {@link #length} (Quantity of time the encounter lasted. This excludes the time during leaves of absence.)
3252     */
3253    public Encounter setLength(Duration value)  { 
3254      this.length = value;
3255      return this;
3256    }
3257
3258    /**
3259     * @return {@link #reason} (Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.)
3260     */
3261    public List<CodeableConcept> getReason() { 
3262      if (this.reason == null)
3263        this.reason = new ArrayList<CodeableConcept>();
3264      return this.reason;
3265    }
3266
3267    /**
3268     * @return Returns a reference to <code>this</code> for easy method chaining
3269     */
3270    public Encounter setReason(List<CodeableConcept> theReason) { 
3271      this.reason = theReason;
3272      return this;
3273    }
3274
3275    public boolean hasReason() { 
3276      if (this.reason == null)
3277        return false;
3278      for (CodeableConcept item : this.reason)
3279        if (!item.isEmpty())
3280          return true;
3281      return false;
3282    }
3283
3284    public CodeableConcept addReason() { //3
3285      CodeableConcept t = new CodeableConcept();
3286      if (this.reason == null)
3287        this.reason = new ArrayList<CodeableConcept>();
3288      this.reason.add(t);
3289      return t;
3290    }
3291
3292    public Encounter addReason(CodeableConcept t) { //3
3293      if (t == null)
3294        return this;
3295      if (this.reason == null)
3296        this.reason = new ArrayList<CodeableConcept>();
3297      this.reason.add(t);
3298      return this;
3299    }
3300
3301    /**
3302     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist
3303     */
3304    public CodeableConcept getReasonFirstRep() { 
3305      if (getReason().isEmpty()) {
3306        addReason();
3307      }
3308      return getReason().get(0);
3309    }
3310
3311    /**
3312     * @return {@link #diagnosis} (The list of diagnosis relevant to this encounter.)
3313     */
3314    public List<DiagnosisComponent> getDiagnosis() { 
3315      if (this.diagnosis == null)
3316        this.diagnosis = new ArrayList<DiagnosisComponent>();
3317      return this.diagnosis;
3318    }
3319
3320    /**
3321     * @return Returns a reference to <code>this</code> for easy method chaining
3322     */
3323    public Encounter setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
3324      this.diagnosis = theDiagnosis;
3325      return this;
3326    }
3327
3328    public boolean hasDiagnosis() { 
3329      if (this.diagnosis == null)
3330        return false;
3331      for (DiagnosisComponent item : this.diagnosis)
3332        if (!item.isEmpty())
3333          return true;
3334      return false;
3335    }
3336
3337    public DiagnosisComponent addDiagnosis() { //3
3338      DiagnosisComponent t = new DiagnosisComponent();
3339      if (this.diagnosis == null)
3340        this.diagnosis = new ArrayList<DiagnosisComponent>();
3341      this.diagnosis.add(t);
3342      return t;
3343    }
3344
3345    public Encounter addDiagnosis(DiagnosisComponent t) { //3
3346      if (t == null)
3347        return this;
3348      if (this.diagnosis == null)
3349        this.diagnosis = new ArrayList<DiagnosisComponent>();
3350      this.diagnosis.add(t);
3351      return this;
3352    }
3353
3354    /**
3355     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
3356     */
3357    public DiagnosisComponent getDiagnosisFirstRep() { 
3358      if (getDiagnosis().isEmpty()) {
3359        addDiagnosis();
3360      }
3361      return getDiagnosis().get(0);
3362    }
3363
3364    /**
3365     * @return {@link #account} (The set of accounts that may be used for billing for this Encounter.)
3366     */
3367    public List<Reference> getAccount() { 
3368      if (this.account == null)
3369        this.account = new ArrayList<Reference>();
3370      return this.account;
3371    }
3372
3373    /**
3374     * @return Returns a reference to <code>this</code> for easy method chaining
3375     */
3376    public Encounter setAccount(List<Reference> theAccount) { 
3377      this.account = theAccount;
3378      return this;
3379    }
3380
3381    public boolean hasAccount() { 
3382      if (this.account == null)
3383        return false;
3384      for (Reference item : this.account)
3385        if (!item.isEmpty())
3386          return true;
3387      return false;
3388    }
3389
3390    public Reference addAccount() { //3
3391      Reference t = new Reference();
3392      if (this.account == null)
3393        this.account = new ArrayList<Reference>();
3394      this.account.add(t);
3395      return t;
3396    }
3397
3398    public Encounter addAccount(Reference t) { //3
3399      if (t == null)
3400        return this;
3401      if (this.account == null)
3402        this.account = new ArrayList<Reference>();
3403      this.account.add(t);
3404      return this;
3405    }
3406
3407    /**
3408     * @return The first repetition of repeating field {@link #account}, creating it if it does not already exist
3409     */
3410    public Reference getAccountFirstRep() { 
3411      if (getAccount().isEmpty()) {
3412        addAccount();
3413      }
3414      return getAccount().get(0);
3415    }
3416
3417    /**
3418     * @deprecated Use Reference#setResource(IBaseResource) instead
3419     */
3420    @Deprecated
3421    public List<Account> getAccountTarget() { 
3422      if (this.accountTarget == null)
3423        this.accountTarget = new ArrayList<Account>();
3424      return this.accountTarget;
3425    }
3426
3427    /**
3428     * @deprecated Use Reference#setResource(IBaseResource) instead
3429     */
3430    @Deprecated
3431    public Account addAccountTarget() { 
3432      Account r = new Account();
3433      if (this.accountTarget == null)
3434        this.accountTarget = new ArrayList<Account>();
3435      this.accountTarget.add(r);
3436      return r;
3437    }
3438
3439    /**
3440     * @return {@link #hospitalization} (Details about the admission to a healthcare service.)
3441     */
3442    public EncounterHospitalizationComponent getHospitalization() { 
3443      if (this.hospitalization == null)
3444        if (Configuration.errorOnAutoCreate())
3445          throw new Error("Attempt to auto-create Encounter.hospitalization");
3446        else if (Configuration.doAutoCreate())
3447          this.hospitalization = new EncounterHospitalizationComponent(); // cc
3448      return this.hospitalization;
3449    }
3450
3451    public boolean hasHospitalization() { 
3452      return this.hospitalization != null && !this.hospitalization.isEmpty();
3453    }
3454
3455    /**
3456     * @param value {@link #hospitalization} (Details about the admission to a healthcare service.)
3457     */
3458    public Encounter setHospitalization(EncounterHospitalizationComponent value)  { 
3459      this.hospitalization = value;
3460      return this;
3461    }
3462
3463    /**
3464     * @return {@link #location} (List of locations where  the patient has been during this encounter.)
3465     */
3466    public List<EncounterLocationComponent> getLocation() { 
3467      if (this.location == null)
3468        this.location = new ArrayList<EncounterLocationComponent>();
3469      return this.location;
3470    }
3471
3472    /**
3473     * @return Returns a reference to <code>this</code> for easy method chaining
3474     */
3475    public Encounter setLocation(List<EncounterLocationComponent> theLocation) { 
3476      this.location = theLocation;
3477      return this;
3478    }
3479
3480    public boolean hasLocation() { 
3481      if (this.location == null)
3482        return false;
3483      for (EncounterLocationComponent item : this.location)
3484        if (!item.isEmpty())
3485          return true;
3486      return false;
3487    }
3488
3489    public EncounterLocationComponent addLocation() { //3
3490      EncounterLocationComponent t = new EncounterLocationComponent();
3491      if (this.location == null)
3492        this.location = new ArrayList<EncounterLocationComponent>();
3493      this.location.add(t);
3494      return t;
3495    }
3496
3497    public Encounter addLocation(EncounterLocationComponent t) { //3
3498      if (t == null)
3499        return this;
3500      if (this.location == null)
3501        this.location = new ArrayList<EncounterLocationComponent>();
3502      this.location.add(t);
3503      return this;
3504    }
3505
3506    /**
3507     * @return The first repetition of repeating field {@link #location}, creating it if it does not already exist
3508     */
3509    public EncounterLocationComponent getLocationFirstRep() { 
3510      if (getLocation().isEmpty()) {
3511        addLocation();
3512      }
3513      return getLocation().get(0);
3514    }
3515
3516    /**
3517     * @return {@link #serviceProvider} (An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.)
3518     */
3519    public Reference getServiceProvider() { 
3520      if (this.serviceProvider == null)
3521        if (Configuration.errorOnAutoCreate())
3522          throw new Error("Attempt to auto-create Encounter.serviceProvider");
3523        else if (Configuration.doAutoCreate())
3524          this.serviceProvider = new Reference(); // cc
3525      return this.serviceProvider;
3526    }
3527
3528    public boolean hasServiceProvider() { 
3529      return this.serviceProvider != null && !this.serviceProvider.isEmpty();
3530    }
3531
3532    /**
3533     * @param value {@link #serviceProvider} (An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.)
3534     */
3535    public Encounter setServiceProvider(Reference value)  { 
3536      this.serviceProvider = value;
3537      return this;
3538    }
3539
3540    /**
3541     * @return {@link #serviceProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.)
3542     */
3543    public Organization getServiceProviderTarget() { 
3544      if (this.serviceProviderTarget == null)
3545        if (Configuration.errorOnAutoCreate())
3546          throw new Error("Attempt to auto-create Encounter.serviceProvider");
3547        else if (Configuration.doAutoCreate())
3548          this.serviceProviderTarget = new Organization(); // aa
3549      return this.serviceProviderTarget;
3550    }
3551
3552    /**
3553     * @param value {@link #serviceProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.)
3554     */
3555    public Encounter setServiceProviderTarget(Organization value) { 
3556      this.serviceProviderTarget = value;
3557      return this;
3558    }
3559
3560    /**
3561     * @return {@link #partOf} (Another Encounter of which this encounter is a part of (administratively or in time).)
3562     */
3563    public Reference getPartOf() { 
3564      if (this.partOf == null)
3565        if (Configuration.errorOnAutoCreate())
3566          throw new Error("Attempt to auto-create Encounter.partOf");
3567        else if (Configuration.doAutoCreate())
3568          this.partOf = new Reference(); // cc
3569      return this.partOf;
3570    }
3571
3572    public boolean hasPartOf() { 
3573      return this.partOf != null && !this.partOf.isEmpty();
3574    }
3575
3576    /**
3577     * @param value {@link #partOf} (Another Encounter of which this encounter is a part of (administratively or in time).)
3578     */
3579    public Encounter setPartOf(Reference value)  { 
3580      this.partOf = value;
3581      return this;
3582    }
3583
3584    /**
3585     * @return {@link #partOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Another Encounter of which this encounter is a part of (administratively or in time).)
3586     */
3587    public Encounter getPartOfTarget() { 
3588      if (this.partOfTarget == null)
3589        if (Configuration.errorOnAutoCreate())
3590          throw new Error("Attempt to auto-create Encounter.partOf");
3591        else if (Configuration.doAutoCreate())
3592          this.partOfTarget = new Encounter(); // aa
3593      return this.partOfTarget;
3594    }
3595
3596    /**
3597     * @param value {@link #partOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Another Encounter of which this encounter is a part of (administratively or in time).)
3598     */
3599    public Encounter setPartOfTarget(Encounter value) { 
3600      this.partOfTarget = value;
3601      return this;
3602    }
3603
3604      protected void listChildren(List<Property> children) {
3605        super.listChildren(children);
3606        children.add(new Property("identifier", "Identifier", "Identifier(s) by which this encounter is known.", 0, java.lang.Integer.MAX_VALUE, identifier));
3607        children.add(new Property("status", "code", "planned | arrived | triaged | in-progress | onleave | finished | cancelled +.", 0, 1, status));
3608        children.add(new Property("statusHistory", "", "The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.", 0, java.lang.Integer.MAX_VALUE, statusHistory));
3609        children.add(new Property("class", "Coding", "inpatient | outpatient | ambulatory | emergency +.", 0, 1, class_));
3610        children.add(new Property("classHistory", "", "The class history permits the tracking of the encounters transitions without needing to go  through the resource history.\n\nThis would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.", 0, java.lang.Integer.MAX_VALUE, classHistory));
3611        children.add(new Property("type", "CodeableConcept", "Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).", 0, java.lang.Integer.MAX_VALUE, type));
3612        children.add(new Property("priority", "CodeableConcept", "Indicates the urgency of the encounter.", 0, 1, priority));
3613        children.add(new Property("subject", "Reference(Patient|Group)", "The patient ro group present at the encounter.", 0, 1, subject));
3614        children.add(new Property("episodeOfCare", "Reference(EpisodeOfCare)", "Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).", 0, java.lang.Integer.MAX_VALUE, episodeOfCare));
3615        children.add(new Property("incomingReferral", "Reference(ReferralRequest)", "The referral request this encounter satisfies (incoming referral).", 0, java.lang.Integer.MAX_VALUE, incomingReferral));
3616        children.add(new Property("participant", "", "The list of people responsible for providing the service.", 0, java.lang.Integer.MAX_VALUE, participant));
3617        children.add(new Property("appointment", "Reference(Appointment)", "The appointment that scheduled this encounter.", 0, 1, appointment));
3618        children.add(new Property("period", "Period", "The start and end time of the encounter.", 0, 1, period));
3619        children.add(new Property("length", "Duration", "Quantity of time the encounter lasted. This excludes the time during leaves of absence.", 0, 1, length));
3620        children.add(new Property("reason", "CodeableConcept", "Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.", 0, java.lang.Integer.MAX_VALUE, reason));
3621        children.add(new Property("diagnosis", "", "The list of diagnosis relevant to this encounter.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
3622        children.add(new Property("account", "Reference(Account)", "The set of accounts that may be used for billing for this Encounter.", 0, java.lang.Integer.MAX_VALUE, account));
3623        children.add(new Property("hospitalization", "", "Details about the admission to a healthcare service.", 0, 1, hospitalization));
3624        children.add(new Property("location", "", "List of locations where  the patient has been during this encounter.", 0, java.lang.Integer.MAX_VALUE, location));
3625        children.add(new Property("serviceProvider", "Reference(Organization)", "An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.", 0, 1, serviceProvider));
3626        children.add(new Property("partOf", "Reference(Encounter)", "Another Encounter of which this encounter is a part of (administratively or in time).", 0, 1, partOf));
3627      }
3628
3629      @Override
3630      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3631        switch (_hash) {
3632        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier(s) by which this encounter is known.", 0, java.lang.Integer.MAX_VALUE, identifier);
3633        case -892481550: /*status*/  return new Property("status", "code", "planned | arrived | triaged | in-progress | onleave | finished | cancelled +.", 0, 1, status);
3634        case -986695614: /*statusHistory*/  return new Property("statusHistory", "", "The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.", 0, java.lang.Integer.MAX_VALUE, statusHistory);
3635        case 94742904: /*class*/  return new Property("class", "Coding", "inpatient | outpatient | ambulatory | emergency +.", 0, 1, class_);
3636        case 962575356: /*classHistory*/  return new Property("classHistory", "", "The class history permits the tracking of the encounters transitions without needing to go  through the resource history.\n\nThis would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.", 0, java.lang.Integer.MAX_VALUE, classHistory);
3637        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).", 0, java.lang.Integer.MAX_VALUE, type);
3638        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "Indicates the urgency of the encounter.", 0, 1, priority);
3639        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The patient ro group present at the encounter.", 0, 1, subject);
3640        case -1892140189: /*episodeOfCare*/  return new Property("episodeOfCare", "Reference(EpisodeOfCare)", "Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).", 0, java.lang.Integer.MAX_VALUE, episodeOfCare);
3641        case -1258204701: /*incomingReferral*/  return new Property("incomingReferral", "Reference(ReferralRequest)", "The referral request this encounter satisfies (incoming referral).", 0, java.lang.Integer.MAX_VALUE, incomingReferral);
3642        case 767422259: /*participant*/  return new Property("participant", "", "The list of people responsible for providing the service.", 0, java.lang.Integer.MAX_VALUE, participant);
3643        case -1474995297: /*appointment*/  return new Property("appointment", "Reference(Appointment)", "The appointment that scheduled this encounter.", 0, 1, appointment);
3644        case -991726143: /*period*/  return new Property("period", "Period", "The start and end time of the encounter.", 0, 1, period);
3645        case -1106363674: /*length*/  return new Property("length", "Duration", "Quantity of time the encounter lasted. This excludes the time during leaves of absence.", 0, 1, length);
3646        case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.", 0, java.lang.Integer.MAX_VALUE, reason);
3647        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "The list of diagnosis relevant to this encounter.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
3648        case -1177318867: /*account*/  return new Property("account", "Reference(Account)", "The set of accounts that may be used for billing for this Encounter.", 0, java.lang.Integer.MAX_VALUE, account);
3649        case 1057894634: /*hospitalization*/  return new Property("hospitalization", "", "Details about the admission to a healthcare service.", 0, 1, hospitalization);
3650        case 1901043637: /*location*/  return new Property("location", "", "List of locations where  the patient has been during this encounter.", 0, java.lang.Integer.MAX_VALUE, location);
3651        case 243182534: /*serviceProvider*/  return new Property("serviceProvider", "Reference(Organization)", "An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.", 0, 1, serviceProvider);
3652        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Encounter)", "Another Encounter of which this encounter is a part of (administratively or in time).", 0, 1, partOf);
3653        default: return super.getNamedProperty(_hash, _name, _checkValid);
3654        }
3655
3656      }
3657
3658      @Override
3659      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3660        switch (hash) {
3661        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3662        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EncounterStatus>
3663        case -986695614: /*statusHistory*/ return this.statusHistory == null ? new Base[0] : this.statusHistory.toArray(new Base[this.statusHistory.size()]); // StatusHistoryComponent
3664        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // Coding
3665        case 962575356: /*classHistory*/ return this.classHistory == null ? new Base[0] : this.classHistory.toArray(new Base[this.classHistory.size()]); // ClassHistoryComponent
3666        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3667        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
3668        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3669        case -1892140189: /*episodeOfCare*/ return this.episodeOfCare == null ? new Base[0] : this.episodeOfCare.toArray(new Base[this.episodeOfCare.size()]); // Reference
3670        case -1258204701: /*incomingReferral*/ return this.incomingReferral == null ? new Base[0] : this.incomingReferral.toArray(new Base[this.incomingReferral.size()]); // Reference
3671        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // EncounterParticipantComponent
3672        case -1474995297: /*appointment*/ return this.appointment == null ? new Base[0] : new Base[] {this.appointment}; // Reference
3673        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
3674        case -1106363674: /*length*/ return this.length == null ? new Base[0] : new Base[] {this.length}; // Duration
3675        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
3676        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
3677        case -1177318867: /*account*/ return this.account == null ? new Base[0] : this.account.toArray(new Base[this.account.size()]); // Reference
3678        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // EncounterHospitalizationComponent
3679        case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // EncounterLocationComponent
3680        case 243182534: /*serviceProvider*/ return this.serviceProvider == null ? new Base[0] : new Base[] {this.serviceProvider}; // Reference
3681        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : new Base[] {this.partOf}; // Reference
3682        default: return super.getProperty(hash, name, checkValid);
3683        }
3684
3685      }
3686
3687      @Override
3688      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3689        switch (hash) {
3690        case -1618432855: // identifier
3691          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3692          return value;
3693        case -892481550: // status
3694          value = new EncounterStatusEnumFactory().fromType(castToCode(value));
3695          this.status = (Enumeration) value; // Enumeration<EncounterStatus>
3696          return value;
3697        case -986695614: // statusHistory
3698          this.getStatusHistory().add((StatusHistoryComponent) value); // StatusHistoryComponent
3699          return value;
3700        case 94742904: // class
3701          this.class_ = castToCoding(value); // Coding
3702          return value;
3703        case 962575356: // classHistory
3704          this.getClassHistory().add((ClassHistoryComponent) value); // ClassHistoryComponent
3705          return value;
3706        case 3575610: // type
3707          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
3708          return value;
3709        case -1165461084: // priority
3710          this.priority = castToCodeableConcept(value); // CodeableConcept
3711          return value;
3712        case -1867885268: // subject
3713          this.subject = castToReference(value); // Reference
3714          return value;
3715        case -1892140189: // episodeOfCare
3716          this.getEpisodeOfCare().add(castToReference(value)); // Reference
3717          return value;
3718        case -1258204701: // incomingReferral
3719          this.getIncomingReferral().add(castToReference(value)); // Reference
3720          return value;
3721        case 767422259: // participant
3722          this.getParticipant().add((EncounterParticipantComponent) value); // EncounterParticipantComponent
3723          return value;
3724        case -1474995297: // appointment
3725          this.appointment = castToReference(value); // Reference
3726          return value;
3727        case -991726143: // period
3728          this.period = castToPeriod(value); // Period
3729          return value;
3730        case -1106363674: // length
3731          this.length = castToDuration(value); // Duration
3732          return value;
3733        case -934964668: // reason
3734          this.getReason().add(castToCodeableConcept(value)); // CodeableConcept
3735          return value;
3736        case 1196993265: // diagnosis
3737          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
3738          return value;
3739        case -1177318867: // account
3740          this.getAccount().add(castToReference(value)); // Reference
3741          return value;
3742        case 1057894634: // hospitalization
3743          this.hospitalization = (EncounterHospitalizationComponent) value; // EncounterHospitalizationComponent
3744          return value;
3745        case 1901043637: // location
3746          this.getLocation().add((EncounterLocationComponent) value); // EncounterLocationComponent
3747          return value;
3748        case 243182534: // serviceProvider
3749          this.serviceProvider = castToReference(value); // Reference
3750          return value;
3751        case -995410646: // partOf
3752          this.partOf = castToReference(value); // Reference
3753          return value;
3754        default: return super.setProperty(hash, name, value);
3755        }
3756
3757      }
3758
3759      @Override
3760      public Base setProperty(String name, Base value) throws FHIRException {
3761        if (name.equals("identifier")) {
3762          this.getIdentifier().add(castToIdentifier(value));
3763        } else if (name.equals("status")) {
3764          value = new EncounterStatusEnumFactory().fromType(castToCode(value));
3765          this.status = (Enumeration) value; // Enumeration<EncounterStatus>
3766        } else if (name.equals("statusHistory")) {
3767          this.getStatusHistory().add((StatusHistoryComponent) value);
3768        } else if (name.equals("class")) {
3769          this.class_ = castToCoding(value); // Coding
3770        } else if (name.equals("classHistory")) {
3771          this.getClassHistory().add((ClassHistoryComponent) value);
3772        } else if (name.equals("type")) {
3773          this.getType().add(castToCodeableConcept(value));
3774        } else if (name.equals("priority")) {
3775          this.priority = castToCodeableConcept(value); // CodeableConcept
3776        } else if (name.equals("subject")) {
3777          this.subject = castToReference(value); // Reference
3778        } else if (name.equals("episodeOfCare")) {
3779          this.getEpisodeOfCare().add(castToReference(value));
3780        } else if (name.equals("incomingReferral")) {
3781          this.getIncomingReferral().add(castToReference(value));
3782        } else if (name.equals("participant")) {
3783          this.getParticipant().add((EncounterParticipantComponent) value);
3784        } else if (name.equals("appointment")) {
3785          this.appointment = castToReference(value); // Reference
3786        } else if (name.equals("period")) {
3787          this.period = castToPeriod(value); // Period
3788        } else if (name.equals("length")) {
3789          this.length = castToDuration(value); // Duration
3790        } else if (name.equals("reason")) {
3791          this.getReason().add(castToCodeableConcept(value));
3792        } else if (name.equals("diagnosis")) {
3793          this.getDiagnosis().add((DiagnosisComponent) value);
3794        } else if (name.equals("account")) {
3795          this.getAccount().add(castToReference(value));
3796        } else if (name.equals("hospitalization")) {
3797          this.hospitalization = (EncounterHospitalizationComponent) value; // EncounterHospitalizationComponent
3798        } else if (name.equals("location")) {
3799          this.getLocation().add((EncounterLocationComponent) value);
3800        } else if (name.equals("serviceProvider")) {
3801          this.serviceProvider = castToReference(value); // Reference
3802        } else if (name.equals("partOf")) {
3803          this.partOf = castToReference(value); // Reference
3804        } else
3805          return super.setProperty(name, value);
3806        return value;
3807      }
3808
3809      @Override
3810      public Base makeProperty(int hash, String name) throws FHIRException {
3811        switch (hash) {
3812        case -1618432855:  return addIdentifier(); 
3813        case -892481550:  return getStatusElement();
3814        case -986695614:  return addStatusHistory(); 
3815        case 94742904:  return getClass_(); 
3816        case 962575356:  return addClassHistory(); 
3817        case 3575610:  return addType(); 
3818        case -1165461084:  return getPriority(); 
3819        case -1867885268:  return getSubject(); 
3820        case -1892140189:  return addEpisodeOfCare(); 
3821        case -1258204701:  return addIncomingReferral(); 
3822        case 767422259:  return addParticipant(); 
3823        case -1474995297:  return getAppointment(); 
3824        case -991726143:  return getPeriod(); 
3825        case -1106363674:  return getLength(); 
3826        case -934964668:  return addReason(); 
3827        case 1196993265:  return addDiagnosis(); 
3828        case -1177318867:  return addAccount(); 
3829        case 1057894634:  return getHospitalization(); 
3830        case 1901043637:  return addLocation(); 
3831        case 243182534:  return getServiceProvider(); 
3832        case -995410646:  return getPartOf(); 
3833        default: return super.makeProperty(hash, name);
3834        }
3835
3836      }
3837
3838      @Override
3839      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3840        switch (hash) {
3841        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3842        case -892481550: /*status*/ return new String[] {"code"};
3843        case -986695614: /*statusHistory*/ return new String[] {};
3844        case 94742904: /*class*/ return new String[] {"Coding"};
3845        case 962575356: /*classHistory*/ return new String[] {};
3846        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3847        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
3848        case -1867885268: /*subject*/ return new String[] {"Reference"};
3849        case -1892140189: /*episodeOfCare*/ return new String[] {"Reference"};
3850        case -1258204701: /*incomingReferral*/ return new String[] {"Reference"};
3851        case 767422259: /*participant*/ return new String[] {};
3852        case -1474995297: /*appointment*/ return new String[] {"Reference"};
3853        case -991726143: /*period*/ return new String[] {"Period"};
3854        case -1106363674: /*length*/ return new String[] {"Duration"};
3855        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
3856        case 1196993265: /*diagnosis*/ return new String[] {};
3857        case -1177318867: /*account*/ return new String[] {"Reference"};
3858        case 1057894634: /*hospitalization*/ return new String[] {};
3859        case 1901043637: /*location*/ return new String[] {};
3860        case 243182534: /*serviceProvider*/ return new String[] {"Reference"};
3861        case -995410646: /*partOf*/ return new String[] {"Reference"};
3862        default: return super.getTypesForProperty(hash, name);
3863        }
3864
3865      }
3866
3867      @Override
3868      public Base addChild(String name) throws FHIRException {
3869        if (name.equals("identifier")) {
3870          return addIdentifier();
3871        }
3872        else if (name.equals("status")) {
3873          throw new FHIRException("Cannot call addChild on a primitive type Encounter.status");
3874        }
3875        else if (name.equals("statusHistory")) {
3876          return addStatusHistory();
3877        }
3878        else if (name.equals("class")) {
3879          this.class_ = new Coding();
3880          return this.class_;
3881        }
3882        else if (name.equals("classHistory")) {
3883          return addClassHistory();
3884        }
3885        else if (name.equals("type")) {
3886          return addType();
3887        }
3888        else if (name.equals("priority")) {
3889          this.priority = new CodeableConcept();
3890          return this.priority;
3891        }
3892        else if (name.equals("subject")) {
3893          this.subject = new Reference();
3894          return this.subject;
3895        }
3896        else if (name.equals("episodeOfCare")) {
3897          return addEpisodeOfCare();
3898        }
3899        else if (name.equals("incomingReferral")) {
3900          return addIncomingReferral();
3901        }
3902        else if (name.equals("participant")) {
3903          return addParticipant();
3904        }
3905        else if (name.equals("appointment")) {
3906          this.appointment = new Reference();
3907          return this.appointment;
3908        }
3909        else if (name.equals("period")) {
3910          this.period = new Period();
3911          return this.period;
3912        }
3913        else if (name.equals("length")) {
3914          this.length = new Duration();
3915          return this.length;
3916        }
3917        else if (name.equals("reason")) {
3918          return addReason();
3919        }
3920        else if (name.equals("diagnosis")) {
3921          return addDiagnosis();
3922        }
3923        else if (name.equals("account")) {
3924          return addAccount();
3925        }
3926        else if (name.equals("hospitalization")) {
3927          this.hospitalization = new EncounterHospitalizationComponent();
3928          return this.hospitalization;
3929        }
3930        else if (name.equals("location")) {
3931          return addLocation();
3932        }
3933        else if (name.equals("serviceProvider")) {
3934          this.serviceProvider = new Reference();
3935          return this.serviceProvider;
3936        }
3937        else if (name.equals("partOf")) {
3938          this.partOf = new Reference();
3939          return this.partOf;
3940        }
3941        else
3942          return super.addChild(name);
3943      }
3944
3945  public String fhirType() {
3946    return "Encounter";
3947
3948  }
3949
3950      public Encounter copy() {
3951        Encounter dst = new Encounter();
3952        copyValues(dst);
3953        if (identifier != null) {
3954          dst.identifier = new ArrayList<Identifier>();
3955          for (Identifier i : identifier)
3956            dst.identifier.add(i.copy());
3957        };
3958        dst.status = status == null ? null : status.copy();
3959        if (statusHistory != null) {
3960          dst.statusHistory = new ArrayList<StatusHistoryComponent>();
3961          for (StatusHistoryComponent i : statusHistory)
3962            dst.statusHistory.add(i.copy());
3963        };
3964        dst.class_ = class_ == null ? null : class_.copy();
3965        if (classHistory != null) {
3966          dst.classHistory = new ArrayList<ClassHistoryComponent>();
3967          for (ClassHistoryComponent i : classHistory)
3968            dst.classHistory.add(i.copy());
3969        };
3970        if (type != null) {
3971          dst.type = new ArrayList<CodeableConcept>();
3972          for (CodeableConcept i : type)
3973            dst.type.add(i.copy());
3974        };
3975        dst.priority = priority == null ? null : priority.copy();
3976        dst.subject = subject == null ? null : subject.copy();
3977        if (episodeOfCare != null) {
3978          dst.episodeOfCare = new ArrayList<Reference>();
3979          for (Reference i : episodeOfCare)
3980            dst.episodeOfCare.add(i.copy());
3981        };
3982        if (incomingReferral != null) {
3983          dst.incomingReferral = new ArrayList<Reference>();
3984          for (Reference i : incomingReferral)
3985            dst.incomingReferral.add(i.copy());
3986        };
3987        if (participant != null) {
3988          dst.participant = new ArrayList<EncounterParticipantComponent>();
3989          for (EncounterParticipantComponent i : participant)
3990            dst.participant.add(i.copy());
3991        };
3992        dst.appointment = appointment == null ? null : appointment.copy();
3993        dst.period = period == null ? null : period.copy();
3994        dst.length = length == null ? null : length.copy();
3995        if (reason != null) {
3996          dst.reason = new ArrayList<CodeableConcept>();
3997          for (CodeableConcept i : reason)
3998            dst.reason.add(i.copy());
3999        };
4000        if (diagnosis != null) {
4001          dst.diagnosis = new ArrayList<DiagnosisComponent>();
4002          for (DiagnosisComponent i : diagnosis)
4003            dst.diagnosis.add(i.copy());
4004        };
4005        if (account != null) {
4006          dst.account = new ArrayList<Reference>();
4007          for (Reference i : account)
4008            dst.account.add(i.copy());
4009        };
4010        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
4011        if (location != null) {
4012          dst.location = new ArrayList<EncounterLocationComponent>();
4013          for (EncounterLocationComponent i : location)
4014            dst.location.add(i.copy());
4015        };
4016        dst.serviceProvider = serviceProvider == null ? null : serviceProvider.copy();
4017        dst.partOf = partOf == null ? null : partOf.copy();
4018        return dst;
4019      }
4020
4021      protected Encounter typedCopy() {
4022        return copy();
4023      }
4024
4025      @Override
4026      public boolean equalsDeep(Base other_) {
4027        if (!super.equalsDeep(other_))
4028          return false;
4029        if (!(other_ instanceof Encounter))
4030          return false;
4031        Encounter o = (Encounter) other_;
4032        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(statusHistory, o.statusHistory, true)
4033           && compareDeep(class_, o.class_, true) && compareDeep(classHistory, o.classHistory, true) && compareDeep(type, o.type, true)
4034           && compareDeep(priority, o.priority, true) && compareDeep(subject, o.subject, true) && compareDeep(episodeOfCare, o.episodeOfCare, true)
4035           && compareDeep(incomingReferral, o.incomingReferral, true) && compareDeep(participant, o.participant, true)
4036           && compareDeep(appointment, o.appointment, true) && compareDeep(period, o.period, true) && compareDeep(length, o.length, true)
4037           && compareDeep(reason, o.reason, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(account, o.account, true)
4038           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(location, o.location, true)
4039           && compareDeep(serviceProvider, o.serviceProvider, true) && compareDeep(partOf, o.partOf, true)
4040          ;
4041      }
4042
4043      @Override
4044      public boolean equalsShallow(Base other_) {
4045        if (!super.equalsShallow(other_))
4046          return false;
4047        if (!(other_ instanceof Encounter))
4048          return false;
4049        Encounter o = (Encounter) other_;
4050        return compareValues(status, o.status, true);
4051      }
4052
4053      public boolean isEmpty() {
4054        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusHistory
4055          , class_, classHistory, type, priority, subject, episodeOfCare, incomingReferral
4056          , participant, appointment, period, length, reason, diagnosis, account, hospitalization
4057          , location, serviceProvider, partOf);
4058      }
4059
4060  @Override
4061  public ResourceType getResourceType() {
4062    return ResourceType.Encounter;
4063   }
4064
4065 /**
4066   * Search parameter: <b>date</b>
4067   * <p>
4068   * Description: <b>A date within the period the Encounter lasted</b><br>
4069   * Type: <b>date</b><br>
4070   * Path: <b>Encounter.period</b><br>
4071   * </p>
4072   */
4073  @SearchParamDefinition(name="date", path="Encounter.period", description="A date within the period the Encounter lasted", type="date" )
4074  public static final String SP_DATE = "date";
4075 /**
4076   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4077   * <p>
4078   * Description: <b>A date within the period the Encounter lasted</b><br>
4079   * Type: <b>date</b><br>
4080   * Path: <b>Encounter.period</b><br>
4081   * </p>
4082   */
4083  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4084
4085 /**
4086   * Search parameter: <b>identifier</b>
4087   * <p>
4088   * Description: <b>Identifier(s) by which this encounter is known</b><br>
4089   * Type: <b>token</b><br>
4090   * Path: <b>Encounter.identifier</b><br>
4091   * </p>
4092   */
4093  @SearchParamDefinition(name="identifier", path="Encounter.identifier", description="Identifier(s) by which this encounter is known", type="token" )
4094  public static final String SP_IDENTIFIER = "identifier";
4095 /**
4096   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4097   * <p>
4098   * Description: <b>Identifier(s) by which this encounter is known</b><br>
4099   * Type: <b>token</b><br>
4100   * Path: <b>Encounter.identifier</b><br>
4101   * </p>
4102   */
4103  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4104
4105 /**
4106   * Search parameter: <b>reason</b>
4107   * <p>
4108   * Description: <b>Reason the encounter takes place (code)</b><br>
4109   * Type: <b>token</b><br>
4110   * Path: <b>Encounter.reason</b><br>
4111   * </p>
4112   */
4113  @SearchParamDefinition(name="reason", path="Encounter.reason", description="Reason the encounter takes place (code)", type="token" )
4114  public static final String SP_REASON = "reason";
4115 /**
4116   * <b>Fluent Client</b> search parameter constant for <b>reason</b>
4117   * <p>
4118   * Description: <b>Reason the encounter takes place (code)</b><br>
4119   * Type: <b>token</b><br>
4120   * Path: <b>Encounter.reason</b><br>
4121   * </p>
4122   */
4123  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON);
4124
4125 /**
4126   * Search parameter: <b>episodeofcare</b>
4127   * <p>
4128   * Description: <b>Episode(s) of care that this encounter should be recorded against</b><br>
4129   * Type: <b>reference</b><br>
4130   * Path: <b>Encounter.episodeOfCare</b><br>
4131   * </p>
4132   */
4133  @SearchParamDefinition(name="episodeofcare", path="Encounter.episodeOfCare", description="Episode(s) of care that this encounter should be recorded against", type="reference", target={EpisodeOfCare.class } )
4134  public static final String SP_EPISODEOFCARE = "episodeofcare";
4135 /**
4136   * <b>Fluent Client</b> search parameter constant for <b>episodeofcare</b>
4137   * <p>
4138   * Description: <b>Episode(s) of care that this encounter should be recorded against</b><br>
4139   * Type: <b>reference</b><br>
4140   * Path: <b>Encounter.episodeOfCare</b><br>
4141   * </p>
4142   */
4143  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam EPISODEOFCARE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_EPISODEOFCARE);
4144
4145/**
4146   * Constant for fluent queries to be used to add include statements. Specifies
4147   * the path value of "<b>Encounter:episodeofcare</b>".
4148   */
4149  public static final ca.uhn.fhir.model.api.Include INCLUDE_EPISODEOFCARE = new ca.uhn.fhir.model.api.Include("Encounter:episodeofcare").toLocked();
4150
4151 /**
4152   * Search parameter: <b>participant-type</b>
4153   * <p>
4154   * Description: <b>Role of participant in encounter</b><br>
4155   * Type: <b>token</b><br>
4156   * Path: <b>Encounter.participant.type</b><br>
4157   * </p>
4158   */
4159  @SearchParamDefinition(name="participant-type", path="Encounter.participant.type", description="Role of participant in encounter", type="token" )
4160  public static final String SP_PARTICIPANT_TYPE = "participant-type";
4161 /**
4162   * <b>Fluent Client</b> search parameter constant for <b>participant-type</b>
4163   * <p>
4164   * Description: <b>Role of participant in encounter</b><br>
4165   * Type: <b>token</b><br>
4166   * Path: <b>Encounter.participant.type</b><br>
4167   * </p>
4168   */
4169  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PARTICIPANT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PARTICIPANT_TYPE);
4170
4171 /**
4172   * Search parameter: <b>incomingreferral</b>
4173   * <p>
4174   * Description: <b>The ReferralRequest that initiated this encounter</b><br>
4175   * Type: <b>reference</b><br>
4176   * Path: <b>Encounter.incomingReferral</b><br>
4177   * </p>
4178   */
4179  @SearchParamDefinition(name="incomingreferral", path="Encounter.incomingReferral", description="The ReferralRequest that initiated this encounter", type="reference", target={ReferralRequest.class } )
4180  public static final String SP_INCOMINGREFERRAL = "incomingreferral";
4181 /**
4182   * <b>Fluent Client</b> search parameter constant for <b>incomingreferral</b>
4183   * <p>
4184   * Description: <b>The ReferralRequest that initiated this encounter</b><br>
4185   * Type: <b>reference</b><br>
4186   * Path: <b>Encounter.incomingReferral</b><br>
4187   * </p>
4188   */
4189  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INCOMINGREFERRAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INCOMINGREFERRAL);
4190
4191/**
4192   * Constant for fluent queries to be used to add include statements. Specifies
4193   * the path value of "<b>Encounter:incomingreferral</b>".
4194   */
4195  public static final ca.uhn.fhir.model.api.Include INCLUDE_INCOMINGREFERRAL = new ca.uhn.fhir.model.api.Include("Encounter:incomingreferral").toLocked();
4196
4197 /**
4198   * Search parameter: <b>practitioner</b>
4199   * <p>
4200   * Description: <b>Persons involved in the encounter other than the patient</b><br>
4201   * Type: <b>reference</b><br>
4202   * Path: <b>Encounter.participant.individual</b><br>
4203   * </p>
4204   */
4205  @SearchParamDefinition(name="practitioner", path="Encounter.participant.individual", description="Persons involved in the encounter other than the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
4206  public static final String SP_PRACTITIONER = "practitioner";
4207 /**
4208   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
4209   * <p>
4210   * Description: <b>Persons involved in the encounter other than the patient</b><br>
4211   * Type: <b>reference</b><br>
4212   * Path: <b>Encounter.participant.individual</b><br>
4213   * </p>
4214   */
4215  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
4216
4217/**
4218   * Constant for fluent queries to be used to add include statements. Specifies
4219   * the path value of "<b>Encounter:practitioner</b>".
4220   */
4221  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("Encounter:practitioner").toLocked();
4222
4223 /**
4224   * Search parameter: <b>subject</b>
4225   * <p>
4226   * Description: <b>The patient ro group present at the encounter</b><br>
4227   * Type: <b>reference</b><br>
4228   * Path: <b>Encounter.subject</b><br>
4229   * </p>
4230   */
4231  @SearchParamDefinition(name="subject", path="Encounter.subject", description="The patient ro group present at the encounter", type="reference", target={Group.class, Patient.class } )
4232  public static final String SP_SUBJECT = "subject";
4233 /**
4234   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4235   * <p>
4236   * Description: <b>The patient ro group present at the encounter</b><br>
4237   * Type: <b>reference</b><br>
4238   * Path: <b>Encounter.subject</b><br>
4239   * </p>
4240   */
4241  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
4242
4243/**
4244   * Constant for fluent queries to be used to add include statements. Specifies
4245   * the path value of "<b>Encounter:subject</b>".
4246   */
4247  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Encounter:subject").toLocked();
4248
4249 /**
4250   * Search parameter: <b>length</b>
4251   * <p>
4252   * Description: <b>Length of encounter in days</b><br>
4253   * Type: <b>number</b><br>
4254   * Path: <b>Encounter.length</b><br>
4255   * </p>
4256   */
4257  @SearchParamDefinition(name="length", path="Encounter.length", description="Length of encounter in days", type="number" )
4258  public static final String SP_LENGTH = "length";
4259 /**
4260   * <b>Fluent Client</b> search parameter constant for <b>length</b>
4261   * <p>
4262   * Description: <b>Length of encounter in days</b><br>
4263   * Type: <b>number</b><br>
4264   * Path: <b>Encounter.length</b><br>
4265   * </p>
4266   */
4267  public static final ca.uhn.fhir.rest.gclient.NumberClientParam LENGTH = new ca.uhn.fhir.rest.gclient.NumberClientParam(SP_LENGTH);
4268
4269 /**
4270   * Search parameter: <b>diagnosis</b>
4271   * <p>
4272   * Description: <b>Reason the encounter takes place (resource)</b><br>
4273   * Type: <b>reference</b><br>
4274   * Path: <b>Encounter.diagnosis.condition</b><br>
4275   * </p>
4276   */
4277  @SearchParamDefinition(name="diagnosis", path="Encounter.diagnosis.condition", description="Reason the encounter takes place (resource)", type="reference", target={Condition.class, Procedure.class } )
4278  public static final String SP_DIAGNOSIS = "diagnosis";
4279 /**
4280   * <b>Fluent Client</b> search parameter constant for <b>diagnosis</b>
4281   * <p>
4282   * Description: <b>Reason the encounter takes place (resource)</b><br>
4283   * Type: <b>reference</b><br>
4284   * Path: <b>Encounter.diagnosis.condition</b><br>
4285   * </p>
4286   */
4287  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DIAGNOSIS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DIAGNOSIS);
4288
4289/**
4290   * Constant for fluent queries to be used to add include statements. Specifies
4291   * the path value of "<b>Encounter:diagnosis</b>".
4292   */
4293  public static final ca.uhn.fhir.model.api.Include INCLUDE_DIAGNOSIS = new ca.uhn.fhir.model.api.Include("Encounter:diagnosis").toLocked();
4294
4295 /**
4296   * Search parameter: <b>appointment</b>
4297   * <p>
4298   * Description: <b>The appointment that scheduled this encounter</b><br>
4299   * Type: <b>reference</b><br>
4300   * Path: <b>Encounter.appointment</b><br>
4301   * </p>
4302   */
4303  @SearchParamDefinition(name="appointment", path="Encounter.appointment", description="The appointment that scheduled this encounter", type="reference", target={Appointment.class } )
4304  public static final String SP_APPOINTMENT = "appointment";
4305 /**
4306   * <b>Fluent Client</b> search parameter constant for <b>appointment</b>
4307   * <p>
4308   * Description: <b>The appointment that scheduled this encounter</b><br>
4309   * Type: <b>reference</b><br>
4310   * Path: <b>Encounter.appointment</b><br>
4311   * </p>
4312   */
4313  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam APPOINTMENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_APPOINTMENT);
4314
4315/**
4316   * Constant for fluent queries to be used to add include statements. Specifies
4317   * the path value of "<b>Encounter:appointment</b>".
4318   */
4319  public static final ca.uhn.fhir.model.api.Include INCLUDE_APPOINTMENT = new ca.uhn.fhir.model.api.Include("Encounter:appointment").toLocked();
4320
4321 /**
4322   * Search parameter: <b>part-of</b>
4323   * <p>
4324   * Description: <b>Another Encounter this encounter is part of</b><br>
4325   * Type: <b>reference</b><br>
4326   * Path: <b>Encounter.partOf</b><br>
4327   * </p>
4328   */
4329  @SearchParamDefinition(name="part-of", path="Encounter.partOf", description="Another Encounter this encounter is part of", type="reference", target={Encounter.class } )
4330  public static final String SP_PART_OF = "part-of";
4331 /**
4332   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
4333   * <p>
4334   * Description: <b>Another Encounter this encounter is part of</b><br>
4335   * Type: <b>reference</b><br>
4336   * Path: <b>Encounter.partOf</b><br>
4337   * </p>
4338   */
4339  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
4340
4341/**
4342   * Constant for fluent queries to be used to add include statements. Specifies
4343   * the path value of "<b>Encounter:part-of</b>".
4344   */
4345  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Encounter:part-of").toLocked();
4346
4347 /**
4348   * Search parameter: <b>type</b>
4349   * <p>
4350   * Description: <b>Specific type of encounter</b><br>
4351   * Type: <b>token</b><br>
4352   * Path: <b>Encounter.type</b><br>
4353   * </p>
4354   */
4355  @SearchParamDefinition(name="type", path="Encounter.type", description="Specific type of encounter", type="token" )
4356  public static final String SP_TYPE = "type";
4357 /**
4358   * <b>Fluent Client</b> search parameter constant for <b>type</b>
4359   * <p>
4360   * Description: <b>Specific type of encounter</b><br>
4361   * Type: <b>token</b><br>
4362   * Path: <b>Encounter.type</b><br>
4363   * </p>
4364   */
4365  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
4366
4367 /**
4368   * Search parameter: <b>participant</b>
4369   * <p>
4370   * Description: <b>Persons involved in the encounter other than the patient</b><br>
4371   * Type: <b>reference</b><br>
4372   * Path: <b>Encounter.participant.individual</b><br>
4373   * </p>
4374   */
4375  @SearchParamDefinition(name="participant", path="Encounter.participant.individual", description="Persons involved in the encounter other than the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Practitioner.class, RelatedPerson.class } )
4376  public static final String SP_PARTICIPANT = "participant";
4377 /**
4378   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
4379   * <p>
4380   * Description: <b>Persons involved in the encounter other than the patient</b><br>
4381   * Type: <b>reference</b><br>
4382   * Path: <b>Encounter.participant.individual</b><br>
4383   * </p>
4384   */
4385  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTICIPANT);
4386
4387/**
4388   * Constant for fluent queries to be used to add include statements. Specifies
4389   * the path value of "<b>Encounter:participant</b>".
4390   */
4391  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include("Encounter:participant").toLocked();
4392
4393 /**
4394   * Search parameter: <b>patient</b>
4395   * <p>
4396   * Description: <b>The patient ro group present at the encounter</b><br>
4397   * Type: <b>reference</b><br>
4398   * Path: <b>Encounter.subject</b><br>
4399   * </p>
4400   */
4401  @SearchParamDefinition(name="patient", path="Encounter.subject", description="The patient ro group present at the encounter", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
4402  public static final String SP_PATIENT = "patient";
4403 /**
4404   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4405   * <p>
4406   * Description: <b>The patient ro group present at the encounter</b><br>
4407   * Type: <b>reference</b><br>
4408   * Path: <b>Encounter.subject</b><br>
4409   * </p>
4410   */
4411  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4412
4413/**
4414   * Constant for fluent queries to be used to add include statements. Specifies
4415   * the path value of "<b>Encounter:patient</b>".
4416   */
4417  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Encounter:patient").toLocked();
4418
4419 /**
4420   * Search parameter: <b>location-period</b>
4421   * <p>
4422   * Description: <b>Time period during which the patient was present at the location</b><br>
4423   * Type: <b>date</b><br>
4424   * Path: <b>Encounter.location.period</b><br>
4425   * </p>
4426   */
4427  @SearchParamDefinition(name="location-period", path="Encounter.location.period", description="Time period during which the patient was present at the location", type="date" )
4428  public static final String SP_LOCATION_PERIOD = "location-period";
4429 /**
4430   * <b>Fluent Client</b> search parameter constant for <b>location-period</b>
4431   * <p>
4432   * Description: <b>Time period during which the patient was present at the location</b><br>
4433   * Type: <b>date</b><br>
4434   * Path: <b>Encounter.location.period</b><br>
4435   * </p>
4436   */
4437  public static final ca.uhn.fhir.rest.gclient.DateClientParam LOCATION_PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_LOCATION_PERIOD);
4438
4439 /**
4440   * Search parameter: <b>location</b>
4441   * <p>
4442   * Description: <b>Location the encounter takes place</b><br>
4443   * Type: <b>reference</b><br>
4444   * Path: <b>Encounter.location.location</b><br>
4445   * </p>
4446   */
4447  @SearchParamDefinition(name="location", path="Encounter.location.location", description="Location the encounter takes place", type="reference", target={Location.class } )
4448  public static final String SP_LOCATION = "location";
4449 /**
4450   * <b>Fluent Client</b> search parameter constant for <b>location</b>
4451   * <p>
4452   * Description: <b>Location the encounter takes place</b><br>
4453   * Type: <b>reference</b><br>
4454   * Path: <b>Encounter.location.location</b><br>
4455   * </p>
4456   */
4457  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
4458
4459/**
4460   * Constant for fluent queries to be used to add include statements. Specifies
4461   * the path value of "<b>Encounter:location</b>".
4462   */
4463  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Encounter:location").toLocked();
4464
4465 /**
4466   * Search parameter: <b>service-provider</b>
4467   * <p>
4468   * Description: <b>The custodian organization of this Encounter record</b><br>
4469   * Type: <b>reference</b><br>
4470   * Path: <b>Encounter.serviceProvider</b><br>
4471   * </p>
4472   */
4473  @SearchParamDefinition(name="service-provider", path="Encounter.serviceProvider", description="The custodian organization of this Encounter record", type="reference", target={Organization.class } )
4474  public static final String SP_SERVICE_PROVIDER = "service-provider";
4475 /**
4476   * <b>Fluent Client</b> search parameter constant for <b>service-provider</b>
4477   * <p>
4478   * Description: <b>The custodian organization of this Encounter record</b><br>
4479   * Type: <b>reference</b><br>
4480   * Path: <b>Encounter.serviceProvider</b><br>
4481   * </p>
4482   */
4483  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SERVICE_PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SERVICE_PROVIDER);
4484
4485/**
4486   * Constant for fluent queries to be used to add include statements. Specifies
4487   * the path value of "<b>Encounter:service-provider</b>".
4488   */
4489  public static final ca.uhn.fhir.model.api.Include INCLUDE_SERVICE_PROVIDER = new ca.uhn.fhir.model.api.Include("Encounter:service-provider").toLocked();
4490
4491 /**
4492   * Search parameter: <b>special-arrangement</b>
4493   * <p>
4494   * Description: <b>Wheelchair, translator, stretcher, etc.</b><br>
4495   * Type: <b>token</b><br>
4496   * Path: <b>Encounter.hospitalization.specialArrangement</b><br>
4497   * </p>
4498   */
4499  @SearchParamDefinition(name="special-arrangement", path="Encounter.hospitalization.specialArrangement", description="Wheelchair, translator, stretcher, etc.", type="token" )
4500  public static final String SP_SPECIAL_ARRANGEMENT = "special-arrangement";
4501 /**
4502   * <b>Fluent Client</b> search parameter constant for <b>special-arrangement</b>
4503   * <p>
4504   * Description: <b>Wheelchair, translator, stretcher, etc.</b><br>
4505   * Type: <b>token</b><br>
4506   * Path: <b>Encounter.hospitalization.specialArrangement</b><br>
4507   * </p>
4508   */
4509  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIAL_ARRANGEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIAL_ARRANGEMENT);
4510
4511 /**
4512   * Search parameter: <b>class</b>
4513   * <p>
4514   * Description: <b>inpatient | outpatient | ambulatory | emergency +</b><br>
4515   * Type: <b>token</b><br>
4516   * Path: <b>Encounter.class</b><br>
4517   * </p>
4518   */
4519  @SearchParamDefinition(name="class", path="Encounter.class", description="inpatient | outpatient | ambulatory | emergency +", type="token" )
4520  public static final String SP_CLASS = "class";
4521 /**
4522   * <b>Fluent Client</b> search parameter constant for <b>class</b>
4523   * <p>
4524   * Description: <b>inpatient | outpatient | ambulatory | emergency +</b><br>
4525   * Type: <b>token</b><br>
4526   * Path: <b>Encounter.class</b><br>
4527   * </p>
4528   */
4529  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASS);
4530
4531 /**
4532   * Search parameter: <b>status</b>
4533   * <p>
4534   * Description: <b>planned | arrived | triaged | in-progress | onleave | finished | cancelled +</b><br>
4535   * Type: <b>token</b><br>
4536   * Path: <b>Encounter.status</b><br>
4537   * </p>
4538   */
4539  @SearchParamDefinition(name="status", path="Encounter.status", description="planned | arrived | triaged | in-progress | onleave | finished | cancelled +", type="token" )
4540  public static final String SP_STATUS = "status";
4541 /**
4542   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4543   * <p>
4544   * Description: <b>planned | arrived | triaged | in-progress | onleave | finished | cancelled +</b><br>
4545   * Type: <b>token</b><br>
4546   * Path: <b>Encounter.status</b><br>
4547   * </p>
4548   */
4549  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4550
4551
4552}
4553