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