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