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