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