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, Sep 13, 2018 09:04-0400 for FHIR v3.5.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 system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known which one.
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 system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
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, anaethetist, 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, anaethetist, 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, anaethetist, 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, anaethetist, 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, anaethetist, 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, anaethetist, 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 propagates 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 propagates from server to server." )
774    protected List<Identifier> identifier;
775
776    /**
777     * The URL pointing to a FHIR-defined protocol, guideline, orderset 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, orderset 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, orderset 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, orderset 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 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 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 the procedure was performed.
860     */
861    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=10, min=0, max=1, modifier=false, summary=true)
862    @Description(shortDefinition="Encounter or episode associated with the procedure", formalDefinition="The encounter during which the procedure was performed." )
863    protected Reference context;
864
865    /**
866     * The actual object that is the target of the reference (The encounter during which the procedure was performed.)
867     */
868    protected Resource contextTarget;
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 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 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 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 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 followup 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 followup 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 = -518493467L;
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 propagates 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, orderset 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, orderset 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, orderset 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, orderset 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, orderset 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, orderset 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, orderset 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, orderset 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 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 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 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 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 #context} (The encounter during which the procedure was performed.)
1507     */
1508    public Reference getContext() { 
1509      if (this.context == null)
1510        if (Configuration.errorOnAutoCreate())
1511          throw new Error("Attempt to auto-create Procedure.context");
1512        else if (Configuration.doAutoCreate())
1513          this.context = new Reference(); // cc
1514      return this.context;
1515    }
1516
1517    public boolean hasContext() { 
1518      return this.context != null && !this.context.isEmpty();
1519    }
1520
1521    /**
1522     * @param value {@link #context} (The encounter during which the procedure was performed.)
1523     */
1524    public Procedure setContext(Reference value) { 
1525      this.context = value;
1526      return this;
1527    }
1528
1529    /**
1530     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The encounter during which the procedure was performed.)
1531     */
1532    public Resource getContextTarget() { 
1533      return this.contextTarget;
1534    }
1535
1536    /**
1537     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The encounter during which the procedure was performed.)
1538     */
1539    public Procedure setContextTarget(Resource value) { 
1540      this.contextTarget = value;
1541      return this;
1542    }
1543
1544    /**
1545     * @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.)
1546     */
1547    public Type getPerformed() { 
1548      return this.performed;
1549    }
1550
1551    /**
1552     * @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.)
1553     */
1554    public DateTimeType getPerformedDateTimeType() throws FHIRException { 
1555      if (this.performed == null)
1556        return null;
1557      if (!(this.performed instanceof DateTimeType))
1558        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.performed.getClass().getName()+" was encountered");
1559      return (DateTimeType) this.performed;
1560    }
1561
1562    public boolean hasPerformedDateTimeType() { 
1563      return this != null && this.performed instanceof DateTimeType;
1564    }
1565
1566    /**
1567     * @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.)
1568     */
1569    public Period getPerformedPeriod() throws FHIRException { 
1570      if (this.performed == null)
1571        return null;
1572      if (!(this.performed instanceof Period))
1573        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.performed.getClass().getName()+" was encountered");
1574      return (Period) this.performed;
1575    }
1576
1577    public boolean hasPerformedPeriod() { 
1578      return this != null && this.performed instanceof Period;
1579    }
1580
1581    /**
1582     * @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.)
1583     */
1584    public StringType getPerformedStringType() throws FHIRException { 
1585      if (this.performed == null)
1586        return null;
1587      if (!(this.performed instanceof StringType))
1588        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.performed.getClass().getName()+" was encountered");
1589      return (StringType) this.performed;
1590    }
1591
1592    public boolean hasPerformedStringType() { 
1593      return this != null && this.performed instanceof StringType;
1594    }
1595
1596    /**
1597     * @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.)
1598     */
1599    public Age getPerformedAge() throws FHIRException { 
1600      if (this.performed == null)
1601        return null;
1602      if (!(this.performed instanceof Age))
1603        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.performed.getClass().getName()+" was encountered");
1604      return (Age) this.performed;
1605    }
1606
1607    public boolean hasPerformedAge() { 
1608      return this != null && this.performed instanceof Age;
1609    }
1610
1611    /**
1612     * @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.)
1613     */
1614    public Range getPerformedRange() throws FHIRException { 
1615      if (this.performed == null)
1616        return null;
1617      if (!(this.performed instanceof Range))
1618        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.performed.getClass().getName()+" was encountered");
1619      return (Range) this.performed;
1620    }
1621
1622    public boolean hasPerformedRange() { 
1623      return this != null && this.performed instanceof Range;
1624    }
1625
1626    public boolean hasPerformed() { 
1627      return this.performed != null && !this.performed.isEmpty();
1628    }
1629
1630    /**
1631     * @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.)
1632     */
1633    public Procedure setPerformed(Type value) { 
1634      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof StringType || value instanceof Age || value instanceof Range))
1635        throw new Error("Not the right type for Procedure.performed[x]: "+value.fhirType());
1636      this.performed = value;
1637      return this;
1638    }
1639
1640    /**
1641     * @return {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1642     */
1643    public Reference getRecorder() { 
1644      if (this.recorder == null)
1645        if (Configuration.errorOnAutoCreate())
1646          throw new Error("Attempt to auto-create Procedure.recorder");
1647        else if (Configuration.doAutoCreate())
1648          this.recorder = new Reference(); // cc
1649      return this.recorder;
1650    }
1651
1652    public boolean hasRecorder() { 
1653      return this.recorder != null && !this.recorder.isEmpty();
1654    }
1655
1656    /**
1657     * @param value {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1658     */
1659    public Procedure setRecorder(Reference value) { 
1660      this.recorder = value;
1661      return this;
1662    }
1663
1664    /**
1665     * @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.)
1666     */
1667    public Resource getRecorderTarget() { 
1668      return this.recorderTarget;
1669    }
1670
1671    /**
1672     * @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.)
1673     */
1674    public Procedure setRecorderTarget(Resource value) { 
1675      this.recorderTarget = value;
1676      return this;
1677    }
1678
1679    /**
1680     * @return {@link #asserter} (Individual who is making the procedure statement.)
1681     */
1682    public Reference getAsserter() { 
1683      if (this.asserter == null)
1684        if (Configuration.errorOnAutoCreate())
1685          throw new Error("Attempt to auto-create Procedure.asserter");
1686        else if (Configuration.doAutoCreate())
1687          this.asserter = new Reference(); // cc
1688      return this.asserter;
1689    }
1690
1691    public boolean hasAsserter() { 
1692      return this.asserter != null && !this.asserter.isEmpty();
1693    }
1694
1695    /**
1696     * @param value {@link #asserter} (Individual who is making the procedure statement.)
1697     */
1698    public Procedure setAsserter(Reference value) { 
1699      this.asserter = value;
1700      return this;
1701    }
1702
1703    /**
1704     * @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.)
1705     */
1706    public Resource getAsserterTarget() { 
1707      return this.asserterTarget;
1708    }
1709
1710    /**
1711     * @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.)
1712     */
1713    public Procedure setAsserterTarget(Resource value) { 
1714      this.asserterTarget = value;
1715      return this;
1716    }
1717
1718    /**
1719     * @return {@link #performer} (Limited to 'real' people rather than equipment.)
1720     */
1721    public List<ProcedurePerformerComponent> getPerformer() { 
1722      if (this.performer == null)
1723        this.performer = new ArrayList<ProcedurePerformerComponent>();
1724      return this.performer;
1725    }
1726
1727    /**
1728     * @return Returns a reference to <code>this</code> for easy method chaining
1729     */
1730    public Procedure setPerformer(List<ProcedurePerformerComponent> thePerformer) { 
1731      this.performer = thePerformer;
1732      return this;
1733    }
1734
1735    public boolean hasPerformer() { 
1736      if (this.performer == null)
1737        return false;
1738      for (ProcedurePerformerComponent item : this.performer)
1739        if (!item.isEmpty())
1740          return true;
1741      return false;
1742    }
1743
1744    public ProcedurePerformerComponent addPerformer() { //3
1745      ProcedurePerformerComponent t = new ProcedurePerformerComponent();
1746      if (this.performer == null)
1747        this.performer = new ArrayList<ProcedurePerformerComponent>();
1748      this.performer.add(t);
1749      return t;
1750    }
1751
1752    public Procedure addPerformer(ProcedurePerformerComponent t) { //3
1753      if (t == null)
1754        return this;
1755      if (this.performer == null)
1756        this.performer = new ArrayList<ProcedurePerformerComponent>();
1757      this.performer.add(t);
1758      return this;
1759    }
1760
1761    /**
1762     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
1763     */
1764    public ProcedurePerformerComponent getPerformerFirstRep() { 
1765      if (getPerformer().isEmpty()) {
1766        addPerformer();
1767      }
1768      return getPerformer().get(0);
1769    }
1770
1771    /**
1772     * @return {@link #location} (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1773     */
1774    public Reference getLocation() { 
1775      if (this.location == null)
1776        if (Configuration.errorOnAutoCreate())
1777          throw new Error("Attempt to auto-create Procedure.location");
1778        else if (Configuration.doAutoCreate())
1779          this.location = new Reference(); // cc
1780      return this.location;
1781    }
1782
1783    public boolean hasLocation() { 
1784      return this.location != null && !this.location.isEmpty();
1785    }
1786
1787    /**
1788     * @param value {@link #location} (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1789     */
1790    public Procedure setLocation(Reference value) { 
1791      this.location = value;
1792      return this;
1793    }
1794
1795    /**
1796     * @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.)
1797     */
1798    public Location getLocationTarget() { 
1799      if (this.locationTarget == null)
1800        if (Configuration.errorOnAutoCreate())
1801          throw new Error("Attempt to auto-create Procedure.location");
1802        else if (Configuration.doAutoCreate())
1803          this.locationTarget = new Location(); // aa
1804      return this.locationTarget;
1805    }
1806
1807    /**
1808     * @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.)
1809     */
1810    public Procedure setLocationTarget(Location value) { 
1811      this.locationTarget = value;
1812      return this;
1813    }
1814
1815    /**
1816     * @return {@link #reasonCode} (The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.)
1817     */
1818    public List<CodeableConcept> getReasonCode() { 
1819      if (this.reasonCode == null)
1820        this.reasonCode = new ArrayList<CodeableConcept>();
1821      return this.reasonCode;
1822    }
1823
1824    /**
1825     * @return Returns a reference to <code>this</code> for easy method chaining
1826     */
1827    public Procedure setReasonCode(List<CodeableConcept> theReasonCode) { 
1828      this.reasonCode = theReasonCode;
1829      return this;
1830    }
1831
1832    public boolean hasReasonCode() { 
1833      if (this.reasonCode == null)
1834        return false;
1835      for (CodeableConcept item : this.reasonCode)
1836        if (!item.isEmpty())
1837          return true;
1838      return false;
1839    }
1840
1841    public CodeableConcept addReasonCode() { //3
1842      CodeableConcept t = new CodeableConcept();
1843      if (this.reasonCode == null)
1844        this.reasonCode = new ArrayList<CodeableConcept>();
1845      this.reasonCode.add(t);
1846      return t;
1847    }
1848
1849    public Procedure addReasonCode(CodeableConcept t) { //3
1850      if (t == null)
1851        return this;
1852      if (this.reasonCode == null)
1853        this.reasonCode = new ArrayList<CodeableConcept>();
1854      this.reasonCode.add(t);
1855      return this;
1856    }
1857
1858    /**
1859     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1860     */
1861    public CodeableConcept getReasonCodeFirstRep() { 
1862      if (getReasonCode().isEmpty()) {
1863        addReasonCode();
1864      }
1865      return getReasonCode().get(0);
1866    }
1867
1868    /**
1869     * @return {@link #reasonReference} (The justification of why the procedure was performed.)
1870     */
1871    public List<Reference> getReasonReference() { 
1872      if (this.reasonReference == null)
1873        this.reasonReference = new ArrayList<Reference>();
1874      return this.reasonReference;
1875    }
1876
1877    /**
1878     * @return Returns a reference to <code>this</code> for easy method chaining
1879     */
1880    public Procedure setReasonReference(List<Reference> theReasonReference) { 
1881      this.reasonReference = theReasonReference;
1882      return this;
1883    }
1884
1885    public boolean hasReasonReference() { 
1886      if (this.reasonReference == null)
1887        return false;
1888      for (Reference item : this.reasonReference)
1889        if (!item.isEmpty())
1890          return true;
1891      return false;
1892    }
1893
1894    public Reference addReasonReference() { //3
1895      Reference t = new Reference();
1896      if (this.reasonReference == null)
1897        this.reasonReference = new ArrayList<Reference>();
1898      this.reasonReference.add(t);
1899      return t;
1900    }
1901
1902    public Procedure addReasonReference(Reference t) { //3
1903      if (t == null)
1904        return this;
1905      if (this.reasonReference == null)
1906        this.reasonReference = new ArrayList<Reference>();
1907      this.reasonReference.add(t);
1908      return this;
1909    }
1910
1911    /**
1912     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1913     */
1914    public Reference getReasonReferenceFirstRep() { 
1915      if (getReasonReference().isEmpty()) {
1916        addReasonReference();
1917      }
1918      return getReasonReference().get(0);
1919    }
1920
1921    /**
1922     * @deprecated Use Reference#setResource(IBaseResource) instead
1923     */
1924    @Deprecated
1925    public List<Resource> getReasonReferenceTarget() { 
1926      if (this.reasonReferenceTarget == null)
1927        this.reasonReferenceTarget = new ArrayList<Resource>();
1928      return this.reasonReferenceTarget;
1929    }
1930
1931    /**
1932     * @return {@link #bodySite} (Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.)
1933     */
1934    public List<CodeableConcept> getBodySite() { 
1935      if (this.bodySite == null)
1936        this.bodySite = new ArrayList<CodeableConcept>();
1937      return this.bodySite;
1938    }
1939
1940    /**
1941     * @return Returns a reference to <code>this</code> for easy method chaining
1942     */
1943    public Procedure setBodySite(List<CodeableConcept> theBodySite) { 
1944      this.bodySite = theBodySite;
1945      return this;
1946    }
1947
1948    public boolean hasBodySite() { 
1949      if (this.bodySite == null)
1950        return false;
1951      for (CodeableConcept item : this.bodySite)
1952        if (!item.isEmpty())
1953          return true;
1954      return false;
1955    }
1956
1957    public CodeableConcept addBodySite() { //3
1958      CodeableConcept t = new CodeableConcept();
1959      if (this.bodySite == null)
1960        this.bodySite = new ArrayList<CodeableConcept>();
1961      this.bodySite.add(t);
1962      return t;
1963    }
1964
1965    public Procedure addBodySite(CodeableConcept t) { //3
1966      if (t == null)
1967        return this;
1968      if (this.bodySite == null)
1969        this.bodySite = new ArrayList<CodeableConcept>();
1970      this.bodySite.add(t);
1971      return this;
1972    }
1973
1974    /**
1975     * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist
1976     */
1977    public CodeableConcept getBodySiteFirstRep() { 
1978      if (getBodySite().isEmpty()) {
1979        addBodySite();
1980      }
1981      return getBodySite().get(0);
1982    }
1983
1984    /**
1985     * @return {@link #outcome} (The outcome of the procedure - did it resolve reasons for the procedure being performed?)
1986     */
1987    public CodeableConcept getOutcome() { 
1988      if (this.outcome == null)
1989        if (Configuration.errorOnAutoCreate())
1990          throw new Error("Attempt to auto-create Procedure.outcome");
1991        else if (Configuration.doAutoCreate())
1992          this.outcome = new CodeableConcept(); // cc
1993      return this.outcome;
1994    }
1995
1996    public boolean hasOutcome() { 
1997      return this.outcome != null && !this.outcome.isEmpty();
1998    }
1999
2000    /**
2001     * @param value {@link #outcome} (The outcome of the procedure - did it resolve reasons for the procedure being performed?)
2002     */
2003    public Procedure setOutcome(CodeableConcept value) { 
2004      this.outcome = value;
2005      return this;
2006    }
2007
2008    /**
2009     * @return {@link #report} (This could be a histology result, pathology report, surgical report, etc.)
2010     */
2011    public List<Reference> getReport() { 
2012      if (this.report == null)
2013        this.report = new ArrayList<Reference>();
2014      return this.report;
2015    }
2016
2017    /**
2018     * @return Returns a reference to <code>this</code> for easy method chaining
2019     */
2020    public Procedure setReport(List<Reference> theReport) { 
2021      this.report = theReport;
2022      return this;
2023    }
2024
2025    public boolean hasReport() { 
2026      if (this.report == null)
2027        return false;
2028      for (Reference item : this.report)
2029        if (!item.isEmpty())
2030          return true;
2031      return false;
2032    }
2033
2034    public Reference addReport() { //3
2035      Reference t = new Reference();
2036      if (this.report == null)
2037        this.report = new ArrayList<Reference>();
2038      this.report.add(t);
2039      return t;
2040    }
2041
2042    public Procedure addReport(Reference t) { //3
2043      if (t == null)
2044        return this;
2045      if (this.report == null)
2046        this.report = new ArrayList<Reference>();
2047      this.report.add(t);
2048      return this;
2049    }
2050
2051    /**
2052     * @return The first repetition of repeating field {@link #report}, creating it if it does not already exist
2053     */
2054    public Reference getReportFirstRep() { 
2055      if (getReport().isEmpty()) {
2056        addReport();
2057      }
2058      return getReport().get(0);
2059    }
2060
2061    /**
2062     * @deprecated Use Reference#setResource(IBaseResource) instead
2063     */
2064    @Deprecated
2065    public List<Resource> getReportTarget() { 
2066      if (this.reportTarget == null)
2067        this.reportTarget = new ArrayList<Resource>();
2068      return this.reportTarget;
2069    }
2070
2071    /**
2072     * @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.)
2073     */
2074    public List<CodeableConcept> getComplication() { 
2075      if (this.complication == null)
2076        this.complication = new ArrayList<CodeableConcept>();
2077      return this.complication;
2078    }
2079
2080    /**
2081     * @return Returns a reference to <code>this</code> for easy method chaining
2082     */
2083    public Procedure setComplication(List<CodeableConcept> theComplication) { 
2084      this.complication = theComplication;
2085      return this;
2086    }
2087
2088    public boolean hasComplication() { 
2089      if (this.complication == null)
2090        return false;
2091      for (CodeableConcept item : this.complication)
2092        if (!item.isEmpty())
2093          return true;
2094      return false;
2095    }
2096
2097    public CodeableConcept addComplication() { //3
2098      CodeableConcept t = new CodeableConcept();
2099      if (this.complication == null)
2100        this.complication = new ArrayList<CodeableConcept>();
2101      this.complication.add(t);
2102      return t;
2103    }
2104
2105    public Procedure addComplication(CodeableConcept t) { //3
2106      if (t == null)
2107        return this;
2108      if (this.complication == null)
2109        this.complication = new ArrayList<CodeableConcept>();
2110      this.complication.add(t);
2111      return this;
2112    }
2113
2114    /**
2115     * @return The first repetition of repeating field {@link #complication}, creating it if it does not already exist
2116     */
2117    public CodeableConcept getComplicationFirstRep() { 
2118      if (getComplication().isEmpty()) {
2119        addComplication();
2120      }
2121      return getComplication().get(0);
2122    }
2123
2124    /**
2125     * @return {@link #complicationDetail} (Any complications that occurred during the procedure, or in the immediate post-performance period.)
2126     */
2127    public List<Reference> getComplicationDetail() { 
2128      if (this.complicationDetail == null)
2129        this.complicationDetail = new ArrayList<Reference>();
2130      return this.complicationDetail;
2131    }
2132
2133    /**
2134     * @return Returns a reference to <code>this</code> for easy method chaining
2135     */
2136    public Procedure setComplicationDetail(List<Reference> theComplicationDetail) { 
2137      this.complicationDetail = theComplicationDetail;
2138      return this;
2139    }
2140
2141    public boolean hasComplicationDetail() { 
2142      if (this.complicationDetail == null)
2143        return false;
2144      for (Reference item : this.complicationDetail)
2145        if (!item.isEmpty())
2146          return true;
2147      return false;
2148    }
2149
2150    public Reference addComplicationDetail() { //3
2151      Reference t = new Reference();
2152      if (this.complicationDetail == null)
2153        this.complicationDetail = new ArrayList<Reference>();
2154      this.complicationDetail.add(t);
2155      return t;
2156    }
2157
2158    public Procedure addComplicationDetail(Reference t) { //3
2159      if (t == null)
2160        return this;
2161      if (this.complicationDetail == null)
2162        this.complicationDetail = new ArrayList<Reference>();
2163      this.complicationDetail.add(t);
2164      return this;
2165    }
2166
2167    /**
2168     * @return The first repetition of repeating field {@link #complicationDetail}, creating it if it does not already exist
2169     */
2170    public Reference getComplicationDetailFirstRep() { 
2171      if (getComplicationDetail().isEmpty()) {
2172        addComplicationDetail();
2173      }
2174      return getComplicationDetail().get(0);
2175    }
2176
2177    /**
2178     * @deprecated Use Reference#setResource(IBaseResource) instead
2179     */
2180    @Deprecated
2181    public List<Condition> getComplicationDetailTarget() { 
2182      if (this.complicationDetailTarget == null)
2183        this.complicationDetailTarget = new ArrayList<Condition>();
2184      return this.complicationDetailTarget;
2185    }
2186
2187    /**
2188     * @deprecated Use Reference#setResource(IBaseResource) instead
2189     */
2190    @Deprecated
2191    public Condition addComplicationDetailTarget() { 
2192      Condition r = new Condition();
2193      if (this.complicationDetailTarget == null)
2194        this.complicationDetailTarget = new ArrayList<Condition>();
2195      this.complicationDetailTarget.add(r);
2196      return r;
2197    }
2198
2199    /**
2200     * @return {@link #followUp} (If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.)
2201     */
2202    public List<CodeableConcept> getFollowUp() { 
2203      if (this.followUp == null)
2204        this.followUp = new ArrayList<CodeableConcept>();
2205      return this.followUp;
2206    }
2207
2208    /**
2209     * @return Returns a reference to <code>this</code> for easy method chaining
2210     */
2211    public Procedure setFollowUp(List<CodeableConcept> theFollowUp) { 
2212      this.followUp = theFollowUp;
2213      return this;
2214    }
2215
2216    public boolean hasFollowUp() { 
2217      if (this.followUp == null)
2218        return false;
2219      for (CodeableConcept item : this.followUp)
2220        if (!item.isEmpty())
2221          return true;
2222      return false;
2223    }
2224
2225    public CodeableConcept addFollowUp() { //3
2226      CodeableConcept t = new CodeableConcept();
2227      if (this.followUp == null)
2228        this.followUp = new ArrayList<CodeableConcept>();
2229      this.followUp.add(t);
2230      return t;
2231    }
2232
2233    public Procedure addFollowUp(CodeableConcept t) { //3
2234      if (t == null)
2235        return this;
2236      if (this.followUp == null)
2237        this.followUp = new ArrayList<CodeableConcept>();
2238      this.followUp.add(t);
2239      return this;
2240    }
2241
2242    /**
2243     * @return The first repetition of repeating field {@link #followUp}, creating it if it does not already exist
2244     */
2245    public CodeableConcept getFollowUpFirstRep() { 
2246      if (getFollowUp().isEmpty()) {
2247        addFollowUp();
2248      }
2249      return getFollowUp().get(0);
2250    }
2251
2252    /**
2253     * @return {@link #note} (Any other notes and comments about the procedure.)
2254     */
2255    public List<Annotation> getNote() { 
2256      if (this.note == null)
2257        this.note = new ArrayList<Annotation>();
2258      return this.note;
2259    }
2260
2261    /**
2262     * @return Returns a reference to <code>this</code> for easy method chaining
2263     */
2264    public Procedure setNote(List<Annotation> theNote) { 
2265      this.note = theNote;
2266      return this;
2267    }
2268
2269    public boolean hasNote() { 
2270      if (this.note == null)
2271        return false;
2272      for (Annotation item : this.note)
2273        if (!item.isEmpty())
2274          return true;
2275      return false;
2276    }
2277
2278    public Annotation addNote() { //3
2279      Annotation t = new Annotation();
2280      if (this.note == null)
2281        this.note = new ArrayList<Annotation>();
2282      this.note.add(t);
2283      return t;
2284    }
2285
2286    public Procedure addNote(Annotation t) { //3
2287      if (t == null)
2288        return this;
2289      if (this.note == null)
2290        this.note = new ArrayList<Annotation>();
2291      this.note.add(t);
2292      return this;
2293    }
2294
2295    /**
2296     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2297     */
2298    public Annotation getNoteFirstRep() { 
2299      if (getNote().isEmpty()) {
2300        addNote();
2301      }
2302      return getNote().get(0);
2303    }
2304
2305    /**
2306     * @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.)
2307     */
2308    public List<ProcedureFocalDeviceComponent> getFocalDevice() { 
2309      if (this.focalDevice == null)
2310        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2311      return this.focalDevice;
2312    }
2313
2314    /**
2315     * @return Returns a reference to <code>this</code> for easy method chaining
2316     */
2317    public Procedure setFocalDevice(List<ProcedureFocalDeviceComponent> theFocalDevice) { 
2318      this.focalDevice = theFocalDevice;
2319      return this;
2320    }
2321
2322    public boolean hasFocalDevice() { 
2323      if (this.focalDevice == null)
2324        return false;
2325      for (ProcedureFocalDeviceComponent item : this.focalDevice)
2326        if (!item.isEmpty())
2327          return true;
2328      return false;
2329    }
2330
2331    public ProcedureFocalDeviceComponent addFocalDevice() { //3
2332      ProcedureFocalDeviceComponent t = new ProcedureFocalDeviceComponent();
2333      if (this.focalDevice == null)
2334        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2335      this.focalDevice.add(t);
2336      return t;
2337    }
2338
2339    public Procedure addFocalDevice(ProcedureFocalDeviceComponent t) { //3
2340      if (t == null)
2341        return this;
2342      if (this.focalDevice == null)
2343        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2344      this.focalDevice.add(t);
2345      return this;
2346    }
2347
2348    /**
2349     * @return The first repetition of repeating field {@link #focalDevice}, creating it if it does not already exist
2350     */
2351    public ProcedureFocalDeviceComponent getFocalDeviceFirstRep() { 
2352      if (getFocalDevice().isEmpty()) {
2353        addFocalDevice();
2354      }
2355      return getFocalDevice().get(0);
2356    }
2357
2358    /**
2359     * @return {@link #usedReference} (Identifies medications, devices and any other substance used as part of the procedure.)
2360     */
2361    public List<Reference> getUsedReference() { 
2362      if (this.usedReference == null)
2363        this.usedReference = new ArrayList<Reference>();
2364      return this.usedReference;
2365    }
2366
2367    /**
2368     * @return Returns a reference to <code>this</code> for easy method chaining
2369     */
2370    public Procedure setUsedReference(List<Reference> theUsedReference) { 
2371      this.usedReference = theUsedReference;
2372      return this;
2373    }
2374
2375    public boolean hasUsedReference() { 
2376      if (this.usedReference == null)
2377        return false;
2378      for (Reference item : this.usedReference)
2379        if (!item.isEmpty())
2380          return true;
2381      return false;
2382    }
2383
2384    public Reference addUsedReference() { //3
2385      Reference t = new Reference();
2386      if (this.usedReference == null)
2387        this.usedReference = new ArrayList<Reference>();
2388      this.usedReference.add(t);
2389      return t;
2390    }
2391
2392    public Procedure addUsedReference(Reference t) { //3
2393      if (t == null)
2394        return this;
2395      if (this.usedReference == null)
2396        this.usedReference = new ArrayList<Reference>();
2397      this.usedReference.add(t);
2398      return this;
2399    }
2400
2401    /**
2402     * @return The first repetition of repeating field {@link #usedReference}, creating it if it does not already exist
2403     */
2404    public Reference getUsedReferenceFirstRep() { 
2405      if (getUsedReference().isEmpty()) {
2406        addUsedReference();
2407      }
2408      return getUsedReference().get(0);
2409    }
2410
2411    /**
2412     * @deprecated Use Reference#setResource(IBaseResource) instead
2413     */
2414    @Deprecated
2415    public List<Resource> getUsedReferenceTarget() { 
2416      if (this.usedReferenceTarget == null)
2417        this.usedReferenceTarget = new ArrayList<Resource>();
2418      return this.usedReferenceTarget;
2419    }
2420
2421    /**
2422     * @return {@link #usedCode} (Identifies coded items that were used as part of the procedure.)
2423     */
2424    public List<CodeableConcept> getUsedCode() { 
2425      if (this.usedCode == null)
2426        this.usedCode = new ArrayList<CodeableConcept>();
2427      return this.usedCode;
2428    }
2429
2430    /**
2431     * @return Returns a reference to <code>this</code> for easy method chaining
2432     */
2433    public Procedure setUsedCode(List<CodeableConcept> theUsedCode) { 
2434      this.usedCode = theUsedCode;
2435      return this;
2436    }
2437
2438    public boolean hasUsedCode() { 
2439      if (this.usedCode == null)
2440        return false;
2441      for (CodeableConcept item : this.usedCode)
2442        if (!item.isEmpty())
2443          return true;
2444      return false;
2445    }
2446
2447    public CodeableConcept addUsedCode() { //3
2448      CodeableConcept t = new CodeableConcept();
2449      if (this.usedCode == null)
2450        this.usedCode = new ArrayList<CodeableConcept>();
2451      this.usedCode.add(t);
2452      return t;
2453    }
2454
2455    public Procedure addUsedCode(CodeableConcept t) { //3
2456      if (t == null)
2457        return this;
2458      if (this.usedCode == null)
2459        this.usedCode = new ArrayList<CodeableConcept>();
2460      this.usedCode.add(t);
2461      return this;
2462    }
2463
2464    /**
2465     * @return The first repetition of repeating field {@link #usedCode}, creating it if it does not already exist
2466     */
2467    public CodeableConcept getUsedCodeFirstRep() { 
2468      if (getUsedCode().isEmpty()) {
2469        addUsedCode();
2470      }
2471      return getUsedCode().get(0);
2472    }
2473
2474      protected void listChildren(List<Property> children) {
2475        super.listChildren(children);
2476        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 propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
2477        children.add(new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition|Measure|OperationDefinition|Questionnaire)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2478        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2479        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));
2480        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));
2481        children.add(new Property("status", "code", "A code specifying the state of the procedure. Generally this will be in-progress or completed state.", 0, 1, status));
2482        children.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the procedure.", 0, 1, statusReason));
2483        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));
2484        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));
2485        children.add(new Property("subject", "Reference(Patient|Group)", "The person, animal or group on which the procedure was performed.", 0, 1, subject));
2486        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter during which the procedure was performed.", 0, 1, context));
2487        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));
2488        children.add(new Property("recorder", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder));
2489        children.add(new Property("asserter", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who is making the procedure statement.", 0, 1, asserter));
2490        children.add(new Property("performer", "", "Limited to 'real' people rather than equipment.", 0, java.lang.Integer.MAX_VALUE, performer));
2491        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));
2492        children.add(new Property("reasonCode", "CodeableConcept", "The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2493        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));
2494        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));
2495        children.add(new Property("outcome", "CodeableConcept", "The outcome of the procedure - did it resolve reasons for the procedure being performed?", 0, 1, outcome));
2496        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));
2497        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));
2498        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));
2499        children.add(new Property("followUp", "CodeableConcept", "If the procedure required specific follow up - e.g. removal of sutures. The followup 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));
2500        children.add(new Property("note", "Annotation", "Any other notes and comments about the procedure.", 0, java.lang.Integer.MAX_VALUE, note));
2501        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));
2502        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));
2503        children.add(new Property("usedCode", "CodeableConcept", "Identifies coded items that were used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedCode));
2504      }
2505
2506      @Override
2507      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2508        switch (_hash) {
2509        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 propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
2510        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition|Measure|OperationDefinition|Questionnaire)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2511        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Procedure.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2512        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);
2513        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);
2514        case -892481550: /*status*/  return new Property("status", "code", "A code specifying the state of the procedure. Generally this will be in-progress or completed state.", 0, 1, status);
2515        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the procedure.", 0, 1, statusReason);
2516        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);
2517        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);
2518        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The person, animal or group on which the procedure was performed.", 0, 1, subject);
2519        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter during which the procedure was performed.", 0, 1, context);
2520        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);
2521        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);
2522        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);
2523        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);
2524        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);
2525        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);
2526        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);
2527        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);
2528        case -373242253: /*asserter*/  return new Property("asserter", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole)", "Individual who is making the procedure statement.", 0, 1, asserter);
2529        case 481140686: /*performer*/  return new Property("performer", "", "Limited to 'real' people rather than equipment.", 0, java.lang.Integer.MAX_VALUE, performer);
2530        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);
2531        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2532        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);
2533        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);
2534        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "The outcome of the procedure - did it resolve reasons for the procedure being performed?", 0, 1, outcome);
2535        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);
2536        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);
2537        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);
2538        case 301801004: /*followUp*/  return new Property("followUp", "CodeableConcept", "If the procedure required specific follow up - e.g. removal of sutures. The followup 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);
2539        case 3387378: /*note*/  return new Property("note", "Annotation", "Any other notes and comments about the procedure.", 0, java.lang.Integer.MAX_VALUE, note);
2540        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);
2541        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);
2542        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);
2543        default: return super.getNamedProperty(_hash, _name, _checkValid);
2544        }
2545
2546      }
2547
2548      @Override
2549      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2550        switch (hash) {
2551        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2552        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2553        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2554        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2555        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2556        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ProcedureStatus>
2557        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
2558        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2559        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2560        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2561        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
2562        case 481140672: /*performed*/ return this.performed == null ? new Base[0] : new Base[] {this.performed}; // Type
2563        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
2564        case -373242253: /*asserter*/ return this.asserter == null ? new Base[0] : new Base[] {this.asserter}; // Reference
2565        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // ProcedurePerformerComponent
2566        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2567        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2568        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2569        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // CodeableConcept
2570        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
2571        case -934521548: /*report*/ return this.report == null ? new Base[0] : this.report.toArray(new Base[this.report.size()]); // Reference
2572        case -1644401602: /*complication*/ return this.complication == null ? new Base[0] : this.complication.toArray(new Base[this.complication.size()]); // CodeableConcept
2573        case -1685272017: /*complicationDetail*/ return this.complicationDetail == null ? new Base[0] : this.complicationDetail.toArray(new Base[this.complicationDetail.size()]); // Reference
2574        case 301801004: /*followUp*/ return this.followUp == null ? new Base[0] : this.followUp.toArray(new Base[this.followUp.size()]); // CodeableConcept
2575        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2576        case -1129235173: /*focalDevice*/ return this.focalDevice == null ? new Base[0] : this.focalDevice.toArray(new Base[this.focalDevice.size()]); // ProcedureFocalDeviceComponent
2577        case -504932338: /*usedReference*/ return this.usedReference == null ? new Base[0] : this.usedReference.toArray(new Base[this.usedReference.size()]); // Reference
2578        case -279910582: /*usedCode*/ return this.usedCode == null ? new Base[0] : this.usedCode.toArray(new Base[this.usedCode.size()]); // CodeableConcept
2579        default: return super.getProperty(hash, name, checkValid);
2580        }
2581
2582      }
2583
2584      @Override
2585      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2586        switch (hash) {
2587        case -1618432855: // identifier
2588          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2589          return value;
2590        case 8911915: // instantiatesCanonical
2591          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2592          return value;
2593        case -1926393373: // instantiatesUri
2594          this.getInstantiatesUri().add(castToUri(value)); // UriType
2595          return value;
2596        case -332612366: // basedOn
2597          this.getBasedOn().add(castToReference(value)); // Reference
2598          return value;
2599        case -995410646: // partOf
2600          this.getPartOf().add(castToReference(value)); // Reference
2601          return value;
2602        case -892481550: // status
2603          value = new ProcedureStatusEnumFactory().fromType(castToCode(value));
2604          this.status = (Enumeration) value; // Enumeration<ProcedureStatus>
2605          return value;
2606        case 2051346646: // statusReason
2607          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2608          return value;
2609        case 50511102: // category
2610          this.category = castToCodeableConcept(value); // CodeableConcept
2611          return value;
2612        case 3059181: // code
2613          this.code = castToCodeableConcept(value); // CodeableConcept
2614          return value;
2615        case -1867885268: // subject
2616          this.subject = castToReference(value); // Reference
2617          return value;
2618        case 951530927: // context
2619          this.context = castToReference(value); // Reference
2620          return value;
2621        case 481140672: // performed
2622          this.performed = castToType(value); // Type
2623          return value;
2624        case -799233858: // recorder
2625          this.recorder = castToReference(value); // Reference
2626          return value;
2627        case -373242253: // asserter
2628          this.asserter = castToReference(value); // Reference
2629          return value;
2630        case 481140686: // performer
2631          this.getPerformer().add((ProcedurePerformerComponent) value); // ProcedurePerformerComponent
2632          return value;
2633        case 1901043637: // location
2634          this.location = castToReference(value); // Reference
2635          return value;
2636        case 722137681: // reasonCode
2637          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2638          return value;
2639        case -1146218137: // reasonReference
2640          this.getReasonReference().add(castToReference(value)); // Reference
2641          return value;
2642        case 1702620169: // bodySite
2643          this.getBodySite().add(castToCodeableConcept(value)); // CodeableConcept
2644          return value;
2645        case -1106507950: // outcome
2646          this.outcome = castToCodeableConcept(value); // CodeableConcept
2647          return value;
2648        case -934521548: // report
2649          this.getReport().add(castToReference(value)); // Reference
2650          return value;
2651        case -1644401602: // complication
2652          this.getComplication().add(castToCodeableConcept(value)); // CodeableConcept
2653          return value;
2654        case -1685272017: // complicationDetail
2655          this.getComplicationDetail().add(castToReference(value)); // Reference
2656          return value;
2657        case 301801004: // followUp
2658          this.getFollowUp().add(castToCodeableConcept(value)); // CodeableConcept
2659          return value;
2660        case 3387378: // note
2661          this.getNote().add(castToAnnotation(value)); // Annotation
2662          return value;
2663        case -1129235173: // focalDevice
2664          this.getFocalDevice().add((ProcedureFocalDeviceComponent) value); // ProcedureFocalDeviceComponent
2665          return value;
2666        case -504932338: // usedReference
2667          this.getUsedReference().add(castToReference(value)); // Reference
2668          return value;
2669        case -279910582: // usedCode
2670          this.getUsedCode().add(castToCodeableConcept(value)); // CodeableConcept
2671          return value;
2672        default: return super.setProperty(hash, name, value);
2673        }
2674
2675      }
2676
2677      @Override
2678      public Base setProperty(String name, Base value) throws FHIRException {
2679        if (name.equals("identifier")) {
2680          this.getIdentifier().add(castToIdentifier(value));
2681        } else if (name.equals("instantiatesCanonical")) {
2682          this.getInstantiatesCanonical().add(castToCanonical(value));
2683        } else if (name.equals("instantiatesUri")) {
2684          this.getInstantiatesUri().add(castToUri(value));
2685        } else if (name.equals("basedOn")) {
2686          this.getBasedOn().add(castToReference(value));
2687        } else if (name.equals("partOf")) {
2688          this.getPartOf().add(castToReference(value));
2689        } else if (name.equals("status")) {
2690          value = new ProcedureStatusEnumFactory().fromType(castToCode(value));
2691          this.status = (Enumeration) value; // Enumeration<ProcedureStatus>
2692        } else if (name.equals("statusReason")) {
2693          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2694        } else if (name.equals("category")) {
2695          this.category = castToCodeableConcept(value); // CodeableConcept
2696        } else if (name.equals("code")) {
2697          this.code = castToCodeableConcept(value); // CodeableConcept
2698        } else if (name.equals("subject")) {
2699          this.subject = castToReference(value); // Reference
2700        } else if (name.equals("context")) {
2701          this.context = castToReference(value); // Reference
2702        } else if (name.equals("performed[x]")) {
2703          this.performed = castToType(value); // Type
2704        } else if (name.equals("recorder")) {
2705          this.recorder = castToReference(value); // Reference
2706        } else if (name.equals("asserter")) {
2707          this.asserter = castToReference(value); // Reference
2708        } else if (name.equals("performer")) {
2709          this.getPerformer().add((ProcedurePerformerComponent) value);
2710        } else if (name.equals("location")) {
2711          this.location = castToReference(value); // Reference
2712        } else if (name.equals("reasonCode")) {
2713          this.getReasonCode().add(castToCodeableConcept(value));
2714        } else if (name.equals("reasonReference")) {
2715          this.getReasonReference().add(castToReference(value));
2716        } else if (name.equals("bodySite")) {
2717          this.getBodySite().add(castToCodeableConcept(value));
2718        } else if (name.equals("outcome")) {
2719          this.outcome = castToCodeableConcept(value); // CodeableConcept
2720        } else if (name.equals("report")) {
2721          this.getReport().add(castToReference(value));
2722        } else if (name.equals("complication")) {
2723          this.getComplication().add(castToCodeableConcept(value));
2724        } else if (name.equals("complicationDetail")) {
2725          this.getComplicationDetail().add(castToReference(value));
2726        } else if (name.equals("followUp")) {
2727          this.getFollowUp().add(castToCodeableConcept(value));
2728        } else if (name.equals("note")) {
2729          this.getNote().add(castToAnnotation(value));
2730        } else if (name.equals("focalDevice")) {
2731          this.getFocalDevice().add((ProcedureFocalDeviceComponent) value);
2732        } else if (name.equals("usedReference")) {
2733          this.getUsedReference().add(castToReference(value));
2734        } else if (name.equals("usedCode")) {
2735          this.getUsedCode().add(castToCodeableConcept(value));
2736        } else
2737          return super.setProperty(name, value);
2738        return value;
2739      }
2740
2741      @Override
2742      public Base makeProperty(int hash, String name) throws FHIRException {
2743        switch (hash) {
2744        case -1618432855:  return addIdentifier(); 
2745        case 8911915:  return addInstantiatesCanonicalElement();
2746        case -1926393373:  return addInstantiatesUriElement();
2747        case -332612366:  return addBasedOn(); 
2748        case -995410646:  return addPartOf(); 
2749        case -892481550:  return getStatusElement();
2750        case 2051346646:  return getStatusReason(); 
2751        case 50511102:  return getCategory(); 
2752        case 3059181:  return getCode(); 
2753        case -1867885268:  return getSubject(); 
2754        case 951530927:  return getContext(); 
2755        case 1355984064:  return getPerformed(); 
2756        case 481140672:  return getPerformed(); 
2757        case -799233858:  return getRecorder(); 
2758        case -373242253:  return getAsserter(); 
2759        case 481140686:  return addPerformer(); 
2760        case 1901043637:  return getLocation(); 
2761        case 722137681:  return addReasonCode(); 
2762        case -1146218137:  return addReasonReference(); 
2763        case 1702620169:  return addBodySite(); 
2764        case -1106507950:  return getOutcome(); 
2765        case -934521548:  return addReport(); 
2766        case -1644401602:  return addComplication(); 
2767        case -1685272017:  return addComplicationDetail(); 
2768        case 301801004:  return addFollowUp(); 
2769        case 3387378:  return addNote(); 
2770        case -1129235173:  return addFocalDevice(); 
2771        case -504932338:  return addUsedReference(); 
2772        case -279910582:  return addUsedCode(); 
2773        default: return super.makeProperty(hash, name);
2774        }
2775
2776      }
2777
2778      @Override
2779      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2780        switch (hash) {
2781        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2782        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
2783        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
2784        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2785        case -995410646: /*partOf*/ return new String[] {"Reference"};
2786        case -892481550: /*status*/ return new String[] {"code"};
2787        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2788        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2789        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2790        case -1867885268: /*subject*/ return new String[] {"Reference"};
2791        case 951530927: /*context*/ return new String[] {"Reference"};
2792        case 481140672: /*performed*/ return new String[] {"dateTime", "Period", "string", "Age", "Range"};
2793        case -799233858: /*recorder*/ return new String[] {"Reference"};
2794        case -373242253: /*asserter*/ return new String[] {"Reference"};
2795        case 481140686: /*performer*/ return new String[] {};
2796        case 1901043637: /*location*/ return new String[] {"Reference"};
2797        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2798        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2799        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
2800        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
2801        case -934521548: /*report*/ return new String[] {"Reference"};
2802        case -1644401602: /*complication*/ return new String[] {"CodeableConcept"};
2803        case -1685272017: /*complicationDetail*/ return new String[] {"Reference"};
2804        case 301801004: /*followUp*/ return new String[] {"CodeableConcept"};
2805        case 3387378: /*note*/ return new String[] {"Annotation"};
2806        case -1129235173: /*focalDevice*/ return new String[] {};
2807        case -504932338: /*usedReference*/ return new String[] {"Reference"};
2808        case -279910582: /*usedCode*/ return new String[] {"CodeableConcept"};
2809        default: return super.getTypesForProperty(hash, name);
2810        }
2811
2812      }
2813
2814      @Override
2815      public Base addChild(String name) throws FHIRException {
2816        if (name.equals("identifier")) {
2817          return addIdentifier();
2818        }
2819        else if (name.equals("instantiatesCanonical")) {
2820          throw new FHIRException("Cannot call addChild on a primitive type Procedure.instantiatesCanonical");
2821        }
2822        else if (name.equals("instantiatesUri")) {
2823          throw new FHIRException("Cannot call addChild on a primitive type Procedure.instantiatesUri");
2824        }
2825        else if (name.equals("basedOn")) {
2826          return addBasedOn();
2827        }
2828        else if (name.equals("partOf")) {
2829          return addPartOf();
2830        }
2831        else if (name.equals("status")) {
2832          throw new FHIRException("Cannot call addChild on a primitive type Procedure.status");
2833        }
2834        else if (name.equals("statusReason")) {
2835          this.statusReason = new CodeableConcept();
2836          return this.statusReason;
2837        }
2838        else if (name.equals("category")) {
2839          this.category = new CodeableConcept();
2840          return this.category;
2841        }
2842        else if (name.equals("code")) {
2843          this.code = new CodeableConcept();
2844          return this.code;
2845        }
2846        else if (name.equals("subject")) {
2847          this.subject = new Reference();
2848          return this.subject;
2849        }
2850        else if (name.equals("context")) {
2851          this.context = new Reference();
2852          return this.context;
2853        }
2854        else if (name.equals("performedDateTime")) {
2855          this.performed = new DateTimeType();
2856          return this.performed;
2857        }
2858        else if (name.equals("performedPeriod")) {
2859          this.performed = new Period();
2860          return this.performed;
2861        }
2862        else if (name.equals("performedString")) {
2863          this.performed = new StringType();
2864          return this.performed;
2865        }
2866        else if (name.equals("performedAge")) {
2867          this.performed = new Age();
2868          return this.performed;
2869        }
2870        else if (name.equals("performedRange")) {
2871          this.performed = new Range();
2872          return this.performed;
2873        }
2874        else if (name.equals("recorder")) {
2875          this.recorder = new Reference();
2876          return this.recorder;
2877        }
2878        else if (name.equals("asserter")) {
2879          this.asserter = new Reference();
2880          return this.asserter;
2881        }
2882        else if (name.equals("performer")) {
2883          return addPerformer();
2884        }
2885        else if (name.equals("location")) {
2886          this.location = new Reference();
2887          return this.location;
2888        }
2889        else if (name.equals("reasonCode")) {
2890          return addReasonCode();
2891        }
2892        else if (name.equals("reasonReference")) {
2893          return addReasonReference();
2894        }
2895        else if (name.equals("bodySite")) {
2896          return addBodySite();
2897        }
2898        else if (name.equals("outcome")) {
2899          this.outcome = new CodeableConcept();
2900          return this.outcome;
2901        }
2902        else if (name.equals("report")) {
2903          return addReport();
2904        }
2905        else if (name.equals("complication")) {
2906          return addComplication();
2907        }
2908        else if (name.equals("complicationDetail")) {
2909          return addComplicationDetail();
2910        }
2911        else if (name.equals("followUp")) {
2912          return addFollowUp();
2913        }
2914        else if (name.equals("note")) {
2915          return addNote();
2916        }
2917        else if (name.equals("focalDevice")) {
2918          return addFocalDevice();
2919        }
2920        else if (name.equals("usedReference")) {
2921          return addUsedReference();
2922        }
2923        else if (name.equals("usedCode")) {
2924          return addUsedCode();
2925        }
2926        else
2927          return super.addChild(name);
2928      }
2929
2930  public String fhirType() {
2931    return "Procedure";
2932
2933  }
2934
2935      public Procedure copy() {
2936        Procedure dst = new Procedure();
2937        copyValues(dst);
2938        if (identifier != null) {
2939          dst.identifier = new ArrayList<Identifier>();
2940          for (Identifier i : identifier)
2941            dst.identifier.add(i.copy());
2942        };
2943        if (instantiatesCanonical != null) {
2944          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2945          for (CanonicalType i : instantiatesCanonical)
2946            dst.instantiatesCanonical.add(i.copy());
2947        };
2948        if (instantiatesUri != null) {
2949          dst.instantiatesUri = new ArrayList<UriType>();
2950          for (UriType i : instantiatesUri)
2951            dst.instantiatesUri.add(i.copy());
2952        };
2953        if (basedOn != null) {
2954          dst.basedOn = new ArrayList<Reference>();
2955          for (Reference i : basedOn)
2956            dst.basedOn.add(i.copy());
2957        };
2958        if (partOf != null) {
2959          dst.partOf = new ArrayList<Reference>();
2960          for (Reference i : partOf)
2961            dst.partOf.add(i.copy());
2962        };
2963        dst.status = status == null ? null : status.copy();
2964        dst.statusReason = statusReason == null ? null : statusReason.copy();
2965        dst.category = category == null ? null : category.copy();
2966        dst.code = code == null ? null : code.copy();
2967        dst.subject = subject == null ? null : subject.copy();
2968        dst.context = context == null ? null : context.copy();
2969        dst.performed = performed == null ? null : performed.copy();
2970        dst.recorder = recorder == null ? null : recorder.copy();
2971        dst.asserter = asserter == null ? null : asserter.copy();
2972        if (performer != null) {
2973          dst.performer = new ArrayList<ProcedurePerformerComponent>();
2974          for (ProcedurePerformerComponent i : performer)
2975            dst.performer.add(i.copy());
2976        };
2977        dst.location = location == null ? null : location.copy();
2978        if (reasonCode != null) {
2979          dst.reasonCode = new ArrayList<CodeableConcept>();
2980          for (CodeableConcept i : reasonCode)
2981            dst.reasonCode.add(i.copy());
2982        };
2983        if (reasonReference != null) {
2984          dst.reasonReference = new ArrayList<Reference>();
2985          for (Reference i : reasonReference)
2986            dst.reasonReference.add(i.copy());
2987        };
2988        if (bodySite != null) {
2989          dst.bodySite = new ArrayList<CodeableConcept>();
2990          for (CodeableConcept i : bodySite)
2991            dst.bodySite.add(i.copy());
2992        };
2993        dst.outcome = outcome == null ? null : outcome.copy();
2994        if (report != null) {
2995          dst.report = new ArrayList<Reference>();
2996          for (Reference i : report)
2997            dst.report.add(i.copy());
2998        };
2999        if (complication != null) {
3000          dst.complication = new ArrayList<CodeableConcept>();
3001          for (CodeableConcept i : complication)
3002            dst.complication.add(i.copy());
3003        };
3004        if (complicationDetail != null) {
3005          dst.complicationDetail = new ArrayList<Reference>();
3006          for (Reference i : complicationDetail)
3007            dst.complicationDetail.add(i.copy());
3008        };
3009        if (followUp != null) {
3010          dst.followUp = new ArrayList<CodeableConcept>();
3011          for (CodeableConcept i : followUp)
3012            dst.followUp.add(i.copy());
3013        };
3014        if (note != null) {
3015          dst.note = new ArrayList<Annotation>();
3016          for (Annotation i : note)
3017            dst.note.add(i.copy());
3018        };
3019        if (focalDevice != null) {
3020          dst.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
3021          for (ProcedureFocalDeviceComponent i : focalDevice)
3022            dst.focalDevice.add(i.copy());
3023        };
3024        if (usedReference != null) {
3025          dst.usedReference = new ArrayList<Reference>();
3026          for (Reference i : usedReference)
3027            dst.usedReference.add(i.copy());
3028        };
3029        if (usedCode != null) {
3030          dst.usedCode = new ArrayList<CodeableConcept>();
3031          for (CodeableConcept i : usedCode)
3032            dst.usedCode.add(i.copy());
3033        };
3034        return dst;
3035      }
3036
3037      protected Procedure typedCopy() {
3038        return copy();
3039      }
3040
3041      @Override
3042      public boolean equalsDeep(Base other_) {
3043        if (!super.equalsDeep(other_))
3044          return false;
3045        if (!(other_ instanceof Procedure))
3046          return false;
3047        Procedure o = (Procedure) other_;
3048        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
3049           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
3050           && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
3051           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
3052           && compareDeep(context, o.context, true) && compareDeep(performed, o.performed, true) && compareDeep(recorder, o.recorder, true)
3053           && compareDeep(asserter, o.asserter, true) && compareDeep(performer, o.performer, true) && compareDeep(location, o.location, true)
3054           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
3055           && compareDeep(bodySite, o.bodySite, true) && compareDeep(outcome, o.outcome, true) && compareDeep(report, o.report, true)
3056           && compareDeep(complication, o.complication, true) && compareDeep(complicationDetail, o.complicationDetail, true)
3057           && compareDeep(followUp, o.followUp, true) && compareDeep(note, o.note, true) && compareDeep(focalDevice, o.focalDevice, true)
3058           && compareDeep(usedReference, o.usedReference, true) && compareDeep(usedCode, o.usedCode, true)
3059          ;
3060      }
3061
3062      @Override
3063      public boolean equalsShallow(Base other_) {
3064        if (!super.equalsShallow(other_))
3065          return false;
3066        if (!(other_ instanceof Procedure))
3067          return false;
3068        Procedure o = (Procedure) other_;
3069        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
3070          ;
3071      }
3072
3073      public boolean isEmpty() {
3074        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
3075          , instantiatesUri, basedOn, partOf, status, statusReason, category, code, subject
3076          , context, performed, recorder, asserter, performer, location, reasonCode, reasonReference
3077          , bodySite, outcome, report, complication, complicationDetail, followUp, note
3078          , focalDevice, usedReference, usedCode);
3079      }
3080
3081  @Override
3082  public ResourceType getResourceType() {
3083    return ResourceType.Procedure;
3084   }
3085
3086 /**
3087   * Search parameter: <b>date</b>
3088   * <p>
3089   * Description: <b>When the procedure was performed</b><br>
3090   * Type: <b>date</b><br>
3091   * Path: <b>Procedure.performed[x]</b><br>
3092   * </p>
3093   */
3094  @SearchParamDefinition(name="date", path="Procedure.performed", description="When the procedure was performed", type="date" )
3095  public static final String SP_DATE = "date";
3096 /**
3097   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3098   * <p>
3099   * Description: <b>When the procedure was performed</b><br>
3100   * Type: <b>date</b><br>
3101   * Path: <b>Procedure.performed[x]</b><br>
3102   * </p>
3103   */
3104  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3105
3106 /**
3107   * Search parameter: <b>identifier</b>
3108   * <p>
3109   * Description: <b>A unique identifier for a procedure</b><br>
3110   * Type: <b>token</b><br>
3111   * Path: <b>Procedure.identifier</b><br>
3112   * </p>
3113   */
3114  @SearchParamDefinition(name="identifier", path="Procedure.identifier", description="A unique identifier for a procedure", type="token" )
3115  public static final String SP_IDENTIFIER = "identifier";
3116 /**
3117   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3118   * <p>
3119   * Description: <b>A unique identifier for a procedure</b><br>
3120   * Type: <b>token</b><br>
3121   * Path: <b>Procedure.identifier</b><br>
3122   * </p>
3123   */
3124  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3125
3126 /**
3127   * Search parameter: <b>code</b>
3128   * <p>
3129   * Description: <b>A code to identify a  procedure</b><br>
3130   * Type: <b>token</b><br>
3131   * Path: <b>Procedure.code</b><br>
3132   * </p>
3133   */
3134  @SearchParamDefinition(name="code", path="Procedure.code", description="A code to identify a  procedure", type="token" )
3135  public static final String SP_CODE = "code";
3136 /**
3137   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3138   * <p>
3139   * Description: <b>A code to identify a  procedure</b><br>
3140   * Type: <b>token</b><br>
3141   * Path: <b>Procedure.code</b><br>
3142   * </p>
3143   */
3144  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3145
3146 /**
3147   * Search parameter: <b>performer</b>
3148   * <p>
3149   * Description: <b>The reference to the practitioner</b><br>
3150   * Type: <b>reference</b><br>
3151   * Path: <b>Procedure.performer.actor</b><br>
3152   * </p>
3153   */
3154  @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 } )
3155  public static final String SP_PERFORMER = "performer";
3156 /**
3157   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3158   * <p>
3159   * Description: <b>The reference to the practitioner</b><br>
3160   * Type: <b>reference</b><br>
3161   * Path: <b>Procedure.performer.actor</b><br>
3162   * </p>
3163   */
3164  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
3165
3166/**
3167   * Constant for fluent queries to be used to add include statements. Specifies
3168   * the path value of "<b>Procedure:performer</b>".
3169   */
3170  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("Procedure:performer").toLocked();
3171
3172 /**
3173   * Search parameter: <b>subject</b>
3174   * <p>
3175   * Description: <b>Search by subject</b><br>
3176   * Type: <b>reference</b><br>
3177   * Path: <b>Procedure.subject</b><br>
3178   * </p>
3179   */
3180  @SearchParamDefinition(name="subject", path="Procedure.subject", description="Search by subject", type="reference", target={Group.class, Patient.class } )
3181  public static final String SP_SUBJECT = "subject";
3182 /**
3183   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3184   * <p>
3185   * Description: <b>Search by subject</b><br>
3186   * Type: <b>reference</b><br>
3187   * Path: <b>Procedure.subject</b><br>
3188   * </p>
3189   */
3190  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3191
3192/**
3193   * Constant for fluent queries to be used to add include statements. Specifies
3194   * the path value of "<b>Procedure:subject</b>".
3195   */
3196  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Procedure:subject").toLocked();
3197
3198 /**
3199   * Search parameter: <b>instantiates-canonical</b>
3200   * <p>
3201   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3202   * Type: <b>reference</b><br>
3203   * Path: <b>Procedure.instantiatesCanonical</b><br>
3204   * </p>
3205   */
3206  @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 } )
3207  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
3208 /**
3209   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
3210   * <p>
3211   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3212   * Type: <b>reference</b><br>
3213   * Path: <b>Procedure.instantiatesCanonical</b><br>
3214   * </p>
3215   */
3216  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
3217
3218/**
3219   * Constant for fluent queries to be used to add include statements. Specifies
3220   * the path value of "<b>Procedure:instantiates-canonical</b>".
3221   */
3222  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("Procedure:instantiates-canonical").toLocked();
3223
3224 /**
3225   * Search parameter: <b>part-of</b>
3226   * <p>
3227   * Description: <b>Part of referenced event</b><br>
3228   * Type: <b>reference</b><br>
3229   * Path: <b>Procedure.partOf</b><br>
3230   * </p>
3231   */
3232  @SearchParamDefinition(name="part-of", path="Procedure.partOf", description="Part of referenced event", type="reference", target={MedicationAdministration.class, Observation.class, Procedure.class } )
3233  public static final String SP_PART_OF = "part-of";
3234 /**
3235   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
3236   * <p>
3237   * Description: <b>Part of referenced event</b><br>
3238   * Type: <b>reference</b><br>
3239   * Path: <b>Procedure.partOf</b><br>
3240   * </p>
3241   */
3242  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
3243
3244/**
3245   * Constant for fluent queries to be used to add include statements. Specifies
3246   * the path value of "<b>Procedure:part-of</b>".
3247   */
3248  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Procedure:part-of").toLocked();
3249
3250 /**
3251   * Search parameter: <b>encounter</b>
3252   * <p>
3253   * Description: <b>Search by encounter</b><br>
3254   * Type: <b>reference</b><br>
3255   * Path: <b>Procedure.context</b><br>
3256   * </p>
3257   */
3258  @SearchParamDefinition(name="encounter", path="Procedure.context.where(resolve() is Encounter)", description="Search by encounter", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
3259  public static final String SP_ENCOUNTER = "encounter";
3260 /**
3261   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3262   * <p>
3263   * Description: <b>Search by encounter</b><br>
3264   * Type: <b>reference</b><br>
3265   * Path: <b>Procedure.context</b><br>
3266   * </p>
3267   */
3268  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3269
3270/**
3271   * Constant for fluent queries to be used to add include statements. Specifies
3272   * the path value of "<b>Procedure:encounter</b>".
3273   */
3274  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Procedure:encounter").toLocked();
3275
3276 /**
3277   * Search parameter: <b>reason-code</b>
3278   * <p>
3279   * Description: <b>Coded reason procedure performed</b><br>
3280   * Type: <b>token</b><br>
3281   * Path: <b>Procedure.reasonCode</b><br>
3282   * </p>
3283   */
3284  @SearchParamDefinition(name="reason-code", path="Procedure.reasonCode", description="Coded reason procedure performed", type="token" )
3285  public static final String SP_REASON_CODE = "reason-code";
3286 /**
3287   * <b>Fluent Client</b> search parameter constant for <b>reason-code</b>
3288   * <p>
3289   * Description: <b>Coded reason procedure performed</b><br>
3290   * Type: <b>token</b><br>
3291   * Path: <b>Procedure.reasonCode</b><br>
3292   * </p>
3293   */
3294  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_CODE);
3295
3296 /**
3297   * Search parameter: <b>based-on</b>
3298   * <p>
3299   * Description: <b>A request for this procedure</b><br>
3300   * Type: <b>reference</b><br>
3301   * Path: <b>Procedure.basedOn</b><br>
3302   * </p>
3303   */
3304  @SearchParamDefinition(name="based-on", path="Procedure.basedOn", description="A request for this procedure", type="reference", target={CarePlan.class, ServiceRequest.class } )
3305  public static final String SP_BASED_ON = "based-on";
3306 /**
3307   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
3308   * <p>
3309   * Description: <b>A request for this procedure</b><br>
3310   * Type: <b>reference</b><br>
3311   * Path: <b>Procedure.basedOn</b><br>
3312   * </p>
3313   */
3314  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
3315
3316/**
3317   * Constant for fluent queries to be used to add include statements. Specifies
3318   * the path value of "<b>Procedure:based-on</b>".
3319   */
3320  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Procedure:based-on").toLocked();
3321
3322 /**
3323   * Search parameter: <b>patient</b>
3324   * <p>
3325   * Description: <b>Search by subject - a patient</b><br>
3326   * Type: <b>reference</b><br>
3327   * Path: <b>Procedure.subject</b><br>
3328   * </p>
3329   */
3330  @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 } )
3331  public static final String SP_PATIENT = "patient";
3332 /**
3333   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3334   * <p>
3335   * Description: <b>Search by subject - a patient</b><br>
3336   * Type: <b>reference</b><br>
3337   * Path: <b>Procedure.subject</b><br>
3338   * </p>
3339   */
3340  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3341
3342/**
3343   * Constant for fluent queries to be used to add include statements. Specifies
3344   * the path value of "<b>Procedure:patient</b>".
3345   */
3346  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Procedure:patient").toLocked();
3347
3348 /**
3349   * Search parameter: <b>context</b>
3350   * <p>
3351   * Description: <b>Encounter or episode associated with the procedure</b><br>
3352   * Type: <b>reference</b><br>
3353   * Path: <b>Procedure.context</b><br>
3354   * </p>
3355   */
3356  @SearchParamDefinition(name="context", path="Procedure.context", description="Encounter or episode associated with the procedure", type="reference", target={Encounter.class, EpisodeOfCare.class } )
3357  public static final String SP_CONTEXT = "context";
3358 /**
3359   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3360   * <p>
3361   * Description: <b>Encounter or episode associated with the procedure</b><br>
3362   * Type: <b>reference</b><br>
3363   * Path: <b>Procedure.context</b><br>
3364   * </p>
3365   */
3366  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
3367
3368/**
3369   * Constant for fluent queries to be used to add include statements. Specifies
3370   * the path value of "<b>Procedure:context</b>".
3371   */
3372  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("Procedure:context").toLocked();
3373
3374 /**
3375   * Search parameter: <b>reason-reference</b>
3376   * <p>
3377   * Description: <b>The justification that the procedure was performed</b><br>
3378   * Type: <b>reference</b><br>
3379   * Path: <b>Procedure.reasonReference</b><br>
3380   * </p>
3381   */
3382  @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 } )
3383  public static final String SP_REASON_REFERENCE = "reason-reference";
3384 /**
3385   * <b>Fluent Client</b> search parameter constant for <b>reason-reference</b>
3386   * <p>
3387   * Description: <b>The justification that the procedure was performed</b><br>
3388   * Type: <b>reference</b><br>
3389   * Path: <b>Procedure.reasonReference</b><br>
3390   * </p>
3391   */
3392  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REASON_REFERENCE);
3393
3394/**
3395   * Constant for fluent queries to be used to add include statements. Specifies
3396   * the path value of "<b>Procedure:reason-reference</b>".
3397   */
3398  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_REFERENCE = new ca.uhn.fhir.model.api.Include("Procedure:reason-reference").toLocked();
3399
3400 /**
3401   * Search parameter: <b>location</b>
3402   * <p>
3403   * Description: <b>Where the procedure happened</b><br>
3404   * Type: <b>reference</b><br>
3405   * Path: <b>Procedure.location</b><br>
3406   * </p>
3407   */
3408  @SearchParamDefinition(name="location", path="Procedure.location", description="Where the procedure happened", type="reference", target={Location.class } )
3409  public static final String SP_LOCATION = "location";
3410 /**
3411   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3412   * <p>
3413   * Description: <b>Where the procedure happened</b><br>
3414   * Type: <b>reference</b><br>
3415   * Path: <b>Procedure.location</b><br>
3416   * </p>
3417   */
3418  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3419
3420/**
3421   * Constant for fluent queries to be used to add include statements. Specifies
3422   * the path value of "<b>Procedure:location</b>".
3423   */
3424  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Procedure:location").toLocked();
3425
3426 /**
3427   * Search parameter: <b>instantiates-uri</b>
3428   * <p>
3429   * Description: <b>Instantiates external protocol or definition</b><br>
3430   * Type: <b>uri</b><br>
3431   * Path: <b>Procedure.instantiatesUri</b><br>
3432   * </p>
3433   */
3434  @SearchParamDefinition(name="instantiates-uri", path="Procedure.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
3435  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
3436 /**
3437   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
3438   * <p>
3439   * Description: <b>Instantiates external protocol or definition</b><br>
3440   * Type: <b>uri</b><br>
3441   * Path: <b>Procedure.instantiatesUri</b><br>
3442   * </p>
3443   */
3444  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
3445
3446 /**
3447   * Search parameter: <b>category</b>
3448   * <p>
3449   * Description: <b>Classification of the procedure</b><br>
3450   * Type: <b>token</b><br>
3451   * Path: <b>Procedure.category</b><br>
3452   * </p>
3453   */
3454  @SearchParamDefinition(name="category", path="Procedure.category", description="Classification of the procedure", type="token" )
3455  public static final String SP_CATEGORY = "category";
3456 /**
3457   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3458   * <p>
3459   * Description: <b>Classification of the procedure</b><br>
3460   * Type: <b>token</b><br>
3461   * Path: <b>Procedure.category</b><br>
3462   * </p>
3463   */
3464  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3465
3466 /**
3467   * Search parameter: <b>status</b>
3468   * <p>
3469   * Description: <b>preparation | in-progress | not-done | suspended | aborted | completed | entered-in-error | unknown</b><br>
3470   * Type: <b>token</b><br>
3471   * Path: <b>Procedure.status</b><br>
3472   * </p>
3473   */
3474  @SearchParamDefinition(name="status", path="Procedure.status", description="preparation | in-progress | not-done | suspended | aborted | completed | entered-in-error | unknown", type="token" )
3475  public static final String SP_STATUS = "status";
3476 /**
3477   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3478   * <p>
3479   * Description: <b>preparation | in-progress | not-done | suspended | aborted | completed | entered-in-error | unknown</b><br>
3480   * Type: <b>token</b><br>
3481   * Path: <b>Procedure.status</b><br>
3482   * </p>
3483   */
3484  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3485
3486
3487}
3488