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