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