001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046/**
047 * Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.
048 */
049@ResourceDef(name="CarePlan", profile="http://hl7.org/fhir/Profile/CarePlan")
050public class CarePlan extends DomainResource {
051
052    public enum CarePlanStatus {
053        /**
054         * The plan has been suggested but no commitment to it has yet been made.
055         */
056        PROPOSED, 
057        /**
058         * The plan is in development or awaiting use but is not yet intended to be acted upon.
059         */
060        DRAFT, 
061        /**
062         * The plan is intended to be followed and used as part of patient care.
063         */
064        ACTIVE, 
065        /**
066         * The plan is no longer in use and is not expected to be followed or used in patient care.
067         */
068        COMPLETED, 
069        /**
070         * The plan has been terminated prior to reaching completion (though it may have been replaced by a new plan).
071         */
072        CANCELLED, 
073        /**
074         * added to help the parsers
075         */
076        NULL;
077        public static CarePlanStatus fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("proposed".equals(codeString))
081          return PROPOSED;
082        if ("draft".equals(codeString))
083          return DRAFT;
084        if ("active".equals(codeString))
085          return ACTIVE;
086        if ("completed".equals(codeString))
087          return COMPLETED;
088        if ("cancelled".equals(codeString))
089          return CANCELLED;
090        throw new FHIRException("Unknown CarePlanStatus code '"+codeString+"'");
091        }
092        public String toCode() {
093          switch (this) {
094            case PROPOSED: return "proposed";
095            case DRAFT: return "draft";
096            case ACTIVE: return "active";
097            case COMPLETED: return "completed";
098            case CANCELLED: return "cancelled";
099            default: return "?";
100          }
101        }
102        public String getSystem() {
103          switch (this) {
104            case PROPOSED: return "http://hl7.org/fhir/care-plan-status";
105            case DRAFT: return "http://hl7.org/fhir/care-plan-status";
106            case ACTIVE: return "http://hl7.org/fhir/care-plan-status";
107            case COMPLETED: return "http://hl7.org/fhir/care-plan-status";
108            case CANCELLED: return "http://hl7.org/fhir/care-plan-status";
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case PROPOSED: return "The plan has been suggested but no commitment to it has yet been made.";
115            case DRAFT: return "The plan is in development or awaiting use but is not yet intended to be acted upon.";
116            case ACTIVE: return "The plan is intended to be followed and used as part of patient care.";
117            case COMPLETED: return "The plan is no longer in use and is not expected to be followed or used in patient care.";
118            case CANCELLED: return "The plan has been terminated prior to reaching completion (though it may have been replaced by a new plan).";
119            default: return "?";
120          }
121        }
122        public String getDisplay() {
123          switch (this) {
124            case PROPOSED: return "Proposed";
125            case DRAFT: return "Pending";
126            case ACTIVE: return "Active";
127            case COMPLETED: return "Completed";
128            case CANCELLED: return "Cancelled";
129            default: return "?";
130          }
131        }
132    }
133
134  public static class CarePlanStatusEnumFactory implements EnumFactory<CarePlanStatus> {
135    public CarePlanStatus fromCode(String codeString) throws IllegalArgumentException {
136      if (codeString == null || "".equals(codeString))
137            if (codeString == null || "".equals(codeString))
138                return null;
139        if ("proposed".equals(codeString))
140          return CarePlanStatus.PROPOSED;
141        if ("draft".equals(codeString))
142          return CarePlanStatus.DRAFT;
143        if ("active".equals(codeString))
144          return CarePlanStatus.ACTIVE;
145        if ("completed".equals(codeString))
146          return CarePlanStatus.COMPLETED;
147        if ("cancelled".equals(codeString))
148          return CarePlanStatus.CANCELLED;
149        throw new IllegalArgumentException("Unknown CarePlanStatus code '"+codeString+"'");
150        }
151        public Enumeration<CarePlanStatus> fromType(Base code) throws FHIRException {
152          if (code == null || code.isEmpty())
153            return null;
154          String codeString = ((PrimitiveType) code).asStringValue();
155          if (codeString == null || "".equals(codeString))
156            return null;
157        if ("proposed".equals(codeString))
158          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.PROPOSED);
159        if ("draft".equals(codeString))
160          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.DRAFT);
161        if ("active".equals(codeString))
162          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.ACTIVE);
163        if ("completed".equals(codeString))
164          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.COMPLETED);
165        if ("cancelled".equals(codeString))
166          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.CANCELLED);
167        throw new FHIRException("Unknown CarePlanStatus code '"+codeString+"'");
168        }
169    public String toCode(CarePlanStatus code) {
170      if (code == CarePlanStatus.PROPOSED)
171        return "proposed";
172      if (code == CarePlanStatus.DRAFT)
173        return "draft";
174      if (code == CarePlanStatus.ACTIVE)
175        return "active";
176      if (code == CarePlanStatus.COMPLETED)
177        return "completed";
178      if (code == CarePlanStatus.CANCELLED)
179        return "cancelled";
180      return "?";
181      }
182    public String toSystem(CarePlanStatus code) {
183      return code.getSystem();
184      }
185    }
186
187    public enum CarePlanRelationship {
188        /**
189         * The referenced plan is considered to be part of this plan.
190         */
191        INCLUDES, 
192        /**
193         * This plan takes the places of the referenced plan.
194         */
195        REPLACES, 
196        /**
197         * This plan provides details about how to perform activities defined at a higher level by the referenced plan.
198         */
199        FULFILLS, 
200        /**
201         * added to help the parsers
202         */
203        NULL;
204        public static CarePlanRelationship fromCode(String codeString) throws FHIRException {
205            if (codeString == null || "".equals(codeString))
206                return null;
207        if ("includes".equals(codeString))
208          return INCLUDES;
209        if ("replaces".equals(codeString))
210          return REPLACES;
211        if ("fulfills".equals(codeString))
212          return FULFILLS;
213        throw new FHIRException("Unknown CarePlanRelationship code '"+codeString+"'");
214        }
215        public String toCode() {
216          switch (this) {
217            case INCLUDES: return "includes";
218            case REPLACES: return "replaces";
219            case FULFILLS: return "fulfills";
220            default: return "?";
221          }
222        }
223        public String getSystem() {
224          switch (this) {
225            case INCLUDES: return "http://hl7.org/fhir/care-plan-relationship";
226            case REPLACES: return "http://hl7.org/fhir/care-plan-relationship";
227            case FULFILLS: return "http://hl7.org/fhir/care-plan-relationship";
228            default: return "?";
229          }
230        }
231        public String getDefinition() {
232          switch (this) {
233            case INCLUDES: return "The referenced plan is considered to be part of this plan.";
234            case REPLACES: return "This plan takes the places of the referenced plan.";
235            case FULFILLS: return "This plan provides details about how to perform activities defined at a higher level by the referenced plan.";
236            default: return "?";
237          }
238        }
239        public String getDisplay() {
240          switch (this) {
241            case INCLUDES: return "Includes";
242            case REPLACES: return "Replaces";
243            case FULFILLS: return "Fulfills";
244            default: return "?";
245          }
246        }
247    }
248
249  public static class CarePlanRelationshipEnumFactory implements EnumFactory<CarePlanRelationship> {
250    public CarePlanRelationship fromCode(String codeString) throws IllegalArgumentException {
251      if (codeString == null || "".equals(codeString))
252            if (codeString == null || "".equals(codeString))
253                return null;
254        if ("includes".equals(codeString))
255          return CarePlanRelationship.INCLUDES;
256        if ("replaces".equals(codeString))
257          return CarePlanRelationship.REPLACES;
258        if ("fulfills".equals(codeString))
259          return CarePlanRelationship.FULFILLS;
260        throw new IllegalArgumentException("Unknown CarePlanRelationship code '"+codeString+"'");
261        }
262        public Enumeration<CarePlanRelationship> fromType(Base code) throws FHIRException {
263          if (code == null || code.isEmpty())
264            return null;
265          String codeString = ((PrimitiveType) code).asStringValue();
266          if (codeString == null || "".equals(codeString))
267            return null;
268        if ("includes".equals(codeString))
269          return new Enumeration<CarePlanRelationship>(this, CarePlanRelationship.INCLUDES);
270        if ("replaces".equals(codeString))
271          return new Enumeration<CarePlanRelationship>(this, CarePlanRelationship.REPLACES);
272        if ("fulfills".equals(codeString))
273          return new Enumeration<CarePlanRelationship>(this, CarePlanRelationship.FULFILLS);
274        throw new FHIRException("Unknown CarePlanRelationship code '"+codeString+"'");
275        }
276    public String toCode(CarePlanRelationship code) {
277      if (code == CarePlanRelationship.INCLUDES)
278        return "includes";
279      if (code == CarePlanRelationship.REPLACES)
280        return "replaces";
281      if (code == CarePlanRelationship.FULFILLS)
282        return "fulfills";
283      return "?";
284      }
285    public String toSystem(CarePlanRelationship code) {
286      return code.getSystem();
287      }
288    }
289
290    public enum CarePlanActivityStatus {
291        /**
292         * Activity is planned but no action has yet been taken.
293         */
294        NOTSTARTED, 
295        /**
296         * Appointment or other booking has occurred but activity has not yet begun.
297         */
298        SCHEDULED, 
299        /**
300         * Activity has been started but is not yet complete.
301         */
302        INPROGRESS, 
303        /**
304         * Activity was started but has temporarily ceased with an expectation of resumption at a future time.
305         */
306        ONHOLD, 
307        /**
308         * The activities have been completed (more or less) as planned.
309         */
310        COMPLETED, 
311        /**
312         * The activities have been ended prior to completion (perhaps even before they were started).
313         */
314        CANCELLED, 
315        /**
316         * added to help the parsers
317         */
318        NULL;
319        public static CarePlanActivityStatus fromCode(String codeString) throws FHIRException {
320            if (codeString == null || "".equals(codeString))
321                return null;
322        if ("not-started".equals(codeString))
323          return NOTSTARTED;
324        if ("scheduled".equals(codeString))
325          return SCHEDULED;
326        if ("in-progress".equals(codeString))
327          return INPROGRESS;
328        if ("on-hold".equals(codeString))
329          return ONHOLD;
330        if ("completed".equals(codeString))
331          return COMPLETED;
332        if ("cancelled".equals(codeString))
333          return CANCELLED;
334        throw new FHIRException("Unknown CarePlanActivityStatus code '"+codeString+"'");
335        }
336        public String toCode() {
337          switch (this) {
338            case NOTSTARTED: return "not-started";
339            case SCHEDULED: return "scheduled";
340            case INPROGRESS: return "in-progress";
341            case ONHOLD: return "on-hold";
342            case COMPLETED: return "completed";
343            case CANCELLED: return "cancelled";
344            default: return "?";
345          }
346        }
347        public String getSystem() {
348          switch (this) {
349            case NOTSTARTED: return "http://hl7.org/fhir/care-plan-activity-status";
350            case SCHEDULED: return "http://hl7.org/fhir/care-plan-activity-status";
351            case INPROGRESS: return "http://hl7.org/fhir/care-plan-activity-status";
352            case ONHOLD: return "http://hl7.org/fhir/care-plan-activity-status";
353            case COMPLETED: return "http://hl7.org/fhir/care-plan-activity-status";
354            case CANCELLED: return "http://hl7.org/fhir/care-plan-activity-status";
355            default: return "?";
356          }
357        }
358        public String getDefinition() {
359          switch (this) {
360            case NOTSTARTED: return "Activity is planned but no action has yet been taken.";
361            case SCHEDULED: return "Appointment or other booking has occurred but activity has not yet begun.";
362            case INPROGRESS: return "Activity has been started but is not yet complete.";
363            case ONHOLD: return "Activity was started but has temporarily ceased with an expectation of resumption at a future time.";
364            case COMPLETED: return "The activities have been completed (more or less) as planned.";
365            case CANCELLED: return "The activities have been ended prior to completion (perhaps even before they were started).";
366            default: return "?";
367          }
368        }
369        public String getDisplay() {
370          switch (this) {
371            case NOTSTARTED: return "Not Started";
372            case SCHEDULED: return "Scheduled";
373            case INPROGRESS: return "In Progress";
374            case ONHOLD: return "On Hold";
375            case COMPLETED: return "Completed";
376            case CANCELLED: return "Cancelled";
377            default: return "?";
378          }
379        }
380    }
381
382  public static class CarePlanActivityStatusEnumFactory implements EnumFactory<CarePlanActivityStatus> {
383    public CarePlanActivityStatus fromCode(String codeString) throws IllegalArgumentException {
384      if (codeString == null || "".equals(codeString))
385            if (codeString == null || "".equals(codeString))
386                return null;
387        if ("not-started".equals(codeString))
388          return CarePlanActivityStatus.NOTSTARTED;
389        if ("scheduled".equals(codeString))
390          return CarePlanActivityStatus.SCHEDULED;
391        if ("in-progress".equals(codeString))
392          return CarePlanActivityStatus.INPROGRESS;
393        if ("on-hold".equals(codeString))
394          return CarePlanActivityStatus.ONHOLD;
395        if ("completed".equals(codeString))
396          return CarePlanActivityStatus.COMPLETED;
397        if ("cancelled".equals(codeString))
398          return CarePlanActivityStatus.CANCELLED;
399        throw new IllegalArgumentException("Unknown CarePlanActivityStatus code '"+codeString+"'");
400        }
401        public Enumeration<CarePlanActivityStatus> fromType(Base code) throws FHIRException {
402          if (code == null || code.isEmpty())
403            return null;
404          String codeString = ((PrimitiveType) code).asStringValue();
405          if (codeString == null || "".equals(codeString))
406            return null;
407        if ("not-started".equals(codeString))
408          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.NOTSTARTED);
409        if ("scheduled".equals(codeString))
410          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.SCHEDULED);
411        if ("in-progress".equals(codeString))
412          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.INPROGRESS);
413        if ("on-hold".equals(codeString))
414          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.ONHOLD);
415        if ("completed".equals(codeString))
416          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.COMPLETED);
417        if ("cancelled".equals(codeString))
418          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.CANCELLED);
419        throw new FHIRException("Unknown CarePlanActivityStatus code '"+codeString+"'");
420        }
421    public String toCode(CarePlanActivityStatus code) {
422      if (code == CarePlanActivityStatus.NOTSTARTED)
423        return "not-started";
424      if (code == CarePlanActivityStatus.SCHEDULED)
425        return "scheduled";
426      if (code == CarePlanActivityStatus.INPROGRESS)
427        return "in-progress";
428      if (code == CarePlanActivityStatus.ONHOLD)
429        return "on-hold";
430      if (code == CarePlanActivityStatus.COMPLETED)
431        return "completed";
432      if (code == CarePlanActivityStatus.CANCELLED)
433        return "cancelled";
434      return "?";
435      }
436    public String toSystem(CarePlanActivityStatus code) {
437      return code.getSystem();
438      }
439    }
440
441    @Block()
442    public static class CarePlanRelatedPlanComponent extends BackboneElement implements IBaseBackboneElement {
443        /**
444         * Identifies the type of relationship this plan has to the target plan.
445         */
446        @Child(name = "code", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
447        @Description(shortDefinition="includes | replaces | fulfills", formalDefinition="Identifies the type of relationship this plan has to the target plan." )
448        protected Enumeration<CarePlanRelationship> code;
449
450        /**
451         * A reference to the plan to which a relationship is asserted.
452         */
453        @Child(name = "plan", type = {CarePlan.class}, order=2, min=1, max=1, modifier=false, summary=false)
454        @Description(shortDefinition="Plan relationship exists with", formalDefinition="A reference to the plan to which a relationship is asserted." )
455        protected Reference plan;
456
457        /**
458         * The actual object that is the target of the reference (A reference to the plan to which a relationship is asserted.)
459         */
460        protected CarePlan planTarget;
461
462        private static final long serialVersionUID = 1875598050L;
463
464    /**
465     * Constructor
466     */
467      public CarePlanRelatedPlanComponent() {
468        super();
469      }
470
471    /**
472     * Constructor
473     */
474      public CarePlanRelatedPlanComponent(Reference plan) {
475        super();
476        this.plan = plan;
477      }
478
479        /**
480         * @return {@link #code} (Identifies the type of relationship this plan has to the target plan.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
481         */
482        public Enumeration<CarePlanRelationship> getCodeElement() { 
483          if (this.code == null)
484            if (Configuration.errorOnAutoCreate())
485              throw new Error("Attempt to auto-create CarePlanRelatedPlanComponent.code");
486            else if (Configuration.doAutoCreate())
487              this.code = new Enumeration<CarePlanRelationship>(new CarePlanRelationshipEnumFactory()); // bb
488          return this.code;
489        }
490
491        public boolean hasCodeElement() { 
492          return this.code != null && !this.code.isEmpty();
493        }
494
495        public boolean hasCode() { 
496          return this.code != null && !this.code.isEmpty();
497        }
498
499        /**
500         * @param value {@link #code} (Identifies the type of relationship this plan has to the target plan.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
501         */
502        public CarePlanRelatedPlanComponent setCodeElement(Enumeration<CarePlanRelationship> value) { 
503          this.code = value;
504          return this;
505        }
506
507        /**
508         * @return Identifies the type of relationship this plan has to the target plan.
509         */
510        public CarePlanRelationship getCode() { 
511          return this.code == null ? null : this.code.getValue();
512        }
513
514        /**
515         * @param value Identifies the type of relationship this plan has to the target plan.
516         */
517        public CarePlanRelatedPlanComponent setCode(CarePlanRelationship value) { 
518          if (value == null)
519            this.code = null;
520          else {
521            if (this.code == null)
522              this.code = new Enumeration<CarePlanRelationship>(new CarePlanRelationshipEnumFactory());
523            this.code.setValue(value);
524          }
525          return this;
526        }
527
528        /**
529         * @return {@link #plan} (A reference to the plan to which a relationship is asserted.)
530         */
531        public Reference getPlan() { 
532          if (this.plan == null)
533            if (Configuration.errorOnAutoCreate())
534              throw new Error("Attempt to auto-create CarePlanRelatedPlanComponent.plan");
535            else if (Configuration.doAutoCreate())
536              this.plan = new Reference(); // cc
537          return this.plan;
538        }
539
540        public boolean hasPlan() { 
541          return this.plan != null && !this.plan.isEmpty();
542        }
543
544        /**
545         * @param value {@link #plan} (A reference to the plan to which a relationship is asserted.)
546         */
547        public CarePlanRelatedPlanComponent setPlan(Reference value) { 
548          this.plan = value;
549          return this;
550        }
551
552        /**
553         * @return {@link #plan} 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. (A reference to the plan to which a relationship is asserted.)
554         */
555        public CarePlan getPlanTarget() { 
556          if (this.planTarget == null)
557            if (Configuration.errorOnAutoCreate())
558              throw new Error("Attempt to auto-create CarePlanRelatedPlanComponent.plan");
559            else if (Configuration.doAutoCreate())
560              this.planTarget = new CarePlan(); // aa
561          return this.planTarget;
562        }
563
564        /**
565         * @param value {@link #plan} 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. (A reference to the plan to which a relationship is asserted.)
566         */
567        public CarePlanRelatedPlanComponent setPlanTarget(CarePlan value) { 
568          this.planTarget = value;
569          return this;
570        }
571
572        protected void listChildren(List<Property> childrenList) {
573          super.listChildren(childrenList);
574          childrenList.add(new Property("code", "code", "Identifies the type of relationship this plan has to the target plan.", 0, java.lang.Integer.MAX_VALUE, code));
575          childrenList.add(new Property("plan", "Reference(CarePlan)", "A reference to the plan to which a relationship is asserted.", 0, java.lang.Integer.MAX_VALUE, plan));
576        }
577
578      @Override
579      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
580        switch (hash) {
581        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<CarePlanRelationship>
582        case 3443497: /*plan*/ return this.plan == null ? new Base[0] : new Base[] {this.plan}; // Reference
583        default: return super.getProperty(hash, name, checkValid);
584        }
585
586      }
587
588      @Override
589      public void setProperty(int hash, String name, Base value) throws FHIRException {
590        switch (hash) {
591        case 3059181: // code
592          this.code = new CarePlanRelationshipEnumFactory().fromType(value); // Enumeration<CarePlanRelationship>
593          break;
594        case 3443497: // plan
595          this.plan = castToReference(value); // Reference
596          break;
597        default: super.setProperty(hash, name, value);
598        }
599
600      }
601
602      @Override
603      public void setProperty(String name, Base value) throws FHIRException {
604        if (name.equals("code"))
605          this.code = new CarePlanRelationshipEnumFactory().fromType(value); // Enumeration<CarePlanRelationship>
606        else if (name.equals("plan"))
607          this.plan = castToReference(value); // Reference
608        else
609          super.setProperty(name, value);
610      }
611
612      @Override
613      public Base makeProperty(int hash, String name) throws FHIRException {
614        switch (hash) {
615        case 3059181: throw new FHIRException("Cannot make property code as it is not a complex type"); // Enumeration<CarePlanRelationship>
616        case 3443497:  return getPlan(); // Reference
617        default: return super.makeProperty(hash, name);
618        }
619
620      }
621
622      @Override
623      public Base addChild(String name) throws FHIRException {
624        if (name.equals("code")) {
625          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.code");
626        }
627        else if (name.equals("plan")) {
628          this.plan = new Reference();
629          return this.plan;
630        }
631        else
632          return super.addChild(name);
633      }
634
635      public CarePlanRelatedPlanComponent copy() {
636        CarePlanRelatedPlanComponent dst = new CarePlanRelatedPlanComponent();
637        copyValues(dst);
638        dst.code = code == null ? null : code.copy();
639        dst.plan = plan == null ? null : plan.copy();
640        return dst;
641      }
642
643      @Override
644      public boolean equalsDeep(Base other) {
645        if (!super.equalsDeep(other))
646          return false;
647        if (!(other instanceof CarePlanRelatedPlanComponent))
648          return false;
649        CarePlanRelatedPlanComponent o = (CarePlanRelatedPlanComponent) other;
650        return compareDeep(code, o.code, true) && compareDeep(plan, o.plan, true);
651      }
652
653      @Override
654      public boolean equalsShallow(Base other) {
655        if (!super.equalsShallow(other))
656          return false;
657        if (!(other instanceof CarePlanRelatedPlanComponent))
658          return false;
659        CarePlanRelatedPlanComponent o = (CarePlanRelatedPlanComponent) other;
660        return compareValues(code, o.code, true);
661      }
662
663      public boolean isEmpty() {
664        return super.isEmpty() && (code == null || code.isEmpty()) && (plan == null || plan.isEmpty())
665          ;
666      }
667
668  public String fhirType() {
669    return "CarePlan.relatedPlan";
670
671  }
672
673  }
674
675    @Block()
676    public static class CarePlanParticipantComponent extends BackboneElement implements IBaseBackboneElement {
677        /**
678         * Indicates specific responsibility of an individual within the care plan; e.g. "Primary physician", "Team coordinator", "Caregiver", etc.
679         */
680        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
681        @Description(shortDefinition="Type of involvement", formalDefinition="Indicates specific responsibility of an individual within the care plan; e.g. \"Primary physician\", \"Team coordinator\", \"Caregiver\", etc." )
682        protected CodeableConcept role;
683
684        /**
685         * The specific person or organization who is participating/expected to participate in the care plan.
686         */
687        @Child(name = "member", type = {Practitioner.class, RelatedPerson.class, Patient.class, Organization.class}, order=2, min=0, max=1, modifier=false, summary=false)
688        @Description(shortDefinition="Who is involved", formalDefinition="The specific person or organization who is participating/expected to participate in the care plan." )
689        protected Reference member;
690
691        /**
692         * The actual object that is the target of the reference (The specific person or organization who is participating/expected to participate in the care plan.)
693         */
694        protected Resource memberTarget;
695
696        private static final long serialVersionUID = -466811117L;
697
698    /**
699     * Constructor
700     */
701      public CarePlanParticipantComponent() {
702        super();
703      }
704
705        /**
706         * @return {@link #role} (Indicates specific responsibility of an individual within the care plan; e.g. "Primary physician", "Team coordinator", "Caregiver", etc.)
707         */
708        public CodeableConcept getRole() { 
709          if (this.role == null)
710            if (Configuration.errorOnAutoCreate())
711              throw new Error("Attempt to auto-create CarePlanParticipantComponent.role");
712            else if (Configuration.doAutoCreate())
713              this.role = new CodeableConcept(); // cc
714          return this.role;
715        }
716
717        public boolean hasRole() { 
718          return this.role != null && !this.role.isEmpty();
719        }
720
721        /**
722         * @param value {@link #role} (Indicates specific responsibility of an individual within the care plan; e.g. "Primary physician", "Team coordinator", "Caregiver", etc.)
723         */
724        public CarePlanParticipantComponent setRole(CodeableConcept value) { 
725          this.role = value;
726          return this;
727        }
728
729        /**
730         * @return {@link #member} (The specific person or organization who is participating/expected to participate in the care plan.)
731         */
732        public Reference getMember() { 
733          if (this.member == null)
734            if (Configuration.errorOnAutoCreate())
735              throw new Error("Attempt to auto-create CarePlanParticipantComponent.member");
736            else if (Configuration.doAutoCreate())
737              this.member = new Reference(); // cc
738          return this.member;
739        }
740
741        public boolean hasMember() { 
742          return this.member != null && !this.member.isEmpty();
743        }
744
745        /**
746         * @param value {@link #member} (The specific person or organization who is participating/expected to participate in the care plan.)
747         */
748        public CarePlanParticipantComponent setMember(Reference value) { 
749          this.member = value;
750          return this;
751        }
752
753        /**
754         * @return {@link #member} 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 specific person or organization who is participating/expected to participate in the care plan.)
755         */
756        public Resource getMemberTarget() { 
757          return this.memberTarget;
758        }
759
760        /**
761         * @param value {@link #member} 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 specific person or organization who is participating/expected to participate in the care plan.)
762         */
763        public CarePlanParticipantComponent setMemberTarget(Resource value) { 
764          this.memberTarget = value;
765          return this;
766        }
767
768        protected void listChildren(List<Property> childrenList) {
769          super.listChildren(childrenList);
770          childrenList.add(new Property("role", "CodeableConcept", "Indicates specific responsibility of an individual within the care plan; e.g. \"Primary physician\", \"Team coordinator\", \"Caregiver\", etc.", 0, java.lang.Integer.MAX_VALUE, role));
771          childrenList.add(new Property("member", "Reference(Practitioner|RelatedPerson|Patient|Organization)", "The specific person or organization who is participating/expected to participate in the care plan.", 0, java.lang.Integer.MAX_VALUE, member));
772        }
773
774      @Override
775      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
776        switch (hash) {
777        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
778        case -1077769574: /*member*/ return this.member == null ? new Base[0] : new Base[] {this.member}; // Reference
779        default: return super.getProperty(hash, name, checkValid);
780        }
781
782      }
783
784      @Override
785      public void setProperty(int hash, String name, Base value) throws FHIRException {
786        switch (hash) {
787        case 3506294: // role
788          this.role = castToCodeableConcept(value); // CodeableConcept
789          break;
790        case -1077769574: // member
791          this.member = castToReference(value); // Reference
792          break;
793        default: super.setProperty(hash, name, value);
794        }
795
796      }
797
798      @Override
799      public void setProperty(String name, Base value) throws FHIRException {
800        if (name.equals("role"))
801          this.role = castToCodeableConcept(value); // CodeableConcept
802        else if (name.equals("member"))
803          this.member = castToReference(value); // Reference
804        else
805          super.setProperty(name, value);
806      }
807
808      @Override
809      public Base makeProperty(int hash, String name) throws FHIRException {
810        switch (hash) {
811        case 3506294:  return getRole(); // CodeableConcept
812        case -1077769574:  return getMember(); // Reference
813        default: return super.makeProperty(hash, name);
814        }
815
816      }
817
818      @Override
819      public Base addChild(String name) throws FHIRException {
820        if (name.equals("role")) {
821          this.role = new CodeableConcept();
822          return this.role;
823        }
824        else if (name.equals("member")) {
825          this.member = new Reference();
826          return this.member;
827        }
828        else
829          return super.addChild(name);
830      }
831
832      public CarePlanParticipantComponent copy() {
833        CarePlanParticipantComponent dst = new CarePlanParticipantComponent();
834        copyValues(dst);
835        dst.role = role == null ? null : role.copy();
836        dst.member = member == null ? null : member.copy();
837        return dst;
838      }
839
840      @Override
841      public boolean equalsDeep(Base other) {
842        if (!super.equalsDeep(other))
843          return false;
844        if (!(other instanceof CarePlanParticipantComponent))
845          return false;
846        CarePlanParticipantComponent o = (CarePlanParticipantComponent) other;
847        return compareDeep(role, o.role, true) && compareDeep(member, o.member, true);
848      }
849
850      @Override
851      public boolean equalsShallow(Base other) {
852        if (!super.equalsShallow(other))
853          return false;
854        if (!(other instanceof CarePlanParticipantComponent))
855          return false;
856        CarePlanParticipantComponent o = (CarePlanParticipantComponent) other;
857        return true;
858      }
859
860      public boolean isEmpty() {
861        return super.isEmpty() && (role == null || role.isEmpty()) && (member == null || member.isEmpty())
862          ;
863      }
864
865  public String fhirType() {
866    return "CarePlan.participant";
867
868  }
869
870  }
871
872    @Block()
873    public static class CarePlanActivityComponent extends BackboneElement implements IBaseBackboneElement {
874        /**
875         * Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.
876         */
877        @Child(name = "actionResulting", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
878        @Description(shortDefinition="Appointments, orders, etc.", formalDefinition="Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc." )
879        protected List<Reference> actionResulting;
880        /**
881         * The actual objects that are the target of the reference (Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.)
882         */
883        protected List<Resource> actionResultingTarget;
884
885
886        /**
887         * Notes about the adherence/status/progress of the activity.
888         */
889        @Child(name = "progress", type = {Annotation.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
890        @Description(shortDefinition="Comments about the activity status/progress", formalDefinition="Notes about the adherence/status/progress of the activity." )
891        protected List<Annotation> progress;
892
893        /**
894         * The details of the proposed activity represented in a specific resource.
895         */
896        @Child(name = "reference", type = {Appointment.class, CommunicationRequest.class, DeviceUseRequest.class, DiagnosticOrder.class, MedicationOrder.class, NutritionOrder.class, Order.class, ProcedureRequest.class, ProcessRequest.class, ReferralRequest.class, SupplyRequest.class, VisionPrescription.class}, order=3, min=0, max=1, modifier=false, summary=false)
897        @Description(shortDefinition="Activity details defined in specific resource", formalDefinition="The details of the proposed activity represented in a specific resource." )
898        protected Reference reference;
899
900        /**
901         * The actual object that is the target of the reference (The details of the proposed activity represented in a specific resource.)
902         */
903        protected Resource referenceTarget;
904
905        /**
906         * 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.
907         */
908        @Child(name = "detail", type = {}, order=4, min=0, max=1, modifier=false, summary=false)
909        @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." )
910        protected CarePlanActivityDetailComponent detail;
911
912        private static final long serialVersionUID = 40181608L;
913
914    /**
915     * Constructor
916     */
917      public CarePlanActivityComponent() {
918        super();
919      }
920
921        /**
922         * @return {@link #actionResulting} (Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.)
923         */
924        public List<Reference> getActionResulting() { 
925          if (this.actionResulting == null)
926            this.actionResulting = new ArrayList<Reference>();
927          return this.actionResulting;
928        }
929
930        public boolean hasActionResulting() { 
931          if (this.actionResulting == null)
932            return false;
933          for (Reference item : this.actionResulting)
934            if (!item.isEmpty())
935              return true;
936          return false;
937        }
938
939        /**
940         * @return {@link #actionResulting} (Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.)
941         */
942    // syntactic sugar
943        public Reference addActionResulting() { //3
944          Reference t = new Reference();
945          if (this.actionResulting == null)
946            this.actionResulting = new ArrayList<Reference>();
947          this.actionResulting.add(t);
948          return t;
949        }
950
951    // syntactic sugar
952        public CarePlanActivityComponent addActionResulting(Reference t) { //3
953          if (t == null)
954            return this;
955          if (this.actionResulting == null)
956            this.actionResulting = new ArrayList<Reference>();
957          this.actionResulting.add(t);
958          return this;
959        }
960
961        /**
962         * @return {@link #actionResulting} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.)
963         */
964        public List<Resource> getActionResultingTarget() { 
965          if (this.actionResultingTarget == null)
966            this.actionResultingTarget = new ArrayList<Resource>();
967          return this.actionResultingTarget;
968        }
969
970        /**
971         * @return {@link #progress} (Notes about the adherence/status/progress of the activity.)
972         */
973        public List<Annotation> getProgress() { 
974          if (this.progress == null)
975            this.progress = new ArrayList<Annotation>();
976          return this.progress;
977        }
978
979        public boolean hasProgress() { 
980          if (this.progress == null)
981            return false;
982          for (Annotation item : this.progress)
983            if (!item.isEmpty())
984              return true;
985          return false;
986        }
987
988        /**
989         * @return {@link #progress} (Notes about the adherence/status/progress of the activity.)
990         */
991    // syntactic sugar
992        public Annotation addProgress() { //3
993          Annotation t = new Annotation();
994          if (this.progress == null)
995            this.progress = new ArrayList<Annotation>();
996          this.progress.add(t);
997          return t;
998        }
999
1000    // syntactic sugar
1001        public CarePlanActivityComponent addProgress(Annotation t) { //3
1002          if (t == null)
1003            return this;
1004          if (this.progress == null)
1005            this.progress = new ArrayList<Annotation>();
1006          this.progress.add(t);
1007          return this;
1008        }
1009
1010        /**
1011         * @return {@link #reference} (The details of the proposed activity represented in a specific resource.)
1012         */
1013        public Reference getReference() { 
1014          if (this.reference == null)
1015            if (Configuration.errorOnAutoCreate())
1016              throw new Error("Attempt to auto-create CarePlanActivityComponent.reference");
1017            else if (Configuration.doAutoCreate())
1018              this.reference = new Reference(); // cc
1019          return this.reference;
1020        }
1021
1022        public boolean hasReference() { 
1023          return this.reference != null && !this.reference.isEmpty();
1024        }
1025
1026        /**
1027         * @param value {@link #reference} (The details of the proposed activity represented in a specific resource.)
1028         */
1029        public CarePlanActivityComponent setReference(Reference value) { 
1030          this.reference = value;
1031          return this;
1032        }
1033
1034        /**
1035         * @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.)
1036         */
1037        public Resource getReferenceTarget() { 
1038          return this.referenceTarget;
1039        }
1040
1041        /**
1042         * @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.)
1043         */
1044        public CarePlanActivityComponent setReferenceTarget(Resource value) { 
1045          this.referenceTarget = value;
1046          return this;
1047        }
1048
1049        /**
1050         * @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.)
1051         */
1052        public CarePlanActivityDetailComponent getDetail() { 
1053          if (this.detail == null)
1054            if (Configuration.errorOnAutoCreate())
1055              throw new Error("Attempt to auto-create CarePlanActivityComponent.detail");
1056            else if (Configuration.doAutoCreate())
1057              this.detail = new CarePlanActivityDetailComponent(); // cc
1058          return this.detail;
1059        }
1060
1061        public boolean hasDetail() { 
1062          return this.detail != null && !this.detail.isEmpty();
1063        }
1064
1065        /**
1066         * @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.)
1067         */
1068        public CarePlanActivityComponent setDetail(CarePlanActivityDetailComponent value) { 
1069          this.detail = value;
1070          return this;
1071        }
1072
1073        protected void listChildren(List<Property> childrenList) {
1074          super.listChildren(childrenList);
1075          childrenList.add(new Property("actionResulting", "Reference(Any)", "Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.", 0, java.lang.Integer.MAX_VALUE, actionResulting));
1076          childrenList.add(new Property("progress", "Annotation", "Notes about the adherence/status/progress of the activity.", 0, java.lang.Integer.MAX_VALUE, progress));
1077          childrenList.add(new Property("reference", "Reference(Appointment|CommunicationRequest|DeviceUseRequest|DiagnosticOrder|MedicationOrder|NutritionOrder|Order|ProcedureRequest|ProcessRequest|ReferralRequest|SupplyRequest|VisionPrescription)", "The details of the proposed activity represented in a specific resource.", 0, java.lang.Integer.MAX_VALUE, reference));
1078          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));
1079        }
1080
1081      @Override
1082      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1083        switch (hash) {
1084        case 836386063: /*actionResulting*/ return this.actionResulting == null ? new Base[0] : this.actionResulting.toArray(new Base[this.actionResulting.size()]); // Reference
1085        case -1001078227: /*progress*/ return this.progress == null ? new Base[0] : this.progress.toArray(new Base[this.progress.size()]); // Annotation
1086        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
1087        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // CarePlanActivityDetailComponent
1088        default: return super.getProperty(hash, name, checkValid);
1089        }
1090
1091      }
1092
1093      @Override
1094      public void setProperty(int hash, String name, Base value) throws FHIRException {
1095        switch (hash) {
1096        case 836386063: // actionResulting
1097          this.getActionResulting().add(castToReference(value)); // Reference
1098          break;
1099        case -1001078227: // progress
1100          this.getProgress().add(castToAnnotation(value)); // Annotation
1101          break;
1102        case -925155509: // reference
1103          this.reference = castToReference(value); // Reference
1104          break;
1105        case -1335224239: // detail
1106          this.detail = (CarePlanActivityDetailComponent) value; // CarePlanActivityDetailComponent
1107          break;
1108        default: super.setProperty(hash, name, value);
1109        }
1110
1111      }
1112
1113      @Override
1114      public void setProperty(String name, Base value) throws FHIRException {
1115        if (name.equals("actionResulting"))
1116          this.getActionResulting().add(castToReference(value));
1117        else if (name.equals("progress"))
1118          this.getProgress().add(castToAnnotation(value));
1119        else if (name.equals("reference"))
1120          this.reference = castToReference(value); // Reference
1121        else if (name.equals("detail"))
1122          this.detail = (CarePlanActivityDetailComponent) value; // CarePlanActivityDetailComponent
1123        else
1124          super.setProperty(name, value);
1125      }
1126
1127      @Override
1128      public Base makeProperty(int hash, String name) throws FHIRException {
1129        switch (hash) {
1130        case 836386063:  return addActionResulting(); // Reference
1131        case -1001078227:  return addProgress(); // Annotation
1132        case -925155509:  return getReference(); // Reference
1133        case -1335224239:  return getDetail(); // CarePlanActivityDetailComponent
1134        default: return super.makeProperty(hash, name);
1135        }
1136
1137      }
1138
1139      @Override
1140      public Base addChild(String name) throws FHIRException {
1141        if (name.equals("actionResulting")) {
1142          return addActionResulting();
1143        }
1144        else if (name.equals("progress")) {
1145          return addProgress();
1146        }
1147        else if (name.equals("reference")) {
1148          this.reference = new Reference();
1149          return this.reference;
1150        }
1151        else if (name.equals("detail")) {
1152          this.detail = new CarePlanActivityDetailComponent();
1153          return this.detail;
1154        }
1155        else
1156          return super.addChild(name);
1157      }
1158
1159      public CarePlanActivityComponent copy() {
1160        CarePlanActivityComponent dst = new CarePlanActivityComponent();
1161        copyValues(dst);
1162        if (actionResulting != null) {
1163          dst.actionResulting = new ArrayList<Reference>();
1164          for (Reference i : actionResulting)
1165            dst.actionResulting.add(i.copy());
1166        };
1167        if (progress != null) {
1168          dst.progress = new ArrayList<Annotation>();
1169          for (Annotation i : progress)
1170            dst.progress.add(i.copy());
1171        };
1172        dst.reference = reference == null ? null : reference.copy();
1173        dst.detail = detail == null ? null : detail.copy();
1174        return dst;
1175      }
1176
1177      @Override
1178      public boolean equalsDeep(Base other) {
1179        if (!super.equalsDeep(other))
1180          return false;
1181        if (!(other instanceof CarePlanActivityComponent))
1182          return false;
1183        CarePlanActivityComponent o = (CarePlanActivityComponent) other;
1184        return compareDeep(actionResulting, o.actionResulting, true) && compareDeep(progress, o.progress, true)
1185           && compareDeep(reference, o.reference, true) && compareDeep(detail, o.detail, true);
1186      }
1187
1188      @Override
1189      public boolean equalsShallow(Base other) {
1190        if (!super.equalsShallow(other))
1191          return false;
1192        if (!(other instanceof CarePlanActivityComponent))
1193          return false;
1194        CarePlanActivityComponent o = (CarePlanActivityComponent) other;
1195        return true;
1196      }
1197
1198      public boolean isEmpty() {
1199        return super.isEmpty() && (actionResulting == null || actionResulting.isEmpty()) && (progress == null || progress.isEmpty())
1200           && (reference == null || reference.isEmpty()) && (detail == null || detail.isEmpty());
1201      }
1202
1203  public String fhirType() {
1204    return "CarePlan.activity";
1205
1206  }
1207
1208  }
1209
1210    @Block()
1211    public static class CarePlanActivityDetailComponent extends BackboneElement implements IBaseBackboneElement {
1212        /**
1213         * High-level categorization of the type of activity in a care plan.
1214         */
1215        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1216        @Description(shortDefinition="diet | drug | encounter | observation | procedure | supply | other", formalDefinition="High-level categorization of the type of activity in a care plan." )
1217        protected CodeableConcept category;
1218
1219        /**
1220         * Detailed description of the type of planned activity; e.g. What lab test, what procedure, what kind of encounter.
1221         */
1222        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1223        @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." )
1224        protected CodeableConcept code;
1225
1226        /**
1227         * Provides the rationale that drove the inclusion of this particular activity as part of the plan.
1228         */
1229        @Child(name = "reasonCode", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1230        @Description(shortDefinition="Why activity should be done", formalDefinition="Provides the rationale that drove the inclusion of this particular activity as part of the plan." )
1231        protected List<CodeableConcept> reasonCode;
1232
1233        /**
1234         * Provides the health condition(s) that drove the inclusion of this particular activity as part of the plan.
1235         */
1236        @Child(name = "reasonReference", type = {Condition.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1237        @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." )
1238        protected List<Reference> reasonReference;
1239        /**
1240         * 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.)
1241         */
1242        protected List<Condition> reasonReferenceTarget;
1243
1244
1245        /**
1246         * Internal reference that identifies the goals that this activity is intended to contribute towards meeting.
1247         */
1248        @Child(name = "goal", type = {Goal.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1249        @Description(shortDefinition="Goals this activity relates to", formalDefinition="Internal reference that identifies the goals that this activity is intended to contribute towards meeting." )
1250        protected List<Reference> goal;
1251        /**
1252         * 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.)
1253         */
1254        protected List<Goal> goalTarget;
1255
1256
1257        /**
1258         * Identifies what progress is being made for the specific activity.
1259         */
1260        @Child(name = "status", type = {CodeType.class}, order=6, min=0, max=1, modifier=true, summary=false)
1261        @Description(shortDefinition="not-started | scheduled | in-progress | on-hold | completed | cancelled", formalDefinition="Identifies what progress is being made for the specific activity." )
1262        protected Enumeration<CarePlanActivityStatus> status;
1263
1264        /**
1265         * Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.
1266         */
1267        @Child(name = "statusReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
1268        @Description(shortDefinition="Reason for current status", formalDefinition="Provides reason why the activity isn't yet started, is on hold, was cancelled, etc." )
1269        protected CodeableConcept statusReason;
1270
1271        /**
1272         * If true, indicates that the described activity is one that must NOT be engaged in when following the plan.
1273         */
1274        @Child(name = "prohibited", type = {BooleanType.class}, order=8, min=1, max=1, modifier=true, summary=false)
1275        @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." )
1276        protected BooleanType prohibited;
1277
1278        /**
1279         * The period, timing or frequency upon which the described activity is to occur.
1280         */
1281        @Child(name = "scheduled", type = {Timing.class, Period.class, StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1282        @Description(shortDefinition="When activity is to occur", formalDefinition="The period, timing or frequency upon which the described activity is to occur." )
1283        protected Type scheduled;
1284
1285        /**
1286         * Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.
1287         */
1288        @Child(name = "location", type = {Location.class}, order=10, min=0, max=1, modifier=false, summary=false)
1289        @Description(shortDefinition="Where it should happen", formalDefinition="Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc." )
1290        protected Reference location;
1291
1292        /**
1293         * 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.)
1294         */
1295        protected Location locationTarget;
1296
1297        /**
1298         * Identifies who's expected to be involved in the activity.
1299         */
1300        @Child(name = "performer", type = {Practitioner.class, Organization.class, RelatedPerson.class, Patient.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1301        @Description(shortDefinition="Who will be responsible?", formalDefinition="Identifies who's expected to be involved in the activity." )
1302        protected List<Reference> performer;
1303        /**
1304         * The actual objects that are the target of the reference (Identifies who's expected to be involved in the activity.)
1305         */
1306        protected List<Resource> performerTarget;
1307
1308
1309        /**
1310         * Identifies the food, drug or other product to be consumed or supplied in the activity.
1311         */
1312        @Child(name = "product", type = {CodeableConcept.class, Medication.class, Substance.class}, order=12, min=0, max=1, modifier=false, summary=false)
1313        @Description(shortDefinition="What is to be administered/supplied", formalDefinition="Identifies the food, drug or other product to be consumed or supplied in the activity." )
1314        protected Type product;
1315
1316        /**
1317         * Identifies the quantity expected to be consumed in a given day.
1318         */
1319        @Child(name = "dailyAmount", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
1320        @Description(shortDefinition="How to consume/day?", formalDefinition="Identifies the quantity expected to be consumed in a given day." )
1321        protected SimpleQuantity dailyAmount;
1322
1323        /**
1324         * Identifies the quantity expected to be supplied, administered or consumed by the subject.
1325         */
1326        @Child(name = "quantity", type = {SimpleQuantity.class}, order=14, min=0, max=1, modifier=false, summary=false)
1327        @Description(shortDefinition="How much to administer/supply/consume", formalDefinition="Identifies the quantity expected to be supplied, administered or consumed by the subject." )
1328        protected SimpleQuantity quantity;
1329
1330        /**
1331         * 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.
1332         */
1333        @Child(name = "description", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=false)
1334        @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." )
1335        protected StringType description;
1336
1337        private static final long serialVersionUID = -1763965702L;
1338
1339    /**
1340     * Constructor
1341     */
1342      public CarePlanActivityDetailComponent() {
1343        super();
1344      }
1345
1346    /**
1347     * Constructor
1348     */
1349      public CarePlanActivityDetailComponent(BooleanType prohibited) {
1350        super();
1351        this.prohibited = prohibited;
1352      }
1353
1354        /**
1355         * @return {@link #category} (High-level categorization of the type of activity in a care plan.)
1356         */
1357        public CodeableConcept getCategory() { 
1358          if (this.category == null)
1359            if (Configuration.errorOnAutoCreate())
1360              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.category");
1361            else if (Configuration.doAutoCreate())
1362              this.category = new CodeableConcept(); // cc
1363          return this.category;
1364        }
1365
1366        public boolean hasCategory() { 
1367          return this.category != null && !this.category.isEmpty();
1368        }
1369
1370        /**
1371         * @param value {@link #category} (High-level categorization of the type of activity in a care plan.)
1372         */
1373        public CarePlanActivityDetailComponent setCategory(CodeableConcept value) { 
1374          this.category = value;
1375          return this;
1376        }
1377
1378        /**
1379         * @return {@link #code} (Detailed description of the type of planned activity; e.g. What lab test, what procedure, what kind of encounter.)
1380         */
1381        public CodeableConcept getCode() { 
1382          if (this.code == null)
1383            if (Configuration.errorOnAutoCreate())
1384              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.code");
1385            else if (Configuration.doAutoCreate())
1386              this.code = new CodeableConcept(); // cc
1387          return this.code;
1388        }
1389
1390        public boolean hasCode() { 
1391          return this.code != null && !this.code.isEmpty();
1392        }
1393
1394        /**
1395         * @param value {@link #code} (Detailed description of the type of planned activity; e.g. What lab test, what procedure, what kind of encounter.)
1396         */
1397        public CarePlanActivityDetailComponent setCode(CodeableConcept value) { 
1398          this.code = value;
1399          return this;
1400        }
1401
1402        /**
1403         * @return {@link #reasonCode} (Provides the rationale that drove the inclusion of this particular activity as part of the plan.)
1404         */
1405        public List<CodeableConcept> getReasonCode() { 
1406          if (this.reasonCode == null)
1407            this.reasonCode = new ArrayList<CodeableConcept>();
1408          return this.reasonCode;
1409        }
1410
1411        public boolean hasReasonCode() { 
1412          if (this.reasonCode == null)
1413            return false;
1414          for (CodeableConcept item : this.reasonCode)
1415            if (!item.isEmpty())
1416              return true;
1417          return false;
1418        }
1419
1420        /**
1421         * @return {@link #reasonCode} (Provides the rationale that drove the inclusion of this particular activity as part of the plan.)
1422         */
1423    // syntactic sugar
1424        public CodeableConcept addReasonCode() { //3
1425          CodeableConcept t = new CodeableConcept();
1426          if (this.reasonCode == null)
1427            this.reasonCode = new ArrayList<CodeableConcept>();
1428          this.reasonCode.add(t);
1429          return t;
1430        }
1431
1432    // syntactic sugar
1433        public CarePlanActivityDetailComponent addReasonCode(CodeableConcept t) { //3
1434          if (t == null)
1435            return this;
1436          if (this.reasonCode == null)
1437            this.reasonCode = new ArrayList<CodeableConcept>();
1438          this.reasonCode.add(t);
1439          return this;
1440        }
1441
1442        /**
1443         * @return {@link #reasonReference} (Provides the health condition(s) that drove the inclusion of this particular activity as part of the plan.)
1444         */
1445        public List<Reference> getReasonReference() { 
1446          if (this.reasonReference == null)
1447            this.reasonReference = new ArrayList<Reference>();
1448          return this.reasonReference;
1449        }
1450
1451        public boolean hasReasonReference() { 
1452          if (this.reasonReference == null)
1453            return false;
1454          for (Reference item : this.reasonReference)
1455            if (!item.isEmpty())
1456              return true;
1457          return false;
1458        }
1459
1460        /**
1461         * @return {@link #reasonReference} (Provides the health condition(s) that drove the inclusion of this particular activity as part of the plan.)
1462         */
1463    // syntactic sugar
1464        public Reference addReasonReference() { //3
1465          Reference t = new Reference();
1466          if (this.reasonReference == null)
1467            this.reasonReference = new ArrayList<Reference>();
1468          this.reasonReference.add(t);
1469          return t;
1470        }
1471
1472    // syntactic sugar
1473        public CarePlanActivityDetailComponent addReasonReference(Reference t) { //3
1474          if (t == null)
1475            return this;
1476          if (this.reasonReference == null)
1477            this.reasonReference = new ArrayList<Reference>();
1478          this.reasonReference.add(t);
1479          return this;
1480        }
1481
1482        /**
1483         * @return {@link #reasonReference} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Provides the health condition(s) that drove the inclusion of this particular activity as part of the plan.)
1484         */
1485        public List<Condition> getReasonReferenceTarget() { 
1486          if (this.reasonReferenceTarget == null)
1487            this.reasonReferenceTarget = new ArrayList<Condition>();
1488          return this.reasonReferenceTarget;
1489        }
1490
1491    // syntactic sugar
1492        /**
1493         * @return {@link #reasonReference} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Provides the health condition(s) that drove the inclusion of this particular activity as part of the plan.)
1494         */
1495        public Condition addReasonReferenceTarget() { 
1496          Condition r = new Condition();
1497          if (this.reasonReferenceTarget == null)
1498            this.reasonReferenceTarget = new ArrayList<Condition>();
1499          this.reasonReferenceTarget.add(r);
1500          return r;
1501        }
1502
1503        /**
1504         * @return {@link #goal} (Internal reference that identifies the goals that this activity is intended to contribute towards meeting.)
1505         */
1506        public List<Reference> getGoal() { 
1507          if (this.goal == null)
1508            this.goal = new ArrayList<Reference>();
1509          return this.goal;
1510        }
1511
1512        public boolean hasGoal() { 
1513          if (this.goal == null)
1514            return false;
1515          for (Reference item : this.goal)
1516            if (!item.isEmpty())
1517              return true;
1518          return false;
1519        }
1520
1521        /**
1522         * @return {@link #goal} (Internal reference that identifies the goals that this activity is intended to contribute towards meeting.)
1523         */
1524    // syntactic sugar
1525        public Reference addGoal() { //3
1526          Reference t = new Reference();
1527          if (this.goal == null)
1528            this.goal = new ArrayList<Reference>();
1529          this.goal.add(t);
1530          return t;
1531        }
1532
1533    // syntactic sugar
1534        public CarePlanActivityDetailComponent addGoal(Reference t) { //3
1535          if (t == null)
1536            return this;
1537          if (this.goal == null)
1538            this.goal = new ArrayList<Reference>();
1539          this.goal.add(t);
1540          return this;
1541        }
1542
1543        /**
1544         * @return {@link #goal} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Internal reference that identifies the goals that this activity is intended to contribute towards meeting.)
1545         */
1546        public List<Goal> getGoalTarget() { 
1547          if (this.goalTarget == null)
1548            this.goalTarget = new ArrayList<Goal>();
1549          return this.goalTarget;
1550        }
1551
1552    // syntactic sugar
1553        /**
1554         * @return {@link #goal} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Internal reference that identifies the goals that this activity is intended to contribute towards meeting.)
1555         */
1556        public Goal addGoalTarget() { 
1557          Goal r = new Goal();
1558          if (this.goalTarget == null)
1559            this.goalTarget = new ArrayList<Goal>();
1560          this.goalTarget.add(r);
1561          return r;
1562        }
1563
1564        /**
1565         * @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
1566         */
1567        public Enumeration<CarePlanActivityStatus> getStatusElement() { 
1568          if (this.status == null)
1569            if (Configuration.errorOnAutoCreate())
1570              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.status");
1571            else if (Configuration.doAutoCreate())
1572              this.status = new Enumeration<CarePlanActivityStatus>(new CarePlanActivityStatusEnumFactory()); // bb
1573          return this.status;
1574        }
1575
1576        public boolean hasStatusElement() { 
1577          return this.status != null && !this.status.isEmpty();
1578        }
1579
1580        public boolean hasStatus() { 
1581          return this.status != null && !this.status.isEmpty();
1582        }
1583
1584        /**
1585         * @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
1586         */
1587        public CarePlanActivityDetailComponent setStatusElement(Enumeration<CarePlanActivityStatus> value) { 
1588          this.status = value;
1589          return this;
1590        }
1591
1592        /**
1593         * @return Identifies what progress is being made for the specific activity.
1594         */
1595        public CarePlanActivityStatus getStatus() { 
1596          return this.status == null ? null : this.status.getValue();
1597        }
1598
1599        /**
1600         * @param value Identifies what progress is being made for the specific activity.
1601         */
1602        public CarePlanActivityDetailComponent setStatus(CarePlanActivityStatus value) { 
1603          if (value == null)
1604            this.status = null;
1605          else {
1606            if (this.status == null)
1607              this.status = new Enumeration<CarePlanActivityStatus>(new CarePlanActivityStatusEnumFactory());
1608            this.status.setValue(value);
1609          }
1610          return this;
1611        }
1612
1613        /**
1614         * @return {@link #statusReason} (Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.)
1615         */
1616        public CodeableConcept getStatusReason() { 
1617          if (this.statusReason == null)
1618            if (Configuration.errorOnAutoCreate())
1619              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.statusReason");
1620            else if (Configuration.doAutoCreate())
1621              this.statusReason = new CodeableConcept(); // cc
1622          return this.statusReason;
1623        }
1624
1625        public boolean hasStatusReason() { 
1626          return this.statusReason != null && !this.statusReason.isEmpty();
1627        }
1628
1629        /**
1630         * @param value {@link #statusReason} (Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.)
1631         */
1632        public CarePlanActivityDetailComponent setStatusReason(CodeableConcept value) { 
1633          this.statusReason = value;
1634          return this;
1635        }
1636
1637        /**
1638         * @return {@link #prohibited} (If true, indicates that the described activity is one that must NOT 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
1639         */
1640        public BooleanType getProhibitedElement() { 
1641          if (this.prohibited == null)
1642            if (Configuration.errorOnAutoCreate())
1643              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.prohibited");
1644            else if (Configuration.doAutoCreate())
1645              this.prohibited = new BooleanType(); // bb
1646          return this.prohibited;
1647        }
1648
1649        public boolean hasProhibitedElement() { 
1650          return this.prohibited != null && !this.prohibited.isEmpty();
1651        }
1652
1653        public boolean hasProhibited() { 
1654          return this.prohibited != null && !this.prohibited.isEmpty();
1655        }
1656
1657        /**
1658         * @param value {@link #prohibited} (If true, indicates that the described activity is one that must NOT 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
1659         */
1660        public CarePlanActivityDetailComponent setProhibitedElement(BooleanType value) { 
1661          this.prohibited = value;
1662          return this;
1663        }
1664
1665        /**
1666         * @return If true, indicates that the described activity is one that must NOT be engaged in when following the plan.
1667         */
1668        public boolean getProhibited() { 
1669          return this.prohibited == null || this.prohibited.isEmpty() ? false : this.prohibited.getValue();
1670        }
1671
1672        /**
1673         * @param value If true, indicates that the described activity is one that must NOT be engaged in when following the plan.
1674         */
1675        public CarePlanActivityDetailComponent setProhibited(boolean value) { 
1676            if (this.prohibited == null)
1677              this.prohibited = new BooleanType();
1678            this.prohibited.setValue(value);
1679          return this;
1680        }
1681
1682        /**
1683         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1684         */
1685        public Type getScheduled() { 
1686          return this.scheduled;
1687        }
1688
1689        /**
1690         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1691         */
1692        public Timing getScheduledTiming() throws FHIRException { 
1693          if (!(this.scheduled instanceof Timing))
1694            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.scheduled.getClass().getName()+" was encountered");
1695          return (Timing) this.scheduled;
1696        }
1697
1698        public boolean hasScheduledTiming() { 
1699          return this.scheduled instanceof Timing;
1700        }
1701
1702        /**
1703         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1704         */
1705        public Period getScheduledPeriod() throws FHIRException { 
1706          if (!(this.scheduled instanceof Period))
1707            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.scheduled.getClass().getName()+" was encountered");
1708          return (Period) this.scheduled;
1709        }
1710
1711        public boolean hasScheduledPeriod() { 
1712          return this.scheduled instanceof Period;
1713        }
1714
1715        /**
1716         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1717         */
1718        public StringType getScheduledStringType() throws FHIRException { 
1719          if (!(this.scheduled instanceof StringType))
1720            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.scheduled.getClass().getName()+" was encountered");
1721          return (StringType) this.scheduled;
1722        }
1723
1724        public boolean hasScheduledStringType() { 
1725          return this.scheduled instanceof StringType;
1726        }
1727
1728        public boolean hasScheduled() { 
1729          return this.scheduled != null && !this.scheduled.isEmpty();
1730        }
1731
1732        /**
1733         * @param value {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1734         */
1735        public CarePlanActivityDetailComponent setScheduled(Type value) { 
1736          this.scheduled = value;
1737          return this;
1738        }
1739
1740        /**
1741         * @return {@link #location} (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1742         */
1743        public Reference getLocation() { 
1744          if (this.location == null)
1745            if (Configuration.errorOnAutoCreate())
1746              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.location");
1747            else if (Configuration.doAutoCreate())
1748              this.location = new Reference(); // cc
1749          return this.location;
1750        }
1751
1752        public boolean hasLocation() { 
1753          return this.location != null && !this.location.isEmpty();
1754        }
1755
1756        /**
1757         * @param value {@link #location} (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1758         */
1759        public CarePlanActivityDetailComponent setLocation(Reference value) { 
1760          this.location = value;
1761          return this;
1762        }
1763
1764        /**
1765         * @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.)
1766         */
1767        public Location getLocationTarget() { 
1768          if (this.locationTarget == null)
1769            if (Configuration.errorOnAutoCreate())
1770              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.location");
1771            else if (Configuration.doAutoCreate())
1772              this.locationTarget = new Location(); // aa
1773          return this.locationTarget;
1774        }
1775
1776        /**
1777         * @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.)
1778         */
1779        public CarePlanActivityDetailComponent setLocationTarget(Location value) { 
1780          this.locationTarget = value;
1781          return this;
1782        }
1783
1784        /**
1785         * @return {@link #performer} (Identifies who's expected to be involved in the activity.)
1786         */
1787        public List<Reference> getPerformer() { 
1788          if (this.performer == null)
1789            this.performer = new ArrayList<Reference>();
1790          return this.performer;
1791        }
1792
1793        public boolean hasPerformer() { 
1794          if (this.performer == null)
1795            return false;
1796          for (Reference item : this.performer)
1797            if (!item.isEmpty())
1798              return true;
1799          return false;
1800        }
1801
1802        /**
1803         * @return {@link #performer} (Identifies who's expected to be involved in the activity.)
1804         */
1805    // syntactic sugar
1806        public Reference addPerformer() { //3
1807          Reference t = new Reference();
1808          if (this.performer == null)
1809            this.performer = new ArrayList<Reference>();
1810          this.performer.add(t);
1811          return t;
1812        }
1813
1814    // syntactic sugar
1815        public CarePlanActivityDetailComponent addPerformer(Reference t) { //3
1816          if (t == null)
1817            return this;
1818          if (this.performer == null)
1819            this.performer = new ArrayList<Reference>();
1820          this.performer.add(t);
1821          return this;
1822        }
1823
1824        /**
1825         * @return {@link #performer} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Identifies who's expected to be involved in the activity.)
1826         */
1827        public List<Resource> getPerformerTarget() { 
1828          if (this.performerTarget == null)
1829            this.performerTarget = new ArrayList<Resource>();
1830          return this.performerTarget;
1831        }
1832
1833        /**
1834         * @return {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
1835         */
1836        public Type getProduct() { 
1837          return this.product;
1838        }
1839
1840        /**
1841         * @return {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
1842         */
1843        public CodeableConcept getProductCodeableConcept() throws FHIRException { 
1844          if (!(this.product instanceof CodeableConcept))
1845            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.product.getClass().getName()+" was encountered");
1846          return (CodeableConcept) this.product;
1847        }
1848
1849        public boolean hasProductCodeableConcept() { 
1850          return this.product instanceof CodeableConcept;
1851        }
1852
1853        /**
1854         * @return {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
1855         */
1856        public Reference getProductReference() throws FHIRException { 
1857          if (!(this.product instanceof Reference))
1858            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.product.getClass().getName()+" was encountered");
1859          return (Reference) this.product;
1860        }
1861
1862        public boolean hasProductReference() { 
1863          return this.product instanceof Reference;
1864        }
1865
1866        public boolean hasProduct() { 
1867          return this.product != null && !this.product.isEmpty();
1868        }
1869
1870        /**
1871         * @param value {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
1872         */
1873        public CarePlanActivityDetailComponent setProduct(Type value) { 
1874          this.product = value;
1875          return this;
1876        }
1877
1878        /**
1879         * @return {@link #dailyAmount} (Identifies the quantity expected to be consumed in a given day.)
1880         */
1881        public SimpleQuantity getDailyAmount() { 
1882          if (this.dailyAmount == null)
1883            if (Configuration.errorOnAutoCreate())
1884              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.dailyAmount");
1885            else if (Configuration.doAutoCreate())
1886              this.dailyAmount = new SimpleQuantity(); // cc
1887          return this.dailyAmount;
1888        }
1889
1890        public boolean hasDailyAmount() { 
1891          return this.dailyAmount != null && !this.dailyAmount.isEmpty();
1892        }
1893
1894        /**
1895         * @param value {@link #dailyAmount} (Identifies the quantity expected to be consumed in a given day.)
1896         */
1897        public CarePlanActivityDetailComponent setDailyAmount(SimpleQuantity value) { 
1898          this.dailyAmount = value;
1899          return this;
1900        }
1901
1902        /**
1903         * @return {@link #quantity} (Identifies the quantity expected to be supplied, administered or consumed by the subject.)
1904         */
1905        public SimpleQuantity getQuantity() { 
1906          if (this.quantity == null)
1907            if (Configuration.errorOnAutoCreate())
1908              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.quantity");
1909            else if (Configuration.doAutoCreate())
1910              this.quantity = new SimpleQuantity(); // cc
1911          return this.quantity;
1912        }
1913
1914        public boolean hasQuantity() { 
1915          return this.quantity != null && !this.quantity.isEmpty();
1916        }
1917
1918        /**
1919         * @param value {@link #quantity} (Identifies the quantity expected to be supplied, administered or consumed by the subject.)
1920         */
1921        public CarePlanActivityDetailComponent setQuantity(SimpleQuantity value) { 
1922          this.quantity = value;
1923          return this;
1924        }
1925
1926        /**
1927         * @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
1928         */
1929        public StringType getDescriptionElement() { 
1930          if (this.description == null)
1931            if (Configuration.errorOnAutoCreate())
1932              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.description");
1933            else if (Configuration.doAutoCreate())
1934              this.description = new StringType(); // bb
1935          return this.description;
1936        }
1937
1938        public boolean hasDescriptionElement() { 
1939          return this.description != null && !this.description.isEmpty();
1940        }
1941
1942        public boolean hasDescription() { 
1943          return this.description != null && !this.description.isEmpty();
1944        }
1945
1946        /**
1947         * @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
1948         */
1949        public CarePlanActivityDetailComponent setDescriptionElement(StringType value) { 
1950          this.description = value;
1951          return this;
1952        }
1953
1954        /**
1955         * @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.
1956         */
1957        public String getDescription() { 
1958          return this.description == null ? null : this.description.getValue();
1959        }
1960
1961        /**
1962         * @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.
1963         */
1964        public CarePlanActivityDetailComponent setDescription(String value) { 
1965          if (Utilities.noString(value))
1966            this.description = null;
1967          else {
1968            if (this.description == null)
1969              this.description = new StringType();
1970            this.description.setValue(value);
1971          }
1972          return this;
1973        }
1974
1975        protected void listChildren(List<Property> childrenList) {
1976          super.listChildren(childrenList);
1977          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));
1978          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));
1979          childrenList.add(new Property("reasonCode", "CodeableConcept", "Provides the rationale that drove the inclusion of this particular activity as part of the plan.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
1980          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));
1981          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));
1982          childrenList.add(new Property("status", "code", "Identifies what progress is being made for the specific activity.", 0, java.lang.Integer.MAX_VALUE, status));
1983          childrenList.add(new Property("statusReason", "CodeableConcept", "Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.", 0, java.lang.Integer.MAX_VALUE, statusReason));
1984          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.", 0, java.lang.Integer.MAX_VALUE, prohibited));
1985          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));
1986          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));
1987          childrenList.add(new Property("performer", "Reference(Practitioner|Organization|RelatedPerson|Patient)", "Identifies who's expected to be involved in the activity.", 0, java.lang.Integer.MAX_VALUE, performer));
1988          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));
1989          childrenList.add(new Property("dailyAmount", "SimpleQuantity", "Identifies the quantity expected to be consumed in a given day.", 0, java.lang.Integer.MAX_VALUE, dailyAmount));
1990          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));
1991          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));
1992        }
1993
1994      @Override
1995      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1996        switch (hash) {
1997        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1998        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1999        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2000        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2001        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // Reference
2002        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CarePlanActivityStatus>
2003        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
2004        case 663275198: /*prohibited*/ return this.prohibited == null ? new Base[0] : new Base[] {this.prohibited}; // BooleanType
2005        case -160710483: /*scheduled*/ return this.scheduled == null ? new Base[0] : new Base[] {this.scheduled}; // Type
2006        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2007        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference
2008        case -309474065: /*product*/ return this.product == null ? new Base[0] : new Base[] {this.product}; // Type
2009        case -768908335: /*dailyAmount*/ return this.dailyAmount == null ? new Base[0] : new Base[] {this.dailyAmount}; // SimpleQuantity
2010        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
2011        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2012        default: return super.getProperty(hash, name, checkValid);
2013        }
2014
2015      }
2016
2017      @Override
2018      public void setProperty(int hash, String name, Base value) throws FHIRException {
2019        switch (hash) {
2020        case 50511102: // category
2021          this.category = castToCodeableConcept(value); // CodeableConcept
2022          break;
2023        case 3059181: // code
2024          this.code = castToCodeableConcept(value); // CodeableConcept
2025          break;
2026        case 722137681: // reasonCode
2027          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2028          break;
2029        case -1146218137: // reasonReference
2030          this.getReasonReference().add(castToReference(value)); // Reference
2031          break;
2032        case 3178259: // goal
2033          this.getGoal().add(castToReference(value)); // Reference
2034          break;
2035        case -892481550: // status
2036          this.status = new CarePlanActivityStatusEnumFactory().fromType(value); // Enumeration<CarePlanActivityStatus>
2037          break;
2038        case 2051346646: // statusReason
2039          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2040          break;
2041        case 663275198: // prohibited
2042          this.prohibited = castToBoolean(value); // BooleanType
2043          break;
2044        case -160710483: // scheduled
2045          this.scheduled = (Type) value; // Type
2046          break;
2047        case 1901043637: // location
2048          this.location = castToReference(value); // Reference
2049          break;
2050        case 481140686: // performer
2051          this.getPerformer().add(castToReference(value)); // Reference
2052          break;
2053        case -309474065: // product
2054          this.product = (Type) value; // Type
2055          break;
2056        case -768908335: // dailyAmount
2057          this.dailyAmount = castToSimpleQuantity(value); // SimpleQuantity
2058          break;
2059        case -1285004149: // quantity
2060          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2061          break;
2062        case -1724546052: // description
2063          this.description = castToString(value); // StringType
2064          break;
2065        default: super.setProperty(hash, name, value);
2066        }
2067
2068      }
2069
2070      @Override
2071      public void setProperty(String name, Base value) throws FHIRException {
2072        if (name.equals("category"))
2073          this.category = castToCodeableConcept(value); // CodeableConcept
2074        else if (name.equals("code"))
2075          this.code = castToCodeableConcept(value); // CodeableConcept
2076        else if (name.equals("reasonCode"))
2077          this.getReasonCode().add(castToCodeableConcept(value));
2078        else if (name.equals("reasonReference"))
2079          this.getReasonReference().add(castToReference(value));
2080        else if (name.equals("goal"))
2081          this.getGoal().add(castToReference(value));
2082        else if (name.equals("status"))
2083          this.status = new CarePlanActivityStatusEnumFactory().fromType(value); // Enumeration<CarePlanActivityStatus>
2084        else if (name.equals("statusReason"))
2085          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2086        else if (name.equals("prohibited"))
2087          this.prohibited = castToBoolean(value); // BooleanType
2088        else if (name.equals("scheduled[x]"))
2089          this.scheduled = (Type) value; // Type
2090        else if (name.equals("location"))
2091          this.location = castToReference(value); // Reference
2092        else if (name.equals("performer"))
2093          this.getPerformer().add(castToReference(value));
2094        else if (name.equals("product[x]"))
2095          this.product = (Type) value; // Type
2096        else if (name.equals("dailyAmount"))
2097          this.dailyAmount = castToSimpleQuantity(value); // SimpleQuantity
2098        else if (name.equals("quantity"))
2099          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2100        else if (name.equals("description"))
2101          this.description = castToString(value); // StringType
2102        else
2103          super.setProperty(name, value);
2104      }
2105
2106      @Override
2107      public Base makeProperty(int hash, String name) throws FHIRException {
2108        switch (hash) {
2109        case 50511102:  return getCategory(); // CodeableConcept
2110        case 3059181:  return getCode(); // CodeableConcept
2111        case 722137681:  return addReasonCode(); // CodeableConcept
2112        case -1146218137:  return addReasonReference(); // Reference
2113        case 3178259:  return addGoal(); // Reference
2114        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<CarePlanActivityStatus>
2115        case 2051346646:  return getStatusReason(); // CodeableConcept
2116        case 663275198: throw new FHIRException("Cannot make property prohibited as it is not a complex type"); // BooleanType
2117        case 1162627251:  return getScheduled(); // Type
2118        case 1901043637:  return getLocation(); // Reference
2119        case 481140686:  return addPerformer(); // Reference
2120        case 1753005361:  return getProduct(); // Type
2121        case -768908335:  return getDailyAmount(); // SimpleQuantity
2122        case -1285004149:  return getQuantity(); // SimpleQuantity
2123        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
2124        default: return super.makeProperty(hash, name);
2125        }
2126
2127      }
2128
2129      @Override
2130      public Base addChild(String name) throws FHIRException {
2131        if (name.equals("category")) {
2132          this.category = new CodeableConcept();
2133          return this.category;
2134        }
2135        else if (name.equals("code")) {
2136          this.code = new CodeableConcept();
2137          return this.code;
2138        }
2139        else if (name.equals("reasonCode")) {
2140          return addReasonCode();
2141        }
2142        else if (name.equals("reasonReference")) {
2143          return addReasonReference();
2144        }
2145        else if (name.equals("goal")) {
2146          return addGoal();
2147        }
2148        else if (name.equals("status")) {
2149          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.status");
2150        }
2151        else if (name.equals("statusReason")) {
2152          this.statusReason = new CodeableConcept();
2153          return this.statusReason;
2154        }
2155        else if (name.equals("prohibited")) {
2156          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.prohibited");
2157        }
2158        else if (name.equals("scheduledTiming")) {
2159          this.scheduled = new Timing();
2160          return this.scheduled;
2161        }
2162        else if (name.equals("scheduledPeriod")) {
2163          this.scheduled = new Period();
2164          return this.scheduled;
2165        }
2166        else if (name.equals("scheduledString")) {
2167          this.scheduled = new StringType();
2168          return this.scheduled;
2169        }
2170        else if (name.equals("location")) {
2171          this.location = new Reference();
2172          return this.location;
2173        }
2174        else if (name.equals("performer")) {
2175          return addPerformer();
2176        }
2177        else if (name.equals("productCodeableConcept")) {
2178          this.product = new CodeableConcept();
2179          return this.product;
2180        }
2181        else if (name.equals("productReference")) {
2182          this.product = new Reference();
2183          return this.product;
2184        }
2185        else if (name.equals("dailyAmount")) {
2186          this.dailyAmount = new SimpleQuantity();
2187          return this.dailyAmount;
2188        }
2189        else if (name.equals("quantity")) {
2190          this.quantity = new SimpleQuantity();
2191          return this.quantity;
2192        }
2193        else if (name.equals("description")) {
2194          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.description");
2195        }
2196        else
2197          return super.addChild(name);
2198      }
2199
2200      public CarePlanActivityDetailComponent copy() {
2201        CarePlanActivityDetailComponent dst = new CarePlanActivityDetailComponent();
2202        copyValues(dst);
2203        dst.category = category == null ? null : category.copy();
2204        dst.code = code == null ? null : code.copy();
2205        if (reasonCode != null) {
2206          dst.reasonCode = new ArrayList<CodeableConcept>();
2207          for (CodeableConcept i : reasonCode)
2208            dst.reasonCode.add(i.copy());
2209        };
2210        if (reasonReference != null) {
2211          dst.reasonReference = new ArrayList<Reference>();
2212          for (Reference i : reasonReference)
2213            dst.reasonReference.add(i.copy());
2214        };
2215        if (goal != null) {
2216          dst.goal = new ArrayList<Reference>();
2217          for (Reference i : goal)
2218            dst.goal.add(i.copy());
2219        };
2220        dst.status = status == null ? null : status.copy();
2221        dst.statusReason = statusReason == null ? null : statusReason.copy();
2222        dst.prohibited = prohibited == null ? null : prohibited.copy();
2223        dst.scheduled = scheduled == null ? null : scheduled.copy();
2224        dst.location = location == null ? null : location.copy();
2225        if (performer != null) {
2226          dst.performer = new ArrayList<Reference>();
2227          for (Reference i : performer)
2228            dst.performer.add(i.copy());
2229        };
2230        dst.product = product == null ? null : product.copy();
2231        dst.dailyAmount = dailyAmount == null ? null : dailyAmount.copy();
2232        dst.quantity = quantity == null ? null : quantity.copy();
2233        dst.description = description == null ? null : description.copy();
2234        return dst;
2235      }
2236
2237      @Override
2238      public boolean equalsDeep(Base other) {
2239        if (!super.equalsDeep(other))
2240          return false;
2241        if (!(other instanceof CarePlanActivityDetailComponent))
2242          return false;
2243        CarePlanActivityDetailComponent o = (CarePlanActivityDetailComponent) other;
2244        return compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(reasonCode, o.reasonCode, true)
2245           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(goal, o.goal, true) && compareDeep(status, o.status, true)
2246           && compareDeep(statusReason, o.statusReason, true) && compareDeep(prohibited, o.prohibited, true)
2247           && compareDeep(scheduled, o.scheduled, true) && compareDeep(location, o.location, true) && compareDeep(performer, o.performer, true)
2248           && compareDeep(product, o.product, true) && compareDeep(dailyAmount, o.dailyAmount, true) && compareDeep(quantity, o.quantity, true)
2249           && compareDeep(description, o.description, true);
2250      }
2251
2252      @Override
2253      public boolean equalsShallow(Base other) {
2254        if (!super.equalsShallow(other))
2255          return false;
2256        if (!(other instanceof CarePlanActivityDetailComponent))
2257          return false;
2258        CarePlanActivityDetailComponent o = (CarePlanActivityDetailComponent) other;
2259        return compareValues(status, o.status, true) && compareValues(prohibited, o.prohibited, true) && compareValues(description, o.description, true)
2260          ;
2261      }
2262
2263      public boolean isEmpty() {
2264        return super.isEmpty() && (category == null || category.isEmpty()) && (code == null || code.isEmpty())
2265           && (reasonCode == null || reasonCode.isEmpty()) && (reasonReference == null || reasonReference.isEmpty())
2266           && (goal == null || goal.isEmpty()) && (status == null || status.isEmpty()) && (statusReason == null || statusReason.isEmpty())
2267           && (prohibited == null || prohibited.isEmpty()) && (scheduled == null || scheduled.isEmpty())
2268           && (location == null || location.isEmpty()) && (performer == null || performer.isEmpty())
2269           && (product == null || product.isEmpty()) && (dailyAmount == null || dailyAmount.isEmpty())
2270           && (quantity == null || quantity.isEmpty()) && (description == null || description.isEmpty())
2271          ;
2272      }
2273
2274  public String fhirType() {
2275    return "CarePlan.activity.detail";
2276
2277  }
2278
2279  }
2280
2281    /**
2282     * This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
2283     */
2284    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2285    @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)." )
2286    protected List<Identifier> identifier;
2287
2288    /**
2289     * Identifies the patient or group whose intended care is described by the plan.
2290     */
2291    @Child(name = "subject", type = {Patient.class, Group.class}, order=1, min=0, max=1, modifier=false, summary=true)
2292    @Description(shortDefinition="Who care plan is for", formalDefinition="Identifies the patient or group whose intended care is described by the plan." )
2293    protected Reference subject;
2294
2295    /**
2296     * The actual object that is the target of the reference (Identifies the patient or group whose intended care is described by the plan.)
2297     */
2298    protected Resource subjectTarget;
2299
2300    /**
2301     * Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.
2302     */
2303    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
2304    @Description(shortDefinition="proposed | draft | active | completed | cancelled", formalDefinition="Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record." )
2305    protected Enumeration<CarePlanStatus> status;
2306
2307    /**
2308     * Identifies the context in which this particular CarePlan is defined.
2309     */
2310    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=3, min=0, max=1, modifier=false, summary=true)
2311    @Description(shortDefinition="Created in context of", formalDefinition="Identifies the context in which this particular CarePlan is defined." )
2312    protected Reference context;
2313
2314    /**
2315     * The actual object that is the target of the reference (Identifies the context in which this particular CarePlan is defined.)
2316     */
2317    protected Resource contextTarget;
2318
2319    /**
2320     * Indicates when the plan did (or is intended to) come into effect and end.
2321     */
2322    @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
2323    @Description(shortDefinition="Time period plan covers", formalDefinition="Indicates when the plan did (or is intended to) come into effect and end." )
2324    protected Period period;
2325
2326    /**
2327     * Identifies the individual(s) or ogranization who is responsible for the content of the care plan.
2328     */
2329    @Child(name = "author", type = {Patient.class, Practitioner.class, RelatedPerson.class, Organization.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2330    @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." )
2331    protected List<Reference> author;
2332    /**
2333     * 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.)
2334     */
2335    protected List<Resource> authorTarget;
2336
2337
2338    /**
2339     * Identifies the most recent date on which the plan has been revised.
2340     */
2341    @Child(name = "modified", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2342    @Description(shortDefinition="When last updated", formalDefinition="Identifies the most recent date on which the plan has been revised." )
2343    protected DateTimeType modified;
2344
2345    /**
2346     * 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.
2347     */
2348    @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2349    @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." )
2350    protected List<CodeableConcept> category;
2351
2352    /**
2353     * A description of the scope and nature of the plan.
2354     */
2355    @Child(name = "description", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
2356    @Description(shortDefinition="Summary of nature of plan", formalDefinition="A description of the scope and nature of the plan." )
2357    protected StringType description;
2358
2359    /**
2360     * Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.
2361     */
2362    @Child(name = "addresses", type = {Condition.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2363    @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." )
2364    protected List<Reference> addresses;
2365    /**
2366     * 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.)
2367     */
2368    protected List<Condition> addressesTarget;
2369
2370
2371    /**
2372     * 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.
2373     */
2374    @Child(name = "support", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2375    @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." )
2376    protected List<Reference> support;
2377    /**
2378     * 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.)
2379     */
2380    protected List<Resource> supportTarget;
2381
2382
2383    /**
2384     * Identifies CarePlans with some sort of formal relationship to the current plan.
2385     */
2386    @Child(name = "relatedPlan", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2387    @Description(shortDefinition="Plans related to this one", formalDefinition="Identifies CarePlans with some sort of formal relationship to the current plan." )
2388    protected List<CarePlanRelatedPlanComponent> relatedPlan;
2389
2390    /**
2391     * Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.
2392     */
2393    @Child(name = "participant", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2394    @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." )
2395    protected List<CarePlanParticipantComponent> participant;
2396
2397    /**
2398     * Describes the intended objective(s) of carrying out the care plan.
2399     */
2400    @Child(name = "goal", type = {Goal.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2401    @Description(shortDefinition="Desired outcome of plan", formalDefinition="Describes the intended objective(s) of carrying out the care plan." )
2402    protected List<Reference> goal;
2403    /**
2404     * The actual objects that are the target of the reference (Describes the intended objective(s) of carrying out the care plan.)
2405     */
2406    protected List<Goal> goalTarget;
2407
2408
2409    /**
2410     * 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.
2411     */
2412    @Child(name = "activity", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2413    @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." )
2414    protected List<CarePlanActivityComponent> activity;
2415
2416    /**
2417     * General notes about the care plan not covered elsewhere.
2418     */
2419    @Child(name = "note", type = {Annotation.class}, order=15, min=0, max=1, modifier=false, summary=false)
2420    @Description(shortDefinition="Comments about the plan", formalDefinition="General notes about the care plan not covered elsewhere." )
2421    protected Annotation note;
2422
2423    private static final long serialVersionUID = -307500543L;
2424
2425  /**
2426   * Constructor
2427   */
2428    public CarePlan() {
2429      super();
2430    }
2431
2432  /**
2433   * Constructor
2434   */
2435    public CarePlan(Enumeration<CarePlanStatus> status) {
2436      super();
2437      this.status = status;
2438    }
2439
2440    /**
2441     * @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).)
2442     */
2443    public List<Identifier> getIdentifier() { 
2444      if (this.identifier == null)
2445        this.identifier = new ArrayList<Identifier>();
2446      return this.identifier;
2447    }
2448
2449    public boolean hasIdentifier() { 
2450      if (this.identifier == null)
2451        return false;
2452      for (Identifier item : this.identifier)
2453        if (!item.isEmpty())
2454          return true;
2455      return false;
2456    }
2457
2458    /**
2459     * @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).)
2460     */
2461    // syntactic sugar
2462    public Identifier addIdentifier() { //3
2463      Identifier t = new Identifier();
2464      if (this.identifier == null)
2465        this.identifier = new ArrayList<Identifier>();
2466      this.identifier.add(t);
2467      return t;
2468    }
2469
2470    // syntactic sugar
2471    public CarePlan addIdentifier(Identifier t) { //3
2472      if (t == null)
2473        return this;
2474      if (this.identifier == null)
2475        this.identifier = new ArrayList<Identifier>();
2476      this.identifier.add(t);
2477      return this;
2478    }
2479
2480    /**
2481     * @return {@link #subject} (Identifies the patient or group whose intended care is described by the plan.)
2482     */
2483    public Reference getSubject() { 
2484      if (this.subject == null)
2485        if (Configuration.errorOnAutoCreate())
2486          throw new Error("Attempt to auto-create CarePlan.subject");
2487        else if (Configuration.doAutoCreate())
2488          this.subject = new Reference(); // cc
2489      return this.subject;
2490    }
2491
2492    public boolean hasSubject() { 
2493      return this.subject != null && !this.subject.isEmpty();
2494    }
2495
2496    /**
2497     * @param value {@link #subject} (Identifies the patient or group whose intended care is described by the plan.)
2498     */
2499    public CarePlan setSubject(Reference value) { 
2500      this.subject = value;
2501      return this;
2502    }
2503
2504    /**
2505     * @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.)
2506     */
2507    public Resource getSubjectTarget() { 
2508      return this.subjectTarget;
2509    }
2510
2511    /**
2512     * @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.)
2513     */
2514    public CarePlan setSubjectTarget(Resource value) { 
2515      this.subjectTarget = value;
2516      return this;
2517    }
2518
2519    /**
2520     * @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
2521     */
2522    public Enumeration<CarePlanStatus> getStatusElement() { 
2523      if (this.status == null)
2524        if (Configuration.errorOnAutoCreate())
2525          throw new Error("Attempt to auto-create CarePlan.status");
2526        else if (Configuration.doAutoCreate())
2527          this.status = new Enumeration<CarePlanStatus>(new CarePlanStatusEnumFactory()); // bb
2528      return this.status;
2529    }
2530
2531    public boolean hasStatusElement() { 
2532      return this.status != null && !this.status.isEmpty();
2533    }
2534
2535    public boolean hasStatus() { 
2536      return this.status != null && !this.status.isEmpty();
2537    }
2538
2539    /**
2540     * @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
2541     */
2542    public CarePlan setStatusElement(Enumeration<CarePlanStatus> value) { 
2543      this.status = value;
2544      return this;
2545    }
2546
2547    /**
2548     * @return Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.
2549     */
2550    public CarePlanStatus getStatus() { 
2551      return this.status == null ? null : this.status.getValue();
2552    }
2553
2554    /**
2555     * @param value Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.
2556     */
2557    public CarePlan setStatus(CarePlanStatus value) { 
2558        if (this.status == null)
2559          this.status = new Enumeration<CarePlanStatus>(new CarePlanStatusEnumFactory());
2560        this.status.setValue(value);
2561      return this;
2562    }
2563
2564    /**
2565     * @return {@link #context} (Identifies the context in which this particular CarePlan is defined.)
2566     */
2567    public Reference getContext() { 
2568      if (this.context == null)
2569        if (Configuration.errorOnAutoCreate())
2570          throw new Error("Attempt to auto-create CarePlan.context");
2571        else if (Configuration.doAutoCreate())
2572          this.context = new Reference(); // cc
2573      return this.context;
2574    }
2575
2576    public boolean hasContext() { 
2577      return this.context != null && !this.context.isEmpty();
2578    }
2579
2580    /**
2581     * @param value {@link #context} (Identifies the context in which this particular CarePlan is defined.)
2582     */
2583    public CarePlan setContext(Reference value) { 
2584      this.context = value;
2585      return this;
2586    }
2587
2588    /**
2589     * @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 context in which this particular CarePlan is defined.)
2590     */
2591    public Resource getContextTarget() { 
2592      return this.contextTarget;
2593    }
2594
2595    /**
2596     * @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 context in which this particular CarePlan is defined.)
2597     */
2598    public CarePlan setContextTarget(Resource value) { 
2599      this.contextTarget = value;
2600      return this;
2601    }
2602
2603    /**
2604     * @return {@link #period} (Indicates when the plan did (or is intended to) come into effect and end.)
2605     */
2606    public Period getPeriod() { 
2607      if (this.period == null)
2608        if (Configuration.errorOnAutoCreate())
2609          throw new Error("Attempt to auto-create CarePlan.period");
2610        else if (Configuration.doAutoCreate())
2611          this.period = new Period(); // cc
2612      return this.period;
2613    }
2614
2615    public boolean hasPeriod() { 
2616      return this.period != null && !this.period.isEmpty();
2617    }
2618
2619    /**
2620     * @param value {@link #period} (Indicates when the plan did (or is intended to) come into effect and end.)
2621     */
2622    public CarePlan setPeriod(Period value) { 
2623      this.period = value;
2624      return this;
2625    }
2626
2627    /**
2628     * @return {@link #author} (Identifies the individual(s) or ogranization who is responsible for the content of the care plan.)
2629     */
2630    public List<Reference> getAuthor() { 
2631      if (this.author == null)
2632        this.author = new ArrayList<Reference>();
2633      return this.author;
2634    }
2635
2636    public boolean hasAuthor() { 
2637      if (this.author == null)
2638        return false;
2639      for (Reference item : this.author)
2640        if (!item.isEmpty())
2641          return true;
2642      return false;
2643    }
2644
2645    /**
2646     * @return {@link #author} (Identifies the individual(s) or ogranization who is responsible for the content of the care plan.)
2647     */
2648    // syntactic sugar
2649    public Reference addAuthor() { //3
2650      Reference t = new Reference();
2651      if (this.author == null)
2652        this.author = new ArrayList<Reference>();
2653      this.author.add(t);
2654      return t;
2655    }
2656
2657    // syntactic sugar
2658    public CarePlan addAuthor(Reference t) { //3
2659      if (t == null)
2660        return this;
2661      if (this.author == null)
2662        this.author = new ArrayList<Reference>();
2663      this.author.add(t);
2664      return this;
2665    }
2666
2667    /**
2668     * @return {@link #author} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Identifies the individual(s) or ogranization who is responsible for the content of the care plan.)
2669     */
2670    public List<Resource> getAuthorTarget() { 
2671      if (this.authorTarget == null)
2672        this.authorTarget = new ArrayList<Resource>();
2673      return this.authorTarget;
2674    }
2675
2676    /**
2677     * @return {@link #modified} (Identifies the most recent date on which the plan has been revised.). This is the underlying object with id, value and extensions. The accessor "getModified" gives direct access to the value
2678     */
2679    public DateTimeType getModifiedElement() { 
2680      if (this.modified == null)
2681        if (Configuration.errorOnAutoCreate())
2682          throw new Error("Attempt to auto-create CarePlan.modified");
2683        else if (Configuration.doAutoCreate())
2684          this.modified = new DateTimeType(); // bb
2685      return this.modified;
2686    }
2687
2688    public boolean hasModifiedElement() { 
2689      return this.modified != null && !this.modified.isEmpty();
2690    }
2691
2692    public boolean hasModified() { 
2693      return this.modified != null && !this.modified.isEmpty();
2694    }
2695
2696    /**
2697     * @param value {@link #modified} (Identifies the most recent date on which the plan has been revised.). This is the underlying object with id, value and extensions. The accessor "getModified" gives direct access to the value
2698     */
2699    public CarePlan setModifiedElement(DateTimeType value) { 
2700      this.modified = value;
2701      return this;
2702    }
2703
2704    /**
2705     * @return Identifies the most recent date on which the plan has been revised.
2706     */
2707    public Date getModified() { 
2708      return this.modified == null ? null : this.modified.getValue();
2709    }
2710
2711    /**
2712     * @param value Identifies the most recent date on which the plan has been revised.
2713     */
2714    public CarePlan setModified(Date value) { 
2715      if (value == null)
2716        this.modified = null;
2717      else {
2718        if (this.modified == null)
2719          this.modified = new DateTimeType();
2720        this.modified.setValue(value);
2721      }
2722      return this;
2723    }
2724
2725    /**
2726     * @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.)
2727     */
2728    public List<CodeableConcept> getCategory() { 
2729      if (this.category == null)
2730        this.category = new ArrayList<CodeableConcept>();
2731      return this.category;
2732    }
2733
2734    public boolean hasCategory() { 
2735      if (this.category == null)
2736        return false;
2737      for (CodeableConcept item : this.category)
2738        if (!item.isEmpty())
2739          return true;
2740      return false;
2741    }
2742
2743    /**
2744     * @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.)
2745     */
2746    // syntactic sugar
2747    public CodeableConcept addCategory() { //3
2748      CodeableConcept t = new CodeableConcept();
2749      if (this.category == null)
2750        this.category = new ArrayList<CodeableConcept>();
2751      this.category.add(t);
2752      return t;
2753    }
2754
2755    // syntactic sugar
2756    public CarePlan addCategory(CodeableConcept t) { //3
2757      if (t == null)
2758        return this;
2759      if (this.category == null)
2760        this.category = new ArrayList<CodeableConcept>();
2761      this.category.add(t);
2762      return this;
2763    }
2764
2765    /**
2766     * @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
2767     */
2768    public StringType getDescriptionElement() { 
2769      if (this.description == null)
2770        if (Configuration.errorOnAutoCreate())
2771          throw new Error("Attempt to auto-create CarePlan.description");
2772        else if (Configuration.doAutoCreate())
2773          this.description = new StringType(); // bb
2774      return this.description;
2775    }
2776
2777    public boolean hasDescriptionElement() { 
2778      return this.description != null && !this.description.isEmpty();
2779    }
2780
2781    public boolean hasDescription() { 
2782      return this.description != null && !this.description.isEmpty();
2783    }
2784
2785    /**
2786     * @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
2787     */
2788    public CarePlan setDescriptionElement(StringType value) { 
2789      this.description = value;
2790      return this;
2791    }
2792
2793    /**
2794     * @return A description of the scope and nature of the plan.
2795     */
2796    public String getDescription() { 
2797      return this.description == null ? null : this.description.getValue();
2798    }
2799
2800    /**
2801     * @param value A description of the scope and nature of the plan.
2802     */
2803    public CarePlan setDescription(String value) { 
2804      if (Utilities.noString(value))
2805        this.description = null;
2806      else {
2807        if (this.description == null)
2808          this.description = new StringType();
2809        this.description.setValue(value);
2810      }
2811      return this;
2812    }
2813
2814    /**
2815     * @return {@link #addresses} (Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
2816     */
2817    public List<Reference> getAddresses() { 
2818      if (this.addresses == null)
2819        this.addresses = new ArrayList<Reference>();
2820      return this.addresses;
2821    }
2822
2823    public boolean hasAddresses() { 
2824      if (this.addresses == null)
2825        return false;
2826      for (Reference item : this.addresses)
2827        if (!item.isEmpty())
2828          return true;
2829      return false;
2830    }
2831
2832    /**
2833     * @return {@link #addresses} (Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
2834     */
2835    // syntactic sugar
2836    public Reference addAddresses() { //3
2837      Reference t = new Reference();
2838      if (this.addresses == null)
2839        this.addresses = new ArrayList<Reference>();
2840      this.addresses.add(t);
2841      return t;
2842    }
2843
2844    // syntactic sugar
2845    public CarePlan addAddresses(Reference t) { //3
2846      if (t == null)
2847        return this;
2848      if (this.addresses == null)
2849        this.addresses = new ArrayList<Reference>();
2850      this.addresses.add(t);
2851      return this;
2852    }
2853
2854    /**
2855     * @return {@link #addresses} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
2856     */
2857    public List<Condition> getAddressesTarget() { 
2858      if (this.addressesTarget == null)
2859        this.addressesTarget = new ArrayList<Condition>();
2860      return this.addressesTarget;
2861    }
2862
2863    // syntactic sugar
2864    /**
2865     * @return {@link #addresses} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
2866     */
2867    public Condition addAddressesTarget() { 
2868      Condition r = new Condition();
2869      if (this.addressesTarget == null)
2870        this.addressesTarget = new ArrayList<Condition>();
2871      this.addressesTarget.add(r);
2872      return r;
2873    }
2874
2875    /**
2876     * @return {@link #support} (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.)
2877     */
2878    public List<Reference> getSupport() { 
2879      if (this.support == null)
2880        this.support = new ArrayList<Reference>();
2881      return this.support;
2882    }
2883
2884    public boolean hasSupport() { 
2885      if (this.support == null)
2886        return false;
2887      for (Reference item : this.support)
2888        if (!item.isEmpty())
2889          return true;
2890      return false;
2891    }
2892
2893    /**
2894     * @return {@link #support} (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.)
2895     */
2896    // syntactic sugar
2897    public Reference addSupport() { //3
2898      Reference t = new Reference();
2899      if (this.support == null)
2900        this.support = new ArrayList<Reference>();
2901      this.support.add(t);
2902      return t;
2903    }
2904
2905    // syntactic sugar
2906    public CarePlan addSupport(Reference t) { //3
2907      if (t == null)
2908        return this;
2909      if (this.support == null)
2910        this.support = new ArrayList<Reference>();
2911      this.support.add(t);
2912      return this;
2913    }
2914
2915    /**
2916     * @return {@link #support} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. 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.)
2917     */
2918    public List<Resource> getSupportTarget() { 
2919      if (this.supportTarget == null)
2920        this.supportTarget = new ArrayList<Resource>();
2921      return this.supportTarget;
2922    }
2923
2924    /**
2925     * @return {@link #relatedPlan} (Identifies CarePlans with some sort of formal relationship to the current plan.)
2926     */
2927    public List<CarePlanRelatedPlanComponent> getRelatedPlan() { 
2928      if (this.relatedPlan == null)
2929        this.relatedPlan = new ArrayList<CarePlanRelatedPlanComponent>();
2930      return this.relatedPlan;
2931    }
2932
2933    public boolean hasRelatedPlan() { 
2934      if (this.relatedPlan == null)
2935        return false;
2936      for (CarePlanRelatedPlanComponent item : this.relatedPlan)
2937        if (!item.isEmpty())
2938          return true;
2939      return false;
2940    }
2941
2942    /**
2943     * @return {@link #relatedPlan} (Identifies CarePlans with some sort of formal relationship to the current plan.)
2944     */
2945    // syntactic sugar
2946    public CarePlanRelatedPlanComponent addRelatedPlan() { //3
2947      CarePlanRelatedPlanComponent t = new CarePlanRelatedPlanComponent();
2948      if (this.relatedPlan == null)
2949        this.relatedPlan = new ArrayList<CarePlanRelatedPlanComponent>();
2950      this.relatedPlan.add(t);
2951      return t;
2952    }
2953
2954    // syntactic sugar
2955    public CarePlan addRelatedPlan(CarePlanRelatedPlanComponent t) { //3
2956      if (t == null)
2957        return this;
2958      if (this.relatedPlan == null)
2959        this.relatedPlan = new ArrayList<CarePlanRelatedPlanComponent>();
2960      this.relatedPlan.add(t);
2961      return this;
2962    }
2963
2964    /**
2965     * @return {@link #participant} (Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.)
2966     */
2967    public List<CarePlanParticipantComponent> getParticipant() { 
2968      if (this.participant == null)
2969        this.participant = new ArrayList<CarePlanParticipantComponent>();
2970      return this.participant;
2971    }
2972
2973    public boolean hasParticipant() { 
2974      if (this.participant == null)
2975        return false;
2976      for (CarePlanParticipantComponent item : this.participant)
2977        if (!item.isEmpty())
2978          return true;
2979      return false;
2980    }
2981
2982    /**
2983     * @return {@link #participant} (Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.)
2984     */
2985    // syntactic sugar
2986    public CarePlanParticipantComponent addParticipant() { //3
2987      CarePlanParticipantComponent t = new CarePlanParticipantComponent();
2988      if (this.participant == null)
2989        this.participant = new ArrayList<CarePlanParticipantComponent>();
2990      this.participant.add(t);
2991      return t;
2992    }
2993
2994    // syntactic sugar
2995    public CarePlan addParticipant(CarePlanParticipantComponent t) { //3
2996      if (t == null)
2997        return this;
2998      if (this.participant == null)
2999        this.participant = new ArrayList<CarePlanParticipantComponent>();
3000      this.participant.add(t);
3001      return this;
3002    }
3003
3004    /**
3005     * @return {@link #goal} (Describes the intended objective(s) of carrying out the care plan.)
3006     */
3007    public List<Reference> getGoal() { 
3008      if (this.goal == null)
3009        this.goal = new ArrayList<Reference>();
3010      return this.goal;
3011    }
3012
3013    public boolean hasGoal() { 
3014      if (this.goal == null)
3015        return false;
3016      for (Reference item : this.goal)
3017        if (!item.isEmpty())
3018          return true;
3019      return false;
3020    }
3021
3022    /**
3023     * @return {@link #goal} (Describes the intended objective(s) of carrying out the care plan.)
3024     */
3025    // syntactic sugar
3026    public Reference addGoal() { //3
3027      Reference t = new Reference();
3028      if (this.goal == null)
3029        this.goal = new ArrayList<Reference>();
3030      this.goal.add(t);
3031      return t;
3032    }
3033
3034    // syntactic sugar
3035    public CarePlan addGoal(Reference t) { //3
3036      if (t == null)
3037        return this;
3038      if (this.goal == null)
3039        this.goal = new ArrayList<Reference>();
3040      this.goal.add(t);
3041      return this;
3042    }
3043
3044    /**
3045     * @return {@link #goal} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Describes the intended objective(s) of carrying out the care plan.)
3046     */
3047    public List<Goal> getGoalTarget() { 
3048      if (this.goalTarget == null)
3049        this.goalTarget = new ArrayList<Goal>();
3050      return this.goalTarget;
3051    }
3052
3053    // syntactic sugar
3054    /**
3055     * @return {@link #goal} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Describes the intended objective(s) of carrying out the care plan.)
3056     */
3057    public Goal addGoalTarget() { 
3058      Goal r = new Goal();
3059      if (this.goalTarget == null)
3060        this.goalTarget = new ArrayList<Goal>();
3061      this.goalTarget.add(r);
3062      return r;
3063    }
3064
3065    /**
3066     * @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.)
3067     */
3068    public List<CarePlanActivityComponent> getActivity() { 
3069      if (this.activity == null)
3070        this.activity = new ArrayList<CarePlanActivityComponent>();
3071      return this.activity;
3072    }
3073
3074    public boolean hasActivity() { 
3075      if (this.activity == null)
3076        return false;
3077      for (CarePlanActivityComponent item : this.activity)
3078        if (!item.isEmpty())
3079          return true;
3080      return false;
3081    }
3082
3083    /**
3084     * @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.)
3085     */
3086    // syntactic sugar
3087    public CarePlanActivityComponent addActivity() { //3
3088      CarePlanActivityComponent t = new CarePlanActivityComponent();
3089      if (this.activity == null)
3090        this.activity = new ArrayList<CarePlanActivityComponent>();
3091      this.activity.add(t);
3092      return t;
3093    }
3094
3095    // syntactic sugar
3096    public CarePlan addActivity(CarePlanActivityComponent t) { //3
3097      if (t == null)
3098        return this;
3099      if (this.activity == null)
3100        this.activity = new ArrayList<CarePlanActivityComponent>();
3101      this.activity.add(t);
3102      return this;
3103    }
3104
3105    /**
3106     * @return {@link #note} (General notes about the care plan not covered elsewhere.)
3107     */
3108    public Annotation getNote() { 
3109      if (this.note == null)
3110        if (Configuration.errorOnAutoCreate())
3111          throw new Error("Attempt to auto-create CarePlan.note");
3112        else if (Configuration.doAutoCreate())
3113          this.note = new Annotation(); // cc
3114      return this.note;
3115    }
3116
3117    public boolean hasNote() { 
3118      return this.note != null && !this.note.isEmpty();
3119    }
3120
3121    /**
3122     * @param value {@link #note} (General notes about the care plan not covered elsewhere.)
3123     */
3124    public CarePlan setNote(Annotation value) { 
3125      this.note = value;
3126      return this;
3127    }
3128
3129      protected void listChildren(List<Property> childrenList) {
3130        super.listChildren(childrenList);
3131        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));
3132        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));
3133        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));
3134        childrenList.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "Identifies the context in which this particular CarePlan is defined.", 0, java.lang.Integer.MAX_VALUE, context));
3135        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));
3136        childrenList.add(new Property("author", "Reference(Patient|Practitioner|RelatedPerson|Organization)", "Identifies the individual(s) or ogranization who is responsible for the content of the care plan.", 0, java.lang.Integer.MAX_VALUE, author));
3137        childrenList.add(new Property("modified", "dateTime", "Identifies the most recent date on which the plan has been revised.", 0, java.lang.Integer.MAX_VALUE, modified));
3138        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));
3139        childrenList.add(new Property("description", "string", "A description of the scope and nature of the plan.", 0, java.lang.Integer.MAX_VALUE, description));
3140        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));
3141        childrenList.add(new Property("support", "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, support));
3142        childrenList.add(new Property("relatedPlan", "", "Identifies CarePlans with some sort of formal relationship to the current plan.", 0, java.lang.Integer.MAX_VALUE, relatedPlan));
3143        childrenList.add(new Property("participant", "", "Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.", 0, java.lang.Integer.MAX_VALUE, participant));
3144        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));
3145        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));
3146        childrenList.add(new Property("note", "Annotation", "General notes about the care plan not covered elsewhere.", 0, java.lang.Integer.MAX_VALUE, note));
3147      }
3148
3149      @Override
3150      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3151        switch (hash) {
3152        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3153        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3154        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CarePlanStatus>
3155        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
3156        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
3157        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
3158        case -615513399: /*modified*/ return this.modified == null ? new Base[0] : new Base[] {this.modified}; // DateTimeType
3159        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3160        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3161        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
3162        case -1854767153: /*support*/ return this.support == null ? new Base[0] : this.support.toArray(new Base[this.support.size()]); // Reference
3163        case 1112903156: /*relatedPlan*/ return this.relatedPlan == null ? new Base[0] : this.relatedPlan.toArray(new Base[this.relatedPlan.size()]); // CarePlanRelatedPlanComponent
3164        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // CarePlanParticipantComponent
3165        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // Reference
3166        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : this.activity.toArray(new Base[this.activity.size()]); // CarePlanActivityComponent
3167        case 3387378: /*note*/ return this.note == null ? new Base[0] : new Base[] {this.note}; // Annotation
3168        default: return super.getProperty(hash, name, checkValid);
3169        }
3170
3171      }
3172
3173      @Override
3174      public void setProperty(int hash, String name, Base value) throws FHIRException {
3175        switch (hash) {
3176        case -1618432855: // identifier
3177          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3178          break;
3179        case -1867885268: // subject
3180          this.subject = castToReference(value); // Reference
3181          break;
3182        case -892481550: // status
3183          this.status = new CarePlanStatusEnumFactory().fromType(value); // Enumeration<CarePlanStatus>
3184          break;
3185        case 951530927: // context
3186          this.context = castToReference(value); // Reference
3187          break;
3188        case -991726143: // period
3189          this.period = castToPeriod(value); // Period
3190          break;
3191        case -1406328437: // author
3192          this.getAuthor().add(castToReference(value)); // Reference
3193          break;
3194        case -615513399: // modified
3195          this.modified = castToDateTime(value); // DateTimeType
3196          break;
3197        case 50511102: // category
3198          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
3199          break;
3200        case -1724546052: // description
3201          this.description = castToString(value); // StringType
3202          break;
3203        case 874544034: // addresses
3204          this.getAddresses().add(castToReference(value)); // Reference
3205          break;
3206        case -1854767153: // support
3207          this.getSupport().add(castToReference(value)); // Reference
3208          break;
3209        case 1112903156: // relatedPlan
3210          this.getRelatedPlan().add((CarePlanRelatedPlanComponent) value); // CarePlanRelatedPlanComponent
3211          break;
3212        case 767422259: // participant
3213          this.getParticipant().add((CarePlanParticipantComponent) value); // CarePlanParticipantComponent
3214          break;
3215        case 3178259: // goal
3216          this.getGoal().add(castToReference(value)); // Reference
3217          break;
3218        case -1655966961: // activity
3219          this.getActivity().add((CarePlanActivityComponent) value); // CarePlanActivityComponent
3220          break;
3221        case 3387378: // note
3222          this.note = castToAnnotation(value); // Annotation
3223          break;
3224        default: super.setProperty(hash, name, value);
3225        }
3226
3227      }
3228
3229      @Override
3230      public void setProperty(String name, Base value) throws FHIRException {
3231        if (name.equals("identifier"))
3232          this.getIdentifier().add(castToIdentifier(value));
3233        else if (name.equals("subject"))
3234          this.subject = castToReference(value); // Reference
3235        else if (name.equals("status"))
3236          this.status = new CarePlanStatusEnumFactory().fromType(value); // Enumeration<CarePlanStatus>
3237        else if (name.equals("context"))
3238          this.context = castToReference(value); // Reference
3239        else if (name.equals("period"))
3240          this.period = castToPeriod(value); // Period
3241        else if (name.equals("author"))
3242          this.getAuthor().add(castToReference(value));
3243        else if (name.equals("modified"))
3244          this.modified = castToDateTime(value); // DateTimeType
3245        else if (name.equals("category"))
3246          this.getCategory().add(castToCodeableConcept(value));
3247        else if (name.equals("description"))
3248          this.description = castToString(value); // StringType
3249        else if (name.equals("addresses"))
3250          this.getAddresses().add(castToReference(value));
3251        else if (name.equals("support"))
3252          this.getSupport().add(castToReference(value));
3253        else if (name.equals("relatedPlan"))
3254          this.getRelatedPlan().add((CarePlanRelatedPlanComponent) value);
3255        else if (name.equals("participant"))
3256          this.getParticipant().add((CarePlanParticipantComponent) value);
3257        else if (name.equals("goal"))
3258          this.getGoal().add(castToReference(value));
3259        else if (name.equals("activity"))
3260          this.getActivity().add((CarePlanActivityComponent) value);
3261        else if (name.equals("note"))
3262          this.note = castToAnnotation(value); // Annotation
3263        else
3264          super.setProperty(name, value);
3265      }
3266
3267      @Override
3268      public Base makeProperty(int hash, String name) throws FHIRException {
3269        switch (hash) {
3270        case -1618432855:  return addIdentifier(); // Identifier
3271        case -1867885268:  return getSubject(); // Reference
3272        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<CarePlanStatus>
3273        case 951530927:  return getContext(); // Reference
3274        case -991726143:  return getPeriod(); // Period
3275        case -1406328437:  return addAuthor(); // Reference
3276        case -615513399: throw new FHIRException("Cannot make property modified as it is not a complex type"); // DateTimeType
3277        case 50511102:  return addCategory(); // CodeableConcept
3278        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
3279        case 874544034:  return addAddresses(); // Reference
3280        case -1854767153:  return addSupport(); // Reference
3281        case 1112903156:  return addRelatedPlan(); // CarePlanRelatedPlanComponent
3282        case 767422259:  return addParticipant(); // CarePlanParticipantComponent
3283        case 3178259:  return addGoal(); // Reference
3284        case -1655966961:  return addActivity(); // CarePlanActivityComponent
3285        case 3387378:  return getNote(); // Annotation
3286        default: return super.makeProperty(hash, name);
3287        }
3288
3289      }
3290
3291      @Override
3292      public Base addChild(String name) throws FHIRException {
3293        if (name.equals("identifier")) {
3294          return addIdentifier();
3295        }
3296        else if (name.equals("subject")) {
3297          this.subject = new Reference();
3298          return this.subject;
3299        }
3300        else if (name.equals("status")) {
3301          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.status");
3302        }
3303        else if (name.equals("context")) {
3304          this.context = new Reference();
3305          return this.context;
3306        }
3307        else if (name.equals("period")) {
3308          this.period = new Period();
3309          return this.period;
3310        }
3311        else if (name.equals("author")) {
3312          return addAuthor();
3313        }
3314        else if (name.equals("modified")) {
3315          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.modified");
3316        }
3317        else if (name.equals("category")) {
3318          return addCategory();
3319        }
3320        else if (name.equals("description")) {
3321          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.description");
3322        }
3323        else if (name.equals("addresses")) {
3324          return addAddresses();
3325        }
3326        else if (name.equals("support")) {
3327          return addSupport();
3328        }
3329        else if (name.equals("relatedPlan")) {
3330          return addRelatedPlan();
3331        }
3332        else if (name.equals("participant")) {
3333          return addParticipant();
3334        }
3335        else if (name.equals("goal")) {
3336          return addGoal();
3337        }
3338        else if (name.equals("activity")) {
3339          return addActivity();
3340        }
3341        else if (name.equals("note")) {
3342          this.note = new Annotation();
3343          return this.note;
3344        }
3345        else
3346          return super.addChild(name);
3347      }
3348
3349  public String fhirType() {
3350    return "CarePlan";
3351
3352  }
3353
3354      public CarePlan copy() {
3355        CarePlan dst = new CarePlan();
3356        copyValues(dst);
3357        if (identifier != null) {
3358          dst.identifier = new ArrayList<Identifier>();
3359          for (Identifier i : identifier)
3360            dst.identifier.add(i.copy());
3361        };
3362        dst.subject = subject == null ? null : subject.copy();
3363        dst.status = status == null ? null : status.copy();
3364        dst.context = context == null ? null : context.copy();
3365        dst.period = period == null ? null : period.copy();
3366        if (author != null) {
3367          dst.author = new ArrayList<Reference>();
3368          for (Reference i : author)
3369            dst.author.add(i.copy());
3370        };
3371        dst.modified = modified == null ? null : modified.copy();
3372        if (category != null) {
3373          dst.category = new ArrayList<CodeableConcept>();
3374          for (CodeableConcept i : category)
3375            dst.category.add(i.copy());
3376        };
3377        dst.description = description == null ? null : description.copy();
3378        if (addresses != null) {
3379          dst.addresses = new ArrayList<Reference>();
3380          for (Reference i : addresses)
3381            dst.addresses.add(i.copy());
3382        };
3383        if (support != null) {
3384          dst.support = new ArrayList<Reference>();
3385          for (Reference i : support)
3386            dst.support.add(i.copy());
3387        };
3388        if (relatedPlan != null) {
3389          dst.relatedPlan = new ArrayList<CarePlanRelatedPlanComponent>();
3390          for (CarePlanRelatedPlanComponent i : relatedPlan)
3391            dst.relatedPlan.add(i.copy());
3392        };
3393        if (participant != null) {
3394          dst.participant = new ArrayList<CarePlanParticipantComponent>();
3395          for (CarePlanParticipantComponent i : participant)
3396            dst.participant.add(i.copy());
3397        };
3398        if (goal != null) {
3399          dst.goal = new ArrayList<Reference>();
3400          for (Reference i : goal)
3401            dst.goal.add(i.copy());
3402        };
3403        if (activity != null) {
3404          dst.activity = new ArrayList<CarePlanActivityComponent>();
3405          for (CarePlanActivityComponent i : activity)
3406            dst.activity.add(i.copy());
3407        };
3408        dst.note = note == null ? null : note.copy();
3409        return dst;
3410      }
3411
3412      protected CarePlan typedCopy() {
3413        return copy();
3414      }
3415
3416      @Override
3417      public boolean equalsDeep(Base other) {
3418        if (!super.equalsDeep(other))
3419          return false;
3420        if (!(other instanceof CarePlan))
3421          return false;
3422        CarePlan o = (CarePlan) other;
3423        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(status, o.status, true)
3424           && compareDeep(context, o.context, true) && compareDeep(period, o.period, true) && compareDeep(author, o.author, true)
3425           && compareDeep(modified, o.modified, true) && compareDeep(category, o.category, true) && compareDeep(description, o.description, true)
3426           && compareDeep(addresses, o.addresses, true) && compareDeep(support, o.support, true) && compareDeep(relatedPlan, o.relatedPlan, true)
3427           && compareDeep(participant, o.participant, true) && compareDeep(goal, o.goal, true) && compareDeep(activity, o.activity, true)
3428           && compareDeep(note, o.note, true);
3429      }
3430
3431      @Override
3432      public boolean equalsShallow(Base other) {
3433        if (!super.equalsShallow(other))
3434          return false;
3435        if (!(other instanceof CarePlan))
3436          return false;
3437        CarePlan o = (CarePlan) other;
3438        return compareValues(status, o.status, true) && compareValues(modified, o.modified, true) && compareValues(description, o.description, true)
3439          ;
3440      }
3441
3442      public boolean isEmpty() {
3443        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (subject == null || subject.isEmpty())
3444           && (status == null || status.isEmpty()) && (context == null || context.isEmpty()) && (period == null || period.isEmpty())
3445           && (author == null || author.isEmpty()) && (modified == null || modified.isEmpty()) && (category == null || category.isEmpty())
3446           && (description == null || description.isEmpty()) && (addresses == null || addresses.isEmpty())
3447           && (support == null || support.isEmpty()) && (relatedPlan == null || relatedPlan.isEmpty())
3448           && (participant == null || participant.isEmpty()) && (goal == null || goal.isEmpty()) && (activity == null || activity.isEmpty())
3449           && (note == null || note.isEmpty());
3450      }
3451
3452  @Override
3453  public ResourceType getResourceType() {
3454    return ResourceType.CarePlan;
3455   }
3456
3457 /**
3458   * Search parameter: <b>activitycode</b>
3459   * <p>
3460   * Description: <b>Detail type of activity</b><br>
3461   * Type: <b>token</b><br>
3462   * Path: <b>CarePlan.activity.detail.code</b><br>
3463   * </p>
3464   */
3465  @SearchParamDefinition(name="activitycode", path="CarePlan.activity.detail.code", description="Detail type of activity", type="token" )
3466  public static final String SP_ACTIVITYCODE = "activitycode";
3467 /**
3468   * <b>Fluent Client</b> search parameter constant for <b>activitycode</b>
3469   * <p>
3470   * Description: <b>Detail type of activity</b><br>
3471   * Type: <b>token</b><br>
3472   * Path: <b>CarePlan.activity.detail.code</b><br>
3473   * </p>
3474   */
3475  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVITYCODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVITYCODE);
3476
3477 /**
3478   * Search parameter: <b>condition</b>
3479   * <p>
3480   * Description: <b>Health issues this plan addresses</b><br>
3481   * Type: <b>reference</b><br>
3482   * Path: <b>CarePlan.addresses</b><br>
3483   * </p>
3484   */
3485  @SearchParamDefinition(name="condition", path="CarePlan.addresses", description="Health issues this plan addresses", type="reference" )
3486  public static final String SP_CONDITION = "condition";
3487 /**
3488   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
3489   * <p>
3490   * Description: <b>Health issues this plan addresses</b><br>
3491   * Type: <b>reference</b><br>
3492   * Path: <b>CarePlan.addresses</b><br>
3493   * </p>
3494   */
3495  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONDITION);
3496
3497/**
3498   * Constant for fluent queries to be used to add include statements. Specifies
3499   * the path value of "<b>CarePlan:condition</b>".
3500   */
3501  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include("CarePlan:condition").toLocked();
3502
3503 /**
3504   * Search parameter: <b>subject</b>
3505   * <p>
3506   * Description: <b>Who care plan is for</b><br>
3507   * Type: <b>reference</b><br>
3508   * Path: <b>CarePlan.subject</b><br>
3509   * </p>
3510   */
3511  @SearchParamDefinition(name="subject", path="CarePlan.subject", description="Who care plan is for", type="reference" )
3512  public static final String SP_SUBJECT = "subject";
3513 /**
3514   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3515   * <p>
3516   * Description: <b>Who care plan is for</b><br>
3517   * Type: <b>reference</b><br>
3518   * Path: <b>CarePlan.subject</b><br>
3519   * </p>
3520   */
3521  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3522
3523/**
3524   * Constant for fluent queries to be used to add include statements. Specifies
3525   * the path value of "<b>CarePlan:subject</b>".
3526   */
3527  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("CarePlan:subject").toLocked();
3528
3529 /**
3530   * Search parameter: <b>activitydate</b>
3531   * <p>
3532   * Description: <b>Specified date occurs within period specified by CarePlan.activity.timingSchedule</b><br>
3533   * Type: <b>date</b><br>
3534   * Path: <b>CarePlan.activity.detail.scheduled[x]</b><br>
3535   * </p>
3536   */
3537  @SearchParamDefinition(name="activitydate", path="CarePlan.activity.detail.scheduled", description="Specified date occurs within period specified by CarePlan.activity.timingSchedule", type="date" )
3538  public static final String SP_ACTIVITYDATE = "activitydate";
3539 /**
3540   * <b>Fluent Client</b> search parameter constant for <b>activitydate</b>
3541   * <p>
3542   * Description: <b>Specified date occurs within period specified by CarePlan.activity.timingSchedule</b><br>
3543   * Type: <b>date</b><br>
3544   * Path: <b>CarePlan.activity.detail.scheduled[x]</b><br>
3545   * </p>
3546   */
3547  public static final ca.uhn.fhir.rest.gclient.DateClientParam ACTIVITYDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ACTIVITYDATE);
3548
3549 /**
3550   * Search parameter: <b>date</b>
3551   * <p>
3552   * Description: <b>Time period plan covers</b><br>
3553   * Type: <b>date</b><br>
3554   * Path: <b>CarePlan.period</b><br>
3555   * </p>
3556   */
3557  @SearchParamDefinition(name="date", path="CarePlan.period", description="Time period plan covers", type="date" )
3558  public static final String SP_DATE = "date";
3559 /**
3560   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3561   * <p>
3562   * Description: <b>Time period plan covers</b><br>
3563   * Type: <b>date</b><br>
3564   * Path: <b>CarePlan.period</b><br>
3565   * </p>
3566   */
3567  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3568
3569 /**
3570   * Search parameter: <b>goal</b>
3571   * <p>
3572   * Description: <b>Desired outcome of plan</b><br>
3573   * Type: <b>reference</b><br>
3574   * Path: <b>CarePlan.goal</b><br>
3575   * </p>
3576   */
3577  @SearchParamDefinition(name="goal", path="CarePlan.goal", description="Desired outcome of plan", type="reference" )
3578  public static final String SP_GOAL = "goal";
3579 /**
3580   * <b>Fluent Client</b> search parameter constant for <b>goal</b>
3581   * <p>
3582   * Description: <b>Desired outcome of plan</b><br>
3583   * Type: <b>reference</b><br>
3584   * Path: <b>CarePlan.goal</b><br>
3585   * </p>
3586   */
3587  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam GOAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_GOAL);
3588
3589/**
3590   * Constant for fluent queries to be used to add include statements. Specifies
3591   * the path value of "<b>CarePlan:goal</b>".
3592   */
3593  public static final ca.uhn.fhir.model.api.Include INCLUDE_GOAL = new ca.uhn.fhir.model.api.Include("CarePlan:goal").toLocked();
3594
3595 /**
3596   * Search parameter: <b>related</b>
3597   * <p>
3598   * Description: <b>A combination of the type of relationship and the related plan</b><br>
3599   * Type: <b>composite</b><br>
3600   * Path: <b></b><br>
3601   * </p>
3602   */
3603  @SearchParamDefinition(name="related", path="", description="A combination of the type of relationship and the related plan", type="composite", compositeOf={"relatedcode", "relatedplan"} )
3604  public static final String SP_RELATED = "related";
3605 /**
3606   * <b>Fluent Client</b> search parameter constant for <b>related</b>
3607   * <p>
3608   * Description: <b>A combination of the type of relationship and the related plan</b><br>
3609   * Type: <b>composite</b><br>
3610   * Path: <b></b><br>
3611   * </p>
3612   */
3613  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.ReferenceClientParam> RELATED = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.ReferenceClientParam>(SP_RELATED);
3614
3615 /**
3616   * Search parameter: <b>relatedcode</b>
3617   * <p>
3618   * Description: <b>includes | replaces | fulfills</b><br>
3619   * Type: <b>token</b><br>
3620   * Path: <b>CarePlan.relatedPlan.code</b><br>
3621   * </p>
3622   */
3623  @SearchParamDefinition(name="relatedcode", path="CarePlan.relatedPlan.code", description="includes | replaces | fulfills", type="token" )
3624  public static final String SP_RELATEDCODE = "relatedcode";
3625 /**
3626   * <b>Fluent Client</b> search parameter constant for <b>relatedcode</b>
3627   * <p>
3628   * Description: <b>includes | replaces | fulfills</b><br>
3629   * Type: <b>token</b><br>
3630   * Path: <b>CarePlan.relatedPlan.code</b><br>
3631   * </p>
3632   */
3633  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATEDCODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATEDCODE);
3634
3635 /**
3636   * Search parameter: <b>patient</b>
3637   * <p>
3638   * Description: <b>Who care plan is for</b><br>
3639   * Type: <b>reference</b><br>
3640   * Path: <b>CarePlan.subject</b><br>
3641   * </p>
3642   */
3643  @SearchParamDefinition(name="patient", path="CarePlan.subject", description="Who care plan is for", type="reference" )
3644  public static final String SP_PATIENT = "patient";
3645 /**
3646   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3647   * <p>
3648   * Description: <b>Who care plan is for</b><br>
3649   * Type: <b>reference</b><br>
3650   * Path: <b>CarePlan.subject</b><br>
3651   * </p>
3652   */
3653  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3654
3655/**
3656   * Constant for fluent queries to be used to add include statements. Specifies
3657   * the path value of "<b>CarePlan:patient</b>".
3658   */
3659  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CarePlan:patient").toLocked();
3660
3661 /**
3662   * Search parameter: <b>participant</b>
3663   * <p>
3664   * Description: <b>Who is involved</b><br>
3665   * Type: <b>reference</b><br>
3666   * Path: <b>CarePlan.participant.member</b><br>
3667   * </p>
3668   */
3669  @SearchParamDefinition(name="participant", path="CarePlan.participant.member", description="Who is involved", type="reference" )
3670  public static final String SP_PARTICIPANT = "participant";
3671 /**
3672   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
3673   * <p>
3674   * Description: <b>Who is involved</b><br>
3675   * Type: <b>reference</b><br>
3676   * Path: <b>CarePlan.participant.member</b><br>
3677   * </p>
3678   */
3679  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTICIPANT);
3680
3681/**
3682   * Constant for fluent queries to be used to add include statements. Specifies
3683   * the path value of "<b>CarePlan:participant</b>".
3684   */
3685  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include("CarePlan:participant").toLocked();
3686
3687 /**
3688   * Search parameter: <b>performer</b>
3689   * <p>
3690   * 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>
3691   * Type: <b>reference</b><br>
3692   * Path: <b>CarePlan.activity.detail.performer</b><br>
3693   * </p>
3694   */
3695  @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" )
3696  public static final String SP_PERFORMER = "performer";
3697 /**
3698   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3699   * <p>
3700   * 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>
3701   * Type: <b>reference</b><br>
3702   * Path: <b>CarePlan.activity.detail.performer</b><br>
3703   * </p>
3704   */
3705  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
3706
3707/**
3708   * Constant for fluent queries to be used to add include statements. Specifies
3709   * the path value of "<b>CarePlan:performer</b>".
3710   */
3711  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("CarePlan:performer").toLocked();
3712
3713 /**
3714   * Search parameter: <b>activityreference</b>
3715   * <p>
3716   * Description: <b>Activity details defined in specific resource</b><br>
3717   * Type: <b>reference</b><br>
3718   * Path: <b>CarePlan.activity.reference</b><br>
3719   * </p>
3720   */
3721  @SearchParamDefinition(name="activityreference", path="CarePlan.activity.reference", description="Activity details defined in specific resource", type="reference" )
3722  public static final String SP_ACTIVITYREFERENCE = "activityreference";
3723 /**
3724   * <b>Fluent Client</b> search parameter constant for <b>activityreference</b>
3725   * <p>
3726   * Description: <b>Activity details defined in specific resource</b><br>
3727   * Type: <b>reference</b><br>
3728   * Path: <b>CarePlan.activity.reference</b><br>
3729   * </p>
3730   */
3731  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTIVITYREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTIVITYREFERENCE);
3732
3733/**
3734   * Constant for fluent queries to be used to add include statements. Specifies
3735   * the path value of "<b>CarePlan:activityreference</b>".
3736   */
3737  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTIVITYREFERENCE = new ca.uhn.fhir.model.api.Include("CarePlan:activityreference").toLocked();
3738
3739 /**
3740   * Search parameter: <b>relatedplan</b>
3741   * <p>
3742   * Description: <b>Plan relationship exists with</b><br>
3743   * Type: <b>reference</b><br>
3744   * Path: <b>CarePlan.relatedPlan.plan</b><br>
3745   * </p>
3746   */
3747  @SearchParamDefinition(name="relatedplan", path="CarePlan.relatedPlan.plan", description="Plan relationship exists with", type="reference" )
3748  public static final String SP_RELATEDPLAN = "relatedplan";
3749 /**
3750   * <b>Fluent Client</b> search parameter constant for <b>relatedplan</b>
3751   * <p>
3752   * Description: <b>Plan relationship exists with</b><br>
3753   * Type: <b>reference</b><br>
3754   * Path: <b>CarePlan.relatedPlan.plan</b><br>
3755   * </p>
3756   */
3757  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATEDPLAN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATEDPLAN);
3758
3759/**
3760   * Constant for fluent queries to be used to add include statements. Specifies
3761   * the path value of "<b>CarePlan:relatedplan</b>".
3762   */
3763  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATEDPLAN = new ca.uhn.fhir.model.api.Include("CarePlan:relatedplan").toLocked();
3764
3765
3766}
3767