001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. The managing organization assumes a level of responsibility for the patient during this time.
048 */
049@ResourceDef(name="EpisodeOfCare", profile="http://hl7.org/fhir/Profile/EpisodeOfCare")
050public class EpisodeOfCare extends DomainResource {
051
052    public enum EpisodeOfCareStatus {
053        /**
054         * This episode of care is planned to start at the date specified in the period.start. During this status, an organization may perform assessments to determine if the patient is eligible to receive services, or be organizing to make resources available to provide care services.
055         */
056        PLANNED, 
057        /**
058         * This episode has been placed on a waitlist, pending the episode being made active (or cancelled).
059         */
060        WAITLIST, 
061        /**
062         * This episode of care is current.
063         */
064        ACTIVE, 
065        /**
066         * This episode of care is on hold, the organization has limited responsibility for the patient (such as while on respite).
067         */
068        ONHOLD, 
069        /**
070         * This episode of care is finished and the organization is not expecting to be providing further care to the patient. Can also be known as "closed", "completed" or other similar terms.
071         */
072        FINISHED, 
073        /**
074         * The episode of care was cancelled, or withdrawn from service, often selected during the planned stage as the patient may have gone elsewhere, or the circumstances have changed and the organization is unable to provide the care. It indicates that services terminated outside the planned/expected workflow.
075         */
076        CANCELLED, 
077        /**
078         * This instance should not have been part of this patient's medical record.
079         */
080        ENTEREDINERROR, 
081        /**
082         * added to help the parsers with the generic types
083         */
084        NULL;
085        public static EpisodeOfCareStatus fromCode(String codeString) throws FHIRException {
086            if (codeString == null || "".equals(codeString))
087                return null;
088        if ("planned".equals(codeString))
089          return PLANNED;
090        if ("waitlist".equals(codeString))
091          return WAITLIST;
092        if ("active".equals(codeString))
093          return ACTIVE;
094        if ("onhold".equals(codeString))
095          return ONHOLD;
096        if ("finished".equals(codeString))
097          return FINISHED;
098        if ("cancelled".equals(codeString))
099          return CANCELLED;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        if (Configuration.isAcceptInvalidEnums())
103          return null;
104        else
105          throw new FHIRException("Unknown EpisodeOfCareStatus code '"+codeString+"'");
106        }
107        public String toCode() {
108          switch (this) {
109            case PLANNED: return "planned";
110            case WAITLIST: return "waitlist";
111            case ACTIVE: return "active";
112            case ONHOLD: return "onhold";
113            case FINISHED: return "finished";
114            case CANCELLED: return "cancelled";
115            case ENTEREDINERROR: return "entered-in-error";
116            default: return "?";
117          }
118        }
119        public String getSystem() {
120          switch (this) {
121            case PLANNED: return "http://hl7.org/fhir/episode-of-care-status";
122            case WAITLIST: return "http://hl7.org/fhir/episode-of-care-status";
123            case ACTIVE: return "http://hl7.org/fhir/episode-of-care-status";
124            case ONHOLD: return "http://hl7.org/fhir/episode-of-care-status";
125            case FINISHED: return "http://hl7.org/fhir/episode-of-care-status";
126            case CANCELLED: return "http://hl7.org/fhir/episode-of-care-status";
127            case ENTEREDINERROR: return "http://hl7.org/fhir/episode-of-care-status";
128            default: return "?";
129          }
130        }
131        public String getDefinition() {
132          switch (this) {
133            case PLANNED: return "This episode of care is planned to start at the date specified in the period.start. During this status, an organization may perform assessments to determine if the patient is eligible to receive services, or be organizing to make resources available to provide care services.";
134            case WAITLIST: return "This episode has been placed on a waitlist, pending the episode being made active (or cancelled).";
135            case ACTIVE: return "This episode of care is current.";
136            case ONHOLD: return "This episode of care is on hold, the organization has limited responsibility for the patient (such as while on respite).";
137            case FINISHED: return "This episode of care is finished and the organization is not expecting to be providing further care to the patient. Can also be known as \"closed\", \"completed\" or other similar terms.";
138            case CANCELLED: return "The episode of care was cancelled, or withdrawn from service, often selected during the planned stage as the patient may have gone elsewhere, or the circumstances have changed and the organization is unable to provide the care. It indicates that services terminated outside the planned/expected workflow.";
139            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
140            default: return "?";
141          }
142        }
143        public String getDisplay() {
144          switch (this) {
145            case PLANNED: return "Planned";
146            case WAITLIST: return "Waitlist";
147            case ACTIVE: return "Active";
148            case ONHOLD: return "On Hold";
149            case FINISHED: return "Finished";
150            case CANCELLED: return "Cancelled";
151            case ENTEREDINERROR: return "Entered in Error";
152            default: return "?";
153          }
154        }
155    }
156
157  public static class EpisodeOfCareStatusEnumFactory implements EnumFactory<EpisodeOfCareStatus> {
158    public EpisodeOfCareStatus fromCode(String codeString) throws IllegalArgumentException {
159      if (codeString == null || "".equals(codeString))
160            if (codeString == null || "".equals(codeString))
161                return null;
162        if ("planned".equals(codeString))
163          return EpisodeOfCareStatus.PLANNED;
164        if ("waitlist".equals(codeString))
165          return EpisodeOfCareStatus.WAITLIST;
166        if ("active".equals(codeString))
167          return EpisodeOfCareStatus.ACTIVE;
168        if ("onhold".equals(codeString))
169          return EpisodeOfCareStatus.ONHOLD;
170        if ("finished".equals(codeString))
171          return EpisodeOfCareStatus.FINISHED;
172        if ("cancelled".equals(codeString))
173          return EpisodeOfCareStatus.CANCELLED;
174        if ("entered-in-error".equals(codeString))
175          return EpisodeOfCareStatus.ENTEREDINERROR;
176        throw new IllegalArgumentException("Unknown EpisodeOfCareStatus code '"+codeString+"'");
177        }
178        public Enumeration<EpisodeOfCareStatus> fromType(Base code) throws FHIRException {
179          if (code == null)
180            return null;
181          if (code.isEmpty())
182            return new Enumeration<EpisodeOfCareStatus>(this);
183          String codeString = ((PrimitiveType) code).asStringValue();
184          if (codeString == null || "".equals(codeString))
185            return null;
186        if ("planned".equals(codeString))
187          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.PLANNED);
188        if ("waitlist".equals(codeString))
189          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.WAITLIST);
190        if ("active".equals(codeString))
191          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ACTIVE);
192        if ("onhold".equals(codeString))
193          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ONHOLD);
194        if ("finished".equals(codeString))
195          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.FINISHED);
196        if ("cancelled".equals(codeString))
197          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.CANCELLED);
198        if ("entered-in-error".equals(codeString))
199          return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ENTEREDINERROR);
200        throw new FHIRException("Unknown EpisodeOfCareStatus code '"+codeString+"'");
201        }
202    public String toCode(EpisodeOfCareStatus code) {
203      if (code == EpisodeOfCareStatus.PLANNED)
204        return "planned";
205      if (code == EpisodeOfCareStatus.WAITLIST)
206        return "waitlist";
207      if (code == EpisodeOfCareStatus.ACTIVE)
208        return "active";
209      if (code == EpisodeOfCareStatus.ONHOLD)
210        return "onhold";
211      if (code == EpisodeOfCareStatus.FINISHED)
212        return "finished";
213      if (code == EpisodeOfCareStatus.CANCELLED)
214        return "cancelled";
215      if (code == EpisodeOfCareStatus.ENTEREDINERROR)
216        return "entered-in-error";
217      return "?";
218      }
219    public String toSystem(EpisodeOfCareStatus code) {
220      return code.getSystem();
221      }
222    }
223
224    @Block()
225    public static class EpisodeOfCareStatusHistoryComponent extends BackboneElement implements IBaseBackboneElement {
226        /**
227         * planned | waitlist | active | onhold | finished | cancelled.
228         */
229        @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
230        @Description(shortDefinition="planned | waitlist | active | onhold | finished | cancelled | entered-in-error", formalDefinition="planned | waitlist | active | onhold | finished | cancelled." )
231        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/episode-of-care-status")
232        protected Enumeration<EpisodeOfCareStatus> status;
233
234        /**
235         * The period during this EpisodeOfCare that the specific status applied.
236         */
237        @Child(name = "period", type = {Period.class}, order=2, min=1, max=1, modifier=false, summary=false)
238        @Description(shortDefinition="Duration the EpisodeOfCare was in the specified status", formalDefinition="The period during this EpisodeOfCare that the specific status applied." )
239        protected Period period;
240
241        private static final long serialVersionUID = -1192432864L;
242
243    /**
244     * Constructor
245     */
246      public EpisodeOfCareStatusHistoryComponent() {
247        super();
248      }
249
250    /**
251     * Constructor
252     */
253      public EpisodeOfCareStatusHistoryComponent(Enumeration<EpisodeOfCareStatus> status, Period period) {
254        super();
255        this.status = status;
256        this.period = period;
257      }
258
259        /**
260         * @return {@link #status} (planned | waitlist | active | onhold | finished | cancelled.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
261         */
262        public Enumeration<EpisodeOfCareStatus> getStatusElement() { 
263          if (this.status == null)
264            if (Configuration.errorOnAutoCreate())
265              throw new Error("Attempt to auto-create EpisodeOfCareStatusHistoryComponent.status");
266            else if (Configuration.doAutoCreate())
267              this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); // bb
268          return this.status;
269        }
270
271        public boolean hasStatusElement() { 
272          return this.status != null && !this.status.isEmpty();
273        }
274
275        public boolean hasStatus() { 
276          return this.status != null && !this.status.isEmpty();
277        }
278
279        /**
280         * @param value {@link #status} (planned | waitlist | active | onhold | finished | cancelled.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
281         */
282        public EpisodeOfCareStatusHistoryComponent setStatusElement(Enumeration<EpisodeOfCareStatus> value) { 
283          this.status = value;
284          return this;
285        }
286
287        /**
288         * @return planned | waitlist | active | onhold | finished | cancelled.
289         */
290        public EpisodeOfCareStatus getStatus() { 
291          return this.status == null ? null : this.status.getValue();
292        }
293
294        /**
295         * @param value planned | waitlist | active | onhold | finished | cancelled.
296         */
297        public EpisodeOfCareStatusHistoryComponent setStatus(EpisodeOfCareStatus value) { 
298            if (this.status == null)
299              this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory());
300            this.status.setValue(value);
301          return this;
302        }
303
304        /**
305         * @return {@link #period} (The period during this EpisodeOfCare that the specific status applied.)
306         */
307        public Period getPeriod() { 
308          if (this.period == null)
309            if (Configuration.errorOnAutoCreate())
310              throw new Error("Attempt to auto-create EpisodeOfCareStatusHistoryComponent.period");
311            else if (Configuration.doAutoCreate())
312              this.period = new Period(); // cc
313          return this.period;
314        }
315
316        public boolean hasPeriod() { 
317          return this.period != null && !this.period.isEmpty();
318        }
319
320        /**
321         * @param value {@link #period} (The period during this EpisodeOfCare that the specific status applied.)
322         */
323        public EpisodeOfCareStatusHistoryComponent setPeriod(Period value) { 
324          this.period = value;
325          return this;
326        }
327
328        protected void listChildren(List<Property> childrenList) {
329          super.listChildren(childrenList);
330          childrenList.add(new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 0, java.lang.Integer.MAX_VALUE, status));
331          childrenList.add(new Property("period", "Period", "The period during this EpisodeOfCare that the specific status applied.", 0, java.lang.Integer.MAX_VALUE, period));
332        }
333
334      @Override
335      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
336        switch (hash) {
337        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EpisodeOfCareStatus>
338        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
339        default: return super.getProperty(hash, name, checkValid);
340        }
341
342      }
343
344      @Override
345      public Base setProperty(int hash, String name, Base value) throws FHIRException {
346        switch (hash) {
347        case -892481550: // status
348          value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value));
349          this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus>
350          return value;
351        case -991726143: // period
352          this.period = castToPeriod(value); // Period
353          return value;
354        default: return super.setProperty(hash, name, value);
355        }
356
357      }
358
359      @Override
360      public Base setProperty(String name, Base value) throws FHIRException {
361        if (name.equals("status")) {
362          value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value));
363          this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus>
364        } else if (name.equals("period")) {
365          this.period = castToPeriod(value); // Period
366        } else
367          return super.setProperty(name, value);
368        return value;
369      }
370
371      @Override
372      public Base makeProperty(int hash, String name) throws FHIRException {
373        switch (hash) {
374        case -892481550:  return getStatusElement();
375        case -991726143:  return getPeriod(); 
376        default: return super.makeProperty(hash, name);
377        }
378
379      }
380
381      @Override
382      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
383        switch (hash) {
384        case -892481550: /*status*/ return new String[] {"code"};
385        case -991726143: /*period*/ return new String[] {"Period"};
386        default: return super.getTypesForProperty(hash, name);
387        }
388
389      }
390
391      @Override
392      public Base addChild(String name) throws FHIRException {
393        if (name.equals("status")) {
394          throw new FHIRException("Cannot call addChild on a primitive type EpisodeOfCare.status");
395        }
396        else if (name.equals("period")) {
397          this.period = new Period();
398          return this.period;
399        }
400        else
401          return super.addChild(name);
402      }
403
404      public EpisodeOfCareStatusHistoryComponent copy() {
405        EpisodeOfCareStatusHistoryComponent dst = new EpisodeOfCareStatusHistoryComponent();
406        copyValues(dst);
407        dst.status = status == null ? null : status.copy();
408        dst.period = period == null ? null : period.copy();
409        return dst;
410      }
411
412      @Override
413      public boolean equalsDeep(Base other) {
414        if (!super.equalsDeep(other))
415          return false;
416        if (!(other instanceof EpisodeOfCareStatusHistoryComponent))
417          return false;
418        EpisodeOfCareStatusHistoryComponent o = (EpisodeOfCareStatusHistoryComponent) other;
419        return compareDeep(status, o.status, true) && compareDeep(period, o.period, true);
420      }
421
422      @Override
423      public boolean equalsShallow(Base other) {
424        if (!super.equalsShallow(other))
425          return false;
426        if (!(other instanceof EpisodeOfCareStatusHistoryComponent))
427          return false;
428        EpisodeOfCareStatusHistoryComponent o = (EpisodeOfCareStatusHistoryComponent) other;
429        return compareValues(status, o.status, true);
430      }
431
432      public boolean isEmpty() {
433        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, period);
434      }
435
436  public String fhirType() {
437    return "EpisodeOfCare.statusHistory";
438
439  }
440
441  }
442
443    @Block()
444    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
445        /**
446         * A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.
447         */
448        @Child(name = "condition", type = {Condition.class}, order=1, min=1, max=1, modifier=false, summary=true)
449        @Description(shortDefinition="Conditions/problems/diagnoses this episode of care is for", formalDefinition="A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for." )
450        protected Reference condition;
451
452        /**
453         * The actual object that is the target of the reference (A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.)
454         */
455        protected Condition conditionTarget;
456
457        /**
458         * Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …).
459         */
460        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
461        @Description(shortDefinition="Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …)", formalDefinition="Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …)." )
462        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diagnosis-role")
463        protected CodeableConcept role;
464
465        /**
466         * Ranking of the diagnosis (for each role type).
467         */
468        @Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true)
469        @Description(shortDefinition="Ranking of the diagnosis (for each role type)", formalDefinition="Ranking of the diagnosis (for each role type)." )
470        protected PositiveIntType rank;
471
472        private static final long serialVersionUID = 249445632L;
473
474    /**
475     * Constructor
476     */
477      public DiagnosisComponent() {
478        super();
479      }
480
481    /**
482     * Constructor
483     */
484      public DiagnosisComponent(Reference condition) {
485        super();
486        this.condition = condition;
487      }
488
489        /**
490         * @return {@link #condition} (A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.)
491         */
492        public Reference getCondition() { 
493          if (this.condition == null)
494            if (Configuration.errorOnAutoCreate())
495              throw new Error("Attempt to auto-create DiagnosisComponent.condition");
496            else if (Configuration.doAutoCreate())
497              this.condition = new Reference(); // cc
498          return this.condition;
499        }
500
501        public boolean hasCondition() { 
502          return this.condition != null && !this.condition.isEmpty();
503        }
504
505        /**
506         * @param value {@link #condition} (A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.)
507         */
508        public DiagnosisComponent setCondition(Reference value) { 
509          this.condition = value;
510          return this;
511        }
512
513        /**
514         * @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. (A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.)
515         */
516        public Condition getConditionTarget() { 
517          if (this.conditionTarget == null)
518            if (Configuration.errorOnAutoCreate())
519              throw new Error("Attempt to auto-create DiagnosisComponent.condition");
520            else if (Configuration.doAutoCreate())
521              this.conditionTarget = new Condition(); // aa
522          return this.conditionTarget;
523        }
524
525        /**
526         * @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. (A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.)
527         */
528        public DiagnosisComponent setConditionTarget(Condition value) { 
529          this.conditionTarget = value;
530          return this;
531        }
532
533        /**
534         * @return {@link #role} (Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …).)
535         */
536        public CodeableConcept getRole() { 
537          if (this.role == null)
538            if (Configuration.errorOnAutoCreate())
539              throw new Error("Attempt to auto-create DiagnosisComponent.role");
540            else if (Configuration.doAutoCreate())
541              this.role = new CodeableConcept(); // cc
542          return this.role;
543        }
544
545        public boolean hasRole() { 
546          return this.role != null && !this.role.isEmpty();
547        }
548
549        /**
550         * @param value {@link #role} (Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …).)
551         */
552        public DiagnosisComponent setRole(CodeableConcept value) { 
553          this.role = value;
554          return this;
555        }
556
557        /**
558         * @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
559         */
560        public PositiveIntType getRankElement() { 
561          if (this.rank == null)
562            if (Configuration.errorOnAutoCreate())
563              throw new Error("Attempt to auto-create DiagnosisComponent.rank");
564            else if (Configuration.doAutoCreate())
565              this.rank = new PositiveIntType(); // bb
566          return this.rank;
567        }
568
569        public boolean hasRankElement() { 
570          return this.rank != null && !this.rank.isEmpty();
571        }
572
573        public boolean hasRank() { 
574          return this.rank != null && !this.rank.isEmpty();
575        }
576
577        /**
578         * @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
579         */
580        public DiagnosisComponent setRankElement(PositiveIntType value) { 
581          this.rank = value;
582          return this;
583        }
584
585        /**
586         * @return Ranking of the diagnosis (for each role type).
587         */
588        public int getRank() { 
589          return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue();
590        }
591
592        /**
593         * @param value Ranking of the diagnosis (for each role type).
594         */
595        public DiagnosisComponent setRank(int value) { 
596            if (this.rank == null)
597              this.rank = new PositiveIntType();
598            this.rank.setValue(value);
599          return this;
600        }
601
602        protected void listChildren(List<Property> childrenList) {
603          super.listChildren(childrenList);
604          childrenList.add(new Property("condition", "Reference(Condition)", "A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.", 0, java.lang.Integer.MAX_VALUE, condition));
605          childrenList.add(new Property("role", "CodeableConcept", "Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …).", 0, java.lang.Integer.MAX_VALUE, role));
606          childrenList.add(new Property("rank", "positiveInt", "Ranking of the diagnosis (for each role type).", 0, java.lang.Integer.MAX_VALUE, rank));
607        }
608
609      @Override
610      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
611        switch (hash) {
612        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // Reference
613        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
614        case 3492908: /*rank*/ return this.rank == null ? new Base[0] : new Base[] {this.rank}; // PositiveIntType
615        default: return super.getProperty(hash, name, checkValid);
616        }
617
618      }
619
620      @Override
621      public Base setProperty(int hash, String name, Base value) throws FHIRException {
622        switch (hash) {
623        case -861311717: // condition
624          this.condition = castToReference(value); // Reference
625          return value;
626        case 3506294: // role
627          this.role = castToCodeableConcept(value); // CodeableConcept
628          return value;
629        case 3492908: // rank
630          this.rank = castToPositiveInt(value); // PositiveIntType
631          return value;
632        default: return super.setProperty(hash, name, value);
633        }
634
635      }
636
637      @Override
638      public Base setProperty(String name, Base value) throws FHIRException {
639        if (name.equals("condition")) {
640          this.condition = castToReference(value); // Reference
641        } else if (name.equals("role")) {
642          this.role = castToCodeableConcept(value); // CodeableConcept
643        } else if (name.equals("rank")) {
644          this.rank = castToPositiveInt(value); // PositiveIntType
645        } else
646          return super.setProperty(name, value);
647        return value;
648      }
649
650      @Override
651      public Base makeProperty(int hash, String name) throws FHIRException {
652        switch (hash) {
653        case -861311717:  return getCondition(); 
654        case 3506294:  return getRole(); 
655        case 3492908:  return getRankElement();
656        default: return super.makeProperty(hash, name);
657        }
658
659      }
660
661      @Override
662      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
663        switch (hash) {
664        case -861311717: /*condition*/ return new String[] {"Reference"};
665        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
666        case 3492908: /*rank*/ return new String[] {"positiveInt"};
667        default: return super.getTypesForProperty(hash, name);
668        }
669
670      }
671
672      @Override
673      public Base addChild(String name) throws FHIRException {
674        if (name.equals("condition")) {
675          this.condition = new Reference();
676          return this.condition;
677        }
678        else if (name.equals("role")) {
679          this.role = new CodeableConcept();
680          return this.role;
681        }
682        else if (name.equals("rank")) {
683          throw new FHIRException("Cannot call addChild on a primitive type EpisodeOfCare.rank");
684        }
685        else
686          return super.addChild(name);
687      }
688
689      public DiagnosisComponent copy() {
690        DiagnosisComponent dst = new DiagnosisComponent();
691        copyValues(dst);
692        dst.condition = condition == null ? null : condition.copy();
693        dst.role = role == null ? null : role.copy();
694        dst.rank = rank == null ? null : rank.copy();
695        return dst;
696      }
697
698      @Override
699      public boolean equalsDeep(Base other) {
700        if (!super.equalsDeep(other))
701          return false;
702        if (!(other instanceof DiagnosisComponent))
703          return false;
704        DiagnosisComponent o = (DiagnosisComponent) other;
705        return compareDeep(condition, o.condition, true) && compareDeep(role, o.role, true) && compareDeep(rank, o.rank, true)
706          ;
707      }
708
709      @Override
710      public boolean equalsShallow(Base other) {
711        if (!super.equalsShallow(other))
712          return false;
713        if (!(other instanceof DiagnosisComponent))
714          return false;
715        DiagnosisComponent o = (DiagnosisComponent) other;
716        return compareValues(rank, o.rank, true);
717      }
718
719      public boolean isEmpty() {
720        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(condition, role, rank);
721      }
722
723  public String fhirType() {
724    return "EpisodeOfCare.diagnosis";
725
726  }
727
728  }
729
730    /**
731     * The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.
732     */
733    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
734    @Description(shortDefinition="Business Identifier(s) relevant for this EpisodeOfCare", formalDefinition="The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes." )
735    protected List<Identifier> identifier;
736
737    /**
738     * planned | waitlist | active | onhold | finished | cancelled.
739     */
740    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
741    @Description(shortDefinition="planned | waitlist | active | onhold | finished | cancelled | entered-in-error", formalDefinition="planned | waitlist | active | onhold | finished | cancelled." )
742    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/episode-of-care-status")
743    protected Enumeration<EpisodeOfCareStatus> status;
744
745    /**
746     * The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).
747     */
748    @Child(name = "statusHistory", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
749    @Description(shortDefinition="Past list of status codes (the current status may be included to cover the start date of the status)", formalDefinition="The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource)." )
750    protected List<EpisodeOfCareStatusHistoryComponent> statusHistory;
751
752    /**
753     * A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.
754     */
755    @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
756    @Description(shortDefinition="Type/class  - e.g. specialist referral, disease management", formalDefinition="A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care." )
757    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/episodeofcare-type")
758    protected List<CodeableConcept> type;
759
760    /**
761     * The list of diagnosis relevant to this episode of care.
762     */
763    @Child(name = "diagnosis", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
764    @Description(shortDefinition="The list of diagnosis relevant to this episode of care", formalDefinition="The list of diagnosis relevant to this episode of care." )
765    protected List<DiagnosisComponent> diagnosis;
766
767    /**
768     * The patient who is the focus of this episode of care.
769     */
770    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
771    @Description(shortDefinition="The patient who is the focus of this episode of care", formalDefinition="The patient who is the focus of this episode of care." )
772    protected Reference patient;
773
774    /**
775     * The actual object that is the target of the reference (The patient who is the focus of this episode of care.)
776     */
777    protected Patient patientTarget;
778
779    /**
780     * The organization that has assumed the specific responsibilities for the specified duration.
781     */
782    @Child(name = "managingOrganization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
783    @Description(shortDefinition="Organization that assumes care", formalDefinition="The organization that has assumed the specific responsibilities for the specified duration." )
784    protected Reference managingOrganization;
785
786    /**
787     * The actual object that is the target of the reference (The organization that has assumed the specific responsibilities for the specified duration.)
788     */
789    protected Organization managingOrganizationTarget;
790
791    /**
792     * The interval during which the managing organization assumes the defined responsibility.
793     */
794    @Child(name = "period", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
795    @Description(shortDefinition="Interval during responsibility is assumed", formalDefinition="The interval during which the managing organization assumes the defined responsibility." )
796    protected Period period;
797
798    /**
799     * Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.
800     */
801    @Child(name = "referralRequest", type = {ReferralRequest.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
802    @Description(shortDefinition="Originating Referral Request(s)", formalDefinition="Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals." )
803    protected List<Reference> referralRequest;
804    /**
805     * The actual objects that are the target of the reference (Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.)
806     */
807    protected List<ReferralRequest> referralRequestTarget;
808
809
810    /**
811     * The practitioner that is the care manager/care co-ordinator for this patient.
812     */
813    @Child(name = "careManager", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=false)
814    @Description(shortDefinition="Care manager/care co-ordinator for the patient", formalDefinition="The practitioner that is the care manager/care co-ordinator for this patient." )
815    protected Reference careManager;
816
817    /**
818     * The actual object that is the target of the reference (The practitioner that is the care manager/care co-ordinator for this patient.)
819     */
820    protected Practitioner careManagerTarget;
821
822    /**
823     * The list of practitioners that may be facilitating this episode of care for specific purposes.
824     */
825    @Child(name = "team", type = {CareTeam.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
826    @Description(shortDefinition="Other practitioners facilitating this episode of care", formalDefinition="The list of practitioners that may be facilitating this episode of care for specific purposes." )
827    protected List<Reference> team;
828    /**
829     * The actual objects that are the target of the reference (The list of practitioners that may be facilitating this episode of care for specific purposes.)
830     */
831    protected List<CareTeam> teamTarget;
832
833
834    /**
835     * The set of accounts that may be used for billing for this EpisodeOfCare.
836     */
837    @Child(name = "account", type = {Account.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
838    @Description(shortDefinition="The set of accounts that may be used for billing for this EpisodeOfCare", formalDefinition="The set of accounts that may be used for billing for this EpisodeOfCare." )
839    protected List<Reference> account;
840    /**
841     * The actual objects that are the target of the reference (The set of accounts that may be used for billing for this EpisodeOfCare.)
842     */
843    protected List<Account> accountTarget;
844
845
846    private static final long serialVersionUID = 76719771L;
847
848  /**
849   * Constructor
850   */
851    public EpisodeOfCare() {
852      super();
853    }
854
855  /**
856   * Constructor
857   */
858    public EpisodeOfCare(Enumeration<EpisodeOfCareStatus> status, Reference patient) {
859      super();
860      this.status = status;
861      this.patient = patient;
862    }
863
864    /**
865     * @return {@link #identifier} (The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.)
866     */
867    public List<Identifier> getIdentifier() { 
868      if (this.identifier == null)
869        this.identifier = new ArrayList<Identifier>();
870      return this.identifier;
871    }
872
873    /**
874     * @return Returns a reference to <code>this</code> for easy method chaining
875     */
876    public EpisodeOfCare setIdentifier(List<Identifier> theIdentifier) { 
877      this.identifier = theIdentifier;
878      return this;
879    }
880
881    public boolean hasIdentifier() { 
882      if (this.identifier == null)
883        return false;
884      for (Identifier item : this.identifier)
885        if (!item.isEmpty())
886          return true;
887      return false;
888    }
889
890    public Identifier addIdentifier() { //3
891      Identifier t = new Identifier();
892      if (this.identifier == null)
893        this.identifier = new ArrayList<Identifier>();
894      this.identifier.add(t);
895      return t;
896    }
897
898    public EpisodeOfCare addIdentifier(Identifier t) { //3
899      if (t == null)
900        return this;
901      if (this.identifier == null)
902        this.identifier = new ArrayList<Identifier>();
903      this.identifier.add(t);
904      return this;
905    }
906
907    /**
908     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
909     */
910    public Identifier getIdentifierFirstRep() { 
911      if (getIdentifier().isEmpty()) {
912        addIdentifier();
913      }
914      return getIdentifier().get(0);
915    }
916
917    /**
918     * @return {@link #status} (planned | waitlist | active | onhold | finished | cancelled.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
919     */
920    public Enumeration<EpisodeOfCareStatus> getStatusElement() { 
921      if (this.status == null)
922        if (Configuration.errorOnAutoCreate())
923          throw new Error("Attempt to auto-create EpisodeOfCare.status");
924        else if (Configuration.doAutoCreate())
925          this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); // bb
926      return this.status;
927    }
928
929    public boolean hasStatusElement() { 
930      return this.status != null && !this.status.isEmpty();
931    }
932
933    public boolean hasStatus() { 
934      return this.status != null && !this.status.isEmpty();
935    }
936
937    /**
938     * @param value {@link #status} (planned | waitlist | active | onhold | finished | cancelled.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
939     */
940    public EpisodeOfCare setStatusElement(Enumeration<EpisodeOfCareStatus> value) { 
941      this.status = value;
942      return this;
943    }
944
945    /**
946     * @return planned | waitlist | active | onhold | finished | cancelled.
947     */
948    public EpisodeOfCareStatus getStatus() { 
949      return this.status == null ? null : this.status.getValue();
950    }
951
952    /**
953     * @param value planned | waitlist | active | onhold | finished | cancelled.
954     */
955    public EpisodeOfCare setStatus(EpisodeOfCareStatus value) { 
956        if (this.status == null)
957          this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory());
958        this.status.setValue(value);
959      return this;
960    }
961
962    /**
963     * @return {@link #statusHistory} (The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).)
964     */
965    public List<EpisodeOfCareStatusHistoryComponent> getStatusHistory() { 
966      if (this.statusHistory == null)
967        this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>();
968      return this.statusHistory;
969    }
970
971    /**
972     * @return Returns a reference to <code>this</code> for easy method chaining
973     */
974    public EpisodeOfCare setStatusHistory(List<EpisodeOfCareStatusHistoryComponent> theStatusHistory) { 
975      this.statusHistory = theStatusHistory;
976      return this;
977    }
978
979    public boolean hasStatusHistory() { 
980      if (this.statusHistory == null)
981        return false;
982      for (EpisodeOfCareStatusHistoryComponent item : this.statusHistory)
983        if (!item.isEmpty())
984          return true;
985      return false;
986    }
987
988    public EpisodeOfCareStatusHistoryComponent addStatusHistory() { //3
989      EpisodeOfCareStatusHistoryComponent t = new EpisodeOfCareStatusHistoryComponent();
990      if (this.statusHistory == null)
991        this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>();
992      this.statusHistory.add(t);
993      return t;
994    }
995
996    public EpisodeOfCare addStatusHistory(EpisodeOfCareStatusHistoryComponent t) { //3
997      if (t == null)
998        return this;
999      if (this.statusHistory == null)
1000        this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>();
1001      this.statusHistory.add(t);
1002      return this;
1003    }
1004
1005    /**
1006     * @return The first repetition of repeating field {@link #statusHistory}, creating it if it does not already exist
1007     */
1008    public EpisodeOfCareStatusHistoryComponent getStatusHistoryFirstRep() { 
1009      if (getStatusHistory().isEmpty()) {
1010        addStatusHistory();
1011      }
1012      return getStatusHistory().get(0);
1013    }
1014
1015    /**
1016     * @return {@link #type} (A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.)
1017     */
1018    public List<CodeableConcept> getType() { 
1019      if (this.type == null)
1020        this.type = new ArrayList<CodeableConcept>();
1021      return this.type;
1022    }
1023
1024    /**
1025     * @return Returns a reference to <code>this</code> for easy method chaining
1026     */
1027    public EpisodeOfCare setType(List<CodeableConcept> theType) { 
1028      this.type = theType;
1029      return this;
1030    }
1031
1032    public boolean hasType() { 
1033      if (this.type == null)
1034        return false;
1035      for (CodeableConcept item : this.type)
1036        if (!item.isEmpty())
1037          return true;
1038      return false;
1039    }
1040
1041    public CodeableConcept addType() { //3
1042      CodeableConcept t = new CodeableConcept();
1043      if (this.type == null)
1044        this.type = new ArrayList<CodeableConcept>();
1045      this.type.add(t);
1046      return t;
1047    }
1048
1049    public EpisodeOfCare addType(CodeableConcept t) { //3
1050      if (t == null)
1051        return this;
1052      if (this.type == null)
1053        this.type = new ArrayList<CodeableConcept>();
1054      this.type.add(t);
1055      return this;
1056    }
1057
1058    /**
1059     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1060     */
1061    public CodeableConcept getTypeFirstRep() { 
1062      if (getType().isEmpty()) {
1063        addType();
1064      }
1065      return getType().get(0);
1066    }
1067
1068    /**
1069     * @return {@link #diagnosis} (The list of diagnosis relevant to this episode of care.)
1070     */
1071    public List<DiagnosisComponent> getDiagnosis() { 
1072      if (this.diagnosis == null)
1073        this.diagnosis = new ArrayList<DiagnosisComponent>();
1074      return this.diagnosis;
1075    }
1076
1077    /**
1078     * @return Returns a reference to <code>this</code> for easy method chaining
1079     */
1080    public EpisodeOfCare setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
1081      this.diagnosis = theDiagnosis;
1082      return this;
1083    }
1084
1085    public boolean hasDiagnosis() { 
1086      if (this.diagnosis == null)
1087        return false;
1088      for (DiagnosisComponent item : this.diagnosis)
1089        if (!item.isEmpty())
1090          return true;
1091      return false;
1092    }
1093
1094    public DiagnosisComponent addDiagnosis() { //3
1095      DiagnosisComponent t = new DiagnosisComponent();
1096      if (this.diagnosis == null)
1097        this.diagnosis = new ArrayList<DiagnosisComponent>();
1098      this.diagnosis.add(t);
1099      return t;
1100    }
1101
1102    public EpisodeOfCare addDiagnosis(DiagnosisComponent t) { //3
1103      if (t == null)
1104        return this;
1105      if (this.diagnosis == null)
1106        this.diagnosis = new ArrayList<DiagnosisComponent>();
1107      this.diagnosis.add(t);
1108      return this;
1109    }
1110
1111    /**
1112     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
1113     */
1114    public DiagnosisComponent getDiagnosisFirstRep() { 
1115      if (getDiagnosis().isEmpty()) {
1116        addDiagnosis();
1117      }
1118      return getDiagnosis().get(0);
1119    }
1120
1121    /**
1122     * @return {@link #patient} (The patient who is the focus of this episode of care.)
1123     */
1124    public Reference getPatient() { 
1125      if (this.patient == null)
1126        if (Configuration.errorOnAutoCreate())
1127          throw new Error("Attempt to auto-create EpisodeOfCare.patient");
1128        else if (Configuration.doAutoCreate())
1129          this.patient = new Reference(); // cc
1130      return this.patient;
1131    }
1132
1133    public boolean hasPatient() { 
1134      return this.patient != null && !this.patient.isEmpty();
1135    }
1136
1137    /**
1138     * @param value {@link #patient} (The patient who is the focus of this episode of care.)
1139     */
1140    public EpisodeOfCare setPatient(Reference value) { 
1141      this.patient = value;
1142      return this;
1143    }
1144
1145    /**
1146     * @return {@link #patient} 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 who is the focus of this episode of care.)
1147     */
1148    public Patient getPatientTarget() { 
1149      if (this.patientTarget == null)
1150        if (Configuration.errorOnAutoCreate())
1151          throw new Error("Attempt to auto-create EpisodeOfCare.patient");
1152        else if (Configuration.doAutoCreate())
1153          this.patientTarget = new Patient(); // aa
1154      return this.patientTarget;
1155    }
1156
1157    /**
1158     * @param value {@link #patient} 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 who is the focus of this episode of care.)
1159     */
1160    public EpisodeOfCare setPatientTarget(Patient value) { 
1161      this.patientTarget = value;
1162      return this;
1163    }
1164
1165    /**
1166     * @return {@link #managingOrganization} (The organization that has assumed the specific responsibilities for the specified duration.)
1167     */
1168    public Reference getManagingOrganization() { 
1169      if (this.managingOrganization == null)
1170        if (Configuration.errorOnAutoCreate())
1171          throw new Error("Attempt to auto-create EpisodeOfCare.managingOrganization");
1172        else if (Configuration.doAutoCreate())
1173          this.managingOrganization = new Reference(); // cc
1174      return this.managingOrganization;
1175    }
1176
1177    public boolean hasManagingOrganization() { 
1178      return this.managingOrganization != null && !this.managingOrganization.isEmpty();
1179    }
1180
1181    /**
1182     * @param value {@link #managingOrganization} (The organization that has assumed the specific responsibilities for the specified duration.)
1183     */
1184    public EpisodeOfCare setManagingOrganization(Reference value) { 
1185      this.managingOrganization = value;
1186      return this;
1187    }
1188
1189    /**
1190     * @return {@link #managingOrganization} 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 organization that has assumed the specific responsibilities for the specified duration.)
1191     */
1192    public Organization getManagingOrganizationTarget() { 
1193      if (this.managingOrganizationTarget == null)
1194        if (Configuration.errorOnAutoCreate())
1195          throw new Error("Attempt to auto-create EpisodeOfCare.managingOrganization");
1196        else if (Configuration.doAutoCreate())
1197          this.managingOrganizationTarget = new Organization(); // aa
1198      return this.managingOrganizationTarget;
1199    }
1200
1201    /**
1202     * @param value {@link #managingOrganization} 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 organization that has assumed the specific responsibilities for the specified duration.)
1203     */
1204    public EpisodeOfCare setManagingOrganizationTarget(Organization value) { 
1205      this.managingOrganizationTarget = value;
1206      return this;
1207    }
1208
1209    /**
1210     * @return {@link #period} (The interval during which the managing organization assumes the defined responsibility.)
1211     */
1212    public Period getPeriod() { 
1213      if (this.period == null)
1214        if (Configuration.errorOnAutoCreate())
1215          throw new Error("Attempt to auto-create EpisodeOfCare.period");
1216        else if (Configuration.doAutoCreate())
1217          this.period = new Period(); // cc
1218      return this.period;
1219    }
1220
1221    public boolean hasPeriod() { 
1222      return this.period != null && !this.period.isEmpty();
1223    }
1224
1225    /**
1226     * @param value {@link #period} (The interval during which the managing organization assumes the defined responsibility.)
1227     */
1228    public EpisodeOfCare setPeriod(Period value) { 
1229      this.period = value;
1230      return this;
1231    }
1232
1233    /**
1234     * @return {@link #referralRequest} (Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.)
1235     */
1236    public List<Reference> getReferralRequest() { 
1237      if (this.referralRequest == null)
1238        this.referralRequest = new ArrayList<Reference>();
1239      return this.referralRequest;
1240    }
1241
1242    /**
1243     * @return Returns a reference to <code>this</code> for easy method chaining
1244     */
1245    public EpisodeOfCare setReferralRequest(List<Reference> theReferralRequest) { 
1246      this.referralRequest = theReferralRequest;
1247      return this;
1248    }
1249
1250    public boolean hasReferralRequest() { 
1251      if (this.referralRequest == null)
1252        return false;
1253      for (Reference item : this.referralRequest)
1254        if (!item.isEmpty())
1255          return true;
1256      return false;
1257    }
1258
1259    public Reference addReferralRequest() { //3
1260      Reference t = new Reference();
1261      if (this.referralRequest == null)
1262        this.referralRequest = new ArrayList<Reference>();
1263      this.referralRequest.add(t);
1264      return t;
1265    }
1266
1267    public EpisodeOfCare addReferralRequest(Reference t) { //3
1268      if (t == null)
1269        return this;
1270      if (this.referralRequest == null)
1271        this.referralRequest = new ArrayList<Reference>();
1272      this.referralRequest.add(t);
1273      return this;
1274    }
1275
1276    /**
1277     * @return The first repetition of repeating field {@link #referralRequest}, creating it if it does not already exist
1278     */
1279    public Reference getReferralRequestFirstRep() { 
1280      if (getReferralRequest().isEmpty()) {
1281        addReferralRequest();
1282      }
1283      return getReferralRequest().get(0);
1284    }
1285
1286    /**
1287     * @deprecated Use Reference#setResource(IBaseResource) instead
1288     */
1289    @Deprecated
1290    public List<ReferralRequest> getReferralRequestTarget() { 
1291      if (this.referralRequestTarget == null)
1292        this.referralRequestTarget = new ArrayList<ReferralRequest>();
1293      return this.referralRequestTarget;
1294    }
1295
1296    /**
1297     * @deprecated Use Reference#setResource(IBaseResource) instead
1298     */
1299    @Deprecated
1300    public ReferralRequest addReferralRequestTarget() { 
1301      ReferralRequest r = new ReferralRequest();
1302      if (this.referralRequestTarget == null)
1303        this.referralRequestTarget = new ArrayList<ReferralRequest>();
1304      this.referralRequestTarget.add(r);
1305      return r;
1306    }
1307
1308    /**
1309     * @return {@link #careManager} (The practitioner that is the care manager/care co-ordinator for this patient.)
1310     */
1311    public Reference getCareManager() { 
1312      if (this.careManager == null)
1313        if (Configuration.errorOnAutoCreate())
1314          throw new Error("Attempt to auto-create EpisodeOfCare.careManager");
1315        else if (Configuration.doAutoCreate())
1316          this.careManager = new Reference(); // cc
1317      return this.careManager;
1318    }
1319
1320    public boolean hasCareManager() { 
1321      return this.careManager != null && !this.careManager.isEmpty();
1322    }
1323
1324    /**
1325     * @param value {@link #careManager} (The practitioner that is the care manager/care co-ordinator for this patient.)
1326     */
1327    public EpisodeOfCare setCareManager(Reference value) { 
1328      this.careManager = value;
1329      return this;
1330    }
1331
1332    /**
1333     * @return {@link #careManager} 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 practitioner that is the care manager/care co-ordinator for this patient.)
1334     */
1335    public Practitioner getCareManagerTarget() { 
1336      if (this.careManagerTarget == null)
1337        if (Configuration.errorOnAutoCreate())
1338          throw new Error("Attempt to auto-create EpisodeOfCare.careManager");
1339        else if (Configuration.doAutoCreate())
1340          this.careManagerTarget = new Practitioner(); // aa
1341      return this.careManagerTarget;
1342    }
1343
1344    /**
1345     * @param value {@link #careManager} 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 practitioner that is the care manager/care co-ordinator for this patient.)
1346     */
1347    public EpisodeOfCare setCareManagerTarget(Practitioner value) { 
1348      this.careManagerTarget = value;
1349      return this;
1350    }
1351
1352    /**
1353     * @return {@link #team} (The list of practitioners that may be facilitating this episode of care for specific purposes.)
1354     */
1355    public List<Reference> getTeam() { 
1356      if (this.team == null)
1357        this.team = new ArrayList<Reference>();
1358      return this.team;
1359    }
1360
1361    /**
1362     * @return Returns a reference to <code>this</code> for easy method chaining
1363     */
1364    public EpisodeOfCare setTeam(List<Reference> theTeam) { 
1365      this.team = theTeam;
1366      return this;
1367    }
1368
1369    public boolean hasTeam() { 
1370      if (this.team == null)
1371        return false;
1372      for (Reference item : this.team)
1373        if (!item.isEmpty())
1374          return true;
1375      return false;
1376    }
1377
1378    public Reference addTeam() { //3
1379      Reference t = new Reference();
1380      if (this.team == null)
1381        this.team = new ArrayList<Reference>();
1382      this.team.add(t);
1383      return t;
1384    }
1385
1386    public EpisodeOfCare addTeam(Reference t) { //3
1387      if (t == null)
1388        return this;
1389      if (this.team == null)
1390        this.team = new ArrayList<Reference>();
1391      this.team.add(t);
1392      return this;
1393    }
1394
1395    /**
1396     * @return The first repetition of repeating field {@link #team}, creating it if it does not already exist
1397     */
1398    public Reference getTeamFirstRep() { 
1399      if (getTeam().isEmpty()) {
1400        addTeam();
1401      }
1402      return getTeam().get(0);
1403    }
1404
1405    /**
1406     * @deprecated Use Reference#setResource(IBaseResource) instead
1407     */
1408    @Deprecated
1409    public List<CareTeam> getTeamTarget() { 
1410      if (this.teamTarget == null)
1411        this.teamTarget = new ArrayList<CareTeam>();
1412      return this.teamTarget;
1413    }
1414
1415    /**
1416     * @deprecated Use Reference#setResource(IBaseResource) instead
1417     */
1418    @Deprecated
1419    public CareTeam addTeamTarget() { 
1420      CareTeam r = new CareTeam();
1421      if (this.teamTarget == null)
1422        this.teamTarget = new ArrayList<CareTeam>();
1423      this.teamTarget.add(r);
1424      return r;
1425    }
1426
1427    /**
1428     * @return {@link #account} (The set of accounts that may be used for billing for this EpisodeOfCare.)
1429     */
1430    public List<Reference> getAccount() { 
1431      if (this.account == null)
1432        this.account = new ArrayList<Reference>();
1433      return this.account;
1434    }
1435
1436    /**
1437     * @return Returns a reference to <code>this</code> for easy method chaining
1438     */
1439    public EpisodeOfCare setAccount(List<Reference> theAccount) { 
1440      this.account = theAccount;
1441      return this;
1442    }
1443
1444    public boolean hasAccount() { 
1445      if (this.account == null)
1446        return false;
1447      for (Reference item : this.account)
1448        if (!item.isEmpty())
1449          return true;
1450      return false;
1451    }
1452
1453    public Reference addAccount() { //3
1454      Reference t = new Reference();
1455      if (this.account == null)
1456        this.account = new ArrayList<Reference>();
1457      this.account.add(t);
1458      return t;
1459    }
1460
1461    public EpisodeOfCare addAccount(Reference t) { //3
1462      if (t == null)
1463        return this;
1464      if (this.account == null)
1465        this.account = new ArrayList<Reference>();
1466      this.account.add(t);
1467      return this;
1468    }
1469
1470    /**
1471     * @return The first repetition of repeating field {@link #account}, creating it if it does not already exist
1472     */
1473    public Reference getAccountFirstRep() { 
1474      if (getAccount().isEmpty()) {
1475        addAccount();
1476      }
1477      return getAccount().get(0);
1478    }
1479
1480    /**
1481     * @deprecated Use Reference#setResource(IBaseResource) instead
1482     */
1483    @Deprecated
1484    public List<Account> getAccountTarget() { 
1485      if (this.accountTarget == null)
1486        this.accountTarget = new ArrayList<Account>();
1487      return this.accountTarget;
1488    }
1489
1490    /**
1491     * @deprecated Use Reference#setResource(IBaseResource) instead
1492     */
1493    @Deprecated
1494    public Account addAccountTarget() { 
1495      Account r = new Account();
1496      if (this.accountTarget == null)
1497        this.accountTarget = new ArrayList<Account>();
1498      this.accountTarget.add(r);
1499      return r;
1500    }
1501
1502      protected void listChildren(List<Property> childrenList) {
1503        super.listChildren(childrenList);
1504        childrenList.add(new Property("identifier", "Identifier", "The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.", 0, java.lang.Integer.MAX_VALUE, identifier));
1505        childrenList.add(new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 0, java.lang.Integer.MAX_VALUE, status));
1506        childrenList.add(new Property("statusHistory", "", "The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).", 0, java.lang.Integer.MAX_VALUE, statusHistory));
1507        childrenList.add(new Property("type", "CodeableConcept", "A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.", 0, java.lang.Integer.MAX_VALUE, type));
1508        childrenList.add(new Property("diagnosis", "", "The list of diagnosis relevant to this episode of care.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
1509        childrenList.add(new Property("patient", "Reference(Patient)", "The patient who is the focus of this episode of care.", 0, java.lang.Integer.MAX_VALUE, patient));
1510        childrenList.add(new Property("managingOrganization", "Reference(Organization)", "The organization that has assumed the specific responsibilities for the specified duration.", 0, java.lang.Integer.MAX_VALUE, managingOrganization));
1511        childrenList.add(new Property("period", "Period", "The interval during which the managing organization assumes the defined responsibility.", 0, java.lang.Integer.MAX_VALUE, period));
1512        childrenList.add(new Property("referralRequest", "Reference(ReferralRequest)", "Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.", 0, java.lang.Integer.MAX_VALUE, referralRequest));
1513        childrenList.add(new Property("careManager", "Reference(Practitioner)", "The practitioner that is the care manager/care co-ordinator for this patient.", 0, java.lang.Integer.MAX_VALUE, careManager));
1514        childrenList.add(new Property("team", "Reference(CareTeam)", "The list of practitioners that may be facilitating this episode of care for specific purposes.", 0, java.lang.Integer.MAX_VALUE, team));
1515        childrenList.add(new Property("account", "Reference(Account)", "The set of accounts that may be used for billing for this EpisodeOfCare.", 0, java.lang.Integer.MAX_VALUE, account));
1516      }
1517
1518      @Override
1519      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1520        switch (hash) {
1521        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1522        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EpisodeOfCareStatus>
1523        case -986695614: /*statusHistory*/ return this.statusHistory == null ? new Base[0] : this.statusHistory.toArray(new Base[this.statusHistory.size()]); // EpisodeOfCareStatusHistoryComponent
1524        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1525        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
1526        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1527        case -2058947787: /*managingOrganization*/ return this.managingOrganization == null ? new Base[0] : new Base[] {this.managingOrganization}; // Reference
1528        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1529        case -310299598: /*referralRequest*/ return this.referralRequest == null ? new Base[0] : this.referralRequest.toArray(new Base[this.referralRequest.size()]); // Reference
1530        case -1147746468: /*careManager*/ return this.careManager == null ? new Base[0] : new Base[] {this.careManager}; // Reference
1531        case 3555933: /*team*/ return this.team == null ? new Base[0] : this.team.toArray(new Base[this.team.size()]); // Reference
1532        case -1177318867: /*account*/ return this.account == null ? new Base[0] : this.account.toArray(new Base[this.account.size()]); // Reference
1533        default: return super.getProperty(hash, name, checkValid);
1534        }
1535
1536      }
1537
1538      @Override
1539      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1540        switch (hash) {
1541        case -1618432855: // identifier
1542          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1543          return value;
1544        case -892481550: // status
1545          value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value));
1546          this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus>
1547          return value;
1548        case -986695614: // statusHistory
1549          this.getStatusHistory().add((EpisodeOfCareStatusHistoryComponent) value); // EpisodeOfCareStatusHistoryComponent
1550          return value;
1551        case 3575610: // type
1552          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1553          return value;
1554        case 1196993265: // diagnosis
1555          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
1556          return value;
1557        case -791418107: // patient
1558          this.patient = castToReference(value); // Reference
1559          return value;
1560        case -2058947787: // managingOrganization
1561          this.managingOrganization = castToReference(value); // Reference
1562          return value;
1563        case -991726143: // period
1564          this.period = castToPeriod(value); // Period
1565          return value;
1566        case -310299598: // referralRequest
1567          this.getReferralRequest().add(castToReference(value)); // Reference
1568          return value;
1569        case -1147746468: // careManager
1570          this.careManager = castToReference(value); // Reference
1571          return value;
1572        case 3555933: // team
1573          this.getTeam().add(castToReference(value)); // Reference
1574          return value;
1575        case -1177318867: // account
1576          this.getAccount().add(castToReference(value)); // Reference
1577          return value;
1578        default: return super.setProperty(hash, name, value);
1579        }
1580
1581      }
1582
1583      @Override
1584      public Base setProperty(String name, Base value) throws FHIRException {
1585        if (name.equals("identifier")) {
1586          this.getIdentifier().add(castToIdentifier(value));
1587        } else if (name.equals("status")) {
1588          value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value));
1589          this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus>
1590        } else if (name.equals("statusHistory")) {
1591          this.getStatusHistory().add((EpisodeOfCareStatusHistoryComponent) value);
1592        } else if (name.equals("type")) {
1593          this.getType().add(castToCodeableConcept(value));
1594        } else if (name.equals("diagnosis")) {
1595          this.getDiagnosis().add((DiagnosisComponent) value);
1596        } else if (name.equals("patient")) {
1597          this.patient = castToReference(value); // Reference
1598        } else if (name.equals("managingOrganization")) {
1599          this.managingOrganization = castToReference(value); // Reference
1600        } else if (name.equals("period")) {
1601          this.period = castToPeriod(value); // Period
1602        } else if (name.equals("referralRequest")) {
1603          this.getReferralRequest().add(castToReference(value));
1604        } else if (name.equals("careManager")) {
1605          this.careManager = castToReference(value); // Reference
1606        } else if (name.equals("team")) {
1607          this.getTeam().add(castToReference(value));
1608        } else if (name.equals("account")) {
1609          this.getAccount().add(castToReference(value));
1610        } else
1611          return super.setProperty(name, value);
1612        return value;
1613      }
1614
1615      @Override
1616      public Base makeProperty(int hash, String name) throws FHIRException {
1617        switch (hash) {
1618        case -1618432855:  return addIdentifier(); 
1619        case -892481550:  return getStatusElement();
1620        case -986695614:  return addStatusHistory(); 
1621        case 3575610:  return addType(); 
1622        case 1196993265:  return addDiagnosis(); 
1623        case -791418107:  return getPatient(); 
1624        case -2058947787:  return getManagingOrganization(); 
1625        case -991726143:  return getPeriod(); 
1626        case -310299598:  return addReferralRequest(); 
1627        case -1147746468:  return getCareManager(); 
1628        case 3555933:  return addTeam(); 
1629        case -1177318867:  return addAccount(); 
1630        default: return super.makeProperty(hash, name);
1631        }
1632
1633      }
1634
1635      @Override
1636      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1637        switch (hash) {
1638        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1639        case -892481550: /*status*/ return new String[] {"code"};
1640        case -986695614: /*statusHistory*/ return new String[] {};
1641        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1642        case 1196993265: /*diagnosis*/ return new String[] {};
1643        case -791418107: /*patient*/ return new String[] {"Reference"};
1644        case -2058947787: /*managingOrganization*/ return new String[] {"Reference"};
1645        case -991726143: /*period*/ return new String[] {"Period"};
1646        case -310299598: /*referralRequest*/ return new String[] {"Reference"};
1647        case -1147746468: /*careManager*/ return new String[] {"Reference"};
1648        case 3555933: /*team*/ return new String[] {"Reference"};
1649        case -1177318867: /*account*/ return new String[] {"Reference"};
1650        default: return super.getTypesForProperty(hash, name);
1651        }
1652
1653      }
1654
1655      @Override
1656      public Base addChild(String name) throws FHIRException {
1657        if (name.equals("identifier")) {
1658          return addIdentifier();
1659        }
1660        else if (name.equals("status")) {
1661          throw new FHIRException("Cannot call addChild on a primitive type EpisodeOfCare.status");
1662        }
1663        else if (name.equals("statusHistory")) {
1664          return addStatusHistory();
1665        }
1666        else if (name.equals("type")) {
1667          return addType();
1668        }
1669        else if (name.equals("diagnosis")) {
1670          return addDiagnosis();
1671        }
1672        else if (name.equals("patient")) {
1673          this.patient = new Reference();
1674          return this.patient;
1675        }
1676        else if (name.equals("managingOrganization")) {
1677          this.managingOrganization = new Reference();
1678          return this.managingOrganization;
1679        }
1680        else if (name.equals("period")) {
1681          this.period = new Period();
1682          return this.period;
1683        }
1684        else if (name.equals("referralRequest")) {
1685          return addReferralRequest();
1686        }
1687        else if (name.equals("careManager")) {
1688          this.careManager = new Reference();
1689          return this.careManager;
1690        }
1691        else if (name.equals("team")) {
1692          return addTeam();
1693        }
1694        else if (name.equals("account")) {
1695          return addAccount();
1696        }
1697        else
1698          return super.addChild(name);
1699      }
1700
1701  public String fhirType() {
1702    return "EpisodeOfCare";
1703
1704  }
1705
1706      public EpisodeOfCare copy() {
1707        EpisodeOfCare dst = new EpisodeOfCare();
1708        copyValues(dst);
1709        if (identifier != null) {
1710          dst.identifier = new ArrayList<Identifier>();
1711          for (Identifier i : identifier)
1712            dst.identifier.add(i.copy());
1713        };
1714        dst.status = status == null ? null : status.copy();
1715        if (statusHistory != null) {
1716          dst.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>();
1717          for (EpisodeOfCareStatusHistoryComponent i : statusHistory)
1718            dst.statusHistory.add(i.copy());
1719        };
1720        if (type != null) {
1721          dst.type = new ArrayList<CodeableConcept>();
1722          for (CodeableConcept i : type)
1723            dst.type.add(i.copy());
1724        };
1725        if (diagnosis != null) {
1726          dst.diagnosis = new ArrayList<DiagnosisComponent>();
1727          for (DiagnosisComponent i : diagnosis)
1728            dst.diagnosis.add(i.copy());
1729        };
1730        dst.patient = patient == null ? null : patient.copy();
1731        dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
1732        dst.period = period == null ? null : period.copy();
1733        if (referralRequest != null) {
1734          dst.referralRequest = new ArrayList<Reference>();
1735          for (Reference i : referralRequest)
1736            dst.referralRequest.add(i.copy());
1737        };
1738        dst.careManager = careManager == null ? null : careManager.copy();
1739        if (team != null) {
1740          dst.team = new ArrayList<Reference>();
1741          for (Reference i : team)
1742            dst.team.add(i.copy());
1743        };
1744        if (account != null) {
1745          dst.account = new ArrayList<Reference>();
1746          for (Reference i : account)
1747            dst.account.add(i.copy());
1748        };
1749        return dst;
1750      }
1751
1752      protected EpisodeOfCare typedCopy() {
1753        return copy();
1754      }
1755
1756      @Override
1757      public boolean equalsDeep(Base other) {
1758        if (!super.equalsDeep(other))
1759          return false;
1760        if (!(other instanceof EpisodeOfCare))
1761          return false;
1762        EpisodeOfCare o = (EpisodeOfCare) other;
1763        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(statusHistory, o.statusHistory, true)
1764           && compareDeep(type, o.type, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(patient, o.patient, true)
1765           && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(period, o.period, true)
1766           && compareDeep(referralRequest, o.referralRequest, true) && compareDeep(careManager, o.careManager, true)
1767           && compareDeep(team, o.team, true) && compareDeep(account, o.account, true);
1768      }
1769
1770      @Override
1771      public boolean equalsShallow(Base other) {
1772        if (!super.equalsShallow(other))
1773          return false;
1774        if (!(other instanceof EpisodeOfCare))
1775          return false;
1776        EpisodeOfCare o = (EpisodeOfCare) other;
1777        return compareValues(status, o.status, true);
1778      }
1779
1780      public boolean isEmpty() {
1781        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusHistory
1782          , type, diagnosis, patient, managingOrganization, period, referralRequest, careManager
1783          , team, account);
1784      }
1785
1786  @Override
1787  public ResourceType getResourceType() {
1788    return ResourceType.EpisodeOfCare;
1789   }
1790
1791 /**
1792   * Search parameter: <b>date</b>
1793   * <p>
1794   * Description: <b>The provided date search value falls within the episode of care's period</b><br>
1795   * Type: <b>date</b><br>
1796   * Path: <b>EpisodeOfCare.period</b><br>
1797   * </p>
1798   */
1799  @SearchParamDefinition(name="date", path="EpisodeOfCare.period", description="The provided date search value falls within the episode of care's period", type="date" )
1800  public static final String SP_DATE = "date";
1801 /**
1802   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1803   * <p>
1804   * Description: <b>The provided date search value falls within the episode of care's period</b><br>
1805   * Type: <b>date</b><br>
1806   * Path: <b>EpisodeOfCare.period</b><br>
1807   * </p>
1808   */
1809  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1810
1811 /**
1812   * Search parameter: <b>identifier</b>
1813   * <p>
1814   * Description: <b>Business Identifier(s) relevant for this EpisodeOfCare</b><br>
1815   * Type: <b>token</b><br>
1816   * Path: <b>EpisodeOfCare.identifier</b><br>
1817   * </p>
1818   */
1819  @SearchParamDefinition(name="identifier", path="EpisodeOfCare.identifier", description="Business Identifier(s) relevant for this EpisodeOfCare", type="token" )
1820  public static final String SP_IDENTIFIER = "identifier";
1821 /**
1822   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1823   * <p>
1824   * Description: <b>Business Identifier(s) relevant for this EpisodeOfCare</b><br>
1825   * Type: <b>token</b><br>
1826   * Path: <b>EpisodeOfCare.identifier</b><br>
1827   * </p>
1828   */
1829  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1830
1831 /**
1832   * Search parameter: <b>condition</b>
1833   * <p>
1834   * Description: <b>Conditions/problems/diagnoses this episode of care is for</b><br>
1835   * Type: <b>reference</b><br>
1836   * Path: <b>EpisodeOfCare.diagnosis.condition</b><br>
1837   * </p>
1838   */
1839  @SearchParamDefinition(name="condition", path="EpisodeOfCare.diagnosis.condition", description="Conditions/problems/diagnoses this episode of care is for", type="reference", target={Condition.class } )
1840  public static final String SP_CONDITION = "condition";
1841 /**
1842   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
1843   * <p>
1844   * Description: <b>Conditions/problems/diagnoses this episode of care is for</b><br>
1845   * Type: <b>reference</b><br>
1846   * Path: <b>EpisodeOfCare.diagnosis.condition</b><br>
1847   * </p>
1848   */
1849  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONDITION);
1850
1851/**
1852   * Constant for fluent queries to be used to add include statements. Specifies
1853   * the path value of "<b>EpisodeOfCare:condition</b>".
1854   */
1855  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include("EpisodeOfCare:condition").toLocked();
1856
1857 /**
1858   * Search parameter: <b>incomingreferral</b>
1859   * <p>
1860   * Description: <b>Incoming Referral Request</b><br>
1861   * Type: <b>reference</b><br>
1862   * Path: <b>EpisodeOfCare.referralRequest</b><br>
1863   * </p>
1864   */
1865  @SearchParamDefinition(name="incomingreferral", path="EpisodeOfCare.referralRequest", description="Incoming Referral Request", type="reference", target={ReferralRequest.class } )
1866  public static final String SP_INCOMINGREFERRAL = "incomingreferral";
1867 /**
1868   * <b>Fluent Client</b> search parameter constant for <b>incomingreferral</b>
1869   * <p>
1870   * Description: <b>Incoming Referral Request</b><br>
1871   * Type: <b>reference</b><br>
1872   * Path: <b>EpisodeOfCare.referralRequest</b><br>
1873   * </p>
1874   */
1875  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INCOMINGREFERRAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INCOMINGREFERRAL);
1876
1877/**
1878   * Constant for fluent queries to be used to add include statements. Specifies
1879   * the path value of "<b>EpisodeOfCare:incomingreferral</b>".
1880   */
1881  public static final ca.uhn.fhir.model.api.Include INCLUDE_INCOMINGREFERRAL = new ca.uhn.fhir.model.api.Include("EpisodeOfCare:incomingreferral").toLocked();
1882
1883 /**
1884   * Search parameter: <b>patient</b>
1885   * <p>
1886   * Description: <b>The patient who is the focus of this episode of care</b><br>
1887   * Type: <b>reference</b><br>
1888   * Path: <b>EpisodeOfCare.patient</b><br>
1889   * </p>
1890   */
1891  @SearchParamDefinition(name="patient", path="EpisodeOfCare.patient", description="The patient who is the focus of this episode of care", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1892  public static final String SP_PATIENT = "patient";
1893 /**
1894   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1895   * <p>
1896   * Description: <b>The patient who is the focus of this episode of care</b><br>
1897   * Type: <b>reference</b><br>
1898   * Path: <b>EpisodeOfCare.patient</b><br>
1899   * </p>
1900   */
1901  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1902
1903/**
1904   * Constant for fluent queries to be used to add include statements. Specifies
1905   * the path value of "<b>EpisodeOfCare:patient</b>".
1906   */
1907  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EpisodeOfCare:patient").toLocked();
1908
1909 /**
1910   * Search parameter: <b>organization</b>
1911   * <p>
1912   * Description: <b>The organization that has assumed the specific responsibilities of this EpisodeOfCare</b><br>
1913   * Type: <b>reference</b><br>
1914   * Path: <b>EpisodeOfCare.managingOrganization</b><br>
1915   * </p>
1916   */
1917  @SearchParamDefinition(name="organization", path="EpisodeOfCare.managingOrganization", description="The organization that has assumed the specific responsibilities of this EpisodeOfCare", type="reference", target={Organization.class } )
1918  public static final String SP_ORGANIZATION = "organization";
1919 /**
1920   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1921   * <p>
1922   * Description: <b>The organization that has assumed the specific responsibilities of this EpisodeOfCare</b><br>
1923   * Type: <b>reference</b><br>
1924   * Path: <b>EpisodeOfCare.managingOrganization</b><br>
1925   * </p>
1926   */
1927  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1928
1929/**
1930   * Constant for fluent queries to be used to add include statements. Specifies
1931   * the path value of "<b>EpisodeOfCare:organization</b>".
1932   */
1933  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("EpisodeOfCare:organization").toLocked();
1934
1935 /**
1936   * Search parameter: <b>type</b>
1937   * <p>
1938   * Description: <b>Type/class  - e.g. specialist referral, disease management</b><br>
1939   * Type: <b>token</b><br>
1940   * Path: <b>EpisodeOfCare.type</b><br>
1941   * </p>
1942   */
1943  @SearchParamDefinition(name="type", path="EpisodeOfCare.type", description="Type/class  - e.g. specialist referral, disease management", type="token" )
1944  public static final String SP_TYPE = "type";
1945 /**
1946   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1947   * <p>
1948   * Description: <b>Type/class  - e.g. specialist referral, disease management</b><br>
1949   * Type: <b>token</b><br>
1950   * Path: <b>EpisodeOfCare.type</b><br>
1951   * </p>
1952   */
1953  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1954
1955 /**
1956   * Search parameter: <b>care-manager</b>
1957   * <p>
1958   * Description: <b>Care manager/care co-ordinator for the patient</b><br>
1959   * Type: <b>reference</b><br>
1960   * Path: <b>EpisodeOfCare.careManager</b><br>
1961   * </p>
1962   */
1963  @SearchParamDefinition(name="care-manager", path="EpisodeOfCare.careManager", description="Care manager/care co-ordinator for the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
1964  public static final String SP_CARE_MANAGER = "care-manager";
1965 /**
1966   * <b>Fluent Client</b> search parameter constant for <b>care-manager</b>
1967   * <p>
1968   * Description: <b>Care manager/care co-ordinator for the patient</b><br>
1969   * Type: <b>reference</b><br>
1970   * Path: <b>EpisodeOfCare.careManager</b><br>
1971   * </p>
1972   */
1973  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_MANAGER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_MANAGER);
1974
1975/**
1976   * Constant for fluent queries to be used to add include statements. Specifies
1977   * the path value of "<b>EpisodeOfCare:care-manager</b>".
1978   */
1979  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_MANAGER = new ca.uhn.fhir.model.api.Include("EpisodeOfCare:care-manager").toLocked();
1980
1981 /**
1982   * Search parameter: <b>status</b>
1983   * <p>
1984   * Description: <b>The current status of the Episode of Care as provided (does not check the status history collection)</b><br>
1985   * Type: <b>token</b><br>
1986   * Path: <b>EpisodeOfCare.status</b><br>
1987   * </p>
1988   */
1989  @SearchParamDefinition(name="status", path="EpisodeOfCare.status", description="The current status of the Episode of Care as provided (does not check the status history collection)", type="token" )
1990  public static final String SP_STATUS = "status";
1991 /**
1992   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1993   * <p>
1994   * Description: <b>The current status of the Episode of Care as provided (does not check the status history collection)</b><br>
1995   * Type: <b>token</b><br>
1996   * Path: <b>EpisodeOfCare.status</b><br>
1997   * </p>
1998   */
1999  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2000
2001
2002}
2003