001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033
034import ca.uhn.fhir.model.api.annotation.*;
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037
038import java.util.ArrayList;
039import java.util.Date;
040import java.util.List;
041/**
042 * A request to perform an action.
043 */
044@ResourceDef(name="Order", profile="http://hl7.org/fhir/Profile/Order")
045public class Order extends DomainResource {
046
047    @Block()
048    public static class OrderWhenComponent extends BackboneElement implements IBaseBackboneElement {
049        /**
050         * Code specifies when request should be done. The code may simply be a priority code.
051         */
052        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
053        @Description(shortDefinition="Code specifies when request should be done. The code may simply be a priority code", formalDefinition="Code specifies when request should be done. The code may simply be a priority code." )
054        protected CodeableConcept code;
055
056        /**
057         * A formal schedule.
058         */
059        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=1, modifier=false, summary=true)
060        @Description(shortDefinition="A formal schedule", formalDefinition="A formal schedule." )
061        protected Timing schedule;
062
063        private static final long serialVersionUID = 307115287L;
064
065    /*
066     * Constructor
067     */
068      public OrderWhenComponent() {
069        super();
070      }
071
072        /**
073         * @return {@link #code} (Code specifies when request should be done. The code may simply be a priority code.)
074         */
075        public CodeableConcept getCode() { 
076          if (this.code == null)
077            if (Configuration.errorOnAutoCreate())
078              throw new Error("Attempt to auto-create OrderWhenComponent.code");
079            else if (Configuration.doAutoCreate())
080              this.code = new CodeableConcept(); // cc
081          return this.code;
082        }
083
084        public boolean hasCode() { 
085          return this.code != null && !this.code.isEmpty();
086        }
087
088        /**
089         * @param value {@link #code} (Code specifies when request should be done. The code may simply be a priority code.)
090         */
091        public OrderWhenComponent setCode(CodeableConcept value) { 
092          this.code = value;
093          return this;
094        }
095
096        /**
097         * @return {@link #schedule} (A formal schedule.)
098         */
099        public Timing getSchedule() { 
100          if (this.schedule == null)
101            if (Configuration.errorOnAutoCreate())
102              throw new Error("Attempt to auto-create OrderWhenComponent.schedule");
103            else if (Configuration.doAutoCreate())
104              this.schedule = new Timing(); // cc
105          return this.schedule;
106        }
107
108        public boolean hasSchedule() { 
109          return this.schedule != null && !this.schedule.isEmpty();
110        }
111
112        /**
113         * @param value {@link #schedule} (A formal schedule.)
114         */
115        public OrderWhenComponent setSchedule(Timing value) { 
116          this.schedule = value;
117          return this;
118        }
119
120        protected void listChildren(List<Property> childrenList) {
121          super.listChildren(childrenList);
122          childrenList.add(new Property("code", "CodeableConcept", "Code specifies when request should be done. The code may simply be a priority code.", 0, java.lang.Integer.MAX_VALUE, code));
123          childrenList.add(new Property("schedule", "Timing", "A formal schedule.", 0, java.lang.Integer.MAX_VALUE, schedule));
124        }
125
126      @Override
127      public void setProperty(String name, Base value) throws FHIRException {
128        if (name.equals("code"))
129          this.code = castToCodeableConcept(value); // CodeableConcept
130        else if (name.equals("schedule"))
131          this.schedule = castToTiming(value); // Timing
132        else
133          super.setProperty(name, value);
134      }
135
136      @Override
137      public Base addChild(String name) throws FHIRException {
138        if (name.equals("code")) {
139          this.code = new CodeableConcept();
140          return this.code;
141        }
142        else if (name.equals("schedule")) {
143          this.schedule = new Timing();
144          return this.schedule;
145        }
146        else
147          return super.addChild(name);
148      }
149
150      public OrderWhenComponent copy() {
151        OrderWhenComponent dst = new OrderWhenComponent();
152        copyValues(dst);
153        dst.code = code == null ? null : code.copy();
154        dst.schedule = schedule == null ? null : schedule.copy();
155        return dst;
156      }
157
158      @Override
159      public boolean equalsDeep(Base other) {
160        if (!super.equalsDeep(other))
161          return false;
162        if (!(other instanceof OrderWhenComponent))
163          return false;
164        OrderWhenComponent o = (OrderWhenComponent) other;
165        return compareDeep(code, o.code, true) && compareDeep(schedule, o.schedule, true);
166      }
167
168      @Override
169      public boolean equalsShallow(Base other) {
170        if (!super.equalsShallow(other))
171          return false;
172        if (!(other instanceof OrderWhenComponent))
173          return false;
174        OrderWhenComponent o = (OrderWhenComponent) other;
175        return true;
176      }
177
178      public boolean isEmpty() {
179        return super.isEmpty() && (code == null || code.isEmpty()) && (schedule == null || schedule.isEmpty())
180          ;
181      }
182
183  public String fhirType() {
184    return "Order.when";
185
186  }
187
188  }
189
190    /**
191     * Identifiers assigned to this order by the orderer or by the receiver.
192     */
193    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
194    @Description(shortDefinition="Identifiers assigned to this order by the orderer or by the receiver", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." )
195    protected List<Identifier> identifier;
196
197    /**
198     * When the order was made.
199     */
200    @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
201    @Description(shortDefinition="When the order was made", formalDefinition="When the order was made." )
202    protected DateTimeType date;
203
204    /**
205     * Patient this order is about.
206     */
207    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class}, order=2, min=0, max=1, modifier=false, summary=true)
208    @Description(shortDefinition="Patient this order is about", formalDefinition="Patient this order is about." )
209    protected Reference subject;
210
211    /**
212     * The actual object that is the target of the reference (Patient this order is about.)
213     */
214    protected Resource subjectTarget;
215
216    /**
217     * Who initiated the order.
218     */
219    @Child(name = "source", type = {Practitioner.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
220    @Description(shortDefinition="Who initiated the order", formalDefinition="Who initiated the order." )
221    protected Reference source;
222
223    /**
224     * The actual object that is the target of the reference (Who initiated the order.)
225     */
226    protected Resource sourceTarget;
227
228    /**
229     * Who is intended to fulfill the order.
230     */
231    @Child(name = "target", type = {Organization.class, Device.class, Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true)
232    @Description(shortDefinition="Who is intended to fulfill the order", formalDefinition="Who is intended to fulfill the order." )
233    protected Reference target;
234
235    /**
236     * The actual object that is the target of the reference (Who is intended to fulfill the order.)
237     */
238    protected Resource targetTarget;
239
240    /**
241     * Text - why the order was made.
242     */
243    @Child(name = "reason", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
244    @Description(shortDefinition="Text - why the order was made", formalDefinition="Text - why the order was made." )
245    protected Type reason;
246
247    /**
248     * When order should be fulfilled.
249     */
250    @Child(name = "when", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
251    @Description(shortDefinition="When order should be fulfilled", formalDefinition="When order should be fulfilled." )
252    protected OrderWhenComponent when;
253
254    /**
255     * What action is being ordered.
256     */
257    @Child(name = "detail", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
258    @Description(shortDefinition="What action is being ordered", formalDefinition="What action is being ordered." )
259    protected List<Reference> detail;
260    /**
261     * The actual objects that are the target of the reference (What action is being ordered.)
262     */
263    protected List<Resource> detailTarget;
264
265
266    private static final long serialVersionUID = -1392311096L;
267
268  /*
269   * Constructor
270   */
271    public Order() {
272      super();
273    }
274
275    /**
276     * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.)
277     */
278    public List<Identifier> getIdentifier() { 
279      if (this.identifier == null)
280        this.identifier = new ArrayList<Identifier>();
281      return this.identifier;
282    }
283
284    public boolean hasIdentifier() { 
285      if (this.identifier == null)
286        return false;
287      for (Identifier item : this.identifier)
288        if (!item.isEmpty())
289          return true;
290      return false;
291    }
292
293    /**
294     * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.)
295     */
296    // syntactic sugar
297    public Identifier addIdentifier() { //3
298      Identifier t = new Identifier();
299      if (this.identifier == null)
300        this.identifier = new ArrayList<Identifier>();
301      this.identifier.add(t);
302      return t;
303    }
304
305    // syntactic sugar
306    public Order addIdentifier(Identifier t) { //3
307      if (t == null)
308        return this;
309      if (this.identifier == null)
310        this.identifier = new ArrayList<Identifier>();
311      this.identifier.add(t);
312      return this;
313    }
314
315    /**
316     * @return {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
317     */
318    public DateTimeType getDateElement() { 
319      if (this.date == null)
320        if (Configuration.errorOnAutoCreate())
321          throw new Error("Attempt to auto-create Order.date");
322        else if (Configuration.doAutoCreate())
323          this.date = new DateTimeType(); // bb
324      return this.date;
325    }
326
327    public boolean hasDateElement() { 
328      return this.date != null && !this.date.isEmpty();
329    }
330
331    public boolean hasDate() { 
332      return this.date != null && !this.date.isEmpty();
333    }
334
335    /**
336     * @param value {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
337     */
338    public Order setDateElement(DateTimeType value) { 
339      this.date = value;
340      return this;
341    }
342
343    /**
344     * @return When the order was made.
345     */
346    public Date getDate() { 
347      return this.date == null ? null : this.date.getValue();
348    }
349
350    /**
351     * @param value When the order was made.
352     */
353    public Order setDate(Date value) { 
354      if (value == null)
355        this.date = null;
356      else {
357        if (this.date == null)
358          this.date = new DateTimeType();
359        this.date.setValue(value);
360      }
361      return this;
362    }
363
364    /**
365     * @return {@link #subject} (Patient this order is about.)
366     */
367    public Reference getSubject() { 
368      if (this.subject == null)
369        if (Configuration.errorOnAutoCreate())
370          throw new Error("Attempt to auto-create Order.subject");
371        else if (Configuration.doAutoCreate())
372          this.subject = new Reference(); // cc
373      return this.subject;
374    }
375
376    public boolean hasSubject() { 
377      return this.subject != null && !this.subject.isEmpty();
378    }
379
380    /**
381     * @param value {@link #subject} (Patient this order is about.)
382     */
383    public Order setSubject(Reference value) { 
384      this.subject = value;
385      return this;
386    }
387
388    /**
389     * @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. (Patient this order is about.)
390     */
391    public Resource getSubjectTarget() { 
392      return this.subjectTarget;
393    }
394
395    /**
396     * @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. (Patient this order is about.)
397     */
398    public Order setSubjectTarget(Resource value) { 
399      this.subjectTarget = value;
400      return this;
401    }
402
403    /**
404     * @return {@link #source} (Who initiated the order.)
405     */
406    public Reference getSource() { 
407      if (this.source == null)
408        if (Configuration.errorOnAutoCreate())
409          throw new Error("Attempt to auto-create Order.source");
410        else if (Configuration.doAutoCreate())
411          this.source = new Reference(); // cc
412      return this.source;
413    }
414
415    public boolean hasSource() { 
416      return this.source != null && !this.source.isEmpty();
417    }
418
419    /**
420     * @param value {@link #source} (Who initiated the order.)
421     */
422    public Order setSource(Reference value) { 
423      this.source = value;
424      return this;
425    }
426
427    /**
428     * @return {@link #source} 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. (Who initiated the order.)
429     */
430    public Resource getSourceTarget() { 
431      return this.sourceTarget;
432    }
433
434    /**
435     * @param value {@link #source} 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. (Who initiated the order.)
436     */
437    public Order setSourceTarget(Resource value) { 
438      this.sourceTarget = value;
439      return this;
440    }
441
442    /**
443     * @return {@link #target} (Who is intended to fulfill the order.)
444     */
445    public Reference getTarget() { 
446      if (this.target == null)
447        if (Configuration.errorOnAutoCreate())
448          throw new Error("Attempt to auto-create Order.target");
449        else if (Configuration.doAutoCreate())
450          this.target = new Reference(); // cc
451      return this.target;
452    }
453
454    public boolean hasTarget() { 
455      return this.target != null && !this.target.isEmpty();
456    }
457
458    /**
459     * @param value {@link #target} (Who is intended to fulfill the order.)
460     */
461    public Order setTarget(Reference value) { 
462      this.target = value;
463      return this;
464    }
465
466    /**
467     * @return {@link #target} 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. (Who is intended to fulfill the order.)
468     */
469    public Resource getTargetTarget() { 
470      return this.targetTarget;
471    }
472
473    /**
474     * @param value {@link #target} 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. (Who is intended to fulfill the order.)
475     */
476    public Order setTargetTarget(Resource value) { 
477      this.targetTarget = value;
478      return this;
479    }
480
481    /**
482     * @return {@link #reason} (Text - why the order was made.)
483     */
484    public Type getReason() { 
485      return this.reason;
486    }
487
488    /**
489     * @return {@link #reason} (Text - why the order was made.)
490     */
491    public CodeableConcept getReasonCodeableConcept() throws FHIRException { 
492      if (!(this.reason instanceof CodeableConcept))
493        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered");
494      return (CodeableConcept) this.reason;
495    }
496
497    public boolean hasReasonCodeableConcept() { 
498      return this.reason instanceof CodeableConcept;
499    }
500
501    /**
502     * @return {@link #reason} (Text - why the order was made.)
503     */
504    public Reference getReasonReference() throws FHIRException { 
505      if (!(this.reason instanceof Reference))
506        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered");
507      return (Reference) this.reason;
508    }
509
510    public boolean hasReasonReference() { 
511      return this.reason instanceof Reference;
512    }
513
514    public boolean hasReason() { 
515      return this.reason != null && !this.reason.isEmpty();
516    }
517
518    /**
519     * @param value {@link #reason} (Text - why the order was made.)
520     */
521    public Order setReason(Type value) { 
522      this.reason = value;
523      return this;
524    }
525
526    /**
527     * @return {@link #when} (When order should be fulfilled.)
528     */
529    public OrderWhenComponent getWhen() { 
530      if (this.when == null)
531        if (Configuration.errorOnAutoCreate())
532          throw new Error("Attempt to auto-create Order.when");
533        else if (Configuration.doAutoCreate())
534          this.when = new OrderWhenComponent(); // cc
535      return this.when;
536    }
537
538    public boolean hasWhen() { 
539      return this.when != null && !this.when.isEmpty();
540    }
541
542    /**
543     * @param value {@link #when} (When order should be fulfilled.)
544     */
545    public Order setWhen(OrderWhenComponent value) { 
546      this.when = value;
547      return this;
548    }
549
550    /**
551     * @return {@link #detail} (What action is being ordered.)
552     */
553    public List<Reference> getDetail() { 
554      if (this.detail == null)
555        this.detail = new ArrayList<Reference>();
556      return this.detail;
557    }
558
559    public boolean hasDetail() { 
560      if (this.detail == null)
561        return false;
562      for (Reference item : this.detail)
563        if (!item.isEmpty())
564          return true;
565      return false;
566    }
567
568    /**
569     * @return {@link #detail} (What action is being ordered.)
570     */
571    // syntactic sugar
572    public Reference addDetail() { //3
573      Reference t = new Reference();
574      if (this.detail == null)
575        this.detail = new ArrayList<Reference>();
576      this.detail.add(t);
577      return t;
578    }
579
580    // syntactic sugar
581    public Order addDetail(Reference t) { //3
582      if (t == null)
583        return this;
584      if (this.detail == null)
585        this.detail = new ArrayList<Reference>();
586      this.detail.add(t);
587      return this;
588    }
589
590    /**
591     * @return {@link #detail} (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. What action is being ordered.)
592     */
593    public List<Resource> getDetailTarget() { 
594      if (this.detailTarget == null)
595        this.detailTarget = new ArrayList<Resource>();
596      return this.detailTarget;
597    }
598
599      protected void listChildren(List<Property> childrenList) {
600        super.listChildren(childrenList);
601        childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
602        childrenList.add(new Property("date", "dateTime", "When the order was made.", 0, java.lang.Integer.MAX_VALUE, date));
603        childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Substance)", "Patient this order is about.", 0, java.lang.Integer.MAX_VALUE, subject));
604        childrenList.add(new Property("source", "Reference(Practitioner|Organization)", "Who initiated the order.", 0, java.lang.Integer.MAX_VALUE, source));
605        childrenList.add(new Property("target", "Reference(Organization|Device|Practitioner)", "Who is intended to fulfill the order.", 0, java.lang.Integer.MAX_VALUE, target));
606        childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Any)", "Text - why the order was made.", 0, java.lang.Integer.MAX_VALUE, reason));
607        childrenList.add(new Property("when", "", "When order should be fulfilled.", 0, java.lang.Integer.MAX_VALUE, when));
608        childrenList.add(new Property("detail", "Reference(Any)", "What action is being ordered.", 0, java.lang.Integer.MAX_VALUE, detail));
609      }
610
611      @Override
612      public void setProperty(String name, Base value) throws FHIRException {
613        if (name.equals("identifier"))
614          this.getIdentifier().add(castToIdentifier(value));
615        else if (name.equals("date"))
616          this.date = castToDateTime(value); // DateTimeType
617        else if (name.equals("subject"))
618          this.subject = castToReference(value); // Reference
619        else if (name.equals("source"))
620          this.source = castToReference(value); // Reference
621        else if (name.equals("target"))
622          this.target = castToReference(value); // Reference
623        else if (name.equals("reason[x]"))
624          this.reason = (Type) value; // Type
625        else if (name.equals("when"))
626          this.when = (OrderWhenComponent) value; // OrderWhenComponent
627        else if (name.equals("detail"))
628          this.getDetail().add(castToReference(value));
629        else
630          super.setProperty(name, value);
631      }
632
633      @Override
634      public Base addChild(String name) throws FHIRException {
635        if (name.equals("identifier")) {
636          return addIdentifier();
637        }
638        else if (name.equals("date")) {
639          throw new FHIRException("Cannot call addChild on a primitive type Order.date");
640        }
641        else if (name.equals("subject")) {
642          this.subject = new Reference();
643          return this.subject;
644        }
645        else if (name.equals("source")) {
646          this.source = new Reference();
647          return this.source;
648        }
649        else if (name.equals("target")) {
650          this.target = new Reference();
651          return this.target;
652        }
653        else if (name.equals("reasonCodeableConcept")) {
654          this.reason = new CodeableConcept();
655          return this.reason;
656        }
657        else if (name.equals("reasonReference")) {
658          this.reason = new Reference();
659          return this.reason;
660        }
661        else if (name.equals("when")) {
662          this.when = new OrderWhenComponent();
663          return this.when;
664        }
665        else if (name.equals("detail")) {
666          return addDetail();
667        }
668        else
669          return super.addChild(name);
670      }
671
672  public String fhirType() {
673    return "Order";
674
675  }
676
677      public Order copy() {
678        Order dst = new Order();
679        copyValues(dst);
680        if (identifier != null) {
681          dst.identifier = new ArrayList<Identifier>();
682          for (Identifier i : identifier)
683            dst.identifier.add(i.copy());
684        };
685        dst.date = date == null ? null : date.copy();
686        dst.subject = subject == null ? null : subject.copy();
687        dst.source = source == null ? null : source.copy();
688        dst.target = target == null ? null : target.copy();
689        dst.reason = reason == null ? null : reason.copy();
690        dst.when = when == null ? null : when.copy();
691        if (detail != null) {
692          dst.detail = new ArrayList<Reference>();
693          for (Reference i : detail)
694            dst.detail.add(i.copy());
695        };
696        return dst;
697      }
698
699      protected Order typedCopy() {
700        return copy();
701      }
702
703      @Override
704      public boolean equalsDeep(Base other) {
705        if (!super.equalsDeep(other))
706          return false;
707        if (!(other instanceof Order))
708          return false;
709        Order o = (Order) other;
710        return compareDeep(identifier, o.identifier, true) && compareDeep(date, o.date, true) && compareDeep(subject, o.subject, true)
711           && compareDeep(source, o.source, true) && compareDeep(target, o.target, true) && compareDeep(reason, o.reason, true)
712           && compareDeep(when, o.when, true) && compareDeep(detail, o.detail, true);
713      }
714
715      @Override
716      public boolean equalsShallow(Base other) {
717        if (!super.equalsShallow(other))
718          return false;
719        if (!(other instanceof Order))
720          return false;
721        Order o = (Order) other;
722        return compareValues(date, o.date, true);
723      }
724
725      public boolean isEmpty() {
726        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (date == null || date.isEmpty())
727           && (subject == null || subject.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty())
728           && (reason == null || reason.isEmpty()) && (when == null || when.isEmpty()) && (detail == null || detail.isEmpty())
729          ;
730      }
731
732  @Override
733  public ResourceType getResourceType() {
734    return ResourceType.Order;
735   }
736
737  @SearchParamDefinition(name="date", path="Order.date", description="When the order was made", type="date" )
738  public static final String SP_DATE = "date";
739  @SearchParamDefinition(name="identifier", path="Order.identifier", description="Instance id from source, target, and/or  others", type="token" )
740  public static final String SP_IDENTIFIER = "identifier";
741  @SearchParamDefinition(name="subject", path="Order.subject", description="Patient this order is about", type="reference" )
742  public static final String SP_SUBJECT = "subject";
743  @SearchParamDefinition(name="patient", path="Order.subject", description="Patient this order is about", type="reference" )
744  public static final String SP_PATIENT = "patient";
745  @SearchParamDefinition(name="source", path="Order.source", description="Who initiated the order", type="reference" )
746  public static final String SP_SOURCE = "source";
747  @SearchParamDefinition(name="detail", path="Order.detail", description="What action is being ordered", type="reference" )
748  public static final String SP_DETAIL = "detail";
749  @SearchParamDefinition(name="when", path="Order.when.schedule", description="A formal schedule", type="date" )
750  public static final String SP_WHEN = "when";
751  @SearchParamDefinition(name="target", path="Order.target", description="Who is intended to fulfill the order", type="reference" )
752  public static final String SP_TARGET = "target";
753  @SearchParamDefinition(name="when_code", path="Order.when.code", description="Code specifies when request should be done. The code may simply be a priority code", type="token" )
754  public static final String SP_WHENCODE = "when_code";
755
756}
757