001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045/**
046 * A record of a request for a diagnostic investigation service to be performed.
047 */
048@ResourceDef(name="DiagnosticOrder", profile="http://hl7.org/fhir/Profile/DiagnosticOrder")
049public class DiagnosticOrder extends DomainResource {
050
051    public enum DiagnosticOrderStatus {
052        /**
053         * The request has been proposed.
054         */
055        PROPOSED, 
056        /**
057         * The request is in preliminary form prior to being sent.
058         */
059        DRAFT, 
060        /**
061         * The request has been planned.
062         */
063        PLANNED, 
064        /**
065         * The request has been placed.
066         */
067        REQUESTED, 
068        /**
069         * The receiving system has received the order, but not yet decided whether it will be performed.
070         */
071        RECEIVED, 
072        /**
073         * The receiving system has accepted the order, but work has not yet commenced.
074         */
075        ACCEPTED, 
076        /**
077         * The work to fulfill the order is happening.
078         */
079        INPROGRESS, 
080        /**
081         * The work is complete, and the outcomes are being reviewed for approval.
082         */
083        REVIEW, 
084        /**
085         * The work has been completed, the report(s) released, and no further work is planned.
086         */
087        COMPLETED, 
088        /**
089         * The request has been withdrawn.
090         */
091        CANCELLED, 
092        /**
093         * The request has been held by originating system/user request.
094         */
095        SUSPENDED, 
096        /**
097         * The receiving system has declined to fulfill the request.
098         */
099        REJECTED, 
100        /**
101         * The diagnostic investigation was attempted, but due to some procedural error, it could not be completed.
102         */
103        FAILED, 
104        /**
105         * The request was entered in error and voided.
106         */
107        ENTEREDINERROR, 
108        /**
109         * added to help the parsers
110         */
111        NULL;
112        public static DiagnosticOrderStatus fromCode(String codeString) throws FHIRException {
113            if (codeString == null || "".equals(codeString))
114                return null;
115        if ("proposed".equals(codeString))
116          return PROPOSED;
117        if ("draft".equals(codeString))
118          return DRAFT;
119        if ("planned".equals(codeString))
120          return PLANNED;
121        if ("requested".equals(codeString))
122          return REQUESTED;
123        if ("received".equals(codeString))
124          return RECEIVED;
125        if ("accepted".equals(codeString))
126          return ACCEPTED;
127        if ("in-progress".equals(codeString))
128          return INPROGRESS;
129        if ("review".equals(codeString))
130          return REVIEW;
131        if ("completed".equals(codeString))
132          return COMPLETED;
133        if ("cancelled".equals(codeString))
134          return CANCELLED;
135        if ("suspended".equals(codeString))
136          return SUSPENDED;
137        if ("rejected".equals(codeString))
138          return REJECTED;
139        if ("failed".equals(codeString))
140          return FAILED;
141        if ("entered-in-error".equals(codeString))
142          return ENTEREDINERROR;
143        throw new FHIRException("Unknown DiagnosticOrderStatus code '"+codeString+"'");
144        }
145        public String toCode() {
146          switch (this) {
147            case PROPOSED: return "proposed";
148            case DRAFT: return "draft";
149            case PLANNED: return "planned";
150            case REQUESTED: return "requested";
151            case RECEIVED: return "received";
152            case ACCEPTED: return "accepted";
153            case INPROGRESS: return "in-progress";
154            case REVIEW: return "review";
155            case COMPLETED: return "completed";
156            case CANCELLED: return "cancelled";
157            case SUSPENDED: return "suspended";
158            case REJECTED: return "rejected";
159            case FAILED: return "failed";
160            case ENTEREDINERROR: return "entered-in-error";
161            default: return "?";
162          }
163        }
164        public String getSystem() {
165          switch (this) {
166            case PROPOSED: return "http://hl7.org/fhir/diagnostic-order-status";
167            case DRAFT: return "http://hl7.org/fhir/diagnostic-order-status";
168            case PLANNED: return "http://hl7.org/fhir/diagnostic-order-status";
169            case REQUESTED: return "http://hl7.org/fhir/diagnostic-order-status";
170            case RECEIVED: return "http://hl7.org/fhir/diagnostic-order-status";
171            case ACCEPTED: return "http://hl7.org/fhir/diagnostic-order-status";
172            case INPROGRESS: return "http://hl7.org/fhir/diagnostic-order-status";
173            case REVIEW: return "http://hl7.org/fhir/diagnostic-order-status";
174            case COMPLETED: return "http://hl7.org/fhir/diagnostic-order-status";
175            case CANCELLED: return "http://hl7.org/fhir/diagnostic-order-status";
176            case SUSPENDED: return "http://hl7.org/fhir/diagnostic-order-status";
177            case REJECTED: return "http://hl7.org/fhir/diagnostic-order-status";
178            case FAILED: return "http://hl7.org/fhir/diagnostic-order-status";
179            case ENTEREDINERROR: return "http://hl7.org/fhir/diagnostic-order-status";
180            default: return "?";
181          }
182        }
183        public String getDefinition() {
184          switch (this) {
185            case PROPOSED: return "The request has been proposed.";
186            case DRAFT: return "The request is in preliminary form prior to being sent.";
187            case PLANNED: return "The request has been planned.";
188            case REQUESTED: return "The request has been placed.";
189            case RECEIVED: return "The receiving system has received the order, but not yet decided whether it will be performed.";
190            case ACCEPTED: return "The receiving system has accepted the order, but work has not yet commenced.";
191            case INPROGRESS: return "The work to fulfill the order is happening.";
192            case REVIEW: return "The work is complete, and the outcomes are being reviewed for approval.";
193            case COMPLETED: return "The work has been completed, the report(s) released, and no further work is planned.";
194            case CANCELLED: return "The request has been withdrawn.";
195            case SUSPENDED: return "The request has been held by originating system/user request.";
196            case REJECTED: return "The receiving system has declined to fulfill the request.";
197            case FAILED: return "The diagnostic investigation was attempted, but due to some procedural error, it could not be completed.";
198            case ENTEREDINERROR: return "The request was entered in error and voided.";
199            default: return "?";
200          }
201        }
202        public String getDisplay() {
203          switch (this) {
204            case PROPOSED: return "Proposed";
205            case DRAFT: return "Draft";
206            case PLANNED: return "Planned";
207            case REQUESTED: return "Requested";
208            case RECEIVED: return "Received";
209            case ACCEPTED: return "Accepted";
210            case INPROGRESS: return "In-Progress";
211            case REVIEW: return "Review";
212            case COMPLETED: return "Completed";
213            case CANCELLED: return "Cancelled";
214            case SUSPENDED: return "Suspended";
215            case REJECTED: return "Rejected";
216            case FAILED: return "Failed";
217            case ENTEREDINERROR: return "Entered in Error";
218            default: return "?";
219          }
220        }
221    }
222
223  public static class DiagnosticOrderStatusEnumFactory implements EnumFactory<DiagnosticOrderStatus> {
224    public DiagnosticOrderStatus fromCode(String codeString) throws IllegalArgumentException {
225      if (codeString == null || "".equals(codeString))
226            if (codeString == null || "".equals(codeString))
227                return null;
228        if ("proposed".equals(codeString))
229          return DiagnosticOrderStatus.PROPOSED;
230        if ("draft".equals(codeString))
231          return DiagnosticOrderStatus.DRAFT;
232        if ("planned".equals(codeString))
233          return DiagnosticOrderStatus.PLANNED;
234        if ("requested".equals(codeString))
235          return DiagnosticOrderStatus.REQUESTED;
236        if ("received".equals(codeString))
237          return DiagnosticOrderStatus.RECEIVED;
238        if ("accepted".equals(codeString))
239          return DiagnosticOrderStatus.ACCEPTED;
240        if ("in-progress".equals(codeString))
241          return DiagnosticOrderStatus.INPROGRESS;
242        if ("review".equals(codeString))
243          return DiagnosticOrderStatus.REVIEW;
244        if ("completed".equals(codeString))
245          return DiagnosticOrderStatus.COMPLETED;
246        if ("cancelled".equals(codeString))
247          return DiagnosticOrderStatus.CANCELLED;
248        if ("suspended".equals(codeString))
249          return DiagnosticOrderStatus.SUSPENDED;
250        if ("rejected".equals(codeString))
251          return DiagnosticOrderStatus.REJECTED;
252        if ("failed".equals(codeString))
253          return DiagnosticOrderStatus.FAILED;
254        if ("entered-in-error".equals(codeString))
255          return DiagnosticOrderStatus.ENTEREDINERROR;
256        throw new IllegalArgumentException("Unknown DiagnosticOrderStatus code '"+codeString+"'");
257        }
258        public Enumeration<DiagnosticOrderStatus> fromType(Base code) throws FHIRException {
259          if (code == null || code.isEmpty())
260            return null;
261          String codeString = ((PrimitiveType) code).asStringValue();
262          if (codeString == null || "".equals(codeString))
263            return null;
264        if ("proposed".equals(codeString))
265          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.PROPOSED);
266        if ("draft".equals(codeString))
267          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.DRAFT);
268        if ("planned".equals(codeString))
269          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.PLANNED);
270        if ("requested".equals(codeString))
271          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.REQUESTED);
272        if ("received".equals(codeString))
273          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.RECEIVED);
274        if ("accepted".equals(codeString))
275          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.ACCEPTED);
276        if ("in-progress".equals(codeString))
277          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.INPROGRESS);
278        if ("review".equals(codeString))
279          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.REVIEW);
280        if ("completed".equals(codeString))
281          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.COMPLETED);
282        if ("cancelled".equals(codeString))
283          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.CANCELLED);
284        if ("suspended".equals(codeString))
285          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.SUSPENDED);
286        if ("rejected".equals(codeString))
287          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.REJECTED);
288        if ("failed".equals(codeString))
289          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.FAILED);
290        if ("entered-in-error".equals(codeString))
291          return new Enumeration<DiagnosticOrderStatus>(this, DiagnosticOrderStatus.ENTEREDINERROR);
292        throw new FHIRException("Unknown DiagnosticOrderStatus code '"+codeString+"'");
293        }
294    public String toCode(DiagnosticOrderStatus code) {
295      if (code == DiagnosticOrderStatus.PROPOSED)
296        return "proposed";
297      if (code == DiagnosticOrderStatus.DRAFT)
298        return "draft";
299      if (code == DiagnosticOrderStatus.PLANNED)
300        return "planned";
301      if (code == DiagnosticOrderStatus.REQUESTED)
302        return "requested";
303      if (code == DiagnosticOrderStatus.RECEIVED)
304        return "received";
305      if (code == DiagnosticOrderStatus.ACCEPTED)
306        return "accepted";
307      if (code == DiagnosticOrderStatus.INPROGRESS)
308        return "in-progress";
309      if (code == DiagnosticOrderStatus.REVIEW)
310        return "review";
311      if (code == DiagnosticOrderStatus.COMPLETED)
312        return "completed";
313      if (code == DiagnosticOrderStatus.CANCELLED)
314        return "cancelled";
315      if (code == DiagnosticOrderStatus.SUSPENDED)
316        return "suspended";
317      if (code == DiagnosticOrderStatus.REJECTED)
318        return "rejected";
319      if (code == DiagnosticOrderStatus.FAILED)
320        return "failed";
321      if (code == DiagnosticOrderStatus.ENTEREDINERROR)
322        return "entered-in-error";
323      return "?";
324      }
325    public String toSystem(DiagnosticOrderStatus code) {
326      return code.getSystem();
327      }
328    }
329
330    public enum DiagnosticOrderPriority {
331        /**
332         * The order has a normal priority .
333         */
334        ROUTINE, 
335        /**
336         * The order should be urgently.
337         */
338        URGENT, 
339        /**
340         * The order is time-critical.
341         */
342        STAT, 
343        /**
344         * The order should be acted on as soon as possible.
345         */
346        ASAP, 
347        /**
348         * added to help the parsers
349         */
350        NULL;
351        public static DiagnosticOrderPriority fromCode(String codeString) throws FHIRException {
352            if (codeString == null || "".equals(codeString))
353                return null;
354        if ("routine".equals(codeString))
355          return ROUTINE;
356        if ("urgent".equals(codeString))
357          return URGENT;
358        if ("stat".equals(codeString))
359          return STAT;
360        if ("asap".equals(codeString))
361          return ASAP;
362        throw new FHIRException("Unknown DiagnosticOrderPriority code '"+codeString+"'");
363        }
364        public String toCode() {
365          switch (this) {
366            case ROUTINE: return "routine";
367            case URGENT: return "urgent";
368            case STAT: return "stat";
369            case ASAP: return "asap";
370            default: return "?";
371          }
372        }
373        public String getSystem() {
374          switch (this) {
375            case ROUTINE: return "http://hl7.org/fhir/diagnostic-order-priority";
376            case URGENT: return "http://hl7.org/fhir/diagnostic-order-priority";
377            case STAT: return "http://hl7.org/fhir/diagnostic-order-priority";
378            case ASAP: return "http://hl7.org/fhir/diagnostic-order-priority";
379            default: return "?";
380          }
381        }
382        public String getDefinition() {
383          switch (this) {
384            case ROUTINE: return "The order has a normal priority .";
385            case URGENT: return "The order should be urgently.";
386            case STAT: return "The order is time-critical.";
387            case ASAP: return "The order should be acted on as soon as possible.";
388            default: return "?";
389          }
390        }
391        public String getDisplay() {
392          switch (this) {
393            case ROUTINE: return "Routine";
394            case URGENT: return "Urgent";
395            case STAT: return "Stat";
396            case ASAP: return "ASAP";
397            default: return "?";
398          }
399        }
400    }
401
402  public static class DiagnosticOrderPriorityEnumFactory implements EnumFactory<DiagnosticOrderPriority> {
403    public DiagnosticOrderPriority fromCode(String codeString) throws IllegalArgumentException {
404      if (codeString == null || "".equals(codeString))
405            if (codeString == null || "".equals(codeString))
406                return null;
407        if ("routine".equals(codeString))
408          return DiagnosticOrderPriority.ROUTINE;
409        if ("urgent".equals(codeString))
410          return DiagnosticOrderPriority.URGENT;
411        if ("stat".equals(codeString))
412          return DiagnosticOrderPriority.STAT;
413        if ("asap".equals(codeString))
414          return DiagnosticOrderPriority.ASAP;
415        throw new IllegalArgumentException("Unknown DiagnosticOrderPriority code '"+codeString+"'");
416        }
417        public Enumeration<DiagnosticOrderPriority> fromType(Base code) throws FHIRException {
418          if (code == null || code.isEmpty())
419            return null;
420          String codeString = ((PrimitiveType) code).asStringValue();
421          if (codeString == null || "".equals(codeString))
422            return null;
423        if ("routine".equals(codeString))
424          return new Enumeration<DiagnosticOrderPriority>(this, DiagnosticOrderPriority.ROUTINE);
425        if ("urgent".equals(codeString))
426          return new Enumeration<DiagnosticOrderPriority>(this, DiagnosticOrderPriority.URGENT);
427        if ("stat".equals(codeString))
428          return new Enumeration<DiagnosticOrderPriority>(this, DiagnosticOrderPriority.STAT);
429        if ("asap".equals(codeString))
430          return new Enumeration<DiagnosticOrderPriority>(this, DiagnosticOrderPriority.ASAP);
431        throw new FHIRException("Unknown DiagnosticOrderPriority code '"+codeString+"'");
432        }
433    public String toCode(DiagnosticOrderPriority code) {
434      if (code == DiagnosticOrderPriority.ROUTINE)
435        return "routine";
436      if (code == DiagnosticOrderPriority.URGENT)
437        return "urgent";
438      if (code == DiagnosticOrderPriority.STAT)
439        return "stat";
440      if (code == DiagnosticOrderPriority.ASAP)
441        return "asap";
442      return "?";
443      }
444    public String toSystem(DiagnosticOrderPriority code) {
445      return code.getSystem();
446      }
447    }
448
449    @Block()
450    public static class DiagnosticOrderEventComponent extends BackboneElement implements IBaseBackboneElement {
451        /**
452         * The status for the event.
453         */
454        @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
455        @Description(shortDefinition="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", formalDefinition="The status for the event." )
456        protected Enumeration<DiagnosticOrderStatus> status;
457
458        /**
459         * Additional information about the event that occurred - e.g. if the status remained unchanged.
460         */
461        @Child(name = "description", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
462        @Description(shortDefinition="More information about the event and its context", formalDefinition="Additional information about the event that occurred - e.g. if the status remained unchanged." )
463        protected CodeableConcept description;
464
465        /**
466         * The date/time at which the event occurred.
467         */
468        @Child(name = "dateTime", type = {DateTimeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
469        @Description(shortDefinition="The date at which the event happened", formalDefinition="The date/time at which the event occurred." )
470        protected DateTimeType dateTime;
471
472        /**
473         * The person responsible for performing or recording the action.
474         */
475        @Child(name = "actor", type = {Practitioner.class, Device.class}, order=4, min=0, max=1, modifier=false, summary=false)
476        @Description(shortDefinition="Who recorded or did this", formalDefinition="The person responsible for performing or recording the action." )
477        protected Reference actor;
478
479        /**
480         * The actual object that is the target of the reference (The person responsible for performing or recording the action.)
481         */
482        protected Resource actorTarget;
483
484        private static final long serialVersionUID = -370793723L;
485
486    /**
487     * Constructor
488     */
489      public DiagnosticOrderEventComponent() {
490        super();
491      }
492
493    /**
494     * Constructor
495     */
496      public DiagnosticOrderEventComponent(Enumeration<DiagnosticOrderStatus> status, DateTimeType dateTime) {
497        super();
498        this.status = status;
499        this.dateTime = dateTime;
500      }
501
502        /**
503         * @return {@link #status} (The status for the event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
504         */
505        public Enumeration<DiagnosticOrderStatus> getStatusElement() { 
506          if (this.status == null)
507            if (Configuration.errorOnAutoCreate())
508              throw new Error("Attempt to auto-create DiagnosticOrderEventComponent.status");
509            else if (Configuration.doAutoCreate())
510              this.status = new Enumeration<DiagnosticOrderStatus>(new DiagnosticOrderStatusEnumFactory()); // bb
511          return this.status;
512        }
513
514        public boolean hasStatusElement() { 
515          return this.status != null && !this.status.isEmpty();
516        }
517
518        public boolean hasStatus() { 
519          return this.status != null && !this.status.isEmpty();
520        }
521
522        /**
523         * @param value {@link #status} (The status for the event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
524         */
525        public DiagnosticOrderEventComponent setStatusElement(Enumeration<DiagnosticOrderStatus> value) { 
526          this.status = value;
527          return this;
528        }
529
530        /**
531         * @return The status for the event.
532         */
533        public DiagnosticOrderStatus getStatus() { 
534          return this.status == null ? null : this.status.getValue();
535        }
536
537        /**
538         * @param value The status for the event.
539         */
540        public DiagnosticOrderEventComponent setStatus(DiagnosticOrderStatus value) { 
541            if (this.status == null)
542              this.status = new Enumeration<DiagnosticOrderStatus>(new DiagnosticOrderStatusEnumFactory());
543            this.status.setValue(value);
544          return this;
545        }
546
547        /**
548         * @return {@link #description} (Additional information about the event that occurred - e.g. if the status remained unchanged.)
549         */
550        public CodeableConcept getDescription() { 
551          if (this.description == null)
552            if (Configuration.errorOnAutoCreate())
553              throw new Error("Attempt to auto-create DiagnosticOrderEventComponent.description");
554            else if (Configuration.doAutoCreate())
555              this.description = new CodeableConcept(); // cc
556          return this.description;
557        }
558
559        public boolean hasDescription() { 
560          return this.description != null && !this.description.isEmpty();
561        }
562
563        /**
564         * @param value {@link #description} (Additional information about the event that occurred - e.g. if the status remained unchanged.)
565         */
566        public DiagnosticOrderEventComponent setDescription(CodeableConcept value) { 
567          this.description = value;
568          return this;
569        }
570
571        /**
572         * @return {@link #dateTime} (The date/time at which the event occurred.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
573         */
574        public DateTimeType getDateTimeElement() { 
575          if (this.dateTime == null)
576            if (Configuration.errorOnAutoCreate())
577              throw new Error("Attempt to auto-create DiagnosticOrderEventComponent.dateTime");
578            else if (Configuration.doAutoCreate())
579              this.dateTime = new DateTimeType(); // bb
580          return this.dateTime;
581        }
582
583        public boolean hasDateTimeElement() { 
584          return this.dateTime != null && !this.dateTime.isEmpty();
585        }
586
587        public boolean hasDateTime() { 
588          return this.dateTime != null && !this.dateTime.isEmpty();
589        }
590
591        /**
592         * @param value {@link #dateTime} (The date/time at which the event occurred.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
593         */
594        public DiagnosticOrderEventComponent setDateTimeElement(DateTimeType value) { 
595          this.dateTime = value;
596          return this;
597        }
598
599        /**
600         * @return The date/time at which the event occurred.
601         */
602        public Date getDateTime() { 
603          return this.dateTime == null ? null : this.dateTime.getValue();
604        }
605
606        /**
607         * @param value The date/time at which the event occurred.
608         */
609        public DiagnosticOrderEventComponent setDateTime(Date value) { 
610            if (this.dateTime == null)
611              this.dateTime = new DateTimeType();
612            this.dateTime.setValue(value);
613          return this;
614        }
615
616        /**
617         * @return {@link #actor} (The person responsible for performing or recording the action.)
618         */
619        public Reference getActor() { 
620          if (this.actor == null)
621            if (Configuration.errorOnAutoCreate())
622              throw new Error("Attempt to auto-create DiagnosticOrderEventComponent.actor");
623            else if (Configuration.doAutoCreate())
624              this.actor = new Reference(); // cc
625          return this.actor;
626        }
627
628        public boolean hasActor() { 
629          return this.actor != null && !this.actor.isEmpty();
630        }
631
632        /**
633         * @param value {@link #actor} (The person responsible for performing or recording the action.)
634         */
635        public DiagnosticOrderEventComponent setActor(Reference value) { 
636          this.actor = value;
637          return this;
638        }
639
640        /**
641         * @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 person responsible for performing or recording the action.)
642         */
643        public Resource getActorTarget() { 
644          return this.actorTarget;
645        }
646
647        /**
648         * @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 person responsible for performing or recording the action.)
649         */
650        public DiagnosticOrderEventComponent setActorTarget(Resource value) { 
651          this.actorTarget = value;
652          return this;
653        }
654
655        protected void listChildren(List<Property> childrenList) {
656          super.listChildren(childrenList);
657          childrenList.add(new Property("status", "code", "The status for the event.", 0, java.lang.Integer.MAX_VALUE, status));
658          childrenList.add(new Property("description", "CodeableConcept", "Additional information about the event that occurred - e.g. if the status remained unchanged.", 0, java.lang.Integer.MAX_VALUE, description));
659          childrenList.add(new Property("dateTime", "dateTime", "The date/time at which the event occurred.", 0, java.lang.Integer.MAX_VALUE, dateTime));
660          childrenList.add(new Property("actor", "Reference(Practitioner|Device)", "The person responsible for performing or recording the action.", 0, java.lang.Integer.MAX_VALUE, actor));
661        }
662
663      @Override
664      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
665        switch (hash) {
666        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DiagnosticOrderStatus>
667        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // CodeableConcept
668        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
669        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
670        default: return super.getProperty(hash, name, checkValid);
671        }
672
673      }
674
675      @Override
676      public void setProperty(int hash, String name, Base value) throws FHIRException {
677        switch (hash) {
678        case -892481550: // status
679          this.status = new DiagnosticOrderStatusEnumFactory().fromType(value); // Enumeration<DiagnosticOrderStatus>
680          break;
681        case -1724546052: // description
682          this.description = castToCodeableConcept(value); // CodeableConcept
683          break;
684        case 1792749467: // dateTime
685          this.dateTime = castToDateTime(value); // DateTimeType
686          break;
687        case 92645877: // actor
688          this.actor = castToReference(value); // Reference
689          break;
690        default: super.setProperty(hash, name, value);
691        }
692
693      }
694
695      @Override
696      public void setProperty(String name, Base value) throws FHIRException {
697        if (name.equals("status"))
698          this.status = new DiagnosticOrderStatusEnumFactory().fromType(value); // Enumeration<DiagnosticOrderStatus>
699        else if (name.equals("description"))
700          this.description = castToCodeableConcept(value); // CodeableConcept
701        else if (name.equals("dateTime"))
702          this.dateTime = castToDateTime(value); // DateTimeType
703        else if (name.equals("actor"))
704          this.actor = castToReference(value); // Reference
705        else
706          super.setProperty(name, value);
707      }
708
709      @Override
710      public Base makeProperty(int hash, String name) throws FHIRException {
711        switch (hash) {
712        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<DiagnosticOrderStatus>
713        case -1724546052:  return getDescription(); // CodeableConcept
714        case 1792749467: throw new FHIRException("Cannot make property dateTime as it is not a complex type"); // DateTimeType
715        case 92645877:  return getActor(); // Reference
716        default: return super.makeProperty(hash, name);
717        }
718
719      }
720
721      @Override
722      public Base addChild(String name) throws FHIRException {
723        if (name.equals("status")) {
724          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticOrder.status");
725        }
726        else if (name.equals("description")) {
727          this.description = new CodeableConcept();
728          return this.description;
729        }
730        else if (name.equals("dateTime")) {
731          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticOrder.dateTime");
732        }
733        else if (name.equals("actor")) {
734          this.actor = new Reference();
735          return this.actor;
736        }
737        else
738          return super.addChild(name);
739      }
740
741      public DiagnosticOrderEventComponent copy() {
742        DiagnosticOrderEventComponent dst = new DiagnosticOrderEventComponent();
743        copyValues(dst);
744        dst.status = status == null ? null : status.copy();
745        dst.description = description == null ? null : description.copy();
746        dst.dateTime = dateTime == null ? null : dateTime.copy();
747        dst.actor = actor == null ? null : actor.copy();
748        return dst;
749      }
750
751      @Override
752      public boolean equalsDeep(Base other) {
753        if (!super.equalsDeep(other))
754          return false;
755        if (!(other instanceof DiagnosticOrderEventComponent))
756          return false;
757        DiagnosticOrderEventComponent o = (DiagnosticOrderEventComponent) other;
758        return compareDeep(status, o.status, true) && compareDeep(description, o.description, true) && compareDeep(dateTime, o.dateTime, true)
759           && compareDeep(actor, o.actor, true);
760      }
761
762      @Override
763      public boolean equalsShallow(Base other) {
764        if (!super.equalsShallow(other))
765          return false;
766        if (!(other instanceof DiagnosticOrderEventComponent))
767          return false;
768        DiagnosticOrderEventComponent o = (DiagnosticOrderEventComponent) other;
769        return compareValues(status, o.status, true) && compareValues(dateTime, o.dateTime, true);
770      }
771
772      public boolean isEmpty() {
773        return super.isEmpty() && (status == null || status.isEmpty()) && (description == null || description.isEmpty())
774           && (dateTime == null || dateTime.isEmpty()) && (actor == null || actor.isEmpty());
775      }
776
777  public String fhirType() {
778    return "DiagnosticOrder.event";
779
780  }
781
782  }
783
784    @Block()
785    public static class DiagnosticOrderItemComponent extends BackboneElement implements IBaseBackboneElement {
786        /**
787         * A code that identifies a particular diagnostic investigation, or panel of investigations, that have been requested.
788         */
789        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
790        @Description(shortDefinition="Code to indicate the item (test or panel) being ordered", formalDefinition="A code that identifies a particular diagnostic investigation, or panel of investigations, that have been requested." )
791        protected CodeableConcept code;
792
793        /**
794         * If the item is related to a specific specimen.
795         */
796        @Child(name = "specimen", type = {Specimen.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
797        @Description(shortDefinition="If this item relates to specific specimens", formalDefinition="If the item is related to a specific specimen." )
798        protected List<Reference> specimen;
799        /**
800         * The actual objects that are the target of the reference (If the item is related to a specific specimen.)
801         */
802        protected List<Specimen> specimenTarget;
803
804
805        /**
806         * Anatomical location where the request test should be performed.  This is the target site.
807         */
808        @Child(name = "bodySite", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
809        @Description(shortDefinition="Location of requested test (if applicable)", formalDefinition="Anatomical location where the request test should be performed.  This is the target site." )
810        protected CodeableConcept bodySite;
811
812        /**
813         * The status of this individual item within the order.
814         */
815        @Child(name = "status", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
816        @Description(shortDefinition="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", formalDefinition="The status of this individual item within the order." )
817        protected Enumeration<DiagnosticOrderStatus> status;
818
819        /**
820         * A summary of the events of interest that have occurred as this item of the request is processed.
821         */
822        @Child(name = "event", type = {DiagnosticOrderEventComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
823        @Description(shortDefinition="Events specific to this item", formalDefinition="A summary of the events of interest that have occurred as this item of the request is processed." )
824        protected List<DiagnosticOrderEventComponent> event;
825
826        private static final long serialVersionUID = 381238192L;
827
828    /**
829     * Constructor
830     */
831      public DiagnosticOrderItemComponent() {
832        super();
833      }
834
835    /**
836     * Constructor
837     */
838      public DiagnosticOrderItemComponent(CodeableConcept code) {
839        super();
840        this.code = code;
841      }
842
843        /**
844         * @return {@link #code} (A code that identifies a particular diagnostic investigation, or panel of investigations, that have been requested.)
845         */
846        public CodeableConcept getCode() { 
847          if (this.code == null)
848            if (Configuration.errorOnAutoCreate())
849              throw new Error("Attempt to auto-create DiagnosticOrderItemComponent.code");
850            else if (Configuration.doAutoCreate())
851              this.code = new CodeableConcept(); // cc
852          return this.code;
853        }
854
855        public boolean hasCode() { 
856          return this.code != null && !this.code.isEmpty();
857        }
858
859        /**
860         * @param value {@link #code} (A code that identifies a particular diagnostic investigation, or panel of investigations, that have been requested.)
861         */
862        public DiagnosticOrderItemComponent setCode(CodeableConcept value) { 
863          this.code = value;
864          return this;
865        }
866
867        /**
868         * @return {@link #specimen} (If the item is related to a specific specimen.)
869         */
870        public List<Reference> getSpecimen() { 
871          if (this.specimen == null)
872            this.specimen = new ArrayList<Reference>();
873          return this.specimen;
874        }
875
876        public boolean hasSpecimen() { 
877          if (this.specimen == null)
878            return false;
879          for (Reference item : this.specimen)
880            if (!item.isEmpty())
881              return true;
882          return false;
883        }
884
885        /**
886         * @return {@link #specimen} (If the item is related to a specific specimen.)
887         */
888    // syntactic sugar
889        public Reference addSpecimen() { //3
890          Reference t = new Reference();
891          if (this.specimen == null)
892            this.specimen = new ArrayList<Reference>();
893          this.specimen.add(t);
894          return t;
895        }
896
897    // syntactic sugar
898        public DiagnosticOrderItemComponent addSpecimen(Reference t) { //3
899          if (t == null)
900            return this;
901          if (this.specimen == null)
902            this.specimen = new ArrayList<Reference>();
903          this.specimen.add(t);
904          return this;
905        }
906
907        /**
908         * @return {@link #specimen} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. If the item is related to a specific specimen.)
909         */
910        public List<Specimen> getSpecimenTarget() { 
911          if (this.specimenTarget == null)
912            this.specimenTarget = new ArrayList<Specimen>();
913          return this.specimenTarget;
914        }
915
916    // syntactic sugar
917        /**
918         * @return {@link #specimen} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. If the item is related to a specific specimen.)
919         */
920        public Specimen addSpecimenTarget() { 
921          Specimen r = new Specimen();
922          if (this.specimenTarget == null)
923            this.specimenTarget = new ArrayList<Specimen>();
924          this.specimenTarget.add(r);
925          return r;
926        }
927
928        /**
929         * @return {@link #bodySite} (Anatomical location where the request test should be performed.  This is the target site.)
930         */
931        public CodeableConcept getBodySite() { 
932          if (this.bodySite == null)
933            if (Configuration.errorOnAutoCreate())
934              throw new Error("Attempt to auto-create DiagnosticOrderItemComponent.bodySite");
935            else if (Configuration.doAutoCreate())
936              this.bodySite = new CodeableConcept(); // cc
937          return this.bodySite;
938        }
939
940        public boolean hasBodySite() { 
941          return this.bodySite != null && !this.bodySite.isEmpty();
942        }
943
944        /**
945         * @param value {@link #bodySite} (Anatomical location where the request test should be performed.  This is the target site.)
946         */
947        public DiagnosticOrderItemComponent setBodySite(CodeableConcept value) { 
948          this.bodySite = value;
949          return this;
950        }
951
952        /**
953         * @return {@link #status} (The status of this individual item within the order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
954         */
955        public Enumeration<DiagnosticOrderStatus> getStatusElement() { 
956          if (this.status == null)
957            if (Configuration.errorOnAutoCreate())
958              throw new Error("Attempt to auto-create DiagnosticOrderItemComponent.status");
959            else if (Configuration.doAutoCreate())
960              this.status = new Enumeration<DiagnosticOrderStatus>(new DiagnosticOrderStatusEnumFactory()); // bb
961          return this.status;
962        }
963
964        public boolean hasStatusElement() { 
965          return this.status != null && !this.status.isEmpty();
966        }
967
968        public boolean hasStatus() { 
969          return this.status != null && !this.status.isEmpty();
970        }
971
972        /**
973         * @param value {@link #status} (The status of this individual item within the order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
974         */
975        public DiagnosticOrderItemComponent setStatusElement(Enumeration<DiagnosticOrderStatus> value) { 
976          this.status = value;
977          return this;
978        }
979
980        /**
981         * @return The status of this individual item within the order.
982         */
983        public DiagnosticOrderStatus getStatus() { 
984          return this.status == null ? null : this.status.getValue();
985        }
986
987        /**
988         * @param value The status of this individual item within the order.
989         */
990        public DiagnosticOrderItemComponent setStatus(DiagnosticOrderStatus value) { 
991          if (value == null)
992            this.status = null;
993          else {
994            if (this.status == null)
995              this.status = new Enumeration<DiagnosticOrderStatus>(new DiagnosticOrderStatusEnumFactory());
996            this.status.setValue(value);
997          }
998          return this;
999        }
1000
1001        /**
1002         * @return {@link #event} (A summary of the events of interest that have occurred as this item of the request is processed.)
1003         */
1004        public List<DiagnosticOrderEventComponent> getEvent() { 
1005          if (this.event == null)
1006            this.event = new ArrayList<DiagnosticOrderEventComponent>();
1007          return this.event;
1008        }
1009
1010        public boolean hasEvent() { 
1011          if (this.event == null)
1012            return false;
1013          for (DiagnosticOrderEventComponent item : this.event)
1014            if (!item.isEmpty())
1015              return true;
1016          return false;
1017        }
1018
1019        /**
1020         * @return {@link #event} (A summary of the events of interest that have occurred as this item of the request is processed.)
1021         */
1022    // syntactic sugar
1023        public DiagnosticOrderEventComponent addEvent() { //3
1024          DiagnosticOrderEventComponent t = new DiagnosticOrderEventComponent();
1025          if (this.event == null)
1026            this.event = new ArrayList<DiagnosticOrderEventComponent>();
1027          this.event.add(t);
1028          return t;
1029        }
1030
1031    // syntactic sugar
1032        public DiagnosticOrderItemComponent addEvent(DiagnosticOrderEventComponent t) { //3
1033          if (t == null)
1034            return this;
1035          if (this.event == null)
1036            this.event = new ArrayList<DiagnosticOrderEventComponent>();
1037          this.event.add(t);
1038          return this;
1039        }
1040
1041        protected void listChildren(List<Property> childrenList) {
1042          super.listChildren(childrenList);
1043          childrenList.add(new Property("code", "CodeableConcept", "A code that identifies a particular diagnostic investigation, or panel of investigations, that have been requested.", 0, java.lang.Integer.MAX_VALUE, code));
1044          childrenList.add(new Property("specimen", "Reference(Specimen)", "If the item is related to a specific specimen.", 0, java.lang.Integer.MAX_VALUE, specimen));
1045          childrenList.add(new Property("bodySite", "CodeableConcept", "Anatomical location where the request test should be performed.  This is the target site.", 0, java.lang.Integer.MAX_VALUE, bodySite));
1046          childrenList.add(new Property("status", "code", "The status of this individual item within the order.", 0, java.lang.Integer.MAX_VALUE, status));
1047          childrenList.add(new Property("event", "@DiagnosticOrder.event", "A summary of the events of interest that have occurred as this item of the request is processed.", 0, java.lang.Integer.MAX_VALUE, event));
1048        }
1049
1050      @Override
1051      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1052        switch (hash) {
1053        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1054        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
1055        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
1056        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DiagnosticOrderStatus>
1057        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // DiagnosticOrderEventComponent
1058        default: return super.getProperty(hash, name, checkValid);
1059        }
1060
1061      }
1062
1063      @Override
1064      public void setProperty(int hash, String name, Base value) throws FHIRException {
1065        switch (hash) {
1066        case 3059181: // code
1067          this.code = castToCodeableConcept(value); // CodeableConcept
1068          break;
1069        case -2132868344: // specimen
1070          this.getSpecimen().add(castToReference(value)); // Reference
1071          break;
1072        case 1702620169: // bodySite
1073          this.bodySite = castToCodeableConcept(value); // CodeableConcept
1074          break;
1075        case -892481550: // status
1076          this.status = new DiagnosticOrderStatusEnumFactory().fromType(value); // Enumeration<DiagnosticOrderStatus>
1077          break;
1078        case 96891546: // event
1079          this.getEvent().add((DiagnosticOrderEventComponent) value); // DiagnosticOrderEventComponent
1080          break;
1081        default: super.setProperty(hash, name, value);
1082        }
1083
1084      }
1085
1086      @Override
1087      public void setProperty(String name, Base value) throws FHIRException {
1088        if (name.equals("code"))
1089          this.code = castToCodeableConcept(value); // CodeableConcept
1090        else if (name.equals("specimen"))
1091          this.getSpecimen().add(castToReference(value));
1092        else if (name.equals("bodySite"))
1093          this.bodySite = castToCodeableConcept(value); // CodeableConcept
1094        else if (name.equals("status"))
1095          this.status = new DiagnosticOrderStatusEnumFactory().fromType(value); // Enumeration<DiagnosticOrderStatus>
1096        else if (name.equals("event"))
1097          this.getEvent().add((DiagnosticOrderEventComponent) value);
1098        else
1099          super.setProperty(name, value);
1100      }
1101
1102      @Override
1103      public Base makeProperty(int hash, String name) throws FHIRException {
1104        switch (hash) {
1105        case 3059181:  return getCode(); // CodeableConcept
1106        case -2132868344:  return addSpecimen(); // Reference
1107        case 1702620169:  return getBodySite(); // CodeableConcept
1108        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<DiagnosticOrderStatus>
1109        case 96891546:  return addEvent(); // DiagnosticOrderEventComponent
1110        default: return super.makeProperty(hash, name);
1111        }
1112
1113      }
1114
1115      @Override
1116      public Base addChild(String name) throws FHIRException {
1117        if (name.equals("code")) {
1118          this.code = new CodeableConcept();
1119          return this.code;
1120        }
1121        else if (name.equals("specimen")) {
1122          return addSpecimen();
1123        }
1124        else if (name.equals("bodySite")) {
1125          this.bodySite = new CodeableConcept();
1126          return this.bodySite;
1127        }
1128        else if (name.equals("status")) {
1129          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticOrder.status");
1130        }
1131        else if (name.equals("event")) {
1132          return addEvent();
1133        }
1134        else
1135          return super.addChild(name);
1136      }
1137
1138      public DiagnosticOrderItemComponent copy() {
1139        DiagnosticOrderItemComponent dst = new DiagnosticOrderItemComponent();
1140        copyValues(dst);
1141        dst.code = code == null ? null : code.copy();
1142        if (specimen != null) {
1143          dst.specimen = new ArrayList<Reference>();
1144          for (Reference i : specimen)
1145            dst.specimen.add(i.copy());
1146        };
1147        dst.bodySite = bodySite == null ? null : bodySite.copy();
1148        dst.status = status == null ? null : status.copy();
1149        if (event != null) {
1150          dst.event = new ArrayList<DiagnosticOrderEventComponent>();
1151          for (DiagnosticOrderEventComponent i : event)
1152            dst.event.add(i.copy());
1153        };
1154        return dst;
1155      }
1156
1157      @Override
1158      public boolean equalsDeep(Base other) {
1159        if (!super.equalsDeep(other))
1160          return false;
1161        if (!(other instanceof DiagnosticOrderItemComponent))
1162          return false;
1163        DiagnosticOrderItemComponent o = (DiagnosticOrderItemComponent) other;
1164        return compareDeep(code, o.code, true) && compareDeep(specimen, o.specimen, true) && compareDeep(bodySite, o.bodySite, true)
1165           && compareDeep(status, o.status, true) && compareDeep(event, o.event, true);
1166      }
1167
1168      @Override
1169      public boolean equalsShallow(Base other) {
1170        if (!super.equalsShallow(other))
1171          return false;
1172        if (!(other instanceof DiagnosticOrderItemComponent))
1173          return false;
1174        DiagnosticOrderItemComponent o = (DiagnosticOrderItemComponent) other;
1175        return compareValues(status, o.status, true);
1176      }
1177
1178      public boolean isEmpty() {
1179        return super.isEmpty() && (code == null || code.isEmpty()) && (specimen == null || specimen.isEmpty())
1180           && (bodySite == null || bodySite.isEmpty()) && (status == null || status.isEmpty()) && (event == null || event.isEmpty())
1181          ;
1182      }
1183
1184  public String fhirType() {
1185    return "DiagnosticOrder.item";
1186
1187  }
1188
1189  }
1190
1191    /**
1192     * Identifiers assigned to this order instance by the orderer and/or  the receiver and/or order fulfiller.
1193     */
1194    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1195    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order instance by the orderer and/or  the receiver and/or order fulfiller." )
1196    protected List<Identifier> identifier;
1197
1198    /**
1199     * The status of the order.
1200     */
1201    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1202    @Description(shortDefinition="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", formalDefinition="The status of the order." )
1203    protected Enumeration<DiagnosticOrderStatus> status;
1204
1205    /**
1206     * The clinical priority associated with this order.
1207     */
1208    @Child(name = "priority", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1209    @Description(shortDefinition="routine | urgent | stat | asap", formalDefinition="The clinical priority associated with this order." )
1210    protected Enumeration<DiagnosticOrderPriority> priority;
1211
1212    /**
1213     * On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).
1214     */
1215    @Child(name = "subject", type = {Patient.class, Group.class, Location.class, Device.class}, order=3, min=1, max=1, modifier=false, summary=true)
1216    @Description(shortDefinition="Who and/or what test is about", formalDefinition="On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans)." )
1217    protected Reference subject;
1218
1219    /**
1220     * The actual object that is the target of the reference (On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).)
1221     */
1222    protected Resource subjectTarget;
1223
1224    /**
1225     * An encounter that provides additional information about the healthcare context in which this request is made.
1226     */
1227    @Child(name = "encounter", type = {Encounter.class}, order=4, min=0, max=1, modifier=false, summary=true)
1228    @Description(shortDefinition="The encounter that this diagnostic order is associated with", formalDefinition="An encounter that provides additional information about the healthcare context in which this request is made." )
1229    protected Reference encounter;
1230
1231    /**
1232     * The actual object that is the target of the reference (An encounter that provides additional information about the healthcare context in which this request is made.)
1233     */
1234    protected Encounter encounterTarget;
1235
1236    /**
1237     * The practitioner that holds legal responsibility for ordering the investigation.
1238     */
1239    @Child(name = "orderer", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
1240    @Description(shortDefinition="Who ordered the test", formalDefinition="The practitioner that holds legal responsibility for ordering the investigation." )
1241    protected Reference orderer;
1242
1243    /**
1244     * The actual object that is the target of the reference (The practitioner that holds legal responsibility for ordering the investigation.)
1245     */
1246    protected Practitioner ordererTarget;
1247
1248    /**
1249     * An explanation or justification for why this diagnostic investigation is being requested.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation.
1250     */
1251    @Child(name = "reason", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1252    @Description(shortDefinition="Explanation/Justification for test", formalDefinition="An explanation or justification for why this diagnostic investigation is being requested.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation." )
1253    protected List<CodeableConcept> reason;
1254
1255    /**
1256     * Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order.
1257     */
1258    @Child(name = "supportingInformation", type = {Observation.class, Condition.class, DocumentReference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1259    @Description(shortDefinition="Additional clinical information", formalDefinition="Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order." )
1260    protected List<Reference> supportingInformation;
1261    /**
1262     * The actual objects that are the target of the reference (Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order.)
1263     */
1264    protected List<Resource> supportingInformationTarget;
1265
1266
1267    /**
1268     * One or more specimens that the diagnostic investigation is about.
1269     */
1270    @Child(name = "specimen", type = {Specimen.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1271    @Description(shortDefinition="If the whole order relates to specific specimens", formalDefinition="One or more specimens that the diagnostic investigation is about." )
1272    protected List<Reference> specimen;
1273    /**
1274     * The actual objects that are the target of the reference (One or more specimens that the diagnostic investigation is about.)
1275     */
1276    protected List<Specimen> specimenTarget;
1277
1278
1279    /**
1280     * A summary of the events of interest that have occurred as the request is processed; e.g. when the order was made, various processing steps (specimens received), when it was completed.
1281     */
1282    @Child(name = "event", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1283    @Description(shortDefinition="A list of events of interest in the lifecycle", formalDefinition="A summary of the events of interest that have occurred as the request is processed; e.g. when the order was made, various processing steps (specimens received), when it was completed." )
1284    protected List<DiagnosticOrderEventComponent> event;
1285
1286    /**
1287     * The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested.
1288     */
1289    @Child(name = "item", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1290    @Description(shortDefinition="The items the orderer requested", formalDefinition="The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested." )
1291    protected List<DiagnosticOrderItemComponent> item;
1292
1293    /**
1294     * Any other notes associated with this patient, specimen or order (e.g. "patient hates needles").
1295     */
1296    @Child(name = "note", type = {Annotation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1297    @Description(shortDefinition="Other notes and comments", formalDefinition="Any other notes associated with this patient, specimen or order (e.g. \"patient hates needles\")." )
1298    protected List<Annotation> note;
1299
1300    private static final long serialVersionUID = 1170289657L;
1301
1302  /**
1303   * Constructor
1304   */
1305    public DiagnosticOrder() {
1306      super();
1307    }
1308
1309  /**
1310   * Constructor
1311   */
1312    public DiagnosticOrder(Reference subject) {
1313      super();
1314      this.subject = subject;
1315    }
1316
1317    /**
1318     * @return {@link #identifier} (Identifiers assigned to this order instance by the orderer and/or  the receiver and/or order fulfiller.)
1319     */
1320    public List<Identifier> getIdentifier() { 
1321      if (this.identifier == null)
1322        this.identifier = new ArrayList<Identifier>();
1323      return this.identifier;
1324    }
1325
1326    public boolean hasIdentifier() { 
1327      if (this.identifier == null)
1328        return false;
1329      for (Identifier item : this.identifier)
1330        if (!item.isEmpty())
1331          return true;
1332      return false;
1333    }
1334
1335    /**
1336     * @return {@link #identifier} (Identifiers assigned to this order instance by the orderer and/or  the receiver and/or order fulfiller.)
1337     */
1338    // syntactic sugar
1339    public Identifier addIdentifier() { //3
1340      Identifier t = new Identifier();
1341      if (this.identifier == null)
1342        this.identifier = new ArrayList<Identifier>();
1343      this.identifier.add(t);
1344      return t;
1345    }
1346
1347    // syntactic sugar
1348    public DiagnosticOrder addIdentifier(Identifier t) { //3
1349      if (t == null)
1350        return this;
1351      if (this.identifier == null)
1352        this.identifier = new ArrayList<Identifier>();
1353      this.identifier.add(t);
1354      return this;
1355    }
1356
1357    /**
1358     * @return {@link #status} (The status of the order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1359     */
1360    public Enumeration<DiagnosticOrderStatus> getStatusElement() { 
1361      if (this.status == null)
1362        if (Configuration.errorOnAutoCreate())
1363          throw new Error("Attempt to auto-create DiagnosticOrder.status");
1364        else if (Configuration.doAutoCreate())
1365          this.status = new Enumeration<DiagnosticOrderStatus>(new DiagnosticOrderStatusEnumFactory()); // bb
1366      return this.status;
1367    }
1368
1369    public boolean hasStatusElement() { 
1370      return this.status != null && !this.status.isEmpty();
1371    }
1372
1373    public boolean hasStatus() { 
1374      return this.status != null && !this.status.isEmpty();
1375    }
1376
1377    /**
1378     * @param value {@link #status} (The status of the order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1379     */
1380    public DiagnosticOrder setStatusElement(Enumeration<DiagnosticOrderStatus> value) { 
1381      this.status = value;
1382      return this;
1383    }
1384
1385    /**
1386     * @return The status of the order.
1387     */
1388    public DiagnosticOrderStatus getStatus() { 
1389      return this.status == null ? null : this.status.getValue();
1390    }
1391
1392    /**
1393     * @param value The status of the order.
1394     */
1395    public DiagnosticOrder setStatus(DiagnosticOrderStatus value) { 
1396      if (value == null)
1397        this.status = null;
1398      else {
1399        if (this.status == null)
1400          this.status = new Enumeration<DiagnosticOrderStatus>(new DiagnosticOrderStatusEnumFactory());
1401        this.status.setValue(value);
1402      }
1403      return this;
1404    }
1405
1406    /**
1407     * @return {@link #priority} (The clinical priority associated with this order.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1408     */
1409    public Enumeration<DiagnosticOrderPriority> getPriorityElement() { 
1410      if (this.priority == null)
1411        if (Configuration.errorOnAutoCreate())
1412          throw new Error("Attempt to auto-create DiagnosticOrder.priority");
1413        else if (Configuration.doAutoCreate())
1414          this.priority = new Enumeration<DiagnosticOrderPriority>(new DiagnosticOrderPriorityEnumFactory()); // bb
1415      return this.priority;
1416    }
1417
1418    public boolean hasPriorityElement() { 
1419      return this.priority != null && !this.priority.isEmpty();
1420    }
1421
1422    public boolean hasPriority() { 
1423      return this.priority != null && !this.priority.isEmpty();
1424    }
1425
1426    /**
1427     * @param value {@link #priority} (The clinical priority associated with this order.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1428     */
1429    public DiagnosticOrder setPriorityElement(Enumeration<DiagnosticOrderPriority> value) { 
1430      this.priority = value;
1431      return this;
1432    }
1433
1434    /**
1435     * @return The clinical priority associated with this order.
1436     */
1437    public DiagnosticOrderPriority getPriority() { 
1438      return this.priority == null ? null : this.priority.getValue();
1439    }
1440
1441    /**
1442     * @param value The clinical priority associated with this order.
1443     */
1444    public DiagnosticOrder setPriority(DiagnosticOrderPriority value) { 
1445      if (value == null)
1446        this.priority = null;
1447      else {
1448        if (this.priority == null)
1449          this.priority = new Enumeration<DiagnosticOrderPriority>(new DiagnosticOrderPriorityEnumFactory());
1450        this.priority.setValue(value);
1451      }
1452      return this;
1453    }
1454
1455    /**
1456     * @return {@link #subject} (On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).)
1457     */
1458    public Reference getSubject() { 
1459      if (this.subject == null)
1460        if (Configuration.errorOnAutoCreate())
1461          throw new Error("Attempt to auto-create DiagnosticOrder.subject");
1462        else if (Configuration.doAutoCreate())
1463          this.subject = new Reference(); // cc
1464      return this.subject;
1465    }
1466
1467    public boolean hasSubject() { 
1468      return this.subject != null && !this.subject.isEmpty();
1469    }
1470
1471    /**
1472     * @param value {@link #subject} (On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).)
1473     */
1474    public DiagnosticOrder setSubject(Reference value) { 
1475      this.subject = value;
1476      return this;
1477    }
1478
1479    /**
1480     * @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. (On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).)
1481     */
1482    public Resource getSubjectTarget() { 
1483      return this.subjectTarget;
1484    }
1485
1486    /**
1487     * @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. (On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).)
1488     */
1489    public DiagnosticOrder setSubjectTarget(Resource value) { 
1490      this.subjectTarget = value;
1491      return this;
1492    }
1493
1494    /**
1495     * @return {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
1496     */
1497    public Reference getEncounter() { 
1498      if (this.encounter == null)
1499        if (Configuration.errorOnAutoCreate())
1500          throw new Error("Attempt to auto-create DiagnosticOrder.encounter");
1501        else if (Configuration.doAutoCreate())
1502          this.encounter = new Reference(); // cc
1503      return this.encounter;
1504    }
1505
1506    public boolean hasEncounter() { 
1507      return this.encounter != null && !this.encounter.isEmpty();
1508    }
1509
1510    /**
1511     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
1512     */
1513    public DiagnosticOrder setEncounter(Reference value) { 
1514      this.encounter = value;
1515      return this;
1516    }
1517
1518    /**
1519     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
1520     */
1521    public Encounter getEncounterTarget() { 
1522      if (this.encounterTarget == null)
1523        if (Configuration.errorOnAutoCreate())
1524          throw new Error("Attempt to auto-create DiagnosticOrder.encounter");
1525        else if (Configuration.doAutoCreate())
1526          this.encounterTarget = new Encounter(); // aa
1527      return this.encounterTarget;
1528    }
1529
1530    /**
1531     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
1532     */
1533    public DiagnosticOrder setEncounterTarget(Encounter value) { 
1534      this.encounterTarget = value;
1535      return this;
1536    }
1537
1538    /**
1539     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the investigation.)
1540     */
1541    public Reference getOrderer() { 
1542      if (this.orderer == null)
1543        if (Configuration.errorOnAutoCreate())
1544          throw new Error("Attempt to auto-create DiagnosticOrder.orderer");
1545        else if (Configuration.doAutoCreate())
1546          this.orderer = new Reference(); // cc
1547      return this.orderer;
1548    }
1549
1550    public boolean hasOrderer() { 
1551      return this.orderer != null && !this.orderer.isEmpty();
1552    }
1553
1554    /**
1555     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the investigation.)
1556     */
1557    public DiagnosticOrder setOrderer(Reference value) { 
1558      this.orderer = value;
1559      return this;
1560    }
1561
1562    /**
1563     * @return {@link #orderer} 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 that holds legal responsibility for ordering the investigation.)
1564     */
1565    public Practitioner getOrdererTarget() { 
1566      if (this.ordererTarget == null)
1567        if (Configuration.errorOnAutoCreate())
1568          throw new Error("Attempt to auto-create DiagnosticOrder.orderer");
1569        else if (Configuration.doAutoCreate())
1570          this.ordererTarget = new Practitioner(); // aa
1571      return this.ordererTarget;
1572    }
1573
1574    /**
1575     * @param value {@link #orderer} 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 that holds legal responsibility for ordering the investigation.)
1576     */
1577    public DiagnosticOrder setOrdererTarget(Practitioner value) { 
1578      this.ordererTarget = value;
1579      return this;
1580    }
1581
1582    /**
1583     * @return {@link #reason} (An explanation or justification for why this diagnostic investigation is being requested.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation.)
1584     */
1585    public List<CodeableConcept> getReason() { 
1586      if (this.reason == null)
1587        this.reason = new ArrayList<CodeableConcept>();
1588      return this.reason;
1589    }
1590
1591    public boolean hasReason() { 
1592      if (this.reason == null)
1593        return false;
1594      for (CodeableConcept item : this.reason)
1595        if (!item.isEmpty())
1596          return true;
1597      return false;
1598    }
1599
1600    /**
1601     * @return {@link #reason} (An explanation or justification for why this diagnostic investigation is being requested.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation.)
1602     */
1603    // syntactic sugar
1604    public CodeableConcept addReason() { //3
1605      CodeableConcept t = new CodeableConcept();
1606      if (this.reason == null)
1607        this.reason = new ArrayList<CodeableConcept>();
1608      this.reason.add(t);
1609      return t;
1610    }
1611
1612    // syntactic sugar
1613    public DiagnosticOrder addReason(CodeableConcept t) { //3
1614      if (t == null)
1615        return this;
1616      if (this.reason == null)
1617        this.reason = new ArrayList<CodeableConcept>();
1618      this.reason.add(t);
1619      return this;
1620    }
1621
1622    /**
1623     * @return {@link #supportingInformation} (Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order.)
1624     */
1625    public List<Reference> getSupportingInformation() { 
1626      if (this.supportingInformation == null)
1627        this.supportingInformation = new ArrayList<Reference>();
1628      return this.supportingInformation;
1629    }
1630
1631    public boolean hasSupportingInformation() { 
1632      if (this.supportingInformation == null)
1633        return false;
1634      for (Reference item : this.supportingInformation)
1635        if (!item.isEmpty())
1636          return true;
1637      return false;
1638    }
1639
1640    /**
1641     * @return {@link #supportingInformation} (Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order.)
1642     */
1643    // syntactic sugar
1644    public Reference addSupportingInformation() { //3
1645      Reference t = new Reference();
1646      if (this.supportingInformation == null)
1647        this.supportingInformation = new ArrayList<Reference>();
1648      this.supportingInformation.add(t);
1649      return t;
1650    }
1651
1652    // syntactic sugar
1653    public DiagnosticOrder addSupportingInformation(Reference t) { //3
1654      if (t == null)
1655        return this;
1656      if (this.supportingInformation == null)
1657        this.supportingInformation = new ArrayList<Reference>();
1658      this.supportingInformation.add(t);
1659      return this;
1660    }
1661
1662    /**
1663     * @return {@link #supportingInformation} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order.)
1664     */
1665    public List<Resource> getSupportingInformationTarget() { 
1666      if (this.supportingInformationTarget == null)
1667        this.supportingInformationTarget = new ArrayList<Resource>();
1668      return this.supportingInformationTarget;
1669    }
1670
1671    /**
1672     * @return {@link #specimen} (One or more specimens that the diagnostic investigation is about.)
1673     */
1674    public List<Reference> getSpecimen() { 
1675      if (this.specimen == null)
1676        this.specimen = new ArrayList<Reference>();
1677      return this.specimen;
1678    }
1679
1680    public boolean hasSpecimen() { 
1681      if (this.specimen == null)
1682        return false;
1683      for (Reference item : this.specimen)
1684        if (!item.isEmpty())
1685          return true;
1686      return false;
1687    }
1688
1689    /**
1690     * @return {@link #specimen} (One or more specimens that the diagnostic investigation is about.)
1691     */
1692    // syntactic sugar
1693    public Reference addSpecimen() { //3
1694      Reference t = new Reference();
1695      if (this.specimen == null)
1696        this.specimen = new ArrayList<Reference>();
1697      this.specimen.add(t);
1698      return t;
1699    }
1700
1701    // syntactic sugar
1702    public DiagnosticOrder addSpecimen(Reference t) { //3
1703      if (t == null)
1704        return this;
1705      if (this.specimen == null)
1706        this.specimen = new ArrayList<Reference>();
1707      this.specimen.add(t);
1708      return this;
1709    }
1710
1711    /**
1712     * @return {@link #specimen} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. One or more specimens that the diagnostic investigation is about.)
1713     */
1714    public List<Specimen> getSpecimenTarget() { 
1715      if (this.specimenTarget == null)
1716        this.specimenTarget = new ArrayList<Specimen>();
1717      return this.specimenTarget;
1718    }
1719
1720    // syntactic sugar
1721    /**
1722     * @return {@link #specimen} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. One or more specimens that the diagnostic investigation is about.)
1723     */
1724    public Specimen addSpecimenTarget() { 
1725      Specimen r = new Specimen();
1726      if (this.specimenTarget == null)
1727        this.specimenTarget = new ArrayList<Specimen>();
1728      this.specimenTarget.add(r);
1729      return r;
1730    }
1731
1732    /**
1733     * @return {@link #event} (A summary of the events of interest that have occurred as the request is processed; e.g. when the order was made, various processing steps (specimens received), when it was completed.)
1734     */
1735    public List<DiagnosticOrderEventComponent> getEvent() { 
1736      if (this.event == null)
1737        this.event = new ArrayList<DiagnosticOrderEventComponent>();
1738      return this.event;
1739    }
1740
1741    public boolean hasEvent() { 
1742      if (this.event == null)
1743        return false;
1744      for (DiagnosticOrderEventComponent item : this.event)
1745        if (!item.isEmpty())
1746          return true;
1747      return false;
1748    }
1749
1750    /**
1751     * @return {@link #event} (A summary of the events of interest that have occurred as the request is processed; e.g. when the order was made, various processing steps (specimens received), when it was completed.)
1752     */
1753    // syntactic sugar
1754    public DiagnosticOrderEventComponent addEvent() { //3
1755      DiagnosticOrderEventComponent t = new DiagnosticOrderEventComponent();
1756      if (this.event == null)
1757        this.event = new ArrayList<DiagnosticOrderEventComponent>();
1758      this.event.add(t);
1759      return t;
1760    }
1761
1762    // syntactic sugar
1763    public DiagnosticOrder addEvent(DiagnosticOrderEventComponent t) { //3
1764      if (t == null)
1765        return this;
1766      if (this.event == null)
1767        this.event = new ArrayList<DiagnosticOrderEventComponent>();
1768      this.event.add(t);
1769      return this;
1770    }
1771
1772    /**
1773     * @return {@link #item} (The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested.)
1774     */
1775    public List<DiagnosticOrderItemComponent> getItem() { 
1776      if (this.item == null)
1777        this.item = new ArrayList<DiagnosticOrderItemComponent>();
1778      return this.item;
1779    }
1780
1781    public boolean hasItem() { 
1782      if (this.item == null)
1783        return false;
1784      for (DiagnosticOrderItemComponent item : this.item)
1785        if (!item.isEmpty())
1786          return true;
1787      return false;
1788    }
1789
1790    /**
1791     * @return {@link #item} (The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested.)
1792     */
1793    // syntactic sugar
1794    public DiagnosticOrderItemComponent addItem() { //3
1795      DiagnosticOrderItemComponent t = new DiagnosticOrderItemComponent();
1796      if (this.item == null)
1797        this.item = new ArrayList<DiagnosticOrderItemComponent>();
1798      this.item.add(t);
1799      return t;
1800    }
1801
1802    // syntactic sugar
1803    public DiagnosticOrder addItem(DiagnosticOrderItemComponent t) { //3
1804      if (t == null)
1805        return this;
1806      if (this.item == null)
1807        this.item = new ArrayList<DiagnosticOrderItemComponent>();
1808      this.item.add(t);
1809      return this;
1810    }
1811
1812    /**
1813     * @return {@link #note} (Any other notes associated with this patient, specimen or order (e.g. "patient hates needles").)
1814     */
1815    public List<Annotation> getNote() { 
1816      if (this.note == null)
1817        this.note = new ArrayList<Annotation>();
1818      return this.note;
1819    }
1820
1821    public boolean hasNote() { 
1822      if (this.note == null)
1823        return false;
1824      for (Annotation item : this.note)
1825        if (!item.isEmpty())
1826          return true;
1827      return false;
1828    }
1829
1830    /**
1831     * @return {@link #note} (Any other notes associated with this patient, specimen or order (e.g. "patient hates needles").)
1832     */
1833    // syntactic sugar
1834    public Annotation addNote() { //3
1835      Annotation t = new Annotation();
1836      if (this.note == null)
1837        this.note = new ArrayList<Annotation>();
1838      this.note.add(t);
1839      return t;
1840    }
1841
1842    // syntactic sugar
1843    public DiagnosticOrder addNote(Annotation t) { //3
1844      if (t == null)
1845        return this;
1846      if (this.note == null)
1847        this.note = new ArrayList<Annotation>();
1848      this.note.add(t);
1849      return this;
1850    }
1851
1852      protected void listChildren(List<Property> childrenList) {
1853        super.listChildren(childrenList);
1854        childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order instance by the orderer and/or  the receiver and/or order fulfiller.", 0, java.lang.Integer.MAX_VALUE, identifier));
1855        childrenList.add(new Property("status", "code", "The status of the order.", 0, java.lang.Integer.MAX_VALUE, status));
1856        childrenList.add(new Property("priority", "code", "The clinical priority associated with this order.", 0, java.lang.Integer.MAX_VALUE, priority));
1857        childrenList.add(new Property("subject", "Reference(Patient|Group|Location|Device)", "On whom or what the investigation is to be performed. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).", 0, java.lang.Integer.MAX_VALUE, subject));
1858        childrenList.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, java.lang.Integer.MAX_VALUE, encounter));
1859        childrenList.add(new Property("orderer", "Reference(Practitioner)", "The practitioner that holds legal responsibility for ordering the investigation.", 0, java.lang.Integer.MAX_VALUE, orderer));
1860        childrenList.add(new Property("reason", "CodeableConcept", "An explanation or justification for why this diagnostic investigation is being requested.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation.", 0, java.lang.Integer.MAX_VALUE, reason));
1861        childrenList.add(new Property("supportingInformation", "Reference(Observation|Condition|DocumentReference)", "Additional clinical information about the patient or specimen that may influence test interpretations.  This includes observations explicitly requested by the producer(filler) to provide context or supporting information needed to complete the order.", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
1862        childrenList.add(new Property("specimen", "Reference(Specimen)", "One or more specimens that the diagnostic investigation is about.", 0, java.lang.Integer.MAX_VALUE, specimen));
1863        childrenList.add(new Property("event", "", "A summary of the events of interest that have occurred as the request is processed; e.g. when the order was made, various processing steps (specimens received), when it was completed.", 0, java.lang.Integer.MAX_VALUE, event));
1864        childrenList.add(new Property("item", "", "The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested.", 0, java.lang.Integer.MAX_VALUE, item));
1865        childrenList.add(new Property("note", "Annotation", "Any other notes associated with this patient, specimen or order (e.g. \"patient hates needles\").", 0, java.lang.Integer.MAX_VALUE, note));
1866      }
1867
1868      @Override
1869      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1870        switch (hash) {
1871        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1872        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DiagnosticOrderStatus>
1873        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<DiagnosticOrderPriority>
1874        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1875        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1876        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
1877        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
1878        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
1879        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
1880        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // DiagnosticOrderEventComponent
1881        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // DiagnosticOrderItemComponent
1882        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1883        default: return super.getProperty(hash, name, checkValid);
1884        }
1885
1886      }
1887
1888      @Override
1889      public void setProperty(int hash, String name, Base value) throws FHIRException {
1890        switch (hash) {
1891        case -1618432855: // identifier
1892          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1893          break;
1894        case -892481550: // status
1895          this.status = new DiagnosticOrderStatusEnumFactory().fromType(value); // Enumeration<DiagnosticOrderStatus>
1896          break;
1897        case -1165461084: // priority
1898          this.priority = new DiagnosticOrderPriorityEnumFactory().fromType(value); // Enumeration<DiagnosticOrderPriority>
1899          break;
1900        case -1867885268: // subject
1901          this.subject = castToReference(value); // Reference
1902          break;
1903        case 1524132147: // encounter
1904          this.encounter = castToReference(value); // Reference
1905          break;
1906        case -1207109509: // orderer
1907          this.orderer = castToReference(value); // Reference
1908          break;
1909        case -934964668: // reason
1910          this.getReason().add(castToCodeableConcept(value)); // CodeableConcept
1911          break;
1912        case -1248768647: // supportingInformation
1913          this.getSupportingInformation().add(castToReference(value)); // Reference
1914          break;
1915        case -2132868344: // specimen
1916          this.getSpecimen().add(castToReference(value)); // Reference
1917          break;
1918        case 96891546: // event
1919          this.getEvent().add((DiagnosticOrderEventComponent) value); // DiagnosticOrderEventComponent
1920          break;
1921        case 3242771: // item
1922          this.getItem().add((DiagnosticOrderItemComponent) value); // DiagnosticOrderItemComponent
1923          break;
1924        case 3387378: // note
1925          this.getNote().add(castToAnnotation(value)); // Annotation
1926          break;
1927        default: super.setProperty(hash, name, value);
1928        }
1929
1930      }
1931
1932      @Override
1933      public void setProperty(String name, Base value) throws FHIRException {
1934        if (name.equals("identifier"))
1935          this.getIdentifier().add(castToIdentifier(value));
1936        else if (name.equals("status"))
1937          this.status = new DiagnosticOrderStatusEnumFactory().fromType(value); // Enumeration<DiagnosticOrderStatus>
1938        else if (name.equals("priority"))
1939          this.priority = new DiagnosticOrderPriorityEnumFactory().fromType(value); // Enumeration<DiagnosticOrderPriority>
1940        else if (name.equals("subject"))
1941          this.subject = castToReference(value); // Reference
1942        else if (name.equals("encounter"))
1943          this.encounter = castToReference(value); // Reference
1944        else if (name.equals("orderer"))
1945          this.orderer = castToReference(value); // Reference
1946        else if (name.equals("reason"))
1947          this.getReason().add(castToCodeableConcept(value));
1948        else if (name.equals("supportingInformation"))
1949          this.getSupportingInformation().add(castToReference(value));
1950        else if (name.equals("specimen"))
1951          this.getSpecimen().add(castToReference(value));
1952        else if (name.equals("event"))
1953          this.getEvent().add((DiagnosticOrderEventComponent) value);
1954        else if (name.equals("item"))
1955          this.getItem().add((DiagnosticOrderItemComponent) value);
1956        else if (name.equals("note"))
1957          this.getNote().add(castToAnnotation(value));
1958        else
1959          super.setProperty(name, value);
1960      }
1961
1962      @Override
1963      public Base makeProperty(int hash, String name) throws FHIRException {
1964        switch (hash) {
1965        case -1618432855:  return addIdentifier(); // Identifier
1966        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<DiagnosticOrderStatus>
1967        case -1165461084: throw new FHIRException("Cannot make property priority as it is not a complex type"); // Enumeration<DiagnosticOrderPriority>
1968        case -1867885268:  return getSubject(); // Reference
1969        case 1524132147:  return getEncounter(); // Reference
1970        case -1207109509:  return getOrderer(); // Reference
1971        case -934964668:  return addReason(); // CodeableConcept
1972        case -1248768647:  return addSupportingInformation(); // Reference
1973        case -2132868344:  return addSpecimen(); // Reference
1974        case 96891546:  return addEvent(); // DiagnosticOrderEventComponent
1975        case 3242771:  return addItem(); // DiagnosticOrderItemComponent
1976        case 3387378:  return addNote(); // Annotation
1977        default: return super.makeProperty(hash, name);
1978        }
1979
1980      }
1981
1982      @Override
1983      public Base addChild(String name) throws FHIRException {
1984        if (name.equals("identifier")) {
1985          return addIdentifier();
1986        }
1987        else if (name.equals("status")) {
1988          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticOrder.status");
1989        }
1990        else if (name.equals("priority")) {
1991          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticOrder.priority");
1992        }
1993        else if (name.equals("subject")) {
1994          this.subject = new Reference();
1995          return this.subject;
1996        }
1997        else if (name.equals("encounter")) {
1998          this.encounter = new Reference();
1999          return this.encounter;
2000        }
2001        else if (name.equals("orderer")) {
2002          this.orderer = new Reference();
2003          return this.orderer;
2004        }
2005        else if (name.equals("reason")) {
2006          return addReason();
2007        }
2008        else if (name.equals("supportingInformation")) {
2009          return addSupportingInformation();
2010        }
2011        else if (name.equals("specimen")) {
2012          return addSpecimen();
2013        }
2014        else if (name.equals("event")) {
2015          return addEvent();
2016        }
2017        else if (name.equals("item")) {
2018          return addItem();
2019        }
2020        else if (name.equals("note")) {
2021          return addNote();
2022        }
2023        else
2024          return super.addChild(name);
2025      }
2026
2027  public String fhirType() {
2028    return "DiagnosticOrder";
2029
2030  }
2031
2032      public DiagnosticOrder copy() {
2033        DiagnosticOrder dst = new DiagnosticOrder();
2034        copyValues(dst);
2035        if (identifier != null) {
2036          dst.identifier = new ArrayList<Identifier>();
2037          for (Identifier i : identifier)
2038            dst.identifier.add(i.copy());
2039        };
2040        dst.status = status == null ? null : status.copy();
2041        dst.priority = priority == null ? null : priority.copy();
2042        dst.subject = subject == null ? null : subject.copy();
2043        dst.encounter = encounter == null ? null : encounter.copy();
2044        dst.orderer = orderer == null ? null : orderer.copy();
2045        if (reason != null) {
2046          dst.reason = new ArrayList<CodeableConcept>();
2047          for (CodeableConcept i : reason)
2048            dst.reason.add(i.copy());
2049        };
2050        if (supportingInformation != null) {
2051          dst.supportingInformation = new ArrayList<Reference>();
2052          for (Reference i : supportingInformation)
2053            dst.supportingInformation.add(i.copy());
2054        };
2055        if (specimen != null) {
2056          dst.specimen = new ArrayList<Reference>();
2057          for (Reference i : specimen)
2058            dst.specimen.add(i.copy());
2059        };
2060        if (event != null) {
2061          dst.event = new ArrayList<DiagnosticOrderEventComponent>();
2062          for (DiagnosticOrderEventComponent i : event)
2063            dst.event.add(i.copy());
2064        };
2065        if (item != null) {
2066          dst.item = new ArrayList<DiagnosticOrderItemComponent>();
2067          for (DiagnosticOrderItemComponent i : item)
2068            dst.item.add(i.copy());
2069        };
2070        if (note != null) {
2071          dst.note = new ArrayList<Annotation>();
2072          for (Annotation i : note)
2073            dst.note.add(i.copy());
2074        };
2075        return dst;
2076      }
2077
2078      protected DiagnosticOrder typedCopy() {
2079        return copy();
2080      }
2081
2082      @Override
2083      public boolean equalsDeep(Base other) {
2084        if (!super.equalsDeep(other))
2085          return false;
2086        if (!(other instanceof DiagnosticOrder))
2087          return false;
2088        DiagnosticOrder o = (DiagnosticOrder) other;
2089        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(priority, o.priority, true)
2090           && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true) && compareDeep(orderer, o.orderer, true)
2091           && compareDeep(reason, o.reason, true) && compareDeep(supportingInformation, o.supportingInformation, true)
2092           && compareDeep(specimen, o.specimen, true) && compareDeep(event, o.event, true) && compareDeep(item, o.item, true)
2093           && compareDeep(note, o.note, true);
2094      }
2095
2096      @Override
2097      public boolean equalsShallow(Base other) {
2098        if (!super.equalsShallow(other))
2099          return false;
2100        if (!(other instanceof DiagnosticOrder))
2101          return false;
2102        DiagnosticOrder o = (DiagnosticOrder) other;
2103        return compareValues(status, o.status, true) && compareValues(priority, o.priority, true);
2104      }
2105
2106      public boolean isEmpty() {
2107        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
2108           && (priority == null || priority.isEmpty()) && (subject == null || subject.isEmpty()) && (encounter == null || encounter.isEmpty())
2109           && (orderer == null || orderer.isEmpty()) && (reason == null || reason.isEmpty()) && (supportingInformation == null || supportingInformation.isEmpty())
2110           && (specimen == null || specimen.isEmpty()) && (event == null || event.isEmpty()) && (item == null || item.isEmpty())
2111           && (note == null || note.isEmpty());
2112      }
2113
2114  @Override
2115  public ResourceType getResourceType() {
2116    return ResourceType.DiagnosticOrder;
2117   }
2118
2119 /**
2120   * Search parameter: <b>orderer</b>
2121   * <p>
2122   * Description: <b>Who ordered the test</b><br>
2123   * Type: <b>reference</b><br>
2124   * Path: <b>DiagnosticOrder.orderer</b><br>
2125   * </p>
2126   */
2127  @SearchParamDefinition(name="orderer", path="DiagnosticOrder.orderer", description="Who ordered the test", type="reference" )
2128  public static final String SP_ORDERER = "orderer";
2129 /**
2130   * <b>Fluent Client</b> search parameter constant for <b>orderer</b>
2131   * <p>
2132   * Description: <b>Who ordered the test</b><br>
2133   * Type: <b>reference</b><br>
2134   * Path: <b>DiagnosticOrder.orderer</b><br>
2135   * </p>
2136   */
2137  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORDERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORDERER);
2138
2139/**
2140   * Constant for fluent queries to be used to add include statements. Specifies
2141   * the path value of "<b>DiagnosticOrder:orderer</b>".
2142   */
2143  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORDERER = new ca.uhn.fhir.model.api.Include("DiagnosticOrder:orderer").toLocked();
2144
2145 /**
2146   * Search parameter: <b>status</b>
2147   * <p>
2148   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2149   * Type: <b>token</b><br>
2150   * Path: <b>DiagnosticOrder.status</b><br>
2151   * </p>
2152   */
2153  @SearchParamDefinition(name="status", path="DiagnosticOrder.status", description="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", type="token" )
2154  public static final String SP_STATUS = "status";
2155 /**
2156   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2157   * <p>
2158   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2159   * Type: <b>token</b><br>
2160   * Path: <b>DiagnosticOrder.status</b><br>
2161   * </p>
2162   */
2163  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2164
2165 /**
2166   * Search parameter: <b>subject</b>
2167   * <p>
2168   * Description: <b>Who and/or what test is about</b><br>
2169   * Type: <b>reference</b><br>
2170   * Path: <b>DiagnosticOrder.subject</b><br>
2171   * </p>
2172   */
2173  @SearchParamDefinition(name="subject", path="DiagnosticOrder.subject", description="Who and/or what test is about", type="reference" )
2174  public static final String SP_SUBJECT = "subject";
2175 /**
2176   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2177   * <p>
2178   * Description: <b>Who and/or what test is about</b><br>
2179   * Type: <b>reference</b><br>
2180   * Path: <b>DiagnosticOrder.subject</b><br>
2181   * </p>
2182   */
2183  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2184
2185/**
2186   * Constant for fluent queries to be used to add include statements. Specifies
2187   * the path value of "<b>DiagnosticOrder:subject</b>".
2188   */
2189  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DiagnosticOrder:subject").toLocked();
2190
2191 /**
2192   * Search parameter: <b>item-status</b>
2193   * <p>
2194   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2195   * Type: <b>token</b><br>
2196   * Path: <b>DiagnosticOrder.item.status</b><br>
2197   * </p>
2198   */
2199  @SearchParamDefinition(name="item-status", path="DiagnosticOrder.item.status", description="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", type="token" )
2200  public static final String SP_ITEM_STATUS = "item-status";
2201 /**
2202   * <b>Fluent Client</b> search parameter constant for <b>item-status</b>
2203   * <p>
2204   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2205   * Type: <b>token</b><br>
2206   * Path: <b>DiagnosticOrder.item.status</b><br>
2207   * </p>
2208   */
2209  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ITEM_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ITEM_STATUS);
2210
2211 /**
2212   * Search parameter: <b>event-status</b>
2213   * <p>
2214   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2215   * Type: <b>token</b><br>
2216   * Path: <b>DiagnosticOrder.event.status</b><br>
2217   * </p>
2218   */
2219  @SearchParamDefinition(name="event-status", path="DiagnosticOrder.event.status", description="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", type="token" )
2220  public static final String SP_EVENT_STATUS = "event-status";
2221 /**
2222   * <b>Fluent Client</b> search parameter constant for <b>event-status</b>
2223   * <p>
2224   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2225   * Type: <b>token</b><br>
2226   * Path: <b>DiagnosticOrder.event.status</b><br>
2227   * </p>
2228   */
2229  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EVENT_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EVENT_STATUS);
2230
2231 /**
2232   * Search parameter: <b>actor</b>
2233   * <p>
2234   * Description: <b>Who recorded or did this</b><br>
2235   * Type: <b>reference</b><br>
2236   * Path: <b>DiagnosticOrder.event.actor, DiagnosticOrder.item.event.actor</b><br>
2237   * </p>
2238   */
2239  @SearchParamDefinition(name="actor", path="DiagnosticOrder.event.actor | DiagnosticOrder.item.event.actor", description="Who recorded or did this", type="reference" )
2240  public static final String SP_ACTOR = "actor";
2241 /**
2242   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
2243   * <p>
2244   * Description: <b>Who recorded or did this</b><br>
2245   * Type: <b>reference</b><br>
2246   * Path: <b>DiagnosticOrder.event.actor, DiagnosticOrder.item.event.actor</b><br>
2247   * </p>
2248   */
2249  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
2250
2251/**
2252   * Constant for fluent queries to be used to add include statements. Specifies
2253   * the path value of "<b>DiagnosticOrder:actor</b>".
2254   */
2255  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("DiagnosticOrder:actor").toLocked();
2256
2257 /**
2258   * Search parameter: <b>code</b>
2259   * <p>
2260   * Description: <b>Code to indicate the item (test or panel) being ordered</b><br>
2261   * Type: <b>token</b><br>
2262   * Path: <b>DiagnosticOrder.item.code</b><br>
2263   * </p>
2264   */
2265  @SearchParamDefinition(name="code", path="DiagnosticOrder.item.code", description="Code to indicate the item (test or panel) being ordered", type="token" )
2266  public static final String SP_CODE = "code";
2267 /**
2268   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2269   * <p>
2270   * Description: <b>Code to indicate the item (test or panel) being ordered</b><br>
2271   * Type: <b>token</b><br>
2272   * Path: <b>DiagnosticOrder.item.code</b><br>
2273   * </p>
2274   */
2275  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2276
2277 /**
2278   * Search parameter: <b>encounter</b>
2279   * <p>
2280   * Description: <b>The encounter that this diagnostic order is associated with</b><br>
2281   * Type: <b>reference</b><br>
2282   * Path: <b>DiagnosticOrder.encounter</b><br>
2283   * </p>
2284   */
2285  @SearchParamDefinition(name="encounter", path="DiagnosticOrder.encounter", description="The encounter that this diagnostic order is associated with", type="reference" )
2286  public static final String SP_ENCOUNTER = "encounter";
2287 /**
2288   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2289   * <p>
2290   * Description: <b>The encounter that this diagnostic order is associated with</b><br>
2291   * Type: <b>reference</b><br>
2292   * Path: <b>DiagnosticOrder.encounter</b><br>
2293   * </p>
2294   */
2295  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2296
2297/**
2298   * Constant for fluent queries to be used to add include statements. Specifies
2299   * the path value of "<b>DiagnosticOrder:encounter</b>".
2300   */
2301  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("DiagnosticOrder:encounter").toLocked();
2302
2303 /**
2304   * Search parameter: <b>item-past-status</b>
2305   * <p>
2306   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2307   * Type: <b>token</b><br>
2308   * Path: <b>DiagnosticOrder.item.event.status</b><br>
2309   * </p>
2310   */
2311  @SearchParamDefinition(name="item-past-status", path="DiagnosticOrder.item.event.status", description="proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error", type="token" )
2312  public static final String SP_ITEM_PAST_STATUS = "item-past-status";
2313 /**
2314   * <b>Fluent Client</b> search parameter constant for <b>item-past-status</b>
2315   * <p>
2316   * Description: <b>proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error</b><br>
2317   * Type: <b>token</b><br>
2318   * Path: <b>DiagnosticOrder.item.event.status</b><br>
2319   * </p>
2320   */
2321  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ITEM_PAST_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ITEM_PAST_STATUS);
2322
2323 /**
2324   * Search parameter: <b>patient</b>
2325   * <p>
2326   * Description: <b>Who and/or what test is about</b><br>
2327   * Type: <b>reference</b><br>
2328   * Path: <b>DiagnosticOrder.subject</b><br>
2329   * </p>
2330   */
2331  @SearchParamDefinition(name="patient", path="DiagnosticOrder.subject", description="Who and/or what test is about", type="reference" )
2332  public static final String SP_PATIENT = "patient";
2333 /**
2334   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2335   * <p>
2336   * Description: <b>Who and/or what test is about</b><br>
2337   * Type: <b>reference</b><br>
2338   * Path: <b>DiagnosticOrder.subject</b><br>
2339   * </p>
2340   */
2341  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2342
2343/**
2344   * Constant for fluent queries to be used to add include statements. Specifies
2345   * the path value of "<b>DiagnosticOrder:patient</b>".
2346   */
2347  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DiagnosticOrder:patient").toLocked();
2348
2349 /**
2350   * Search parameter: <b>bodysite</b>
2351   * <p>
2352   * Description: <b>Location of requested test (if applicable)</b><br>
2353   * Type: <b>token</b><br>
2354   * Path: <b>DiagnosticOrder.item.bodySite</b><br>
2355   * </p>
2356   */
2357  @SearchParamDefinition(name="bodysite", path="DiagnosticOrder.item.bodySite", description="Location of requested test (if applicable)", type="token" )
2358  public static final String SP_BODYSITE = "bodysite";
2359 /**
2360   * <b>Fluent Client</b> search parameter constant for <b>bodysite</b>
2361   * <p>
2362   * Description: <b>Location of requested test (if applicable)</b><br>
2363   * Type: <b>token</b><br>
2364   * Path: <b>DiagnosticOrder.item.bodySite</b><br>
2365   * </p>
2366   */
2367  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODYSITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BODYSITE);
2368
2369 /**
2370   * Search parameter: <b>item-date</b>
2371   * <p>
2372   * Description: <b>The date at which the event happened</b><br>
2373   * Type: <b>date</b><br>
2374   * Path: <b>DiagnosticOrder.item.event.dateTime</b><br>
2375   * </p>
2376   */
2377  @SearchParamDefinition(name="item-date", path="DiagnosticOrder.item.event.dateTime", description="The date at which the event happened", type="date" )
2378  public static final String SP_ITEM_DATE = "item-date";
2379 /**
2380   * <b>Fluent Client</b> search parameter constant for <b>item-date</b>
2381   * <p>
2382   * Description: <b>The date at which the event happened</b><br>
2383   * Type: <b>date</b><br>
2384   * Path: <b>DiagnosticOrder.item.event.dateTime</b><br>
2385   * </p>
2386   */
2387  public static final ca.uhn.fhir.rest.gclient.DateClientParam ITEM_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ITEM_DATE);
2388
2389 /**
2390   * Search parameter: <b>specimen</b>
2391   * <p>
2392   * Description: <b>If the whole order relates to specific specimens</b><br>
2393   * Type: <b>reference</b><br>
2394   * Path: <b>DiagnosticOrder.specimen, DiagnosticOrder.item.specimen</b><br>
2395   * </p>
2396   */
2397  @SearchParamDefinition(name="specimen", path="DiagnosticOrder.specimen | DiagnosticOrder.item.specimen", description="If the whole order relates to specific specimens", type="reference" )
2398  public static final String SP_SPECIMEN = "specimen";
2399 /**
2400   * <b>Fluent Client</b> search parameter constant for <b>specimen</b>
2401   * <p>
2402   * Description: <b>If the whole order relates to specific specimens</b><br>
2403   * Type: <b>reference</b><br>
2404   * Path: <b>DiagnosticOrder.specimen, DiagnosticOrder.item.specimen</b><br>
2405   * </p>
2406   */
2407  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPECIMEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SPECIMEN);
2408
2409/**
2410   * Constant for fluent queries to be used to add include statements. Specifies
2411   * the path value of "<b>DiagnosticOrder:specimen</b>".
2412   */
2413  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPECIMEN = new ca.uhn.fhir.model.api.Include("DiagnosticOrder:specimen").toLocked();
2414
2415 /**
2416   * Search parameter: <b>event-status-date</b>
2417   * <p>
2418   * Description: <b>A combination of past-status and date</b><br>
2419   * Type: <b>composite</b><br>
2420   * Path: <b></b><br>
2421   * </p>
2422   */
2423  @SearchParamDefinition(name="event-status-date", path="", description="A combination of past-status and date", type="composite", compositeOf={"event-status", "event-date"} )
2424  public static final String SP_EVENT_STATUS_DATE = "event-status-date";
2425 /**
2426   * <b>Fluent Client</b> search parameter constant for <b>event-status-date</b>
2427   * <p>
2428   * Description: <b>A combination of past-status and date</b><br>
2429   * Type: <b>composite</b><br>
2430   * Path: <b></b><br>
2431   * </p>
2432   */
2433  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam> EVENT_STATUS_DATE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam>(SP_EVENT_STATUS_DATE);
2434
2435 /**
2436   * Search parameter: <b>event-date</b>
2437   * <p>
2438   * Description: <b>The date at which the event happened</b><br>
2439   * Type: <b>date</b><br>
2440   * Path: <b>DiagnosticOrder.event.dateTime</b><br>
2441   * </p>
2442   */
2443  @SearchParamDefinition(name="event-date", path="DiagnosticOrder.event.dateTime", description="The date at which the event happened", type="date" )
2444  public static final String SP_EVENT_DATE = "event-date";
2445 /**
2446   * <b>Fluent Client</b> search parameter constant for <b>event-date</b>
2447   * <p>
2448   * Description: <b>The date at which the event happened</b><br>
2449   * Type: <b>date</b><br>
2450   * Path: <b>DiagnosticOrder.event.dateTime</b><br>
2451   * </p>
2452   */
2453  public static final ca.uhn.fhir.rest.gclient.DateClientParam EVENT_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EVENT_DATE);
2454
2455 /**
2456   * Search parameter: <b>identifier</b>
2457   * <p>
2458   * Description: <b>Identifiers assigned to this order</b><br>
2459   * Type: <b>token</b><br>
2460   * Path: <b>DiagnosticOrder.identifier</b><br>
2461   * </p>
2462   */
2463  @SearchParamDefinition(name="identifier", path="DiagnosticOrder.identifier", description="Identifiers assigned to this order", type="token" )
2464  public static final String SP_IDENTIFIER = "identifier";
2465 /**
2466   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2467   * <p>
2468   * Description: <b>Identifiers assigned to this order</b><br>
2469   * Type: <b>token</b><br>
2470   * Path: <b>DiagnosticOrder.identifier</b><br>
2471   * </p>
2472   */
2473  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2474
2475 /**
2476   * Search parameter: <b>item-status-date</b>
2477   * <p>
2478   * Description: <b>A combination of item-past-status and item-date</b><br>
2479   * Type: <b>composite</b><br>
2480   * Path: <b></b><br>
2481   * </p>
2482   */
2483  @SearchParamDefinition(name="item-status-date", path="", description="A combination of item-past-status and item-date", type="composite", compositeOf={"item-past-status", "item-date"} )
2484  public static final String SP_ITEM_STATUS_DATE = "item-status-date";
2485 /**
2486   * <b>Fluent Client</b> search parameter constant for <b>item-status-date</b>
2487   * <p>
2488   * Description: <b>A combination of item-past-status and item-date</b><br>
2489   * Type: <b>composite</b><br>
2490   * Path: <b></b><br>
2491   * </p>
2492   */
2493  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam> ITEM_STATUS_DATE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam>(SP_ITEM_STATUS_DATE);
2494
2495
2496}
2497