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