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