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