001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
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/Profile/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.
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 system does not know which of the status values currently applies for this request. Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, but the authoring 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.";
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 system does not know which of the status values currently applies for this request. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring 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 DetectedIssueMitigationComponent extends BackboneElement implements IBaseBackboneElement {
349        /**
350         * Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.
351         */
352        @Child(name = "action", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
353        @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." )
354        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/detectedissue-mitigation-action")
355        protected CodeableConcept action;
356
357        /**
358         * Indicates when the mitigating action was documented.
359         */
360        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
361        @Description(shortDefinition="Date committed", formalDefinition="Indicates when the mitigating action was documented." )
362        protected DateTimeType date;
363
364        /**
365         * Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.
366         */
367        @Child(name = "author", type = {Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=false)
368        @Description(shortDefinition="Who is committing?", formalDefinition="Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring." )
369        protected Reference author;
370
371        /**
372         * 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.)
373         */
374        protected Practitioner authorTarget;
375
376        private static final long serialVersionUID = -1994768436L;
377
378    /**
379     * Constructor
380     */
381      public DetectedIssueMitigationComponent() {
382        super();
383      }
384
385    /**
386     * Constructor
387     */
388      public DetectedIssueMitigationComponent(CodeableConcept action) {
389        super();
390        this.action = action;
391      }
392
393        /**
394         * @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.)
395         */
396        public CodeableConcept getAction() { 
397          if (this.action == null)
398            if (Configuration.errorOnAutoCreate())
399              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.action");
400            else if (Configuration.doAutoCreate())
401              this.action = new CodeableConcept(); // cc
402          return this.action;
403        }
404
405        public boolean hasAction() { 
406          return this.action != null && !this.action.isEmpty();
407        }
408
409        /**
410         * @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.)
411         */
412        public DetectedIssueMitigationComponent setAction(CodeableConcept value) { 
413          this.action = value;
414          return this;
415        }
416
417        /**
418         * @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
419         */
420        public DateTimeType getDateElement() { 
421          if (this.date == null)
422            if (Configuration.errorOnAutoCreate())
423              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.date");
424            else if (Configuration.doAutoCreate())
425              this.date = new DateTimeType(); // bb
426          return this.date;
427        }
428
429        public boolean hasDateElement() { 
430          return this.date != null && !this.date.isEmpty();
431        }
432
433        public boolean hasDate() { 
434          return this.date != null && !this.date.isEmpty();
435        }
436
437        /**
438         * @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
439         */
440        public DetectedIssueMitigationComponent setDateElement(DateTimeType value) { 
441          this.date = value;
442          return this;
443        }
444
445        /**
446         * @return Indicates when the mitigating action was documented.
447         */
448        public Date getDate() { 
449          return this.date == null ? null : this.date.getValue();
450        }
451
452        /**
453         * @param value Indicates when the mitigating action was documented.
454         */
455        public DetectedIssueMitigationComponent setDate(Date value) { 
456          if (value == null)
457            this.date = null;
458          else {
459            if (this.date == null)
460              this.date = new DateTimeType();
461            this.date.setValue(value);
462          }
463          return this;
464        }
465
466        /**
467         * @return {@link #author} (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.)
468         */
469        public Reference getAuthor() { 
470          if (this.author == null)
471            if (Configuration.errorOnAutoCreate())
472              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.author");
473            else if (Configuration.doAutoCreate())
474              this.author = new Reference(); // cc
475          return this.author;
476        }
477
478        public boolean hasAuthor() { 
479          return this.author != null && !this.author.isEmpty();
480        }
481
482        /**
483         * @param value {@link #author} (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.)
484         */
485        public DetectedIssueMitigationComponent setAuthor(Reference value) { 
486          this.author = value;
487          return this;
488        }
489
490        /**
491         * @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.)
492         */
493        public Practitioner getAuthorTarget() { 
494          if (this.authorTarget == null)
495            if (Configuration.errorOnAutoCreate())
496              throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.author");
497            else if (Configuration.doAutoCreate())
498              this.authorTarget = new Practitioner(); // aa
499          return this.authorTarget;
500        }
501
502        /**
503         * @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.)
504         */
505        public DetectedIssueMitigationComponent setAuthorTarget(Practitioner value) { 
506          this.authorTarget = value;
507          return this;
508        }
509
510        protected void listChildren(List<Property> childrenList) {
511          super.listChildren(childrenList);
512          childrenList.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, java.lang.Integer.MAX_VALUE, action));
513          childrenList.add(new Property("date", "dateTime", "Indicates when the mitigating action was documented.", 0, java.lang.Integer.MAX_VALUE, date));
514          childrenList.add(new Property("author", "Reference(Practitioner)", "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.", 0, java.lang.Integer.MAX_VALUE, author));
515        }
516
517      @Override
518      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
519        switch (hash) {
520        case -1422950858: /*action*/ return this.action == null ? new Base[0] : new Base[] {this.action}; // CodeableConcept
521        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
522        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
523        default: return super.getProperty(hash, name, checkValid);
524        }
525
526      }
527
528      @Override
529      public Base setProperty(int hash, String name, Base value) throws FHIRException {
530        switch (hash) {
531        case -1422950858: // action
532          this.action = castToCodeableConcept(value); // CodeableConcept
533          return value;
534        case 3076014: // date
535          this.date = castToDateTime(value); // DateTimeType
536          return value;
537        case -1406328437: // author
538          this.author = castToReference(value); // Reference
539          return value;
540        default: return super.setProperty(hash, name, value);
541        }
542
543      }
544
545      @Override
546      public Base setProperty(String name, Base value) throws FHIRException {
547        if (name.equals("action")) {
548          this.action = castToCodeableConcept(value); // CodeableConcept
549        } else if (name.equals("date")) {
550          this.date = castToDateTime(value); // DateTimeType
551        } else if (name.equals("author")) {
552          this.author = castToReference(value); // Reference
553        } else
554          return super.setProperty(name, value);
555        return value;
556      }
557
558      @Override
559      public Base makeProperty(int hash, String name) throws FHIRException {
560        switch (hash) {
561        case -1422950858:  return getAction(); 
562        case 3076014:  return getDateElement();
563        case -1406328437:  return getAuthor(); 
564        default: return super.makeProperty(hash, name);
565        }
566
567      }
568
569      @Override
570      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
571        switch (hash) {
572        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
573        case 3076014: /*date*/ return new String[] {"dateTime"};
574        case -1406328437: /*author*/ return new String[] {"Reference"};
575        default: return super.getTypesForProperty(hash, name);
576        }
577
578      }
579
580      @Override
581      public Base addChild(String name) throws FHIRException {
582        if (name.equals("action")) {
583          this.action = new CodeableConcept();
584          return this.action;
585        }
586        else if (name.equals("date")) {
587          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.date");
588        }
589        else if (name.equals("author")) {
590          this.author = new Reference();
591          return this.author;
592        }
593        else
594          return super.addChild(name);
595      }
596
597      public DetectedIssueMitigationComponent copy() {
598        DetectedIssueMitigationComponent dst = new DetectedIssueMitigationComponent();
599        copyValues(dst);
600        dst.action = action == null ? null : action.copy();
601        dst.date = date == null ? null : date.copy();
602        dst.author = author == null ? null : author.copy();
603        return dst;
604      }
605
606      @Override
607      public boolean equalsDeep(Base other) {
608        if (!super.equalsDeep(other))
609          return false;
610        if (!(other instanceof DetectedIssueMitigationComponent))
611          return false;
612        DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other;
613        return compareDeep(action, o.action, true) && compareDeep(date, o.date, true) && compareDeep(author, o.author, true)
614          ;
615      }
616
617      @Override
618      public boolean equalsShallow(Base other) {
619        if (!super.equalsShallow(other))
620          return false;
621        if (!(other instanceof DetectedIssueMitigationComponent))
622          return false;
623        DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other;
624        return compareValues(date, o.date, true);
625      }
626
627      public boolean isEmpty() {
628        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(action, date, author);
629      }
630
631  public String fhirType() {
632    return "DetectedIssue.mitigation";
633
634  }
635
636  }
637
638    /**
639     * Business identifier associated with the detected issue record.
640     */
641    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
642    @Description(shortDefinition="Unique id for the detected issue", formalDefinition="Business identifier associated with the detected issue record." )
643    protected Identifier identifier;
644
645    /**
646     * Indicates the status of the detected issue.
647     */
648    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
649    @Description(shortDefinition="registered | preliminary | final | amended +", formalDefinition="Indicates the status of the detected issue." )
650    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-status")
651    protected Enumeration<DetectedIssueStatus> status;
652
653    /**
654     * Identifies the general type of issue identified.
655     */
656    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
657    @Description(shortDefinition="Issue Category, e.g. drug-drug, duplicate therapy, etc.", formalDefinition="Identifies the general type of issue identified." )
658    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/detectedissue-category")
659    protected CodeableConcept category;
660
661    /**
662     * Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.
663     */
664    @Child(name = "severity", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
665    @Description(shortDefinition="high | moderate | low", formalDefinition="Indicates the degree of importance associated with the identified issue based on the potential impact on the patient." )
666    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/detectedissue-severity")
667    protected Enumeration<DetectedIssueSeverity> severity;
668
669    /**
670     * Indicates the patient whose record the detected issue is associated with.
671     */
672    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=true)
673    @Description(shortDefinition="Associated patient", formalDefinition="Indicates the patient whose record the detected issue is associated with." )
674    protected Reference patient;
675
676    /**
677     * The actual object that is the target of the reference (Indicates the patient whose record the detected issue is associated with.)
678     */
679    protected Patient patientTarget;
680
681    /**
682     * The date or date-time when the detected issue was initially identified.
683     */
684    @Child(name = "date", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
685    @Description(shortDefinition="When identified", formalDefinition="The date or date-time when the detected issue was initially identified." )
686    protected DateTimeType date;
687
688    /**
689     * Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.
690     */
691    @Child(name = "author", type = {Practitioner.class, Device.class}, order=6, min=0, max=1, modifier=false, summary=true)
692    @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." )
693    protected Reference author;
694
695    /**
696     * 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.)
697     */
698    protected Resource authorTarget;
699
700    /**
701     * Indicates the resource representing the current activity or proposed activity that is potentially problematic.
702     */
703    @Child(name = "implicated", type = {Reference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
704    @Description(shortDefinition="Problem resource", formalDefinition="Indicates the resource representing the current activity or proposed activity that is potentially problematic." )
705    protected List<Reference> implicated;
706    /**
707     * The actual objects that are the target of the reference (Indicates the resource representing the current activity or proposed activity that is potentially problematic.)
708     */
709    protected List<Resource> implicatedTarget;
710
711
712    /**
713     * A textual explanation of the detected issue.
714     */
715    @Child(name = "detail", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
716    @Description(shortDefinition="Description and context", formalDefinition="A textual explanation of the detected issue." )
717    protected StringType detail;
718
719    /**
720     * The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.
721     */
722    @Child(name = "reference", type = {UriType.class}, order=9, min=0, max=1, modifier=false, summary=false)
723    @Description(shortDefinition="Authority for issue", formalDefinition="The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified." )
724    protected UriType reference;
725
726    /**
727     * Indicates an action that has been taken or is committed to 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.
728     */
729    @Child(name = "mitigation", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
730    @Description(shortDefinition="Step taken to address", formalDefinition="Indicates an action that has been taken or is committed to 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." )
731    protected List<DetectedIssueMitigationComponent> mitigation;
732
733    private static final long serialVersionUID = -1002889332L;
734
735  /**
736   * Constructor
737   */
738    public DetectedIssue() {
739      super();
740    }
741
742  /**
743   * Constructor
744   */
745    public DetectedIssue(Enumeration<DetectedIssueStatus> status) {
746      super();
747      this.status = status;
748    }
749
750    /**
751     * @return {@link #identifier} (Business identifier associated with the detected issue record.)
752     */
753    public Identifier getIdentifier() { 
754      if (this.identifier == null)
755        if (Configuration.errorOnAutoCreate())
756          throw new Error("Attempt to auto-create DetectedIssue.identifier");
757        else if (Configuration.doAutoCreate())
758          this.identifier = new Identifier(); // cc
759      return this.identifier;
760    }
761
762    public boolean hasIdentifier() { 
763      return this.identifier != null && !this.identifier.isEmpty();
764    }
765
766    /**
767     * @param value {@link #identifier} (Business identifier associated with the detected issue record.)
768     */
769    public DetectedIssue setIdentifier(Identifier value) { 
770      this.identifier = value;
771      return this;
772    }
773
774    /**
775     * @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
776     */
777    public Enumeration<DetectedIssueStatus> getStatusElement() { 
778      if (this.status == null)
779        if (Configuration.errorOnAutoCreate())
780          throw new Error("Attempt to auto-create DetectedIssue.status");
781        else if (Configuration.doAutoCreate())
782          this.status = new Enumeration<DetectedIssueStatus>(new DetectedIssueStatusEnumFactory()); // bb
783      return this.status;
784    }
785
786    public boolean hasStatusElement() { 
787      return this.status != null && !this.status.isEmpty();
788    }
789
790    public boolean hasStatus() { 
791      return this.status != null && !this.status.isEmpty();
792    }
793
794    /**
795     * @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
796     */
797    public DetectedIssue setStatusElement(Enumeration<DetectedIssueStatus> value) { 
798      this.status = value;
799      return this;
800    }
801
802    /**
803     * @return Indicates the status of the detected issue.
804     */
805    public DetectedIssueStatus getStatus() { 
806      return this.status == null ? null : this.status.getValue();
807    }
808
809    /**
810     * @param value Indicates the status of the detected issue.
811     */
812    public DetectedIssue setStatus(DetectedIssueStatus value) { 
813        if (this.status == null)
814          this.status = new Enumeration<DetectedIssueStatus>(new DetectedIssueStatusEnumFactory());
815        this.status.setValue(value);
816      return this;
817    }
818
819    /**
820     * @return {@link #category} (Identifies the general type of issue identified.)
821     */
822    public CodeableConcept getCategory() { 
823      if (this.category == null)
824        if (Configuration.errorOnAutoCreate())
825          throw new Error("Attempt to auto-create DetectedIssue.category");
826        else if (Configuration.doAutoCreate())
827          this.category = new CodeableConcept(); // cc
828      return this.category;
829    }
830
831    public boolean hasCategory() { 
832      return this.category != null && !this.category.isEmpty();
833    }
834
835    /**
836     * @param value {@link #category} (Identifies the general type of issue identified.)
837     */
838    public DetectedIssue setCategory(CodeableConcept value) { 
839      this.category = value;
840      return this;
841    }
842
843    /**
844     * @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
845     */
846    public Enumeration<DetectedIssueSeverity> getSeverityElement() { 
847      if (this.severity == null)
848        if (Configuration.errorOnAutoCreate())
849          throw new Error("Attempt to auto-create DetectedIssue.severity");
850        else if (Configuration.doAutoCreate())
851          this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory()); // bb
852      return this.severity;
853    }
854
855    public boolean hasSeverityElement() { 
856      return this.severity != null && !this.severity.isEmpty();
857    }
858
859    public boolean hasSeverity() { 
860      return this.severity != null && !this.severity.isEmpty();
861    }
862
863    /**
864     * @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
865     */
866    public DetectedIssue setSeverityElement(Enumeration<DetectedIssueSeverity> value) { 
867      this.severity = value;
868      return this;
869    }
870
871    /**
872     * @return Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.
873     */
874    public DetectedIssueSeverity getSeverity() { 
875      return this.severity == null ? null : this.severity.getValue();
876    }
877
878    /**
879     * @param value Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.
880     */
881    public DetectedIssue setSeverity(DetectedIssueSeverity value) { 
882      if (value == null)
883        this.severity = null;
884      else {
885        if (this.severity == null)
886          this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory());
887        this.severity.setValue(value);
888      }
889      return this;
890    }
891
892    /**
893     * @return {@link #patient} (Indicates the patient whose record the detected issue is associated with.)
894     */
895    public Reference getPatient() { 
896      if (this.patient == null)
897        if (Configuration.errorOnAutoCreate())
898          throw new Error("Attempt to auto-create DetectedIssue.patient");
899        else if (Configuration.doAutoCreate())
900          this.patient = new Reference(); // cc
901      return this.patient;
902    }
903
904    public boolean hasPatient() { 
905      return this.patient != null && !this.patient.isEmpty();
906    }
907
908    /**
909     * @param value {@link #patient} (Indicates the patient whose record the detected issue is associated with.)
910     */
911    public DetectedIssue setPatient(Reference value) { 
912      this.patient = value;
913      return this;
914    }
915
916    /**
917     * @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.)
918     */
919    public Patient getPatientTarget() { 
920      if (this.patientTarget == null)
921        if (Configuration.errorOnAutoCreate())
922          throw new Error("Attempt to auto-create DetectedIssue.patient");
923        else if (Configuration.doAutoCreate())
924          this.patientTarget = new Patient(); // aa
925      return this.patientTarget;
926    }
927
928    /**
929     * @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.)
930     */
931    public DetectedIssue setPatientTarget(Patient value) { 
932      this.patientTarget = value;
933      return this;
934    }
935
936    /**
937     * @return {@link #date} (The date or date-time when the detected issue was initially identified.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
938     */
939    public DateTimeType getDateElement() { 
940      if (this.date == null)
941        if (Configuration.errorOnAutoCreate())
942          throw new Error("Attempt to auto-create DetectedIssue.date");
943        else if (Configuration.doAutoCreate())
944          this.date = new DateTimeType(); // bb
945      return this.date;
946    }
947
948    public boolean hasDateElement() { 
949      return this.date != null && !this.date.isEmpty();
950    }
951
952    public boolean hasDate() { 
953      return this.date != null && !this.date.isEmpty();
954    }
955
956    /**
957     * @param value {@link #date} (The date or date-time when the detected issue was initially identified.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
958     */
959    public DetectedIssue setDateElement(DateTimeType value) { 
960      this.date = value;
961      return this;
962    }
963
964    /**
965     * @return The date or date-time when the detected issue was initially identified.
966     */
967    public Date getDate() { 
968      return this.date == null ? null : this.date.getValue();
969    }
970
971    /**
972     * @param value The date or date-time when the detected issue was initially identified.
973     */
974    public DetectedIssue setDate(Date value) { 
975      if (value == null)
976        this.date = null;
977      else {
978        if (this.date == null)
979          this.date = new DateTimeType();
980        this.date.setValue(value);
981      }
982      return this;
983    }
984
985    /**
986     * @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.)
987     */
988    public Reference getAuthor() { 
989      if (this.author == null)
990        if (Configuration.errorOnAutoCreate())
991          throw new Error("Attempt to auto-create DetectedIssue.author");
992        else if (Configuration.doAutoCreate())
993          this.author = new Reference(); // cc
994      return this.author;
995    }
996
997    public boolean hasAuthor() { 
998      return this.author != null && !this.author.isEmpty();
999    }
1000
1001    /**
1002     * @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.)
1003     */
1004    public DetectedIssue setAuthor(Reference value) { 
1005      this.author = value;
1006      return this;
1007    }
1008
1009    /**
1010     * @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.)
1011     */
1012    public Resource getAuthorTarget() { 
1013      return this.authorTarget;
1014    }
1015
1016    /**
1017     * @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.)
1018     */
1019    public DetectedIssue setAuthorTarget(Resource value) { 
1020      this.authorTarget = value;
1021      return this;
1022    }
1023
1024    /**
1025     * @return {@link #implicated} (Indicates the resource representing the current activity or proposed activity that is potentially problematic.)
1026     */
1027    public List<Reference> getImplicated() { 
1028      if (this.implicated == null)
1029        this.implicated = new ArrayList<Reference>();
1030      return this.implicated;
1031    }
1032
1033    /**
1034     * @return Returns a reference to <code>this</code> for easy method chaining
1035     */
1036    public DetectedIssue setImplicated(List<Reference> theImplicated) { 
1037      this.implicated = theImplicated;
1038      return this;
1039    }
1040
1041    public boolean hasImplicated() { 
1042      if (this.implicated == null)
1043        return false;
1044      for (Reference item : this.implicated)
1045        if (!item.isEmpty())
1046          return true;
1047      return false;
1048    }
1049
1050    public Reference addImplicated() { //3
1051      Reference t = new Reference();
1052      if (this.implicated == null)
1053        this.implicated = new ArrayList<Reference>();
1054      this.implicated.add(t);
1055      return t;
1056    }
1057
1058    public DetectedIssue addImplicated(Reference t) { //3
1059      if (t == null)
1060        return this;
1061      if (this.implicated == null)
1062        this.implicated = new ArrayList<Reference>();
1063      this.implicated.add(t);
1064      return this;
1065    }
1066
1067    /**
1068     * @return The first repetition of repeating field {@link #implicated}, creating it if it does not already exist
1069     */
1070    public Reference getImplicatedFirstRep() { 
1071      if (getImplicated().isEmpty()) {
1072        addImplicated();
1073      }
1074      return getImplicated().get(0);
1075    }
1076
1077    /**
1078     * @deprecated Use Reference#setResource(IBaseResource) instead
1079     */
1080    @Deprecated
1081    public List<Resource> getImplicatedTarget() { 
1082      if (this.implicatedTarget == null)
1083        this.implicatedTarget = new ArrayList<Resource>();
1084      return this.implicatedTarget;
1085    }
1086
1087    /**
1088     * @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
1089     */
1090    public StringType getDetailElement() { 
1091      if (this.detail == null)
1092        if (Configuration.errorOnAutoCreate())
1093          throw new Error("Attempt to auto-create DetectedIssue.detail");
1094        else if (Configuration.doAutoCreate())
1095          this.detail = new StringType(); // bb
1096      return this.detail;
1097    }
1098
1099    public boolean hasDetailElement() { 
1100      return this.detail != null && !this.detail.isEmpty();
1101    }
1102
1103    public boolean hasDetail() { 
1104      return this.detail != null && !this.detail.isEmpty();
1105    }
1106
1107    /**
1108     * @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
1109     */
1110    public DetectedIssue setDetailElement(StringType value) { 
1111      this.detail = value;
1112      return this;
1113    }
1114
1115    /**
1116     * @return A textual explanation of the detected issue.
1117     */
1118    public String getDetail() { 
1119      return this.detail == null ? null : this.detail.getValue();
1120    }
1121
1122    /**
1123     * @param value A textual explanation of the detected issue.
1124     */
1125    public DetectedIssue setDetail(String value) { 
1126      if (Utilities.noString(value))
1127        this.detail = null;
1128      else {
1129        if (this.detail == null)
1130          this.detail = new StringType();
1131        this.detail.setValue(value);
1132      }
1133      return this;
1134    }
1135
1136    /**
1137     * @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
1138     */
1139    public UriType getReferenceElement() { 
1140      if (this.reference == null)
1141        if (Configuration.errorOnAutoCreate())
1142          throw new Error("Attempt to auto-create DetectedIssue.reference");
1143        else if (Configuration.doAutoCreate())
1144          this.reference = new UriType(); // bb
1145      return this.reference;
1146    }
1147
1148    public boolean hasReferenceElement() { 
1149      return this.reference != null && !this.reference.isEmpty();
1150    }
1151
1152    public boolean hasReference() { 
1153      return this.reference != null && !this.reference.isEmpty();
1154    }
1155
1156    /**
1157     * @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
1158     */
1159    public DetectedIssue setReferenceElement(UriType value) { 
1160      this.reference = value;
1161      return this;
1162    }
1163
1164    /**
1165     * @return The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.
1166     */
1167    public String getReference() { 
1168      return this.reference == null ? null : this.reference.getValue();
1169    }
1170
1171    /**
1172     * @param value The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.
1173     */
1174    public DetectedIssue setReference(String value) { 
1175      if (Utilities.noString(value))
1176        this.reference = null;
1177      else {
1178        if (this.reference == null)
1179          this.reference = new UriType();
1180        this.reference.setValue(value);
1181      }
1182      return this;
1183    }
1184
1185    /**
1186     * @return {@link #mitigation} (Indicates an action that has been taken or is committed to 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.)
1187     */
1188    public List<DetectedIssueMitigationComponent> getMitigation() { 
1189      if (this.mitigation == null)
1190        this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1191      return this.mitigation;
1192    }
1193
1194    /**
1195     * @return Returns a reference to <code>this</code> for easy method chaining
1196     */
1197    public DetectedIssue setMitigation(List<DetectedIssueMitigationComponent> theMitigation) { 
1198      this.mitigation = theMitigation;
1199      return this;
1200    }
1201
1202    public boolean hasMitigation() { 
1203      if (this.mitigation == null)
1204        return false;
1205      for (DetectedIssueMitigationComponent item : this.mitigation)
1206        if (!item.isEmpty())
1207          return true;
1208      return false;
1209    }
1210
1211    public DetectedIssueMitigationComponent addMitigation() { //3
1212      DetectedIssueMitigationComponent t = new DetectedIssueMitigationComponent();
1213      if (this.mitigation == null)
1214        this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1215      this.mitigation.add(t);
1216      return t;
1217    }
1218
1219    public DetectedIssue addMitigation(DetectedIssueMitigationComponent t) { //3
1220      if (t == null)
1221        return this;
1222      if (this.mitigation == null)
1223        this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1224      this.mitigation.add(t);
1225      return this;
1226    }
1227
1228    /**
1229     * @return The first repetition of repeating field {@link #mitigation}, creating it if it does not already exist
1230     */
1231    public DetectedIssueMitigationComponent getMitigationFirstRep() { 
1232      if (getMitigation().isEmpty()) {
1233        addMitigation();
1234      }
1235      return getMitigation().get(0);
1236    }
1237
1238      protected void listChildren(List<Property> childrenList) {
1239        super.listChildren(childrenList);
1240        childrenList.add(new Property("identifier", "Identifier", "Business identifier associated with the detected issue record.", 0, java.lang.Integer.MAX_VALUE, identifier));
1241        childrenList.add(new Property("status", "code", "Indicates the status of the detected issue.", 0, java.lang.Integer.MAX_VALUE, status));
1242        childrenList.add(new Property("category", "CodeableConcept", "Identifies the general type of issue identified.", 0, java.lang.Integer.MAX_VALUE, category));
1243        childrenList.add(new Property("severity", "code", "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.", 0, java.lang.Integer.MAX_VALUE, severity));
1244        childrenList.add(new Property("patient", "Reference(Patient)", "Indicates the patient whose record the detected issue is associated with.", 0, java.lang.Integer.MAX_VALUE, patient));
1245        childrenList.add(new Property("date", "dateTime", "The date or date-time when the detected issue was initially identified.", 0, java.lang.Integer.MAX_VALUE, date));
1246        childrenList.add(new Property("author", "Reference(Practitioner|Device)", "Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.", 0, java.lang.Integer.MAX_VALUE, author));
1247        childrenList.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));
1248        childrenList.add(new Property("detail", "string", "A textual explanation of the detected issue.", 0, java.lang.Integer.MAX_VALUE, detail));
1249        childrenList.add(new Property("reference", "uri", "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.", 0, java.lang.Integer.MAX_VALUE, reference));
1250        childrenList.add(new Property("mitigation", "", "Indicates an action that has been taken or is committed to 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));
1251      }
1252
1253      @Override
1254      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1255        switch (hash) {
1256        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1257        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DetectedIssueStatus>
1258        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1259        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<DetectedIssueSeverity>
1260        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1261        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
1262        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
1263        case -810216884: /*implicated*/ return this.implicated == null ? new Base[0] : this.implicated.toArray(new Base[this.implicated.size()]); // Reference
1264        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // StringType
1265        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // UriType
1266        case 1293793087: /*mitigation*/ return this.mitigation == null ? new Base[0] : this.mitigation.toArray(new Base[this.mitigation.size()]); // DetectedIssueMitigationComponent
1267        default: return super.getProperty(hash, name, checkValid);
1268        }
1269
1270      }
1271
1272      @Override
1273      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1274        switch (hash) {
1275        case -1618432855: // identifier
1276          this.identifier = castToIdentifier(value); // Identifier
1277          return value;
1278        case -892481550: // status
1279          value = new DetectedIssueStatusEnumFactory().fromType(castToCode(value));
1280          this.status = (Enumeration) value; // Enumeration<DetectedIssueStatus>
1281          return value;
1282        case 50511102: // category
1283          this.category = castToCodeableConcept(value); // CodeableConcept
1284          return value;
1285        case 1478300413: // severity
1286          value = new DetectedIssueSeverityEnumFactory().fromType(castToCode(value));
1287          this.severity = (Enumeration) value; // Enumeration<DetectedIssueSeverity>
1288          return value;
1289        case -791418107: // patient
1290          this.patient = castToReference(value); // Reference
1291          return value;
1292        case 3076014: // date
1293          this.date = castToDateTime(value); // DateTimeType
1294          return value;
1295        case -1406328437: // author
1296          this.author = castToReference(value); // Reference
1297          return value;
1298        case -810216884: // implicated
1299          this.getImplicated().add(castToReference(value)); // Reference
1300          return value;
1301        case -1335224239: // detail
1302          this.detail = castToString(value); // StringType
1303          return value;
1304        case -925155509: // reference
1305          this.reference = castToUri(value); // UriType
1306          return value;
1307        case 1293793087: // mitigation
1308          this.getMitigation().add((DetectedIssueMitigationComponent) value); // DetectedIssueMitigationComponent
1309          return value;
1310        default: return super.setProperty(hash, name, value);
1311        }
1312
1313      }
1314
1315      @Override
1316      public Base setProperty(String name, Base value) throws FHIRException {
1317        if (name.equals("identifier")) {
1318          this.identifier = castToIdentifier(value); // Identifier
1319        } else if (name.equals("status")) {
1320          value = new DetectedIssueStatusEnumFactory().fromType(castToCode(value));
1321          this.status = (Enumeration) value; // Enumeration<DetectedIssueStatus>
1322        } else if (name.equals("category")) {
1323          this.category = castToCodeableConcept(value); // CodeableConcept
1324        } else if (name.equals("severity")) {
1325          value = new DetectedIssueSeverityEnumFactory().fromType(castToCode(value));
1326          this.severity = (Enumeration) value; // Enumeration<DetectedIssueSeverity>
1327        } else if (name.equals("patient")) {
1328          this.patient = castToReference(value); // Reference
1329        } else if (name.equals("date")) {
1330          this.date = castToDateTime(value); // DateTimeType
1331        } else if (name.equals("author")) {
1332          this.author = castToReference(value); // Reference
1333        } else if (name.equals("implicated")) {
1334          this.getImplicated().add(castToReference(value));
1335        } else if (name.equals("detail")) {
1336          this.detail = castToString(value); // StringType
1337        } else if (name.equals("reference")) {
1338          this.reference = castToUri(value); // UriType
1339        } else if (name.equals("mitigation")) {
1340          this.getMitigation().add((DetectedIssueMitigationComponent) value);
1341        } else
1342          return super.setProperty(name, value);
1343        return value;
1344      }
1345
1346      @Override
1347      public Base makeProperty(int hash, String name) throws FHIRException {
1348        switch (hash) {
1349        case -1618432855:  return getIdentifier(); 
1350        case -892481550:  return getStatusElement();
1351        case 50511102:  return getCategory(); 
1352        case 1478300413:  return getSeverityElement();
1353        case -791418107:  return getPatient(); 
1354        case 3076014:  return getDateElement();
1355        case -1406328437:  return getAuthor(); 
1356        case -810216884:  return addImplicated(); 
1357        case -1335224239:  return getDetailElement();
1358        case -925155509:  return getReferenceElement();
1359        case 1293793087:  return addMitigation(); 
1360        default: return super.makeProperty(hash, name);
1361        }
1362
1363      }
1364
1365      @Override
1366      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1367        switch (hash) {
1368        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1369        case -892481550: /*status*/ return new String[] {"code"};
1370        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1371        case 1478300413: /*severity*/ return new String[] {"code"};
1372        case -791418107: /*patient*/ return new String[] {"Reference"};
1373        case 3076014: /*date*/ return new String[] {"dateTime"};
1374        case -1406328437: /*author*/ return new String[] {"Reference"};
1375        case -810216884: /*implicated*/ return new String[] {"Reference"};
1376        case -1335224239: /*detail*/ return new String[] {"string"};
1377        case -925155509: /*reference*/ return new String[] {"uri"};
1378        case 1293793087: /*mitigation*/ return new String[] {};
1379        default: return super.getTypesForProperty(hash, name);
1380        }
1381
1382      }
1383
1384      @Override
1385      public Base addChild(String name) throws FHIRException {
1386        if (name.equals("identifier")) {
1387          this.identifier = new Identifier();
1388          return this.identifier;
1389        }
1390        else if (name.equals("status")) {
1391          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.status");
1392        }
1393        else if (name.equals("category")) {
1394          this.category = new CodeableConcept();
1395          return this.category;
1396        }
1397        else if (name.equals("severity")) {
1398          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.severity");
1399        }
1400        else if (name.equals("patient")) {
1401          this.patient = new Reference();
1402          return this.patient;
1403        }
1404        else if (name.equals("date")) {
1405          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.date");
1406        }
1407        else if (name.equals("author")) {
1408          this.author = new Reference();
1409          return this.author;
1410        }
1411        else if (name.equals("implicated")) {
1412          return addImplicated();
1413        }
1414        else if (name.equals("detail")) {
1415          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.detail");
1416        }
1417        else if (name.equals("reference")) {
1418          throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.reference");
1419        }
1420        else if (name.equals("mitigation")) {
1421          return addMitigation();
1422        }
1423        else
1424          return super.addChild(name);
1425      }
1426
1427  public String fhirType() {
1428    return "DetectedIssue";
1429
1430  }
1431
1432      public DetectedIssue copy() {
1433        DetectedIssue dst = new DetectedIssue();
1434        copyValues(dst);
1435        dst.identifier = identifier == null ? null : identifier.copy();
1436        dst.status = status == null ? null : status.copy();
1437        dst.category = category == null ? null : category.copy();
1438        dst.severity = severity == null ? null : severity.copy();
1439        dst.patient = patient == null ? null : patient.copy();
1440        dst.date = date == null ? null : date.copy();
1441        dst.author = author == null ? null : author.copy();
1442        if (implicated != null) {
1443          dst.implicated = new ArrayList<Reference>();
1444          for (Reference i : implicated)
1445            dst.implicated.add(i.copy());
1446        };
1447        dst.detail = detail == null ? null : detail.copy();
1448        dst.reference = reference == null ? null : reference.copy();
1449        if (mitigation != null) {
1450          dst.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1451          for (DetectedIssueMitigationComponent i : mitigation)
1452            dst.mitigation.add(i.copy());
1453        };
1454        return dst;
1455      }
1456
1457      protected DetectedIssue typedCopy() {
1458        return copy();
1459      }
1460
1461      @Override
1462      public boolean equalsDeep(Base other) {
1463        if (!super.equalsDeep(other))
1464          return false;
1465        if (!(other instanceof DetectedIssue))
1466          return false;
1467        DetectedIssue o = (DetectedIssue) other;
1468        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
1469           && compareDeep(severity, o.severity, true) && compareDeep(patient, o.patient, true) && compareDeep(date, o.date, true)
1470           && compareDeep(author, o.author, true) && compareDeep(implicated, o.implicated, true) && compareDeep(detail, o.detail, true)
1471           && compareDeep(reference, o.reference, true) && compareDeep(mitigation, o.mitigation, true);
1472      }
1473
1474      @Override
1475      public boolean equalsShallow(Base other) {
1476        if (!super.equalsShallow(other))
1477          return false;
1478        if (!(other instanceof DetectedIssue))
1479          return false;
1480        DetectedIssue o = (DetectedIssue) other;
1481        return compareValues(status, o.status, true) && compareValues(severity, o.severity, true) && compareValues(date, o.date, true)
1482           && compareValues(detail, o.detail, true) && compareValues(reference, o.reference, true);
1483      }
1484
1485      public boolean isEmpty() {
1486        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
1487          , severity, patient, date, author, implicated, detail, reference, mitigation
1488          );
1489      }
1490
1491  @Override
1492  public ResourceType getResourceType() {
1493    return ResourceType.DetectedIssue;
1494   }
1495
1496 /**
1497   * Search parameter: <b>date</b>
1498   * <p>
1499   * Description: <b>When identified</b><br>
1500   * Type: <b>date</b><br>
1501   * Path: <b>DetectedIssue.date</b><br>
1502   * </p>
1503   */
1504  @SearchParamDefinition(name="date", path="DetectedIssue.date", description="When identified", type="date" )
1505  public static final String SP_DATE = "date";
1506 /**
1507   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1508   * <p>
1509   * Description: <b>When identified</b><br>
1510   * Type: <b>date</b><br>
1511   * Path: <b>DetectedIssue.date</b><br>
1512   * </p>
1513   */
1514  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1515
1516 /**
1517   * Search parameter: <b>identifier</b>
1518   * <p>
1519   * Description: <b>Unique id for the detected issue</b><br>
1520   * Type: <b>token</b><br>
1521   * Path: <b>DetectedIssue.identifier</b><br>
1522   * </p>
1523   */
1524  @SearchParamDefinition(name="identifier", path="DetectedIssue.identifier", description="Unique id for the detected issue", type="token" )
1525  public static final String SP_IDENTIFIER = "identifier";
1526 /**
1527   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1528   * <p>
1529   * Description: <b>Unique id for the detected issue</b><br>
1530   * Type: <b>token</b><br>
1531   * Path: <b>DetectedIssue.identifier</b><br>
1532   * </p>
1533   */
1534  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1535
1536 /**
1537   * Search parameter: <b>patient</b>
1538   * <p>
1539   * Description: <b>Associated patient</b><br>
1540   * Type: <b>reference</b><br>
1541   * Path: <b>DetectedIssue.patient</b><br>
1542   * </p>
1543   */
1544  @SearchParamDefinition(name="patient", path="DetectedIssue.patient", description="Associated patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1545  public static final String SP_PATIENT = "patient";
1546 /**
1547   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1548   * <p>
1549   * Description: <b>Associated patient</b><br>
1550   * Type: <b>reference</b><br>
1551   * Path: <b>DetectedIssue.patient</b><br>
1552   * </p>
1553   */
1554  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1555
1556/**
1557   * Constant for fluent queries to be used to add include statements. Specifies
1558   * the path value of "<b>DetectedIssue:patient</b>".
1559   */
1560  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DetectedIssue:patient").toLocked();
1561
1562 /**
1563   * Search parameter: <b>author</b>
1564   * <p>
1565   * Description: <b>The provider or device that identified the issue</b><br>
1566   * Type: <b>reference</b><br>
1567   * Path: <b>DetectedIssue.author</b><br>
1568   * </p>
1569   */
1570  @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 } )
1571  public static final String SP_AUTHOR = "author";
1572 /**
1573   * <b>Fluent Client</b> search parameter constant for <b>author</b>
1574   * <p>
1575   * Description: <b>The provider or device that identified the issue</b><br>
1576   * Type: <b>reference</b><br>
1577   * Path: <b>DetectedIssue.author</b><br>
1578   * </p>
1579   */
1580  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
1581
1582/**
1583   * Constant for fluent queries to be used to add include statements. Specifies
1584   * the path value of "<b>DetectedIssue:author</b>".
1585   */
1586  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("DetectedIssue:author").toLocked();
1587
1588 /**
1589   * Search parameter: <b>implicated</b>
1590   * <p>
1591   * Description: <b>Problem resource</b><br>
1592   * Type: <b>reference</b><br>
1593   * Path: <b>DetectedIssue.implicated</b><br>
1594   * </p>
1595   */
1596  @SearchParamDefinition(name="implicated", path="DetectedIssue.implicated", description="Problem resource", type="reference" )
1597  public static final String SP_IMPLICATED = "implicated";
1598 /**
1599   * <b>Fluent Client</b> search parameter constant for <b>implicated</b>
1600   * <p>
1601   * Description: <b>Problem resource</b><br>
1602   * Type: <b>reference</b><br>
1603   * Path: <b>DetectedIssue.implicated</b><br>
1604   * </p>
1605   */
1606  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam IMPLICATED = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_IMPLICATED);
1607
1608/**
1609   * Constant for fluent queries to be used to add include statements. Specifies
1610   * the path value of "<b>DetectedIssue:implicated</b>".
1611   */
1612  public static final ca.uhn.fhir.model.api.Include INCLUDE_IMPLICATED = new ca.uhn.fhir.model.api.Include("DetectedIssue:implicated").toLocked();
1613
1614 /**
1615   * Search parameter: <b>category</b>
1616   * <p>
1617   * Description: <b>Issue Category, e.g. drug-drug, duplicate therapy, etc.</b><br>
1618   * Type: <b>token</b><br>
1619   * Path: <b>DetectedIssue.category</b><br>
1620   * </p>
1621   */
1622  @SearchParamDefinition(name="category", path="DetectedIssue.category", description="Issue Category, e.g. drug-drug, duplicate therapy, etc.", type="token" )
1623  public static final String SP_CATEGORY = "category";
1624 /**
1625   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1626   * <p>
1627   * Description: <b>Issue Category, e.g. drug-drug, duplicate therapy, etc.</b><br>
1628   * Type: <b>token</b><br>
1629   * Path: <b>DetectedIssue.category</b><br>
1630   * </p>
1631   */
1632  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1633
1634
1635}
1636