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