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