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