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