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