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