001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * An action that is or was performed on or for a patient. This can be a physical intervention like an operation, or less invasive like long term services, counseling, or hypnotherapy.
050 */
051@ResourceDef(name="Procedure", profile="http://hl7.org/fhir/StructureDefinition/Procedure")
052public class Procedure extends DomainResource {
053
054    public enum ProcedureStatus {
055        /**
056         * The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation).  Preparation stages may be tracked for billing purposes.
057         */
058        PREPARATION, 
059        /**
060         * The event is currently occurring.
061         */
062        INPROGRESS, 
063        /**
064         * The event was terminated prior to any activity beyond preparation.  I.e. The 'main' activity has not yet begun.  The boundary between preparatory and the 'main' activity is context-specific.
065         */
066        NOTDONE, 
067        /**
068         * The event has been temporarily stopped but is expected to resume in the future.
069         */
070        ONHOLD, 
071        /**
072         * The event was terminated prior to the full completion of the intended activity but after at least some of the 'main' activity (beyond preparation) has occurred.
073         */
074        STOPPED, 
075        /**
076         * The event has now concluded.
077         */
078        COMPLETED, 
079        /**
080         * This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be "stopped" rather than "entered-in-error".).
081         */
082        ENTEREDINERROR, 
083        /**
084         * The authoring/source system does not know which of the status values currently applies for this event.  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.
085         */
086        UNKNOWN, 
087        /**
088         * added to help the parsers with the generic types
089         */
090        NULL;
091        public static ProcedureStatus fromCode(String codeString) throws FHIRException {
092            if (codeString == null || "".equals(codeString))
093                return null;
094        if ("preparation".equals(codeString))
095          return PREPARATION;
096        if ("in-progress".equals(codeString))
097          return INPROGRESS;
098        if ("not-done".equals(codeString))
099          return NOTDONE;
100        if ("on-hold".equals(codeString))
101          return ONHOLD;
102        if ("stopped".equals(codeString))
103          return STOPPED;
104        if ("completed".equals(codeString))
105          return COMPLETED;
106        if ("entered-in-error".equals(codeString))
107          return ENTEREDINERROR;
108        if ("unknown".equals(codeString))
109          return UNKNOWN;
110        if (Configuration.isAcceptInvalidEnums())
111          return null;
112        else
113          throw new FHIRException("Unknown ProcedureStatus code '"+codeString+"'");
114        }
115        public String toCode() {
116          switch (this) {
117            case PREPARATION: return "preparation";
118            case INPROGRESS: return "in-progress";
119            case NOTDONE: return "not-done";
120            case ONHOLD: return "on-hold";
121            case STOPPED: return "stopped";
122            case COMPLETED: return "completed";
123            case ENTEREDINERROR: return "entered-in-error";
124            case UNKNOWN: return "unknown";
125            default: return "?";
126          }
127        }
128        public String getSystem() {
129          switch (this) {
130            case PREPARATION: return "http://hl7.org/fhir/event-status";
131            case INPROGRESS: return "http://hl7.org/fhir/event-status";
132            case NOTDONE: return "http://hl7.org/fhir/event-status";
133            case ONHOLD: return "http://hl7.org/fhir/event-status";
134            case STOPPED: return "http://hl7.org/fhir/event-status";
135            case COMPLETED: return "http://hl7.org/fhir/event-status";
136            case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
137            case UNKNOWN: return "http://hl7.org/fhir/event-status";
138            default: return "?";
139          }
140        }
141        public String getDefinition() {
142          switch (this) {
143            case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation).  Preparation stages may be tracked for billing purposes.";
144            case INPROGRESS: return "The event is currently occurring.";
145            case NOTDONE: return "The event was terminated prior to any activity beyond preparation.  I.e. The 'main' activity has not yet begun.  The boundary between preparatory and the 'main' activity is context-specific.";
146            case ONHOLD: return "The event has been temporarily stopped but is expected to resume in the future.";
147            case STOPPED: return "The event was terminated prior to the full completion of the intended activity but after at least some of the 'main' activity (beyond preparation) has occurred.";
148            case COMPLETED: return "The event has now concluded.";
149            case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be \"stopped\" rather than \"entered-in-error\".).";
150            case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this event.  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.";
151            default: return "?";
152          }
153        }
154        public String getDisplay() {
155          switch (this) {
156            case PREPARATION: return "Preparation";
157            case INPROGRESS: return "In Progress";
158            case NOTDONE: return "Not Done";
159            case ONHOLD: return "On Hold";
160            case STOPPED: return "Stopped";
161            case COMPLETED: return "Completed";
162            case ENTEREDINERROR: return "Entered in Error";
163            case UNKNOWN: return "Unknown";
164            default: return "?";
165          }
166        }
167    }
168
169  public static class ProcedureStatusEnumFactory implements EnumFactory<ProcedureStatus> {
170    public ProcedureStatus fromCode(String codeString) throws IllegalArgumentException {
171      if (codeString == null || "".equals(codeString))
172            if (codeString == null || "".equals(codeString))
173                return null;
174        if ("preparation".equals(codeString))
175          return ProcedureStatus.PREPARATION;
176        if ("in-progress".equals(codeString))
177          return ProcedureStatus.INPROGRESS;
178        if ("not-done".equals(codeString))
179          return ProcedureStatus.NOTDONE;
180        if ("on-hold".equals(codeString))
181          return ProcedureStatus.ONHOLD;
182        if ("stopped".equals(codeString))
183          return ProcedureStatus.STOPPED;
184        if ("completed".equals(codeString))
185          return ProcedureStatus.COMPLETED;
186        if ("entered-in-error".equals(codeString))
187          return ProcedureStatus.ENTEREDINERROR;
188        if ("unknown".equals(codeString))
189          return ProcedureStatus.UNKNOWN;
190        throw new IllegalArgumentException("Unknown ProcedureStatus code '"+codeString+"'");
191        }
192        public Enumeration<ProcedureStatus> fromType(Base code) throws FHIRException {
193          if (code == null)
194            return null;
195          if (code.isEmpty())
196            return new Enumeration<ProcedureStatus>(this);
197          String codeString = ((PrimitiveType) code).asStringValue();
198          if (codeString == null || "".equals(codeString))
199            return null;
200        if ("preparation".equals(codeString))
201          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.PREPARATION);
202        if ("in-progress".equals(codeString))
203          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.INPROGRESS);
204        if ("not-done".equals(codeString))
205          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.NOTDONE);
206        if ("on-hold".equals(codeString))
207          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.ONHOLD);
208        if ("stopped".equals(codeString))
209          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.STOPPED);
210        if ("completed".equals(codeString))
211          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.COMPLETED);
212        if ("entered-in-error".equals(codeString))
213          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.ENTEREDINERROR);
214        if ("unknown".equals(codeString))
215          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.UNKNOWN);
216        throw new FHIRException("Unknown ProcedureStatus code '"+codeString+"'");
217        }
218    public String toCode(ProcedureStatus code) {
219      if (code == ProcedureStatus.PREPARATION)
220        return "preparation";
221      if (code == ProcedureStatus.INPROGRESS)
222        return "in-progress";
223      if (code == ProcedureStatus.NOTDONE)
224        return "not-done";
225      if (code == ProcedureStatus.ONHOLD)
226        return "on-hold";
227      if (code == ProcedureStatus.STOPPED)
228        return "stopped";
229      if (code == ProcedureStatus.COMPLETED)
230        return "completed";
231      if (code == ProcedureStatus.ENTEREDINERROR)
232        return "entered-in-error";
233      if (code == ProcedureStatus.UNKNOWN)
234        return "unknown";
235      return "?";
236      }
237    public String toSystem(ProcedureStatus code) {
238      return code.getSystem();
239      }
240    }
241
242    @Block()
243    public static class ProcedurePerformerComponent extends BackboneElement implements IBaseBackboneElement {
244        /**
245         * Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist.
246         */
247        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
248        @Description(shortDefinition="Type of performance", formalDefinition="Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist." )
249        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/performer-role")
250        protected CodeableConcept function;
251
252        /**
253         * The practitioner who was involved in the procedure.
254         */
255        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=2, min=1, max=1, modifier=false, summary=true)
256        @Description(shortDefinition="The reference to the practitioner", formalDefinition="The practitioner who was involved in the procedure." )
257        protected Reference actor;
258
259        /**
260         * The actual object that is the target of the reference (The practitioner who was involved in the procedure.)
261         */
262        protected Resource actorTarget;
263
264        /**
265         * The organization the device or practitioner was acting on behalf of.
266         */
267        @Child(name = "onBehalfOf", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
268        @Description(shortDefinition="Organization the device or practitioner was acting for", formalDefinition="The organization the device or practitioner was acting on behalf of." )
269        protected Reference onBehalfOf;
270
271        /**
272         * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of.)
273         */
274        protected Organization onBehalfOfTarget;
275
276        private static final long serialVersionUID = -997772724L;
277
278    /**
279     * Constructor
280     */
281      public ProcedurePerformerComponent() {
282        super();
283      }
284
285    /**
286     * Constructor
287     */
288      public ProcedurePerformerComponent(Reference actor) {
289        super();
290        this.actor = actor;
291      }
292
293        /**
294         * @return {@link #function} (Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist.)
295         */
296        public CodeableConcept getFunction() { 
297          if (this.function == null)
298            if (Configuration.errorOnAutoCreate())
299              throw new Error("Attempt to auto-create ProcedurePerformerComponent.function");
300            else if (Configuration.doAutoCreate())
301              this.function = new CodeableConcept(); // cc
302          return this.function;
303        }
304
305        public boolean hasFunction() { 
306          return this.function != null && !this.function.isEmpty();
307        }
308
309        /**
310         * @param value {@link #function} (Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist.)
311         */
312        public ProcedurePerformerComponent setFunction(CodeableConcept value) { 
313          this.function = value;
314          return this;
315        }
316
317        /**
318         * @return {@link #actor} (The practitioner who was involved in the procedure.)
319         */
320        public Reference getActor() { 
321          if (this.actor == null)
322            if (Configuration.errorOnAutoCreate())
323              throw new Error("Attempt to auto-create ProcedurePerformerComponent.actor");
324            else if (Configuration.doAutoCreate())
325              this.actor = new Reference(); // cc
326          return this.actor;
327        }
328
329        public boolean hasActor() { 
330          return this.actor != null && !this.actor.isEmpty();
331        }
332
333        /**
334         * @param value {@link #actor} (The practitioner who was involved in the procedure.)
335         */
336        public ProcedurePerformerComponent setActor(Reference value) { 
337          this.actor = value;
338          return this;
339        }
340
341        /**
342         * @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who was involved in the procedure.)
343         */
344        public Resource getActorTarget() { 
345          return this.actorTarget;
346        }
347
348        /**
349         * @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who was involved in the procedure.)
350         */
351        public ProcedurePerformerComponent setActorTarget(Resource value) { 
352          this.actorTarget = value;
353          return this;
354        }
355
356        /**
357         * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
358         */
359        public Reference getOnBehalfOf() { 
360          if (this.onBehalfOf == null)
361            if (Configuration.errorOnAutoCreate())
362              throw new Error("Attempt to auto-create ProcedurePerformerComponent.onBehalfOf");
363            else if (Configuration.doAutoCreate())
364              this.onBehalfOf = new Reference(); // cc
365          return this.onBehalfOf;
366        }
367
368        public boolean hasOnBehalfOf() { 
369          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
370        }
371
372        /**
373         * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
374         */
375        public ProcedurePerformerComponent setOnBehalfOf(Reference value) { 
376          this.onBehalfOf = value;
377          return this;
378        }
379
380        /**
381         * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.)
382         */
383        public Organization getOnBehalfOfTarget() { 
384          if (this.onBehalfOfTarget == null)
385            if (Configuration.errorOnAutoCreate())
386              throw new Error("Attempt to auto-create ProcedurePerformerComponent.onBehalfOf");
387            else if (Configuration.doAutoCreate())
388              this.onBehalfOfTarget = new Organization(); // aa
389          return this.onBehalfOfTarget;
390        }
391
392        /**
393         * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.)
394         */
395        public ProcedurePerformerComponent setOnBehalfOfTarget(Organization value) { 
396          this.onBehalfOfTarget = value;
397          return this;
398        }
399
400        protected void listChildren(List<Property> children) {
401          super.listChildren(children);
402          children.add(new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist.", 0, 1, function));
403          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The practitioner who was involved in the procedure.", 0, 1, actor));
404          children.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf));
405        }
406
407        @Override
408        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
409          switch (_hash) {
410          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist.", 0, 1, function);
411          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The practitioner who was involved in the procedure.", 0, 1, actor);
412          case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf);
413          default: return super.getNamedProperty(_hash, _name, _checkValid);
414          }
415
416        }
417
418      @Override
419      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
420        switch (hash) {
421        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
422        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
423        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
424        default: return super.getProperty(hash, name, checkValid);
425        }
426
427      }
428
429      @Override
430      public Base setProperty(int hash, String name, Base value) throws FHIRException {
431        switch (hash) {
432        case 1380938712: // function
433          this.function = castToCodeableConcept(value); // CodeableConcept
434          return value;
435        case 92645877: // actor
436          this.actor = castToReference(value); // Reference
437          return value;
438        case -14402964: // onBehalfOf
439          this.onBehalfOf = castToReference(value); // Reference
440          return value;
441        default: return super.setProperty(hash, name, value);
442        }
443
444      }
445
446      @Override
447      public Base setProperty(String name, Base value) throws FHIRException {
448        if (name.equals("function")) {
449          this.function = castToCodeableConcept(value); // CodeableConcept
450        } else if (name.equals("actor")) {
451          this.actor = castToReference(value); // Reference
452        } else if (name.equals("onBehalfOf")) {
453          this.onBehalfOf = castToReference(value); // Reference
454        } else
455          return super.setProperty(name, value);
456        return value;
457      }
458
459      @Override
460      public Base makeProperty(int hash, String name) throws FHIRException {
461        switch (hash) {
462        case 1380938712:  return getFunction(); 
463        case 92645877:  return getActor(); 
464        case -14402964:  return getOnBehalfOf(); 
465        default: return super.makeProperty(hash, name);
466        }
467
468      }
469
470      @Override
471      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
472        switch (hash) {
473        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
474        case 92645877: /*actor*/ return new String[] {"Reference"};
475        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
476        default: return super.getTypesForProperty(hash, name);
477        }
478
479      }
480
481      @Override
482      public Base addChild(String name) throws FHIRException {
483        if (name.equals("function")) {
484          this.function = new CodeableConcept();
485          return this.function;
486        }
487        else if (name.equals("actor")) {
488          this.actor = new Reference();
489          return this.actor;
490        }
491        else if (name.equals("onBehalfOf")) {
492          this.onBehalfOf = new Reference();
493          return this.onBehalfOf;
494        }
495        else
496          return super.addChild(name);
497      }
498
499      public ProcedurePerformerComponent copy() {
500        ProcedurePerformerComponent dst = new ProcedurePerformerComponent();
501        copyValues(dst);
502        return dst;
503      }
504
505      public void copyValues(ProcedurePerformerComponent dst) {
506        super.copyValues(dst);
507        dst.function = function == null ? null : function.copy();
508        dst.actor = actor == null ? null : actor.copy();
509        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
510      }
511
512      @Override
513      public boolean equalsDeep(Base other_) {
514        if (!super.equalsDeep(other_))
515          return false;
516        if (!(other_ instanceof ProcedurePerformerComponent))
517          return false;
518        ProcedurePerformerComponent o = (ProcedurePerformerComponent) other_;
519        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true) && compareDeep(onBehalfOf, o.onBehalfOf, true)
520          ;
521      }
522
523      @Override
524      public boolean equalsShallow(Base other_) {
525        if (!super.equalsShallow(other_))
526          return false;
527        if (!(other_ instanceof ProcedurePerformerComponent))
528          return false;
529        ProcedurePerformerComponent o = (ProcedurePerformerComponent) other_;
530        return true;
531      }
532
533      public boolean isEmpty() {
534        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor, onBehalfOf
535          );
536      }
537
538  public String fhirType() {
539    return "Procedure.performer";
540
541  }
542
543  }
544
545    @Block()
546    public static class ProcedureFocalDeviceComponent extends BackboneElement implements IBaseBackboneElement {
547        /**
548         * The kind of change that happened to the device during the procedure.
549         */
550        @Child(name = "action", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
551        @Description(shortDefinition="Kind of change to device", formalDefinition="The kind of change that happened to the device during the procedure." )
552        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-action")
553        protected CodeableConcept action;
554
555        /**
556         * The device that was manipulated (changed) during the procedure.
557         */
558        @Child(name = "manipulated", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=false)
559        @Description(shortDefinition="Device that was changed", formalDefinition="The device that was manipulated (changed) during the procedure." )
560        protected Reference manipulated;
561
562        /**
563         * The actual object that is the target of the reference (The device that was manipulated (changed) during the procedure.)
564         */
565        protected Device manipulatedTarget;
566
567        private static final long serialVersionUID = 1779937807L;
568
569    /**
570     * Constructor
571     */
572      public ProcedureFocalDeviceComponent() {
573        super();
574      }
575
576    /**
577     * Constructor
578     */
579      public ProcedureFocalDeviceComponent(Reference manipulated) {
580        super();
581        this.manipulated = manipulated;
582      }
583
584        /**
585         * @return {@link #action} (The kind of change that happened to the device during the procedure.)
586         */
587        public CodeableConcept getAction() { 
588          if (this.action == null)
589            if (Configuration.errorOnAutoCreate())
590              throw new Error("Attempt to auto-create ProcedureFocalDeviceComponent.action");
591            else if (Configuration.doAutoCreate())
592              this.action = new CodeableConcept(); // cc
593          return this.action;
594        }
595
596        public boolean hasAction() { 
597          return this.action != null && !this.action.isEmpty();
598        }
599
600        /**
601         * @param value {@link #action} (The kind of change that happened to the device during the procedure.)
602         */
603        public ProcedureFocalDeviceComponent setAction(CodeableConcept value) { 
604          this.action = value;
605          return this;
606        }
607
608        /**
609         * @return {@link #manipulated} (The device that was manipulated (changed) during the procedure.)
610         */
611        public Reference getManipulated() { 
612          if (this.manipulated == null)
613            if (Configuration.errorOnAutoCreate())
614              throw new Error("Attempt to auto-create ProcedureFocalDeviceComponent.manipulated");
615            else if (Configuration.doAutoCreate())
616              this.manipulated = new Reference(); // cc
617          return this.manipulated;
618        }
619
620        public boolean hasManipulated() { 
621          return this.manipulated != null && !this.manipulated.isEmpty();
622        }
623
624        /**
625         * @param value {@link #manipulated} (The device that was manipulated (changed) during the procedure.)
626         */
627        public ProcedureFocalDeviceComponent setManipulated(Reference value) { 
628          this.manipulated = value;
629          return this;
630        }
631
632        /**
633         * @return {@link #manipulated} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The device that was manipulated (changed) during the procedure.)
634         */
635        public Device getManipulatedTarget() { 
636          if (this.manipulatedTarget == null)
637            if (Configuration.errorOnAutoCreate())
638              throw new Error("Attempt to auto-create ProcedureFocalDeviceComponent.manipulated");
639            else if (Configuration.doAutoCreate())
640              this.manipulatedTarget = new Device(); // aa
641          return this.manipulatedTarget;
642        }
643
644        /**
645         * @param value {@link #manipulated} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The device that was manipulated (changed) during the procedure.)
646         */
647        public ProcedureFocalDeviceComponent setManipulatedTarget(Device value) { 
648          this.manipulatedTarget = value;
649          return this;
650        }
651
652        protected void listChildren(List<Property> children) {
653          super.listChildren(children);
654          children.add(new Property("action", "CodeableConcept", "The kind of change that happened to the device during the procedure.", 0, 1, action));
655          children.add(new Property("manipulated", "Reference(Device)", "The device that was manipulated (changed) during the procedure.", 0, 1, manipulated));
656        }
657
658        @Override
659        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
660          switch (_hash) {
661          case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "The kind of change that happened to the device during the procedure.", 0, 1, action);
662          case 947372650: /*manipulated*/  return new Property("manipulated", "Reference(Device)", "The device that was manipulated (changed) during the procedure.", 0, 1, manipulated);
663          default: return super.getNamedProperty(_hash, _name, _checkValid);
664          }
665
666        }
667
668      @Override
669      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
670        switch (hash) {
671        case -1422950858: /*action*/ return this.action == null ? new Base[0] : new Base[] {this.action}; // CodeableConcept
672        case 947372650: /*manipulated*/ return this.manipulated == null ? new Base[0] : new Base[] {this.manipulated}; // Reference
673        default: return super.getProperty(hash, name, checkValid);
674        }
675
676      }
677
678      @Override
679      public Base setProperty(int hash, String name, Base value) throws FHIRException {
680        switch (hash) {
681        case -1422950858: // action
682          this.action = castToCodeableConcept(value); // CodeableConcept
683          return value;
684        case 947372650: // manipulated
685          this.manipulated = castToReference(value); // Reference
686          return value;
687        default: return super.setProperty(hash, name, value);
688        }
689
690      }
691
692      @Override
693      public Base setProperty(String name, Base value) throws FHIRException {
694        if (name.equals("action")) {
695          this.action = castToCodeableConcept(value); // CodeableConcept
696        } else if (name.equals("manipulated")) {
697          this.manipulated = castToReference(value); // Reference
698        } else
699          return super.setProperty(name, value);
700        return value;
701      }
702
703      @Override
704      public Base makeProperty(int hash, String name) throws FHIRException {
705        switch (hash) {
706        case -1422950858:  return getAction(); 
707        case 947372650:  return getManipulated(); 
708        default: return super.makeProperty(hash, name);
709        }
710
711      }
712
713      @Override
714      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
715        switch (hash) {
716        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
717        case 947372650: /*manipulated*/ return new String[] {"Reference"};
718        default: return super.getTypesForProperty(hash, name);
719        }
720
721      }
722
723      @Override
724      public Base addChild(String name) throws FHIRException {
725        if (name.equals("action")) {
726          this.action = new CodeableConcept();
727          return this.action;
728        }
729        else if (name.equals("manipulated")) {
730          this.manipulated = new Reference();
731          return this.manipulated;
732        }
733        else
734          return super.addChild(name);
735      }
736
737      public ProcedureFocalDeviceComponent copy() {
738        ProcedureFocalDeviceComponent dst = new ProcedureFocalDeviceComponent();
739        copyValues(dst);
740        return dst;
741      }
742
743      public void copyValues(ProcedureFocalDeviceComponent dst) {
744        super.copyValues(dst);
745        dst.action = action == null ? null : action.copy();
746        dst.manipulated = manipulated == null ? null : manipulated.copy();
747      }
748
749      @Override
750      public boolean equalsDeep(Base other_) {
751        if (!super.equalsDeep(other_))
752          return false;
753        if (!(other_ instanceof ProcedureFocalDeviceComponent))
754          return false;
755        ProcedureFocalDeviceComponent o = (ProcedureFocalDeviceComponent) other_;
756        return compareDeep(action, o.action, true) && compareDeep(manipulated, o.manipulated, true);
757      }
758
759      @Override
760      public boolean equalsShallow(Base other_) {
761        if (!super.equalsShallow(other_))
762          return false;
763        if (!(other_ instanceof ProcedureFocalDeviceComponent))
764          return false;
765        ProcedureFocalDeviceComponent o = (ProcedureFocalDeviceComponent) other_;
766        return true;
767      }
768
769      public boolean isEmpty() {
770        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(action, manipulated);
771      }
772
773  public String fhirType() {
774    return "Procedure.focalDevice";
775
776  }
777
778  }
779
780    /**
781     * Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server.
782     */
783    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
784    @Description(shortDefinition="External Identifiers for this procedure", formalDefinition="Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server." )
785    protected List<Identifier> identifier;
786
787    /**
788     * The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.
789     */
790    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
791    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure." )
792    protected List<CanonicalType> instantiatesCanonical;
793
794    /**
795     * The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.
796     */
797    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
798    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure." )
799    protected List<UriType> instantiatesUri;
800
801    /**
802     * A reference to a resource that contains details of the request for this procedure.
803     */
804    @Child(name = "basedOn", type = {CarePlan.class, ServiceRequest.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
805    @Description(shortDefinition="A request for this procedure", formalDefinition="A reference to a resource that contains details of the request for this procedure." )
806    protected List<Reference> basedOn;
807    /**
808     * The actual objects that are the target of the reference (A reference to a resource that contains details of the request for this procedure.)
809     */
810    protected List<Resource> basedOnTarget;
811
812
813    /**
814     * A larger event of which this particular procedure is a component or step.
815     */
816    @Child(name = "partOf", type = {Procedure.class, Observation.class, MedicationAdministration.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
817    @Description(shortDefinition="Part of referenced event", formalDefinition="A larger event of which this particular procedure is a component or step." )
818    protected List<Reference> partOf;
819    /**
820     * The actual objects that are the target of the reference (A larger event of which this particular procedure is a component or step.)
821     */
822    protected List<Resource> partOfTarget;
823
824
825    /**
826     * A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.
827     */
828    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
829    @Description(shortDefinition="preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown", formalDefinition="A code specifying the state of the procedure. Generally, this will be the in-progress or completed state." )
830    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/event-status")
831    protected Enumeration<ProcedureStatus> status;
832
833    /**
834     * Captures the reason for the current state of the procedure.
835     */
836    @Child(name = "statusReason", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
837    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current state of the procedure." )
838    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-not-performed-reason")
839    protected CodeableConcept statusReason;
840
841    /**
842     * A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").
843     */
844    @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
845    @Description(shortDefinition="Classification of the procedure", formalDefinition="A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\")." )
846    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-category")
847    protected CodeableConcept category;
848
849    /**
850     * The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").
851     */
852    @Child(name = "code", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
853    @Description(shortDefinition="Identification of the procedure", formalDefinition="The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\")." )
854    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-code")
855    protected CodeableConcept code;
856
857    /**
858     * The person, animal or group on which the procedure was performed.
859     */
860    @Child(name = "subject", type = {Patient.class, Group.class}, order=9, min=1, max=1, modifier=false, summary=true)
861    @Description(shortDefinition="Who the procedure was performed on", formalDefinition="The person, animal or group on which the procedure was performed." )
862    protected Reference subject;
863
864    /**
865     * The actual object that is the target of the reference (The person, animal or group on which the procedure was performed.)
866     */
867    protected Resource subjectTarget;
868
869    /**
870     * The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.
871     */
872    @Child(name = "encounter", type = {Encounter.class}, order=10, min=0, max=1, modifier=false, summary=true)
873    @Description(shortDefinition="Encounter created as part of", formalDefinition="The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated." )
874    protected Reference encounter;
875
876    /**
877     * The actual object that is the target of the reference (The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.)
878     */
879    protected Encounter encounterTarget;
880
881    /**
882     * Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.
883     */
884    @Child(name = "performed", type = {DateTimeType.class, Period.class, StringType.class, Age.class, Range.class}, order=11, min=0, max=1, modifier=false, summary=true)
885    @Description(shortDefinition="When the procedure was performed", formalDefinition="Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured." )
886    protected Type performed;
887
888    /**
889     * Individual who recorded the record and takes responsibility for its content.
890     */
891    @Child(name = "recorder", type = {Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class}, order=12, min=0, max=1, modifier=false, summary=true)
892    @Description(shortDefinition="Who recorded the procedure", formalDefinition="Individual who recorded the record and takes responsibility for its content." )
893    protected Reference recorder;
894
895    /**
896     * The actual object that is the target of the reference (Individual who recorded the record and takes responsibility for its content.)
897     */
898    protected Resource recorderTarget;
899
900    /**
901     * Individual who is making the procedure statement.
902     */
903    @Child(name = "asserter", type = {Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class}, order=13, min=0, max=1, modifier=false, summary=true)
904    @Description(shortDefinition="Person who asserts this procedure", formalDefinition="Individual who is making the procedure statement." )
905    protected Reference asserter;
906
907    /**
908     * The actual object that is the target of the reference (Individual who is making the procedure statement.)
909     */
910    protected Resource asserterTarget;
911
912    /**
913     * Limited to "real" people rather than equipment.
914     */
915    @Child(name = "performer", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
916    @Description(shortDefinition="The people who performed the procedure", formalDefinition="Limited to \"real\" people rather than equipment." )
917    protected List<ProcedurePerformerComponent> performer;
918
919    /**
920     * The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.
921     */
922    @Child(name = "location", type = {Location.class}, order=15, min=0, max=1, modifier=false, summary=true)
923    @Description(shortDefinition="Where the procedure happened", formalDefinition="The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant." )
924    protected Reference location;
925
926    /**
927     * The actual object that is the target of the reference (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
928     */
929    protected Location locationTarget;
930
931    /**
932     * The coded reason why the procedure was performed. This may be a coded entity of some type, or may simply be present as text.
933     */
934    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
935    @Description(shortDefinition="Coded reason procedure performed", formalDefinition="The coded reason why the procedure was performed. This may be a coded entity of some type, or may simply be present as text." )
936    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-reason")
937    protected List<CodeableConcept> reasonCode;
938
939    /**
940     * The justification of why the procedure was performed.
941     */
942    @Child(name = "reasonReference", type = {Condition.class, Observation.class, Procedure.class, DiagnosticReport.class, DocumentReference.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
943    @Description(shortDefinition="The justification that the procedure was performed", formalDefinition="The justification of why the procedure was performed." )
944    protected List<Reference> reasonReference;
945    /**
946     * The actual objects that are the target of the reference (The justification of why the procedure was performed.)
947     */
948    protected List<Resource> reasonReferenceTarget;
949
950
951    /**
952     * Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.
953     */
954    @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
955    @Description(shortDefinition="Target body sites", formalDefinition="Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion." )
956    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
957    protected List<CodeableConcept> bodySite;
958
959    /**
960     * The outcome of the procedure - did it resolve the reasons for the procedure being performed?
961     */
962    @Child(name = "outcome", type = {CodeableConcept.class}, order=19, min=0, max=1, modifier=false, summary=true)
963    @Description(shortDefinition="The result of procedure", formalDefinition="The outcome of the procedure - did it resolve the reasons for the procedure being performed?" )
964    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-outcome")
965    protected CodeableConcept outcome;
966
967    /**
968     * This could be a histology result, pathology report, surgical report, etc.
969     */
970    @Child(name = "report", type = {DiagnosticReport.class, DocumentReference.class, Composition.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
971    @Description(shortDefinition="Any report resulting from the procedure", formalDefinition="This could be a histology result, pathology report, surgical report, etc." )
972    protected List<Reference> report;
973    /**
974     * The actual objects that are the target of the reference (This could be a histology result, pathology report, surgical report, etc.)
975     */
976    protected List<Resource> reportTarget;
977
978
979    /**
980     * Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.
981     */
982    @Child(name = "complication", type = {CodeableConcept.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
983    @Description(shortDefinition="Complication following the procedure", formalDefinition="Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues." )
984    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
985    protected List<CodeableConcept> complication;
986
987    /**
988     * Any complications that occurred during the procedure, or in the immediate post-performance period.
989     */
990    @Child(name = "complicationDetail", type = {Condition.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
991    @Description(shortDefinition="A condition that is a result of the procedure", formalDefinition="Any complications that occurred during the procedure, or in the immediate post-performance period." )
992    protected List<Reference> complicationDetail;
993    /**
994     * The actual objects that are the target of the reference (Any complications that occurred during the procedure, or in the immediate post-performance period.)
995     */
996    protected List<Condition> complicationDetailTarget;
997
998
999    /**
1000     * If the procedure required specific follow up - e.g. removal of sutures. The follow up may be represented as a simple note or could potentially be more complex, in which case the CarePlan resource can be used.
1001     */
1002    @Child(name = "followUp", type = {CodeableConcept.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1003    @Description(shortDefinition="Instructions for follow up", formalDefinition="If the procedure required specific follow up - e.g. removal of sutures. The follow up may be represented as a simple note or could potentially be more complex, in which case the CarePlan resource can be used." )
1004    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-followup")
1005    protected List<CodeableConcept> followUp;
1006
1007    /**
1008     * Any other notes and comments about the procedure.
1009     */
1010    @Child(name = "note", type = {Annotation.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1011    @Description(shortDefinition="Additional information about the procedure", formalDefinition="Any other notes and comments about the procedure." )
1012    protected List<Annotation> note;
1013
1014    /**
1015     * A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.
1016     */
1017    @Child(name = "focalDevice", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1018    @Description(shortDefinition="Manipulated, implanted, or removed device", formalDefinition="A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure." )
1019    protected List<ProcedureFocalDeviceComponent> focalDevice;
1020
1021    /**
1022     * Identifies medications, devices and any other substance used as part of the procedure.
1023     */
1024    @Child(name = "usedReference", type = {Device.class, Medication.class, Substance.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1025    @Description(shortDefinition="Items used during procedure", formalDefinition="Identifies medications, devices and any other substance used as part of the procedure." )
1026    protected List<Reference> usedReference;
1027    /**
1028     * The actual objects that are the target of the reference (Identifies medications, devices and any other substance used as part of the procedure.)
1029     */
1030    protected List<Resource> usedReferenceTarget;
1031
1032
1033    /**
1034     * Identifies coded items that were used as part of the procedure.
1035     */
1036    @Child(name = "usedCode", type = {CodeableConcept.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1037    @Description(shortDefinition="Coded items used during the procedure", formalDefinition="Identifies coded items that were used as part of the procedure." )
1038    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-kind")
1039    protected List<CodeableConcept> usedCode;
1040
1041    private static final long serialVersionUID = -29072720L;
1042
1043  /**
1044   * Constructor
1045   */
1046    public Procedure() {
1047      super();
1048    }
1049
1050  /**
1051   * Constructor
1052   */
1053    public Procedure(Enumeration<ProcedureStatus> status, Reference subject) {
1054      super();
1055      this.status = status;
1056      this.subject = subject;
1057    }
1058
1059    /**
1060     * @return {@link #identifier} (Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server.)
1061     */
1062    public List<Identifier> getIdentifier() { 
1063      if (this.identifier == null)
1064        this.identifier = new ArrayList<Identifier>();
1065      return this.identifier;
1066    }
1067
1068    /**
1069     * @return Returns a reference to <code>this</code> for easy method chaining
1070     */
1071    public Procedure setIdentifier(List<Identifier> theIdentifier) { 
1072      this.identifier = theIdentifier;
1073      return this;
1074    }
1075
1076    public boolean hasIdentifier() { 
1077      if (this.identifier == null)
1078        return false;
1079      for (Identifier item : this.identifier)
1080        if (!item.isEmpty())
1081          return true;
1082      return false;
1083    }
1084
1085    public Identifier addIdentifier() { //3
1086      Identifier t = new Identifier();
1087      if (this.identifier == null)
1088        this.identifier = new ArrayList<Identifier>();
1089      this.identifier.add(t);
1090      return t;
1091    }
1092
1093    public Procedure addIdentifier(Identifier t) { //3
1094      if (t == null)
1095        return this;
1096      if (this.identifier == null)
1097        this.identifier = new ArrayList<Identifier>();
1098      this.identifier.add(t);
1099      return this;
1100    }
1101
1102    /**
1103     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1104     */
1105    public Identifier getIdentifierFirstRep() { 
1106      if (getIdentifier().isEmpty()) {
1107        addIdentifier();
1108      }
1109      return getIdentifier().get(0);
1110    }
1111
1112    /**
1113     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1114     */
1115    public List<CanonicalType> getInstantiatesCanonical() { 
1116      if (this.instantiatesCanonical == null)
1117        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1118      return this.instantiatesCanonical;
1119    }
1120
1121    /**
1122     * @return Returns a reference to <code>this</code> for easy method chaining
1123     */
1124    public Procedure setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
1125      this.instantiatesCanonical = theInstantiatesCanonical;
1126      return this;
1127    }
1128
1129    public boolean hasInstantiatesCanonical() { 
1130      if (this.instantiatesCanonical == null)
1131        return false;
1132      for (CanonicalType item : this.instantiatesCanonical)
1133        if (!item.isEmpty())
1134          return true;
1135      return false;
1136    }
1137
1138    /**
1139     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1140     */
1141    public CanonicalType addInstantiatesCanonicalElement() {//2 
1142      CanonicalType t = new CanonicalType();
1143      if (this.instantiatesCanonical == null)
1144        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1145      this.instantiatesCanonical.add(t);
1146      return t;
1147    }
1148
1149    /**
1150     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1151     */
1152    public Procedure addInstantiatesCanonical(String value) { //1
1153      CanonicalType t = new CanonicalType();
1154      t.setValue(value);
1155      if (this.instantiatesCanonical == null)
1156        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1157      this.instantiatesCanonical.add(t);
1158      return this;
1159    }
1160
1161    /**
1162     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1163     */
1164    public boolean hasInstantiatesCanonical(String value) { 
1165      if (this.instantiatesCanonical == null)
1166        return false;
1167      for (CanonicalType v : this.instantiatesCanonical)
1168        if (v.getValue().equals(value)) // canonical(PlanDefinition|ActivityDefinition|Measure|OperationDefinition|Questionnaire)
1169          return true;
1170      return false;
1171    }
1172
1173    /**
1174     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1175     */
1176    public List<UriType> getInstantiatesUri() { 
1177      if (this.instantiatesUri == null)
1178        this.instantiatesUri = new ArrayList<UriType>();
1179      return this.instantiatesUri;
1180    }
1181
1182    /**
1183     * @return Returns a reference to <code>this</code> for easy method chaining
1184     */
1185    public Procedure setInstantiatesUri(List<UriType> theInstantiatesUri) { 
1186      this.instantiatesUri = theInstantiatesUri;
1187      return this;
1188    }
1189
1190    public boolean hasInstantiatesUri() { 
1191      if (this.instantiatesUri == null)
1192        return false;
1193      for (UriType item : this.instantiatesUri)
1194        if (!item.isEmpty())
1195          return true;
1196      return false;
1197    }
1198
1199    /**
1200     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1201     */
1202    public UriType addInstantiatesUriElement() {//2 
1203      UriType t = new UriType();
1204      if (this.instantiatesUri == null)
1205        this.instantiatesUri = new ArrayList<UriType>();
1206      this.instantiatesUri.add(t);
1207      return t;
1208    }
1209
1210    /**
1211     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1212     */
1213    public Procedure addInstantiatesUri(String value) { //1
1214      UriType t = new UriType();
1215      t.setValue(value);
1216      if (this.instantiatesUri == null)
1217        this.instantiatesUri = new ArrayList<UriType>();
1218      this.instantiatesUri.add(t);
1219      return this;
1220    }
1221
1222    /**
1223     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.)
1224     */
1225    public boolean hasInstantiatesUri(String value) { 
1226      if (this.instantiatesUri == null)
1227        return false;
1228      for (UriType v : this.instantiatesUri)
1229        if (v.getValue().equals(value)) // uri
1230          return true;
1231      return false;
1232    }
1233
1234    /**
1235     * @return {@link #basedOn} (A reference to a resource that contains details of the request for this procedure.)
1236     */
1237    public List<Reference> getBasedOn() { 
1238      if (this.basedOn == null)
1239        this.basedOn = new ArrayList<Reference>();
1240      return this.basedOn;
1241    }
1242
1243    /**
1244     * @return Returns a reference to <code>this</code> for easy method chaining
1245     */
1246    public Procedure setBasedOn(List<Reference> theBasedOn) { 
1247      this.basedOn = theBasedOn;
1248      return this;
1249    }
1250
1251    public boolean hasBasedOn() { 
1252      if (this.basedOn == null)
1253        return false;
1254      for (Reference item : this.basedOn)
1255        if (!item.isEmpty())
1256          return true;
1257      return false;
1258    }
1259
1260    public Reference addBasedOn() { //3
1261      Reference t = new Reference();
1262      if (this.basedOn == null)
1263        this.basedOn = new ArrayList<Reference>();
1264      this.basedOn.add(t);
1265      return t;
1266    }
1267
1268    public Procedure addBasedOn(Reference t) { //3
1269      if (t == null)
1270        return this;
1271      if (this.basedOn == null)
1272        this.basedOn = new ArrayList<Reference>();
1273      this.basedOn.add(t);
1274      return this;
1275    }
1276
1277    /**
1278     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
1279     */
1280    public Reference getBasedOnFirstRep() { 
1281      if (getBasedOn().isEmpty()) {
1282        addBasedOn();
1283      }
1284      return getBasedOn().get(0);
1285    }
1286
1287    /**
1288     * @deprecated Use Reference#setResource(IBaseResource) instead
1289     */
1290    @Deprecated
1291    public List<Resource> getBasedOnTarget() { 
1292      if (this.basedOnTarget == null)
1293        this.basedOnTarget = new ArrayList<Resource>();
1294      return this.basedOnTarget;
1295    }
1296
1297    /**
1298     * @return {@link #partOf} (A larger event of which this particular procedure is a component or step.)
1299     */
1300    public List<Reference> getPartOf() { 
1301      if (this.partOf == null)
1302        this.partOf = new ArrayList<Reference>();
1303      return this.partOf;
1304    }
1305
1306    /**
1307     * @return Returns a reference to <code>this</code> for easy method chaining
1308     */
1309    public Procedure setPartOf(List<Reference> thePartOf) { 
1310      this.partOf = thePartOf;
1311      return this;
1312    }
1313
1314    public boolean hasPartOf() { 
1315      if (this.partOf == null)
1316        return false;
1317      for (Reference item : this.partOf)
1318        if (!item.isEmpty())
1319          return true;
1320      return false;
1321    }
1322
1323    public Reference addPartOf() { //3
1324      Reference t = new Reference();
1325      if (this.partOf == null)
1326        this.partOf = new ArrayList<Reference>();
1327      this.partOf.add(t);
1328      return t;
1329    }
1330
1331    public Procedure addPartOf(Reference t) { //3
1332      if (t == null)
1333        return this;
1334      if (this.partOf == null)
1335        this.partOf = new ArrayList<Reference>();
1336      this.partOf.add(t);
1337      return this;
1338    }
1339
1340    /**
1341     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
1342     */
1343    public Reference getPartOfFirstRep() { 
1344      if (getPartOf().isEmpty()) {
1345        addPartOf();
1346      }
1347      return getPartOf().get(0);
1348    }
1349
1350    /**
1351     * @deprecated Use Reference#setResource(IBaseResource) instead
1352     */
1353    @Deprecated
1354    public List<Resource> getPartOfTarget() { 
1355      if (this.partOfTarget == null)
1356        this.partOfTarget = new ArrayList<Resource>();
1357      return this.partOfTarget;
1358    }
1359
1360    /**
1361     * @return {@link #status} (A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1362     */
1363    public Enumeration<ProcedureStatus> getStatusElement() { 
1364      if (this.status == null)
1365        if (Configuration.errorOnAutoCreate())
1366          throw new Error("Attempt to auto-create Procedure.status");
1367        else if (Configuration.doAutoCreate())
1368          this.status = new Enumeration<ProcedureStatus>(new ProcedureStatusEnumFactory()); // bb
1369      return this.status;
1370    }
1371
1372    public boolean hasStatusElement() { 
1373      return this.status != null && !this.status.isEmpty();
1374    }
1375
1376    public boolean hasStatus() { 
1377      return this.status != null && !this.status.isEmpty();
1378    }
1379
1380    /**
1381     * @param value {@link #status} (A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1382     */
1383    public Procedure setStatusElement(Enumeration<ProcedureStatus> value) { 
1384      this.status = value;
1385      return this;
1386    }
1387
1388    /**
1389     * @return A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.
1390     */
1391    public ProcedureStatus getStatus() { 
1392      return this.status == null ? null : this.status.getValue();
1393    }
1394
1395    /**
1396     * @param value A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.
1397     */
1398    public Procedure setStatus(ProcedureStatus value) { 
1399        if (this.status == null)
1400          this.status = new Enumeration<ProcedureStatus>(new ProcedureStatusEnumFactory());
1401        this.status.setValue(value);
1402      return this;
1403    }
1404
1405    /**
1406     * @return {@link #statusReason} (Captures the reason for the current state of the procedure.)
1407     */
1408    public CodeableConcept getStatusReason() { 
1409      if (this.statusReason == null)
1410        if (Configuration.errorOnAutoCreate())
1411          throw new Error("Attempt to auto-create Procedure.statusReason");
1412        else if (Configuration.doAutoCreate())
1413          this.statusReason = new CodeableConcept(); // cc
1414      return this.statusReason;
1415    }
1416
1417    public boolean hasStatusReason() { 
1418      return this.statusReason != null && !this.statusReason.isEmpty();
1419    }
1420
1421    /**
1422     * @param value {@link #statusReason} (Captures the reason for the current state of the procedure.)
1423     */
1424    public Procedure setStatusReason(CodeableConcept value) { 
1425      this.statusReason = value;
1426      return this;
1427    }
1428
1429    /**
1430     * @return {@link #category} (A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").)
1431     */
1432    public CodeableConcept getCategory() { 
1433      if (this.category == null)
1434        if (Configuration.errorOnAutoCreate())
1435          throw new Error("Attempt to auto-create Procedure.category");
1436        else if (Configuration.doAutoCreate())
1437          this.category = new CodeableConcept(); // cc
1438      return this.category;
1439    }
1440
1441    public boolean hasCategory() { 
1442      return this.category != null && !this.category.isEmpty();
1443    }
1444
1445    /**
1446     * @param value {@link #category} (A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").)
1447     */
1448    public Procedure setCategory(CodeableConcept value) { 
1449      this.category = value;
1450      return this;
1451    }
1452
1453    /**
1454     * @return {@link #code} (The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").)
1455     */
1456    public CodeableConcept getCode() { 
1457      if (this.code == null)
1458        if (Configuration.errorOnAutoCreate())
1459          throw new Error("Attempt to auto-create Procedure.code");
1460        else if (Configuration.doAutoCreate())
1461          this.code = new CodeableConcept(); // cc
1462      return this.code;
1463    }
1464
1465    public boolean hasCode() { 
1466      return this.code != null && !this.code.isEmpty();
1467    }
1468
1469    /**
1470     * @param value {@link #code} (The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").)
1471     */
1472    public Procedure setCode(CodeableConcept value) { 
1473      this.code = value;
1474      return this;
1475    }
1476
1477    /**
1478     * @return {@link #subject} (The person, animal or group on which the procedure was performed.)
1479     */
1480    public Reference getSubject() { 
1481      if (this.subject == null)
1482        if (Configuration.errorOnAutoCreate())
1483          throw new Error("Attempt to auto-create Procedure.subject");
1484        else if (Configuration.doAutoCreate())
1485          this.subject = new Reference(); // cc
1486      return this.subject;
1487    }
1488
1489    public boolean hasSubject() { 
1490      return this.subject != null && !this.subject.isEmpty();
1491    }
1492
1493    /**
1494     * @param value {@link #subject} (The person, animal or group on which the procedure was performed.)
1495     */
1496    public Procedure setSubject(Reference value) { 
1497      this.subject = value;
1498      return this;
1499    }
1500
1501    /**
1502     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person, animal or group on which the procedure was performed.)
1503     */
1504    public Resource getSubjectTarget() { 
1505      return this.subjectTarget;
1506    }
1507
1508    /**
1509     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person, animal or group on which the procedure was performed.)
1510     */
1511    public Procedure setSubjectTarget(Resource value) { 
1512      this.subjectTarget = value;
1513      return this;
1514    }
1515
1516    /**
1517     * @return {@link #encounter} (The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.)
1518     */
1519    public Reference getEncounter() { 
1520      if (this.encounter == null)
1521        if (Configuration.errorOnAutoCreate())
1522          throw new Error("Attempt to auto-create Procedure.encounter");
1523        else if (Configuration.doAutoCreate())
1524          this.encounter = new Reference(); // cc
1525      return this.encounter;
1526    }
1527
1528    public boolean hasEncounter() { 
1529      return this.encounter != null && !this.encounter.isEmpty();
1530    }
1531
1532    /**
1533     * @param value {@link #encounter} (The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.)
1534     */
1535    public Procedure setEncounter(Reference value) { 
1536      this.encounter = value;
1537      return this;
1538    }
1539
1540    /**
1541     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.)
1542     */
1543    public Encounter getEncounterTarget() { 
1544      if (this.encounterTarget == null)
1545        if (Configuration.errorOnAutoCreate())
1546          throw new Error("Attempt to auto-create Procedure.encounter");
1547        else if (Configuration.doAutoCreate())
1548          this.encounterTarget = new Encounter(); // aa
1549      return this.encounterTarget;
1550    }
1551
1552    /**
1553     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.)
1554     */
1555    public Procedure setEncounterTarget(Encounter value) { 
1556      this.encounterTarget = value;
1557      return this;
1558    }
1559
1560    /**
1561     * @return {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1562     */
1563    public Type getPerformed() { 
1564      return this.performed;
1565    }
1566
1567    /**
1568     * @return {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1569     */
1570    public DateTimeType getPerformedDateTimeType() throws FHIRException { 
1571      if (this.performed == null)
1572        this.performed = new DateTimeType();
1573      if (!(this.performed instanceof DateTimeType))
1574        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.performed.getClass().getName()+" was encountered");
1575      return (DateTimeType) this.performed;
1576    }
1577
1578    public boolean hasPerformedDateTimeType() { 
1579      return this != null && this.performed instanceof DateTimeType;
1580    }
1581
1582    /**
1583     * @return {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1584     */
1585    public Period getPerformedPeriod() throws FHIRException { 
1586      if (this.performed == null)
1587        this.performed = new Period();
1588      if (!(this.performed instanceof Period))
1589        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.performed.getClass().getName()+" was encountered");
1590      return (Period) this.performed;
1591    }
1592
1593    public boolean hasPerformedPeriod() { 
1594      return this != null && this.performed instanceof Period;
1595    }
1596
1597    /**
1598     * @return {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1599     */
1600    public StringType getPerformedStringType() throws FHIRException { 
1601      if (this.performed == null)
1602        this.performed = new StringType();
1603      if (!(this.performed instanceof StringType))
1604        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.performed.getClass().getName()+" was encountered");
1605      return (StringType) this.performed;
1606    }
1607
1608    public boolean hasPerformedStringType() { 
1609      return this != null && this.performed instanceof StringType;
1610    }
1611
1612    /**
1613     * @return {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1614     */
1615    public Age getPerformedAge() throws FHIRException { 
1616      if (this.performed == null)
1617        this.performed = new Age();
1618      if (!(this.performed instanceof Age))
1619        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.performed.getClass().getName()+" was encountered");
1620      return (Age) this.performed;
1621    }
1622
1623    public boolean hasPerformedAge() { 
1624      return this != null && this.performed instanceof Age;
1625    }
1626
1627    /**
1628     * @return {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1629     */
1630    public Range getPerformedRange() throws FHIRException { 
1631      if (this.performed == null)
1632        this.performed = new Range();
1633      if (!(this.performed instanceof Range))
1634        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.performed.getClass().getName()+" was encountered");
1635      return (Range) this.performed;
1636    }
1637
1638    public boolean hasPerformedRange() { 
1639      return this != null && this.performed instanceof Range;
1640    }
1641
1642    public boolean hasPerformed() { 
1643      return this.performed != null && !this.performed.isEmpty();
1644    }
1645
1646    /**
1647     * @param value {@link #performed} (Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1648     */
1649    public Procedure setPerformed(Type value) { 
1650      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof StringType || value instanceof Age || value instanceof Range))
1651        throw new Error("Not the right type for Procedure.performed[x]: "+value.fhirType());
1652      this.performed = value;
1653      return this;
1654    }
1655
1656    /**
1657     * @return {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1658     */
1659    public Reference getRecorder() { 
1660      if (this.recorder == null)
1661        if (Configuration.errorOnAutoCreate())
1662          throw new Error("Attempt to auto-create Procedure.recorder");
1663        else if (Configuration.doAutoCreate())
1664          this.recorder = new Reference(); // cc
1665      return this.recorder;
1666    }
1667
1668    public boolean hasRecorder() { 
1669      return this.recorder != null && !this.recorder.isEmpty();
1670    }
1671
1672    /**
1673     * @param value {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1674     */
1675    public Procedure setRecorder(Reference value) { 
1676      this.recorder = value;
1677      return this;
1678    }
1679
1680    /**
1681     * @return {@link #recorder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Individual who recorded the record and takes responsibility for its content.)
1682     */
1683    public Resource getRecorderTarget() { 
1684      return this.recorderTarget;
1685    }
1686
1687    /**
1688     * @param value {@link #recorder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Individual who recorded the record and takes responsibility for its content.)
1689     */
1690    public Procedure setRecorderTarget(Resource value) { 
1691      this.recorderTarget = value;
1692      return this;
1693    }
1694
1695    /**
1696     * @return {@link #asserter} (Individual who is making the procedure statement.)
1697     */
1698    public Reference getAsserter() { 
1699      if (this.asserter == null)
1700        if (Configuration.errorOnAutoCreate())
1701          throw new Error("Attempt to auto-create Procedure.asserter");
1702        else if (Configuration.doAutoCreate())
1703          this.asserter = new Reference(); // cc
1704      return this.asserter;
1705    }
1706
1707    public boolean hasAsserter() { 
1708      return this.asserter != null && !this.asserter.isEmpty();
1709    }
1710
1711    /**
1712     * @param value {@link #asserter} (Individual who is making the procedure statement.)
1713     */
1714    public Procedure setAsserter(Reference value) { 
1715      this.asserter = value;
1716      return this;
1717    }
1718
1719    /**
1720     * @return {@link #asserter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Individual who is making the procedure statement.)
1721     */
1722    public Resource getAsserterTarget() { 
1723      return this.asserterTarget;
1724    }
1725
1726    /**
1727     * @param value {@link #asserter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Individual who is making the procedure statement.)
1728     */
1729    public Procedure setAsserterTarget(Resource value) { 
1730      this.asserterTarget = value;
1731      return this;
1732    }
1733
1734    /**
1735     * @return {@link #performer} (Limited to "real" people rather than equipment.)
1736     */
1737    public List<ProcedurePerformerComponent> getPerformer() { 
1738      if (this.performer == null)
1739        this.performer = new ArrayList<ProcedurePerformerComponent>();
1740      return this.performer;
1741    }
1742
1743    /**
1744     * @return Returns a reference to <code>this</code> for easy method chaining
1745     */
1746    public Procedure setPerformer(List<ProcedurePerformerComponent> thePerformer) { 
1747      this.performer = thePerformer;
1748      return this;
1749    }
1750
1751    public boolean hasPerformer() { 
1752      if (this.performer == null)
1753        return false;
1754      for (ProcedurePerformerComponent item : this.performer)
1755        if (!item.isEmpty())
1756          return true;
1757      return false;
1758    }
1759
1760    public ProcedurePerformerComponent addPerformer() { //3
1761      ProcedurePerformerComponent t = new ProcedurePerformerComponent();
1762      if (this.performer == null)
1763        this.performer = new ArrayList<ProcedurePerformerComponent>();
1764      this.performer.add(t);
1765      return t;
1766    }
1767
1768    public Procedure addPerformer(ProcedurePerformerComponent t) { //3
1769      if (t == null)
1770        return this;
1771      if (this.performer == null)
1772        this.performer = new ArrayList<ProcedurePerformerComponent>();
1773      this.performer.add(t);
1774      return this;
1775    }
1776
1777    /**
1778     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
1779     */
1780    public ProcedurePerformerComponent getPerformerFirstRep() { 
1781      if (getPerformer().isEmpty()) {
1782        addPerformer();
1783      }
1784      return getPerformer().get(0);
1785    }
1786
1787    /**
1788     * @return {@link #location} (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1789     */
1790    public Reference getLocation() { 
1791      if (this.location == null)
1792        if (Configuration.errorOnAutoCreate())
1793          throw new Error("Attempt to auto-create Procedure.location");
1794        else if (Configuration.doAutoCreate())
1795          this.location = new Reference(); // cc
1796      return this.location;
1797    }
1798
1799    public boolean hasLocation() { 
1800      return this.location != null && !this.location.isEmpty();
1801    }
1802
1803    /**
1804     * @param value {@link #location} (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1805     */
1806    public Procedure setLocation(Reference value) { 
1807      this.location = value;
1808      return this;
1809    }
1810
1811    /**
1812     * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1813     */
1814    public Location getLocationTarget() { 
1815      if (this.locationTarget == null)
1816        if (Configuration.errorOnAutoCreate())
1817          throw new Error("Attempt to auto-create Procedure.location");
1818        else if (Configuration.doAutoCreate())
1819          this.locationTarget = new Location(); // aa
1820      return this.locationTarget;
1821    }
1822
1823    /**
1824     * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1825     */
1826    public Procedure setLocationTarget(Location value) { 
1827      this.locationTarget = value;
1828      return this;
1829    }
1830
1831    /**
1832     * @return {@link #reasonCode} (The coded reason why the procedure was performed. This may be a coded entity of some type, or may simply be present as text.)
1833     */
1834    public List<CodeableConcept> getReasonCode() { 
1835      if (this.reasonCode == null)
1836        this.reasonCode = new ArrayList<CodeableConcept>();
1837      return this.reasonCode;
1838    }
1839
1840    /**
1841     * @return Returns a reference to <code>this</code> for easy method chaining
1842     */
1843    public Procedure setReasonCode(List<CodeableConcept> theReasonCode) { 
1844      this.reasonCode = theReasonCode;
1845      return this;
1846    }
1847
1848    public boolean hasReasonCode() { 
1849      if (this.reasonCode == null)
1850        return false;
1851      for (CodeableConcept item : this.reasonCode)
1852        if (!item.isEmpty())
1853          return true;
1854      return false;
1855    }
1856
1857    public CodeableConcept addReasonCode() { //3
1858      CodeableConcept t = new CodeableConcept();
1859      if (this.reasonCode == null)
1860        this.reasonCode = new ArrayList<CodeableConcept>();
1861      this.reasonCode.add(t);
1862      return t;
1863    }
1864
1865    public Procedure addReasonCode(CodeableConcept t) { //3
1866      if (t == null)
1867        return this;
1868      if (this.reasonCode == null)
1869        this.reasonCode = new ArrayList<CodeableConcept>();
1870      this.reasonCode.add(t);
1871      return this;
1872    }
1873
1874    /**
1875     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1876     */
1877    public CodeableConcept getReasonCodeFirstRep() { 
1878      if (getReasonCode().isEmpty()) {
1879        addReasonCode();
1880      }
1881      return getReasonCode().get(0);
1882    }
1883
1884    /**
1885     * @return {@link #reasonReference} (The justification of why the procedure was performed.)
1886     */
1887    public List<Reference> getReasonReference() { 
1888      if (this.reasonReference == null)
1889        this.reasonReference = new ArrayList<Reference>();
1890      return this.reasonReference;
1891    }
1892
1893    /**
1894     * @return Returns a reference to <code>this</code> for easy method chaining
1895     */
1896    public Procedure setReasonReference(List<Reference> theReasonReference) { 
1897      this.reasonReference = theReasonReference;
1898      return this;
1899    }
1900
1901    public boolean hasReasonReference() { 
1902      if (this.reasonReference == null)
1903        return false;
1904      for (Reference item : this.reasonReference)
1905        if (!item.isEmpty())
1906          return true;
1907      return false;
1908    }
1909
1910    public Reference addReasonReference() { //3
1911      Reference t = new Reference();
1912      if (this.reasonReference == null)
1913        this.reasonReference = new ArrayList<Reference>();
1914      this.reasonReference.add(t);
1915      return t;
1916    }
1917
1918    public Procedure addReasonReference(Reference t) { //3
1919      if (t == null)
1920        return this;
1921      if (this.reasonReference == null)
1922        this.reasonReference = new ArrayList<Reference>();
1923      this.reasonReference.add(t);
1924      return this;
1925    }
1926
1927    /**
1928     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1929     */
1930    public Reference getReasonReferenceFirstRep() { 
1931      if (getReasonReference().isEmpty()) {
1932        addReasonReference();
1933      }
1934      return getReasonReference().get(0);
1935    }
1936
1937    /**
1938     * @deprecated Use Reference#setResource(IBaseResource) instead
1939     */
1940    @Deprecated
1941    public List<Resource> getReasonReferenceTarget() { 
1942      if (this.reasonReferenceTarget == null)
1943        this.reasonReferenceTarget = new ArrayList<Resource>();
1944      return this.reasonReferenceTarget;
1945    }
1946
1947    /**
1948     * @return {@link #bodySite} (Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.)
1949     */
1950    public List<CodeableConcept> getBodySite() { 
1951      if (this.bodySite == null)
1952        this.bodySite = new ArrayList<CodeableConcept>();
1953      return this.bodySite;
1954    }
1955
1956    /**
1957     * @return Returns a reference to <code>this</code> for easy method chaining
1958     */
1959    public Procedure setBodySite(List<CodeableConcept> theBodySite) { 
1960      this.bodySite = theBodySite;
1961      return this;
1962    }
1963
1964    public boolean hasBodySite() { 
1965      if (this.bodySite == null)
1966        return false;
1967      for (CodeableConcept item : this.bodySite)
1968        if (!item.isEmpty())
1969          return true;
1970      return false;
1971    }
1972
1973    public CodeableConcept addBodySite() { //3
1974      CodeableConcept t = new CodeableConcept();
1975      if (this.bodySite == null)
1976        this.bodySite = new ArrayList<CodeableConcept>();
1977      this.bodySite.add(t);
1978      return t;
1979    }
1980
1981    public Procedure addBodySite(CodeableConcept t) { //3
1982      if (t == null)
1983        return this;
1984      if (this.bodySite == null)
1985        this.bodySite = new ArrayList<CodeableConcept>();
1986      this.bodySite.add(t);
1987      return this;
1988    }
1989
1990    /**
1991     * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist
1992     */
1993    public CodeableConcept getBodySiteFirstRep() { 
1994      if (getBodySite().isEmpty()) {
1995        addBodySite();
1996      }
1997      return getBodySite().get(0);
1998    }
1999
2000    /**
2001     * @return {@link #outcome} (The outcome of the procedure - did it resolve the reasons for the procedure being performed?)
2002     */
2003    public CodeableConcept getOutcome() { 
2004      if (this.outcome == null)
2005        if (Configuration.errorOnAutoCreate())
2006          throw new Error("Attempt to auto-create Procedure.outcome");
2007        else if (Configuration.doAutoCreate())
2008          this.outcome = new CodeableConcept(); // cc
2009      return this.outcome;
2010    }
2011
2012    public boolean hasOutcome() { 
2013      return this.outcome != null && !this.outcome.isEmpty();
2014    }
2015
2016    /**
2017     * @param value {@link #outcome} (The outcome of the procedure - did it resolve the reasons for the procedure being performed?)
2018     */
2019    public Procedure setOutcome(CodeableConcept value) { 
2020      this.outcome = value;
2021      return this;
2022    }
2023
2024    /**
2025     * @return {@link #report} (This could be a histology result, pathology report, surgical report, etc.)
2026     */
2027    public List<Reference> getReport() { 
2028      if (this.report == null)
2029        this.report = new ArrayList<Reference>();
2030      return this.report;
2031    }
2032
2033    /**
2034     * @return Returns a reference to <code>this</code> for easy method chaining
2035     */
2036    public Procedure setReport(List<Reference> theReport) { 
2037      this.report = theReport;
2038      return this;
2039    }
2040
2041    public boolean hasReport() { 
2042      if (this.report == null)
2043        return false;
2044      for (Reference item : this.report)
2045        if (!item.isEmpty())
2046          return true;
2047      return false;
2048    }
2049
2050    public Reference addReport() { //3
2051      Reference t = new Reference();
2052      if (this.report == null)
2053        this.report = new ArrayList<Reference>();
2054      this.report.add(t);
2055      return t;
2056    }
2057
2058    public Procedure addReport(Reference t) { //3
2059      if (t == null)
2060        return this;
2061      if (this.report == null)
2062        this.report = new ArrayList<Reference>();
2063      this.report.add(t);
2064      return this;
2065    }
2066
2067    /**
2068     * @return The first repetition of repeating field {@link #report}, creating it if it does not already exist
2069     */
2070    public Reference getReportFirstRep() { 
2071      if (getReport().isEmpty()) {
2072        addReport();
2073      }
2074      return getReport().get(0);
2075    }
2076
2077    /**
2078     * @deprecated Use Reference#setResource(IBaseResource) instead
2079     */
2080    @Deprecated
2081    public List<Resource> getReportTarget() { 
2082      if (this.reportTarget == null)
2083        this.reportTarget = new ArrayList<Resource>();
2084      return this.reportTarget;
2085    }
2086
2087    /**
2088     * @return {@link #complication} (Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.)
2089     */
2090    public List<CodeableConcept> getComplication() { 
2091      if (this.complication == null)
2092        this.complication = new ArrayList<CodeableConcept>();
2093      return this.complication;
2094    }
2095
2096    /**
2097     * @return Returns a reference to <code>this</code> for easy method chaining
2098     */
2099    public Procedure setComplication(List<CodeableConcept> theComplication) { 
2100      this.complication = theComplication;
2101      return this;
2102    }
2103
2104    public boolean hasComplication() { 
2105      if (this.complication == null)
2106        return false;
2107      for (CodeableConcept item : this.complication)
2108        if (!item.isEmpty())
2109          return true;
2110      return false;
2111    }
2112
2113    public CodeableConcept addComplication() { //3
2114      CodeableConcept t = new CodeableConcept();
2115      if (this.complication == null)
2116        this.complication = new ArrayList<CodeableConcept>();
2117      this.complication.add(t);
2118      return t;
2119    }
2120
2121    public Procedure addComplication(CodeableConcept t) { //3
2122      if (t == null)
2123        return this;
2124      if (this.complication == null)
2125        this.complication = new ArrayList<CodeableConcept>();
2126      this.complication.add(t);
2127      return this;
2128    }
2129
2130    /**
2131     * @return The first repetition of repeating field {@link #complication}, creating it if it does not already exist
2132     */
2133    public CodeableConcept getComplicationFirstRep() { 
2134      if (getComplication().isEmpty()) {
2135        addComplication();
2136      }
2137      return getComplication().get(0);
2138    }
2139
2140    /**
2141     * @return {@link #complicationDetail} (Any complications that occurred during the procedure, or in the immediate post-performance period.)
2142     */
2143    public List<Reference> getComplicationDetail() { 
2144      if (this.complicationDetail == null)
2145        this.complicationDetail = new ArrayList<Reference>();
2146      return this.complicationDetail;
2147    }
2148
2149    /**
2150     * @return Returns a reference to <code>this</code> for easy method chaining
2151     */
2152    public Procedure setComplicationDetail(List<Reference> theComplicationDetail) { 
2153      this.complicationDetail = theComplicationDetail;
2154      return this;
2155    }
2156
2157    public boolean hasComplicationDetail() { 
2158      if (this.complicationDetail == null)
2159        return false;
2160      for (Reference item : this.complicationDetail)
2161        if (!item.isEmpty())
2162          return true;
2163      return false;
2164    }
2165
2166    public Reference addComplicationDetail() { //3
2167      Reference t = new Reference();
2168      if (this.complicationDetail == null)
2169        this.complicationDetail = new ArrayList<Reference>();
2170      this.complicationDetail.add(t);
2171      return t;
2172    }
2173
2174    public Procedure addComplicationDetail(Reference t) { //3
2175      if (t == null)
2176        return this;
2177      if (this.complicationDetail == null)
2178        this.complicationDetail = new ArrayList<Reference>();
2179      this.complicationDetail.add(t);
2180      return this;
2181    }
2182
2183    /**
2184     * @return The first repetition of repeating field {@link #complicationDetail}, creating it if it does not already exist
2185     */
2186    public Reference getComplicationDetailFirstRep() { 
2187      if (getComplicationDetail().isEmpty()) {
2188        addComplicationDetail();
2189      }
2190      return getComplicationDetail().get(0);
2191    }
2192
2193    /**
2194     * @deprecated Use Reference#setResource(IBaseResource) instead
2195     */
2196    @Deprecated
2197    public List<Condition> getComplicationDetailTarget() { 
2198      if (this.complicationDetailTarget == null)
2199        this.complicationDetailTarget = new ArrayList<Condition>();
2200      return this.complicationDetailTarget;
2201    }
2202
2203    /**
2204     * @deprecated Use Reference#setResource(IBaseResource) instead
2205     */
2206    @Deprecated
2207    public Condition addComplicationDetailTarget() { 
2208      Condition r = new Condition();
2209      if (this.complicationDetailTarget == null)
2210        this.complicationDetailTarget = new ArrayList<Condition>();
2211      this.complicationDetailTarget.add(r);
2212      return r;
2213    }
2214
2215    /**
2216     * @return {@link #followUp} (If the procedure required specific follow up - e.g. removal of sutures. The follow up may be represented as a simple note or could potentially be more complex, in which case the CarePlan resource can be used.)
2217     */
2218    public List<CodeableConcept> getFollowUp() { 
2219      if (this.followUp == null)
2220        this.followUp = new ArrayList<CodeableConcept>();
2221      return this.followUp;
2222    }
2223
2224    /**
2225     * @return Returns a reference to <code>this</code> for easy method chaining
2226     */
2227    public Procedure setFollowUp(List<CodeableConcept> theFollowUp) { 
2228      this.followUp = theFollowUp;
2229      return this;
2230    }
2231
2232    public boolean hasFollowUp() { 
2233      if (this.followUp == null)
2234        return false;
2235      for (CodeableConcept item : this.followUp)
2236        if (!item.isEmpty())
2237          return true;
2238      return false;
2239    }
2240
2241    public CodeableConcept addFollowUp() { //3
2242      CodeableConcept t = new CodeableConcept();
2243      if (this.followUp == null)
2244        this.followUp = new ArrayList<CodeableConcept>();
2245      this.followUp.add(t);
2246      return t;
2247    }
2248
2249    public Procedure addFollowUp(CodeableConcept t) { //3
2250      if (t == null)
2251        return this;
2252      if (this.followUp == null)
2253        this.followUp = new ArrayList<CodeableConcept>();
2254      this.followUp.add(t);
2255      return this;
2256    }
2257
2258    /**
2259     * @return The first repetition of repeating field {@link #followUp}, creating it if it does not already exist
2260     */
2261    public CodeableConcept getFollowUpFirstRep() { 
2262      if (getFollowUp().isEmpty()) {
2263        addFollowUp();
2264      }
2265      return getFollowUp().get(0);
2266    }
2267
2268    /**
2269     * @return {@link #note} (Any other notes and comments about the procedure.)
2270     */
2271    public List<Annotation> getNote() { 
2272      if (this.note == null)
2273        this.note = new ArrayList<Annotation>();
2274      return this.note;
2275    }
2276
2277    /**
2278     * @return Returns a reference to <code>this</code> for easy method chaining
2279     */
2280    public Procedure setNote(List<Annotation> theNote) { 
2281      this.note = theNote;
2282      return this;
2283    }
2284
2285    public boolean hasNote() { 
2286      if (this.note == null)
2287        return false;
2288      for (Annotation item : this.note)
2289        if (!item.isEmpty())
2290          return true;
2291      return false;
2292    }
2293
2294    public Annotation addNote() { //3
2295      Annotation t = new Annotation();
2296      if (this.note == null)
2297        this.note = new ArrayList<Annotation>();
2298      this.note.add(t);
2299      return t;
2300    }
2301
2302    public Procedure addNote(Annotation t) { //3
2303      if (t == null)
2304        return this;
2305      if (this.note == null)
2306        this.note = new ArrayList<Annotation>();
2307      this.note.add(t);
2308      return this;
2309    }
2310
2311    /**
2312     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2313     */
2314    public Annotation getNoteFirstRep() { 
2315      if (getNote().isEmpty()) {
2316        addNote();
2317      }
2318      return getNote().get(0);
2319    }
2320
2321    /**
2322     * @return {@link #focalDevice} (A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.)
2323     */
2324    public List<ProcedureFocalDeviceComponent> getFocalDevice() { 
2325      if (this.focalDevice == null)
2326        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2327      return this.focalDevice;
2328    }
2329
2330    /**
2331     * @return Returns a reference to <code>this</code> for easy method chaining
2332     */
2333    public Procedure setFocalDevice(List<ProcedureFocalDeviceComponent> theFocalDevice) { 
2334      this.focalDevice = theFocalDevice;
2335      return this;
2336    }
2337
2338    public boolean hasFocalDevice() { 
2339      if (this.focalDevice == null)
2340        return false;
2341      for (ProcedureFocalDeviceComponent item : this.focalDevice)
2342        if (!item.isEmpty())
2343          return true;
2344      return false;
2345    }
2346
2347    public ProcedureFocalDeviceComponent addFocalDevice() { //3
2348      ProcedureFocalDeviceComponent t = new ProcedureFocalDeviceComponent();
2349      if (this.focalDevice == null)
2350        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2351      this.focalDevice.add(t);
2352      return t;
2353    }
2354
2355    public Procedure addFocalDevice(ProcedureFocalDeviceComponent t) { //3
2356      if (t == null)
2357        return this;
2358      if (this.focalDevice == null)
2359        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2360      this.focalDevice.add(t);
2361      return this;
2362    }
2363
2364    /**
2365     * @return The first repetition of repeating field {@link #focalDevice}, creating it if it does not already exist
2366     */
2367    public ProcedureFocalDeviceComponent getFocalDeviceFirstRep() { 
2368      if (getFocalDevice().isEmpty()) {
2369        addFocalDevice();
2370      }
2371      return getFocalDevice().get(0);
2372    }
2373
2374    /**
2375     * @return {@link #usedReference} (Identifies medications, devices and any other substance used as part of the procedure.)
2376     */
2377    public List<Reference> getUsedReference() { 
2378      if (this.usedReference == null)
2379        this.usedReference = new ArrayList<Reference>();
2380      return this.usedReference;
2381    }
2382
2383    /**
2384     * @return Returns a reference to <code>this</code> for easy method chaining
2385     */
2386    public Procedure setUsedReference(List<Reference> theUsedReference) { 
2387      this.usedReference = theUsedReference;
2388      return this;
2389    }
2390
2391    public boolean hasUsedReference() { 
2392      if (this.usedReference == null)
2393        return false;
2394      for (Reference item : this.usedReference)
2395        if (!item.isEmpty())
2396          return true;
2397      return false;
2398    }
2399
2400    public Reference addUsedReference() { //3
2401      Reference t = new Reference();
2402      if (this.usedReference == null)
2403        this.usedReference = new ArrayList<Reference>();
2404      this.usedReference.add(t);
2405      return t;
2406    }
2407
2408    public Procedure addUsedReference(Reference t) { //3
2409      if (t == null)
2410        return this;
2411      if (this.usedReference == null)
2412        this.usedReference = new ArrayList<Reference>();
2413      this.usedReference.add(t);
2414      return this;
2415    }
2416
2417    /**
2418     * @return The first repetition of repeating field {@link #usedReference}, creating it if it does not already exist
2419     */
2420    public Reference getUsedReferenceFirstRep() { 
2421      if (getUsedReference().isEmpty()) {
2422        addUsedReference();
2423      }
2424      return getUsedReference().get(0);
2425    }
2426
2427    /**
2428     * @deprecated Use Reference#setResource(IBaseResource) instead
2429     */
2430    @Deprecated
2431    public List<Resource> getUsedReferenceTarget() { 
2432      if (this.usedReferenceTarget == null)
2433        this.usedReferenceTarget = new ArrayList<Resource>();
2434      return this.usedReferenceTarget;
2435    }
2436
2437    /**
2438     * @return {@link #usedCode} (Identifies coded items that were used as part of the procedure.)
2439     */
2440    public List<CodeableConcept> getUsedCode() { 
2441      if (this.usedCode == null)
2442        this.usedCode = new ArrayList<CodeableConcept>();
2443      return this.usedCode;
2444    }
2445
2446    /**
2447     * @return Returns a reference to <code>this</code> for easy method chaining
2448     */
2449    public Procedure setUsedCode(List<CodeableConcept> theUsedCode) { 
2450      this.usedCode = theUsedCode;
2451      return this;
2452    }
2453
2454    public boolean hasUsedCode() { 
2455      if (this.usedCode == null)
2456        return false;
2457      for (CodeableConcept item : this.usedCode)
2458        if (!item.isEmpty())
2459          return true;
2460      return false;
2461    }
2462
2463    public CodeableConcept addUsedCode() { //3
2464      CodeableConcept t = new CodeableConcept();
2465      if (this.usedCode == null)
2466        this.usedCode = new ArrayList<CodeableConcept>();
2467      this.usedCode.add(t);
2468      return t;
2469    }
2470
2471    public Procedure addUsedCode(CodeableConcept t) { //3
2472      if (t == null)
2473        return this;
2474      if (this.usedCode == null)
2475        this.usedCode = new ArrayList<CodeableConcept>();
2476      this.usedCode.add(t);
2477      return this;
2478    }
2479
2480    /**
2481     * @return The first repetition of repeating field {@link #usedCode}, creating it if it does not already exist
2482     */
2483    public CodeableConcept getUsedCodeFirstRep() { 
2484      if (getUsedCode().isEmpty()) {
2485        addUsedCode();
2486      }
2487      return getUsedCode().get(0);
2488    }
2489
2490      protected void listChildren(List<Property> children) {
2491        super.listChildren(children);
2492        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
2493        children.add(new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition|Measure|OperationDefinition|Questionnaire)", "The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2494        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2495        children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest)", "A reference to a resource that contains details of the request for this procedure.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2496        children.add(new Property("partOf", "Reference(Procedure|Observation|MedicationAdministration)", "A larger event of which this particular procedure is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf));
2497        children.add(new Property("status", "code", "A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.", 0, 1, status));
2498        children.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the procedure.", 0, 1, statusReason));
2499        children.add(new Property("category", "CodeableConcept", "A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\").", 0, 1, category));
2500        children.add(new Property("code", "CodeableConcept", "The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\").", 0, 1, code));
2501        children.add(new Property("subject", "Reference(Patient|Group)", "The person, animal or group on which the procedure was performed.", 0, 1, subject));
2502        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.", 0, 1, encounter));
2503        children.add(new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed));
2504        children.add(new Property("recorder", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder));
2505        children.add(new Property("asserter", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who is making the procedure statement.", 0, 1, asserter));
2506        children.add(new Property("performer", "", "Limited to \"real\" people rather than equipment.", 0, java.lang.Integer.MAX_VALUE, performer));
2507        children.add(new Property("location", "Reference(Location)", "The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.", 0, 1, location));
2508        children.add(new Property("reasonCode", "CodeableConcept", "The coded reason why the procedure was performed. This may be a coded entity of some type, or may simply be present as text.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2509        children.add(new Property("reasonReference", "Reference(Condition|Observation|Procedure|DiagnosticReport|DocumentReference)", "The justification of why the procedure was performed.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2510        children.add(new Property("bodySite", "CodeableConcept", "Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.", 0, java.lang.Integer.MAX_VALUE, bodySite));
2511        children.add(new Property("outcome", "CodeableConcept", "The outcome of the procedure - did it resolve the reasons for the procedure being performed?", 0, 1, outcome));
2512        children.add(new Property("report", "Reference(DiagnosticReport|DocumentReference|Composition)", "This could be a histology result, pathology report, surgical report, etc.", 0, java.lang.Integer.MAX_VALUE, report));
2513        children.add(new Property("complication", "CodeableConcept", "Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.", 0, java.lang.Integer.MAX_VALUE, complication));
2514        children.add(new Property("complicationDetail", "Reference(Condition)", "Any complications that occurred during the procedure, or in the immediate post-performance period.", 0, java.lang.Integer.MAX_VALUE, complicationDetail));
2515        children.add(new Property("followUp", "CodeableConcept", "If the procedure required specific follow up - e.g. removal of sutures. The follow up may be represented as a simple note or could potentially be more complex, in which case the CarePlan resource can be used.", 0, java.lang.Integer.MAX_VALUE, followUp));
2516        children.add(new Property("note", "Annotation", "Any other notes and comments about the procedure.", 0, java.lang.Integer.MAX_VALUE, note));
2517        children.add(new Property("focalDevice", "", "A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.", 0, java.lang.Integer.MAX_VALUE, focalDevice));
2518        children.add(new Property("usedReference", "Reference(Device|Medication|Substance)", "Identifies medications, devices and any other substance used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedReference));
2519        children.add(new Property("usedCode", "CodeableConcept", "Identifies coded items that were used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedCode));
2520      }
2521
2522      @Override
2523      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2524        switch (_hash) {
2525        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
2526        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition|Measure|OperationDefinition|Questionnaire)", "The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2527        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2528        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|ServiceRequest)", "A reference to a resource that contains details of the request for this procedure.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2529        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Procedure|Observation|MedicationAdministration)", "A larger event of which this particular procedure is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf);
2530        case -892481550: /*status*/  return new Property("status", "code", "A code specifying the state of the procedure. Generally, this will be the in-progress or completed state.", 0, 1, status);
2531        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the procedure.", 0, 1, statusReason);
2532        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\").", 0, 1, category);
2533        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\").", 0, 1, code);
2534        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The person, animal or group on which the procedure was performed.", 0, 1, subject);
2535        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.", 0, 1, encounter);
2536        case 1355984064: /*performed[x]*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2537        case 481140672: /*performed*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2538        case 1118270331: /*performedDateTime*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2539        case 1622094241: /*performedPeriod*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2540        case 1721834481: /*performedString*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2541        case 1355958559: /*performedAge*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2542        case 1716617565: /*performedRange*/  return new Property("performed[x]", "dateTime|Period|string|Age|Range", "Estimated or actual date, date-time, period, or age when the procedure was performed.  Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2543        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder);
2544        case -373242253: /*asserter*/  return new Property("asserter", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who is making the procedure statement.", 0, 1, asserter);
2545        case 481140686: /*performer*/  return new Property("performer", "", "Limited to \"real\" people rather than equipment.", 0, java.lang.Integer.MAX_VALUE, performer);
2546        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.", 0, 1, location);
2547        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "The coded reason why the procedure was performed. This may be a coded entity of some type, or may simply be present as text.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2548        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|Procedure|DiagnosticReport|DocumentReference)", "The justification of why the procedure was performed.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2549        case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.", 0, java.lang.Integer.MAX_VALUE, bodySite);
2550        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "The outcome of the procedure - did it resolve the reasons for the procedure being performed?", 0, 1, outcome);
2551        case -934521548: /*report*/  return new Property("report", "Reference(DiagnosticReport|DocumentReference|Composition)", "This could be a histology result, pathology report, surgical report, etc.", 0, java.lang.Integer.MAX_VALUE, report);
2552        case -1644401602: /*complication*/  return new Property("complication", "CodeableConcept", "Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.", 0, java.lang.Integer.MAX_VALUE, complication);
2553        case -1685272017: /*complicationDetail*/  return new Property("complicationDetail", "Reference(Condition)", "Any complications that occurred during the procedure, or in the immediate post-performance period.", 0, java.lang.Integer.MAX_VALUE, complicationDetail);
2554        case 301801004: /*followUp*/  return new Property("followUp", "CodeableConcept", "If the procedure required specific follow up - e.g. removal of sutures. The follow up may be represented as a simple note or could potentially be more complex, in which case the CarePlan resource can be used.", 0, java.lang.Integer.MAX_VALUE, followUp);
2555        case 3387378: /*note*/  return new Property("note", "Annotation", "Any other notes and comments about the procedure.", 0, java.lang.Integer.MAX_VALUE, note);
2556        case -1129235173: /*focalDevice*/  return new Property("focalDevice", "", "A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.", 0, java.lang.Integer.MAX_VALUE, focalDevice);
2557        case -504932338: /*usedReference*/  return new Property("usedReference", "Reference(Device|Medication|Substance)", "Identifies medications, devices and any other substance used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedReference);
2558        case -279910582: /*usedCode*/  return new Property("usedCode", "CodeableConcept", "Identifies coded items that were used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedCode);
2559        default: return super.getNamedProperty(_hash, _name, _checkValid);
2560        }
2561
2562      }
2563
2564      @Override
2565      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2566        switch (hash) {
2567        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2568        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2569        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2570        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2571        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2572        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ProcedureStatus>
2573        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
2574        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2575        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2576        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2577        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2578        case 481140672: /*performed*/ return this.performed == null ? new Base[0] : new Base[] {this.performed}; // Type
2579        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
2580        case -373242253: /*asserter*/ return this.asserter == null ? new Base[0] : new Base[] {this.asserter}; // Reference
2581        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // ProcedurePerformerComponent
2582        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2583        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2584        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2585        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // CodeableConcept
2586        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
2587        case -934521548: /*report*/ return this.report == null ? new Base[0] : this.report.toArray(new Base[this.report.size()]); // Reference
2588        case -1644401602: /*complication*/ return this.complication == null ? new Base[0] : this.complication.toArray(new Base[this.complication.size()]); // CodeableConcept
2589        case -1685272017: /*complicationDetail*/ return this.complicationDetail == null ? new Base[0] : this.complicationDetail.toArray(new Base[this.complicationDetail.size()]); // Reference
2590        case 301801004: /*followUp*/ return this.followUp == null ? new Base[0] : this.followUp.toArray(new Base[this.followUp.size()]); // CodeableConcept
2591        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2592        case -1129235173: /*focalDevice*/ return this.focalDevice == null ? new Base[0] : this.focalDevice.toArray(new Base[this.focalDevice.size()]); // ProcedureFocalDeviceComponent
2593        case -504932338: /*usedReference*/ return this.usedReference == null ? new Base[0] : this.usedReference.toArray(new Base[this.usedReference.size()]); // Reference
2594        case -279910582: /*usedCode*/ return this.usedCode == null ? new Base[0] : this.usedCode.toArray(new Base[this.usedCode.size()]); // CodeableConcept
2595        default: return super.getProperty(hash, name, checkValid);
2596        }
2597
2598      }
2599
2600      @Override
2601      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2602        switch (hash) {
2603        case -1618432855: // identifier
2604          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2605          return value;
2606        case 8911915: // instantiatesCanonical
2607          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2608          return value;
2609        case -1926393373: // instantiatesUri
2610          this.getInstantiatesUri().add(castToUri(value)); // UriType
2611          return value;
2612        case -332612366: // basedOn
2613          this.getBasedOn().add(castToReference(value)); // Reference
2614          return value;
2615        case -995410646: // partOf
2616          this.getPartOf().add(castToReference(value)); // Reference
2617          return value;
2618        case -892481550: // status
2619          value = new ProcedureStatusEnumFactory().fromType(castToCode(value));
2620          this.status = (Enumeration) value; // Enumeration<ProcedureStatus>
2621          return value;
2622        case 2051346646: // statusReason
2623          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2624          return value;
2625        case 50511102: // category
2626          this.category = castToCodeableConcept(value); // CodeableConcept
2627          return value;
2628        case 3059181: // code
2629          this.code = castToCodeableConcept(value); // CodeableConcept
2630          return value;
2631        case -1867885268: // subject
2632          this.subject = castToReference(value); // Reference
2633          return value;
2634        case 1524132147: // encounter
2635          this.encounter = castToReference(value); // Reference
2636          return value;
2637        case 481140672: // performed
2638          this.performed = castToType(value); // Type
2639          return value;
2640        case -799233858: // recorder
2641          this.recorder = castToReference(value); // Reference
2642          return value;
2643        case -373242253: // asserter
2644          this.asserter = castToReference(value); // Reference
2645          return value;
2646        case 481140686: // performer
2647          this.getPerformer().add((ProcedurePerformerComponent) value); // ProcedurePerformerComponent
2648          return value;
2649        case 1901043637: // location
2650          this.location = castToReference(value); // Reference
2651          return value;
2652        case 722137681: // reasonCode
2653          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2654          return value;
2655        case -1146218137: // reasonReference
2656          this.getReasonReference().add(castToReference(value)); // Reference
2657          return value;
2658        case 1702620169: // bodySite
2659          this.getBodySite().add(castToCodeableConcept(value)); // CodeableConcept
2660          return value;
2661        case -1106507950: // outcome
2662          this.outcome = castToCodeableConcept(value); // CodeableConcept
2663          return value;
2664        case -934521548: // report
2665          this.getReport().add(castToReference(value)); // Reference
2666          return value;
2667        case -1644401602: // complication
2668          this.getComplication().add(castToCodeableConcept(value)); // CodeableConcept
2669          return value;
2670        case -1685272017: // complicationDetail
2671          this.getComplicationDetail().add(castToReference(value)); // Reference
2672          return value;
2673        case 301801004: // followUp
2674          this.getFollowUp().add(castToCodeableConcept(value)); // CodeableConcept
2675          return value;
2676        case 3387378: // note
2677          this.getNote().add(castToAnnotation(value)); // Annotation
2678          return value;
2679        case -1129235173: // focalDevice
2680          this.getFocalDevice().add((ProcedureFocalDeviceComponent) value); // ProcedureFocalDeviceComponent
2681          return value;
2682        case -504932338: // usedReference
2683          this.getUsedReference().add(castToReference(value)); // Reference
2684          return value;
2685        case -279910582: // usedCode
2686          this.getUsedCode().add(castToCodeableConcept(value)); // CodeableConcept
2687          return value;
2688        default: return super.setProperty(hash, name, value);
2689        }
2690
2691      }
2692
2693      @Override
2694      public Base setProperty(String name, Base value) throws FHIRException {
2695        if (name.equals("identifier")) {
2696          this.getIdentifier().add(castToIdentifier(value));
2697        } else if (name.equals("instantiatesCanonical")) {
2698          this.getInstantiatesCanonical().add(castToCanonical(value));
2699        } else if (name.equals("instantiatesUri")) {
2700          this.getInstantiatesUri().add(castToUri(value));
2701        } else if (name.equals("basedOn")) {
2702          this.getBasedOn().add(castToReference(value));
2703        } else if (name.equals("partOf")) {
2704          this.getPartOf().add(castToReference(value));
2705        } else if (name.equals("status")) {
2706          value = new ProcedureStatusEnumFactory().fromType(castToCode(value));
2707          this.status = (Enumeration) value; // Enumeration<ProcedureStatus>
2708        } else if (name.equals("statusReason")) {
2709          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2710        } else if (name.equals("category")) {
2711          this.category = castToCodeableConcept(value); // CodeableConcept
2712        } else if (name.equals("code")) {
2713          this.code = castToCodeableConcept(value); // CodeableConcept
2714        } else if (name.equals("subject")) {
2715          this.subject = castToReference(value); // Reference
2716        } else if (name.equals("encounter")) {
2717          this.encounter = castToReference(value); // Reference
2718        } else if (name.equals("performed[x]")) {
2719          this.performed = castToType(value); // Type
2720        } else if (name.equals("recorder")) {
2721          this.recorder = castToReference(value); // Reference
2722        } else if (name.equals("asserter")) {
2723          this.asserter = castToReference(value); // Reference
2724        } else if (name.equals("performer")) {
2725          this.getPerformer().add((ProcedurePerformerComponent) value);
2726        } else if (name.equals("location")) {
2727          this.location = castToReference(value); // Reference
2728        } else if (name.equals("reasonCode")) {
2729          this.getReasonCode().add(castToCodeableConcept(value));
2730        } else if (name.equals("reasonReference")) {
2731          this.getReasonReference().add(castToReference(value));
2732        } else if (name.equals("bodySite")) {
2733          this.getBodySite().add(castToCodeableConcept(value));
2734        } else if (name.equals("outcome")) {
2735          this.outcome = castToCodeableConcept(value); // CodeableConcept
2736        } else if (name.equals("report")) {
2737          this.getReport().add(castToReference(value));
2738        } else if (name.equals("complication")) {
2739          this.getComplication().add(castToCodeableConcept(value));
2740        } else if (name.equals("complicationDetail")) {
2741          this.getComplicationDetail().add(castToReference(value));
2742        } else if (name.equals("followUp")) {
2743          this.getFollowUp().add(castToCodeableConcept(value));
2744        } else if (name.equals("note")) {
2745          this.getNote().add(castToAnnotation(value));
2746        } else if (name.equals("focalDevice")) {
2747          this.getFocalDevice().add((ProcedureFocalDeviceComponent) value);
2748        } else if (name.equals("usedReference")) {
2749          this.getUsedReference().add(castToReference(value));
2750        } else if (name.equals("usedCode")) {
2751          this.getUsedCode().add(castToCodeableConcept(value));
2752        } else
2753          return super.setProperty(name, value);
2754        return value;
2755      }
2756
2757      @Override
2758      public Base makeProperty(int hash, String name) throws FHIRException {
2759        switch (hash) {
2760        case -1618432855:  return addIdentifier(); 
2761        case 8911915:  return addInstantiatesCanonicalElement();
2762        case -1926393373:  return addInstantiatesUriElement();
2763        case -332612366:  return addBasedOn(); 
2764        case -995410646:  return addPartOf(); 
2765        case -892481550:  return getStatusElement();
2766        case 2051346646:  return getStatusReason(); 
2767        case 50511102:  return getCategory(); 
2768        case 3059181:  return getCode(); 
2769        case -1867885268:  return getSubject(); 
2770        case 1524132147:  return getEncounter(); 
2771        case 1355984064:  return getPerformed(); 
2772        case 481140672:  return getPerformed(); 
2773        case -799233858:  return getRecorder(); 
2774        case -373242253:  return getAsserter(); 
2775        case 481140686:  return addPerformer(); 
2776        case 1901043637:  return getLocation(); 
2777        case 722137681:  return addReasonCode(); 
2778        case -1146218137:  return addReasonReference(); 
2779        case 1702620169:  return addBodySite(); 
2780        case -1106507950:  return getOutcome(); 
2781        case -934521548:  return addReport(); 
2782        case -1644401602:  return addComplication(); 
2783        case -1685272017:  return addComplicationDetail(); 
2784        case 301801004:  return addFollowUp(); 
2785        case 3387378:  return addNote(); 
2786        case -1129235173:  return addFocalDevice(); 
2787        case -504932338:  return addUsedReference(); 
2788        case -279910582:  return addUsedCode(); 
2789        default: return super.makeProperty(hash, name);
2790        }
2791
2792      }
2793
2794      @Override
2795      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2796        switch (hash) {
2797        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2798        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
2799        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
2800        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2801        case -995410646: /*partOf*/ return new String[] {"Reference"};
2802        case -892481550: /*status*/ return new String[] {"code"};
2803        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2804        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2805        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2806        case -1867885268: /*subject*/ return new String[] {"Reference"};
2807        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2808        case 481140672: /*performed*/ return new String[] {"dateTime", "Period", "string", "Age", "Range"};
2809        case -799233858: /*recorder*/ return new String[] {"Reference"};
2810        case -373242253: /*asserter*/ return new String[] {"Reference"};
2811        case 481140686: /*performer*/ return new String[] {};
2812        case 1901043637: /*location*/ return new String[] {"Reference"};
2813        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2814        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2815        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
2816        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
2817        case -934521548: /*report*/ return new String[] {"Reference"};
2818        case -1644401602: /*complication*/ return new String[] {"CodeableConcept"};
2819        case -1685272017: /*complicationDetail*/ return new String[] {"Reference"};
2820        case 301801004: /*followUp*/ return new String[] {"CodeableConcept"};
2821        case 3387378: /*note*/ return new String[] {"Annotation"};
2822        case -1129235173: /*focalDevice*/ return new String[] {};
2823        case -504932338: /*usedReference*/ return new String[] {"Reference"};
2824        case -279910582: /*usedCode*/ return new String[] {"CodeableConcept"};
2825        default: return super.getTypesForProperty(hash, name);
2826        }
2827
2828      }
2829
2830      @Override
2831      public Base addChild(String name) throws FHIRException {
2832        if (name.equals("identifier")) {
2833          return addIdentifier();
2834        }
2835        else if (name.equals("instantiatesCanonical")) {
2836          throw new FHIRException("Cannot call addChild on a primitive type Procedure.instantiatesCanonical");
2837        }
2838        else if (name.equals("instantiatesUri")) {
2839          throw new FHIRException("Cannot call addChild on a primitive type Procedure.instantiatesUri");
2840        }
2841        else if (name.equals("basedOn")) {
2842          return addBasedOn();
2843        }
2844        else if (name.equals("partOf")) {
2845          return addPartOf();
2846        }
2847        else if (name.equals("status")) {
2848          throw new FHIRException("Cannot call addChild on a primitive type Procedure.status");
2849        }
2850        else if (name.equals("statusReason")) {
2851          this.statusReason = new CodeableConcept();
2852          return this.statusReason;
2853        }
2854        else if (name.equals("category")) {
2855          this.category = new CodeableConcept();
2856          return this.category;
2857        }
2858        else if (name.equals("code")) {
2859          this.code = new CodeableConcept();
2860          return this.code;
2861        }
2862        else if (name.equals("subject")) {
2863          this.subject = new Reference();
2864          return this.subject;
2865        }
2866        else if (name.equals("encounter")) {
2867          this.encounter = new Reference();
2868          return this.encounter;
2869        }
2870        else if (name.equals("performedDateTime")) {
2871          this.performed = new DateTimeType();
2872          return this.performed;
2873        }
2874        else if (name.equals("performedPeriod")) {
2875          this.performed = new Period();
2876          return this.performed;
2877        }
2878        else if (name.equals("performedString")) {
2879          this.performed = new StringType();
2880          return this.performed;
2881        }
2882        else if (name.equals("performedAge")) {
2883          this.performed = new Age();
2884          return this.performed;
2885        }
2886        else if (name.equals("performedRange")) {
2887          this.performed = new Range();
2888          return this.performed;
2889        }
2890        else if (name.equals("recorder")) {
2891          this.recorder = new Reference();
2892          return this.recorder;
2893        }
2894        else if (name.equals("asserter")) {
2895          this.asserter = new Reference();
2896          return this.asserter;
2897        }
2898        else if (name.equals("performer")) {
2899          return addPerformer();
2900        }
2901        else if (name.equals("location")) {
2902          this.location = new Reference();
2903          return this.location;
2904        }
2905        else if (name.equals("reasonCode")) {
2906          return addReasonCode();
2907        }
2908        else if (name.equals("reasonReference")) {
2909          return addReasonReference();
2910        }
2911        else if (name.equals("bodySite")) {
2912          return addBodySite();
2913        }
2914        else if (name.equals("outcome")) {
2915          this.outcome = new CodeableConcept();
2916          return this.outcome;
2917        }
2918        else if (name.equals("report")) {
2919          return addReport();
2920        }
2921        else if (name.equals("complication")) {
2922          return addComplication();
2923        }
2924        else if (name.equals("complicationDetail")) {
2925          return addComplicationDetail();
2926        }
2927        else if (name.equals("followUp")) {
2928          return addFollowUp();
2929        }
2930        else if (name.equals("note")) {
2931          return addNote();
2932        }
2933        else if (name.equals("focalDevice")) {
2934          return addFocalDevice();
2935        }
2936        else if (name.equals("usedReference")) {
2937          return addUsedReference();
2938        }
2939        else if (name.equals("usedCode")) {
2940          return addUsedCode();
2941        }
2942        else
2943          return super.addChild(name);
2944      }
2945
2946  public String fhirType() {
2947    return "Procedure";
2948
2949  }
2950
2951      public Procedure copy() {
2952        Procedure dst = new Procedure();
2953        copyValues(dst);
2954        return dst;
2955      }
2956
2957      public void copyValues(Procedure dst) {
2958        super.copyValues(dst);
2959        if (identifier != null) {
2960          dst.identifier = new ArrayList<Identifier>();
2961          for (Identifier i : identifier)
2962            dst.identifier.add(i.copy());
2963        };
2964        if (instantiatesCanonical != null) {
2965          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2966          for (CanonicalType i : instantiatesCanonical)
2967            dst.instantiatesCanonical.add(i.copy());
2968        };
2969        if (instantiatesUri != null) {
2970          dst.instantiatesUri = new ArrayList<UriType>();
2971          for (UriType i : instantiatesUri)
2972            dst.instantiatesUri.add(i.copy());
2973        };
2974        if (basedOn != null) {
2975          dst.basedOn = new ArrayList<Reference>();
2976          for (Reference i : basedOn)
2977            dst.basedOn.add(i.copy());
2978        };
2979        if (partOf != null) {
2980          dst.partOf = new ArrayList<Reference>();
2981          for (Reference i : partOf)
2982            dst.partOf.add(i.copy());
2983        };
2984        dst.status = status == null ? null : status.copy();
2985        dst.statusReason = statusReason == null ? null : statusReason.copy();
2986        dst.category = category == null ? null : category.copy();
2987        dst.code = code == null ? null : code.copy();
2988        dst.subject = subject == null ? null : subject.copy();
2989        dst.encounter = encounter == null ? null : encounter.copy();
2990        dst.performed = performed == null ? null : performed.copy();
2991        dst.recorder = recorder == null ? null : recorder.copy();
2992        dst.asserter = asserter == null ? null : asserter.copy();
2993        if (performer != null) {
2994          dst.performer = new ArrayList<ProcedurePerformerComponent>();
2995          for (ProcedurePerformerComponent i : performer)
2996            dst.performer.add(i.copy());
2997        };
2998        dst.location = location == null ? null : location.copy();
2999        if (reasonCode != null) {
3000          dst.reasonCode = new ArrayList<CodeableConcept>();
3001          for (CodeableConcept i : reasonCode)
3002            dst.reasonCode.add(i.copy());
3003        };
3004        if (reasonReference != null) {
3005          dst.reasonReference = new ArrayList<Reference>();
3006          for (Reference i : reasonReference)
3007            dst.reasonReference.add(i.copy());
3008        };
3009        if (bodySite != null) {
3010          dst.bodySite = new ArrayList<CodeableConcept>();
3011          for (CodeableConcept i : bodySite)
3012            dst.bodySite.add(i.copy());
3013        };
3014        dst.outcome = outcome == null ? null : outcome.copy();
3015        if (report != null) {
3016          dst.report = new ArrayList<Reference>();
3017          for (Reference i : report)
3018            dst.report.add(i.copy());
3019        };
3020        if (complication != null) {
3021          dst.complication = new ArrayList<CodeableConcept>();
3022          for (CodeableConcept i : complication)
3023            dst.complication.add(i.copy());
3024        };
3025        if (complicationDetail != null) {
3026          dst.complicationDetail = new ArrayList<Reference>();
3027          for (Reference i : complicationDetail)
3028            dst.complicationDetail.add(i.copy());
3029        };
3030        if (followUp != null) {
3031          dst.followUp = new ArrayList<CodeableConcept>();
3032          for (CodeableConcept i : followUp)
3033            dst.followUp.add(i.copy());
3034        };
3035        if (note != null) {
3036          dst.note = new ArrayList<Annotation>();
3037          for (Annotation i : note)
3038            dst.note.add(i.copy());
3039        };
3040        if (focalDevice != null) {
3041          dst.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
3042          for (ProcedureFocalDeviceComponent i : focalDevice)
3043            dst.focalDevice.add(i.copy());
3044        };
3045        if (usedReference != null) {
3046          dst.usedReference = new ArrayList<Reference>();
3047          for (Reference i : usedReference)
3048            dst.usedReference.add(i.copy());
3049        };
3050        if (usedCode != null) {
3051          dst.usedCode = new ArrayList<CodeableConcept>();
3052          for (CodeableConcept i : usedCode)
3053            dst.usedCode.add(i.copy());
3054        };
3055      }
3056
3057      protected Procedure typedCopy() {
3058        return copy();
3059      }
3060
3061      @Override
3062      public boolean equalsDeep(Base other_) {
3063        if (!super.equalsDeep(other_))
3064          return false;
3065        if (!(other_ instanceof Procedure))
3066          return false;
3067        Procedure o = (Procedure) other_;
3068        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
3069           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
3070           && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
3071           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
3072           && compareDeep(encounter, o.encounter, true) && compareDeep(performed, o.performed, true) && compareDeep(recorder, o.recorder, true)
3073           && compareDeep(asserter, o.asserter, true) && compareDeep(performer, o.performer, true) && compareDeep(location, o.location, true)
3074           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
3075           && compareDeep(bodySite, o.bodySite, true) && compareDeep(outcome, o.outcome, true) && compareDeep(report, o.report, true)
3076           && compareDeep(complication, o.complication, true) && compareDeep(complicationDetail, o.complicationDetail, true)
3077           && compareDeep(followUp, o.followUp, true) && compareDeep(note, o.note, true) && compareDeep(focalDevice, o.focalDevice, true)
3078           && compareDeep(usedReference, o.usedReference, true) && compareDeep(usedCode, o.usedCode, true)
3079          ;
3080      }
3081
3082      @Override
3083      public boolean equalsShallow(Base other_) {
3084        if (!super.equalsShallow(other_))
3085          return false;
3086        if (!(other_ instanceof Procedure))
3087          return false;
3088        Procedure o = (Procedure) other_;
3089        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
3090          ;
3091      }
3092
3093      public boolean isEmpty() {
3094        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
3095          , instantiatesUri, basedOn, partOf, status, statusReason, category, code, subject
3096          , encounter, performed, recorder, asserter, performer, location, reasonCode, reasonReference
3097          , bodySite, outcome, report, complication, complicationDetail, followUp, note
3098          , focalDevice, usedReference, usedCode);
3099      }
3100
3101  @Override
3102  public ResourceType getResourceType() {
3103    return ResourceType.Procedure;
3104   }
3105
3106 /**
3107   * Search parameter: <b>date</b>
3108   * <p>
3109   * Description: <b>When the procedure was performed</b><br>
3110   * Type: <b>date</b><br>
3111   * Path: <b>Procedure.performed[x]</b><br>
3112   * </p>
3113   */
3114  @SearchParamDefinition(name="date", path="Procedure.performed", description="When the procedure was performed", type="date" )
3115  public static final String SP_DATE = "date";
3116 /**
3117   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3118   * <p>
3119   * Description: <b>When the procedure was performed</b><br>
3120   * Type: <b>date</b><br>
3121   * Path: <b>Procedure.performed[x]</b><br>
3122   * </p>
3123   */
3124  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3125
3126 /**
3127   * Search parameter: <b>identifier</b>
3128   * <p>
3129   * Description: <b>A unique identifier for a procedure</b><br>
3130   * Type: <b>token</b><br>
3131   * Path: <b>Procedure.identifier</b><br>
3132   * </p>
3133   */
3134  @SearchParamDefinition(name="identifier", path="Procedure.identifier", description="A unique identifier for a procedure", type="token" )
3135  public static final String SP_IDENTIFIER = "identifier";
3136 /**
3137   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3138   * <p>
3139   * Description: <b>A unique identifier for a procedure</b><br>
3140   * Type: <b>token</b><br>
3141   * Path: <b>Procedure.identifier</b><br>
3142   * </p>
3143   */
3144  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3145
3146 /**
3147   * Search parameter: <b>code</b>
3148   * <p>
3149   * Description: <b>A code to identify a  procedure</b><br>
3150   * Type: <b>token</b><br>
3151   * Path: <b>Procedure.code</b><br>
3152   * </p>
3153   */
3154  @SearchParamDefinition(name="code", path="Procedure.code", description="A code to identify a  procedure", type="token" )
3155  public static final String SP_CODE = "code";
3156 /**
3157   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3158   * <p>
3159   * Description: <b>A code to identify a  procedure</b><br>
3160   * Type: <b>token</b><br>
3161   * Path: <b>Procedure.code</b><br>
3162   * </p>
3163   */
3164  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3165
3166 /**
3167   * Search parameter: <b>performer</b>
3168   * <p>
3169   * Description: <b>The reference to the practitioner</b><br>
3170   * Type: <b>reference</b><br>
3171   * Path: <b>Procedure.performer.actor</b><br>
3172   * </p>
3173   */
3174  @SearchParamDefinition(name="performer", path="Procedure.performer.actor", description="The reference to the practitioner", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3175  public static final String SP_PERFORMER = "performer";
3176 /**
3177   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3178   * <p>
3179   * Description: <b>The reference to the practitioner</b><br>
3180   * Type: <b>reference</b><br>
3181   * Path: <b>Procedure.performer.actor</b><br>
3182   * </p>
3183   */
3184  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
3185
3186/**
3187   * Constant for fluent queries to be used to add include statements. Specifies
3188   * the path value of "<b>Procedure:performer</b>".
3189   */
3190  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("Procedure:performer").toLocked();
3191
3192 /**
3193   * Search parameter: <b>subject</b>
3194   * <p>
3195   * Description: <b>Search by subject</b><br>
3196   * Type: <b>reference</b><br>
3197   * Path: <b>Procedure.subject</b><br>
3198   * </p>
3199   */
3200  @SearchParamDefinition(name="subject", path="Procedure.subject", description="Search by subject", type="reference", target={Group.class, Patient.class } )
3201  public static final String SP_SUBJECT = "subject";
3202 /**
3203   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3204   * <p>
3205   * Description: <b>Search by subject</b><br>
3206   * Type: <b>reference</b><br>
3207   * Path: <b>Procedure.subject</b><br>
3208   * </p>
3209   */
3210  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3211
3212/**
3213   * Constant for fluent queries to be used to add include statements. Specifies
3214   * the path value of "<b>Procedure:subject</b>".
3215   */
3216  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Procedure:subject").toLocked();
3217
3218 /**
3219   * Search parameter: <b>instantiates-canonical</b>
3220   * <p>
3221   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3222   * Type: <b>reference</b><br>
3223   * Path: <b>Procedure.instantiatesCanonical</b><br>
3224   * </p>
3225   */
3226  @SearchParamDefinition(name="instantiates-canonical", path="Procedure.instantiatesCanonical", description="Instantiates FHIR protocol or definition", type="reference", target={ActivityDefinition.class, Measure.class, OperationDefinition.class, PlanDefinition.class, Questionnaire.class } )
3227  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
3228 /**
3229   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
3230   * <p>
3231   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3232   * Type: <b>reference</b><br>
3233   * Path: <b>Procedure.instantiatesCanonical</b><br>
3234   * </p>
3235   */
3236  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
3237
3238/**
3239   * Constant for fluent queries to be used to add include statements. Specifies
3240   * the path value of "<b>Procedure:instantiates-canonical</b>".
3241   */
3242  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("Procedure:instantiates-canonical").toLocked();
3243
3244 /**
3245   * Search parameter: <b>part-of</b>
3246   * <p>
3247   * Description: <b>Part of referenced event</b><br>
3248   * Type: <b>reference</b><br>
3249   * Path: <b>Procedure.partOf</b><br>
3250   * </p>
3251   */
3252  @SearchParamDefinition(name="part-of", path="Procedure.partOf", description="Part of referenced event", type="reference", target={MedicationAdministration.class, Observation.class, Procedure.class } )
3253  public static final String SP_PART_OF = "part-of";
3254 /**
3255   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
3256   * <p>
3257   * Description: <b>Part of referenced event</b><br>
3258   * Type: <b>reference</b><br>
3259   * Path: <b>Procedure.partOf</b><br>
3260   * </p>
3261   */
3262  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
3263
3264/**
3265   * Constant for fluent queries to be used to add include statements. Specifies
3266   * the path value of "<b>Procedure:part-of</b>".
3267   */
3268  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Procedure:part-of").toLocked();
3269
3270 /**
3271   * Search parameter: <b>encounter</b>
3272   * <p>
3273   * Description: <b>Encounter created as part of</b><br>
3274   * Type: <b>reference</b><br>
3275   * Path: <b>Procedure.encounter</b><br>
3276   * </p>
3277   */
3278  @SearchParamDefinition(name="encounter", path="Procedure.encounter", description="Encounter created as part of", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
3279  public static final String SP_ENCOUNTER = "encounter";
3280 /**
3281   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3282   * <p>
3283   * Description: <b>Encounter created as part of</b><br>
3284   * Type: <b>reference</b><br>
3285   * Path: <b>Procedure.encounter</b><br>
3286   * </p>
3287   */
3288  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3289
3290/**
3291   * Constant for fluent queries to be used to add include statements. Specifies
3292   * the path value of "<b>Procedure:encounter</b>".
3293   */
3294  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Procedure:encounter").toLocked();
3295
3296 /**
3297   * Search parameter: <b>reason-code</b>
3298   * <p>
3299   * Description: <b>Coded reason procedure performed</b><br>
3300   * Type: <b>token</b><br>
3301   * Path: <b>Procedure.reasonCode</b><br>
3302   * </p>
3303   */
3304  @SearchParamDefinition(name="reason-code", path="Procedure.reasonCode", description="Coded reason procedure performed", type="token" )
3305  public static final String SP_REASON_CODE = "reason-code";
3306 /**
3307   * <b>Fluent Client</b> search parameter constant for <b>reason-code</b>
3308   * <p>
3309   * Description: <b>Coded reason procedure performed</b><br>
3310   * Type: <b>token</b><br>
3311   * Path: <b>Procedure.reasonCode</b><br>
3312   * </p>
3313   */
3314  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_CODE);
3315
3316 /**
3317   * Search parameter: <b>based-on</b>
3318   * <p>
3319   * Description: <b>A request for this procedure</b><br>
3320   * Type: <b>reference</b><br>
3321   * Path: <b>Procedure.basedOn</b><br>
3322   * </p>
3323   */
3324  @SearchParamDefinition(name="based-on", path="Procedure.basedOn", description="A request for this procedure", type="reference", target={CarePlan.class, ServiceRequest.class } )
3325  public static final String SP_BASED_ON = "based-on";
3326 /**
3327   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
3328   * <p>
3329   * Description: <b>A request for this procedure</b><br>
3330   * Type: <b>reference</b><br>
3331   * Path: <b>Procedure.basedOn</b><br>
3332   * </p>
3333   */
3334  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
3335
3336/**
3337   * Constant for fluent queries to be used to add include statements. Specifies
3338   * the path value of "<b>Procedure:based-on</b>".
3339   */
3340  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Procedure:based-on").toLocked();
3341
3342 /**
3343   * Search parameter: <b>patient</b>
3344   * <p>
3345   * Description: <b>Search by subject - a patient</b><br>
3346   * Type: <b>reference</b><br>
3347   * Path: <b>Procedure.subject</b><br>
3348   * </p>
3349   */
3350  @SearchParamDefinition(name="patient", path="Procedure.subject.where(resolve() is Patient)", description="Search by subject - a patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
3351  public static final String SP_PATIENT = "patient";
3352 /**
3353   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3354   * <p>
3355   * Description: <b>Search by subject - a patient</b><br>
3356   * Type: <b>reference</b><br>
3357   * Path: <b>Procedure.subject</b><br>
3358   * </p>
3359   */
3360  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3361
3362/**
3363   * Constant for fluent queries to be used to add include statements. Specifies
3364   * the path value of "<b>Procedure:patient</b>".
3365   */
3366  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Procedure:patient").toLocked();
3367
3368 /**
3369   * Search parameter: <b>reason-reference</b>
3370   * <p>
3371   * Description: <b>The justification that the procedure was performed</b><br>
3372   * Type: <b>reference</b><br>
3373   * Path: <b>Procedure.reasonReference</b><br>
3374   * </p>
3375   */
3376  @SearchParamDefinition(name="reason-reference", path="Procedure.reasonReference", description="The justification that the procedure was performed", type="reference", target={Condition.class, DiagnosticReport.class, DocumentReference.class, Observation.class, Procedure.class } )
3377  public static final String SP_REASON_REFERENCE = "reason-reference";
3378 /**
3379   * <b>Fluent Client</b> search parameter constant for <b>reason-reference</b>
3380   * <p>
3381   * Description: <b>The justification that the procedure was performed</b><br>
3382   * Type: <b>reference</b><br>
3383   * Path: <b>Procedure.reasonReference</b><br>
3384   * </p>
3385   */
3386  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REASON_REFERENCE);
3387
3388/**
3389   * Constant for fluent queries to be used to add include statements. Specifies
3390   * the path value of "<b>Procedure:reason-reference</b>".
3391   */
3392  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_REFERENCE = new ca.uhn.fhir.model.api.Include("Procedure:reason-reference").toLocked();
3393
3394 /**
3395   * Search parameter: <b>location</b>
3396   * <p>
3397   * Description: <b>Where the procedure happened</b><br>
3398   * Type: <b>reference</b><br>
3399   * Path: <b>Procedure.location</b><br>
3400   * </p>
3401   */
3402  @SearchParamDefinition(name="location", path="Procedure.location", description="Where the procedure happened", type="reference", target={Location.class } )
3403  public static final String SP_LOCATION = "location";
3404 /**
3405   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3406   * <p>
3407   * Description: <b>Where the procedure happened</b><br>
3408   * Type: <b>reference</b><br>
3409   * Path: <b>Procedure.location</b><br>
3410   * </p>
3411   */
3412  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3413
3414/**
3415   * Constant for fluent queries to be used to add include statements. Specifies
3416   * the path value of "<b>Procedure:location</b>".
3417   */
3418  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Procedure:location").toLocked();
3419
3420 /**
3421   * Search parameter: <b>instantiates-uri</b>
3422   * <p>
3423   * Description: <b>Instantiates external protocol or definition</b><br>
3424   * Type: <b>uri</b><br>
3425   * Path: <b>Procedure.instantiatesUri</b><br>
3426   * </p>
3427   */
3428  @SearchParamDefinition(name="instantiates-uri", path="Procedure.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
3429  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
3430 /**
3431   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
3432   * <p>
3433   * Description: <b>Instantiates external protocol or definition</b><br>
3434   * Type: <b>uri</b><br>
3435   * Path: <b>Procedure.instantiatesUri</b><br>
3436   * </p>
3437   */
3438  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
3439
3440 /**
3441   * Search parameter: <b>category</b>
3442   * <p>
3443   * Description: <b>Classification of the procedure</b><br>
3444   * Type: <b>token</b><br>
3445   * Path: <b>Procedure.category</b><br>
3446   * </p>
3447   */
3448  @SearchParamDefinition(name="category", path="Procedure.category", description="Classification of the procedure", type="token" )
3449  public static final String SP_CATEGORY = "category";
3450 /**
3451   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3452   * <p>
3453   * Description: <b>Classification of the procedure</b><br>
3454   * Type: <b>token</b><br>
3455   * Path: <b>Procedure.category</b><br>
3456   * </p>
3457   */
3458  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3459
3460 /**
3461   * Search parameter: <b>status</b>
3462   * <p>
3463   * Description: <b>preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown</b><br>
3464   * Type: <b>token</b><br>
3465   * Path: <b>Procedure.status</b><br>
3466   * </p>
3467   */
3468  @SearchParamDefinition(name="status", path="Procedure.status", description="preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown", type="token" )
3469  public static final String SP_STATUS = "status";
3470 /**
3471   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3472   * <p>
3473   * Description: <b>preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown</b><br>
3474   * Type: <b>token</b><br>
3475   * Path: <b>Procedure.status</b><br>
3476   * </p>
3477   */
3478  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3479
3480
3481}