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