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