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