001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
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;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * The findings and interpretation of diagnostic tests performed on patients,
049 * groups of patients, devices, and locations, and/or specimens derived from
050 * these. The report includes clinical context such as requesting and provider
051 * information, and some mix of atomic results, images, textual and coded
052 * interpretations, and formatted representation of diagnostic reports.
053 */
054@ResourceDef(name = "DiagnosticReport", profile = "http://hl7.org/fhir/StructureDefinition/DiagnosticReport")
055public class DiagnosticReport extends DomainResource {
056
057  public enum DiagnosticReportStatus {
058    /**
059     * The existence of the report is registered, but there is nothing yet
060     * available.
061     */
062    REGISTERED,
063    /**
064     * This is a partial (e.g. initial, interim or preliminary) report: data in the
065     * report may be incomplete or unverified.
066     */
067    PARTIAL,
068    /**
069     * Verified early results are available, but not all results are final.
070     */
071    PRELIMINARY,
072    /**
073     * The report is complete and verified by an authorized person.
074     */
075    FINAL,
076    /**
077     * Subsequent to being final, the report has been modified. This includes any
078     * change in the results, diagnosis, narrative text, or other content of a
079     * report that has been issued.
080     */
081    AMENDED,
082    /**
083     * Subsequent to being final, the report has been modified to correct an error
084     * in the report or referenced results.
085     */
086    CORRECTED,
087    /**
088     * Subsequent to being final, the report has been modified by adding new
089     * content. The existing content is unchanged.
090     */
091    APPENDED,
092    /**
093     * The report is unavailable because the measurement was not started or not
094     * completed (also sometimes called "aborted").
095     */
096    CANCELLED,
097    /**
098     * The report has been withdrawn following a previous final release. This
099     * electronic record should never have existed, though it is possible that
100     * real-world decisions were based on it. (If real-world activity has occurred,
101     * the status should be "cancelled" rather than "entered-in-error".).
102     */
103    ENTEREDINERROR,
104    /**
105     * The authoring/source system does not know which of the status values
106     * currently applies for this observation. Note: This concept is not to be used
107     * for "other" - one of the listed statuses is presumed to apply, but the
108     * authoring/source system does not know which.
109     */
110    UNKNOWN,
111    /**
112     * added to help the parsers with the generic types
113     */
114    NULL;
115
116    public static DiagnosticReportStatus fromCode(String codeString) throws FHIRException {
117      if (codeString == null || "".equals(codeString))
118        return null;
119      if ("registered".equals(codeString))
120        return REGISTERED;
121      if ("partial".equals(codeString))
122        return PARTIAL;
123      if ("preliminary".equals(codeString))
124        return PRELIMINARY;
125      if ("final".equals(codeString))
126        return FINAL;
127      if ("amended".equals(codeString))
128        return AMENDED;
129      if ("corrected".equals(codeString))
130        return CORRECTED;
131      if ("appended".equals(codeString))
132        return APPENDED;
133      if ("cancelled".equals(codeString))
134        return CANCELLED;
135      if ("entered-in-error".equals(codeString))
136        return ENTEREDINERROR;
137      if ("unknown".equals(codeString))
138        return UNKNOWN;
139      if (Configuration.isAcceptInvalidEnums())
140        return null;
141      else
142        throw new FHIRException("Unknown DiagnosticReportStatus code '" + codeString + "'");
143    }
144
145    public String toCode() {
146      switch (this) {
147      case REGISTERED:
148        return "registered";
149      case PARTIAL:
150        return "partial";
151      case PRELIMINARY:
152        return "preliminary";
153      case FINAL:
154        return "final";
155      case AMENDED:
156        return "amended";
157      case CORRECTED:
158        return "corrected";
159      case APPENDED:
160        return "appended";
161      case CANCELLED:
162        return "cancelled";
163      case ENTEREDINERROR:
164        return "entered-in-error";
165      case UNKNOWN:
166        return "unknown";
167      case NULL:
168        return null;
169      default:
170        return "?";
171      }
172    }
173
174    public String getSystem() {
175      switch (this) {
176      case REGISTERED:
177        return "http://hl7.org/fhir/diagnostic-report-status";
178      case PARTIAL:
179        return "http://hl7.org/fhir/diagnostic-report-status";
180      case PRELIMINARY:
181        return "http://hl7.org/fhir/diagnostic-report-status";
182      case FINAL:
183        return "http://hl7.org/fhir/diagnostic-report-status";
184      case AMENDED:
185        return "http://hl7.org/fhir/diagnostic-report-status";
186      case CORRECTED:
187        return "http://hl7.org/fhir/diagnostic-report-status";
188      case APPENDED:
189        return "http://hl7.org/fhir/diagnostic-report-status";
190      case CANCELLED:
191        return "http://hl7.org/fhir/diagnostic-report-status";
192      case ENTEREDINERROR:
193        return "http://hl7.org/fhir/diagnostic-report-status";
194      case UNKNOWN:
195        return "http://hl7.org/fhir/diagnostic-report-status";
196      case NULL:
197        return null;
198      default:
199        return "?";
200      }
201    }
202
203    public String getDefinition() {
204      switch (this) {
205      case REGISTERED:
206        return "The existence of the report is registered, but there is nothing yet available.";
207      case PARTIAL:
208        return "This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified.";
209      case PRELIMINARY:
210        return "Verified early results are available, but not all  results are final.";
211      case FINAL:
212        return "The report is complete and verified by an authorized person.";
213      case AMENDED:
214        return "Subsequent to being final, the report has been modified.  This includes any change in the results, diagnosis, narrative text, or other content of a report that has been issued.";
215      case CORRECTED:
216        return "Subsequent to being final, the report has been modified  to correct an error in the report or referenced results.";
217      case APPENDED:
218        return "Subsequent to being final, the report has been modified by adding new content. The existing content is unchanged.";
219      case CANCELLED:
220        return "The report is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
221      case ENTEREDINERROR:
222        return "The report has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
223      case UNKNOWN:
224        return "The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.";
225      case NULL:
226        return null;
227      default:
228        return "?";
229      }
230    }
231
232    public String getDisplay() {
233      switch (this) {
234      case REGISTERED:
235        return "Registered";
236      case PARTIAL:
237        return "Partial";
238      case PRELIMINARY:
239        return "Preliminary";
240      case FINAL:
241        return "Final";
242      case AMENDED:
243        return "Amended";
244      case CORRECTED:
245        return "Corrected";
246      case APPENDED:
247        return "Appended";
248      case CANCELLED:
249        return "Cancelled";
250      case ENTEREDINERROR:
251        return "Entered in Error";
252      case UNKNOWN:
253        return "Unknown";
254      case NULL:
255        return null;
256      default:
257        return "?";
258      }
259    }
260  }
261
262  public static class DiagnosticReportStatusEnumFactory implements EnumFactory<DiagnosticReportStatus> {
263    public DiagnosticReportStatus fromCode(String codeString) throws IllegalArgumentException {
264      if (codeString == null || "".equals(codeString))
265        if (codeString == null || "".equals(codeString))
266          return null;
267      if ("registered".equals(codeString))
268        return DiagnosticReportStatus.REGISTERED;
269      if ("partial".equals(codeString))
270        return DiagnosticReportStatus.PARTIAL;
271      if ("preliminary".equals(codeString))
272        return DiagnosticReportStatus.PRELIMINARY;
273      if ("final".equals(codeString))
274        return DiagnosticReportStatus.FINAL;
275      if ("amended".equals(codeString))
276        return DiagnosticReportStatus.AMENDED;
277      if ("corrected".equals(codeString))
278        return DiagnosticReportStatus.CORRECTED;
279      if ("appended".equals(codeString))
280        return DiagnosticReportStatus.APPENDED;
281      if ("cancelled".equals(codeString))
282        return DiagnosticReportStatus.CANCELLED;
283      if ("entered-in-error".equals(codeString))
284        return DiagnosticReportStatus.ENTEREDINERROR;
285      if ("unknown".equals(codeString))
286        return DiagnosticReportStatus.UNKNOWN;
287      throw new IllegalArgumentException("Unknown DiagnosticReportStatus code '" + codeString + "'");
288    }
289
290    public Enumeration<DiagnosticReportStatus> fromType(PrimitiveType<?> code) throws FHIRException {
291      if (code == null)
292        return null;
293      if (code.isEmpty())
294        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.NULL, code);
295      String codeString = code.asStringValue();
296      if (codeString == null || "".equals(codeString))
297        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.NULL, code);
298      if ("registered".equals(codeString))
299        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.REGISTERED, code);
300      if ("partial".equals(codeString))
301        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.PARTIAL, code);
302      if ("preliminary".equals(codeString))
303        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.PRELIMINARY, code);
304      if ("final".equals(codeString))
305        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.FINAL, code);
306      if ("amended".equals(codeString))
307        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.AMENDED, code);
308      if ("corrected".equals(codeString))
309        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.CORRECTED, code);
310      if ("appended".equals(codeString))
311        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.APPENDED, code);
312      if ("cancelled".equals(codeString))
313        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.CANCELLED, code);
314      if ("entered-in-error".equals(codeString))
315        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.ENTEREDINERROR, code);
316      if ("unknown".equals(codeString))
317        return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.UNKNOWN, code);
318      throw new FHIRException("Unknown DiagnosticReportStatus code '" + codeString + "'");
319    }
320
321    public String toCode(DiagnosticReportStatus code) {
322      if (code == DiagnosticReportStatus.REGISTERED)
323        return "registered";
324      if (code == DiagnosticReportStatus.PARTIAL)
325        return "partial";
326      if (code == DiagnosticReportStatus.PRELIMINARY)
327        return "preliminary";
328      if (code == DiagnosticReportStatus.FINAL)
329        return "final";
330      if (code == DiagnosticReportStatus.AMENDED)
331        return "amended";
332      if (code == DiagnosticReportStatus.CORRECTED)
333        return "corrected";
334      if (code == DiagnosticReportStatus.APPENDED)
335        return "appended";
336      if (code == DiagnosticReportStatus.CANCELLED)
337        return "cancelled";
338      if (code == DiagnosticReportStatus.ENTEREDINERROR)
339        return "entered-in-error";
340      if (code == DiagnosticReportStatus.UNKNOWN)
341        return "unknown";
342      return "?";
343    }
344
345    public String toSystem(DiagnosticReportStatus code) {
346      return code.getSystem();
347    }
348  }
349
350  @Block()
351  public static class DiagnosticReportMediaComponent extends BackboneElement implements IBaseBackboneElement {
352    /**
353     * A comment about the image. Typically, this is used to provide an explanation
354     * for why the image is included, or to draw the viewer's attention to important
355     * features.
356     */
357    @Child(name = "comment", type = {
358        StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
359    @Description(shortDefinition = "Comment about the image (e.g. explanation)", formalDefinition = "A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.")
360    protected StringType comment;
361
362    /**
363     * Reference to the image source.
364     */
365    @Child(name = "link", type = { Media.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
366    @Description(shortDefinition = "Reference to the image source", formalDefinition = "Reference to the image source.")
367    protected Reference link;
368
369    /**
370     * The actual object that is the target of the reference (Reference to the image
371     * source.)
372     */
373    protected Media linkTarget;
374
375    private static final long serialVersionUID = 935791940L;
376
377    /**
378     * Constructor
379     */
380    public DiagnosticReportMediaComponent() {
381      super();
382    }
383
384    /**
385     * Constructor
386     */
387    public DiagnosticReportMediaComponent(Reference link) {
388      super();
389      this.link = link;
390    }
391
392    /**
393     * @return {@link #comment} (A comment about the image. Typically, this is used
394     *         to provide an explanation for why the image is included, or to draw
395     *         the viewer's attention to important features.). This is the
396     *         underlying object with id, value and extensions. The accessor
397     *         "getComment" gives direct access to the value
398     */
399    public StringType getCommentElement() {
400      if (this.comment == null)
401        if (Configuration.errorOnAutoCreate())
402          throw new Error("Attempt to auto-create DiagnosticReportMediaComponent.comment");
403        else if (Configuration.doAutoCreate())
404          this.comment = new StringType(); // bb
405      return this.comment;
406    }
407
408    public boolean hasCommentElement() {
409      return this.comment != null && !this.comment.isEmpty();
410    }
411
412    public boolean hasComment() {
413      return this.comment != null && !this.comment.isEmpty();
414    }
415
416    /**
417     * @param value {@link #comment} (A comment about the image. Typically, this is
418     *              used to provide an explanation for why the image is included, or
419     *              to draw the viewer's attention to important features.). This is
420     *              the underlying object with id, value and extensions. The
421     *              accessor "getComment" gives direct access to the value
422     */
423    public DiagnosticReportMediaComponent setCommentElement(StringType value) {
424      this.comment = value;
425      return this;
426    }
427
428    /**
429     * @return A comment about the image. Typically, this is used to provide an
430     *         explanation for why the image is included, or to draw the viewer's
431     *         attention to important features.
432     */
433    public String getComment() {
434      return this.comment == null ? null : this.comment.getValue();
435    }
436
437    /**
438     * @param value A comment about the image. Typically, this is used to provide an
439     *              explanation for why the image is included, or to draw the
440     *              viewer's attention to important features.
441     */
442    public DiagnosticReportMediaComponent setComment(String value) {
443      if (Utilities.noString(value))
444        this.comment = null;
445      else {
446        if (this.comment == null)
447          this.comment = new StringType();
448        this.comment.setValue(value);
449      }
450      return this;
451    }
452
453    /**
454     * @return {@link #link} (Reference to the image source.)
455     */
456    public Reference getLink() {
457      if (this.link == null)
458        if (Configuration.errorOnAutoCreate())
459          throw new Error("Attempt to auto-create DiagnosticReportMediaComponent.link");
460        else if (Configuration.doAutoCreate())
461          this.link = new Reference(); // cc
462      return this.link;
463    }
464
465    public boolean hasLink() {
466      return this.link != null && !this.link.isEmpty();
467    }
468
469    /**
470     * @param value {@link #link} (Reference to the image source.)
471     */
472    public DiagnosticReportMediaComponent setLink(Reference value) {
473      this.link = value;
474      return this;
475    }
476
477    /**
478     * @return {@link #link} The actual object that is the target of the reference.
479     *         The reference library doesn't populate this, but you can use it to
480     *         hold the resource if you resolve it. (Reference to the image source.)
481     */
482    public Media getLinkTarget() {
483      if (this.linkTarget == null)
484        if (Configuration.errorOnAutoCreate())
485          throw new Error("Attempt to auto-create DiagnosticReportMediaComponent.link");
486        else if (Configuration.doAutoCreate())
487          this.linkTarget = new Media(); // aa
488      return this.linkTarget;
489    }
490
491    /**
492     * @param value {@link #link} The actual object that is the target of the
493     *              reference. The reference library doesn't use these, but you can
494     *              use it to hold the resource if you resolve it. (Reference to the
495     *              image source.)
496     */
497    public DiagnosticReportMediaComponent setLinkTarget(Media value) {
498      this.linkTarget = value;
499      return this;
500    }
501
502    protected void listChildren(List<Property> children) {
503      super.listChildren(children);
504      children.add(new Property("comment", "string",
505          "A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.",
506          0, 1, comment));
507      children.add(new Property("link", "Reference(Media)", "Reference to the image source.", 0, 1, link));
508    }
509
510    @Override
511    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
512      switch (_hash) {
513      case 950398559:
514        /* comment */ return new Property("comment", "string",
515            "A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.",
516            0, 1, comment);
517      case 3321850:
518        /* link */ return new Property("link", "Reference(Media)", "Reference to the image source.", 0, 1, link);
519      default:
520        return super.getNamedProperty(_hash, _name, _checkValid);
521      }
522
523    }
524
525    @Override
526    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
527      switch (hash) {
528      case 950398559:
529        /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType
530      case 3321850:
531        /* link */ return this.link == null ? new Base[0] : new Base[] { this.link }; // Reference
532      default:
533        return super.getProperty(hash, name, checkValid);
534      }
535
536    }
537
538    @Override
539    public Base setProperty(int hash, String name, Base value) throws FHIRException {
540      switch (hash) {
541      case 950398559: // comment
542        this.comment = castToString(value); // StringType
543        return value;
544      case 3321850: // link
545        this.link = castToReference(value); // Reference
546        return value;
547      default:
548        return super.setProperty(hash, name, value);
549      }
550
551    }
552
553    @Override
554    public Base setProperty(String name, Base value) throws FHIRException {
555      if (name.equals("comment")) {
556        this.comment = castToString(value); // StringType
557      } else if (name.equals("link")) {
558        this.link = castToReference(value); // Reference
559      } else
560        return super.setProperty(name, value);
561      return value;
562    }
563
564    @Override
565    public Base makeProperty(int hash, String name) throws FHIRException {
566      switch (hash) {
567      case 950398559:
568        return getCommentElement();
569      case 3321850:
570        return getLink();
571      default:
572        return super.makeProperty(hash, name);
573      }
574
575    }
576
577    @Override
578    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
579      switch (hash) {
580      case 950398559:
581        /* comment */ return new String[] { "string" };
582      case 3321850:
583        /* link */ return new String[] { "Reference" };
584      default:
585        return super.getTypesForProperty(hash, name);
586      }
587
588    }
589
590    @Override
591    public Base addChild(String name) throws FHIRException {
592      if (name.equals("comment")) {
593        throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.comment");
594      } else if (name.equals("link")) {
595        this.link = new Reference();
596        return this.link;
597      } else
598        return super.addChild(name);
599    }
600
601    public DiagnosticReportMediaComponent copy() {
602      DiagnosticReportMediaComponent dst = new DiagnosticReportMediaComponent();
603      copyValues(dst);
604      return dst;
605    }
606
607    public void copyValues(DiagnosticReportMediaComponent dst) {
608      super.copyValues(dst);
609      dst.comment = comment == null ? null : comment.copy();
610      dst.link = link == null ? null : link.copy();
611    }
612
613    @Override
614    public boolean equalsDeep(Base other_) {
615      if (!super.equalsDeep(other_))
616        return false;
617      if (!(other_ instanceof DiagnosticReportMediaComponent))
618        return false;
619      DiagnosticReportMediaComponent o = (DiagnosticReportMediaComponent) other_;
620      return compareDeep(comment, o.comment, true) && compareDeep(link, o.link, true);
621    }
622
623    @Override
624    public boolean equalsShallow(Base other_) {
625      if (!super.equalsShallow(other_))
626        return false;
627      if (!(other_ instanceof DiagnosticReportMediaComponent))
628        return false;
629      DiagnosticReportMediaComponent o = (DiagnosticReportMediaComponent) other_;
630      return compareValues(comment, o.comment, true);
631    }
632
633    public boolean isEmpty() {
634      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, link);
635    }
636
637    public String fhirType() {
638      return "DiagnosticReport.media";
639
640    }
641
642  }
643
644  /**
645   * Identifiers assigned to this report by the performer or other systems.
646   */
647  @Child(name = "identifier", type = {
648      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
649  @Description(shortDefinition = "Business identifier for report", formalDefinition = "Identifiers assigned to this report by the performer or other systems.")
650  protected List<Identifier> identifier;
651
652  /**
653   * Details concerning a service requested.
654   */
655  @Child(name = "basedOn", type = { CarePlan.class, ImmunizationRecommendation.class, MedicationRequest.class,
656      NutritionOrder.class,
657      ServiceRequest.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
658  @Description(shortDefinition = "What was requested", formalDefinition = "Details concerning a service requested.")
659  protected List<Reference> basedOn;
660  /**
661   * The actual objects that are the target of the reference (Details concerning a
662   * service requested.)
663   */
664  protected List<Resource> basedOnTarget;
665
666  /**
667   * The status of the diagnostic report.
668   */
669  @Child(name = "status", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
670  @Description(shortDefinition = "registered | partial | preliminary | final +", formalDefinition = "The status of the diagnostic report.")
671  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/diagnostic-report-status")
672  protected Enumeration<DiagnosticReportStatus> status;
673
674  /**
675   * A code that classifies the clinical discipline, department or diagnostic
676   * service that created the report (e.g. cardiology, biochemistry, hematology,
677   * MRI). This is used for searching, sorting and display purposes.
678   */
679  @Child(name = "category", type = {
680      CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
681  @Description(shortDefinition = "Service category", formalDefinition = "A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.")
682  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/diagnostic-service-sections")
683  protected List<CodeableConcept> category;
684
685  /**
686   * A code or name that describes this diagnostic report.
687   */
688  @Child(name = "code", type = { CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
689  @Description(shortDefinition = "Name/Code for this diagnostic report", formalDefinition = "A code or name that describes this diagnostic report.")
690  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/report-codes")
691  protected CodeableConcept code;
692
693  /**
694   * The subject of the report. Usually, but not always, this is a patient.
695   * However, diagnostic services also perform analyses on specimens collected
696   * from a variety of other sources.
697   */
698  @Child(name = "subject", type = { Patient.class, Group.class, Device.class,
699      Location.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
700  @Description(shortDefinition = "The subject of the report - usually, but not always, the patient", formalDefinition = "The subject of the report. Usually, but not always, this is a patient. However, diagnostic services also perform analyses on specimens collected from a variety of other sources.")
701  protected Reference subject;
702
703  /**
704   * The actual object that is the target of the reference (The subject of the
705   * report. Usually, but not always, this is a patient. However, diagnostic
706   * services also perform analyses on specimens collected from a variety of other
707   * sources.)
708   */
709  protected Resource subjectTarget;
710
711  /**
712   * The healthcare event (e.g. a patient and healthcare provider interaction)
713   * which this DiagnosticReport is about.
714   */
715  @Child(name = "encounter", type = { Encounter.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
716  @Description(shortDefinition = "Health care event when test ordered", formalDefinition = "The healthcare event  (e.g. a patient and healthcare provider interaction) which this DiagnosticReport is about.")
717  protected Reference encounter;
718
719  /**
720   * The actual object that is the target of the reference (The healthcare event
721   * (e.g. a patient and healthcare provider interaction) which this
722   * DiagnosticReport is about.)
723   */
724  protected Encounter encounterTarget;
725
726  /**
727   * The time or time-period the observed values are related to. When the subject
728   * of the report is a patient, this is usually either the time of the procedure
729   * or of specimen collection(s), but very often the source of the date/time is
730   * not known, only the date/time itself.
731   */
732  @Child(name = "effective", type = { DateTimeType.class,
733      Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
734  @Description(shortDefinition = "Clinically relevant time/time-period for report", formalDefinition = "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.")
735  protected Type effective;
736
737  /**
738   * The date and time that this version of the report was made available to
739   * providers, typically after the report was reviewed and verified.
740   */
741  @Child(name = "issued", type = { InstantType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
742  @Description(shortDefinition = "DateTime this version was made", formalDefinition = "The date and time that this version of the report was made available to providers, typically after the report was reviewed and verified.")
743  protected InstantType issued;
744
745  /**
746   * The diagnostic service that is responsible for issuing the report.
747   */
748  @Child(name = "performer", type = { Practitioner.class, PractitionerRole.class, Organization.class,
749      CareTeam.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
750  @Description(shortDefinition = "Responsible Diagnostic Service", formalDefinition = "The diagnostic service that is responsible for issuing the report.")
751  protected List<Reference> performer;
752  /**
753   * The actual objects that are the target of the reference (The diagnostic
754   * service that is responsible for issuing the report.)
755   */
756  protected List<Resource> performerTarget;
757
758  /**
759   * The practitioner or organization that is responsible for the report's
760   * conclusions and interpretations.
761   */
762  @Child(name = "resultsInterpreter", type = { Practitioner.class, PractitionerRole.class, Organization.class,
763      CareTeam.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
764  @Description(shortDefinition = "Primary result interpreter", formalDefinition = "The practitioner or organization that is responsible for the report's conclusions and interpretations.")
765  protected List<Reference> resultsInterpreter;
766  /**
767   * The actual objects that are the target of the reference (The practitioner or
768   * organization that is responsible for the report's conclusions and
769   * interpretations.)
770   */
771  protected List<Resource> resultsInterpreterTarget;
772
773  /**
774   * Details about the specimens on which this diagnostic report is based.
775   */
776  @Child(name = "specimen", type = {
777      Specimen.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
778  @Description(shortDefinition = "Specimens this report is based on", formalDefinition = "Details about the specimens on which this diagnostic report is based.")
779  protected List<Reference> specimen;
780  /**
781   * The actual objects that are the target of the reference (Details about the
782   * specimens on which this diagnostic report is based.)
783   */
784  protected List<Specimen> specimenTarget;
785
786  /**
787   * [Observations](observation.html) that are part of this diagnostic report.
788   */
789  @Child(name = "result", type = {
790      Observation.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
791  @Description(shortDefinition = "Observations", formalDefinition = "[Observations](observation.html)  that are part of this diagnostic report.")
792  protected List<Reference> result;
793  /**
794   * The actual objects that are the target of the reference
795   * ([Observations](observation.html) that are part of this diagnostic report.)
796   */
797  protected List<Observation> resultTarget;
798
799  /**
800   * One or more links to full details of any imaging performed during the
801   * diagnostic investigation. Typically, this is imaging performed by DICOM
802   * enabled modalities, but this is not required. A fully enabled PACS viewer can
803   * use this information to provide views of the source images.
804   */
805  @Child(name = "imagingStudy", type = {
806      ImagingStudy.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
807  @Description(shortDefinition = "Reference to full details of imaging associated with the diagnostic report", formalDefinition = "One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.")
808  protected List<Reference> imagingStudy;
809  /**
810   * The actual objects that are the target of the reference (One or more links to
811   * full details of any imaging performed during the diagnostic investigation.
812   * Typically, this is imaging performed by DICOM enabled modalities, but this is
813   * not required. A fully enabled PACS viewer can use this information to provide
814   * views of the source images.)
815   */
816  protected List<ImagingStudy> imagingStudyTarget;
817
818  /**
819   * A list of key images associated with this report. The images are generally
820   * created during the diagnostic process, and may be directly of the patient, or
821   * of treated specimens (i.e. slides of interest).
822   */
823  @Child(name = "media", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
824  @Description(shortDefinition = "Key images associated with this report", formalDefinition = "A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).")
825  protected List<DiagnosticReportMediaComponent> media;
826
827  /**
828   * Concise and clinically contextualized summary conclusion
829   * (interpretation/impression) of the diagnostic report.
830   */
831  @Child(name = "conclusion", type = {
832      StringType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
833  @Description(shortDefinition = "Clinical conclusion (interpretation) of test results", formalDefinition = "Concise and clinically contextualized summary conclusion (interpretation/impression) of the diagnostic report.")
834  protected StringType conclusion;
835
836  /**
837   * One or more codes that represent the summary conclusion
838   * (interpretation/impression) of the diagnostic report.
839   */
840  @Child(name = "conclusionCode", type = {
841      CodeableConcept.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
842  @Description(shortDefinition = "Codes for the clinical conclusion of test results", formalDefinition = "One or more codes that represent the summary conclusion (interpretation/impression) of the diagnostic report.")
843  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/clinical-findings")
844  protected List<CodeableConcept> conclusionCode;
845
846  /**
847   * Rich text representation of the entire result as issued by the diagnostic
848   * service. Multiple formats are allowed but they SHALL be semantically
849   * equivalent.
850   */
851  @Child(name = "presentedForm", type = {
852      Attachment.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
853  @Description(shortDefinition = "Entire report as issued", formalDefinition = "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.")
854  protected List<Attachment> presentedForm;
855
856  private static final long serialVersionUID = 589102296L;
857
858  /**
859   * Constructor
860   */
861  public DiagnosticReport() {
862    super();
863  }
864
865  /**
866   * Constructor
867   */
868  public DiagnosticReport(Enumeration<DiagnosticReportStatus> status, CodeableConcept code) {
869    super();
870    this.status = status;
871    this.code = code;
872  }
873
874  /**
875   * @return {@link #identifier} (Identifiers assigned to this report by the
876   *         performer or other systems.)
877   */
878  public List<Identifier> getIdentifier() {
879    if (this.identifier == null)
880      this.identifier = new ArrayList<Identifier>();
881    return this.identifier;
882  }
883
884  /**
885   * @return Returns a reference to <code>this</code> for easy method chaining
886   */
887  public DiagnosticReport setIdentifier(List<Identifier> theIdentifier) {
888    this.identifier = theIdentifier;
889    return this;
890  }
891
892  public boolean hasIdentifier() {
893    if (this.identifier == null)
894      return false;
895    for (Identifier item : this.identifier)
896      if (!item.isEmpty())
897        return true;
898    return false;
899  }
900
901  public Identifier addIdentifier() { // 3
902    Identifier t = new Identifier();
903    if (this.identifier == null)
904      this.identifier = new ArrayList<Identifier>();
905    this.identifier.add(t);
906    return t;
907  }
908
909  public DiagnosticReport addIdentifier(Identifier t) { // 3
910    if (t == null)
911      return this;
912    if (this.identifier == null)
913      this.identifier = new ArrayList<Identifier>();
914    this.identifier.add(t);
915    return this;
916  }
917
918  /**
919   * @return The first repetition of repeating field {@link #identifier}, creating
920   *         it if it does not already exist
921   */
922  public Identifier getIdentifierFirstRep() {
923    if (getIdentifier().isEmpty()) {
924      addIdentifier();
925    }
926    return getIdentifier().get(0);
927  }
928
929  /**
930   * @return {@link #basedOn} (Details concerning a service requested.)
931   */
932  public List<Reference> getBasedOn() {
933    if (this.basedOn == null)
934      this.basedOn = new ArrayList<Reference>();
935    return this.basedOn;
936  }
937
938  /**
939   * @return Returns a reference to <code>this</code> for easy method chaining
940   */
941  public DiagnosticReport setBasedOn(List<Reference> theBasedOn) {
942    this.basedOn = theBasedOn;
943    return this;
944  }
945
946  public boolean hasBasedOn() {
947    if (this.basedOn == null)
948      return false;
949    for (Reference item : this.basedOn)
950      if (!item.isEmpty())
951        return true;
952    return false;
953  }
954
955  public Reference addBasedOn() { // 3
956    Reference t = new Reference();
957    if (this.basedOn == null)
958      this.basedOn = new ArrayList<Reference>();
959    this.basedOn.add(t);
960    return t;
961  }
962
963  public DiagnosticReport addBasedOn(Reference t) { // 3
964    if (t == null)
965      return this;
966    if (this.basedOn == null)
967      this.basedOn = new ArrayList<Reference>();
968    this.basedOn.add(t);
969    return this;
970  }
971
972  /**
973   * @return The first repetition of repeating field {@link #basedOn}, creating it
974   *         if it does not already exist
975   */
976  public Reference getBasedOnFirstRep() {
977    if (getBasedOn().isEmpty()) {
978      addBasedOn();
979    }
980    return getBasedOn().get(0);
981  }
982
983  /**
984   * @deprecated Use Reference#setResource(IBaseResource) instead
985   */
986  @Deprecated
987  public List<Resource> getBasedOnTarget() {
988    if (this.basedOnTarget == null)
989      this.basedOnTarget = new ArrayList<Resource>();
990    return this.basedOnTarget;
991  }
992
993  /**
994   * @return {@link #status} (The status of the diagnostic report.). This is the
995   *         underlying object with id, value and extensions. The accessor
996   *         "getStatus" gives direct access to the value
997   */
998  public Enumeration<DiagnosticReportStatus> getStatusElement() {
999    if (this.status == null)
1000      if (Configuration.errorOnAutoCreate())
1001        throw new Error("Attempt to auto-create DiagnosticReport.status");
1002      else if (Configuration.doAutoCreate())
1003        this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory()); // bb
1004    return this.status;
1005  }
1006
1007  public boolean hasStatusElement() {
1008    return this.status != null && !this.status.isEmpty();
1009  }
1010
1011  public boolean hasStatus() {
1012    return this.status != null && !this.status.isEmpty();
1013  }
1014
1015  /**
1016   * @param value {@link #status} (The status of the diagnostic report.). This is
1017   *              the underlying object with id, value and extensions. The
1018   *              accessor "getStatus" gives direct access to the value
1019   */
1020  public DiagnosticReport setStatusElement(Enumeration<DiagnosticReportStatus> value) {
1021    this.status = value;
1022    return this;
1023  }
1024
1025  /**
1026   * @return The status of the diagnostic report.
1027   */
1028  public DiagnosticReportStatus getStatus() {
1029    return this.status == null ? null : this.status.getValue();
1030  }
1031
1032  /**
1033   * @param value The status of the diagnostic report.
1034   */
1035  public DiagnosticReport setStatus(DiagnosticReportStatus value) {
1036    if (this.status == null)
1037      this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory());
1038    this.status.setValue(value);
1039    return this;
1040  }
1041
1042  /**
1043   * @return {@link #category} (A code that classifies the clinical discipline,
1044   *         department or diagnostic service that created the report (e.g.
1045   *         cardiology, biochemistry, hematology, MRI). This is used for
1046   *         searching, sorting and display purposes.)
1047   */
1048  public List<CodeableConcept> getCategory() {
1049    if (this.category == null)
1050      this.category = new ArrayList<CodeableConcept>();
1051    return this.category;
1052  }
1053
1054  /**
1055   * @return Returns a reference to <code>this</code> for easy method chaining
1056   */
1057  public DiagnosticReport setCategory(List<CodeableConcept> theCategory) {
1058    this.category = theCategory;
1059    return this;
1060  }
1061
1062  public boolean hasCategory() {
1063    if (this.category == null)
1064      return false;
1065    for (CodeableConcept item : this.category)
1066      if (!item.isEmpty())
1067        return true;
1068    return false;
1069  }
1070
1071  public CodeableConcept addCategory() { // 3
1072    CodeableConcept t = new CodeableConcept();
1073    if (this.category == null)
1074      this.category = new ArrayList<CodeableConcept>();
1075    this.category.add(t);
1076    return t;
1077  }
1078
1079  public DiagnosticReport addCategory(CodeableConcept t) { // 3
1080    if (t == null)
1081      return this;
1082    if (this.category == null)
1083      this.category = new ArrayList<CodeableConcept>();
1084    this.category.add(t);
1085    return this;
1086  }
1087
1088  /**
1089   * @return The first repetition of repeating field {@link #category}, creating
1090   *         it if it does not already exist
1091   */
1092  public CodeableConcept getCategoryFirstRep() {
1093    if (getCategory().isEmpty()) {
1094      addCategory();
1095    }
1096    return getCategory().get(0);
1097  }
1098
1099  /**
1100   * @return {@link #code} (A code or name that describes this diagnostic report.)
1101   */
1102  public CodeableConcept getCode() {
1103    if (this.code == null)
1104      if (Configuration.errorOnAutoCreate())
1105        throw new Error("Attempt to auto-create DiagnosticReport.code");
1106      else if (Configuration.doAutoCreate())
1107        this.code = new CodeableConcept(); // cc
1108    return this.code;
1109  }
1110
1111  public boolean hasCode() {
1112    return this.code != null && !this.code.isEmpty();
1113  }
1114
1115  /**
1116   * @param value {@link #code} (A code or name that describes this diagnostic
1117   *              report.)
1118   */
1119  public DiagnosticReport setCode(CodeableConcept value) {
1120    this.code = value;
1121    return this;
1122  }
1123
1124  /**
1125   * @return {@link #subject} (The subject of the report. Usually, but not always,
1126   *         this is a patient. However, diagnostic services also perform analyses
1127   *         on specimens collected from a variety of other sources.)
1128   */
1129  public Reference getSubject() {
1130    if (this.subject == null)
1131      if (Configuration.errorOnAutoCreate())
1132        throw new Error("Attempt to auto-create DiagnosticReport.subject");
1133      else if (Configuration.doAutoCreate())
1134        this.subject = new Reference(); // cc
1135    return this.subject;
1136  }
1137
1138  public boolean hasSubject() {
1139    return this.subject != null && !this.subject.isEmpty();
1140  }
1141
1142  /**
1143   * @param value {@link #subject} (The subject of the report. Usually, but not
1144   *              always, this is a patient. However, diagnostic services also
1145   *              perform analyses on specimens collected from a variety of other
1146   *              sources.)
1147   */
1148  public DiagnosticReport setSubject(Reference value) {
1149    this.subject = value;
1150    return this;
1151  }
1152
1153  /**
1154   * @return {@link #subject} The actual object that is the target of the
1155   *         reference. The reference library doesn't populate this, but you can
1156   *         use it to hold the resource if you resolve it. (The subject of the
1157   *         report. Usually, but not always, this is a patient. However,
1158   *         diagnostic services also perform analyses on specimens collected from
1159   *         a variety of other sources.)
1160   */
1161  public Resource getSubjectTarget() {
1162    return this.subjectTarget;
1163  }
1164
1165  /**
1166   * @param value {@link #subject} The actual object that is the target of the
1167   *              reference. The reference library doesn't use these, but you can
1168   *              use it to hold the resource if you resolve it. (The subject of
1169   *              the report. Usually, but not always, this is a patient. However,
1170   *              diagnostic services also perform analyses on specimens collected
1171   *              from a variety of other sources.)
1172   */
1173  public DiagnosticReport setSubjectTarget(Resource value) {
1174    this.subjectTarget = value;
1175    return this;
1176  }
1177
1178  /**
1179   * @return {@link #encounter} (The healthcare event (e.g. a patient and
1180   *         healthcare provider interaction) which this DiagnosticReport is
1181   *         about.)
1182   */
1183  public Reference getEncounter() {
1184    if (this.encounter == null)
1185      if (Configuration.errorOnAutoCreate())
1186        throw new Error("Attempt to auto-create DiagnosticReport.encounter");
1187      else if (Configuration.doAutoCreate())
1188        this.encounter = new Reference(); // cc
1189    return this.encounter;
1190  }
1191
1192  public boolean hasEncounter() {
1193    return this.encounter != null && !this.encounter.isEmpty();
1194  }
1195
1196  /**
1197   * @param value {@link #encounter} (The healthcare event (e.g. a patient and
1198   *              healthcare provider interaction) which this DiagnosticReport is
1199   *              about.)
1200   */
1201  public DiagnosticReport setEncounter(Reference value) {
1202    this.encounter = value;
1203    return this;
1204  }
1205
1206  /**
1207   * @return {@link #encounter} The actual object that is the target of the
1208   *         reference. The reference library doesn't populate this, but you can
1209   *         use it to hold the resource if you resolve it. (The healthcare event
1210   *         (e.g. a patient and healthcare provider interaction) which this
1211   *         DiagnosticReport is about.)
1212   */
1213  public Encounter getEncounterTarget() {
1214    if (this.encounterTarget == null)
1215      if (Configuration.errorOnAutoCreate())
1216        throw new Error("Attempt to auto-create DiagnosticReport.encounter");
1217      else if (Configuration.doAutoCreate())
1218        this.encounterTarget = new Encounter(); // aa
1219    return this.encounterTarget;
1220  }
1221
1222  /**
1223   * @param value {@link #encounter} The actual object that is the target of the
1224   *              reference. The reference library doesn't use these, but you can
1225   *              use it to hold the resource if you resolve it. (The healthcare
1226   *              event (e.g. a patient and healthcare provider interaction) which
1227   *              this DiagnosticReport is about.)
1228   */
1229  public DiagnosticReport setEncounterTarget(Encounter value) {
1230    this.encounterTarget = value;
1231    return this;
1232  }
1233
1234  /**
1235   * @return {@link #effective} (The time or time-period the observed values are
1236   *         related to. When the subject of the report is a patient, this is
1237   *         usually either the time of the procedure or of specimen
1238   *         collection(s), but very often the source of the date/time is not
1239   *         known, only the date/time itself.)
1240   */
1241  public Type getEffective() {
1242    return this.effective;
1243  }
1244
1245  /**
1246   * @return {@link #effective} (The time or time-period the observed values are
1247   *         related to. When the subject of the report is a patient, this is
1248   *         usually either the time of the procedure or of specimen
1249   *         collection(s), but very often the source of the date/time is not
1250   *         known, only the date/time itself.)
1251   */
1252  public DateTimeType getEffectiveDateTimeType() throws FHIRException {
1253    if (this.effective == null)
1254      this.effective = new DateTimeType();
1255    if (!(this.effective instanceof DateTimeType))
1256      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1257          + this.effective.getClass().getName() + " was encountered");
1258    return (DateTimeType) this.effective;
1259  }
1260
1261  public boolean hasEffectiveDateTimeType() {
1262    return this != null && this.effective instanceof DateTimeType;
1263  }
1264
1265  /**
1266   * @return {@link #effective} (The time or time-period the observed values are
1267   *         related to. When the subject of the report is a patient, this is
1268   *         usually either the time of the procedure or of specimen
1269   *         collection(s), but very often the source of the date/time is not
1270   *         known, only the date/time itself.)
1271   */
1272  public Period getEffectivePeriod() throws FHIRException {
1273    if (this.effective == null)
1274      this.effective = new Period();
1275    if (!(this.effective instanceof Period))
1276      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.effective.getClass().getName()
1277          + " was encountered");
1278    return (Period) this.effective;
1279  }
1280
1281  public boolean hasEffectivePeriod() {
1282    return this != null && this.effective instanceof Period;
1283  }
1284
1285  public boolean hasEffective() {
1286    return this.effective != null && !this.effective.isEmpty();
1287  }
1288
1289  /**
1290   * @param value {@link #effective} (The time or time-period the observed values
1291   *              are related to. When the subject of the report is a patient,
1292   *              this is usually either the time of the procedure or of specimen
1293   *              collection(s), but very often the source of the date/time is not
1294   *              known, only the date/time itself.)
1295   */
1296  public DiagnosticReport setEffective(Type value) {
1297    if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1298      throw new Error("Not the right type for DiagnosticReport.effective[x]: " + value.fhirType());
1299    this.effective = value;
1300    return this;
1301  }
1302
1303  /**
1304   * @return {@link #issued} (The date and time that this version of the report
1305   *         was made available to providers, typically after the report was
1306   *         reviewed and verified.). This is the underlying object with id, value
1307   *         and extensions. The accessor "getIssued" gives direct access to the
1308   *         value
1309   */
1310  public InstantType getIssuedElement() {
1311    if (this.issued == null)
1312      if (Configuration.errorOnAutoCreate())
1313        throw new Error("Attempt to auto-create DiagnosticReport.issued");
1314      else if (Configuration.doAutoCreate())
1315        this.issued = new InstantType(); // bb
1316    return this.issued;
1317  }
1318
1319  public boolean hasIssuedElement() {
1320    return this.issued != null && !this.issued.isEmpty();
1321  }
1322
1323  public boolean hasIssued() {
1324    return this.issued != null && !this.issued.isEmpty();
1325  }
1326
1327  /**
1328   * @param value {@link #issued} (The date and time that this version of the
1329   *              report was made available to providers, typically after the
1330   *              report was reviewed and verified.). This is the underlying
1331   *              object with id, value and extensions. The accessor "getIssued"
1332   *              gives direct access to the value
1333   */
1334  public DiagnosticReport setIssuedElement(InstantType value) {
1335    this.issued = value;
1336    return this;
1337  }
1338
1339  /**
1340   * @return The date and time that this version of the report was made available
1341   *         to providers, typically after the report was reviewed and verified.
1342   */
1343  public Date getIssued() {
1344    return this.issued == null ? null : this.issued.getValue();
1345  }
1346
1347  /**
1348   * @param value The date and time that this version of the report was made
1349   *              available to providers, typically after the report was reviewed
1350   *              and verified.
1351   */
1352  public DiagnosticReport setIssued(Date value) {
1353    if (value == null)
1354      this.issued = null;
1355    else {
1356      if (this.issued == null)
1357        this.issued = new InstantType();
1358      this.issued.setValue(value);
1359    }
1360    return this;
1361  }
1362
1363  /**
1364   * @return {@link #performer} (The diagnostic service that is responsible for
1365   *         issuing the report.)
1366   */
1367  public List<Reference> getPerformer() {
1368    if (this.performer == null)
1369      this.performer = new ArrayList<Reference>();
1370    return this.performer;
1371  }
1372
1373  /**
1374   * @return Returns a reference to <code>this</code> for easy method chaining
1375   */
1376  public DiagnosticReport setPerformer(List<Reference> thePerformer) {
1377    this.performer = thePerformer;
1378    return this;
1379  }
1380
1381  public boolean hasPerformer() {
1382    if (this.performer == null)
1383      return false;
1384    for (Reference item : this.performer)
1385      if (!item.isEmpty())
1386        return true;
1387    return false;
1388  }
1389
1390  public Reference addPerformer() { // 3
1391    Reference t = new Reference();
1392    if (this.performer == null)
1393      this.performer = new ArrayList<Reference>();
1394    this.performer.add(t);
1395    return t;
1396  }
1397
1398  public DiagnosticReport addPerformer(Reference t) { // 3
1399    if (t == null)
1400      return this;
1401    if (this.performer == null)
1402      this.performer = new ArrayList<Reference>();
1403    this.performer.add(t);
1404    return this;
1405  }
1406
1407  /**
1408   * @return The first repetition of repeating field {@link #performer}, creating
1409   *         it if it does not already exist
1410   */
1411  public Reference getPerformerFirstRep() {
1412    if (getPerformer().isEmpty()) {
1413      addPerformer();
1414    }
1415    return getPerformer().get(0);
1416  }
1417
1418  /**
1419   * @deprecated Use Reference#setResource(IBaseResource) instead
1420   */
1421  @Deprecated
1422  public List<Resource> getPerformerTarget() {
1423    if (this.performerTarget == null)
1424      this.performerTarget = new ArrayList<Resource>();
1425    return this.performerTarget;
1426  }
1427
1428  /**
1429   * @return {@link #resultsInterpreter} (The practitioner or organization that is
1430   *         responsible for the report's conclusions and interpretations.)
1431   */
1432  public List<Reference> getResultsInterpreter() {
1433    if (this.resultsInterpreter == null)
1434      this.resultsInterpreter = new ArrayList<Reference>();
1435    return this.resultsInterpreter;
1436  }
1437
1438  /**
1439   * @return Returns a reference to <code>this</code> for easy method chaining
1440   */
1441  public DiagnosticReport setResultsInterpreter(List<Reference> theResultsInterpreter) {
1442    this.resultsInterpreter = theResultsInterpreter;
1443    return this;
1444  }
1445
1446  public boolean hasResultsInterpreter() {
1447    if (this.resultsInterpreter == null)
1448      return false;
1449    for (Reference item : this.resultsInterpreter)
1450      if (!item.isEmpty())
1451        return true;
1452    return false;
1453  }
1454
1455  public Reference addResultsInterpreter() { // 3
1456    Reference t = new Reference();
1457    if (this.resultsInterpreter == null)
1458      this.resultsInterpreter = new ArrayList<Reference>();
1459    this.resultsInterpreter.add(t);
1460    return t;
1461  }
1462
1463  public DiagnosticReport addResultsInterpreter(Reference t) { // 3
1464    if (t == null)
1465      return this;
1466    if (this.resultsInterpreter == null)
1467      this.resultsInterpreter = new ArrayList<Reference>();
1468    this.resultsInterpreter.add(t);
1469    return this;
1470  }
1471
1472  /**
1473   * @return The first repetition of repeating field {@link #resultsInterpreter},
1474   *         creating it if it does not already exist
1475   */
1476  public Reference getResultsInterpreterFirstRep() {
1477    if (getResultsInterpreter().isEmpty()) {
1478      addResultsInterpreter();
1479    }
1480    return getResultsInterpreter().get(0);
1481  }
1482
1483  /**
1484   * @deprecated Use Reference#setResource(IBaseResource) instead
1485   */
1486  @Deprecated
1487  public List<Resource> getResultsInterpreterTarget() {
1488    if (this.resultsInterpreterTarget == null)
1489      this.resultsInterpreterTarget = new ArrayList<Resource>();
1490    return this.resultsInterpreterTarget;
1491  }
1492
1493  /**
1494   * @return {@link #specimen} (Details about the specimens on which this
1495   *         diagnostic report is based.)
1496   */
1497  public List<Reference> getSpecimen() {
1498    if (this.specimen == null)
1499      this.specimen = new ArrayList<Reference>();
1500    return this.specimen;
1501  }
1502
1503  /**
1504   * @return Returns a reference to <code>this</code> for easy method chaining
1505   */
1506  public DiagnosticReport setSpecimen(List<Reference> theSpecimen) {
1507    this.specimen = theSpecimen;
1508    return this;
1509  }
1510
1511  public boolean hasSpecimen() {
1512    if (this.specimen == null)
1513      return false;
1514    for (Reference item : this.specimen)
1515      if (!item.isEmpty())
1516        return true;
1517    return false;
1518  }
1519
1520  public Reference addSpecimen() { // 3
1521    Reference t = new Reference();
1522    if (this.specimen == null)
1523      this.specimen = new ArrayList<Reference>();
1524    this.specimen.add(t);
1525    return t;
1526  }
1527
1528  public DiagnosticReport addSpecimen(Reference t) { // 3
1529    if (t == null)
1530      return this;
1531    if (this.specimen == null)
1532      this.specimen = new ArrayList<Reference>();
1533    this.specimen.add(t);
1534    return this;
1535  }
1536
1537  /**
1538   * @return The first repetition of repeating field {@link #specimen}, creating
1539   *         it if it does not already exist
1540   */
1541  public Reference getSpecimenFirstRep() {
1542    if (getSpecimen().isEmpty()) {
1543      addSpecimen();
1544    }
1545    return getSpecimen().get(0);
1546  }
1547
1548  /**
1549   * @deprecated Use Reference#setResource(IBaseResource) instead
1550   */
1551  @Deprecated
1552  public List<Specimen> getSpecimenTarget() {
1553    if (this.specimenTarget == null)
1554      this.specimenTarget = new ArrayList<Specimen>();
1555    return this.specimenTarget;
1556  }
1557
1558  /**
1559   * @deprecated Use Reference#setResource(IBaseResource) instead
1560   */
1561  @Deprecated
1562  public Specimen addSpecimenTarget() {
1563    Specimen r = new Specimen();
1564    if (this.specimenTarget == null)
1565      this.specimenTarget = new ArrayList<Specimen>();
1566    this.specimenTarget.add(r);
1567    return r;
1568  }
1569
1570  /**
1571   * @return {@link #result} ([Observations](observation.html) that are part of
1572   *         this diagnostic report.)
1573   */
1574  public List<Reference> getResult() {
1575    if (this.result == null)
1576      this.result = new ArrayList<Reference>();
1577    return this.result;
1578  }
1579
1580  /**
1581   * @return Returns a reference to <code>this</code> for easy method chaining
1582   */
1583  public DiagnosticReport setResult(List<Reference> theResult) {
1584    this.result = theResult;
1585    return this;
1586  }
1587
1588  public boolean hasResult() {
1589    if (this.result == null)
1590      return false;
1591    for (Reference item : this.result)
1592      if (!item.isEmpty())
1593        return true;
1594    return false;
1595  }
1596
1597  public Reference addResult() { // 3
1598    Reference t = new Reference();
1599    if (this.result == null)
1600      this.result = new ArrayList<Reference>();
1601    this.result.add(t);
1602    return t;
1603  }
1604
1605  public DiagnosticReport addResult(Reference t) { // 3
1606    if (t == null)
1607      return this;
1608    if (this.result == null)
1609      this.result = new ArrayList<Reference>();
1610    this.result.add(t);
1611    return this;
1612  }
1613
1614  /**
1615   * @return The first repetition of repeating field {@link #result}, creating it
1616   *         if it does not already exist
1617   */
1618  public Reference getResultFirstRep() {
1619    if (getResult().isEmpty()) {
1620      addResult();
1621    }
1622    return getResult().get(0);
1623  }
1624
1625  /**
1626   * @deprecated Use Reference#setResource(IBaseResource) instead
1627   */
1628  @Deprecated
1629  public List<Observation> getResultTarget() {
1630    if (this.resultTarget == null)
1631      this.resultTarget = new ArrayList<Observation>();
1632    return this.resultTarget;
1633  }
1634
1635  /**
1636   * @deprecated Use Reference#setResource(IBaseResource) instead
1637   */
1638  @Deprecated
1639  public Observation addResultTarget() {
1640    Observation r = new Observation();
1641    if (this.resultTarget == null)
1642      this.resultTarget = new ArrayList<Observation>();
1643    this.resultTarget.add(r);
1644    return r;
1645  }
1646
1647  /**
1648   * @return {@link #imagingStudy} (One or more links to full details of any
1649   *         imaging performed during the diagnostic investigation. Typically,
1650   *         this is imaging performed by DICOM enabled modalities, but this is
1651   *         not required. A fully enabled PACS viewer can use this information to
1652   *         provide views of the source images.)
1653   */
1654  public List<Reference> getImagingStudy() {
1655    if (this.imagingStudy == null)
1656      this.imagingStudy = new ArrayList<Reference>();
1657    return this.imagingStudy;
1658  }
1659
1660  /**
1661   * @return Returns a reference to <code>this</code> for easy method chaining
1662   */
1663  public DiagnosticReport setImagingStudy(List<Reference> theImagingStudy) {
1664    this.imagingStudy = theImagingStudy;
1665    return this;
1666  }
1667
1668  public boolean hasImagingStudy() {
1669    if (this.imagingStudy == null)
1670      return false;
1671    for (Reference item : this.imagingStudy)
1672      if (!item.isEmpty())
1673        return true;
1674    return false;
1675  }
1676
1677  public Reference addImagingStudy() { // 3
1678    Reference t = new Reference();
1679    if (this.imagingStudy == null)
1680      this.imagingStudy = new ArrayList<Reference>();
1681    this.imagingStudy.add(t);
1682    return t;
1683  }
1684
1685  public DiagnosticReport addImagingStudy(Reference t) { // 3
1686    if (t == null)
1687      return this;
1688    if (this.imagingStudy == null)
1689      this.imagingStudy = new ArrayList<Reference>();
1690    this.imagingStudy.add(t);
1691    return this;
1692  }
1693
1694  /**
1695   * @return The first repetition of repeating field {@link #imagingStudy},
1696   *         creating it if it does not already exist
1697   */
1698  public Reference getImagingStudyFirstRep() {
1699    if (getImagingStudy().isEmpty()) {
1700      addImagingStudy();
1701    }
1702    return getImagingStudy().get(0);
1703  }
1704
1705  /**
1706   * @deprecated Use Reference#setResource(IBaseResource) instead
1707   */
1708  @Deprecated
1709  public List<ImagingStudy> getImagingStudyTarget() {
1710    if (this.imagingStudyTarget == null)
1711      this.imagingStudyTarget = new ArrayList<ImagingStudy>();
1712    return this.imagingStudyTarget;
1713  }
1714
1715  /**
1716   * @deprecated Use Reference#setResource(IBaseResource) instead
1717   */
1718  @Deprecated
1719  public ImagingStudy addImagingStudyTarget() {
1720    ImagingStudy r = new ImagingStudy();
1721    if (this.imagingStudyTarget == null)
1722      this.imagingStudyTarget = new ArrayList<ImagingStudy>();
1723    this.imagingStudyTarget.add(r);
1724    return r;
1725  }
1726
1727  /**
1728   * @return {@link #media} (A list of key images associated with this report. The
1729   *         images are generally created during the diagnostic process, and may
1730   *         be directly of the patient, or of treated specimens (i.e. slides of
1731   *         interest).)
1732   */
1733  public List<DiagnosticReportMediaComponent> getMedia() {
1734    if (this.media == null)
1735      this.media = new ArrayList<DiagnosticReportMediaComponent>();
1736    return this.media;
1737  }
1738
1739  /**
1740   * @return Returns a reference to <code>this</code> for easy method chaining
1741   */
1742  public DiagnosticReport setMedia(List<DiagnosticReportMediaComponent> theMedia) {
1743    this.media = theMedia;
1744    return this;
1745  }
1746
1747  public boolean hasMedia() {
1748    if (this.media == null)
1749      return false;
1750    for (DiagnosticReportMediaComponent item : this.media)
1751      if (!item.isEmpty())
1752        return true;
1753    return false;
1754  }
1755
1756  public DiagnosticReportMediaComponent addMedia() { // 3
1757    DiagnosticReportMediaComponent t = new DiagnosticReportMediaComponent();
1758    if (this.media == null)
1759      this.media = new ArrayList<DiagnosticReportMediaComponent>();
1760    this.media.add(t);
1761    return t;
1762  }
1763
1764  public DiagnosticReport addMedia(DiagnosticReportMediaComponent t) { // 3
1765    if (t == null)
1766      return this;
1767    if (this.media == null)
1768      this.media = new ArrayList<DiagnosticReportMediaComponent>();
1769    this.media.add(t);
1770    return this;
1771  }
1772
1773  /**
1774   * @return The first repetition of repeating field {@link #media}, creating it
1775   *         if it does not already exist
1776   */
1777  public DiagnosticReportMediaComponent getMediaFirstRep() {
1778    if (getMedia().isEmpty()) {
1779      addMedia();
1780    }
1781    return getMedia().get(0);
1782  }
1783
1784  /**
1785   * @return {@link #conclusion} (Concise and clinically contextualized summary
1786   *         conclusion (interpretation/impression) of the diagnostic report.).
1787   *         This is the underlying object with id, value and extensions. The
1788   *         accessor "getConclusion" gives direct access to the value
1789   */
1790  public StringType getConclusionElement() {
1791    if (this.conclusion == null)
1792      if (Configuration.errorOnAutoCreate())
1793        throw new Error("Attempt to auto-create DiagnosticReport.conclusion");
1794      else if (Configuration.doAutoCreate())
1795        this.conclusion = new StringType(); // bb
1796    return this.conclusion;
1797  }
1798
1799  public boolean hasConclusionElement() {
1800    return this.conclusion != null && !this.conclusion.isEmpty();
1801  }
1802
1803  public boolean hasConclusion() {
1804    return this.conclusion != null && !this.conclusion.isEmpty();
1805  }
1806
1807  /**
1808   * @param value {@link #conclusion} (Concise and clinically contextualized
1809   *              summary conclusion (interpretation/impression) of the diagnostic
1810   *              report.). This is the underlying object with id, value and
1811   *              extensions. The accessor "getConclusion" gives direct access to
1812   *              the value
1813   */
1814  public DiagnosticReport setConclusionElement(StringType value) {
1815    this.conclusion = value;
1816    return this;
1817  }
1818
1819  /**
1820   * @return Concise and clinically contextualized summary conclusion
1821   *         (interpretation/impression) of the diagnostic report.
1822   */
1823  public String getConclusion() {
1824    return this.conclusion == null ? null : this.conclusion.getValue();
1825  }
1826
1827  /**
1828   * @param value Concise and clinically contextualized summary conclusion
1829   *              (interpretation/impression) of the diagnostic report.
1830   */
1831  public DiagnosticReport setConclusion(String value) {
1832    if (Utilities.noString(value))
1833      this.conclusion = null;
1834    else {
1835      if (this.conclusion == null)
1836        this.conclusion = new StringType();
1837      this.conclusion.setValue(value);
1838    }
1839    return this;
1840  }
1841
1842  /**
1843   * @return {@link #conclusionCode} (One or more codes that represent the summary
1844   *         conclusion (interpretation/impression) of the diagnostic report.)
1845   */
1846  public List<CodeableConcept> getConclusionCode() {
1847    if (this.conclusionCode == null)
1848      this.conclusionCode = new ArrayList<CodeableConcept>();
1849    return this.conclusionCode;
1850  }
1851
1852  /**
1853   * @return Returns a reference to <code>this</code> for easy method chaining
1854   */
1855  public DiagnosticReport setConclusionCode(List<CodeableConcept> theConclusionCode) {
1856    this.conclusionCode = theConclusionCode;
1857    return this;
1858  }
1859
1860  public boolean hasConclusionCode() {
1861    if (this.conclusionCode == null)
1862      return false;
1863    for (CodeableConcept item : this.conclusionCode)
1864      if (!item.isEmpty())
1865        return true;
1866    return false;
1867  }
1868
1869  public CodeableConcept addConclusionCode() { // 3
1870    CodeableConcept t = new CodeableConcept();
1871    if (this.conclusionCode == null)
1872      this.conclusionCode = new ArrayList<CodeableConcept>();
1873    this.conclusionCode.add(t);
1874    return t;
1875  }
1876
1877  public DiagnosticReport addConclusionCode(CodeableConcept t) { // 3
1878    if (t == null)
1879      return this;
1880    if (this.conclusionCode == null)
1881      this.conclusionCode = new ArrayList<CodeableConcept>();
1882    this.conclusionCode.add(t);
1883    return this;
1884  }
1885
1886  /**
1887   * @return The first repetition of repeating field {@link #conclusionCode},
1888   *         creating it if it does not already exist
1889   */
1890  public CodeableConcept getConclusionCodeFirstRep() {
1891    if (getConclusionCode().isEmpty()) {
1892      addConclusionCode();
1893    }
1894    return getConclusionCode().get(0);
1895  }
1896
1897  /**
1898   * @return {@link #presentedForm} (Rich text representation of the entire result
1899   *         as issued by the diagnostic service. Multiple formats are allowed but
1900   *         they SHALL be semantically equivalent.)
1901   */
1902  public List<Attachment> getPresentedForm() {
1903    if (this.presentedForm == null)
1904      this.presentedForm = new ArrayList<Attachment>();
1905    return this.presentedForm;
1906  }
1907
1908  /**
1909   * @return Returns a reference to <code>this</code> for easy method chaining
1910   */
1911  public DiagnosticReport setPresentedForm(List<Attachment> thePresentedForm) {
1912    this.presentedForm = thePresentedForm;
1913    return this;
1914  }
1915
1916  public boolean hasPresentedForm() {
1917    if (this.presentedForm == null)
1918      return false;
1919    for (Attachment item : this.presentedForm)
1920      if (!item.isEmpty())
1921        return true;
1922    return false;
1923  }
1924
1925  public Attachment addPresentedForm() { // 3
1926    Attachment t = new Attachment();
1927    if (this.presentedForm == null)
1928      this.presentedForm = new ArrayList<Attachment>();
1929    this.presentedForm.add(t);
1930    return t;
1931  }
1932
1933  public DiagnosticReport addPresentedForm(Attachment t) { // 3
1934    if (t == null)
1935      return this;
1936    if (this.presentedForm == null)
1937      this.presentedForm = new ArrayList<Attachment>();
1938    this.presentedForm.add(t);
1939    return this;
1940  }
1941
1942  /**
1943   * @return The first repetition of repeating field {@link #presentedForm},
1944   *         creating it if it does not already exist
1945   */
1946  public Attachment getPresentedFormFirstRep() {
1947    if (getPresentedForm().isEmpty()) {
1948      addPresentedForm();
1949    }
1950    return getPresentedForm().get(0);
1951  }
1952
1953  protected void listChildren(List<Property> children) {
1954    super.listChildren(children);
1955    children.add(new Property("identifier", "Identifier",
1956        "Identifiers assigned to this report by the performer or other systems.", 0, java.lang.Integer.MAX_VALUE,
1957        identifier));
1958    children.add(new Property("basedOn",
1959        "Reference(CarePlan|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest)",
1960        "Details concerning a service requested.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1961    children.add(new Property("status", "code", "The status of the diagnostic report.", 0, 1, status));
1962    children.add(new Property("category", "CodeableConcept",
1963        "A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.",
1964        0, java.lang.Integer.MAX_VALUE, category));
1965    children.add(
1966        new Property("code", "CodeableConcept", "A code or name that describes this diagnostic report.", 0, 1, code));
1967    children.add(new Property("subject", "Reference(Patient|Group|Device|Location)",
1968        "The subject of the report. Usually, but not always, this is a patient. However, diagnostic services also perform analyses on specimens collected from a variety of other sources.",
1969        0, 1, subject));
1970    children.add(new Property("encounter", "Reference(Encounter)",
1971        "The healthcare event  (e.g. a patient and healthcare provider interaction) which this DiagnosticReport is about.",
1972        0, 1, encounter));
1973    children.add(new Property("effective[x]", "dateTime|Period",
1974        "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.",
1975        0, 1, effective));
1976    children.add(new Property("issued", "instant",
1977        "The date and time that this version of the report was made available to providers, typically after the report was reviewed and verified.",
1978        0, 1, issued));
1979    children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
1980        "The diagnostic service that is responsible for issuing the report.", 0, java.lang.Integer.MAX_VALUE,
1981        performer));
1982    children.add(new Property("resultsInterpreter", "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
1983        "The practitioner or organization that is responsible for the report's conclusions and interpretations.", 0,
1984        java.lang.Integer.MAX_VALUE, resultsInterpreter));
1985    children.add(new Property("specimen", "Reference(Specimen)",
1986        "Details about the specimens on which this diagnostic report is based.", 0, java.lang.Integer.MAX_VALUE,
1987        specimen));
1988    children.add(new Property("result", "Reference(Observation)",
1989        "[Observations](observation.html)  that are part of this diagnostic report.", 0, java.lang.Integer.MAX_VALUE,
1990        result));
1991    children.add(new Property("imagingStudy", "Reference(ImagingStudy)",
1992        "One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.",
1993        0, java.lang.Integer.MAX_VALUE, imagingStudy));
1994    children.add(new Property("media", "",
1995        "A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).",
1996        0, java.lang.Integer.MAX_VALUE, media));
1997    children.add(new Property("conclusion", "string",
1998        "Concise and clinically contextualized summary conclusion (interpretation/impression) of the diagnostic report.",
1999        0, 1, conclusion));
2000    children.add(new Property("conclusionCode", "CodeableConcept",
2001        "One or more codes that represent the summary conclusion (interpretation/impression) of the diagnostic report.",
2002        0, java.lang.Integer.MAX_VALUE, conclusionCode));
2003    children.add(new Property("presentedForm", "Attachment",
2004        "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.",
2005        0, java.lang.Integer.MAX_VALUE, presentedForm));
2006  }
2007
2008  @Override
2009  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2010    switch (_hash) {
2011    case -1618432855:
2012      /* identifier */ return new Property("identifier", "Identifier",
2013          "Identifiers assigned to this report by the performer or other systems.", 0, java.lang.Integer.MAX_VALUE,
2014          identifier);
2015    case -332612366:
2016      /* basedOn */ return new Property("basedOn",
2017          "Reference(CarePlan|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest)",
2018          "Details concerning a service requested.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2019    case -892481550:
2020      /* status */ return new Property("status", "code", "The status of the diagnostic report.", 0, 1, status);
2021    case 50511102:
2022      /* category */ return new Property("category", "CodeableConcept",
2023          "A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.",
2024          0, java.lang.Integer.MAX_VALUE, category);
2025    case 3059181:
2026      /* code */ return new Property("code", "CodeableConcept", "A code or name that describes this diagnostic report.",
2027          0, 1, code);
2028    case -1867885268:
2029      /* subject */ return new Property("subject", "Reference(Patient|Group|Device|Location)",
2030          "The subject of the report. Usually, but not always, this is a patient. However, diagnostic services also perform analyses on specimens collected from a variety of other sources.",
2031          0, 1, subject);
2032    case 1524132147:
2033      /* encounter */ return new Property("encounter", "Reference(Encounter)",
2034          "The healthcare event  (e.g. a patient and healthcare provider interaction) which this DiagnosticReport is about.",
2035          0, 1, encounter);
2036    case 247104889:
2037      /* effective[x] */ return new Property("effective[x]", "dateTime|Period",
2038          "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.",
2039          0, 1, effective);
2040    case -1468651097:
2041      /* effective */ return new Property("effective[x]", "dateTime|Period",
2042          "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.",
2043          0, 1, effective);
2044    case -275306910:
2045      /* effectiveDateTime */ return new Property("effective[x]", "dateTime|Period",
2046          "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.",
2047          0, 1, effective);
2048    case -403934648:
2049      /* effectivePeriod */ return new Property("effective[x]", "dateTime|Period",
2050          "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.",
2051          0, 1, effective);
2052    case -1179159893:
2053      /* issued */ return new Property("issued", "instant",
2054          "The date and time that this version of the report was made available to providers, typically after the report was reviewed and verified.",
2055          0, 1, issued);
2056    case 481140686:
2057      /* performer */ return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
2058          "The diagnostic service that is responsible for issuing the report.", 0, java.lang.Integer.MAX_VALUE,
2059          performer);
2060    case 2134944932:
2061      /* resultsInterpreter */ return new Property("resultsInterpreter",
2062          "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
2063          "The practitioner or organization that is responsible for the report's conclusions and interpretations.", 0,
2064          java.lang.Integer.MAX_VALUE, resultsInterpreter);
2065    case -2132868344:
2066      /* specimen */ return new Property("specimen", "Reference(Specimen)",
2067          "Details about the specimens on which this diagnostic report is based.", 0, java.lang.Integer.MAX_VALUE,
2068          specimen);
2069    case -934426595:
2070      /* result */ return new Property("result", "Reference(Observation)",
2071          "[Observations](observation.html)  that are part of this diagnostic report.", 0, java.lang.Integer.MAX_VALUE,
2072          result);
2073    case -814900911:
2074      /* imagingStudy */ return new Property("imagingStudy", "Reference(ImagingStudy)",
2075          "One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.",
2076          0, java.lang.Integer.MAX_VALUE, imagingStudy);
2077    case 103772132:
2078      /* media */ return new Property("media", "",
2079          "A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).",
2080          0, java.lang.Integer.MAX_VALUE, media);
2081    case -1731259873:
2082      /* conclusion */ return new Property("conclusion", "string",
2083          "Concise and clinically contextualized summary conclusion (interpretation/impression) of the diagnostic report.",
2084          0, 1, conclusion);
2085    case -1731523412:
2086      /* conclusionCode */ return new Property("conclusionCode", "CodeableConcept",
2087          "One or more codes that represent the summary conclusion (interpretation/impression) of the diagnostic report.",
2088          0, java.lang.Integer.MAX_VALUE, conclusionCode);
2089    case 230090366:
2090      /* presentedForm */ return new Property("presentedForm", "Attachment",
2091          "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.",
2092          0, java.lang.Integer.MAX_VALUE, presentedForm);
2093    default:
2094      return super.getNamedProperty(_hash, _name, _checkValid);
2095    }
2096
2097  }
2098
2099  @Override
2100  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2101    switch (hash) {
2102    case -1618432855:
2103      /* identifier */ return this.identifier == null ? new Base[0]
2104          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2105    case -332612366:
2106      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2107    case -892481550:
2108      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<DiagnosticReportStatus>
2109    case 50511102:
2110      /* category */ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2111    case 3059181:
2112      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2113    case -1867885268:
2114      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2115    case 1524132147:
2116      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
2117    case -1468651097:
2118      /* effective */ return this.effective == null ? new Base[0] : new Base[] { this.effective }; // Type
2119    case -1179159893:
2120      /* issued */ return this.issued == null ? new Base[0] : new Base[] { this.issued }; // InstantType
2121    case 481140686:
2122      /* performer */ return this.performer == null ? new Base[0]
2123          : this.performer.toArray(new Base[this.performer.size()]); // Reference
2124    case 2134944932:
2125      /* resultsInterpreter */ return this.resultsInterpreter == null ? new Base[0]
2126          : this.resultsInterpreter.toArray(new Base[this.resultsInterpreter.size()]); // Reference
2127    case -2132868344:
2128      /* specimen */ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
2129    case -934426595:
2130      /* result */ return this.result == null ? new Base[0] : this.result.toArray(new Base[this.result.size()]); // Reference
2131    case -814900911:
2132      /* imagingStudy */ return this.imagingStudy == null ? new Base[0]
2133          : this.imagingStudy.toArray(new Base[this.imagingStudy.size()]); // Reference
2134    case 103772132:
2135      /* media */ return this.media == null ? new Base[0] : this.media.toArray(new Base[this.media.size()]); // DiagnosticReportMediaComponent
2136    case -1731259873:
2137      /* conclusion */ return this.conclusion == null ? new Base[0] : new Base[] { this.conclusion }; // StringType
2138    case -1731523412:
2139      /* conclusionCode */ return this.conclusionCode == null ? new Base[0]
2140          : this.conclusionCode.toArray(new Base[this.conclusionCode.size()]); // CodeableConcept
2141    case 230090366:
2142      /* presentedForm */ return this.presentedForm == null ? new Base[0]
2143          : this.presentedForm.toArray(new Base[this.presentedForm.size()]); // Attachment
2144    default:
2145      return super.getProperty(hash, name, checkValid);
2146    }
2147
2148  }
2149
2150  @Override
2151  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2152    switch (hash) {
2153    case -1618432855: // identifier
2154      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2155      return value;
2156    case -332612366: // basedOn
2157      this.getBasedOn().add(castToReference(value)); // Reference
2158      return value;
2159    case -892481550: // status
2160      value = new DiagnosticReportStatusEnumFactory().fromType(castToCode(value));
2161      this.status = (Enumeration) value; // Enumeration<DiagnosticReportStatus>
2162      return value;
2163    case 50511102: // category
2164      this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2165      return value;
2166    case 3059181: // code
2167      this.code = castToCodeableConcept(value); // CodeableConcept
2168      return value;
2169    case -1867885268: // subject
2170      this.subject = castToReference(value); // Reference
2171      return value;
2172    case 1524132147: // encounter
2173      this.encounter = castToReference(value); // Reference
2174      return value;
2175    case -1468651097: // effective
2176      this.effective = castToType(value); // Type
2177      return value;
2178    case -1179159893: // issued
2179      this.issued = castToInstant(value); // InstantType
2180      return value;
2181    case 481140686: // performer
2182      this.getPerformer().add(castToReference(value)); // Reference
2183      return value;
2184    case 2134944932: // resultsInterpreter
2185      this.getResultsInterpreter().add(castToReference(value)); // Reference
2186      return value;
2187    case -2132868344: // specimen
2188      this.getSpecimen().add(castToReference(value)); // Reference
2189      return value;
2190    case -934426595: // result
2191      this.getResult().add(castToReference(value)); // Reference
2192      return value;
2193    case -814900911: // imagingStudy
2194      this.getImagingStudy().add(castToReference(value)); // Reference
2195      return value;
2196    case 103772132: // media
2197      this.getMedia().add((DiagnosticReportMediaComponent) value); // DiagnosticReportMediaComponent
2198      return value;
2199    case -1731259873: // conclusion
2200      this.conclusion = castToString(value); // StringType
2201      return value;
2202    case -1731523412: // conclusionCode
2203      this.getConclusionCode().add(castToCodeableConcept(value)); // CodeableConcept
2204      return value;
2205    case 230090366: // presentedForm
2206      this.getPresentedForm().add(castToAttachment(value)); // Attachment
2207      return value;
2208    default:
2209      return super.setProperty(hash, name, value);
2210    }
2211
2212  }
2213
2214  @Override
2215  public Base setProperty(String name, Base value) throws FHIRException {
2216    if (name.equals("identifier")) {
2217      this.getIdentifier().add(castToIdentifier(value));
2218    } else if (name.equals("basedOn")) {
2219      this.getBasedOn().add(castToReference(value));
2220    } else if (name.equals("status")) {
2221      value = new DiagnosticReportStatusEnumFactory().fromType(castToCode(value));
2222      this.status = (Enumeration) value; // Enumeration<DiagnosticReportStatus>
2223    } else if (name.equals("category")) {
2224      this.getCategory().add(castToCodeableConcept(value));
2225    } else if (name.equals("code")) {
2226      this.code = castToCodeableConcept(value); // CodeableConcept
2227    } else if (name.equals("subject")) {
2228      this.subject = castToReference(value); // Reference
2229    } else if (name.equals("encounter")) {
2230      this.encounter = castToReference(value); // Reference
2231    } else if (name.equals("effective[x]")) {
2232      this.effective = castToType(value); // Type
2233    } else if (name.equals("issued")) {
2234      this.issued = castToInstant(value); // InstantType
2235    } else if (name.equals("performer")) {
2236      this.getPerformer().add(castToReference(value));
2237    } else if (name.equals("resultsInterpreter")) {
2238      this.getResultsInterpreter().add(castToReference(value));
2239    } else if (name.equals("specimen")) {
2240      this.getSpecimen().add(castToReference(value));
2241    } else if (name.equals("result")) {
2242      this.getResult().add(castToReference(value));
2243    } else if (name.equals("imagingStudy")) {
2244      this.getImagingStudy().add(castToReference(value));
2245    } else if (name.equals("media")) {
2246      this.getMedia().add((DiagnosticReportMediaComponent) value);
2247    } else if (name.equals("conclusion")) {
2248      this.conclusion = castToString(value); // StringType
2249    } else if (name.equals("conclusionCode")) {
2250      this.getConclusionCode().add(castToCodeableConcept(value));
2251    } else if (name.equals("presentedForm")) {
2252      this.getPresentedForm().add(castToAttachment(value));
2253    } else
2254      return super.setProperty(name, value);
2255    return value;
2256  }
2257
2258  @Override
2259  public Base makeProperty(int hash, String name) throws FHIRException {
2260    switch (hash) {
2261    case -1618432855:
2262      return addIdentifier();
2263    case -332612366:
2264      return addBasedOn();
2265    case -892481550:
2266      return getStatusElement();
2267    case 50511102:
2268      return addCategory();
2269    case 3059181:
2270      return getCode();
2271    case -1867885268:
2272      return getSubject();
2273    case 1524132147:
2274      return getEncounter();
2275    case 247104889:
2276      return getEffective();
2277    case -1468651097:
2278      return getEffective();
2279    case -1179159893:
2280      return getIssuedElement();
2281    case 481140686:
2282      return addPerformer();
2283    case 2134944932:
2284      return addResultsInterpreter();
2285    case -2132868344:
2286      return addSpecimen();
2287    case -934426595:
2288      return addResult();
2289    case -814900911:
2290      return addImagingStudy();
2291    case 103772132:
2292      return addMedia();
2293    case -1731259873:
2294      return getConclusionElement();
2295    case -1731523412:
2296      return addConclusionCode();
2297    case 230090366:
2298      return addPresentedForm();
2299    default:
2300      return super.makeProperty(hash, name);
2301    }
2302
2303  }
2304
2305  @Override
2306  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2307    switch (hash) {
2308    case -1618432855:
2309      /* identifier */ return new String[] { "Identifier" };
2310    case -332612366:
2311      /* basedOn */ return new String[] { "Reference" };
2312    case -892481550:
2313      /* status */ return new String[] { "code" };
2314    case 50511102:
2315      /* category */ return new String[] { "CodeableConcept" };
2316    case 3059181:
2317      /* code */ return new String[] { "CodeableConcept" };
2318    case -1867885268:
2319      /* subject */ return new String[] { "Reference" };
2320    case 1524132147:
2321      /* encounter */ return new String[] { "Reference" };
2322    case -1468651097:
2323      /* effective */ return new String[] { "dateTime", "Period" };
2324    case -1179159893:
2325      /* issued */ return new String[] { "instant" };
2326    case 481140686:
2327      /* performer */ return new String[] { "Reference" };
2328    case 2134944932:
2329      /* resultsInterpreter */ return new String[] { "Reference" };
2330    case -2132868344:
2331      /* specimen */ return new String[] { "Reference" };
2332    case -934426595:
2333      /* result */ return new String[] { "Reference" };
2334    case -814900911:
2335      /* imagingStudy */ return new String[] { "Reference" };
2336    case 103772132:
2337      /* media */ return new String[] {};
2338    case -1731259873:
2339      /* conclusion */ return new String[] { "string" };
2340    case -1731523412:
2341      /* conclusionCode */ return new String[] { "CodeableConcept" };
2342    case 230090366:
2343      /* presentedForm */ return new String[] { "Attachment" };
2344    default:
2345      return super.getTypesForProperty(hash, name);
2346    }
2347
2348  }
2349
2350  @Override
2351  public Base addChild(String name) throws FHIRException {
2352    if (name.equals("identifier")) {
2353      return addIdentifier();
2354    } else if (name.equals("basedOn")) {
2355      return addBasedOn();
2356    } else if (name.equals("status")) {
2357      throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.status");
2358    } else if (name.equals("category")) {
2359      return addCategory();
2360    } else if (name.equals("code")) {
2361      this.code = new CodeableConcept();
2362      return this.code;
2363    } else if (name.equals("subject")) {
2364      this.subject = new Reference();
2365      return this.subject;
2366    } else if (name.equals("encounter")) {
2367      this.encounter = new Reference();
2368      return this.encounter;
2369    } else if (name.equals("effectiveDateTime")) {
2370      this.effective = new DateTimeType();
2371      return this.effective;
2372    } else if (name.equals("effectivePeriod")) {
2373      this.effective = new Period();
2374      return this.effective;
2375    } else if (name.equals("issued")) {
2376      throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.issued");
2377    } else if (name.equals("performer")) {
2378      return addPerformer();
2379    } else if (name.equals("resultsInterpreter")) {
2380      return addResultsInterpreter();
2381    } else if (name.equals("specimen")) {
2382      return addSpecimen();
2383    } else if (name.equals("result")) {
2384      return addResult();
2385    } else if (name.equals("imagingStudy")) {
2386      return addImagingStudy();
2387    } else if (name.equals("media")) {
2388      return addMedia();
2389    } else if (name.equals("conclusion")) {
2390      throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.conclusion");
2391    } else if (name.equals("conclusionCode")) {
2392      return addConclusionCode();
2393    } else if (name.equals("presentedForm")) {
2394      return addPresentedForm();
2395    } else
2396      return super.addChild(name);
2397  }
2398
2399  public String fhirType() {
2400    return "DiagnosticReport";
2401
2402  }
2403
2404  public DiagnosticReport copy() {
2405    DiagnosticReport dst = new DiagnosticReport();
2406    copyValues(dst);
2407    return dst;
2408  }
2409
2410  public void copyValues(DiagnosticReport dst) {
2411    super.copyValues(dst);
2412    if (identifier != null) {
2413      dst.identifier = new ArrayList<Identifier>();
2414      for (Identifier i : identifier)
2415        dst.identifier.add(i.copy());
2416    }
2417    ;
2418    if (basedOn != null) {
2419      dst.basedOn = new ArrayList<Reference>();
2420      for (Reference i : basedOn)
2421        dst.basedOn.add(i.copy());
2422    }
2423    ;
2424    dst.status = status == null ? null : status.copy();
2425    if (category != null) {
2426      dst.category = new ArrayList<CodeableConcept>();
2427      for (CodeableConcept i : category)
2428        dst.category.add(i.copy());
2429    }
2430    ;
2431    dst.code = code == null ? null : code.copy();
2432    dst.subject = subject == null ? null : subject.copy();
2433    dst.encounter = encounter == null ? null : encounter.copy();
2434    dst.effective = effective == null ? null : effective.copy();
2435    dst.issued = issued == null ? null : issued.copy();
2436    if (performer != null) {
2437      dst.performer = new ArrayList<Reference>();
2438      for (Reference i : performer)
2439        dst.performer.add(i.copy());
2440    }
2441    ;
2442    if (resultsInterpreter != null) {
2443      dst.resultsInterpreter = new ArrayList<Reference>();
2444      for (Reference i : resultsInterpreter)
2445        dst.resultsInterpreter.add(i.copy());
2446    }
2447    ;
2448    if (specimen != null) {
2449      dst.specimen = new ArrayList<Reference>();
2450      for (Reference i : specimen)
2451        dst.specimen.add(i.copy());
2452    }
2453    ;
2454    if (result != null) {
2455      dst.result = new ArrayList<Reference>();
2456      for (Reference i : result)
2457        dst.result.add(i.copy());
2458    }
2459    ;
2460    if (imagingStudy != null) {
2461      dst.imagingStudy = new ArrayList<Reference>();
2462      for (Reference i : imagingStudy)
2463        dst.imagingStudy.add(i.copy());
2464    }
2465    ;
2466    if (media != null) {
2467      dst.media = new ArrayList<DiagnosticReportMediaComponent>();
2468      for (DiagnosticReportMediaComponent i : media)
2469        dst.media.add(i.copy());
2470    }
2471    ;
2472    dst.conclusion = conclusion == null ? null : conclusion.copy();
2473    if (conclusionCode != null) {
2474      dst.conclusionCode = new ArrayList<CodeableConcept>();
2475      for (CodeableConcept i : conclusionCode)
2476        dst.conclusionCode.add(i.copy());
2477    }
2478    ;
2479    if (presentedForm != null) {
2480      dst.presentedForm = new ArrayList<Attachment>();
2481      for (Attachment i : presentedForm)
2482        dst.presentedForm.add(i.copy());
2483    }
2484    ;
2485  }
2486
2487  protected DiagnosticReport typedCopy() {
2488    return copy();
2489  }
2490
2491  @Override
2492  public boolean equalsDeep(Base other_) {
2493    if (!super.equalsDeep(other_))
2494      return false;
2495    if (!(other_ instanceof DiagnosticReport))
2496      return false;
2497    DiagnosticReport o = (DiagnosticReport) other_;
2498    return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true)
2499        && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
2500        && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
2501        && compareDeep(encounter, o.encounter, true) && compareDeep(effective, o.effective, true)
2502        && compareDeep(issued, o.issued, true) && compareDeep(performer, o.performer, true)
2503        && compareDeep(resultsInterpreter, o.resultsInterpreter, true) && compareDeep(specimen, o.specimen, true)
2504        && compareDeep(result, o.result, true) && compareDeep(imagingStudy, o.imagingStudy, true)
2505        && compareDeep(media, o.media, true) && compareDeep(conclusion, o.conclusion, true)
2506        && compareDeep(conclusionCode, o.conclusionCode, true) && compareDeep(presentedForm, o.presentedForm, true);
2507  }
2508
2509  @Override
2510  public boolean equalsShallow(Base other_) {
2511    if (!super.equalsShallow(other_))
2512      return false;
2513    if (!(other_ instanceof DiagnosticReport))
2514      return false;
2515    DiagnosticReport o = (DiagnosticReport) other_;
2516    return compareValues(status, o.status, true) && compareValues(issued, o.issued, true)
2517        && compareValues(conclusion, o.conclusion, true);
2518  }
2519
2520  public boolean isEmpty() {
2521    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, status, category, code, subject,
2522        encounter, effective, issued, performer, resultsInterpreter, specimen, result, imagingStudy, media, conclusion,
2523        conclusionCode, presentedForm);
2524  }
2525
2526  @Override
2527  public ResourceType getResourceType() {
2528    return ResourceType.DiagnosticReport;
2529  }
2530
2531  /**
2532   * Search parameter: <b>date</b>
2533   * <p>
2534   * Description: <b>The clinically relevant time of the report</b><br>
2535   * Type: <b>date</b><br>
2536   * Path: <b>DiagnosticReport.effective[x]</b><br>
2537   * </p>
2538   */
2539  @SearchParamDefinition(name = "date", path = "DiagnosticReport.effective", description = "The clinically relevant time of the report", type = "date")
2540  public static final String SP_DATE = "date";
2541  /**
2542   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2543   * <p>
2544   * Description: <b>The clinically relevant time of the report</b><br>
2545   * Type: <b>date</b><br>
2546   * Path: <b>DiagnosticReport.effective[x]</b><br>
2547   * </p>
2548   */
2549  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2550      SP_DATE);
2551
2552  /**
2553   * Search parameter: <b>identifier</b>
2554   * <p>
2555   * Description: <b>An identifier for the report</b><br>
2556   * Type: <b>token</b><br>
2557   * Path: <b>DiagnosticReport.identifier</b><br>
2558   * </p>
2559   */
2560  @SearchParamDefinition(name = "identifier", path = "DiagnosticReport.identifier", description = "An identifier for the report", type = "token")
2561  public static final String SP_IDENTIFIER = "identifier";
2562  /**
2563   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2564   * <p>
2565   * Description: <b>An identifier for the report</b><br>
2566   * Type: <b>token</b><br>
2567   * Path: <b>DiagnosticReport.identifier</b><br>
2568   * </p>
2569   */
2570  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2571      SP_IDENTIFIER);
2572
2573  /**
2574   * Search parameter: <b>performer</b>
2575   * <p>
2576   * Description: <b>Who is responsible for the report</b><br>
2577   * Type: <b>reference</b><br>
2578   * Path: <b>DiagnosticReport.performer</b><br>
2579   * </p>
2580   */
2581  @SearchParamDefinition(name = "performer", path = "DiagnosticReport.performer", description = "Who is responsible for the report", type = "reference", providesMembershipIn = {
2582      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { CareTeam.class,
2583          Organization.class, Practitioner.class, PractitionerRole.class })
2584  public static final String SP_PERFORMER = "performer";
2585  /**
2586   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2587   * <p>
2588   * Description: <b>Who is responsible for the report</b><br>
2589   * Type: <b>reference</b><br>
2590   * Path: <b>DiagnosticReport.performer</b><br>
2591   * </p>
2592   */
2593  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2594      SP_PERFORMER);
2595
2596  /**
2597   * Constant for fluent queries to be used to add include statements. Specifies
2598   * the path value of "<b>DiagnosticReport:performer</b>".
2599   */
2600  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include(
2601      "DiagnosticReport:performer").toLocked();
2602
2603  /**
2604   * Search parameter: <b>code</b>
2605   * <p>
2606   * Description: <b>The code for the report, as opposed to codes for the atomic
2607   * results, which are the names on the observation resource referred to from the
2608   * result</b><br>
2609   * Type: <b>token</b><br>
2610   * Path: <b>DiagnosticReport.code</b><br>
2611   * </p>
2612   */
2613  @SearchParamDefinition(name = "code", path = "DiagnosticReport.code", description = "The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result", type = "token")
2614  public static final String SP_CODE = "code";
2615  /**
2616   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2617   * <p>
2618   * Description: <b>The code for the report, as opposed to codes for the atomic
2619   * results, which are the names on the observation resource referred to from the
2620   * result</b><br>
2621   * Type: <b>token</b><br>
2622   * Path: <b>DiagnosticReport.code</b><br>
2623   * </p>
2624   */
2625  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2626      SP_CODE);
2627
2628  /**
2629   * Search parameter: <b>subject</b>
2630   * <p>
2631   * Description: <b>The subject of the report</b><br>
2632   * Type: <b>reference</b><br>
2633   * Path: <b>DiagnosticReport.subject</b><br>
2634   * </p>
2635   */
2636  @SearchParamDefinition(name = "subject", path = "DiagnosticReport.subject", description = "The subject of the report", type = "reference", providesMembershipIn = {
2637      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
2638      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Device.class, Group.class,
2639          Location.class, Patient.class })
2640  public static final String SP_SUBJECT = "subject";
2641  /**
2642   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2643   * <p>
2644   * Description: <b>The subject of the report</b><br>
2645   * Type: <b>reference</b><br>
2646   * Path: <b>DiagnosticReport.subject</b><br>
2647   * </p>
2648   */
2649  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2650      SP_SUBJECT);
2651
2652  /**
2653   * Constant for fluent queries to be used to add include statements. Specifies
2654   * the path value of "<b>DiagnosticReport:subject</b>".
2655   */
2656  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
2657      "DiagnosticReport:subject").toLocked();
2658
2659  /**
2660   * Search parameter: <b>media</b>
2661   * <p>
2662   * Description: <b>A reference to the image source.</b><br>
2663   * Type: <b>reference</b><br>
2664   * Path: <b>DiagnosticReport.media.link</b><br>
2665   * </p>
2666   */
2667  @SearchParamDefinition(name = "media", path = "DiagnosticReport.media.link", description = "A reference to the image source.", type = "reference", target = {
2668      Media.class })
2669  public static final String SP_MEDIA = "media";
2670  /**
2671   * <b>Fluent Client</b> search parameter constant for <b>media</b>
2672   * <p>
2673   * Description: <b>A reference to the image source.</b><br>
2674   * Type: <b>reference</b><br>
2675   * Path: <b>DiagnosticReport.media.link</b><br>
2676   * </p>
2677   */
2678  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDIA = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2679      SP_MEDIA);
2680
2681  /**
2682   * Constant for fluent queries to be used to add include statements. Specifies
2683   * the path value of "<b>DiagnosticReport:media</b>".
2684   */
2685  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDIA = new ca.uhn.fhir.model.api.Include(
2686      "DiagnosticReport:media").toLocked();
2687
2688  /**
2689   * Search parameter: <b>encounter</b>
2690   * <p>
2691   * Description: <b>The Encounter when the order was made</b><br>
2692   * Type: <b>reference</b><br>
2693   * Path: <b>DiagnosticReport.encounter</b><br>
2694   * </p>
2695   */
2696  @SearchParamDefinition(name = "encounter", path = "DiagnosticReport.encounter", description = "The Encounter when the order was made", type = "reference", providesMembershipIn = {
2697      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
2698  public static final String SP_ENCOUNTER = "encounter";
2699  /**
2700   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2701   * <p>
2702   * Description: <b>The Encounter when the order was made</b><br>
2703   * Type: <b>reference</b><br>
2704   * Path: <b>DiagnosticReport.encounter</b><br>
2705   * </p>
2706   */
2707  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2708      SP_ENCOUNTER);
2709
2710  /**
2711   * Constant for fluent queries to be used to add include statements. Specifies
2712   * the path value of "<b>DiagnosticReport:encounter</b>".
2713   */
2714  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
2715      "DiagnosticReport:encounter").toLocked();
2716
2717  /**
2718   * Search parameter: <b>result</b>
2719   * <p>
2720   * Description: <b>Link to an atomic result (observation resource)</b><br>
2721   * Type: <b>reference</b><br>
2722   * Path: <b>DiagnosticReport.result</b><br>
2723   * </p>
2724   */
2725  @SearchParamDefinition(name = "result", path = "DiagnosticReport.result", description = "Link to an atomic result (observation resource)", type = "reference", target = {
2726      Observation.class })
2727  public static final String SP_RESULT = "result";
2728  /**
2729   * <b>Fluent Client</b> search parameter constant for <b>result</b>
2730   * <p>
2731   * Description: <b>Link to an atomic result (observation resource)</b><br>
2732   * Type: <b>reference</b><br>
2733   * Path: <b>DiagnosticReport.result</b><br>
2734   * </p>
2735   */
2736  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2737      SP_RESULT);
2738
2739  /**
2740   * Constant for fluent queries to be used to add include statements. Specifies
2741   * the path value of "<b>DiagnosticReport:result</b>".
2742   */
2743  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULT = new ca.uhn.fhir.model.api.Include(
2744      "DiagnosticReport:result").toLocked();
2745
2746  /**
2747   * Search parameter: <b>conclusion</b>
2748   * <p>
2749   * Description: <b>A coded conclusion (interpretation/impression) on the
2750   * report</b><br>
2751   * Type: <b>token</b><br>
2752   * Path: <b>DiagnosticReport.conclusionCode</b><br>
2753   * </p>
2754   */
2755  @SearchParamDefinition(name = "conclusion", path = "DiagnosticReport.conclusionCode", description = "A coded conclusion (interpretation/impression) on the report", type = "token")
2756  public static final String SP_CONCLUSION = "conclusion";
2757  /**
2758   * <b>Fluent Client</b> search parameter constant for <b>conclusion</b>
2759   * <p>
2760   * Description: <b>A coded conclusion (interpretation/impression) on the
2761   * report</b><br>
2762   * Type: <b>token</b><br>
2763   * Path: <b>DiagnosticReport.conclusionCode</b><br>
2764   * </p>
2765   */
2766  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONCLUSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2767      SP_CONCLUSION);
2768
2769  /**
2770   * Search parameter: <b>based-on</b>
2771   * <p>
2772   * Description: <b>Reference to the service request.</b><br>
2773   * Type: <b>reference</b><br>
2774   * Path: <b>DiagnosticReport.basedOn</b><br>
2775   * </p>
2776   */
2777  @SearchParamDefinition(name = "based-on", path = "DiagnosticReport.basedOn", description = "Reference to the service request.", type = "reference", target = {
2778      CarePlan.class, ImmunizationRecommendation.class, MedicationRequest.class, NutritionOrder.class,
2779      ServiceRequest.class })
2780  public static final String SP_BASED_ON = "based-on";
2781  /**
2782   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2783   * <p>
2784   * Description: <b>Reference to the service request.</b><br>
2785   * Type: <b>reference</b><br>
2786   * Path: <b>DiagnosticReport.basedOn</b><br>
2787   * </p>
2788   */
2789  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2790      SP_BASED_ON);
2791
2792  /**
2793   * Constant for fluent queries to be used to add include statements. Specifies
2794   * the path value of "<b>DiagnosticReport:based-on</b>".
2795   */
2796  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include(
2797      "DiagnosticReport:based-on").toLocked();
2798
2799  /**
2800   * Search parameter: <b>patient</b>
2801   * <p>
2802   * Description: <b>The subject of the report if a patient</b><br>
2803   * Type: <b>reference</b><br>
2804   * Path: <b>DiagnosticReport.subject</b><br>
2805   * </p>
2806   */
2807  @SearchParamDefinition(name = "patient", path = "DiagnosticReport.subject.where(resolve() is Patient)", description = "The subject of the report if a patient", type = "reference", target = {
2808      Patient.class })
2809  public static final String SP_PATIENT = "patient";
2810  /**
2811   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2812   * <p>
2813   * Description: <b>The subject of the report if a patient</b><br>
2814   * Type: <b>reference</b><br>
2815   * Path: <b>DiagnosticReport.subject</b><br>
2816   * </p>
2817   */
2818  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2819      SP_PATIENT);
2820
2821  /**
2822   * Constant for fluent queries to be used to add include statements. Specifies
2823   * the path value of "<b>DiagnosticReport:patient</b>".
2824   */
2825  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2826      "DiagnosticReport:patient").toLocked();
2827
2828  /**
2829   * Search parameter: <b>specimen</b>
2830   * <p>
2831   * Description: <b>The specimen details</b><br>
2832   * Type: <b>reference</b><br>
2833   * Path: <b>DiagnosticReport.specimen</b><br>
2834   * </p>
2835   */
2836  @SearchParamDefinition(name = "specimen", path = "DiagnosticReport.specimen", description = "The specimen details", type = "reference", target = {
2837      Specimen.class })
2838  public static final String SP_SPECIMEN = "specimen";
2839  /**
2840   * <b>Fluent Client</b> search parameter constant for <b>specimen</b>
2841   * <p>
2842   * Description: <b>The specimen details</b><br>
2843   * Type: <b>reference</b><br>
2844   * Path: <b>DiagnosticReport.specimen</b><br>
2845   * </p>
2846   */
2847  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPECIMEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2848      SP_SPECIMEN);
2849
2850  /**
2851   * Constant for fluent queries to be used to add include statements. Specifies
2852   * the path value of "<b>DiagnosticReport:specimen</b>".
2853   */
2854  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPECIMEN = new ca.uhn.fhir.model.api.Include(
2855      "DiagnosticReport:specimen").toLocked();
2856
2857  /**
2858   * Search parameter: <b>issued</b>
2859   * <p>
2860   * Description: <b>When the report was issued</b><br>
2861   * Type: <b>date</b><br>
2862   * Path: <b>DiagnosticReport.issued</b><br>
2863   * </p>
2864   */
2865  @SearchParamDefinition(name = "issued", path = "DiagnosticReport.issued", description = "When the report was issued", type = "date")
2866  public static final String SP_ISSUED = "issued";
2867  /**
2868   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
2869   * <p>
2870   * Description: <b>When the report was issued</b><br>
2871   * Type: <b>date</b><br>
2872   * Path: <b>DiagnosticReport.issued</b><br>
2873   * </p>
2874   */
2875  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(
2876      SP_ISSUED);
2877
2878  /**
2879   * Search parameter: <b>category</b>
2880   * <p>
2881   * Description: <b>Which diagnostic discipline/department created the
2882   * report</b><br>
2883   * Type: <b>token</b><br>
2884   * Path: <b>DiagnosticReport.category</b><br>
2885   * </p>
2886   */
2887  @SearchParamDefinition(name = "category", path = "DiagnosticReport.category", description = "Which diagnostic discipline/department created the report", type = "token")
2888  public static final String SP_CATEGORY = "category";
2889  /**
2890   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2891   * <p>
2892   * Description: <b>Which diagnostic discipline/department created the
2893   * report</b><br>
2894   * Type: <b>token</b><br>
2895   * Path: <b>DiagnosticReport.category</b><br>
2896   * </p>
2897   */
2898  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2899      SP_CATEGORY);
2900
2901  /**
2902   * Search parameter: <b>results-interpreter</b>
2903   * <p>
2904   * Description: <b>Who was the source of the report</b><br>
2905   * Type: <b>reference</b><br>
2906   * Path: <b>DiagnosticReport.resultsInterpreter</b><br>
2907   * </p>
2908   */
2909  @SearchParamDefinition(name = "results-interpreter", path = "DiagnosticReport.resultsInterpreter", description = "Who was the source of the report", type = "reference", target = {
2910      CareTeam.class, Organization.class, Practitioner.class, PractitionerRole.class })
2911  public static final String SP_RESULTS_INTERPRETER = "results-interpreter";
2912  /**
2913   * <b>Fluent Client</b> search parameter constant for <b>results-interpreter</b>
2914   * <p>
2915   * Description: <b>Who was the source of the report</b><br>
2916   * Type: <b>reference</b><br>
2917   * Path: <b>DiagnosticReport.resultsInterpreter</b><br>
2918   * </p>
2919   */
2920  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULTS_INTERPRETER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2921      SP_RESULTS_INTERPRETER);
2922
2923  /**
2924   * Constant for fluent queries to be used to add include statements. Specifies
2925   * the path value of "<b>DiagnosticReport:results-interpreter</b>".
2926   */
2927  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULTS_INTERPRETER = new ca.uhn.fhir.model.api.Include(
2928      "DiagnosticReport:results-interpreter").toLocked();
2929
2930  /**
2931   * Search parameter: <b>status</b>
2932   * <p>
2933   * Description: <b>The status of the report</b><br>
2934   * Type: <b>token</b><br>
2935   * Path: <b>DiagnosticReport.status</b><br>
2936   * </p>
2937   */
2938  @SearchParamDefinition(name = "status", path = "DiagnosticReport.status", description = "The status of the report", type = "token")
2939  public static final String SP_STATUS = "status";
2940  /**
2941   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2942   * <p>
2943   * Description: <b>The status of the report</b><br>
2944   * Type: <b>token</b><br>
2945   * Path: <b>DiagnosticReport.status</b><br>
2946   * </p>
2947   */
2948  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2949      SP_STATUS);
2950
2951}