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 void removeChild(String name, Base value) throws FHIRException {
566      if (name.equals("comment")) {
567        this.comment = null;
568      } else if (name.equals("link")) {
569        this.link = null;
570      } else
571        super.removeChild(name, value);
572      
573    }
574
575    @Override
576    public Base makeProperty(int hash, String name) throws FHIRException {
577      switch (hash) {
578      case 950398559:
579        return getCommentElement();
580      case 3321850:
581        return getLink();
582      default:
583        return super.makeProperty(hash, name);
584      }
585
586    }
587
588    @Override
589    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
590      switch (hash) {
591      case 950398559:
592        /* comment */ return new String[] { "string" };
593      case 3321850:
594        /* link */ return new String[] { "Reference" };
595      default:
596        return super.getTypesForProperty(hash, name);
597      }
598
599    }
600
601    @Override
602    public Base addChild(String name) throws FHIRException {
603      if (name.equals("comment")) {
604        throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.comment");
605      } else if (name.equals("link")) {
606        this.link = new Reference();
607        return this.link;
608      } else
609        return super.addChild(name);
610    }
611
612    public DiagnosticReportMediaComponent copy() {
613      DiagnosticReportMediaComponent dst = new DiagnosticReportMediaComponent();
614      copyValues(dst);
615      return dst;
616    }
617
618    public void copyValues(DiagnosticReportMediaComponent dst) {
619      super.copyValues(dst);
620      dst.comment = comment == null ? null : comment.copy();
621      dst.link = link == null ? null : link.copy();
622    }
623
624    @Override
625    public boolean equalsDeep(Base other_) {
626      if (!super.equalsDeep(other_))
627        return false;
628      if (!(other_ instanceof DiagnosticReportMediaComponent))
629        return false;
630      DiagnosticReportMediaComponent o = (DiagnosticReportMediaComponent) other_;
631      return compareDeep(comment, o.comment, true) && compareDeep(link, o.link, true);
632    }
633
634    @Override
635    public boolean equalsShallow(Base other_) {
636      if (!super.equalsShallow(other_))
637        return false;
638      if (!(other_ instanceof DiagnosticReportMediaComponent))
639        return false;
640      DiagnosticReportMediaComponent o = (DiagnosticReportMediaComponent) other_;
641      return compareValues(comment, o.comment, true);
642    }
643
644    public boolean isEmpty() {
645      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, link);
646    }
647
648    public String fhirType() {
649      return "DiagnosticReport.media";
650
651    }
652
653  }
654
655  /**
656   * Identifiers assigned to this report by the performer or other systems.
657   */
658  @Child(name = "identifier", type = {
659      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
660  @Description(shortDefinition = "Business identifier for report", formalDefinition = "Identifiers assigned to this report by the performer or other systems.")
661  protected List<Identifier> identifier;
662
663  /**
664   * Details concerning a service requested.
665   */
666  @Child(name = "basedOn", type = { CarePlan.class, ImmunizationRecommendation.class, MedicationRequest.class,
667      NutritionOrder.class,
668      ServiceRequest.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
669  @Description(shortDefinition = "What was requested", formalDefinition = "Details concerning a service requested.")
670  protected List<Reference> basedOn;
671  /**
672   * The actual objects that are the target of the reference (Details concerning a
673   * service requested.)
674   */
675  protected List<Resource> basedOnTarget;
676
677  /**
678   * The status of the diagnostic report.
679   */
680  @Child(name = "status", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
681  @Description(shortDefinition = "registered | partial | preliminary | final +", formalDefinition = "The status of the diagnostic report.")
682  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/diagnostic-report-status")
683  protected Enumeration<DiagnosticReportStatus> status;
684
685  /**
686   * A code that classifies the clinical discipline, department or diagnostic
687   * service that created the report (e.g. cardiology, biochemistry, hematology,
688   * MRI). This is used for searching, sorting and display purposes.
689   */
690  @Child(name = "category", type = {
691      CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
692  @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.")
693  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/diagnostic-service-sections")
694  protected List<CodeableConcept> category;
695
696  /**
697   * A code or name that describes this diagnostic report.
698   */
699  @Child(name = "code", type = { CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
700  @Description(shortDefinition = "Name/Code for this diagnostic report", formalDefinition = "A code or name that describes this diagnostic report.")
701  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/report-codes")
702  protected CodeableConcept code;
703
704  /**
705   * The subject of the report. Usually, but not always, this is a patient.
706   * However, diagnostic services also perform analyses on specimens collected
707   * from a variety of other sources.
708   */
709  @Child(name = "subject", type = { Patient.class, Group.class, Device.class,
710      Location.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
711  @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.")
712  protected Reference subject;
713
714  /**
715   * The actual object that is the target of the reference (The subject of the
716   * report. Usually, but not always, this is a patient. However, diagnostic
717   * services also perform analyses on specimens collected from a variety of other
718   * sources.)
719   */
720  protected Resource subjectTarget;
721
722  /**
723   * The healthcare event (e.g. a patient and healthcare provider interaction)
724   * which this DiagnosticReport is about.
725   */
726  @Child(name = "encounter", type = { Encounter.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
727  @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.")
728  protected Reference encounter;
729
730  /**
731   * The actual object that is the target of the reference (The healthcare event
732   * (e.g. a patient and healthcare provider interaction) which this
733   * DiagnosticReport is about.)
734   */
735  protected Encounter encounterTarget;
736
737  /**
738   * The time or time-period the observed values are related to. When the subject
739   * of the report is a patient, this is usually either the time of the procedure
740   * or of specimen collection(s), but very often the source of the date/time is
741   * not known, only the date/time itself.
742   */
743  @Child(name = "effective", type = { DateTimeType.class,
744      Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
745  @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.")
746  protected Type effective;
747
748  /**
749   * The date and time that this version of the report was made available to
750   * providers, typically after the report was reviewed and verified.
751   */
752  @Child(name = "issued", type = { InstantType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
753  @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.")
754  protected InstantType issued;
755
756  /**
757   * The diagnostic service that is responsible for issuing the report.
758   */
759  @Child(name = "performer", type = { Practitioner.class, PractitionerRole.class, Organization.class,
760      CareTeam.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
761  @Description(shortDefinition = "Responsible Diagnostic Service", formalDefinition = "The diagnostic service that is responsible for issuing the report.")
762  protected List<Reference> performer;
763  /**
764   * The actual objects that are the target of the reference (The diagnostic
765   * service that is responsible for issuing the report.)
766   */
767  protected List<Resource> performerTarget;
768
769  /**
770   * The practitioner or organization that is responsible for the report's
771   * conclusions and interpretations.
772   */
773  @Child(name = "resultsInterpreter", type = { Practitioner.class, PractitionerRole.class, Organization.class,
774      CareTeam.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
775  @Description(shortDefinition = "Primary result interpreter", formalDefinition = "The practitioner or organization that is responsible for the report's conclusions and interpretations.")
776  protected List<Reference> resultsInterpreter;
777  /**
778   * The actual objects that are the target of the reference (The practitioner or
779   * organization that is responsible for the report's conclusions and
780   * interpretations.)
781   */
782  protected List<Resource> resultsInterpreterTarget;
783
784  /**
785   * Details about the specimens on which this diagnostic report is based.
786   */
787  @Child(name = "specimen", type = {
788      Specimen.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
789  @Description(shortDefinition = "Specimens this report is based on", formalDefinition = "Details about the specimens on which this diagnostic report is based.")
790  protected List<Reference> specimen;
791  /**
792   * The actual objects that are the target of the reference (Details about the
793   * specimens on which this diagnostic report is based.)
794   */
795  protected List<Specimen> specimenTarget;
796
797  /**
798   * [Observations](observation.html) that are part of this diagnostic report.
799   */
800  @Child(name = "result", type = {
801      Observation.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
802  @Description(shortDefinition = "Observations", formalDefinition = "[Observations](observation.html)  that are part of this diagnostic report.")
803  protected List<Reference> result;
804  /**
805   * The actual objects that are the target of the reference
806   * ([Observations](observation.html) that are part of this diagnostic report.)
807   */
808  protected List<Observation> resultTarget;
809
810  /**
811   * One or more links to full details of any imaging performed during the
812   * diagnostic investigation. Typically, this is imaging performed by DICOM
813   * enabled modalities, but this is not required. A fully enabled PACS viewer can
814   * use this information to provide views of the source images.
815   */
816  @Child(name = "imagingStudy", type = {
817      ImagingStudy.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
818  @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.")
819  protected List<Reference> imagingStudy;
820  /**
821   * The actual objects that are the target of the reference (One or more links to
822   * full details of any imaging performed during the diagnostic investigation.
823   * Typically, this is imaging performed by DICOM enabled modalities, but this is
824   * not required. A fully enabled PACS viewer can use this information to provide
825   * views of the source images.)
826   */
827  protected List<ImagingStudy> imagingStudyTarget;
828
829  /**
830   * A list of key images associated with this report. The images are generally
831   * created during the diagnostic process, and may be directly of the patient, or
832   * of treated specimens (i.e. slides of interest).
833   */
834  @Child(name = "media", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
835  @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).")
836  protected List<DiagnosticReportMediaComponent> media;
837
838  /**
839   * Concise and clinically contextualized summary conclusion
840   * (interpretation/impression) of the diagnostic report.
841   */
842  @Child(name = "conclusion", type = {
843      StringType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
844  @Description(shortDefinition = "Clinical conclusion (interpretation) of test results", formalDefinition = "Concise and clinically contextualized summary conclusion (interpretation/impression) of the diagnostic report.")
845  protected StringType conclusion;
846
847  /**
848   * One or more codes that represent the summary conclusion
849   * (interpretation/impression) of the diagnostic report.
850   */
851  @Child(name = "conclusionCode", type = {
852      CodeableConcept.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
853  @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.")
854  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/clinical-findings")
855  protected List<CodeableConcept> conclusionCode;
856
857  /**
858   * Rich text representation of the entire result as issued by the diagnostic
859   * service. Multiple formats are allowed but they SHALL be semantically
860   * equivalent.
861   */
862  @Child(name = "presentedForm", type = {
863      Attachment.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
864  @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.")
865  protected List<Attachment> presentedForm;
866
867  private static final long serialVersionUID = 589102296L;
868
869  /**
870   * Constructor
871   */
872  public DiagnosticReport() {
873    super();
874  }
875
876  /**
877   * Constructor
878   */
879  public DiagnosticReport(Enumeration<DiagnosticReportStatus> status, CodeableConcept code) {
880    super();
881    this.status = status;
882    this.code = code;
883  }
884
885  /**
886   * @return {@link #identifier} (Identifiers assigned to this report by the
887   *         performer or other systems.)
888   */
889  public List<Identifier> getIdentifier() {
890    if (this.identifier == null)
891      this.identifier = new ArrayList<Identifier>();
892    return this.identifier;
893  }
894
895  /**
896   * @return Returns a reference to <code>this</code> for easy method chaining
897   */
898  public DiagnosticReport setIdentifier(List<Identifier> theIdentifier) {
899    this.identifier = theIdentifier;
900    return this;
901  }
902
903  public boolean hasIdentifier() {
904    if (this.identifier == null)
905      return false;
906    for (Identifier item : this.identifier)
907      if (!item.isEmpty())
908        return true;
909    return false;
910  }
911
912  public Identifier addIdentifier() { // 3
913    Identifier t = new Identifier();
914    if (this.identifier == null)
915      this.identifier = new ArrayList<Identifier>();
916    this.identifier.add(t);
917    return t;
918  }
919
920  public DiagnosticReport addIdentifier(Identifier t) { // 3
921    if (t == null)
922      return this;
923    if (this.identifier == null)
924      this.identifier = new ArrayList<Identifier>();
925    this.identifier.add(t);
926    return this;
927  }
928
929  /**
930   * @return The first repetition of repeating field {@link #identifier}, creating
931   *         it if it does not already exist
932   */
933  public Identifier getIdentifierFirstRep() {
934    if (getIdentifier().isEmpty()) {
935      addIdentifier();
936    }
937    return getIdentifier().get(0);
938  }
939
940  /**
941   * @return {@link #basedOn} (Details concerning a service requested.)
942   */
943  public List<Reference> getBasedOn() {
944    if (this.basedOn == null)
945      this.basedOn = new ArrayList<Reference>();
946    return this.basedOn;
947  }
948
949  /**
950   * @return Returns a reference to <code>this</code> for easy method chaining
951   */
952  public DiagnosticReport setBasedOn(List<Reference> theBasedOn) {
953    this.basedOn = theBasedOn;
954    return this;
955  }
956
957  public boolean hasBasedOn() {
958    if (this.basedOn == null)
959      return false;
960    for (Reference item : this.basedOn)
961      if (!item.isEmpty())
962        return true;
963    return false;
964  }
965
966  public Reference addBasedOn() { // 3
967    Reference t = new Reference();
968    if (this.basedOn == null)
969      this.basedOn = new ArrayList<Reference>();
970    this.basedOn.add(t);
971    return t;
972  }
973
974  public DiagnosticReport addBasedOn(Reference t) { // 3
975    if (t == null)
976      return this;
977    if (this.basedOn == null)
978      this.basedOn = new ArrayList<Reference>();
979    this.basedOn.add(t);
980    return this;
981  }
982
983  /**
984   * @return The first repetition of repeating field {@link #basedOn}, creating it
985   *         if it does not already exist
986   */
987  public Reference getBasedOnFirstRep() {
988    if (getBasedOn().isEmpty()) {
989      addBasedOn();
990    }
991    return getBasedOn().get(0);
992  }
993
994  /**
995   * @deprecated Use Reference#setResource(IBaseResource) instead
996   */
997  @Deprecated
998  public List<Resource> getBasedOnTarget() {
999    if (this.basedOnTarget == null)
1000      this.basedOnTarget = new ArrayList<Resource>();
1001    return this.basedOnTarget;
1002  }
1003
1004  /**
1005   * @return {@link #status} (The status of the diagnostic report.). This is the
1006   *         underlying object with id, value and extensions. The accessor
1007   *         "getStatus" gives direct access to the value
1008   */
1009  public Enumeration<DiagnosticReportStatus> getStatusElement() {
1010    if (this.status == null)
1011      if (Configuration.errorOnAutoCreate())
1012        throw new Error("Attempt to auto-create DiagnosticReport.status");
1013      else if (Configuration.doAutoCreate())
1014        this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory()); // bb
1015    return this.status;
1016  }
1017
1018  public boolean hasStatusElement() {
1019    return this.status != null && !this.status.isEmpty();
1020  }
1021
1022  public boolean hasStatus() {
1023    return this.status != null && !this.status.isEmpty();
1024  }
1025
1026  /**
1027   * @param value {@link #status} (The status of the diagnostic report.). This is
1028   *              the underlying object with id, value and extensions. The
1029   *              accessor "getStatus" gives direct access to the value
1030   */
1031  public DiagnosticReport setStatusElement(Enumeration<DiagnosticReportStatus> value) {
1032    this.status = value;
1033    return this;
1034  }
1035
1036  /**
1037   * @return The status of the diagnostic report.
1038   */
1039  public DiagnosticReportStatus getStatus() {
1040    return this.status == null ? null : this.status.getValue();
1041  }
1042
1043  /**
1044   * @param value The status of the diagnostic report.
1045   */
1046  public DiagnosticReport setStatus(DiagnosticReportStatus value) {
1047    if (this.status == null)
1048      this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory());
1049    this.status.setValue(value);
1050    return this;
1051  }
1052
1053  /**
1054   * @return {@link #category} (A code that classifies the clinical discipline,
1055   *         department or diagnostic service that created the report (e.g.
1056   *         cardiology, biochemistry, hematology, MRI). This is used for
1057   *         searching, sorting and display purposes.)
1058   */
1059  public List<CodeableConcept> getCategory() {
1060    if (this.category == null)
1061      this.category = new ArrayList<CodeableConcept>();
1062    return this.category;
1063  }
1064
1065  /**
1066   * @return Returns a reference to <code>this</code> for easy method chaining
1067   */
1068  public DiagnosticReport setCategory(List<CodeableConcept> theCategory) {
1069    this.category = theCategory;
1070    return this;
1071  }
1072
1073  public boolean hasCategory() {
1074    if (this.category == null)
1075      return false;
1076    for (CodeableConcept item : this.category)
1077      if (!item.isEmpty())
1078        return true;
1079    return false;
1080  }
1081
1082  public CodeableConcept addCategory() { // 3
1083    CodeableConcept t = new CodeableConcept();
1084    if (this.category == null)
1085      this.category = new ArrayList<CodeableConcept>();
1086    this.category.add(t);
1087    return t;
1088  }
1089
1090  public DiagnosticReport addCategory(CodeableConcept t) { // 3
1091    if (t == null)
1092      return this;
1093    if (this.category == null)
1094      this.category = new ArrayList<CodeableConcept>();
1095    this.category.add(t);
1096    return this;
1097  }
1098
1099  /**
1100   * @return The first repetition of repeating field {@link #category}, creating
1101   *         it if it does not already exist
1102   */
1103  public CodeableConcept getCategoryFirstRep() {
1104    if (getCategory().isEmpty()) {
1105      addCategory();
1106    }
1107    return getCategory().get(0);
1108  }
1109
1110  /**
1111   * @return {@link #code} (A code or name that describes this diagnostic report.)
1112   */
1113  public CodeableConcept getCode() {
1114    if (this.code == null)
1115      if (Configuration.errorOnAutoCreate())
1116        throw new Error("Attempt to auto-create DiagnosticReport.code");
1117      else if (Configuration.doAutoCreate())
1118        this.code = new CodeableConcept(); // cc
1119    return this.code;
1120  }
1121
1122  public boolean hasCode() {
1123    return this.code != null && !this.code.isEmpty();
1124  }
1125
1126  /**
1127   * @param value {@link #code} (A code or name that describes this diagnostic
1128   *              report.)
1129   */
1130  public DiagnosticReport setCode(CodeableConcept value) {
1131    this.code = value;
1132    return this;
1133  }
1134
1135  /**
1136   * @return {@link #subject} (The subject of the report. Usually, but not always,
1137   *         this is a patient. However, diagnostic services also perform analyses
1138   *         on specimens collected from a variety of other sources.)
1139   */
1140  public Reference getSubject() {
1141    if (this.subject == null)
1142      if (Configuration.errorOnAutoCreate())
1143        throw new Error("Attempt to auto-create DiagnosticReport.subject");
1144      else if (Configuration.doAutoCreate())
1145        this.subject = new Reference(); // cc
1146    return this.subject;
1147  }
1148
1149  public boolean hasSubject() {
1150    return this.subject != null && !this.subject.isEmpty();
1151  }
1152
1153  /**
1154   * @param value {@link #subject} (The subject of the report. Usually, but not
1155   *              always, this is a patient. However, diagnostic services also
1156   *              perform analyses on specimens collected from a variety of other
1157   *              sources.)
1158   */
1159  public DiagnosticReport setSubject(Reference value) {
1160    this.subject = value;
1161    return this;
1162  }
1163
1164  /**
1165   * @return {@link #subject} The actual object that is the target of the
1166   *         reference. The reference library doesn't populate this, but you can
1167   *         use it to hold the resource if you resolve it. (The subject of the
1168   *         report. Usually, but not always, this is a patient. However,
1169   *         diagnostic services also perform analyses on specimens collected from
1170   *         a variety of other sources.)
1171   */
1172  public Resource getSubjectTarget() {
1173    return this.subjectTarget;
1174  }
1175
1176  /**
1177   * @param value {@link #subject} The actual object that is the target of the
1178   *              reference. The reference library doesn't use these, but you can
1179   *              use it to hold the resource if you resolve it. (The subject of
1180   *              the report. Usually, but not always, this is a patient. However,
1181   *              diagnostic services also perform analyses on specimens collected
1182   *              from a variety of other sources.)
1183   */
1184  public DiagnosticReport setSubjectTarget(Resource value) {
1185    this.subjectTarget = value;
1186    return this;
1187  }
1188
1189  /**
1190   * @return {@link #encounter} (The healthcare event (e.g. a patient and
1191   *         healthcare provider interaction) which this DiagnosticReport is
1192   *         about.)
1193   */
1194  public Reference getEncounter() {
1195    if (this.encounter == null)
1196      if (Configuration.errorOnAutoCreate())
1197        throw new Error("Attempt to auto-create DiagnosticReport.encounter");
1198      else if (Configuration.doAutoCreate())
1199        this.encounter = new Reference(); // cc
1200    return this.encounter;
1201  }
1202
1203  public boolean hasEncounter() {
1204    return this.encounter != null && !this.encounter.isEmpty();
1205  }
1206
1207  /**
1208   * @param value {@link #encounter} (The healthcare event (e.g. a patient and
1209   *              healthcare provider interaction) which this DiagnosticReport is
1210   *              about.)
1211   */
1212  public DiagnosticReport setEncounter(Reference value) {
1213    this.encounter = value;
1214    return this;
1215  }
1216
1217  /**
1218   * @return {@link #encounter} The actual object that is the target of the
1219   *         reference. The reference library doesn't populate this, but you can
1220   *         use it to hold the resource if you resolve it. (The healthcare event
1221   *         (e.g. a patient and healthcare provider interaction) which this
1222   *         DiagnosticReport is about.)
1223   */
1224  public Encounter getEncounterTarget() {
1225    if (this.encounterTarget == null)
1226      if (Configuration.errorOnAutoCreate())
1227        throw new Error("Attempt to auto-create DiagnosticReport.encounter");
1228      else if (Configuration.doAutoCreate())
1229        this.encounterTarget = new Encounter(); // aa
1230    return this.encounterTarget;
1231  }
1232
1233  /**
1234   * @param value {@link #encounter} The actual object that is the target of the
1235   *              reference. The reference library doesn't use these, but you can
1236   *              use it to hold the resource if you resolve it. (The healthcare
1237   *              event (e.g. a patient and healthcare provider interaction) which
1238   *              this DiagnosticReport is about.)
1239   */
1240  public DiagnosticReport setEncounterTarget(Encounter value) {
1241    this.encounterTarget = value;
1242    return this;
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 Type getEffective() {
1253    return this.effective;
1254  }
1255
1256  /**
1257   * @return {@link #effective} (The time or time-period the observed values are
1258   *         related to. When the subject of the report is a patient, this is
1259   *         usually either the time of the procedure or of specimen
1260   *         collection(s), but very often the source of the date/time is not
1261   *         known, only the date/time itself.)
1262   */
1263  public DateTimeType getEffectiveDateTimeType() throws FHIRException {
1264    if (this.effective == null)
1265      this.effective = new DateTimeType();
1266    if (!(this.effective instanceof DateTimeType))
1267      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1268          + this.effective.getClass().getName() + " was encountered");
1269    return (DateTimeType) this.effective;
1270  }
1271
1272  public boolean hasEffectiveDateTimeType() {
1273    return this != null && this.effective instanceof DateTimeType;
1274  }
1275
1276  /**
1277   * @return {@link #effective} (The time or time-period the observed values are
1278   *         related to. When the subject of the report is a patient, this is
1279   *         usually either the time of the procedure or of specimen
1280   *         collection(s), but very often the source of the date/time is not
1281   *         known, only the date/time itself.)
1282   */
1283  public Period getEffectivePeriod() throws FHIRException {
1284    if (this.effective == null)
1285      this.effective = new Period();
1286    if (!(this.effective instanceof Period))
1287      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.effective.getClass().getName()
1288          + " was encountered");
1289    return (Period) this.effective;
1290  }
1291
1292  public boolean hasEffectivePeriod() {
1293    return this != null && this.effective instanceof Period;
1294  }
1295
1296  public boolean hasEffective() {
1297    return this.effective != null && !this.effective.isEmpty();
1298  }
1299
1300  /**
1301   * @param value {@link #effective} (The time or time-period the observed values
1302   *              are related to. When the subject of the report is a patient,
1303   *              this is usually either the time of the procedure or of specimen
1304   *              collection(s), but very often the source of the date/time is not
1305   *              known, only the date/time itself.)
1306   */
1307  public DiagnosticReport setEffective(Type value) {
1308    if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1309      throw new Error("Not the right type for DiagnosticReport.effective[x]: " + value.fhirType());
1310    this.effective = value;
1311    return this;
1312  }
1313
1314  /**
1315   * @return {@link #issued} (The date and time that this version of the report
1316   *         was made available to providers, typically after the report was
1317   *         reviewed and verified.). This is the underlying object with id, value
1318   *         and extensions. The accessor "getIssued" gives direct access to the
1319   *         value
1320   */
1321  public InstantType getIssuedElement() {
1322    if (this.issued == null)
1323      if (Configuration.errorOnAutoCreate())
1324        throw new Error("Attempt to auto-create DiagnosticReport.issued");
1325      else if (Configuration.doAutoCreate())
1326        this.issued = new InstantType(); // bb
1327    return this.issued;
1328  }
1329
1330  public boolean hasIssuedElement() {
1331    return this.issued != null && !this.issued.isEmpty();
1332  }
1333
1334  public boolean hasIssued() {
1335    return this.issued != null && !this.issued.isEmpty();
1336  }
1337
1338  /**
1339   * @param value {@link #issued} (The date and time that this version of the
1340   *              report was made available to providers, typically after the
1341   *              report was reviewed and verified.). This is the underlying
1342   *              object with id, value and extensions. The accessor "getIssued"
1343   *              gives direct access to the value
1344   */
1345  public DiagnosticReport setIssuedElement(InstantType value) {
1346    this.issued = value;
1347    return this;
1348  }
1349
1350  /**
1351   * @return The date and time that this version of the report was made available
1352   *         to providers, typically after the report was reviewed and verified.
1353   */
1354  public Date getIssued() {
1355    return this.issued == null ? null : this.issued.getValue();
1356  }
1357
1358  /**
1359   * @param value The date and time that this version of the report was made
1360   *              available to providers, typically after the report was reviewed
1361   *              and verified.
1362   */
1363  public DiagnosticReport setIssued(Date value) {
1364    if (value == null)
1365      this.issued = null;
1366    else {
1367      if (this.issued == null)
1368        this.issued = new InstantType();
1369      this.issued.setValue(value);
1370    }
1371    return this;
1372  }
1373
1374  /**
1375   * @return {@link #performer} (The diagnostic service that is responsible for
1376   *         issuing the report.)
1377   */
1378  public List<Reference> getPerformer() {
1379    if (this.performer == null)
1380      this.performer = new ArrayList<Reference>();
1381    return this.performer;
1382  }
1383
1384  /**
1385   * @return Returns a reference to <code>this</code> for easy method chaining
1386   */
1387  public DiagnosticReport setPerformer(List<Reference> thePerformer) {
1388    this.performer = thePerformer;
1389    return this;
1390  }
1391
1392  public boolean hasPerformer() {
1393    if (this.performer == null)
1394      return false;
1395    for (Reference item : this.performer)
1396      if (!item.isEmpty())
1397        return true;
1398    return false;
1399  }
1400
1401  public Reference addPerformer() { // 3
1402    Reference t = new Reference();
1403    if (this.performer == null)
1404      this.performer = new ArrayList<Reference>();
1405    this.performer.add(t);
1406    return t;
1407  }
1408
1409  public DiagnosticReport addPerformer(Reference t) { // 3
1410    if (t == null)
1411      return this;
1412    if (this.performer == null)
1413      this.performer = new ArrayList<Reference>();
1414    this.performer.add(t);
1415    return this;
1416  }
1417
1418  /**
1419   * @return The first repetition of repeating field {@link #performer}, creating
1420   *         it if it does not already exist
1421   */
1422  public Reference getPerformerFirstRep() {
1423    if (getPerformer().isEmpty()) {
1424      addPerformer();
1425    }
1426    return getPerformer().get(0);
1427  }
1428
1429  /**
1430   * @deprecated Use Reference#setResource(IBaseResource) instead
1431   */
1432  @Deprecated
1433  public List<Resource> getPerformerTarget() {
1434    if (this.performerTarget == null)
1435      this.performerTarget = new ArrayList<Resource>();
1436    return this.performerTarget;
1437  }
1438
1439  /**
1440   * @return {@link #resultsInterpreter} (The practitioner or organization that is
1441   *         responsible for the report's conclusions and interpretations.)
1442   */
1443  public List<Reference> getResultsInterpreter() {
1444    if (this.resultsInterpreter == null)
1445      this.resultsInterpreter = new ArrayList<Reference>();
1446    return this.resultsInterpreter;
1447  }
1448
1449  /**
1450   * @return Returns a reference to <code>this</code> for easy method chaining
1451   */
1452  public DiagnosticReport setResultsInterpreter(List<Reference> theResultsInterpreter) {
1453    this.resultsInterpreter = theResultsInterpreter;
1454    return this;
1455  }
1456
1457  public boolean hasResultsInterpreter() {
1458    if (this.resultsInterpreter == null)
1459      return false;
1460    for (Reference item : this.resultsInterpreter)
1461      if (!item.isEmpty())
1462        return true;
1463    return false;
1464  }
1465
1466  public Reference addResultsInterpreter() { // 3
1467    Reference t = new Reference();
1468    if (this.resultsInterpreter == null)
1469      this.resultsInterpreter = new ArrayList<Reference>();
1470    this.resultsInterpreter.add(t);
1471    return t;
1472  }
1473
1474  public DiagnosticReport addResultsInterpreter(Reference t) { // 3
1475    if (t == null)
1476      return this;
1477    if (this.resultsInterpreter == null)
1478      this.resultsInterpreter = new ArrayList<Reference>();
1479    this.resultsInterpreter.add(t);
1480    return this;
1481  }
1482
1483  /**
1484   * @return The first repetition of repeating field {@link #resultsInterpreter},
1485   *         creating it if it does not already exist
1486   */
1487  public Reference getResultsInterpreterFirstRep() {
1488    if (getResultsInterpreter().isEmpty()) {
1489      addResultsInterpreter();
1490    }
1491    return getResultsInterpreter().get(0);
1492  }
1493
1494  /**
1495   * @deprecated Use Reference#setResource(IBaseResource) instead
1496   */
1497  @Deprecated
1498  public List<Resource> getResultsInterpreterTarget() {
1499    if (this.resultsInterpreterTarget == null)
1500      this.resultsInterpreterTarget = new ArrayList<Resource>();
1501    return this.resultsInterpreterTarget;
1502  }
1503
1504  /**
1505   * @return {@link #specimen} (Details about the specimens on which this
1506   *         diagnostic report is based.)
1507   */
1508  public List<Reference> getSpecimen() {
1509    if (this.specimen == null)
1510      this.specimen = new ArrayList<Reference>();
1511    return this.specimen;
1512  }
1513
1514  /**
1515   * @return Returns a reference to <code>this</code> for easy method chaining
1516   */
1517  public DiagnosticReport setSpecimen(List<Reference> theSpecimen) {
1518    this.specimen = theSpecimen;
1519    return this;
1520  }
1521
1522  public boolean hasSpecimen() {
1523    if (this.specimen == null)
1524      return false;
1525    for (Reference item : this.specimen)
1526      if (!item.isEmpty())
1527        return true;
1528    return false;
1529  }
1530
1531  public Reference addSpecimen() { // 3
1532    Reference t = new Reference();
1533    if (this.specimen == null)
1534      this.specimen = new ArrayList<Reference>();
1535    this.specimen.add(t);
1536    return t;
1537  }
1538
1539  public DiagnosticReport addSpecimen(Reference t) { // 3
1540    if (t == null)
1541      return this;
1542    if (this.specimen == null)
1543      this.specimen = new ArrayList<Reference>();
1544    this.specimen.add(t);
1545    return this;
1546  }
1547
1548  /**
1549   * @return The first repetition of repeating field {@link #specimen}, creating
1550   *         it if it does not already exist
1551   */
1552  public Reference getSpecimenFirstRep() {
1553    if (getSpecimen().isEmpty()) {
1554      addSpecimen();
1555    }
1556    return getSpecimen().get(0);
1557  }
1558
1559  /**
1560   * @deprecated Use Reference#setResource(IBaseResource) instead
1561   */
1562  @Deprecated
1563  public List<Specimen> getSpecimenTarget() {
1564    if (this.specimenTarget == null)
1565      this.specimenTarget = new ArrayList<Specimen>();
1566    return this.specimenTarget;
1567  }
1568
1569  /**
1570   * @deprecated Use Reference#setResource(IBaseResource) instead
1571   */
1572  @Deprecated
1573  public Specimen addSpecimenTarget() {
1574    Specimen r = new Specimen();
1575    if (this.specimenTarget == null)
1576      this.specimenTarget = new ArrayList<Specimen>();
1577    this.specimenTarget.add(r);
1578    return r;
1579  }
1580
1581  /**
1582   * @return {@link #result} ([Observations](observation.html) that are part of
1583   *         this diagnostic report.)
1584   */
1585  public List<Reference> getResult() {
1586    if (this.result == null)
1587      this.result = new ArrayList<Reference>();
1588    return this.result;
1589  }
1590
1591  /**
1592   * @return Returns a reference to <code>this</code> for easy method chaining
1593   */
1594  public DiagnosticReport setResult(List<Reference> theResult) {
1595    this.result = theResult;
1596    return this;
1597  }
1598
1599  public boolean hasResult() {
1600    if (this.result == null)
1601      return false;
1602    for (Reference item : this.result)
1603      if (!item.isEmpty())
1604        return true;
1605    return false;
1606  }
1607
1608  public Reference addResult() { // 3
1609    Reference t = new Reference();
1610    if (this.result == null)
1611      this.result = new ArrayList<Reference>();
1612    this.result.add(t);
1613    return t;
1614  }
1615
1616  public DiagnosticReport addResult(Reference t) { // 3
1617    if (t == null)
1618      return this;
1619    if (this.result == null)
1620      this.result = new ArrayList<Reference>();
1621    this.result.add(t);
1622    return this;
1623  }
1624
1625  /**
1626   * @return The first repetition of repeating field {@link #result}, creating it
1627   *         if it does not already exist
1628   */
1629  public Reference getResultFirstRep() {
1630    if (getResult().isEmpty()) {
1631      addResult();
1632    }
1633    return getResult().get(0);
1634  }
1635
1636  /**
1637   * @deprecated Use Reference#setResource(IBaseResource) instead
1638   */
1639  @Deprecated
1640  public List<Observation> getResultTarget() {
1641    if (this.resultTarget == null)
1642      this.resultTarget = new ArrayList<Observation>();
1643    return this.resultTarget;
1644  }
1645
1646  /**
1647   * @deprecated Use Reference#setResource(IBaseResource) instead
1648   */
1649  @Deprecated
1650  public Observation addResultTarget() {
1651    Observation r = new Observation();
1652    if (this.resultTarget == null)
1653      this.resultTarget = new ArrayList<Observation>();
1654    this.resultTarget.add(r);
1655    return r;
1656  }
1657
1658  /**
1659   * @return {@link #imagingStudy} (One or more links to full details of any
1660   *         imaging performed during the diagnostic investigation. Typically,
1661   *         this is imaging performed by DICOM enabled modalities, but this is
1662   *         not required. A fully enabled PACS viewer can use this information to
1663   *         provide views of the source images.)
1664   */
1665  public List<Reference> getImagingStudy() {
1666    if (this.imagingStudy == null)
1667      this.imagingStudy = new ArrayList<Reference>();
1668    return this.imagingStudy;
1669  }
1670
1671  /**
1672   * @return Returns a reference to <code>this</code> for easy method chaining
1673   */
1674  public DiagnosticReport setImagingStudy(List<Reference> theImagingStudy) {
1675    this.imagingStudy = theImagingStudy;
1676    return this;
1677  }
1678
1679  public boolean hasImagingStudy() {
1680    if (this.imagingStudy == null)
1681      return false;
1682    for (Reference item : this.imagingStudy)
1683      if (!item.isEmpty())
1684        return true;
1685    return false;
1686  }
1687
1688  public Reference addImagingStudy() { // 3
1689    Reference t = new Reference();
1690    if (this.imagingStudy == null)
1691      this.imagingStudy = new ArrayList<Reference>();
1692    this.imagingStudy.add(t);
1693    return t;
1694  }
1695
1696  public DiagnosticReport addImagingStudy(Reference t) { // 3
1697    if (t == null)
1698      return this;
1699    if (this.imagingStudy == null)
1700      this.imagingStudy = new ArrayList<Reference>();
1701    this.imagingStudy.add(t);
1702    return this;
1703  }
1704
1705  /**
1706   * @return The first repetition of repeating field {@link #imagingStudy},
1707   *         creating it if it does not already exist
1708   */
1709  public Reference getImagingStudyFirstRep() {
1710    if (getImagingStudy().isEmpty()) {
1711      addImagingStudy();
1712    }
1713    return getImagingStudy().get(0);
1714  }
1715
1716  /**
1717   * @deprecated Use Reference#setResource(IBaseResource) instead
1718   */
1719  @Deprecated
1720  public List<ImagingStudy> getImagingStudyTarget() {
1721    if (this.imagingStudyTarget == null)
1722      this.imagingStudyTarget = new ArrayList<ImagingStudy>();
1723    return this.imagingStudyTarget;
1724  }
1725
1726  /**
1727   * @deprecated Use Reference#setResource(IBaseResource) instead
1728   */
1729  @Deprecated
1730  public ImagingStudy addImagingStudyTarget() {
1731    ImagingStudy r = new ImagingStudy();
1732    if (this.imagingStudyTarget == null)
1733      this.imagingStudyTarget = new ArrayList<ImagingStudy>();
1734    this.imagingStudyTarget.add(r);
1735    return r;
1736  }
1737
1738  /**
1739   * @return {@link #media} (A list of key images associated with this report. The
1740   *         images are generally created during the diagnostic process, and may
1741   *         be directly of the patient, or of treated specimens (i.e. slides of
1742   *         interest).)
1743   */
1744  public List<DiagnosticReportMediaComponent> getMedia() {
1745    if (this.media == null)
1746      this.media = new ArrayList<DiagnosticReportMediaComponent>();
1747    return this.media;
1748  }
1749
1750  /**
1751   * @return Returns a reference to <code>this</code> for easy method chaining
1752   */
1753  public DiagnosticReport setMedia(List<DiagnosticReportMediaComponent> theMedia) {
1754    this.media = theMedia;
1755    return this;
1756  }
1757
1758  public boolean hasMedia() {
1759    if (this.media == null)
1760      return false;
1761    for (DiagnosticReportMediaComponent item : this.media)
1762      if (!item.isEmpty())
1763        return true;
1764    return false;
1765  }
1766
1767  public DiagnosticReportMediaComponent addMedia() { // 3
1768    DiagnosticReportMediaComponent t = new DiagnosticReportMediaComponent();
1769    if (this.media == null)
1770      this.media = new ArrayList<DiagnosticReportMediaComponent>();
1771    this.media.add(t);
1772    return t;
1773  }
1774
1775  public DiagnosticReport addMedia(DiagnosticReportMediaComponent t) { // 3
1776    if (t == null)
1777      return this;
1778    if (this.media == null)
1779      this.media = new ArrayList<DiagnosticReportMediaComponent>();
1780    this.media.add(t);
1781    return this;
1782  }
1783
1784  /**
1785   * @return The first repetition of repeating field {@link #media}, creating it
1786   *         if it does not already exist
1787   */
1788  public DiagnosticReportMediaComponent getMediaFirstRep() {
1789    if (getMedia().isEmpty()) {
1790      addMedia();
1791    }
1792    return getMedia().get(0);
1793  }
1794
1795  /**
1796   * @return {@link #conclusion} (Concise and clinically contextualized summary
1797   *         conclusion (interpretation/impression) of the diagnostic report.).
1798   *         This is the underlying object with id, value and extensions. The
1799   *         accessor "getConclusion" gives direct access to the value
1800   */
1801  public StringType getConclusionElement() {
1802    if (this.conclusion == null)
1803      if (Configuration.errorOnAutoCreate())
1804        throw new Error("Attempt to auto-create DiagnosticReport.conclusion");
1805      else if (Configuration.doAutoCreate())
1806        this.conclusion = new StringType(); // bb
1807    return this.conclusion;
1808  }
1809
1810  public boolean hasConclusionElement() {
1811    return this.conclusion != null && !this.conclusion.isEmpty();
1812  }
1813
1814  public boolean hasConclusion() {
1815    return this.conclusion != null && !this.conclusion.isEmpty();
1816  }
1817
1818  /**
1819   * @param value {@link #conclusion} (Concise and clinically contextualized
1820   *              summary conclusion (interpretation/impression) of the diagnostic
1821   *              report.). This is the underlying object with id, value and
1822   *              extensions. The accessor "getConclusion" gives direct access to
1823   *              the value
1824   */
1825  public DiagnosticReport setConclusionElement(StringType value) {
1826    this.conclusion = value;
1827    return this;
1828  }
1829
1830  /**
1831   * @return Concise and clinically contextualized summary conclusion
1832   *         (interpretation/impression) of the diagnostic report.
1833   */
1834  public String getConclusion() {
1835    return this.conclusion == null ? null : this.conclusion.getValue();
1836  }
1837
1838  /**
1839   * @param value Concise and clinically contextualized summary conclusion
1840   *              (interpretation/impression) of the diagnostic report.
1841   */
1842  public DiagnosticReport setConclusion(String value) {
1843    if (Utilities.noString(value))
1844      this.conclusion = null;
1845    else {
1846      if (this.conclusion == null)
1847        this.conclusion = new StringType();
1848      this.conclusion.setValue(value);
1849    }
1850    return this;
1851  }
1852
1853  /**
1854   * @return {@link #conclusionCode} (One or more codes that represent the summary
1855   *         conclusion (interpretation/impression) of the diagnostic report.)
1856   */
1857  public List<CodeableConcept> getConclusionCode() {
1858    if (this.conclusionCode == null)
1859      this.conclusionCode = new ArrayList<CodeableConcept>();
1860    return this.conclusionCode;
1861  }
1862
1863  /**
1864   * @return Returns a reference to <code>this</code> for easy method chaining
1865   */
1866  public DiagnosticReport setConclusionCode(List<CodeableConcept> theConclusionCode) {
1867    this.conclusionCode = theConclusionCode;
1868    return this;
1869  }
1870
1871  public boolean hasConclusionCode() {
1872    if (this.conclusionCode == null)
1873      return false;
1874    for (CodeableConcept item : this.conclusionCode)
1875      if (!item.isEmpty())
1876        return true;
1877    return false;
1878  }
1879
1880  public CodeableConcept addConclusionCode() { // 3
1881    CodeableConcept t = new CodeableConcept();
1882    if (this.conclusionCode == null)
1883      this.conclusionCode = new ArrayList<CodeableConcept>();
1884    this.conclusionCode.add(t);
1885    return t;
1886  }
1887
1888  public DiagnosticReport addConclusionCode(CodeableConcept t) { // 3
1889    if (t == null)
1890      return this;
1891    if (this.conclusionCode == null)
1892      this.conclusionCode = new ArrayList<CodeableConcept>();
1893    this.conclusionCode.add(t);
1894    return this;
1895  }
1896
1897  /**
1898   * @return The first repetition of repeating field {@link #conclusionCode},
1899   *         creating it if it does not already exist
1900   */
1901  public CodeableConcept getConclusionCodeFirstRep() {
1902    if (getConclusionCode().isEmpty()) {
1903      addConclusionCode();
1904    }
1905    return getConclusionCode().get(0);
1906  }
1907
1908  /**
1909   * @return {@link #presentedForm} (Rich text representation of the entire result
1910   *         as issued by the diagnostic service. Multiple formats are allowed but
1911   *         they SHALL be semantically equivalent.)
1912   */
1913  public List<Attachment> getPresentedForm() {
1914    if (this.presentedForm == null)
1915      this.presentedForm = new ArrayList<Attachment>();
1916    return this.presentedForm;
1917  }
1918
1919  /**
1920   * @return Returns a reference to <code>this</code> for easy method chaining
1921   */
1922  public DiagnosticReport setPresentedForm(List<Attachment> thePresentedForm) {
1923    this.presentedForm = thePresentedForm;
1924    return this;
1925  }
1926
1927  public boolean hasPresentedForm() {
1928    if (this.presentedForm == null)
1929      return false;
1930    for (Attachment item : this.presentedForm)
1931      if (!item.isEmpty())
1932        return true;
1933    return false;
1934  }
1935
1936  public Attachment addPresentedForm() { // 3
1937    Attachment t = new Attachment();
1938    if (this.presentedForm == null)
1939      this.presentedForm = new ArrayList<Attachment>();
1940    this.presentedForm.add(t);
1941    return t;
1942  }
1943
1944  public DiagnosticReport addPresentedForm(Attachment t) { // 3
1945    if (t == null)
1946      return this;
1947    if (this.presentedForm == null)
1948      this.presentedForm = new ArrayList<Attachment>();
1949    this.presentedForm.add(t);
1950    return this;
1951  }
1952
1953  /**
1954   * @return The first repetition of repeating field {@link #presentedForm},
1955   *         creating it if it does not already exist
1956   */
1957  public Attachment getPresentedFormFirstRep() {
1958    if (getPresentedForm().isEmpty()) {
1959      addPresentedForm();
1960    }
1961    return getPresentedForm().get(0);
1962  }
1963
1964  protected void listChildren(List<Property> children) {
1965    super.listChildren(children);
1966    children.add(new Property("identifier", "Identifier",
1967        "Identifiers assigned to this report by the performer or other systems.", 0, java.lang.Integer.MAX_VALUE,
1968        identifier));
1969    children.add(new Property("basedOn",
1970        "Reference(CarePlan|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest)",
1971        "Details concerning a service requested.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1972    children.add(new Property("status", "code", "The status of the diagnostic report.", 0, 1, status));
1973    children.add(new Property("category", "CodeableConcept",
1974        "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.",
1975        0, java.lang.Integer.MAX_VALUE, category));
1976    children.add(
1977        new Property("code", "CodeableConcept", "A code or name that describes this diagnostic report.", 0, 1, code));
1978    children.add(new Property("subject", "Reference(Patient|Group|Device|Location)",
1979        "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.",
1980        0, 1, subject));
1981    children.add(new Property("encounter", "Reference(Encounter)",
1982        "The healthcare event  (e.g. a patient and healthcare provider interaction) which this DiagnosticReport is about.",
1983        0, 1, encounter));
1984    children.add(new Property("effective[x]", "dateTime|Period",
1985        "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.",
1986        0, 1, effective));
1987    children.add(new Property("issued", "instant",
1988        "The date and time that this version of the report was made available to providers, typically after the report was reviewed and verified.",
1989        0, 1, issued));
1990    children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
1991        "The diagnostic service that is responsible for issuing the report.", 0, java.lang.Integer.MAX_VALUE,
1992        performer));
1993    children.add(new Property("resultsInterpreter", "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
1994        "The practitioner or organization that is responsible for the report's conclusions and interpretations.", 0,
1995        java.lang.Integer.MAX_VALUE, resultsInterpreter));
1996    children.add(new Property("specimen", "Reference(Specimen)",
1997        "Details about the specimens on which this diagnostic report is based.", 0, java.lang.Integer.MAX_VALUE,
1998        specimen));
1999    children.add(new Property("result", "Reference(Observation)",
2000        "[Observations](observation.html)  that are part of this diagnostic report.", 0, java.lang.Integer.MAX_VALUE,
2001        result));
2002    children.add(new Property("imagingStudy", "Reference(ImagingStudy)",
2003        "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.",
2004        0, java.lang.Integer.MAX_VALUE, imagingStudy));
2005    children.add(new Property("media", "",
2006        "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).",
2007        0, java.lang.Integer.MAX_VALUE, media));
2008    children.add(new Property("conclusion", "string",
2009        "Concise and clinically contextualized summary conclusion (interpretation/impression) of the diagnostic report.",
2010        0, 1, conclusion));
2011    children.add(new Property("conclusionCode", "CodeableConcept",
2012        "One or more codes that represent the summary conclusion (interpretation/impression) of the diagnostic report.",
2013        0, java.lang.Integer.MAX_VALUE, conclusionCode));
2014    children.add(new Property("presentedForm", "Attachment",
2015        "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.",
2016        0, java.lang.Integer.MAX_VALUE, presentedForm));
2017  }
2018
2019  @Override
2020  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2021    switch (_hash) {
2022    case -1618432855:
2023      /* identifier */ return new Property("identifier", "Identifier",
2024          "Identifiers assigned to this report by the performer or other systems.", 0, java.lang.Integer.MAX_VALUE,
2025          identifier);
2026    case -332612366:
2027      /* basedOn */ return new Property("basedOn",
2028          "Reference(CarePlan|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest)",
2029          "Details concerning a service requested.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2030    case -892481550:
2031      /* status */ return new Property("status", "code", "The status of the diagnostic report.", 0, 1, status);
2032    case 50511102:
2033      /* category */ return new Property("category", "CodeableConcept",
2034          "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.",
2035          0, java.lang.Integer.MAX_VALUE, category);
2036    case 3059181:
2037      /* code */ return new Property("code", "CodeableConcept", "A code or name that describes this diagnostic report.",
2038          0, 1, code);
2039    case -1867885268:
2040      /* subject */ return new Property("subject", "Reference(Patient|Group|Device|Location)",
2041          "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.",
2042          0, 1, subject);
2043    case 1524132147:
2044      /* encounter */ return new Property("encounter", "Reference(Encounter)",
2045          "The healthcare event  (e.g. a patient and healthcare provider interaction) which this DiagnosticReport is about.",
2046          0, 1, encounter);
2047    case 247104889:
2048      /* effective[x] */ return new Property("effective[x]", "dateTime|Period",
2049          "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.",
2050          0, 1, effective);
2051    case -1468651097:
2052      /* effective */ return new Property("effective[x]", "dateTime|Period",
2053          "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.",
2054          0, 1, effective);
2055    case -275306910:
2056      /* effectiveDateTime */ return new Property("effective[x]", "dateTime|Period",
2057          "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.",
2058          0, 1, effective);
2059    case -403934648:
2060      /* effectivePeriod */ return new Property("effective[x]", "dateTime|Period",
2061          "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.",
2062          0, 1, effective);
2063    case -1179159893:
2064      /* issued */ return new Property("issued", "instant",
2065          "The date and time that this version of the report was made available to providers, typically after the report was reviewed and verified.",
2066          0, 1, issued);
2067    case 481140686:
2068      /* performer */ return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
2069          "The diagnostic service that is responsible for issuing the report.", 0, java.lang.Integer.MAX_VALUE,
2070          performer);
2071    case 2134944932:
2072      /* resultsInterpreter */ return new Property("resultsInterpreter",
2073          "Reference(Practitioner|PractitionerRole|Organization|CareTeam)",
2074          "The practitioner or organization that is responsible for the report's conclusions and interpretations.", 0,
2075          java.lang.Integer.MAX_VALUE, resultsInterpreter);
2076    case -2132868344:
2077      /* specimen */ return new Property("specimen", "Reference(Specimen)",
2078          "Details about the specimens on which this diagnostic report is based.", 0, java.lang.Integer.MAX_VALUE,
2079          specimen);
2080    case -934426595:
2081      /* result */ return new Property("result", "Reference(Observation)",
2082          "[Observations](observation.html)  that are part of this diagnostic report.", 0, java.lang.Integer.MAX_VALUE,
2083          result);
2084    case -814900911:
2085      /* imagingStudy */ return new Property("imagingStudy", "Reference(ImagingStudy)",
2086          "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.",
2087          0, java.lang.Integer.MAX_VALUE, imagingStudy);
2088    case 103772132:
2089      /* media */ return new Property("media", "",
2090          "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).",
2091          0, java.lang.Integer.MAX_VALUE, media);
2092    case -1731259873:
2093      /* conclusion */ return new Property("conclusion", "string",
2094          "Concise and clinically contextualized summary conclusion (interpretation/impression) of the diagnostic report.",
2095          0, 1, conclusion);
2096    case -1731523412:
2097      /* conclusionCode */ return new Property("conclusionCode", "CodeableConcept",
2098          "One or more codes that represent the summary conclusion (interpretation/impression) of the diagnostic report.",
2099          0, java.lang.Integer.MAX_VALUE, conclusionCode);
2100    case 230090366:
2101      /* presentedForm */ return new Property("presentedForm", "Attachment",
2102          "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.",
2103          0, java.lang.Integer.MAX_VALUE, presentedForm);
2104    default:
2105      return super.getNamedProperty(_hash, _name, _checkValid);
2106    }
2107
2108  }
2109
2110  @Override
2111  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2112    switch (hash) {
2113    case -1618432855:
2114      /* identifier */ return this.identifier == null ? new Base[0]
2115          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2116    case -332612366:
2117      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2118    case -892481550:
2119      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<DiagnosticReportStatus>
2120    case 50511102:
2121      /* category */ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2122    case 3059181:
2123      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2124    case -1867885268:
2125      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2126    case 1524132147:
2127      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
2128    case -1468651097:
2129      /* effective */ return this.effective == null ? new Base[0] : new Base[] { this.effective }; // Type
2130    case -1179159893:
2131      /* issued */ return this.issued == null ? new Base[0] : new Base[] { this.issued }; // InstantType
2132    case 481140686:
2133      /* performer */ return this.performer == null ? new Base[0]
2134          : this.performer.toArray(new Base[this.performer.size()]); // Reference
2135    case 2134944932:
2136      /* resultsInterpreter */ return this.resultsInterpreter == null ? new Base[0]
2137          : this.resultsInterpreter.toArray(new Base[this.resultsInterpreter.size()]); // Reference
2138    case -2132868344:
2139      /* specimen */ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
2140    case -934426595:
2141      /* result */ return this.result == null ? new Base[0] : this.result.toArray(new Base[this.result.size()]); // Reference
2142    case -814900911:
2143      /* imagingStudy */ return this.imagingStudy == null ? new Base[0]
2144          : this.imagingStudy.toArray(new Base[this.imagingStudy.size()]); // Reference
2145    case 103772132:
2146      /* media */ return this.media == null ? new Base[0] : this.media.toArray(new Base[this.media.size()]); // DiagnosticReportMediaComponent
2147    case -1731259873:
2148      /* conclusion */ return this.conclusion == null ? new Base[0] : new Base[] { this.conclusion }; // StringType
2149    case -1731523412:
2150      /* conclusionCode */ return this.conclusionCode == null ? new Base[0]
2151          : this.conclusionCode.toArray(new Base[this.conclusionCode.size()]); // CodeableConcept
2152    case 230090366:
2153      /* presentedForm */ return this.presentedForm == null ? new Base[0]
2154          : this.presentedForm.toArray(new Base[this.presentedForm.size()]); // Attachment
2155    default:
2156      return super.getProperty(hash, name, checkValid);
2157    }
2158
2159  }
2160
2161  @Override
2162  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2163    switch (hash) {
2164    case -1618432855: // identifier
2165      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2166      return value;
2167    case -332612366: // basedOn
2168      this.getBasedOn().add(castToReference(value)); // Reference
2169      return value;
2170    case -892481550: // status
2171      value = new DiagnosticReportStatusEnumFactory().fromType(castToCode(value));
2172      this.status = (Enumeration) value; // Enumeration<DiagnosticReportStatus>
2173      return value;
2174    case 50511102: // category
2175      this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2176      return value;
2177    case 3059181: // code
2178      this.code = castToCodeableConcept(value); // CodeableConcept
2179      return value;
2180    case -1867885268: // subject
2181      this.subject = castToReference(value); // Reference
2182      return value;
2183    case 1524132147: // encounter
2184      this.encounter = castToReference(value); // Reference
2185      return value;
2186    case -1468651097: // effective
2187      this.effective = castToType(value); // Type
2188      return value;
2189    case -1179159893: // issued
2190      this.issued = castToInstant(value); // InstantType
2191      return value;
2192    case 481140686: // performer
2193      this.getPerformer().add(castToReference(value)); // Reference
2194      return value;
2195    case 2134944932: // resultsInterpreter
2196      this.getResultsInterpreter().add(castToReference(value)); // Reference
2197      return value;
2198    case -2132868344: // specimen
2199      this.getSpecimen().add(castToReference(value)); // Reference
2200      return value;
2201    case -934426595: // result
2202      this.getResult().add(castToReference(value)); // Reference
2203      return value;
2204    case -814900911: // imagingStudy
2205      this.getImagingStudy().add(castToReference(value)); // Reference
2206      return value;
2207    case 103772132: // media
2208      this.getMedia().add((DiagnosticReportMediaComponent) value); // DiagnosticReportMediaComponent
2209      return value;
2210    case -1731259873: // conclusion
2211      this.conclusion = castToString(value); // StringType
2212      return value;
2213    case -1731523412: // conclusionCode
2214      this.getConclusionCode().add(castToCodeableConcept(value)); // CodeableConcept
2215      return value;
2216    case 230090366: // presentedForm
2217      this.getPresentedForm().add(castToAttachment(value)); // Attachment
2218      return value;
2219    default:
2220      return super.setProperty(hash, name, value);
2221    }
2222
2223  }
2224
2225  @Override
2226  public Base setProperty(String name, Base value) throws FHIRException {
2227    if (name.equals("identifier")) {
2228      this.getIdentifier().add(castToIdentifier(value));
2229    } else if (name.equals("basedOn")) {
2230      this.getBasedOn().add(castToReference(value));
2231    } else if (name.equals("status")) {
2232      value = new DiagnosticReportStatusEnumFactory().fromType(castToCode(value));
2233      this.status = (Enumeration) value; // Enumeration<DiagnosticReportStatus>
2234    } else if (name.equals("category")) {
2235      this.getCategory().add(castToCodeableConcept(value));
2236    } else if (name.equals("code")) {
2237      this.code = castToCodeableConcept(value); // CodeableConcept
2238    } else if (name.equals("subject")) {
2239      this.subject = castToReference(value); // Reference
2240    } else if (name.equals("encounter")) {
2241      this.encounter = castToReference(value); // Reference
2242    } else if (name.equals("effective[x]")) {
2243      this.effective = castToType(value); // Type
2244    } else if (name.equals("issued")) {
2245      this.issued = castToInstant(value); // InstantType
2246    } else if (name.equals("performer")) {
2247      this.getPerformer().add(castToReference(value));
2248    } else if (name.equals("resultsInterpreter")) {
2249      this.getResultsInterpreter().add(castToReference(value));
2250    } else if (name.equals("specimen")) {
2251      this.getSpecimen().add(castToReference(value));
2252    } else if (name.equals("result")) {
2253      this.getResult().add(castToReference(value));
2254    } else if (name.equals("imagingStudy")) {
2255      this.getImagingStudy().add(castToReference(value));
2256    } else if (name.equals("media")) {
2257      this.getMedia().add((DiagnosticReportMediaComponent) value);
2258    } else if (name.equals("conclusion")) {
2259      this.conclusion = castToString(value); // StringType
2260    } else if (name.equals("conclusionCode")) {
2261      this.getConclusionCode().add(castToCodeableConcept(value));
2262    } else if (name.equals("presentedForm")) {
2263      this.getPresentedForm().add(castToAttachment(value));
2264    } else
2265      return super.setProperty(name, value);
2266    return value;
2267  }
2268
2269  @Override
2270  public void removeChild(String name, Base value) throws FHIRException {
2271    if (name.equals("identifier")) {
2272      this.getIdentifier().remove(castToIdentifier(value));
2273    } else if (name.equals("basedOn")) {
2274      this.getBasedOn().remove(castToReference(value));
2275    } else if (name.equals("status")) {
2276      this.status = null;
2277    } else if (name.equals("category")) {
2278      this.getCategory().remove(castToCodeableConcept(value));
2279    } else if (name.equals("code")) {
2280      this.code = null;
2281    } else if (name.equals("subject")) {
2282      this.subject = null;
2283    } else if (name.equals("encounter")) {
2284      this.encounter = null;
2285    } else if (name.equals("effective[x]")) {
2286      this.effective = null;
2287    } else if (name.equals("issued")) {
2288      this.issued = null;
2289    } else if (name.equals("performer")) {
2290      this.getPerformer().remove(castToReference(value));
2291    } else if (name.equals("resultsInterpreter")) {
2292      this.getResultsInterpreter().remove(castToReference(value));
2293    } else if (name.equals("specimen")) {
2294      this.getSpecimen().remove(castToReference(value));
2295    } else if (name.equals("result")) {
2296      this.getResult().remove(castToReference(value));
2297    } else if (name.equals("imagingStudy")) {
2298      this.getImagingStudy().remove(castToReference(value));
2299    } else if (name.equals("media")) {
2300      this.getMedia().remove((DiagnosticReportMediaComponent) value);
2301    } else if (name.equals("conclusion")) {
2302      this.conclusion = null;
2303    } else if (name.equals("conclusionCode")) {
2304      this.getConclusionCode().remove(castToCodeableConcept(value));
2305    } else if (name.equals("presentedForm")) {
2306      this.getPresentedForm().remove(castToAttachment(value));
2307    } else
2308      super.removeChild(name, value);
2309    
2310  }
2311
2312  @Override
2313  public Base makeProperty(int hash, String name) throws FHIRException {
2314    switch (hash) {
2315    case -1618432855:
2316      return addIdentifier();
2317    case -332612366:
2318      return addBasedOn();
2319    case -892481550:
2320      return getStatusElement();
2321    case 50511102:
2322      return addCategory();
2323    case 3059181:
2324      return getCode();
2325    case -1867885268:
2326      return getSubject();
2327    case 1524132147:
2328      return getEncounter();
2329    case 247104889:
2330      return getEffective();
2331    case -1468651097:
2332      return getEffective();
2333    case -1179159893:
2334      return getIssuedElement();
2335    case 481140686:
2336      return addPerformer();
2337    case 2134944932:
2338      return addResultsInterpreter();
2339    case -2132868344:
2340      return addSpecimen();
2341    case -934426595:
2342      return addResult();
2343    case -814900911:
2344      return addImagingStudy();
2345    case 103772132:
2346      return addMedia();
2347    case -1731259873:
2348      return getConclusionElement();
2349    case -1731523412:
2350      return addConclusionCode();
2351    case 230090366:
2352      return addPresentedForm();
2353    default:
2354      return super.makeProperty(hash, name);
2355    }
2356
2357  }
2358
2359  @Override
2360  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2361    switch (hash) {
2362    case -1618432855:
2363      /* identifier */ return new String[] { "Identifier" };
2364    case -332612366:
2365      /* basedOn */ return new String[] { "Reference" };
2366    case -892481550:
2367      /* status */ return new String[] { "code" };
2368    case 50511102:
2369      /* category */ return new String[] { "CodeableConcept" };
2370    case 3059181:
2371      /* code */ return new String[] { "CodeableConcept" };
2372    case -1867885268:
2373      /* subject */ return new String[] { "Reference" };
2374    case 1524132147:
2375      /* encounter */ return new String[] { "Reference" };
2376    case -1468651097:
2377      /* effective */ return new String[] { "dateTime", "Period" };
2378    case -1179159893:
2379      /* issued */ return new String[] { "instant" };
2380    case 481140686:
2381      /* performer */ return new String[] { "Reference" };
2382    case 2134944932:
2383      /* resultsInterpreter */ return new String[] { "Reference" };
2384    case -2132868344:
2385      /* specimen */ return new String[] { "Reference" };
2386    case -934426595:
2387      /* result */ return new String[] { "Reference" };
2388    case -814900911:
2389      /* imagingStudy */ return new String[] { "Reference" };
2390    case 103772132:
2391      /* media */ return new String[] {};
2392    case -1731259873:
2393      /* conclusion */ return new String[] { "string" };
2394    case -1731523412:
2395      /* conclusionCode */ return new String[] { "CodeableConcept" };
2396    case 230090366:
2397      /* presentedForm */ return new String[] { "Attachment" };
2398    default:
2399      return super.getTypesForProperty(hash, name);
2400    }
2401
2402  }
2403
2404  @Override
2405  public Base addChild(String name) throws FHIRException {
2406    if (name.equals("identifier")) {
2407      return addIdentifier();
2408    } else if (name.equals("basedOn")) {
2409      return addBasedOn();
2410    } else if (name.equals("status")) {
2411      throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.status");
2412    } else if (name.equals("category")) {
2413      return addCategory();
2414    } else if (name.equals("code")) {
2415      this.code = new CodeableConcept();
2416      return this.code;
2417    } else if (name.equals("subject")) {
2418      this.subject = new Reference();
2419      return this.subject;
2420    } else if (name.equals("encounter")) {
2421      this.encounter = new Reference();
2422      return this.encounter;
2423    } else if (name.equals("effectiveDateTime")) {
2424      this.effective = new DateTimeType();
2425      return this.effective;
2426    } else if (name.equals("effectivePeriod")) {
2427      this.effective = new Period();
2428      return this.effective;
2429    } else if (name.equals("issued")) {
2430      throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.issued");
2431    } else if (name.equals("performer")) {
2432      return addPerformer();
2433    } else if (name.equals("resultsInterpreter")) {
2434      return addResultsInterpreter();
2435    } else if (name.equals("specimen")) {
2436      return addSpecimen();
2437    } else if (name.equals("result")) {
2438      return addResult();
2439    } else if (name.equals("imagingStudy")) {
2440      return addImagingStudy();
2441    } else if (name.equals("media")) {
2442      return addMedia();
2443    } else if (name.equals("conclusion")) {
2444      throw new FHIRException("Cannot call addChild on a singleton property DiagnosticReport.conclusion");
2445    } else if (name.equals("conclusionCode")) {
2446      return addConclusionCode();
2447    } else if (name.equals("presentedForm")) {
2448      return addPresentedForm();
2449    } else
2450      return super.addChild(name);
2451  }
2452
2453  public String fhirType() {
2454    return "DiagnosticReport";
2455
2456  }
2457
2458  public DiagnosticReport copy() {
2459    DiagnosticReport dst = new DiagnosticReport();
2460    copyValues(dst);
2461    return dst;
2462  }
2463
2464  public void copyValues(DiagnosticReport dst) {
2465    super.copyValues(dst);
2466    if (identifier != null) {
2467      dst.identifier = new ArrayList<Identifier>();
2468      for (Identifier i : identifier)
2469        dst.identifier.add(i.copy());
2470    }
2471    ;
2472    if (basedOn != null) {
2473      dst.basedOn = new ArrayList<Reference>();
2474      for (Reference i : basedOn)
2475        dst.basedOn.add(i.copy());
2476    }
2477    ;
2478    dst.status = status == null ? null : status.copy();
2479    if (category != null) {
2480      dst.category = new ArrayList<CodeableConcept>();
2481      for (CodeableConcept i : category)
2482        dst.category.add(i.copy());
2483    }
2484    ;
2485    dst.code = code == null ? null : code.copy();
2486    dst.subject = subject == null ? null : subject.copy();
2487    dst.encounter = encounter == null ? null : encounter.copy();
2488    dst.effective = effective == null ? null : effective.copy();
2489    dst.issued = issued == null ? null : issued.copy();
2490    if (performer != null) {
2491      dst.performer = new ArrayList<Reference>();
2492      for (Reference i : performer)
2493        dst.performer.add(i.copy());
2494    }
2495    ;
2496    if (resultsInterpreter != null) {
2497      dst.resultsInterpreter = new ArrayList<Reference>();
2498      for (Reference i : resultsInterpreter)
2499        dst.resultsInterpreter.add(i.copy());
2500    }
2501    ;
2502    if (specimen != null) {
2503      dst.specimen = new ArrayList<Reference>();
2504      for (Reference i : specimen)
2505        dst.specimen.add(i.copy());
2506    }
2507    ;
2508    if (result != null) {
2509      dst.result = new ArrayList<Reference>();
2510      for (Reference i : result)
2511        dst.result.add(i.copy());
2512    }
2513    ;
2514    if (imagingStudy != null) {
2515      dst.imagingStudy = new ArrayList<Reference>();
2516      for (Reference i : imagingStudy)
2517        dst.imagingStudy.add(i.copy());
2518    }
2519    ;
2520    if (media != null) {
2521      dst.media = new ArrayList<DiagnosticReportMediaComponent>();
2522      for (DiagnosticReportMediaComponent i : media)
2523        dst.media.add(i.copy());
2524    }
2525    ;
2526    dst.conclusion = conclusion == null ? null : conclusion.copy();
2527    if (conclusionCode != null) {
2528      dst.conclusionCode = new ArrayList<CodeableConcept>();
2529      for (CodeableConcept i : conclusionCode)
2530        dst.conclusionCode.add(i.copy());
2531    }
2532    ;
2533    if (presentedForm != null) {
2534      dst.presentedForm = new ArrayList<Attachment>();
2535      for (Attachment i : presentedForm)
2536        dst.presentedForm.add(i.copy());
2537    }
2538    ;
2539  }
2540
2541  protected DiagnosticReport typedCopy() {
2542    return copy();
2543  }
2544
2545  @Override
2546  public boolean equalsDeep(Base other_) {
2547    if (!super.equalsDeep(other_))
2548      return false;
2549    if (!(other_ instanceof DiagnosticReport))
2550      return false;
2551    DiagnosticReport o = (DiagnosticReport) other_;
2552    return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true)
2553        && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
2554        && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
2555        && compareDeep(encounter, o.encounter, true) && compareDeep(effective, o.effective, true)
2556        && compareDeep(issued, o.issued, true) && compareDeep(performer, o.performer, true)
2557        && compareDeep(resultsInterpreter, o.resultsInterpreter, true) && compareDeep(specimen, o.specimen, true)
2558        && compareDeep(result, o.result, true) && compareDeep(imagingStudy, o.imagingStudy, true)
2559        && compareDeep(media, o.media, true) && compareDeep(conclusion, o.conclusion, true)
2560        && compareDeep(conclusionCode, o.conclusionCode, true) && compareDeep(presentedForm, o.presentedForm, true);
2561  }
2562
2563  @Override
2564  public boolean equalsShallow(Base other_) {
2565    if (!super.equalsShallow(other_))
2566      return false;
2567    if (!(other_ instanceof DiagnosticReport))
2568      return false;
2569    DiagnosticReport o = (DiagnosticReport) other_;
2570    return compareValues(status, o.status, true) && compareValues(issued, o.issued, true)
2571        && compareValues(conclusion, o.conclusion, true);
2572  }
2573
2574  public boolean isEmpty() {
2575    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, status, category, code, subject,
2576        encounter, effective, issued, performer, resultsInterpreter, specimen, result, imagingStudy, media, conclusion,
2577        conclusionCode, presentedForm);
2578  }
2579
2580  @Override
2581  public ResourceType getResourceType() {
2582    return ResourceType.DiagnosticReport;
2583  }
2584
2585  /**
2586   * Search parameter: <b>date</b>
2587   * <p>
2588   * Description: <b>The clinically relevant time of the report</b><br>
2589   * Type: <b>date</b><br>
2590   * Path: <b>DiagnosticReport.effective[x]</b><br>
2591   * </p>
2592   */
2593  @SearchParamDefinition(name = "date", path = "DiagnosticReport.effective", description = "The clinically relevant time of the report", type = "date")
2594  public static final String SP_DATE = "date";
2595  /**
2596   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2597   * <p>
2598   * Description: <b>The clinically relevant time of the report</b><br>
2599   * Type: <b>date</b><br>
2600   * Path: <b>DiagnosticReport.effective[x]</b><br>
2601   * </p>
2602   */
2603  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2604      SP_DATE);
2605
2606  /**
2607   * Search parameter: <b>identifier</b>
2608   * <p>
2609   * Description: <b>An identifier for the report</b><br>
2610   * Type: <b>token</b><br>
2611   * Path: <b>DiagnosticReport.identifier</b><br>
2612   * </p>
2613   */
2614  @SearchParamDefinition(name = "identifier", path = "DiagnosticReport.identifier", description = "An identifier for the report", type = "token")
2615  public static final String SP_IDENTIFIER = "identifier";
2616  /**
2617   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2618   * <p>
2619   * Description: <b>An identifier for the report</b><br>
2620   * Type: <b>token</b><br>
2621   * Path: <b>DiagnosticReport.identifier</b><br>
2622   * </p>
2623   */
2624  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2625      SP_IDENTIFIER);
2626
2627  /**
2628   * Search parameter: <b>performer</b>
2629   * <p>
2630   * Description: <b>Who is responsible for the report</b><br>
2631   * Type: <b>reference</b><br>
2632   * Path: <b>DiagnosticReport.performer</b><br>
2633   * </p>
2634   */
2635  @SearchParamDefinition(name = "performer", path = "DiagnosticReport.performer", description = "Who is responsible for the report", type = "reference", providesMembershipIn = {
2636      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { CareTeam.class,
2637          Organization.class, Practitioner.class, PractitionerRole.class })
2638  public static final String SP_PERFORMER = "performer";
2639  /**
2640   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2641   * <p>
2642   * Description: <b>Who is responsible for the report</b><br>
2643   * Type: <b>reference</b><br>
2644   * Path: <b>DiagnosticReport.performer</b><br>
2645   * </p>
2646   */
2647  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2648      SP_PERFORMER);
2649
2650  /**
2651   * Constant for fluent queries to be used to add include statements. Specifies
2652   * the path value of "<b>DiagnosticReport:performer</b>".
2653   */
2654  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include(
2655      "DiagnosticReport:performer").toLocked();
2656
2657  /**
2658   * Search parameter: <b>code</b>
2659   * <p>
2660   * Description: <b>The code for the report, as opposed to codes for the atomic
2661   * results, which are the names on the observation resource referred to from the
2662   * result</b><br>
2663   * Type: <b>token</b><br>
2664   * Path: <b>DiagnosticReport.code</b><br>
2665   * </p>
2666   */
2667  @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")
2668  public static final String SP_CODE = "code";
2669  /**
2670   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2671   * <p>
2672   * Description: <b>The code for the report, as opposed to codes for the atomic
2673   * results, which are the names on the observation resource referred to from the
2674   * result</b><br>
2675   * Type: <b>token</b><br>
2676   * Path: <b>DiagnosticReport.code</b><br>
2677   * </p>
2678   */
2679  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2680      SP_CODE);
2681
2682  /**
2683   * Search parameter: <b>subject</b>
2684   * <p>
2685   * Description: <b>The subject of the report</b><br>
2686   * Type: <b>reference</b><br>
2687   * Path: <b>DiagnosticReport.subject</b><br>
2688   * </p>
2689   */
2690  @SearchParamDefinition(name = "subject", path = "DiagnosticReport.subject", description = "The subject of the report", type = "reference", providesMembershipIn = {
2691      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
2692      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Device.class, Group.class,
2693          Location.class, Patient.class })
2694  public static final String SP_SUBJECT = "subject";
2695  /**
2696   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2697   * <p>
2698   * Description: <b>The subject of the report</b><br>
2699   * Type: <b>reference</b><br>
2700   * Path: <b>DiagnosticReport.subject</b><br>
2701   * </p>
2702   */
2703  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2704      SP_SUBJECT);
2705
2706  /**
2707   * Constant for fluent queries to be used to add include statements. Specifies
2708   * the path value of "<b>DiagnosticReport:subject</b>".
2709   */
2710  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
2711      "DiagnosticReport:subject").toLocked();
2712
2713  /**
2714   * Search parameter: <b>media</b>
2715   * <p>
2716   * Description: <b>A reference to the image source.</b><br>
2717   * Type: <b>reference</b><br>
2718   * Path: <b>DiagnosticReport.media.link</b><br>
2719   * </p>
2720   */
2721  @SearchParamDefinition(name = "media", path = "DiagnosticReport.media.link", description = "A reference to the image source.", type = "reference", target = {
2722      Media.class })
2723  public static final String SP_MEDIA = "media";
2724  /**
2725   * <b>Fluent Client</b> search parameter constant for <b>media</b>
2726   * <p>
2727   * Description: <b>A reference to the image source.</b><br>
2728   * Type: <b>reference</b><br>
2729   * Path: <b>DiagnosticReport.media.link</b><br>
2730   * </p>
2731   */
2732  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDIA = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2733      SP_MEDIA);
2734
2735  /**
2736   * Constant for fluent queries to be used to add include statements. Specifies
2737   * the path value of "<b>DiagnosticReport:media</b>".
2738   */
2739  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDIA = new ca.uhn.fhir.model.api.Include(
2740      "DiagnosticReport:media").toLocked();
2741
2742  /**
2743   * Search parameter: <b>encounter</b>
2744   * <p>
2745   * Description: <b>The Encounter when the order was made</b><br>
2746   * Type: <b>reference</b><br>
2747   * Path: <b>DiagnosticReport.encounter</b><br>
2748   * </p>
2749   */
2750  @SearchParamDefinition(name = "encounter", path = "DiagnosticReport.encounter", description = "The Encounter when the order was made", type = "reference", providesMembershipIn = {
2751      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
2752  public static final String SP_ENCOUNTER = "encounter";
2753  /**
2754   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2755   * <p>
2756   * Description: <b>The Encounter when the order was made</b><br>
2757   * Type: <b>reference</b><br>
2758   * Path: <b>DiagnosticReport.encounter</b><br>
2759   * </p>
2760   */
2761  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2762      SP_ENCOUNTER);
2763
2764  /**
2765   * Constant for fluent queries to be used to add include statements. Specifies
2766   * the path value of "<b>DiagnosticReport:encounter</b>".
2767   */
2768  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
2769      "DiagnosticReport:encounter").toLocked();
2770
2771  /**
2772   * Search parameter: <b>result</b>
2773   * <p>
2774   * Description: <b>Link to an atomic result (observation resource)</b><br>
2775   * Type: <b>reference</b><br>
2776   * Path: <b>DiagnosticReport.result</b><br>
2777   * </p>
2778   */
2779  @SearchParamDefinition(name = "result", path = "DiagnosticReport.result", description = "Link to an atomic result (observation resource)", type = "reference", target = {
2780      Observation.class })
2781  public static final String SP_RESULT = "result";
2782  /**
2783   * <b>Fluent Client</b> search parameter constant for <b>result</b>
2784   * <p>
2785   * Description: <b>Link to an atomic result (observation resource)</b><br>
2786   * Type: <b>reference</b><br>
2787   * Path: <b>DiagnosticReport.result</b><br>
2788   * </p>
2789   */
2790  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2791      SP_RESULT);
2792
2793  /**
2794   * Constant for fluent queries to be used to add include statements. Specifies
2795   * the path value of "<b>DiagnosticReport:result</b>".
2796   */
2797  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULT = new ca.uhn.fhir.model.api.Include(
2798      "DiagnosticReport:result").toLocked();
2799
2800  /**
2801   * Search parameter: <b>conclusion</b>
2802   * <p>
2803   * Description: <b>A coded conclusion (interpretation/impression) on the
2804   * report</b><br>
2805   * Type: <b>token</b><br>
2806   * Path: <b>DiagnosticReport.conclusionCode</b><br>
2807   * </p>
2808   */
2809  @SearchParamDefinition(name = "conclusion", path = "DiagnosticReport.conclusionCode", description = "A coded conclusion (interpretation/impression) on the report", type = "token")
2810  public static final String SP_CONCLUSION = "conclusion";
2811  /**
2812   * <b>Fluent Client</b> search parameter constant for <b>conclusion</b>
2813   * <p>
2814   * Description: <b>A coded conclusion (interpretation/impression) on the
2815   * report</b><br>
2816   * Type: <b>token</b><br>
2817   * Path: <b>DiagnosticReport.conclusionCode</b><br>
2818   * </p>
2819   */
2820  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONCLUSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2821      SP_CONCLUSION);
2822
2823  /**
2824   * Search parameter: <b>based-on</b>
2825   * <p>
2826   * Description: <b>Reference to the service request.</b><br>
2827   * Type: <b>reference</b><br>
2828   * Path: <b>DiagnosticReport.basedOn</b><br>
2829   * </p>
2830   */
2831  @SearchParamDefinition(name = "based-on", path = "DiagnosticReport.basedOn", description = "Reference to the service request.", type = "reference", target = {
2832      CarePlan.class, ImmunizationRecommendation.class, MedicationRequest.class, NutritionOrder.class,
2833      ServiceRequest.class })
2834  public static final String SP_BASED_ON = "based-on";
2835  /**
2836   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2837   * <p>
2838   * Description: <b>Reference to the service request.</b><br>
2839   * Type: <b>reference</b><br>
2840   * Path: <b>DiagnosticReport.basedOn</b><br>
2841   * </p>
2842   */
2843  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2844      SP_BASED_ON);
2845
2846  /**
2847   * Constant for fluent queries to be used to add include statements. Specifies
2848   * the path value of "<b>DiagnosticReport:based-on</b>".
2849   */
2850  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include(
2851      "DiagnosticReport:based-on").toLocked();
2852
2853  /**
2854   * Search parameter: <b>patient</b>
2855   * <p>
2856   * Description: <b>The subject of the report if a patient</b><br>
2857   * Type: <b>reference</b><br>
2858   * Path: <b>DiagnosticReport.subject</b><br>
2859   * </p>
2860   */
2861  @SearchParamDefinition(name = "patient", path = "DiagnosticReport.subject.where(resolve() is Patient)", description = "The subject of the report if a patient", type = "reference", target = {
2862      Patient.class })
2863  public static final String SP_PATIENT = "patient";
2864  /**
2865   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2866   * <p>
2867   * Description: <b>The subject of the report if a patient</b><br>
2868   * Type: <b>reference</b><br>
2869   * Path: <b>DiagnosticReport.subject</b><br>
2870   * </p>
2871   */
2872  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2873      SP_PATIENT);
2874
2875  /**
2876   * Constant for fluent queries to be used to add include statements. Specifies
2877   * the path value of "<b>DiagnosticReport:patient</b>".
2878   */
2879  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2880      "DiagnosticReport:patient").toLocked();
2881
2882  /**
2883   * Search parameter: <b>specimen</b>
2884   * <p>
2885   * Description: <b>The specimen details</b><br>
2886   * Type: <b>reference</b><br>
2887   * Path: <b>DiagnosticReport.specimen</b><br>
2888   * </p>
2889   */
2890  @SearchParamDefinition(name = "specimen", path = "DiagnosticReport.specimen", description = "The specimen details", type = "reference", target = {
2891      Specimen.class })
2892  public static final String SP_SPECIMEN = "specimen";
2893  /**
2894   * <b>Fluent Client</b> search parameter constant for <b>specimen</b>
2895   * <p>
2896   * Description: <b>The specimen details</b><br>
2897   * Type: <b>reference</b><br>
2898   * Path: <b>DiagnosticReport.specimen</b><br>
2899   * </p>
2900   */
2901  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPECIMEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2902      SP_SPECIMEN);
2903
2904  /**
2905   * Constant for fluent queries to be used to add include statements. Specifies
2906   * the path value of "<b>DiagnosticReport:specimen</b>".
2907   */
2908  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPECIMEN = new ca.uhn.fhir.model.api.Include(
2909      "DiagnosticReport:specimen").toLocked();
2910
2911  /**
2912   * Search parameter: <b>issued</b>
2913   * <p>
2914   * Description: <b>When the report was issued</b><br>
2915   * Type: <b>date</b><br>
2916   * Path: <b>DiagnosticReport.issued</b><br>
2917   * </p>
2918   */
2919  @SearchParamDefinition(name = "issued", path = "DiagnosticReport.issued", description = "When the report was issued", type = "date")
2920  public static final String SP_ISSUED = "issued";
2921  /**
2922   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
2923   * <p>
2924   * Description: <b>When the report was issued</b><br>
2925   * Type: <b>date</b><br>
2926   * Path: <b>DiagnosticReport.issued</b><br>
2927   * </p>
2928   */
2929  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(
2930      SP_ISSUED);
2931
2932  /**
2933   * Search parameter: <b>category</b>
2934   * <p>
2935   * Description: <b>Which diagnostic discipline/department created the
2936   * report</b><br>
2937   * Type: <b>token</b><br>
2938   * Path: <b>DiagnosticReport.category</b><br>
2939   * </p>
2940   */
2941  @SearchParamDefinition(name = "category", path = "DiagnosticReport.category", description = "Which diagnostic discipline/department created the report", type = "token")
2942  public static final String SP_CATEGORY = "category";
2943  /**
2944   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2945   * <p>
2946   * Description: <b>Which diagnostic discipline/department created the
2947   * report</b><br>
2948   * Type: <b>token</b><br>
2949   * Path: <b>DiagnosticReport.category</b><br>
2950   * </p>
2951   */
2952  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2953      SP_CATEGORY);
2954
2955  /**
2956   * Search parameter: <b>results-interpreter</b>
2957   * <p>
2958   * Description: <b>Who was the source of the report</b><br>
2959   * Type: <b>reference</b><br>
2960   * Path: <b>DiagnosticReport.resultsInterpreter</b><br>
2961   * </p>
2962   */
2963  @SearchParamDefinition(name = "results-interpreter", path = "DiagnosticReport.resultsInterpreter", description = "Who was the source of the report", type = "reference", target = {
2964      CareTeam.class, Organization.class, Practitioner.class, PractitionerRole.class })
2965  public static final String SP_RESULTS_INTERPRETER = "results-interpreter";
2966  /**
2967   * <b>Fluent Client</b> search parameter constant for <b>results-interpreter</b>
2968   * <p>
2969   * Description: <b>Who was the source of the report</b><br>
2970   * Type: <b>reference</b><br>
2971   * Path: <b>DiagnosticReport.resultsInterpreter</b><br>
2972   * </p>
2973   */
2974  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULTS_INTERPRETER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2975      SP_RESULTS_INTERPRETER);
2976
2977  /**
2978   * Constant for fluent queries to be used to add include statements. Specifies
2979   * the path value of "<b>DiagnosticReport:results-interpreter</b>".
2980   */
2981  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULTS_INTERPRETER = new ca.uhn.fhir.model.api.Include(
2982      "DiagnosticReport:results-interpreter").toLocked();
2983
2984  /**
2985   * Search parameter: <b>status</b>
2986   * <p>
2987   * Description: <b>The status of the report</b><br>
2988   * Type: <b>token</b><br>
2989   * Path: <b>DiagnosticReport.status</b><br>
2990   * </p>
2991   */
2992  @SearchParamDefinition(name = "status", path = "DiagnosticReport.status", description = "The status of the report", type = "token")
2993  public static final String SP_STATUS = "status";
2994  /**
2995   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2996   * <p>
2997   * Description: <b>The status of the report</b><br>
2998   * Type: <b>token</b><br>
2999   * Path: <b>DiagnosticReport.status</b><br>
3000   * </p>
3001   */
3002  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3003      SP_STATUS);
3004
3005}