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