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