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