001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc.
070 */
071@ResourceDef(name="DetectedIssue", profile="http://hl7.org/fhir/StructureDefinition/DetectedIssue")
072public class DetectedIssue extends DomainResource {
073
074    public enum DetectedIssueStatus {
075        /**
076         * The existence of the observation is registered, but there is no result yet available.
077         */
078        REGISTERED, 
079        /**
080         * This is an initial or interim observation: data may be incomplete or unverified.
081         */
082        PRELIMINARY, 
083        /**
084         * The observation is complete and there are no further actions needed. Additional information such "released", "signed", etc would be represented using [Provenance](provenance.html) which provides not only the act but also the actors and dates and other related data. These act states would be associated with an observation status of `preliminary` until they are all completed and then a status of `final` would be applied.
085         */
086        FINAL, 
087        /**
088         * Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.
089         */
090        AMENDED, 
091        /**
092         * Subsequent to being Final, the observation has been modified to correct an error in the test result.
093         */
094        CORRECTED, 
095        /**
096         * The observation is unavailable because the measurement was not started or not completed (also sometimes called "aborted").
097         */
098        CANCELLED, 
099        /**
100         * The observation has been withdrawn following previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".).
101         */
102        ENTEREDINERROR, 
103        /**
104         * The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.
105         */
106        UNKNOWN, 
107        /**
108         * added to help the parsers with the generic types
109         */
110        NULL;
111        public static DetectedIssueStatus fromCode(String codeString) throws FHIRException {
112            if (codeString == null || "".equals(codeString))
113                return null;
114        if ("registered".equals(codeString))
115          return REGISTERED;
116        if ("preliminary".equals(codeString))
117          return PRELIMINARY;
118        if ("final".equals(codeString))
119          return FINAL;
120        if ("amended".equals(codeString))
121          return AMENDED;
122        if ("corrected".equals(codeString))
123          return CORRECTED;
124        if ("cancelled".equals(codeString))
125          return CANCELLED;
126        if ("entered-in-error".equals(codeString))
127          return ENTEREDINERROR;
128        if ("unknown".equals(codeString))
129          return UNKNOWN;
130        if (Configuration.isAcceptInvalidEnums())
131          return null;
132        else
133          throw new FHIRException("Unknown DetectedIssueStatus code '"+codeString+"'");
134        }
135        public String toCode() {
136          switch (this) {
137            case REGISTERED: return "registered";
138            case PRELIMINARY: return "preliminary";
139            case FINAL: return "final";
140            case AMENDED: return "amended";
141            case CORRECTED: return "corrected";
142            case CANCELLED: return "cancelled";
143            case ENTEREDINERROR: return "entered-in-error";
144            case UNKNOWN: return "unknown";
145            default: return "?";
146          }
147        }
148        public String getSystem() {
149          switch (this) {
150            case REGISTERED: return "http://hl7.org/fhir/observation-status";
151            case PRELIMINARY: return "http://hl7.org/fhir/observation-status";
152            case FINAL: return "http://hl7.org/fhir/observation-status";
153            case AMENDED: return "http://hl7.org/fhir/observation-status";
154            case CORRECTED: return "http://hl7.org/fhir/observation-status";
155            case CANCELLED: return "http://hl7.org/fhir/observation-status";
156            case ENTEREDINERROR: return "http://hl7.org/fhir/observation-status";
157            case UNKNOWN: return "http://hl7.org/fhir/observation-status";
158            default: return "?";
159          }
160        }
161        public String getDefinition() {
162          switch (this) {
163            case REGISTERED: return "The existence of the observation is registered, but there is no result yet available.";
164            case PRELIMINARY: return "This is an initial or interim observation: data may be incomplete or unverified.";
165            case FINAL: return "The observation is complete and there are no further actions needed. Additional information such \"released\", \"signed\", etc would be represented using [Provenance](provenance.html) which provides not only the act but also the actors and dates and other related data. These act states would be associated with an observation status of `preliminary` until they are all completed and then a status of `final` would be applied.";
166            case AMENDED: return "Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.";
167            case CORRECTED: return "Subsequent to being Final, the observation has been modified to correct an error in the test result.";
168            case CANCELLED: return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
169            case ENTEREDINERROR: return "The observation has been withdrawn following previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
170            case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.";
171            default: return "?";
172          }
173        }
174        public String getDisplay() {
175          switch (this) {
176            case REGISTERED: return "Registered";
177            case PRELIMINARY: return "Preliminary";
178            case FINAL: return "Final";
179            case AMENDED: return "Amended";
180            case CORRECTED: return "Corrected";
181            case CANCELLED: return "Cancelled";
182            case ENTEREDINERROR: return "Entered in Error";
183            case UNKNOWN: return "Unknown";
184            default: return "?";
185          }
186        }
187    }
188
189  public static class DetectedIssueStatusEnumFactory implements EnumFactory<DetectedIssueStatus> {
190    public DetectedIssueStatus fromCode(String codeString) throws IllegalArgumentException {
191      if (codeString == null || "".equals(codeString))
192            if (codeString == null || "".equals(codeString))
193                return null;
194        if ("registered".equals(codeString))
195          return DetectedIssueStatus.REGISTERED;
196        if ("preliminary".equals(codeString))
197          return DetectedIssueStatus.PRELIMINARY;
198        if ("final".equals(codeString))
199          return DetectedIssueStatus.FINAL;
200        if ("amended".equals(codeString))
201          return DetectedIssueStatus.AMENDED;
202        if ("corrected".equals(codeString))
203          return DetectedIssueStatus.CORRECTED;
204        if ("cancelled".equals(codeString))
205          return DetectedIssueStatus.CANCELLED;
206        if ("entered-in-error".equals(codeString))
207          return DetectedIssueStatus.ENTEREDINERROR;
208        if ("unknown".equals(codeString))
209          return DetectedIssueStatus.UNKNOWN;
210        throw new IllegalArgumentException("Unknown DetectedIssueStatus code '"+codeString+"'");
211        }
212        public Enumeration<DetectedIssueStatus> fromType(Base code) throws FHIRException {
213          if (code == null)
214            return null;
215          if (code.isEmpty())
216            return new Enumeration<DetectedIssueStatus>(this);
217          String codeString = ((PrimitiveType) code).asStringValue();
218          if (codeString == null || "".equals(codeString))
219            return null;
220        if ("registered".equals(codeString))
221          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.REGISTERED);
222        if ("preliminary".equals(codeString))
223          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.PRELIMINARY);
224        if ("final".equals(codeString))
225          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.FINAL);
226        if ("amended".equals(codeString))
227          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.AMENDED);
228        if ("corrected".equals(codeString))
229          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.CORRECTED);
230        if ("cancelled".equals(codeString))
231          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.CANCELLED);
232        if ("entered-in-error".equals(codeString))
233          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.ENTEREDINERROR);
234        if ("unknown".equals(codeString))
235          return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.UNKNOWN);
236        throw new FHIRException("Unknown DetectedIssueStatus code '"+codeString+"'");
237        }
238    public String toCode(DetectedIssueStatus code) {
239      if (code == DetectedIssueStatus.REGISTERED)
240        return "registered";
241      if (code == DetectedIssueStatus.PRELIMINARY)
242        return "preliminary";
243      if (code == DetectedIssueStatus.FINAL)
244        return "final";
245      if (code == DetectedIssueStatus.AMENDED)
246        return "amended";
247      if (code == DetectedIssueStatus.CORRECTED)
248        return "corrected";
249      if (code == DetectedIssueStatus.CANCELLED)
250        return "cancelled";
251      if (code == DetectedIssueStatus.ENTEREDINERROR)
252        return "entered-in-error";
253      if (code == DetectedIssueStatus.UNKNOWN)
254        return "unknown";
255      return "?";
256      }
257    public String toSystem(DetectedIssueStatus code) {
258      return code.getSystem();
259      }
260    }
261
262    public enum DetectedIssueSeverity {
263        /**
264         * Indicates the issue may be life-threatening or has the potential to cause permanent injury.
265         */
266        HIGH, 
267        /**
268         * Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury.
269         */
270        MODERATE, 
271        /**
272         * Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.
273         */
274        LOW, 
275        /**
276         * added to help the parsers with the generic types
277         */
278        NULL;
279        public static DetectedIssueSeverity fromCode(String codeString) throws FHIRException {
280            if (codeString == null || "".equals(codeString))
281                return null;
282        if ("high".equals(codeString))
283          return HIGH;
284        if ("moderate".equals(codeString))
285          return MODERATE;
286        if ("low".equals(codeString))
287          return LOW;
288        if (Configuration.isAcceptInvalidEnums())
289          return null;
290        else
291          throw new FHIRException("Unknown DetectedIssueSeverity code '"+codeString+"'");
292        }
293        public String toCode() {
294          switch (this) {
295            case HIGH: return "high";
296            case MODERATE: return "moderate";
297            case LOW: return "low";
298            default: return "?";
299          }
300        }
301        public String getSystem() {
302          switch (this) {
303            case HIGH: return "http://hl7.org/fhir/detectedissue-severity";
304            case MODERATE: return "http://hl7.org/fhir/detectedissue-severity";
305            case LOW: return "http://hl7.org/fhir/detectedissue-severity";
306            default: return "?";
307          }
308        }
309        public String getDefinition() {
310          switch (this) {
311            case HIGH: return "Indicates the issue may be life-threatening or has the potential to cause permanent injury.";
312            case MODERATE: return "Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury.";
313            case LOW: return "Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.";
314            default: return "?";
315          }
316        }
317        public String getDisplay() {
318          switch (this) {
319            case HIGH: return "High";
320            case MODERATE: return "Moderate";
321            case LOW: return "Low";
322            default: return "?";
323          }
324        }
325    }
326
327  public static class DetectedIssueSeverityEnumFactory implements EnumFactory<DetectedIssueSeverity> {
328    public DetectedIssueSeverity fromCode(String codeString) throws IllegalArgumentException {
329      if (codeString == null || "".equals(codeString))
330            if (codeString == null || "".equals(codeString))
331                return null;
332        if ("high".equals(codeString))
333          return DetectedIssueSeverity.HIGH;
334        if ("moderate".equals(codeString))
335          return DetectedIssueSeverity.MODERATE;
336        if ("low".equals(codeString))
337          return DetectedIssueSeverity.LOW;
338        throw new IllegalArgumentException("Unknown DetectedIssueSeverity code '"+codeString+"'");
339        }
340        public Enumeration<DetectedIssueSeverity> fromType(Base code) throws FHIRException {
341          if (code == null)
342            return null;
343          if (code.isEmpty())
344            return new Enumeration<DetectedIssueSeverity>(this);
345          String codeString = ((PrimitiveType) code).asStringValue();
346          if (codeString == null || "".equals(codeString))
347            return null;
348        if ("high".equals(codeString))
349          return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.HIGH);
350        if ("moderate".equals(codeString))
351          return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.MODERATE);
352        if ("low".equals(codeString))
353          return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.LOW);
354        throw new FHIRException("Unknown DetectedIssueSeverity code '"+codeString+"'");
355        }
356    public String toCode(DetectedIssueSeverity code) {
357      if (code == DetectedIssueSeverity.HIGH)
358        return "high";
359      if (code == DetectedIssueSeverity.MODERATE)
360        return "moderate";
361      if (code == DetectedIssueSeverity.LOW)
362        return "low";
363      return "?";
364      }
365    public String toSystem(DetectedIssueSeverity code) {
366      return code.getSystem();
367      }
368    }
369
370    @Block()
371    public static class DetectedIssueEvidenceComponent extends BackboneElement implements IBaseBackboneElement {
372        /**
373         * A manifestation that led to the recording of this detected issue.
374         */
375        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
376        @Description(shortDefinition="Manifestation", formalDefinition="A manifestation that led to the recording of this detected issue." )
377        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/manifestation-or-symptom")
378        protected List<CodeableConcept> code;
379
380        /**
381         * Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.
382         */
383        @Child(name = "detail", type = {Reference.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
384        @Description(shortDefinition="Supporting information", formalDefinition="Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport." )
385        protected List<Reference> detail;
386
387        private static final long serialVersionUID = -672691342L;
388
389    /**
390     * Constructor
391     */
392      public DetectedIssueEvidenceComponent() {
393        super();
394      }
395
396        /**
397         * @return {@link #code} (A manifestation that led to the recording of this detected issue.)
398         */
399        public List<CodeableConcept> getCode() { 
400          if (this.code == null)
401            this.code = new ArrayList<CodeableConcept>();
402          return this.code;
403        }
404
405        /**
406         * @return Returns a reference to <code>this</code> for easy method chaining
407         */
408        public DetectedIssueEvidenceComponent setCode(List<CodeableConcept> theCode) { 
409          this.code = theCode;
410          return this;
411        }
412
413        public boolean hasCode() { 
414          if (this.code == null)
415            return false;
416          for (CodeableConcept item : this.code)
417            if (!item.isEmpty())
418              return true;
419          return false;
420        }
421
422        public CodeableConcept addCode() { //3
423          CodeableConcept t = new CodeableConcept();
424          if (this.code == null)
425            this.code = new ArrayList<CodeableConcept>();
426          this.code.add(t);
427          return t;
428        }
429
430        public DetectedIssueEvidenceComponent addCode(CodeableConcept t) { //3
431          if (t == null)
432            return this;
433          if (this.code == null)
434            this.code = new ArrayList<CodeableConcept>();
435          this.code.add(t);
436          return this;
437        }
438
439        /**
440         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
441         */
442        public CodeableConcept getCodeFirstRep() { 
443          if (getCode().isEmpty()) {
444            addCode();
445          }
446          return getCode().get(0);
447        }
448
449        /**
450         * @return {@link #detail} (Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.)
451         */
452        public List<Reference> getDetail() { 
453          if (this.detail == null)
454            this.detail = new ArrayList<Reference>();
455          return this.detail;
456        }
457
458        /**
459         * @return Returns a reference to <code>this</code> for easy method chaining
460         */
461        public DetectedIssueEvidenceComponent setDetail(List<Reference> theDetail) { 
462          this.detail = theDetail;
463          return this;
464        }
465
466        public boolean hasDetail() { 
467          if (this.detail == null)
468            return false;
469          for (Reference item : this.detail)
470            if (!item.isEmpty())
471              return true;
472          return false;
473        }
474
475        public Reference addDetail() { //3
476          Reference t = new Reference();
477          if (this.detail == null)
478            this.detail = new ArrayList<Reference>();
479          this.detail.add(t);
480          return t;
481        }
482
483        public DetectedIssueEvidenceComponent addDetail(Reference t) { //3
484          if (t == null)
485            return this;
486          if (this.detail == null)
487            this.detail = new ArrayList<Reference>();
488          this.detail.add(t);
489          return this;
490        }
491
492        /**
493         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
494         */
495        public Reference getDetailFirstRep() { 
496          if (getDetail().isEmpty()) {
497            addDetail();
498          }
499          return getDetail().get(0);
500        }
501
502        protected void listChildren(List<Property> children) {
503          super.listChildren(children);
504          children.add(new Property("code", "CodeableConcept", "A manifestation that led to the recording of this detected issue.", 0, java.lang.Integer.MAX_VALUE, code));
505          children.add(new Property("detail", "Reference(Any)", "Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.", 0, java.lang.Integer.MAX_VALUE, detail));
506        }
507
508        @Override
509        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
510          switch (_hash) {
511          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A manifestation that led to the recording of this detected issue.", 0, java.lang.Integer.MAX_VALUE, code);
512          case -1335224239: /*detail*/  return new Property("detail", "Reference(Any)", "Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.", 0, java.lang.Integer.MAX_VALUE, detail);
513          default: return super.getNamedProperty(_hash, _name, _checkValid);
514          }
515
516        }
517
518      @Override
519      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
520        switch (hash) {
521        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
522        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference
523        default: return super.getProperty(hash, name, checkValid);
524        }
525
526      }
527
528      @Override
529      public Base setProperty(int hash, String name, Base value) throws FHIRException {
530        switch (hash) {
531        case 3059181: // code
532          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
533          return value;
534        case -1335224239: // detail
535          this.getDetail().add(castToReference(value)); // Reference
536          return value;
537        default: return super.setProperty(hash, name, value);
538        }
539
540      }
541
542      @Override
543      public Base setProperty(String name, Base value) throws FHIRException {
544        if (name.equals("code")) {
545          this.getCode().add(castToCodeableConcept(value));
546        } else if (name.equals("detail")) {
547          this.getDetail().add(castToReference(value));
548        } else
549          return super.setProperty(name, value);
550        return value;
551      }
552
553      @Override
554      public Base makeProperty(int hash, String name) throws FHIRException {
555        switch (hash) {
556        case 3059181:  return addCode(); 
557        case -1335224239:  return addDetail(); 
558        default: return super.makeProperty(hash, name);
559        }
560
561      }
562
563      @Override
564      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
565        switch (hash) {
566        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
567        case -1335224239: /*detail*/ return new String[] {"Reference"};
568        default: return super.getTypesForProperty(hash, name);
569        }
570
571      }
572
573      @Override
574      public Base addChild(String name) throws FHIRException {
575        if (name.equals("code")) {
576          return addCode();
577        }
578        else if (name.equals("detail")) {
579          return addDetail();
580        }
581        else
582          return super.addChild(name);
583      }
584
585      public DetectedIssueEvidenceComponent copy() {
586        DetectedIssueEvidenceComponent dst = new DetectedIssueEvidenceComponent();
587        copyValues(dst);
588        return dst;
589      }
590
591      public void copyValues(DetectedIssueEvidenceComponent dst) {
592        super.copyValues(dst);
593        if (code != null) {
594          dst.code = new ArrayList<CodeableConcept>();
595          for (CodeableConcept i : code)
596            dst.code.add(i.copy());
597        };
598        if (detail != null) {
599          dst.detail = new ArrayList<Reference>();
600          for (Reference i : detail)
601            dst.detail.add(i.copy());
602        };
603      }
604
605      @Override
606      public boolean equalsDeep(Base other_) {
607        if (!super.equalsDeep(other_))
608          return false;
609        if (!(other_ instanceof DetectedIssueEvidenceComponent))
610          return false;
611        DetectedIssueEvidenceComponent o = (DetectedIssueEvidenceComponent) other_;
612        return compareDeep(code, o.code, true) && compareDeep(detail, o.detail, true);
613      }
614
615      @Override
616      public boolean equalsShallow(Base other_) {
617        if (!super.equalsShallow(other_))
618          return false;
619        if (!(other_ instanceof DetectedIssueEvidenceComponent))
620          return false;
621        DetectedIssueEvidenceComponent o = (DetectedIssueEvidenceComponent) other_;
622        return true;
623      }
624
625      public boolean isEmpty() {
626        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, detail);
627      }
628
629  public String fhirType() {
630    return "DetectedIssue.evidence";
631
632  }
633
634  }
635
636    @Block()
637    public static class DetectedIssueMitigationComponent extends BackboneElement implements IBaseBackboneElement {
638        /**
639         * Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.
640         */
641        @Child(name = "action", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
642        @Description(shortDefinition="What mitigation?", formalDefinition="Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue." )
643        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/detectedissue-mitigation-action")
644        protected CodeableConcept action;
645
646        /**
647         * Indicates when the mitigating action was documented.
648         */
649        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
650        @Description(shortDefinition="Date committed", formalDefinition="Indicates when the mitigating action was documented." )
651        protected DateTimeType date;
652
653        /**
654         * Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.
655         */
656        @Child(name = "author", type = {Practitioner.class, PractitionerRole.class}, order=3, min=0, max=1, modifier=false, summary=false)
657        @Description(shortDefinition="Who is committing?", formalDefinition="Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring." )
658        protected Reference author;
659
660        private static final long serialVersionUID = -1797436956L;
661
662    /**
663     * Constructor
664     */
665      public DetectedIssueMitigationComponent() {
666        super();
667      }
668
669    /**
670     * Constructor
671     */
672      public DetectedIssueMitigationComponent(CodeableConcept action) {
673        super();
674        this.action = action;
675      }
676
677        /**
678         * @return {@link #action} (Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.)
679         */
680        public CodeableConcept getAction() { 
681          if (this.action == null)
682            if (Configuration.errorOnAutoCreate())
683              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.action");
684            else if (Configuration.doAutoCreate())
685              this.action = new CodeableConcept(); // cc
686          return this.action;
687        }
688
689        public boolean hasAction() { 
690          return this.action != null && !this.action.isEmpty();
691        }
692
693        /**
694         * @param value {@link #action} (Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.)
695         */
696        public DetectedIssueMitigationComponent setAction(CodeableConcept value) { 
697          this.action = value;
698          return this;
699        }
700
701        /**
702         * @return {@link #date} (Indicates when the mitigating action was documented.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
703         */
704        public DateTimeType getDateElement() { 
705          if (this.date == null)
706            if (Configuration.errorOnAutoCreate())
707              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.date");
708            else if (Configuration.doAutoCreate())
709              this.date = new DateTimeType(); // bb
710          return this.date;
711        }
712
713        public boolean hasDateElement() { 
714          return this.date != null && !this.date.isEmpty();
715        }
716
717        public boolean hasDate() { 
718          return this.date != null && !this.date.isEmpty();
719        }
720
721        /**
722         * @param value {@link #date} (Indicates when the mitigating action was documented.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
723         */
724        public DetectedIssueMitigationComponent setDateElement(DateTimeType value) { 
725          this.date = value;
726          return this;
727        }
728
729        /**
730         * @return Indicates when the mitigating action was documented.
731         */
732        public Date getDate() { 
733          return this.date == null ? null : this.date.getValue();
734        }
735
736        /**
737         * @param value Indicates when the mitigating action was documented.
738         */
739        public DetectedIssueMitigationComponent setDate(Date value) { 
740          if (value == null)
741            this.date = null;
742          else {
743            if (this.date == null)
744              this.date = new DateTimeType();
745            this.date.setValue(value);
746          }
747          return this;
748        }
749
750        /**
751         * @return {@link #author} (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.)
752         */
753        public Reference getAuthor() { 
754          if (this.author == null)
755            if (Configuration.errorOnAutoCreate())
756              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.author");
757            else if (Configuration.doAutoCreate())
758              this.author = new Reference(); // cc
759          return this.author;
760        }
761
762        public boolean hasAuthor() { 
763          return this.author != null && !this.author.isEmpty();
764        }
765
766        /**
767         * @param value {@link #author} (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.)
768         */
769        public DetectedIssueMitigationComponent setAuthor(Reference value) { 
770          this.author = value;
771          return this;
772        }
773
774        protected void listChildren(List<Property> children) {
775          super.listChildren(children);
776          children.add(new Property("action", "CodeableConcept", "Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.", 0, 1, action));
777          children.add(new Property("date", "dateTime", "Indicates when the mitigating action was documented.", 0, 1, date));
778          children.add(new Property("author", "Reference(Practitioner|PractitionerRole)", "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.", 0, 1, author));
779        }
780
781        @Override
782        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
783          switch (_hash) {
784          case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.", 0, 1, action);
785          case 3076014: /*date*/  return new Property("date", "dateTime", "Indicates when the mitigating action was documented.", 0, 1, date);
786          case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|PractitionerRole)", "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.", 0, 1, author);
787          default: return super.getNamedProperty(_hash, _name, _checkValid);
788          }
789
790        }
791
792      @Override
793      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
794        switch (hash) {
795        case -1422950858: /*action*/ return this.action == null ? new Base[0] : new Base[] {this.action}; // CodeableConcept
796        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
797        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
798        default: return super.getProperty(hash, name, checkValid);
799        }
800
801      }
802
803      @Override
804      public Base setProperty(int hash, String name, Base value) throws FHIRException {
805        switch (hash) {
806        case -1422950858: // action
807          this.action = castToCodeableConcept(value); // CodeableConcept
808          return value;
809        case 3076014: // date
810          this.date = castToDateTime(value); // DateTimeType
811          return value;
812        case -1406328437: // author
813          this.author = castToReference(value); // Reference
814          return value;
815        default: return super.setProperty(hash, name, value);
816        }
817
818      }
819
820      @Override
821      public Base setProperty(String name, Base value) throws FHIRException {
822        if (name.equals("action")) {
823          this.action = castToCodeableConcept(value); // CodeableConcept
824        } else if (name.equals("date")) {
825          this.date = castToDateTime(value); // DateTimeType
826        } else if (name.equals("author")) {
827          this.author = castToReference(value); // Reference
828        } else
829          return super.setProperty(name, value);
830        return value;
831      }
832
833      @Override
834      public Base makeProperty(int hash, String name) throws FHIRException {
835        switch (hash) {
836        case -1422950858:  return getAction();
837        case 3076014:  return getDateElement();
838        case -1406328437:  return getAuthor();
839        default: return super.makeProperty(hash, name);
840        }
841
842      }
843
844      @Override
845      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
846        switch (hash) {
847        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
848        case 3076014: /*date*/ return new String[] {"dateTime"};
849        case -1406328437: /*author*/ return new String[] {"Reference"};
850        default: return super.getTypesForProperty(hash, name);
851        }
852
853      }
854
855      @Override
856      public Base addChild(String name) throws FHIRException {
857        if (name.equals("action")) {
858          this.action = new CodeableConcept();
859          return this.action;
860        }
861        else if (name.equals("date")) {
862          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.date");
863        }
864        else if (name.equals("author")) {
865          this.author = new Reference();
866          return this.author;
867        }
868        else
869          return super.addChild(name);
870      }
871
872      public DetectedIssueMitigationComponent copy() {
873        DetectedIssueMitigationComponent dst = new DetectedIssueMitigationComponent();
874        copyValues(dst);
875        return dst;
876      }
877
878      public void copyValues(DetectedIssueMitigationComponent dst) {
879        super.copyValues(dst);
880        dst.action = action == null ? null : action.copy();
881        dst.date = date == null ? null : date.copy();
882        dst.author = author == null ? null : author.copy();
883      }
884
885      @Override
886      public boolean equalsDeep(Base other_) {
887        if (!super.equalsDeep(other_))
888          return false;
889        if (!(other_ instanceof DetectedIssueMitigationComponent))
890          return false;
891        DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other_;
892        return compareDeep(action, o.action, true) && compareDeep(date, o.date, true) && compareDeep(author, o.author, true)
893          ;
894      }
895
896      @Override
897      public boolean equalsShallow(Base other_) {
898        if (!super.equalsShallow(other_))
899          return false;
900        if (!(other_ instanceof DetectedIssueMitigationComponent))
901          return false;
902        DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other_;
903        return compareValues(date, o.date, true);
904      }
905
906      public boolean isEmpty() {
907        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(action, date, author);
908      }
909
910  public String fhirType() {
911    return "DetectedIssue.mitigation";
912
913  }
914
915  }
916
917    /**
918     * Business identifier associated with the detected issue record.
919     */
920    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
921    @Description(shortDefinition="Unique id for the detected issue", formalDefinition="Business identifier associated with the detected issue record." )
922    protected List<Identifier> identifier;
923
924    /**
925     * Indicates the status of the detected issue.
926     */
927    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
928    @Description(shortDefinition="registered | preliminary | final | amended +", formalDefinition="Indicates the status of the detected issue." )
929    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-status")
930    protected Enumeration<DetectedIssueStatus> status;
931
932    /**
933     * Identifies the general type of issue identified.
934     */
935    @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
936    @Description(shortDefinition="Issue Category, e.g. drug-drug, duplicate therapy, etc.", formalDefinition="Identifies the general type of issue identified." )
937    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/detectedissue-category")
938    protected CodeableConcept code;
939
940    /**
941     * Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.
942     */
943    @Child(name = "severity", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
944    @Description(shortDefinition="high | moderate | low", formalDefinition="Indicates the degree of importance associated with the identified issue based on the potential impact on the patient." )
945    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/detectedissue-severity")
946    protected Enumeration<DetectedIssueSeverity> severity;
947
948    /**
949     * Indicates the patient whose record the detected issue is associated with.
950     */
951    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=true)
952    @Description(shortDefinition="Associated patient", formalDefinition="Indicates the patient whose record the detected issue is associated with." )
953    protected Reference patient;
954
955    /**
956     * The date or period when the detected issue was initially identified.
957     */
958    @Child(name = "identified", type = {DateTimeType.class, Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
959    @Description(shortDefinition="When identified", formalDefinition="The date or period when the detected issue was initially identified." )
960    protected Type identified;
961
962    /**
963     * Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.
964     */
965    @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Device.class}, order=6, min=0, max=1, modifier=false, summary=true)
966    @Description(shortDefinition="The provider or device that identified the issue", formalDefinition="Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review." )
967    protected Reference author;
968
969    /**
970     * Indicates the resource representing the current activity or proposed activity that is potentially problematic.
971     */
972    @Child(name = "implicated", type = {Reference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
973    @Description(shortDefinition="Problem resource", formalDefinition="Indicates the resource representing the current activity or proposed activity that is potentially problematic." )
974    protected List<Reference> implicated;
975
976    /**
977     * Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.
978     */
979    @Child(name = "evidence", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
980    @Description(shortDefinition="Supporting evidence", formalDefinition="Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport." )
981    protected List<DetectedIssueEvidenceComponent> evidence;
982
983    /**
984     * A textual explanation of the detected issue.
985     */
986    @Child(name = "detail", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
987    @Description(shortDefinition="Description and context", formalDefinition="A textual explanation of the detected issue." )
988    protected StringType detail;
989
990    /**
991     * The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.
992     */
993    @Child(name = "reference", type = {UriType.class}, order=10, min=0, max=1, modifier=false, summary=false)
994    @Description(shortDefinition="Authority for issue", formalDefinition="The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified." )
995    protected UriType reference;
996
997    /**
998     * Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.
999     */
1000    @Child(name = "mitigation", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1001    @Description(shortDefinition="Step taken to address", formalDefinition="Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action." )
1002    protected List<DetectedIssueMitigationComponent> mitigation;
1003
1004    private static final long serialVersionUID = 1928503865L;
1005
1006  /**
1007   * Constructor
1008   */
1009    public DetectedIssue() {
1010      super();
1011    }
1012
1013  /**
1014   * Constructor
1015   */
1016    public DetectedIssue(Enumeration<DetectedIssueStatus> status) {
1017      super();
1018      this.status = status;
1019    }
1020
1021    /**
1022     * @return {@link #identifier} (Business identifier associated with the detected issue record.)
1023     */
1024    public List<Identifier> getIdentifier() { 
1025      if (this.identifier == null)
1026        this.identifier = new ArrayList<Identifier>();
1027      return this.identifier;
1028    }
1029
1030    /**
1031     * @return Returns a reference to <code>this</code> for easy method chaining
1032     */
1033    public DetectedIssue setIdentifier(List<Identifier> theIdentifier) { 
1034      this.identifier = theIdentifier;
1035      return this;
1036    }
1037
1038    public boolean hasIdentifier() { 
1039      if (this.identifier == null)
1040        return false;
1041      for (Identifier item : this.identifier)
1042        if (!item.isEmpty())
1043          return true;
1044      return false;
1045    }
1046
1047    public Identifier addIdentifier() { //3
1048      Identifier t = new Identifier();
1049      if (this.identifier == null)
1050        this.identifier = new ArrayList<Identifier>();
1051      this.identifier.add(t);
1052      return t;
1053    }
1054
1055    public DetectedIssue addIdentifier(Identifier t) { //3
1056      if (t == null)
1057        return this;
1058      if (this.identifier == null)
1059        this.identifier = new ArrayList<Identifier>();
1060      this.identifier.add(t);
1061      return this;
1062    }
1063
1064    /**
1065     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1066     */
1067    public Identifier getIdentifierFirstRep() { 
1068      if (getIdentifier().isEmpty()) {
1069        addIdentifier();
1070      }
1071      return getIdentifier().get(0);
1072    }
1073
1074    /**
1075     * @return {@link #status} (Indicates the status of the detected issue.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1076     */
1077    public Enumeration<DetectedIssueStatus> getStatusElement() { 
1078      if (this.status == null)
1079        if (Configuration.errorOnAutoCreate())
1080          throw new Error("Attempt to auto-create DetectedIssue.status");
1081        else if (Configuration.doAutoCreate())
1082          this.status = new Enumeration<DetectedIssueStatus>(new DetectedIssueStatusEnumFactory()); // bb
1083      return this.status;
1084    }
1085
1086    public boolean hasStatusElement() { 
1087      return this.status != null && !this.status.isEmpty();
1088    }
1089
1090    public boolean hasStatus() { 
1091      return this.status != null && !this.status.isEmpty();
1092    }
1093
1094    /**
1095     * @param value {@link #status} (Indicates the status of the detected issue.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1096     */
1097    public DetectedIssue setStatusElement(Enumeration<DetectedIssueStatus> value) { 
1098      this.status = value;
1099      return this;
1100    }
1101
1102    /**
1103     * @return Indicates the status of the detected issue.
1104     */
1105    public DetectedIssueStatus getStatus() { 
1106      return this.status == null ? null : this.status.getValue();
1107    }
1108
1109    /**
1110     * @param value Indicates the status of the detected issue.
1111     */
1112    public DetectedIssue setStatus(DetectedIssueStatus value) { 
1113        if (this.status == null)
1114          this.status = new Enumeration<DetectedIssueStatus>(new DetectedIssueStatusEnumFactory());
1115        this.status.setValue(value);
1116      return this;
1117    }
1118
1119    /**
1120     * @return {@link #code} (Identifies the general type of issue identified.)
1121     */
1122    public CodeableConcept getCode() { 
1123      if (this.code == null)
1124        if (Configuration.errorOnAutoCreate())
1125          throw new Error("Attempt to auto-create DetectedIssue.code");
1126        else if (Configuration.doAutoCreate())
1127          this.code = new CodeableConcept(); // cc
1128      return this.code;
1129    }
1130
1131    public boolean hasCode() { 
1132      return this.code != null && !this.code.isEmpty();
1133    }
1134
1135    /**
1136     * @param value {@link #code} (Identifies the general type of issue identified.)
1137     */
1138    public DetectedIssue setCode(CodeableConcept value) { 
1139      this.code = value;
1140      return this;
1141    }
1142
1143    /**
1144     * @return {@link #severity} (Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
1145     */
1146    public Enumeration<DetectedIssueSeverity> getSeverityElement() { 
1147      if (this.severity == null)
1148        if (Configuration.errorOnAutoCreate())
1149          throw new Error("Attempt to auto-create DetectedIssue.severity");
1150        else if (Configuration.doAutoCreate())
1151          this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory()); // bb
1152      return this.severity;
1153    }
1154
1155    public boolean hasSeverityElement() { 
1156      return this.severity != null && !this.severity.isEmpty();
1157    }
1158
1159    public boolean hasSeverity() { 
1160      return this.severity != null && !this.severity.isEmpty();
1161    }
1162
1163    /**
1164     * @param value {@link #severity} (Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
1165     */
1166    public DetectedIssue setSeverityElement(Enumeration<DetectedIssueSeverity> value) { 
1167      this.severity = value;
1168      return this;
1169    }
1170
1171    /**
1172     * @return Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.
1173     */
1174    public DetectedIssueSeverity getSeverity() { 
1175      return this.severity == null ? null : this.severity.getValue();
1176    }
1177
1178    /**
1179     * @param value Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.
1180     */
1181    public DetectedIssue setSeverity(DetectedIssueSeverity value) { 
1182      if (value == null)
1183        this.severity = null;
1184      else {
1185        if (this.severity == null)
1186          this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory());
1187        this.severity.setValue(value);
1188      }
1189      return this;
1190    }
1191
1192    /**
1193     * @return {@link #patient} (Indicates the patient whose record the detected issue is associated with.)
1194     */
1195    public Reference getPatient() { 
1196      if (this.patient == null)
1197        if (Configuration.errorOnAutoCreate())
1198          throw new Error("Attempt to auto-create DetectedIssue.patient");
1199        else if (Configuration.doAutoCreate())
1200          this.patient = new Reference(); // cc
1201      return this.patient;
1202    }
1203
1204    public boolean hasPatient() { 
1205      return this.patient != null && !this.patient.isEmpty();
1206    }
1207
1208    /**
1209     * @param value {@link #patient} (Indicates the patient whose record the detected issue is associated with.)
1210     */
1211    public DetectedIssue setPatient(Reference value) { 
1212      this.patient = value;
1213      return this;
1214    }
1215
1216    /**
1217     * @return {@link #identified} (The date or period when the detected issue was initially identified.)
1218     */
1219    public Type getIdentified() { 
1220      return this.identified;
1221    }
1222
1223    /**
1224     * @return {@link #identified} (The date or period when the detected issue was initially identified.)
1225     */
1226    public DateTimeType getIdentifiedDateTimeType() throws FHIRException { 
1227      if (this.identified == null)
1228        this.identified = new DateTimeType();
1229      if (!(this.identified instanceof DateTimeType))
1230        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.identified.getClass().getName()+" was encountered");
1231      return (DateTimeType) this.identified;
1232    }
1233
1234    public boolean hasIdentifiedDateTimeType() { 
1235      return this != null && this.identified instanceof DateTimeType;
1236    }
1237
1238    /**
1239     * @return {@link #identified} (The date or period when the detected issue was initially identified.)
1240     */
1241    public Period getIdentifiedPeriod() throws FHIRException { 
1242      if (this.identified == null)
1243        this.identified = new Period();
1244      if (!(this.identified instanceof Period))
1245        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.identified.getClass().getName()+" was encountered");
1246      return (Period) this.identified;
1247    }
1248
1249    public boolean hasIdentifiedPeriod() { 
1250      return this != null && this.identified instanceof Period;
1251    }
1252
1253    public boolean hasIdentified() { 
1254      return this.identified != null && !this.identified.isEmpty();
1255    }
1256
1257    /**
1258     * @param value {@link #identified} (The date or period when the detected issue was initially identified.)
1259     */
1260    public DetectedIssue setIdentified(Type value) { 
1261      if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1262        throw new Error("Not the right type for DetectedIssue.identified[x]: "+value.fhirType());
1263      this.identified = value;
1264      return this;
1265    }
1266
1267    /**
1268     * @return {@link #author} (Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.)
1269     */
1270    public Reference getAuthor() { 
1271      if (this.author == null)
1272        if (Configuration.errorOnAutoCreate())
1273          throw new Error("Attempt to auto-create DetectedIssue.author");
1274        else if (Configuration.doAutoCreate())
1275          this.author = new Reference(); // cc
1276      return this.author;
1277    }
1278
1279    public boolean hasAuthor() { 
1280      return this.author != null && !this.author.isEmpty();
1281    }
1282
1283    /**
1284     * @param value {@link #author} (Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.)
1285     */
1286    public DetectedIssue setAuthor(Reference value) { 
1287      this.author = value;
1288      return this;
1289    }
1290
1291    /**
1292     * @return {@link #implicated} (Indicates the resource representing the current activity or proposed activity that is potentially problematic.)
1293     */
1294    public List<Reference> getImplicated() { 
1295      if (this.implicated == null)
1296        this.implicated = new ArrayList<Reference>();
1297      return this.implicated;
1298    }
1299
1300    /**
1301     * @return Returns a reference to <code>this</code> for easy method chaining
1302     */
1303    public DetectedIssue setImplicated(List<Reference> theImplicated) { 
1304      this.implicated = theImplicated;
1305      return this;
1306    }
1307
1308    public boolean hasImplicated() { 
1309      if (this.implicated == null)
1310        return false;
1311      for (Reference item : this.implicated)
1312        if (!item.isEmpty())
1313          return true;
1314      return false;
1315    }
1316
1317    public Reference addImplicated() { //3
1318      Reference t = new Reference();
1319      if (this.implicated == null)
1320        this.implicated = new ArrayList<Reference>();
1321      this.implicated.add(t);
1322      return t;
1323    }
1324
1325    public DetectedIssue addImplicated(Reference t) { //3
1326      if (t == null)
1327        return this;
1328      if (this.implicated == null)
1329        this.implicated = new ArrayList<Reference>();
1330      this.implicated.add(t);
1331      return this;
1332    }
1333
1334    /**
1335     * @return The first repetition of repeating field {@link #implicated}, creating it if it does not already exist
1336     */
1337    public Reference getImplicatedFirstRep() { 
1338      if (getImplicated().isEmpty()) {
1339        addImplicated();
1340      }
1341      return getImplicated().get(0);
1342    }
1343
1344    /**
1345     * @return {@link #evidence} (Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.)
1346     */
1347    public List<DetectedIssueEvidenceComponent> getEvidence() { 
1348      if (this.evidence == null)
1349        this.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1350      return this.evidence;
1351    }
1352
1353    /**
1354     * @return Returns a reference to <code>this</code> for easy method chaining
1355     */
1356    public DetectedIssue setEvidence(List<DetectedIssueEvidenceComponent> theEvidence) { 
1357      this.evidence = theEvidence;
1358      return this;
1359    }
1360
1361    public boolean hasEvidence() { 
1362      if (this.evidence == null)
1363        return false;
1364      for (DetectedIssueEvidenceComponent item : this.evidence)
1365        if (!item.isEmpty())
1366          return true;
1367      return false;
1368    }
1369
1370    public DetectedIssueEvidenceComponent addEvidence() { //3
1371      DetectedIssueEvidenceComponent t = new DetectedIssueEvidenceComponent();
1372      if (this.evidence == null)
1373        this.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1374      this.evidence.add(t);
1375      return t;
1376    }
1377
1378    public DetectedIssue addEvidence(DetectedIssueEvidenceComponent t) { //3
1379      if (t == null)
1380        return this;
1381      if (this.evidence == null)
1382        this.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1383      this.evidence.add(t);
1384      return this;
1385    }
1386
1387    /**
1388     * @return The first repetition of repeating field {@link #evidence}, creating it if it does not already exist
1389     */
1390    public DetectedIssueEvidenceComponent getEvidenceFirstRep() { 
1391      if (getEvidence().isEmpty()) {
1392        addEvidence();
1393      }
1394      return getEvidence().get(0);
1395    }
1396
1397    /**
1398     * @return {@link #detail} (A textual explanation of the detected issue.). This is the underlying object with id, value and extensions. The accessor "getDetail" gives direct access to the value
1399     */
1400    public StringType getDetailElement() { 
1401      if (this.detail == null)
1402        if (Configuration.errorOnAutoCreate())
1403          throw new Error("Attempt to auto-create DetectedIssue.detail");
1404        else if (Configuration.doAutoCreate())
1405          this.detail = new StringType(); // bb
1406      return this.detail;
1407    }
1408
1409    public boolean hasDetailElement() { 
1410      return this.detail != null && !this.detail.isEmpty();
1411    }
1412
1413    public boolean hasDetail() { 
1414      return this.detail != null && !this.detail.isEmpty();
1415    }
1416
1417    /**
1418     * @param value {@link #detail} (A textual explanation of the detected issue.). This is the underlying object with id, value and extensions. The accessor "getDetail" gives direct access to the value
1419     */
1420    public DetectedIssue setDetailElement(StringType value) { 
1421      this.detail = value;
1422      return this;
1423    }
1424
1425    /**
1426     * @return A textual explanation of the detected issue.
1427     */
1428    public String getDetail() { 
1429      return this.detail == null ? null : this.detail.getValue();
1430    }
1431
1432    /**
1433     * @param value A textual explanation of the detected issue.
1434     */
1435    public DetectedIssue setDetail(String value) { 
1436      if (Utilities.noString(value))
1437        this.detail = null;
1438      else {
1439        if (this.detail == null)
1440          this.detail = new StringType();
1441        this.detail.setValue(value);
1442      }
1443      return this;
1444    }
1445
1446    /**
1447     * @return {@link #reference} (The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value
1448     */
1449    public UriType getReferenceElement() { 
1450      if (this.reference == null)
1451        if (Configuration.errorOnAutoCreate())
1452          throw new Error("Attempt to auto-create DetectedIssue.reference");
1453        else if (Configuration.doAutoCreate())
1454          this.reference = new UriType(); // bb
1455      return this.reference;
1456    }
1457
1458    public boolean hasReferenceElement() { 
1459      return this.reference != null && !this.reference.isEmpty();
1460    }
1461
1462    public boolean hasReference() { 
1463      return this.reference != null && !this.reference.isEmpty();
1464    }
1465
1466    /**
1467     * @param value {@link #reference} (The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value
1468     */
1469    public DetectedIssue setReferenceElement(UriType value) { 
1470      this.reference = value;
1471      return this;
1472    }
1473
1474    /**
1475     * @return The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.
1476     */
1477    public String getReference() { 
1478      return this.reference == null ? null : this.reference.getValue();
1479    }
1480
1481    /**
1482     * @param value The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.
1483     */
1484    public DetectedIssue setReference(String value) { 
1485      if (Utilities.noString(value))
1486        this.reference = null;
1487      else {
1488        if (this.reference == null)
1489          this.reference = new UriType();
1490        this.reference.setValue(value);
1491      }
1492      return this;
1493    }
1494
1495    /**
1496     * @return {@link #mitigation} (Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.)
1497     */
1498    public List<DetectedIssueMitigationComponent> getMitigation() { 
1499      if (this.mitigation == null)
1500        this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1501      return this.mitigation;
1502    }
1503
1504    /**
1505     * @return Returns a reference to <code>this</code> for easy method chaining
1506     */
1507    public DetectedIssue setMitigation(List<DetectedIssueMitigationComponent> theMitigation) { 
1508      this.mitigation = theMitigation;
1509      return this;
1510    }
1511
1512    public boolean hasMitigation() { 
1513      if (this.mitigation == null)
1514        return false;
1515      for (DetectedIssueMitigationComponent item : this.mitigation)
1516        if (!item.isEmpty())
1517          return true;
1518      return false;
1519    }
1520
1521    public DetectedIssueMitigationComponent addMitigation() { //3
1522      DetectedIssueMitigationComponent t = new DetectedIssueMitigationComponent();
1523      if (this.mitigation == null)
1524        this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1525      this.mitigation.add(t);
1526      return t;
1527    }
1528
1529    public DetectedIssue addMitigation(DetectedIssueMitigationComponent t) { //3
1530      if (t == null)
1531        return this;
1532      if (this.mitigation == null)
1533        this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1534      this.mitigation.add(t);
1535      return this;
1536    }
1537
1538    /**
1539     * @return The first repetition of repeating field {@link #mitigation}, creating it if it does not already exist
1540     */
1541    public DetectedIssueMitigationComponent getMitigationFirstRep() { 
1542      if (getMitigation().isEmpty()) {
1543        addMitigation();
1544      }
1545      return getMitigation().get(0);
1546    }
1547
1548      protected void listChildren(List<Property> children) {
1549        super.listChildren(children);
1550        children.add(new Property("identifier", "Identifier", "Business identifier associated with the detected issue record.", 0, java.lang.Integer.MAX_VALUE, identifier));
1551        children.add(new Property("status", "code", "Indicates the status of the detected issue.", 0, 1, status));
1552        children.add(new Property("code", "CodeableConcept", "Identifies the general type of issue identified.", 0, 1, code));
1553        children.add(new Property("severity", "code", "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.", 0, 1, severity));
1554        children.add(new Property("patient", "Reference(Patient)", "Indicates the patient whose record the detected issue is associated with.", 0, 1, patient));
1555        children.add(new Property("identified[x]", "dateTime|Period", "The date or period when the detected issue was initially identified.", 0, 1, identified));
1556        children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Device)", "Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.", 0, 1, author));
1557        children.add(new Property("implicated", "Reference(Any)", "Indicates the resource representing the current activity or proposed activity that is potentially problematic.", 0, java.lang.Integer.MAX_VALUE, implicated));
1558        children.add(new Property("evidence", "", "Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.", 0, java.lang.Integer.MAX_VALUE, evidence));
1559        children.add(new Property("detail", "string", "A textual explanation of the detected issue.", 0, 1, detail));
1560        children.add(new Property("reference", "uri", "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.", 0, 1, reference));
1561        children.add(new Property("mitigation", "", "Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.", 0, java.lang.Integer.MAX_VALUE, mitigation));
1562      }
1563
1564      @Override
1565      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1566        switch (_hash) {
1567        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier associated with the detected issue record.", 0, java.lang.Integer.MAX_VALUE, identifier);
1568        case -892481550: /*status*/  return new Property("status", "code", "Indicates the status of the detected issue.", 0, 1, status);
1569        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Identifies the general type of issue identified.", 0, 1, code);
1570        case 1478300413: /*severity*/  return new Property("severity", "code", "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.", 0, 1, severity);
1571        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Indicates the patient whose record the detected issue is associated with.", 0, 1, patient);
1572        case 569355781: /*identified[x]*/  return new Property("identified[x]", "dateTime|Period", "The date or period when the detected issue was initially identified.", 0, 1, identified);
1573        case -1618432869: /*identified*/  return new Property("identified[x]", "dateTime|Period", "The date or period when the detected issue was initially identified.", 0, 1, identified);
1574        case -968788650: /*identifiedDateTime*/  return new Property("identified[x]", "dateTime|Period", "The date or period when the detected issue was initially identified.", 0, 1, identified);
1575        case 520482364: /*identifiedPeriod*/  return new Property("identified[x]", "dateTime|Period", "The date or period when the detected issue was initially identified.", 0, 1, identified);
1576        case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|PractitionerRole|Device)", "Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.", 0, 1, author);
1577        case -810216884: /*implicated*/  return new Property("implicated", "Reference(Any)", "Indicates the resource representing the current activity or proposed activity that is potentially problematic.", 0, java.lang.Integer.MAX_VALUE, implicated);
1578        case 382967383: /*evidence*/  return new Property("evidence", "", "Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.", 0, java.lang.Integer.MAX_VALUE, evidence);
1579        case -1335224239: /*detail*/  return new Property("detail", "string", "A textual explanation of the detected issue.", 0, 1, detail);
1580        case -925155509: /*reference*/  return new Property("reference", "uri", "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.", 0, 1, reference);
1581        case 1293793087: /*mitigation*/  return new Property("mitigation", "", "Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.", 0, java.lang.Integer.MAX_VALUE, mitigation);
1582        default: return super.getNamedProperty(_hash, _name, _checkValid);
1583        }
1584
1585      }
1586
1587      @Override
1588      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1589        switch (hash) {
1590        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1591        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DetectedIssueStatus>
1592        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1593        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<DetectedIssueSeverity>
1594        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1595        case -1618432869: /*identified*/ return this.identified == null ? new Base[0] : new Base[] {this.identified}; // Type
1596        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
1597        case -810216884: /*implicated*/ return this.implicated == null ? new Base[0] : this.implicated.toArray(new Base[this.implicated.size()]); // Reference
1598        case 382967383: /*evidence*/ return this.evidence == null ? new Base[0] : this.evidence.toArray(new Base[this.evidence.size()]); // DetectedIssueEvidenceComponent
1599        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // StringType
1600        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // UriType
1601        case 1293793087: /*mitigation*/ return this.mitigation == null ? new Base[0] : this.mitigation.toArray(new Base[this.mitigation.size()]); // DetectedIssueMitigationComponent
1602        default: return super.getProperty(hash, name, checkValid);
1603        }
1604
1605      }
1606
1607      @Override
1608      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1609        switch (hash) {
1610        case -1618432855: // identifier
1611          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1612          return value;
1613        case -892481550: // status
1614          value = new DetectedIssueStatusEnumFactory().fromType(castToCode(value));
1615          this.status = (Enumeration) value; // Enumeration<DetectedIssueStatus>
1616          return value;
1617        case 3059181: // code
1618          this.code = castToCodeableConcept(value); // CodeableConcept
1619          return value;
1620        case 1478300413: // severity
1621          value = new DetectedIssueSeverityEnumFactory().fromType(castToCode(value));
1622          this.severity = (Enumeration) value; // Enumeration<DetectedIssueSeverity>
1623          return value;
1624        case -791418107: // patient
1625          this.patient = castToReference(value); // Reference
1626          return value;
1627        case -1618432869: // identified
1628          this.identified = castToType(value); // Type
1629          return value;
1630        case -1406328437: // author
1631          this.author = castToReference(value); // Reference
1632          return value;
1633        case -810216884: // implicated
1634          this.getImplicated().add(castToReference(value)); // Reference
1635          return value;
1636        case 382967383: // evidence
1637          this.getEvidence().add((DetectedIssueEvidenceComponent) value); // DetectedIssueEvidenceComponent
1638          return value;
1639        case -1335224239: // detail
1640          this.detail = castToString(value); // StringType
1641          return value;
1642        case -925155509: // reference
1643          this.reference = castToUri(value); // UriType
1644          return value;
1645        case 1293793087: // mitigation
1646          this.getMitigation().add((DetectedIssueMitigationComponent) value); // DetectedIssueMitigationComponent
1647          return value;
1648        default: return super.setProperty(hash, name, value);
1649        }
1650
1651      }
1652
1653      @Override
1654      public Base setProperty(String name, Base value) throws FHIRException {
1655        if (name.equals("identifier")) {
1656          this.getIdentifier().add(castToIdentifier(value));
1657        } else if (name.equals("status")) {
1658          value = new DetectedIssueStatusEnumFactory().fromType(castToCode(value));
1659          this.status = (Enumeration) value; // Enumeration<DetectedIssueStatus>
1660        } else if (name.equals("code")) {
1661          this.code = castToCodeableConcept(value); // CodeableConcept
1662        } else if (name.equals("severity")) {
1663          value = new DetectedIssueSeverityEnumFactory().fromType(castToCode(value));
1664          this.severity = (Enumeration) value; // Enumeration<DetectedIssueSeverity>
1665        } else if (name.equals("patient")) {
1666          this.patient = castToReference(value); // Reference
1667        } else if (name.equals("identified[x]")) {
1668          this.identified = castToType(value); // Type
1669        } else if (name.equals("author")) {
1670          this.author = castToReference(value); // Reference
1671        } else if (name.equals("implicated")) {
1672          this.getImplicated().add(castToReference(value));
1673        } else if (name.equals("evidence")) {
1674          this.getEvidence().add((DetectedIssueEvidenceComponent) value);
1675        } else if (name.equals("detail")) {
1676          this.detail = castToString(value); // StringType
1677        } else if (name.equals("reference")) {
1678          this.reference = castToUri(value); // UriType
1679        } else if (name.equals("mitigation")) {
1680          this.getMitigation().add((DetectedIssueMitigationComponent) value);
1681        } else
1682          return super.setProperty(name, value);
1683        return value;
1684      }
1685
1686      @Override
1687      public Base makeProperty(int hash, String name) throws FHIRException {
1688        switch (hash) {
1689        case -1618432855:  return addIdentifier(); 
1690        case -892481550:  return getStatusElement();
1691        case 3059181:  return getCode();
1692        case 1478300413:  return getSeverityElement();
1693        case -791418107:  return getPatient();
1694        case 569355781:  return getIdentified();
1695        case -1618432869:  return getIdentified();
1696        case -1406328437:  return getAuthor();
1697        case -810216884:  return addImplicated(); 
1698        case 382967383:  return addEvidence(); 
1699        case -1335224239:  return getDetailElement();
1700        case -925155509:  return getReferenceElement();
1701        case 1293793087:  return addMitigation(); 
1702        default: return super.makeProperty(hash, name);
1703        }
1704
1705      }
1706
1707      @Override
1708      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1709        switch (hash) {
1710        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1711        case -892481550: /*status*/ return new String[] {"code"};
1712        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1713        case 1478300413: /*severity*/ return new String[] {"code"};
1714        case -791418107: /*patient*/ return new String[] {"Reference"};
1715        case -1618432869: /*identified*/ return new String[] {"dateTime", "Period"};
1716        case -1406328437: /*author*/ return new String[] {"Reference"};
1717        case -810216884: /*implicated*/ return new String[] {"Reference"};
1718        case 382967383: /*evidence*/ return new String[] {};
1719        case -1335224239: /*detail*/ return new String[] {"string"};
1720        case -925155509: /*reference*/ return new String[] {"uri"};
1721        case 1293793087: /*mitigation*/ return new String[] {};
1722        default: return super.getTypesForProperty(hash, name);
1723        }
1724
1725      }
1726
1727      @Override
1728      public Base addChild(String name) throws FHIRException {
1729        if (name.equals("identifier")) {
1730          return addIdentifier();
1731        }
1732        else if (name.equals("status")) {
1733          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.status");
1734        }
1735        else if (name.equals("code")) {
1736          this.code = new CodeableConcept();
1737          return this.code;
1738        }
1739        else if (name.equals("severity")) {
1740          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.severity");
1741        }
1742        else if (name.equals("patient")) {
1743          this.patient = new Reference();
1744          return this.patient;
1745        }
1746        else if (name.equals("identifiedDateTime")) {
1747          this.identified = new DateTimeType();
1748          return this.identified;
1749        }
1750        else if (name.equals("identifiedPeriod")) {
1751          this.identified = new Period();
1752          return this.identified;
1753        }
1754        else if (name.equals("author")) {
1755          this.author = new Reference();
1756          return this.author;
1757        }
1758        else if (name.equals("implicated")) {
1759          return addImplicated();
1760        }
1761        else if (name.equals("evidence")) {
1762          return addEvidence();
1763        }
1764        else if (name.equals("detail")) {
1765          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.detail");
1766        }
1767        else if (name.equals("reference")) {
1768          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.reference");
1769        }
1770        else if (name.equals("mitigation")) {
1771          return addMitigation();
1772        }
1773        else
1774          return super.addChild(name);
1775      }
1776
1777  public String fhirType() {
1778    return "DetectedIssue";
1779
1780  }
1781
1782      public DetectedIssue copy() {
1783        DetectedIssue dst = new DetectedIssue();
1784        copyValues(dst);
1785        return dst;
1786      }
1787
1788      public void copyValues(DetectedIssue dst) {
1789        super.copyValues(dst);
1790        if (identifier != null) {
1791          dst.identifier = new ArrayList<Identifier>();
1792          for (Identifier i : identifier)
1793            dst.identifier.add(i.copy());
1794        };
1795        dst.status = status == null ? null : status.copy();
1796        dst.code = code == null ? null : code.copy();
1797        dst.severity = severity == null ? null : severity.copy();
1798        dst.patient = patient == null ? null : patient.copy();
1799        dst.identified = identified == null ? null : identified.copy();
1800        dst.author = author == null ? null : author.copy();
1801        if (implicated != null) {
1802          dst.implicated = new ArrayList<Reference>();
1803          for (Reference i : implicated)
1804            dst.implicated.add(i.copy());
1805        };
1806        if (evidence != null) {
1807          dst.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1808          for (DetectedIssueEvidenceComponent i : evidence)
1809            dst.evidence.add(i.copy());
1810        };
1811        dst.detail = detail == null ? null : detail.copy();
1812        dst.reference = reference == null ? null : reference.copy();
1813        if (mitigation != null) {
1814          dst.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1815          for (DetectedIssueMitigationComponent i : mitigation)
1816            dst.mitigation.add(i.copy());
1817        };
1818      }
1819
1820      protected DetectedIssue typedCopy() {
1821        return copy();
1822      }
1823
1824      @Override
1825      public boolean equalsDeep(Base other_) {
1826        if (!super.equalsDeep(other_))
1827          return false;
1828        if (!(other_ instanceof DetectedIssue))
1829          return false;
1830        DetectedIssue o = (DetectedIssue) other_;
1831        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(code, o.code, true)
1832           && compareDeep(severity, o.severity, true) && compareDeep(patient, o.patient, true) && compareDeep(identified, o.identified, true)
1833           && compareDeep(author, o.author, true) && compareDeep(implicated, o.implicated, true) && compareDeep(evidence, o.evidence, true)
1834           && compareDeep(detail, o.detail, true) && compareDeep(reference, o.reference, true) && compareDeep(mitigation, o.mitigation, true)
1835          ;
1836      }
1837
1838      @Override
1839      public boolean equalsShallow(Base other_) {
1840        if (!super.equalsShallow(other_))
1841          return false;
1842        if (!(other_ instanceof DetectedIssue))
1843          return false;
1844        DetectedIssue o = (DetectedIssue) other_;
1845        return compareValues(status, o.status, true) && compareValues(severity, o.severity, true) && compareValues(detail, o.detail, true)
1846           && compareValues(reference, o.reference, true);
1847      }
1848
1849      public boolean isEmpty() {
1850        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, code
1851          , severity, patient, identified, author, implicated, evidence, detail, reference
1852          , mitigation);
1853      }
1854
1855  @Override
1856  public ResourceType getResourceType() {
1857    return ResourceType.DetectedIssue;
1858   }
1859
1860 /**
1861   * Search parameter: <b>identifier</b>
1862   * <p>
1863   * Description: <b>Unique id for the detected issue</b><br>
1864   * Type: <b>token</b><br>
1865   * Path: <b>DetectedIssue.identifier</b><br>
1866   * </p>
1867   */
1868  @SearchParamDefinition(name="identifier", path="DetectedIssue.identifier", description="Unique id for the detected issue", type="token" )
1869  public static final String SP_IDENTIFIER = "identifier";
1870 /**
1871   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1872   * <p>
1873   * Description: <b>Unique id for the detected issue</b><br>
1874   * Type: <b>token</b><br>
1875   * Path: <b>DetectedIssue.identifier</b><br>
1876   * </p>
1877   */
1878  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1879
1880 /**
1881   * Search parameter: <b>code</b>
1882   * <p>
1883   * Description: <b>Issue Category, e.g. drug-drug, duplicate therapy, etc.</b><br>
1884   * Type: <b>token</b><br>
1885   * Path: <b>DetectedIssue.code</b><br>
1886   * </p>
1887   */
1888  @SearchParamDefinition(name="code", path="DetectedIssue.code", description="Issue Category, e.g. drug-drug, duplicate therapy, etc.", type="token" )
1889  public static final String SP_CODE = "code";
1890 /**
1891   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1892   * <p>
1893   * Description: <b>Issue Category, e.g. drug-drug, duplicate therapy, etc.</b><br>
1894   * Type: <b>token</b><br>
1895   * Path: <b>DetectedIssue.code</b><br>
1896   * </p>
1897   */
1898  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1899
1900 /**
1901   * Search parameter: <b>identified</b>
1902   * <p>
1903   * Description: <b>When identified</b><br>
1904   * Type: <b>date</b><br>
1905   * Path: <b>DetectedIssue.identified[x]</b><br>
1906   * </p>
1907   */
1908  @SearchParamDefinition(name="identified", path="DetectedIssue.identified", description="When identified", type="date" )
1909  public static final String SP_IDENTIFIED = "identified";
1910 /**
1911   * <b>Fluent Client</b> search parameter constant for <b>identified</b>
1912   * <p>
1913   * Description: <b>When identified</b><br>
1914   * Type: <b>date</b><br>
1915   * Path: <b>DetectedIssue.identified[x]</b><br>
1916   * </p>
1917   */
1918  public static final ca.uhn.fhir.rest.gclient.DateClientParam IDENTIFIED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_IDENTIFIED);
1919
1920 /**
1921   * Search parameter: <b>patient</b>
1922   * <p>
1923   * Description: <b>Associated patient</b><br>
1924   * Type: <b>reference</b><br>
1925   * Path: <b>DetectedIssue.patient</b><br>
1926   * </p>
1927   */
1928  @SearchParamDefinition(name="patient", path="DetectedIssue.patient", description="Associated patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1929  public static final String SP_PATIENT = "patient";
1930 /**
1931   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1932   * <p>
1933   * Description: <b>Associated patient</b><br>
1934   * Type: <b>reference</b><br>
1935   * Path: <b>DetectedIssue.patient</b><br>
1936   * </p>
1937   */
1938  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1939
1940/**
1941   * Constant for fluent queries to be used to add include statements. Specifies
1942   * the path value of "<b>DetectedIssue:patient</b>".
1943   */
1944  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DetectedIssue:patient").toLocked();
1945
1946 /**
1947   * Search parameter: <b>author</b>
1948   * <p>
1949   * Description: <b>The provider or device that identified the issue</b><br>
1950   * Type: <b>reference</b><br>
1951   * Path: <b>DetectedIssue.author</b><br>
1952   * </p>
1953   */
1954  @SearchParamDefinition(name="author", path="DetectedIssue.author", description="The provider or device that identified the issue", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Practitioner.class, PractitionerRole.class } )
1955  public static final String SP_AUTHOR = "author";
1956 /**
1957   * <b>Fluent Client</b> search parameter constant for <b>author</b>
1958   * <p>
1959   * Description: <b>The provider or device that identified the issue</b><br>
1960   * Type: <b>reference</b><br>
1961   * Path: <b>DetectedIssue.author</b><br>
1962   * </p>
1963   */
1964  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
1965
1966/**
1967   * Constant for fluent queries to be used to add include statements. Specifies
1968   * the path value of "<b>DetectedIssue:author</b>".
1969   */
1970  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("DetectedIssue:author").toLocked();
1971
1972 /**
1973   * Search parameter: <b>implicated</b>
1974   * <p>
1975   * Description: <b>Problem resource</b><br>
1976   * Type: <b>reference</b><br>
1977   * Path: <b>DetectedIssue.implicated</b><br>
1978   * </p>
1979   */
1980  @SearchParamDefinition(name="implicated", path="DetectedIssue.implicated", description="Problem resource", type="reference" )
1981  public static final String SP_IMPLICATED = "implicated";
1982 /**
1983   * <b>Fluent Client</b> search parameter constant for <b>implicated</b>
1984   * <p>
1985   * Description: <b>Problem resource</b><br>
1986   * Type: <b>reference</b><br>
1987   * Path: <b>DetectedIssue.implicated</b><br>
1988   * </p>
1989   */
1990  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam IMPLICATED = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_IMPLICATED);
1991
1992/**
1993   * Constant for fluent queries to be used to add include statements. Specifies
1994   * the path value of "<b>DetectedIssue:implicated</b>".
1995   */
1996  public static final ca.uhn.fhir.model.api.Include INCLUDE_IMPLICATED = new ca.uhn.fhir.model.api.Include("DetectedIssue:implicated").toLocked();
1997
1998
1999}
2000