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