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