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