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