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