001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
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 * The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.
048 */
049@ResourceDef(name="DiagnosticReport", profile="http://hl7.org/fhir/Profile/DiagnosticReport")
050public class DiagnosticReport extends DomainResource {
051
052    public enum DiagnosticReportStatus {
053        /**
054         * The existence of the report is registered, but there is nothing yet available.
055         */
056        REGISTERED, 
057        /**
058         * This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified.
059         */
060        PARTIAL, 
061        /**
062         * The report is complete and verified by an authorized person.
063         */
064        FINAL, 
065        /**
066         * The report has been modified subsequent to being Final, and is complete and verified by an authorized person
067         */
068        CORRECTED, 
069        /**
070         * The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed.
071         */
072        APPENDED, 
073        /**
074         * The report is unavailable because the measurement was not started or not completed (also sometimes called "aborted").
075         */
076        CANCELLED, 
077        /**
078         * The report has been withdrawn following a previous final release.
079         */
080        ENTEREDINERROR, 
081        /**
082         * added to help the parsers
083         */
084        NULL;
085        public static DiagnosticReportStatus fromCode(String codeString) throws FHIRException {
086            if (codeString == null || "".equals(codeString))
087                return null;
088        if ("registered".equals(codeString))
089          return REGISTERED;
090        if ("partial".equals(codeString))
091          return PARTIAL;
092        if ("final".equals(codeString))
093          return FINAL;
094        if ("corrected".equals(codeString))
095          return CORRECTED;
096        if ("appended".equals(codeString))
097          return APPENDED;
098        if ("cancelled".equals(codeString))
099          return CANCELLED;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        throw new FHIRException("Unknown DiagnosticReportStatus code '"+codeString+"'");
103        }
104        public String toCode() {
105          switch (this) {
106            case REGISTERED: return "registered";
107            case PARTIAL: return "partial";
108            case FINAL: return "final";
109            case CORRECTED: return "corrected";
110            case APPENDED: return "appended";
111            case CANCELLED: return "cancelled";
112            case ENTEREDINERROR: return "entered-in-error";
113            default: return "?";
114          }
115        }
116        public String getSystem() {
117          switch (this) {
118            case REGISTERED: return "http://hl7.org/fhir/diagnostic-report-status";
119            case PARTIAL: return "http://hl7.org/fhir/diagnostic-report-status";
120            case FINAL: return "http://hl7.org/fhir/diagnostic-report-status";
121            case CORRECTED: return "http://hl7.org/fhir/diagnostic-report-status";
122            case APPENDED: return "http://hl7.org/fhir/diagnostic-report-status";
123            case CANCELLED: return "http://hl7.org/fhir/diagnostic-report-status";
124            case ENTEREDINERROR: return "http://hl7.org/fhir/diagnostic-report-status";
125            default: return "?";
126          }
127        }
128        public String getDefinition() {
129          switch (this) {
130            case REGISTERED: return "The existence of the report is registered, but there is nothing yet available.";
131            case PARTIAL: return "This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified.";
132            case FINAL: return "The report is complete and verified by an authorized person.";
133            case CORRECTED: return "The report has been modified subsequent to being Final, and is complete and verified by an authorized person";
134            case APPENDED: return "The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed.";
135            case CANCELLED: return "The report is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
136            case ENTEREDINERROR: return "The report has been withdrawn following a previous final release.";
137            default: return "?";
138          }
139        }
140        public String getDisplay() {
141          switch (this) {
142            case REGISTERED: return "Registered";
143            case PARTIAL: return "Partial";
144            case FINAL: return "Final";
145            case CORRECTED: return "Corrected";
146            case APPENDED: return "Appended";
147            case CANCELLED: return "Cancelled";
148            case ENTEREDINERROR: return "Entered in Error";
149            default: return "?";
150          }
151        }
152    }
153
154  public static class DiagnosticReportStatusEnumFactory implements EnumFactory<DiagnosticReportStatus> {
155    public DiagnosticReportStatus fromCode(String codeString) throws IllegalArgumentException {
156      if (codeString == null || "".equals(codeString))
157            if (codeString == null || "".equals(codeString))
158                return null;
159        if ("registered".equals(codeString))
160          return DiagnosticReportStatus.REGISTERED;
161        if ("partial".equals(codeString))
162          return DiagnosticReportStatus.PARTIAL;
163        if ("final".equals(codeString))
164          return DiagnosticReportStatus.FINAL;
165        if ("corrected".equals(codeString))
166          return DiagnosticReportStatus.CORRECTED;
167        if ("appended".equals(codeString))
168          return DiagnosticReportStatus.APPENDED;
169        if ("cancelled".equals(codeString))
170          return DiagnosticReportStatus.CANCELLED;
171        if ("entered-in-error".equals(codeString))
172          return DiagnosticReportStatus.ENTEREDINERROR;
173        throw new IllegalArgumentException("Unknown DiagnosticReportStatus code '"+codeString+"'");
174        }
175        public Enumeration<DiagnosticReportStatus> fromType(Base code) throws FHIRException {
176          if (code == null || code.isEmpty())
177            return null;
178          String codeString = ((PrimitiveType) code).asStringValue();
179          if (codeString == null || "".equals(codeString))
180            return null;
181        if ("registered".equals(codeString))
182          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.REGISTERED);
183        if ("partial".equals(codeString))
184          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.PARTIAL);
185        if ("final".equals(codeString))
186          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.FINAL);
187        if ("corrected".equals(codeString))
188          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.CORRECTED);
189        if ("appended".equals(codeString))
190          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.APPENDED);
191        if ("cancelled".equals(codeString))
192          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.CANCELLED);
193        if ("entered-in-error".equals(codeString))
194          return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.ENTEREDINERROR);
195        throw new FHIRException("Unknown DiagnosticReportStatus code '"+codeString+"'");
196        }
197    public String toCode(DiagnosticReportStatus code) {
198      if (code == DiagnosticReportStatus.REGISTERED)
199        return "registered";
200      if (code == DiagnosticReportStatus.PARTIAL)
201        return "partial";
202      if (code == DiagnosticReportStatus.FINAL)
203        return "final";
204      if (code == DiagnosticReportStatus.CORRECTED)
205        return "corrected";
206      if (code == DiagnosticReportStatus.APPENDED)
207        return "appended";
208      if (code == DiagnosticReportStatus.CANCELLED)
209        return "cancelled";
210      if (code == DiagnosticReportStatus.ENTEREDINERROR)
211        return "entered-in-error";
212      return "?";
213      }
214    public String toSystem(DiagnosticReportStatus code) {
215      return code.getSystem();
216      }
217    }
218
219    @Block()
220    public static class DiagnosticReportImageComponent extends BackboneElement implements IBaseBackboneElement {
221        /**
222         * 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.
223         */
224        @Child(name = "comment", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
225        @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." )
226        protected StringType comment;
227
228        /**
229         * Reference to the image source.
230         */
231        @Child(name = "link", type = {Media.class}, order=2, min=1, max=1, modifier=false, summary=true)
232        @Description(shortDefinition="Reference to the image source", formalDefinition="Reference to the image source." )
233        protected Reference link;
234
235        /**
236         * The actual object that is the target of the reference (Reference to the image source.)
237         */
238        protected Media linkTarget;
239
240        private static final long serialVersionUID = 935791940L;
241
242    /**
243     * Constructor
244     */
245      public DiagnosticReportImageComponent() {
246        super();
247      }
248
249    /**
250     * Constructor
251     */
252      public DiagnosticReportImageComponent(Reference link) {
253        super();
254        this.link = link;
255      }
256
257        /**
258         * @return {@link #comment} (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.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
259         */
260        public StringType getCommentElement() { 
261          if (this.comment == null)
262            if (Configuration.errorOnAutoCreate())
263              throw new Error("Attempt to auto-create DiagnosticReportImageComponent.comment");
264            else if (Configuration.doAutoCreate())
265              this.comment = new StringType(); // bb
266          return this.comment;
267        }
268
269        public boolean hasCommentElement() { 
270          return this.comment != null && !this.comment.isEmpty();
271        }
272
273        public boolean hasComment() { 
274          return this.comment != null && !this.comment.isEmpty();
275        }
276
277        /**
278         * @param value {@link #comment} (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.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
279         */
280        public DiagnosticReportImageComponent setCommentElement(StringType value) { 
281          this.comment = value;
282          return this;
283        }
284
285        /**
286         * @return 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.
287         */
288        public String getComment() { 
289          return this.comment == null ? null : this.comment.getValue();
290        }
291
292        /**
293         * @param value 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.
294         */
295        public DiagnosticReportImageComponent setComment(String value) { 
296          if (Utilities.noString(value))
297            this.comment = null;
298          else {
299            if (this.comment == null)
300              this.comment = new StringType();
301            this.comment.setValue(value);
302          }
303          return this;
304        }
305
306        /**
307         * @return {@link #link} (Reference to the image source.)
308         */
309        public Reference getLink() { 
310          if (this.link == null)
311            if (Configuration.errorOnAutoCreate())
312              throw new Error("Attempt to auto-create DiagnosticReportImageComponent.link");
313            else if (Configuration.doAutoCreate())
314              this.link = new Reference(); // cc
315          return this.link;
316        }
317
318        public boolean hasLink() { 
319          return this.link != null && !this.link.isEmpty();
320        }
321
322        /**
323         * @param value {@link #link} (Reference to the image source.)
324         */
325        public DiagnosticReportImageComponent setLink(Reference value) { 
326          this.link = value;
327          return this;
328        }
329
330        /**
331         * @return {@link #link} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the image source.)
332         */
333        public Media getLinkTarget() { 
334          if (this.linkTarget == null)
335            if (Configuration.errorOnAutoCreate())
336              throw new Error("Attempt to auto-create DiagnosticReportImageComponent.link");
337            else if (Configuration.doAutoCreate())
338              this.linkTarget = new Media(); // aa
339          return this.linkTarget;
340        }
341
342        /**
343         * @param value {@link #link} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the image source.)
344         */
345        public DiagnosticReportImageComponent setLinkTarget(Media value) { 
346          this.linkTarget = value;
347          return this;
348        }
349
350        protected void listChildren(List<Property> childrenList) {
351          super.listChildren(childrenList);
352          childrenList.add(new Property("comment", "string", "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.", 0, java.lang.Integer.MAX_VALUE, comment));
353          childrenList.add(new Property("link", "Reference(Media)", "Reference to the image source.", 0, java.lang.Integer.MAX_VALUE, link));
354        }
355
356      @Override
357      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
358        switch (hash) {
359        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
360        case 3321850: /*link*/ return this.link == null ? new Base[0] : new Base[] {this.link}; // Reference
361        default: return super.getProperty(hash, name, checkValid);
362        }
363
364      }
365
366      @Override
367      public void setProperty(int hash, String name, Base value) throws FHIRException {
368        switch (hash) {
369        case 950398559: // comment
370          this.comment = castToString(value); // StringType
371          break;
372        case 3321850: // link
373          this.link = castToReference(value); // Reference
374          break;
375        default: super.setProperty(hash, name, value);
376        }
377
378      }
379
380      @Override
381      public void setProperty(String name, Base value) throws FHIRException {
382        if (name.equals("comment"))
383          this.comment = castToString(value); // StringType
384        else if (name.equals("link"))
385          this.link = castToReference(value); // Reference
386        else
387          super.setProperty(name, value);
388      }
389
390      @Override
391      public Base makeProperty(int hash, String name) throws FHIRException {
392        switch (hash) {
393        case 950398559: throw new FHIRException("Cannot make property comment as it is not a complex type"); // StringType
394        case 3321850:  return getLink(); // Reference
395        default: return super.makeProperty(hash, name);
396        }
397
398      }
399
400      @Override
401      public Base addChild(String name) throws FHIRException {
402        if (name.equals("comment")) {
403          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.comment");
404        }
405        else if (name.equals("link")) {
406          this.link = new Reference();
407          return this.link;
408        }
409        else
410          return super.addChild(name);
411      }
412
413      public DiagnosticReportImageComponent copy() {
414        DiagnosticReportImageComponent dst = new DiagnosticReportImageComponent();
415        copyValues(dst);
416        dst.comment = comment == null ? null : comment.copy();
417        dst.link = link == null ? null : link.copy();
418        return dst;
419      }
420
421      @Override
422      public boolean equalsDeep(Base other) {
423        if (!super.equalsDeep(other))
424          return false;
425        if (!(other instanceof DiagnosticReportImageComponent))
426          return false;
427        DiagnosticReportImageComponent o = (DiagnosticReportImageComponent) other;
428        return compareDeep(comment, o.comment, true) && compareDeep(link, o.link, true);
429      }
430
431      @Override
432      public boolean equalsShallow(Base other) {
433        if (!super.equalsShallow(other))
434          return false;
435        if (!(other instanceof DiagnosticReportImageComponent))
436          return false;
437        DiagnosticReportImageComponent o = (DiagnosticReportImageComponent) other;
438        return compareValues(comment, o.comment, true);
439      }
440
441      public boolean isEmpty() {
442        return super.isEmpty() && (comment == null || comment.isEmpty()) && (link == null || link.isEmpty())
443          ;
444      }
445
446  public String fhirType() {
447    return "DiagnosticReport.image";
448
449  }
450
451  }
452
453    /**
454     * The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.
455     */
456    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
457    @Description(shortDefinition="Id for external references to this report", formalDefinition="The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider." )
458    protected List<Identifier> identifier;
459
460    /**
461     * The status of the diagnostic report as a whole.
462     */
463    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
464    @Description(shortDefinition="registered | partial | final | corrected | appended | cancelled | entered-in-error", formalDefinition="The status of the diagnostic report as a whole." )
465    protected Enumeration<DiagnosticReportStatus> status;
466
467    /**
468     * 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.
469     */
470    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
471    @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." )
472    protected CodeableConcept category;
473
474    /**
475     * A code or name that describes this diagnostic report.
476     */
477    @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true)
478    @Description(shortDefinition="Name/Code for this diagnostic report", formalDefinition="A code or name that describes this diagnostic report." )
479    protected CodeableConcept code;
480
481    /**
482     * 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.
483     */
484    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Location.class}, order=4, min=1, max=1, modifier=false, summary=true)
485    @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." )
486    protected Reference subject;
487
488    /**
489     * The actual object that is the target of the reference (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.)
490     */
491    protected Resource subjectTarget;
492
493    /**
494     * The link to the health care event (encounter) when the order was made.
495     */
496    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
497    @Description(shortDefinition="Health care event when test ordered", formalDefinition="The link to the health care event (encounter) when the order was made." )
498    protected Reference encounter;
499
500    /**
501     * The actual object that is the target of the reference (The link to the health care event (encounter) when the order was made.)
502     */
503    protected Encounter encounterTarget;
504
505    /**
506     * 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.
507     */
508    @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=6, min=1, max=1, modifier=false, summary=true)
509    @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." )
510    protected Type effective;
511
512    /**
513     * The date and time that this version of the report was released from the source diagnostic service.
514     */
515    @Child(name = "issued", type = {InstantType.class}, order=7, min=1, max=1, modifier=false, summary=true)
516    @Description(shortDefinition="DateTime this version was released", formalDefinition="The date and time that this version of the report was released from the source diagnostic service." )
517    protected InstantType issued;
518
519    /**
520     * The diagnostic service that is responsible for issuing the report.
521     */
522    @Child(name = "performer", type = {Practitioner.class, Organization.class}, order=8, min=1, max=1, modifier=false, summary=true)
523    @Description(shortDefinition="Responsible Diagnostic Service", formalDefinition="The diagnostic service that is responsible for issuing the report." )
524    protected Reference performer;
525
526    /**
527     * The actual object that is the target of the reference (The diagnostic service that is responsible for issuing the report.)
528     */
529    protected Resource performerTarget;
530
531    /**
532     * Details concerning a test or procedure requested.
533     */
534    @Child(name = "request", type = {DiagnosticOrder.class, ProcedureRequest.class, ReferralRequest.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
535    @Description(shortDefinition="What was requested", formalDefinition="Details concerning a test or procedure requested." )
536    protected List<Reference> request;
537    /**
538     * The actual objects that are the target of the reference (Details concerning a test or procedure requested.)
539     */
540    protected List<Resource> requestTarget;
541
542
543    /**
544     * Details about the specimens on which this diagnostic report is based.
545     */
546    @Child(name = "specimen", type = {Specimen.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
547    @Description(shortDefinition="Specimens this report is based on", formalDefinition="Details about the specimens on which this diagnostic report is based." )
548    protected List<Reference> specimen;
549    /**
550     * The actual objects that are the target of the reference (Details about the specimens on which this diagnostic report is based.)
551     */
552    protected List<Specimen> specimenTarget;
553
554
555    /**
556     * Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").
557     */
558    @Child(name = "result", type = {Observation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
559    @Description(shortDefinition="Observations - simple, or complex nested groups", formalDefinition="Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. \"atomic\" results), or they can be grouping observations that include references to other members of the group (e.g. \"panels\")." )
560    protected List<Reference> result;
561    /**
562     * The actual objects that are the target of the reference (Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").)
563     */
564    protected List<Observation> resultTarget;
565
566
567    /**
568     * 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.
569     */
570    @Child(name = "imagingStudy", type = {ImagingStudy.class, ImagingObjectSelection.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
571    @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." )
572    protected List<Reference> imagingStudy;
573    /**
574     * The actual objects that are the target of the reference (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.)
575     */
576    protected List<Resource> imagingStudyTarget;
577
578
579    /**
580     * 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).
581     */
582    @Child(name = "image", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
583    @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)." )
584    protected List<DiagnosticReportImageComponent> image;
585
586    /**
587     * Concise and clinically contextualized narrative interpretation of the diagnostic report.
588     */
589    @Child(name = "conclusion", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
590    @Description(shortDefinition="Clinical Interpretation of test results", formalDefinition="Concise and clinically contextualized narrative interpretation of the diagnostic report." )
591    protected StringType conclusion;
592
593    /**
594     * Codes for the conclusion.
595     */
596    @Child(name = "codedDiagnosis", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
597    @Description(shortDefinition="Codes for the conclusion", formalDefinition="Codes for the conclusion." )
598    protected List<CodeableConcept> codedDiagnosis;
599
600    /**
601     * Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.
602     */
603    @Child(name = "presentedForm", type = {Attachment.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
604    @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." )
605    protected List<Attachment> presentedForm;
606
607    private static final long serialVersionUID = 920334551L;
608
609  /**
610   * Constructor
611   */
612    public DiagnosticReport() {
613      super();
614    }
615
616  /**
617   * Constructor
618   */
619    public DiagnosticReport(Enumeration<DiagnosticReportStatus> status, CodeableConcept code, Reference subject, Type effective, InstantType issued, Reference performer) {
620      super();
621      this.status = status;
622      this.code = code;
623      this.subject = subject;
624      this.effective = effective;
625      this.issued = issued;
626      this.performer = performer;
627    }
628
629    /**
630     * @return {@link #identifier} (The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.)
631     */
632    public List<Identifier> getIdentifier() { 
633      if (this.identifier == null)
634        this.identifier = new ArrayList<Identifier>();
635      return this.identifier;
636    }
637
638    public boolean hasIdentifier() { 
639      if (this.identifier == null)
640        return false;
641      for (Identifier item : this.identifier)
642        if (!item.isEmpty())
643          return true;
644      return false;
645    }
646
647    /**
648     * @return {@link #identifier} (The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.)
649     */
650    // syntactic sugar
651    public Identifier addIdentifier() { //3
652      Identifier t = new Identifier();
653      if (this.identifier == null)
654        this.identifier = new ArrayList<Identifier>();
655      this.identifier.add(t);
656      return t;
657    }
658
659    // syntactic sugar
660    public DiagnosticReport addIdentifier(Identifier t) { //3
661      if (t == null)
662        return this;
663      if (this.identifier == null)
664        this.identifier = new ArrayList<Identifier>();
665      this.identifier.add(t);
666      return this;
667    }
668
669    /**
670     * @return {@link #status} (The status of the diagnostic report as a whole.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
671     */
672    public Enumeration<DiagnosticReportStatus> getStatusElement() { 
673      if (this.status == null)
674        if (Configuration.errorOnAutoCreate())
675          throw new Error("Attempt to auto-create DiagnosticReport.status");
676        else if (Configuration.doAutoCreate())
677          this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory()); // bb
678      return this.status;
679    }
680
681    public boolean hasStatusElement() { 
682      return this.status != null && !this.status.isEmpty();
683    }
684
685    public boolean hasStatus() { 
686      return this.status != null && !this.status.isEmpty();
687    }
688
689    /**
690     * @param value {@link #status} (The status of the diagnostic report as a whole.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
691     */
692    public DiagnosticReport setStatusElement(Enumeration<DiagnosticReportStatus> value) { 
693      this.status = value;
694      return this;
695    }
696
697    /**
698     * @return The status of the diagnostic report as a whole.
699     */
700    public DiagnosticReportStatus getStatus() { 
701      return this.status == null ? null : this.status.getValue();
702    }
703
704    /**
705     * @param value The status of the diagnostic report as a whole.
706     */
707    public DiagnosticReport setStatus(DiagnosticReportStatus value) { 
708        if (this.status == null)
709          this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory());
710        this.status.setValue(value);
711      return this;
712    }
713
714    /**
715     * @return {@link #category} (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.)
716     */
717    public CodeableConcept getCategory() { 
718      if (this.category == null)
719        if (Configuration.errorOnAutoCreate())
720          throw new Error("Attempt to auto-create DiagnosticReport.category");
721        else if (Configuration.doAutoCreate())
722          this.category = new CodeableConcept(); // cc
723      return this.category;
724    }
725
726    public boolean hasCategory() { 
727      return this.category != null && !this.category.isEmpty();
728    }
729
730    /**
731     * @param value {@link #category} (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.)
732     */
733    public DiagnosticReport setCategory(CodeableConcept value) { 
734      this.category = value;
735      return this;
736    }
737
738    /**
739     * @return {@link #code} (A code or name that describes this diagnostic report.)
740     */
741    public CodeableConcept getCode() { 
742      if (this.code == null)
743        if (Configuration.errorOnAutoCreate())
744          throw new Error("Attempt to auto-create DiagnosticReport.code");
745        else if (Configuration.doAutoCreate())
746          this.code = new CodeableConcept(); // cc
747      return this.code;
748    }
749
750    public boolean hasCode() { 
751      return this.code != null && !this.code.isEmpty();
752    }
753
754    /**
755     * @param value {@link #code} (A code or name that describes this diagnostic report.)
756     */
757    public DiagnosticReport setCode(CodeableConcept value) { 
758      this.code = value;
759      return this;
760    }
761
762    /**
763     * @return {@link #subject} (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.)
764     */
765    public Reference getSubject() { 
766      if (this.subject == null)
767        if (Configuration.errorOnAutoCreate())
768          throw new Error("Attempt to auto-create DiagnosticReport.subject");
769        else if (Configuration.doAutoCreate())
770          this.subject = new Reference(); // cc
771      return this.subject;
772    }
773
774    public boolean hasSubject() { 
775      return this.subject != null && !this.subject.isEmpty();
776    }
777
778    /**
779     * @param value {@link #subject} (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.)
780     */
781    public DiagnosticReport setSubject(Reference value) { 
782      this.subject = value;
783      return this;
784    }
785
786    /**
787     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The 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.)
788     */
789    public Resource getSubjectTarget() { 
790      return this.subjectTarget;
791    }
792
793    /**
794     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The 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.)
795     */
796    public DiagnosticReport setSubjectTarget(Resource value) { 
797      this.subjectTarget = value;
798      return this;
799    }
800
801    /**
802     * @return {@link #encounter} (The link to the health care event (encounter) when the order was made.)
803     */
804    public Reference getEncounter() { 
805      if (this.encounter == null)
806        if (Configuration.errorOnAutoCreate())
807          throw new Error("Attempt to auto-create DiagnosticReport.encounter");
808        else if (Configuration.doAutoCreate())
809          this.encounter = new Reference(); // cc
810      return this.encounter;
811    }
812
813    public boolean hasEncounter() { 
814      return this.encounter != null && !this.encounter.isEmpty();
815    }
816
817    /**
818     * @param value {@link #encounter} (The link to the health care event (encounter) when the order was made.)
819     */
820    public DiagnosticReport setEncounter(Reference value) { 
821      this.encounter = value;
822      return this;
823    }
824
825    /**
826     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The link to the health care event (encounter) when the order was made.)
827     */
828    public Encounter getEncounterTarget() { 
829      if (this.encounterTarget == null)
830        if (Configuration.errorOnAutoCreate())
831          throw new Error("Attempt to auto-create DiagnosticReport.encounter");
832        else if (Configuration.doAutoCreate())
833          this.encounterTarget = new Encounter(); // aa
834      return this.encounterTarget;
835    }
836
837    /**
838     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The link to the health care event (encounter) when the order was made.)
839     */
840    public DiagnosticReport setEncounterTarget(Encounter value) { 
841      this.encounterTarget = value;
842      return this;
843    }
844
845    /**
846     * @return {@link #effective} (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.)
847     */
848    public Type getEffective() { 
849      return this.effective;
850    }
851
852    /**
853     * @return {@link #effective} (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.)
854     */
855    public DateTimeType getEffectiveDateTimeType() throws FHIRException { 
856      if (!(this.effective instanceof DateTimeType))
857        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered");
858      return (DateTimeType) this.effective;
859    }
860
861    public boolean hasEffectiveDateTimeType() { 
862      return this.effective instanceof DateTimeType;
863    }
864
865    /**
866     * @return {@link #effective} (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.)
867     */
868    public Period getEffectivePeriod() throws FHIRException { 
869      if (!(this.effective instanceof Period))
870        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered");
871      return (Period) this.effective;
872    }
873
874    public boolean hasEffectivePeriod() { 
875      return this.effective instanceof Period;
876    }
877
878    public boolean hasEffective() { 
879      return this.effective != null && !this.effective.isEmpty();
880    }
881
882    /**
883     * @param value {@link #effective} (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.)
884     */
885    public DiagnosticReport setEffective(Type value) { 
886      this.effective = value;
887      return this;
888    }
889
890    /**
891     * @return {@link #issued} (The date and time that this version of the report was released from the source diagnostic service.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
892     */
893    public InstantType getIssuedElement() { 
894      if (this.issued == null)
895        if (Configuration.errorOnAutoCreate())
896          throw new Error("Attempt to auto-create DiagnosticReport.issued");
897        else if (Configuration.doAutoCreate())
898          this.issued = new InstantType(); // bb
899      return this.issued;
900    }
901
902    public boolean hasIssuedElement() { 
903      return this.issued != null && !this.issued.isEmpty();
904    }
905
906    public boolean hasIssued() { 
907      return this.issued != null && !this.issued.isEmpty();
908    }
909
910    /**
911     * @param value {@link #issued} (The date and time that this version of the report was released from the source diagnostic service.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
912     */
913    public DiagnosticReport setIssuedElement(InstantType value) { 
914      this.issued = value;
915      return this;
916    }
917
918    /**
919     * @return The date and time that this version of the report was released from the source diagnostic service.
920     */
921    public Date getIssued() { 
922      return this.issued == null ? null : this.issued.getValue();
923    }
924
925    /**
926     * @param value The date and time that this version of the report was released from the source diagnostic service.
927     */
928    public DiagnosticReport setIssued(Date value) { 
929        if (this.issued == null)
930          this.issued = new InstantType();
931        this.issued.setValue(value);
932      return this;
933    }
934
935    /**
936     * @return {@link #performer} (The diagnostic service that is responsible for issuing the report.)
937     */
938    public Reference getPerformer() { 
939      if (this.performer == null)
940        if (Configuration.errorOnAutoCreate())
941          throw new Error("Attempt to auto-create DiagnosticReport.performer");
942        else if (Configuration.doAutoCreate())
943          this.performer = new Reference(); // cc
944      return this.performer;
945    }
946
947    public boolean hasPerformer() { 
948      return this.performer != null && !this.performer.isEmpty();
949    }
950
951    /**
952     * @param value {@link #performer} (The diagnostic service that is responsible for issuing the report.)
953     */
954    public DiagnosticReport setPerformer(Reference value) { 
955      this.performer = value;
956      return this;
957    }
958
959    /**
960     * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The diagnostic service that is responsible for issuing the report.)
961     */
962    public Resource getPerformerTarget() { 
963      return this.performerTarget;
964    }
965
966    /**
967     * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The diagnostic service that is responsible for issuing the report.)
968     */
969    public DiagnosticReport setPerformerTarget(Resource value) { 
970      this.performerTarget = value;
971      return this;
972    }
973
974    /**
975     * @return {@link #request} (Details concerning a test or procedure requested.)
976     */
977    public List<Reference> getRequest() { 
978      if (this.request == null)
979        this.request = new ArrayList<Reference>();
980      return this.request;
981    }
982
983    public boolean hasRequest() { 
984      if (this.request == null)
985        return false;
986      for (Reference item : this.request)
987        if (!item.isEmpty())
988          return true;
989      return false;
990    }
991
992    /**
993     * @return {@link #request} (Details concerning a test or procedure requested.)
994     */
995    // syntactic sugar
996    public Reference addRequest() { //3
997      Reference t = new Reference();
998      if (this.request == null)
999        this.request = new ArrayList<Reference>();
1000      this.request.add(t);
1001      return t;
1002    }
1003
1004    // syntactic sugar
1005    public DiagnosticReport addRequest(Reference t) { //3
1006      if (t == null)
1007        return this;
1008      if (this.request == null)
1009        this.request = new ArrayList<Reference>();
1010      this.request.add(t);
1011      return this;
1012    }
1013
1014    /**
1015     * @return {@link #request} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Details concerning a test or procedure requested.)
1016     */
1017    public List<Resource> getRequestTarget() { 
1018      if (this.requestTarget == null)
1019        this.requestTarget = new ArrayList<Resource>();
1020      return this.requestTarget;
1021    }
1022
1023    /**
1024     * @return {@link #specimen} (Details about the specimens on which this diagnostic report is based.)
1025     */
1026    public List<Reference> getSpecimen() { 
1027      if (this.specimen == null)
1028        this.specimen = new ArrayList<Reference>();
1029      return this.specimen;
1030    }
1031
1032    public boolean hasSpecimen() { 
1033      if (this.specimen == null)
1034        return false;
1035      for (Reference item : this.specimen)
1036        if (!item.isEmpty())
1037          return true;
1038      return false;
1039    }
1040
1041    /**
1042     * @return {@link #specimen} (Details about the specimens on which this diagnostic report is based.)
1043     */
1044    // syntactic sugar
1045    public Reference addSpecimen() { //3
1046      Reference t = new Reference();
1047      if (this.specimen == null)
1048        this.specimen = new ArrayList<Reference>();
1049      this.specimen.add(t);
1050      return t;
1051    }
1052
1053    // syntactic sugar
1054    public DiagnosticReport addSpecimen(Reference t) { //3
1055      if (t == null)
1056        return this;
1057      if (this.specimen == null)
1058        this.specimen = new ArrayList<Reference>();
1059      this.specimen.add(t);
1060      return this;
1061    }
1062
1063    /**
1064     * @return {@link #specimen} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Details about the specimens on which this diagnostic report is based.)
1065     */
1066    public List<Specimen> getSpecimenTarget() { 
1067      if (this.specimenTarget == null)
1068        this.specimenTarget = new ArrayList<Specimen>();
1069      return this.specimenTarget;
1070    }
1071
1072    // syntactic sugar
1073    /**
1074     * @return {@link #specimen} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Details about the specimens on which this diagnostic report is based.)
1075     */
1076    public Specimen addSpecimenTarget() { 
1077      Specimen r = new Specimen();
1078      if (this.specimenTarget == null)
1079        this.specimenTarget = new ArrayList<Specimen>();
1080      this.specimenTarget.add(r);
1081      return r;
1082    }
1083
1084    /**
1085     * @return {@link #result} (Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").)
1086     */
1087    public List<Reference> getResult() { 
1088      if (this.result == null)
1089        this.result = new ArrayList<Reference>();
1090      return this.result;
1091    }
1092
1093    public boolean hasResult() { 
1094      if (this.result == null)
1095        return false;
1096      for (Reference item : this.result)
1097        if (!item.isEmpty())
1098          return true;
1099      return false;
1100    }
1101
1102    /**
1103     * @return {@link #result} (Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").)
1104     */
1105    // syntactic sugar
1106    public Reference addResult() { //3
1107      Reference t = new Reference();
1108      if (this.result == null)
1109        this.result = new ArrayList<Reference>();
1110      this.result.add(t);
1111      return t;
1112    }
1113
1114    // syntactic sugar
1115    public DiagnosticReport addResult(Reference t) { //3
1116      if (t == null)
1117        return this;
1118      if (this.result == null)
1119        this.result = new ArrayList<Reference>();
1120      this.result.add(t);
1121      return this;
1122    }
1123
1124    /**
1125     * @return {@link #result} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").)
1126     */
1127    public List<Observation> getResultTarget() { 
1128      if (this.resultTarget == null)
1129        this.resultTarget = new ArrayList<Observation>();
1130      return this.resultTarget;
1131    }
1132
1133    // syntactic sugar
1134    /**
1135     * @return {@link #result} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").)
1136     */
1137    public Observation addResultTarget() { 
1138      Observation r = new Observation();
1139      if (this.resultTarget == null)
1140        this.resultTarget = new ArrayList<Observation>();
1141      this.resultTarget.add(r);
1142      return r;
1143    }
1144
1145    /**
1146     * @return {@link #imagingStudy} (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.)
1147     */
1148    public List<Reference> getImagingStudy() { 
1149      if (this.imagingStudy == null)
1150        this.imagingStudy = new ArrayList<Reference>();
1151      return this.imagingStudy;
1152    }
1153
1154    public boolean hasImagingStudy() { 
1155      if (this.imagingStudy == null)
1156        return false;
1157      for (Reference item : this.imagingStudy)
1158        if (!item.isEmpty())
1159          return true;
1160      return false;
1161    }
1162
1163    /**
1164     * @return {@link #imagingStudy} (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.)
1165     */
1166    // syntactic sugar
1167    public Reference addImagingStudy() { //3
1168      Reference t = new Reference();
1169      if (this.imagingStudy == null)
1170        this.imagingStudy = new ArrayList<Reference>();
1171      this.imagingStudy.add(t);
1172      return t;
1173    }
1174
1175    // syntactic sugar
1176    public DiagnosticReport addImagingStudy(Reference t) { //3
1177      if (t == null)
1178        return this;
1179      if (this.imagingStudy == null)
1180        this.imagingStudy = new ArrayList<Reference>();
1181      this.imagingStudy.add(t);
1182      return this;
1183    }
1184
1185    /**
1186     * @return {@link #imagingStudy} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. One or more 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.)
1187     */
1188    public List<Resource> getImagingStudyTarget() { 
1189      if (this.imagingStudyTarget == null)
1190        this.imagingStudyTarget = new ArrayList<Resource>();
1191      return this.imagingStudyTarget;
1192    }
1193
1194    /**
1195     * @return {@link #image} (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).)
1196     */
1197    public List<DiagnosticReportImageComponent> getImage() { 
1198      if (this.image == null)
1199        this.image = new ArrayList<DiagnosticReportImageComponent>();
1200      return this.image;
1201    }
1202
1203    public boolean hasImage() { 
1204      if (this.image == null)
1205        return false;
1206      for (DiagnosticReportImageComponent item : this.image)
1207        if (!item.isEmpty())
1208          return true;
1209      return false;
1210    }
1211
1212    /**
1213     * @return {@link #image} (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).)
1214     */
1215    // syntactic sugar
1216    public DiagnosticReportImageComponent addImage() { //3
1217      DiagnosticReportImageComponent t = new DiagnosticReportImageComponent();
1218      if (this.image == null)
1219        this.image = new ArrayList<DiagnosticReportImageComponent>();
1220      this.image.add(t);
1221      return t;
1222    }
1223
1224    // syntactic sugar
1225    public DiagnosticReport addImage(DiagnosticReportImageComponent t) { //3
1226      if (t == null)
1227        return this;
1228      if (this.image == null)
1229        this.image = new ArrayList<DiagnosticReportImageComponent>();
1230      this.image.add(t);
1231      return this;
1232    }
1233
1234    /**
1235     * @return {@link #conclusion} (Concise and clinically contextualized narrative interpretation of the diagnostic report.). This is the underlying object with id, value and extensions. The accessor "getConclusion" gives direct access to the value
1236     */
1237    public StringType getConclusionElement() { 
1238      if (this.conclusion == null)
1239        if (Configuration.errorOnAutoCreate())
1240          throw new Error("Attempt to auto-create DiagnosticReport.conclusion");
1241        else if (Configuration.doAutoCreate())
1242          this.conclusion = new StringType(); // bb
1243      return this.conclusion;
1244    }
1245
1246    public boolean hasConclusionElement() { 
1247      return this.conclusion != null && !this.conclusion.isEmpty();
1248    }
1249
1250    public boolean hasConclusion() { 
1251      return this.conclusion != null && !this.conclusion.isEmpty();
1252    }
1253
1254    /**
1255     * @param value {@link #conclusion} (Concise and clinically contextualized narrative interpretation of the diagnostic report.). This is the underlying object with id, value and extensions. The accessor "getConclusion" gives direct access to the value
1256     */
1257    public DiagnosticReport setConclusionElement(StringType value) { 
1258      this.conclusion = value;
1259      return this;
1260    }
1261
1262    /**
1263     * @return Concise and clinically contextualized narrative interpretation of the diagnostic report.
1264     */
1265    public String getConclusion() { 
1266      return this.conclusion == null ? null : this.conclusion.getValue();
1267    }
1268
1269    /**
1270     * @param value Concise and clinically contextualized narrative interpretation of the diagnostic report.
1271     */
1272    public DiagnosticReport setConclusion(String value) { 
1273      if (Utilities.noString(value))
1274        this.conclusion = null;
1275      else {
1276        if (this.conclusion == null)
1277          this.conclusion = new StringType();
1278        this.conclusion.setValue(value);
1279      }
1280      return this;
1281    }
1282
1283    /**
1284     * @return {@link #codedDiagnosis} (Codes for the conclusion.)
1285     */
1286    public List<CodeableConcept> getCodedDiagnosis() { 
1287      if (this.codedDiagnosis == null)
1288        this.codedDiagnosis = new ArrayList<CodeableConcept>();
1289      return this.codedDiagnosis;
1290    }
1291
1292    public boolean hasCodedDiagnosis() { 
1293      if (this.codedDiagnosis == null)
1294        return false;
1295      for (CodeableConcept item : this.codedDiagnosis)
1296        if (!item.isEmpty())
1297          return true;
1298      return false;
1299    }
1300
1301    /**
1302     * @return {@link #codedDiagnosis} (Codes for the conclusion.)
1303     */
1304    // syntactic sugar
1305    public CodeableConcept addCodedDiagnosis() { //3
1306      CodeableConcept t = new CodeableConcept();
1307      if (this.codedDiagnosis == null)
1308        this.codedDiagnosis = new ArrayList<CodeableConcept>();
1309      this.codedDiagnosis.add(t);
1310      return t;
1311    }
1312
1313    // syntactic sugar
1314    public DiagnosticReport addCodedDiagnosis(CodeableConcept t) { //3
1315      if (t == null)
1316        return this;
1317      if (this.codedDiagnosis == null)
1318        this.codedDiagnosis = new ArrayList<CodeableConcept>();
1319      this.codedDiagnosis.add(t);
1320      return this;
1321    }
1322
1323    /**
1324     * @return {@link #presentedForm} (Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.)
1325     */
1326    public List<Attachment> getPresentedForm() { 
1327      if (this.presentedForm == null)
1328        this.presentedForm = new ArrayList<Attachment>();
1329      return this.presentedForm;
1330    }
1331
1332    public boolean hasPresentedForm() { 
1333      if (this.presentedForm == null)
1334        return false;
1335      for (Attachment item : this.presentedForm)
1336        if (!item.isEmpty())
1337          return true;
1338      return false;
1339    }
1340
1341    /**
1342     * @return {@link #presentedForm} (Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.)
1343     */
1344    // syntactic sugar
1345    public Attachment addPresentedForm() { //3
1346      Attachment t = new Attachment();
1347      if (this.presentedForm == null)
1348        this.presentedForm = new ArrayList<Attachment>();
1349      this.presentedForm.add(t);
1350      return t;
1351    }
1352
1353    // syntactic sugar
1354    public DiagnosticReport addPresentedForm(Attachment t) { //3
1355      if (t == null)
1356        return this;
1357      if (this.presentedForm == null)
1358        this.presentedForm = new ArrayList<Attachment>();
1359      this.presentedForm.add(t);
1360      return this;
1361    }
1362
1363      protected void listChildren(List<Property> childrenList) {
1364        super.listChildren(childrenList);
1365        childrenList.add(new Property("identifier", "Identifier", "The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.", 0, java.lang.Integer.MAX_VALUE, identifier));
1366        childrenList.add(new Property("status", "code", "The status of the diagnostic report as a whole.", 0, java.lang.Integer.MAX_VALUE, status));
1367        childrenList.add(new Property("category", "CodeableConcept", "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.", 0, java.lang.Integer.MAX_VALUE, category));
1368        childrenList.add(new Property("code", "CodeableConcept", "A code or name that describes this diagnostic report.", 0, java.lang.Integer.MAX_VALUE, code));
1369        childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Location)", "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.", 0, java.lang.Integer.MAX_VALUE, subject));
1370        childrenList.add(new Property("encounter", "Reference(Encounter)", "The link to the health care event (encounter) when the order was made.", 0, java.lang.Integer.MAX_VALUE, encounter));
1371        childrenList.add(new Property("effective[x]", "dateTime|Period", "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.", 0, java.lang.Integer.MAX_VALUE, effective));
1372        childrenList.add(new Property("issued", "instant", "The date and time that this version of the report was released from the source diagnostic service.", 0, java.lang.Integer.MAX_VALUE, issued));
1373        childrenList.add(new Property("performer", "Reference(Practitioner|Organization)", "The diagnostic service that is responsible for issuing the report.", 0, java.lang.Integer.MAX_VALUE, performer));
1374        childrenList.add(new Property("request", "Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)", "Details concerning a test or procedure requested.", 0, java.lang.Integer.MAX_VALUE, request));
1375        childrenList.add(new Property("specimen", "Reference(Specimen)", "Details about the specimens on which this diagnostic report is based.", 0, java.lang.Integer.MAX_VALUE, specimen));
1376        childrenList.add(new Property("result", "Reference(Observation)", "Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. \"atomic\" results), or they can be grouping observations that include references to other members of the group (e.g. \"panels\").", 0, java.lang.Integer.MAX_VALUE, result));
1377        childrenList.add(new Property("imagingStudy", "Reference(ImagingStudy|ImagingObjectSelection)", "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.", 0, java.lang.Integer.MAX_VALUE, imagingStudy));
1378        childrenList.add(new Property("image", "", "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).", 0, java.lang.Integer.MAX_VALUE, image));
1379        childrenList.add(new Property("conclusion", "string", "Concise and clinically contextualized narrative interpretation of the diagnostic report.", 0, java.lang.Integer.MAX_VALUE, conclusion));
1380        childrenList.add(new Property("codedDiagnosis", "CodeableConcept", "Codes for the conclusion.", 0, java.lang.Integer.MAX_VALUE, codedDiagnosis));
1381        childrenList.add(new Property("presentedForm", "Attachment", "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.", 0, java.lang.Integer.MAX_VALUE, presentedForm));
1382      }
1383
1384      @Override
1385      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1386        switch (hash) {
1387        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1388        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DiagnosticReportStatus>
1389        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1390        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1391        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1392        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1393        case -1468651097: /*effective*/ return this.effective == null ? new Base[0] : new Base[] {this.effective}; // Type
1394        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // InstantType
1395        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
1396        case 1095692943: /*request*/ return this.request == null ? new Base[0] : this.request.toArray(new Base[this.request.size()]); // Reference
1397        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
1398        case -934426595: /*result*/ return this.result == null ? new Base[0] : this.result.toArray(new Base[this.result.size()]); // Reference
1399        case -814900911: /*imagingStudy*/ return this.imagingStudy == null ? new Base[0] : this.imagingStudy.toArray(new Base[this.imagingStudy.size()]); // Reference
1400        case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // DiagnosticReportImageComponent
1401        case -1731259873: /*conclusion*/ return this.conclusion == null ? new Base[0] : new Base[] {this.conclusion}; // StringType
1402        case -1364269926: /*codedDiagnosis*/ return this.codedDiagnosis == null ? new Base[0] : this.codedDiagnosis.toArray(new Base[this.codedDiagnosis.size()]); // CodeableConcept
1403        case 230090366: /*presentedForm*/ return this.presentedForm == null ? new Base[0] : this.presentedForm.toArray(new Base[this.presentedForm.size()]); // Attachment
1404        default: return super.getProperty(hash, name, checkValid);
1405        }
1406
1407      }
1408
1409      @Override
1410      public void setProperty(int hash, String name, Base value) throws FHIRException {
1411        switch (hash) {
1412        case -1618432855: // identifier
1413          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1414          break;
1415        case -892481550: // status
1416          this.status = new DiagnosticReportStatusEnumFactory().fromType(value); // Enumeration<DiagnosticReportStatus>
1417          break;
1418        case 50511102: // category
1419          this.category = castToCodeableConcept(value); // CodeableConcept
1420          break;
1421        case 3059181: // code
1422          this.code = castToCodeableConcept(value); // CodeableConcept
1423          break;
1424        case -1867885268: // subject
1425          this.subject = castToReference(value); // Reference
1426          break;
1427        case 1524132147: // encounter
1428          this.encounter = castToReference(value); // Reference
1429          break;
1430        case -1468651097: // effective
1431          this.effective = (Type) value; // Type
1432          break;
1433        case -1179159893: // issued
1434          this.issued = castToInstant(value); // InstantType
1435          break;
1436        case 481140686: // performer
1437          this.performer = castToReference(value); // Reference
1438          break;
1439        case 1095692943: // request
1440          this.getRequest().add(castToReference(value)); // Reference
1441          break;
1442        case -2132868344: // specimen
1443          this.getSpecimen().add(castToReference(value)); // Reference
1444          break;
1445        case -934426595: // result
1446          this.getResult().add(castToReference(value)); // Reference
1447          break;
1448        case -814900911: // imagingStudy
1449          this.getImagingStudy().add(castToReference(value)); // Reference
1450          break;
1451        case 100313435: // image
1452          this.getImage().add((DiagnosticReportImageComponent) value); // DiagnosticReportImageComponent
1453          break;
1454        case -1731259873: // conclusion
1455          this.conclusion = castToString(value); // StringType
1456          break;
1457        case -1364269926: // codedDiagnosis
1458          this.getCodedDiagnosis().add(castToCodeableConcept(value)); // CodeableConcept
1459          break;
1460        case 230090366: // presentedForm
1461          this.getPresentedForm().add(castToAttachment(value)); // Attachment
1462          break;
1463        default: super.setProperty(hash, name, value);
1464        }
1465
1466      }
1467
1468      @Override
1469      public void setProperty(String name, Base value) throws FHIRException {
1470        if (name.equals("identifier"))
1471          this.getIdentifier().add(castToIdentifier(value));
1472        else if (name.equals("status"))
1473          this.status = new DiagnosticReportStatusEnumFactory().fromType(value); // Enumeration<DiagnosticReportStatus>
1474        else if (name.equals("category"))
1475          this.category = castToCodeableConcept(value); // CodeableConcept
1476        else if (name.equals("code"))
1477          this.code = castToCodeableConcept(value); // CodeableConcept
1478        else if (name.equals("subject"))
1479          this.subject = castToReference(value); // Reference
1480        else if (name.equals("encounter"))
1481          this.encounter = castToReference(value); // Reference
1482        else if (name.equals("effective[x]"))
1483          this.effective = (Type) value; // Type
1484        else if (name.equals("issued"))
1485          this.issued = castToInstant(value); // InstantType
1486        else if (name.equals("performer"))
1487          this.performer = castToReference(value); // Reference
1488        else if (name.equals("request"))
1489          this.getRequest().add(castToReference(value));
1490        else if (name.equals("specimen"))
1491          this.getSpecimen().add(castToReference(value));
1492        else if (name.equals("result"))
1493          this.getResult().add(castToReference(value));
1494        else if (name.equals("imagingStudy"))
1495          this.getImagingStudy().add(castToReference(value));
1496        else if (name.equals("image"))
1497          this.getImage().add((DiagnosticReportImageComponent) value);
1498        else if (name.equals("conclusion"))
1499          this.conclusion = castToString(value); // StringType
1500        else if (name.equals("codedDiagnosis"))
1501          this.getCodedDiagnosis().add(castToCodeableConcept(value));
1502        else if (name.equals("presentedForm"))
1503          this.getPresentedForm().add(castToAttachment(value));
1504        else
1505          super.setProperty(name, value);
1506      }
1507
1508      @Override
1509      public Base makeProperty(int hash, String name) throws FHIRException {
1510        switch (hash) {
1511        case -1618432855:  return addIdentifier(); // Identifier
1512        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<DiagnosticReportStatus>
1513        case 50511102:  return getCategory(); // CodeableConcept
1514        case 3059181:  return getCode(); // CodeableConcept
1515        case -1867885268:  return getSubject(); // Reference
1516        case 1524132147:  return getEncounter(); // Reference
1517        case 247104889:  return getEffective(); // Type
1518        case -1179159893: throw new FHIRException("Cannot make property issued as it is not a complex type"); // InstantType
1519        case 481140686:  return getPerformer(); // Reference
1520        case 1095692943:  return addRequest(); // Reference
1521        case -2132868344:  return addSpecimen(); // Reference
1522        case -934426595:  return addResult(); // Reference
1523        case -814900911:  return addImagingStudy(); // Reference
1524        case 100313435:  return addImage(); // DiagnosticReportImageComponent
1525        case -1731259873: throw new FHIRException("Cannot make property conclusion as it is not a complex type"); // StringType
1526        case -1364269926:  return addCodedDiagnosis(); // CodeableConcept
1527        case 230090366:  return addPresentedForm(); // Attachment
1528        default: return super.makeProperty(hash, name);
1529        }
1530
1531      }
1532
1533      @Override
1534      public Base addChild(String name) throws FHIRException {
1535        if (name.equals("identifier")) {
1536          return addIdentifier();
1537        }
1538        else if (name.equals("status")) {
1539          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.status");
1540        }
1541        else if (name.equals("category")) {
1542          this.category = new CodeableConcept();
1543          return this.category;
1544        }
1545        else if (name.equals("code")) {
1546          this.code = new CodeableConcept();
1547          return this.code;
1548        }
1549        else if (name.equals("subject")) {
1550          this.subject = new Reference();
1551          return this.subject;
1552        }
1553        else if (name.equals("encounter")) {
1554          this.encounter = new Reference();
1555          return this.encounter;
1556        }
1557        else if (name.equals("effectiveDateTime")) {
1558          this.effective = new DateTimeType();
1559          return this.effective;
1560        }
1561        else if (name.equals("effectivePeriod")) {
1562          this.effective = new Period();
1563          return this.effective;
1564        }
1565        else if (name.equals("issued")) {
1566          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.issued");
1567        }
1568        else if (name.equals("performer")) {
1569          this.performer = new Reference();
1570          return this.performer;
1571        }
1572        else if (name.equals("request")) {
1573          return addRequest();
1574        }
1575        else if (name.equals("specimen")) {
1576          return addSpecimen();
1577        }
1578        else if (name.equals("result")) {
1579          return addResult();
1580        }
1581        else if (name.equals("imagingStudy")) {
1582          return addImagingStudy();
1583        }
1584        else if (name.equals("image")) {
1585          return addImage();
1586        }
1587        else if (name.equals("conclusion")) {
1588          throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.conclusion");
1589        }
1590        else if (name.equals("codedDiagnosis")) {
1591          return addCodedDiagnosis();
1592        }
1593        else if (name.equals("presentedForm")) {
1594          return addPresentedForm();
1595        }
1596        else
1597          return super.addChild(name);
1598      }
1599
1600  public String fhirType() {
1601    return "DiagnosticReport";
1602
1603  }
1604
1605      public DiagnosticReport copy() {
1606        DiagnosticReport dst = new DiagnosticReport();
1607        copyValues(dst);
1608        if (identifier != null) {
1609          dst.identifier = new ArrayList<Identifier>();
1610          for (Identifier i : identifier)
1611            dst.identifier.add(i.copy());
1612        };
1613        dst.status = status == null ? null : status.copy();
1614        dst.category = category == null ? null : category.copy();
1615        dst.code = code == null ? null : code.copy();
1616        dst.subject = subject == null ? null : subject.copy();
1617        dst.encounter = encounter == null ? null : encounter.copy();
1618        dst.effective = effective == null ? null : effective.copy();
1619        dst.issued = issued == null ? null : issued.copy();
1620        dst.performer = performer == null ? null : performer.copy();
1621        if (request != null) {
1622          dst.request = new ArrayList<Reference>();
1623          for (Reference i : request)
1624            dst.request.add(i.copy());
1625        };
1626        if (specimen != null) {
1627          dst.specimen = new ArrayList<Reference>();
1628          for (Reference i : specimen)
1629            dst.specimen.add(i.copy());
1630        };
1631        if (result != null) {
1632          dst.result = new ArrayList<Reference>();
1633          for (Reference i : result)
1634            dst.result.add(i.copy());
1635        };
1636        if (imagingStudy != null) {
1637          dst.imagingStudy = new ArrayList<Reference>();
1638          for (Reference i : imagingStudy)
1639            dst.imagingStudy.add(i.copy());
1640        };
1641        if (image != null) {
1642          dst.image = new ArrayList<DiagnosticReportImageComponent>();
1643          for (DiagnosticReportImageComponent i : image)
1644            dst.image.add(i.copy());
1645        };
1646        dst.conclusion = conclusion == null ? null : conclusion.copy();
1647        if (codedDiagnosis != null) {
1648          dst.codedDiagnosis = new ArrayList<CodeableConcept>();
1649          for (CodeableConcept i : codedDiagnosis)
1650            dst.codedDiagnosis.add(i.copy());
1651        };
1652        if (presentedForm != null) {
1653          dst.presentedForm = new ArrayList<Attachment>();
1654          for (Attachment i : presentedForm)
1655            dst.presentedForm.add(i.copy());
1656        };
1657        return dst;
1658      }
1659
1660      protected DiagnosticReport typedCopy() {
1661        return copy();
1662      }
1663
1664      @Override
1665      public boolean equalsDeep(Base other) {
1666        if (!super.equalsDeep(other))
1667          return false;
1668        if (!(other instanceof DiagnosticReport))
1669          return false;
1670        DiagnosticReport o = (DiagnosticReport) other;
1671        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
1672           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
1673           && compareDeep(effective, o.effective, true) && compareDeep(issued, o.issued, true) && compareDeep(performer, o.performer, true)
1674           && compareDeep(request, o.request, true) && compareDeep(specimen, o.specimen, true) && compareDeep(result, o.result, true)
1675           && compareDeep(imagingStudy, o.imagingStudy, true) && compareDeep(image, o.image, true) && compareDeep(conclusion, o.conclusion, true)
1676           && compareDeep(codedDiagnosis, o.codedDiagnosis, true) && compareDeep(presentedForm, o.presentedForm, true)
1677          ;
1678      }
1679
1680      @Override
1681      public boolean equalsShallow(Base other) {
1682        if (!super.equalsShallow(other))
1683          return false;
1684        if (!(other instanceof DiagnosticReport))
1685          return false;
1686        DiagnosticReport o = (DiagnosticReport) other;
1687        return compareValues(status, o.status, true) && compareValues(issued, o.issued, true) && compareValues(conclusion, o.conclusion, true)
1688          ;
1689      }
1690
1691      public boolean isEmpty() {
1692        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
1693           && (category == null || category.isEmpty()) && (code == null || code.isEmpty()) && (subject == null || subject.isEmpty())
1694           && (encounter == null || encounter.isEmpty()) && (effective == null || effective.isEmpty())
1695           && (issued == null || issued.isEmpty()) && (performer == null || performer.isEmpty()) && (request == null || request.isEmpty())
1696           && (specimen == null || specimen.isEmpty()) && (result == null || result.isEmpty()) && (imagingStudy == null || imagingStudy.isEmpty())
1697           && (image == null || image.isEmpty()) && (conclusion == null || conclusion.isEmpty()) && (codedDiagnosis == null || codedDiagnosis.isEmpty())
1698           && (presentedForm == null || presentedForm.isEmpty());
1699      }
1700
1701  @Override
1702  public ResourceType getResourceType() {
1703    return ResourceType.DiagnosticReport;
1704   }
1705
1706 /**
1707   * Search parameter: <b>result</b>
1708   * <p>
1709   * Description: <b>Link to an atomic result (observation resource)</b><br>
1710   * Type: <b>reference</b><br>
1711   * Path: <b>DiagnosticReport.result</b><br>
1712   * </p>
1713   */
1714  @SearchParamDefinition(name="result", path="DiagnosticReport.result", description="Link to an atomic result (observation resource)", type="reference" )
1715  public static final String SP_RESULT = "result";
1716 /**
1717   * <b>Fluent Client</b> search parameter constant for <b>result</b>
1718   * <p>
1719   * Description: <b>Link to an atomic result (observation resource)</b><br>
1720   * Type: <b>reference</b><br>
1721   * Path: <b>DiagnosticReport.result</b><br>
1722   * </p>
1723   */
1724  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESULT);
1725
1726/**
1727   * Constant for fluent queries to be used to add include statements. Specifies
1728   * the path value of "<b>DiagnosticReport:result</b>".
1729   */
1730  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULT = new ca.uhn.fhir.model.api.Include("DiagnosticReport:result").toLocked();
1731
1732 /**
1733   * Search parameter: <b>status</b>
1734   * <p>
1735   * Description: <b>The status of the report</b><br>
1736   * Type: <b>token</b><br>
1737   * Path: <b>DiagnosticReport.status</b><br>
1738   * </p>
1739   */
1740  @SearchParamDefinition(name="status", path="DiagnosticReport.status", description="The status of the report", type="token" )
1741  public static final String SP_STATUS = "status";
1742 /**
1743   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1744   * <p>
1745   * Description: <b>The status of the report</b><br>
1746   * Type: <b>token</b><br>
1747   * Path: <b>DiagnosticReport.status</b><br>
1748   * </p>
1749   */
1750  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1751
1752 /**
1753   * Search parameter: <b>subject</b>
1754   * <p>
1755   * Description: <b>The subject of the report</b><br>
1756   * Type: <b>reference</b><br>
1757   * Path: <b>DiagnosticReport.subject</b><br>
1758   * </p>
1759   */
1760  @SearchParamDefinition(name="subject", path="DiagnosticReport.subject", description="The subject of the report", type="reference" )
1761  public static final String SP_SUBJECT = "subject";
1762 /**
1763   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1764   * <p>
1765   * Description: <b>The subject of the report</b><br>
1766   * Type: <b>reference</b><br>
1767   * Path: <b>DiagnosticReport.subject</b><br>
1768   * </p>
1769   */
1770  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1771
1772/**
1773   * Constant for fluent queries to be used to add include statements. Specifies
1774   * the path value of "<b>DiagnosticReport:subject</b>".
1775   */
1776  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DiagnosticReport:subject").toLocked();
1777
1778 /**
1779   * Search parameter: <b>issued</b>
1780   * <p>
1781   * Description: <b>When the report was issued</b><br>
1782   * Type: <b>date</b><br>
1783   * Path: <b>DiagnosticReport.issued</b><br>
1784   * </p>
1785   */
1786  @SearchParamDefinition(name="issued", path="DiagnosticReport.issued", description="When the report was issued", type="date" )
1787  public static final String SP_ISSUED = "issued";
1788 /**
1789   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
1790   * <p>
1791   * Description: <b>When the report was issued</b><br>
1792   * Type: <b>date</b><br>
1793   * Path: <b>DiagnosticReport.issued</b><br>
1794   * </p>
1795   */
1796  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ISSUED);
1797
1798 /**
1799   * Search parameter: <b>diagnosis</b>
1800   * <p>
1801   * Description: <b>A coded diagnosis on the report</b><br>
1802   * Type: <b>token</b><br>
1803   * Path: <b>DiagnosticReport.codedDiagnosis</b><br>
1804   * </p>
1805   */
1806  @SearchParamDefinition(name="diagnosis", path="DiagnosticReport.codedDiagnosis", description="A coded diagnosis on the report", type="token" )
1807  public static final String SP_DIAGNOSIS = "diagnosis";
1808 /**
1809   * <b>Fluent Client</b> search parameter constant for <b>diagnosis</b>
1810   * <p>
1811   * Description: <b>A coded diagnosis on the report</b><br>
1812   * Type: <b>token</b><br>
1813   * Path: <b>DiagnosticReport.codedDiagnosis</b><br>
1814   * </p>
1815   */
1816  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DIAGNOSIS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DIAGNOSIS);
1817
1818 /**
1819   * Search parameter: <b>image</b>
1820   * <p>
1821   * Description: <b>A reference to the image source.</b><br>
1822   * Type: <b>reference</b><br>
1823   * Path: <b>DiagnosticReport.image.link</b><br>
1824   * </p>
1825   */
1826  @SearchParamDefinition(name="image", path="DiagnosticReport.image.link", description="A reference to the image source.", type="reference" )
1827  public static final String SP_IMAGE = "image";
1828 /**
1829   * <b>Fluent Client</b> search parameter constant for <b>image</b>
1830   * <p>
1831   * Description: <b>A reference to the image source.</b><br>
1832   * Type: <b>reference</b><br>
1833   * Path: <b>DiagnosticReport.image.link</b><br>
1834   * </p>
1835   */
1836  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam IMAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_IMAGE);
1837
1838/**
1839   * Constant for fluent queries to be used to add include statements. Specifies
1840   * the path value of "<b>DiagnosticReport:image</b>".
1841   */
1842  public static final ca.uhn.fhir.model.api.Include INCLUDE_IMAGE = new ca.uhn.fhir.model.api.Include("DiagnosticReport:image").toLocked();
1843
1844 /**
1845   * Search parameter: <b>encounter</b>
1846   * <p>
1847   * Description: <b>The Encounter when the order was made</b><br>
1848   * Type: <b>reference</b><br>
1849   * Path: <b>DiagnosticReport.encounter</b><br>
1850   * </p>
1851   */
1852  @SearchParamDefinition(name="encounter", path="DiagnosticReport.encounter", description="The Encounter when the order was made", type="reference" )
1853  public static final String SP_ENCOUNTER = "encounter";
1854 /**
1855   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
1856   * <p>
1857   * Description: <b>The Encounter when the order was made</b><br>
1858   * Type: <b>reference</b><br>
1859   * Path: <b>DiagnosticReport.encounter</b><br>
1860   * </p>
1861   */
1862  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
1863
1864/**
1865   * Constant for fluent queries to be used to add include statements. Specifies
1866   * the path value of "<b>DiagnosticReport:encounter</b>".
1867   */
1868  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("DiagnosticReport:encounter").toLocked();
1869
1870 /**
1871   * Search parameter: <b>code</b>
1872   * <p>
1873   * Description: <b>The code for the report as a whole, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result</b><br>
1874   * Type: <b>token</b><br>
1875   * Path: <b>DiagnosticReport.code</b><br>
1876   * </p>
1877   */
1878  @SearchParamDefinition(name="code", path="DiagnosticReport.code", description="The code for the report as a whole, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result", type="token" )
1879  public static final String SP_CODE = "code";
1880 /**
1881   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1882   * <p>
1883   * Description: <b>The code for the report as a whole, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result</b><br>
1884   * Type: <b>token</b><br>
1885   * Path: <b>DiagnosticReport.code</b><br>
1886   * </p>
1887   */
1888  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1889
1890 /**
1891   * Search parameter: <b>date</b>
1892   * <p>
1893   * Description: <b>The clinically relevant time of the report</b><br>
1894   * Type: <b>date</b><br>
1895   * Path: <b>DiagnosticReport.effective[x]</b><br>
1896   * </p>
1897   */
1898  @SearchParamDefinition(name="date", path="DiagnosticReport.effective", description="The clinically relevant time of the report", type="date" )
1899  public static final String SP_DATE = "date";
1900 /**
1901   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1902   * <p>
1903   * Description: <b>The clinically relevant time of the report</b><br>
1904   * Type: <b>date</b><br>
1905   * Path: <b>DiagnosticReport.effective[x]</b><br>
1906   * </p>
1907   */
1908  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1909
1910 /**
1911   * Search parameter: <b>category</b>
1912   * <p>
1913   * Description: <b>Which diagnostic discipline/department created the report</b><br>
1914   * Type: <b>token</b><br>
1915   * Path: <b>DiagnosticReport.category</b><br>
1916   * </p>
1917   */
1918  @SearchParamDefinition(name="category", path="DiagnosticReport.category", description="Which diagnostic discipline/department created the report", type="token" )
1919  public static final String SP_CATEGORY = "category";
1920 /**
1921   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1922   * <p>
1923   * Description: <b>Which diagnostic discipline/department created the report</b><br>
1924   * Type: <b>token</b><br>
1925   * Path: <b>DiagnosticReport.category</b><br>
1926   * </p>
1927   */
1928  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1929
1930 /**
1931   * Search parameter: <b>patient</b>
1932   * <p>
1933   * Description: <b>The subject of the report if a patient</b><br>
1934   * Type: <b>reference</b><br>
1935   * Path: <b>DiagnosticReport.subject</b><br>
1936   * </p>
1937   */
1938  @SearchParamDefinition(name="patient", path="DiagnosticReport.subject", description="The subject of the report if a patient", type="reference" )
1939  public static final String SP_PATIENT = "patient";
1940 /**
1941   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1942   * <p>
1943   * Description: <b>The subject of the report if a patient</b><br>
1944   * Type: <b>reference</b><br>
1945   * Path: <b>DiagnosticReport.subject</b><br>
1946   * </p>
1947   */
1948  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1949
1950/**
1951   * Constant for fluent queries to be used to add include statements. Specifies
1952   * the path value of "<b>DiagnosticReport:patient</b>".
1953   */
1954  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DiagnosticReport:patient").toLocked();
1955
1956 /**
1957   * Search parameter: <b>request</b>
1958   * <p>
1959   * Description: <b>Reference to the test or procedure request.</b><br>
1960   * Type: <b>reference</b><br>
1961   * Path: <b>DiagnosticReport.request</b><br>
1962   * </p>
1963   */
1964  @SearchParamDefinition(name="request", path="DiagnosticReport.request", description="Reference to the test or procedure request.", type="reference" )
1965  public static final String SP_REQUEST = "request";
1966 /**
1967   * <b>Fluent Client</b> search parameter constant for <b>request</b>
1968   * <p>
1969   * Description: <b>Reference to the test or procedure request.</b><br>
1970   * Type: <b>reference</b><br>
1971   * Path: <b>DiagnosticReport.request</b><br>
1972   * </p>
1973   */
1974  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
1975
1976/**
1977   * Constant for fluent queries to be used to add include statements. Specifies
1978   * the path value of "<b>DiagnosticReport:request</b>".
1979   */
1980  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("DiagnosticReport:request").toLocked();
1981
1982 /**
1983   * Search parameter: <b>specimen</b>
1984   * <p>
1985   * Description: <b>The specimen details</b><br>
1986   * Type: <b>reference</b><br>
1987   * Path: <b>DiagnosticReport.specimen</b><br>
1988   * </p>
1989   */
1990  @SearchParamDefinition(name="specimen", path="DiagnosticReport.specimen", description="The specimen details", type="reference" )
1991  public static final String SP_SPECIMEN = "specimen";
1992 /**
1993   * <b>Fluent Client</b> search parameter constant for <b>specimen</b>
1994   * <p>
1995   * Description: <b>The specimen details</b><br>
1996   * Type: <b>reference</b><br>
1997   * Path: <b>DiagnosticReport.specimen</b><br>
1998   * </p>
1999   */
2000  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPECIMEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SPECIMEN);
2001
2002/**
2003   * Constant for fluent queries to be used to add include statements. Specifies
2004   * the path value of "<b>DiagnosticReport:specimen</b>".
2005   */
2006  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPECIMEN = new ca.uhn.fhir.model.api.Include("DiagnosticReport:specimen").toLocked();
2007
2008 /**
2009   * Search parameter: <b>performer</b>
2010   * <p>
2011   * Description: <b>Who was the source of the report (organization)</b><br>
2012   * Type: <b>reference</b><br>
2013   * Path: <b>DiagnosticReport.performer</b><br>
2014   * </p>
2015   */
2016  @SearchParamDefinition(name="performer", path="DiagnosticReport.performer", description="Who was the source of the report (organization)", type="reference" )
2017  public static final String SP_PERFORMER = "performer";
2018 /**
2019   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2020   * <p>
2021   * Description: <b>Who was the source of the report (organization)</b><br>
2022   * Type: <b>reference</b><br>
2023   * Path: <b>DiagnosticReport.performer</b><br>
2024   * </p>
2025   */
2026  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2027
2028/**
2029   * Constant for fluent queries to be used to add include statements. Specifies
2030   * the path value of "<b>DiagnosticReport:performer</b>".
2031   */
2032  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("DiagnosticReport:performer").toLocked();
2033
2034 /**
2035   * Search parameter: <b>identifier</b>
2036   * <p>
2037   * Description: <b>An identifier for the report</b><br>
2038   * Type: <b>token</b><br>
2039   * Path: <b>DiagnosticReport.identifier</b><br>
2040   * </p>
2041   */
2042  @SearchParamDefinition(name="identifier", path="DiagnosticReport.identifier", description="An identifier for the report", type="token" )
2043  public static final String SP_IDENTIFIER = "identifier";
2044 /**
2045   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2046   * <p>
2047   * Description: <b>An identifier for the report</b><br>
2048   * Type: <b>token</b><br>
2049   * Path: <b>DiagnosticReport.identifier</b><br>
2050   * </p>
2051   */
2052  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2053
2054
2055}
2056