001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_40;
004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40;
010import org.hl7.fhir.exceptions.FHIRException;
011
012public class DetectedIssue30_40 {
013
014  public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException {
015    if (src == null)
016      return null;
017    org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue();
018    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
019    if (src.hasIdentifier())
020      tgt.setIdentifier(Identifier30_40.convertIdentifier(src.getIdentifierFirstRep()));
021    if (src.hasStatus())
022      tgt.setStatusElement(convertDetectedIssueStatus(src.getStatusElement()));
023    if (src.hasCode())
024      tgt.setCategory(CodeableConcept30_40.convertCodeableConcept(src.getCode()));
025    if (src.hasSeverity())
026      tgt.setSeverityElement(convertDetectedIssueSeverity(src.getSeverityElement()));
027    if (src.hasPatient())
028      tgt.setPatient(Reference30_40.convertReference(src.getPatient()));
029    if (src.hasIdentifiedDateTimeType())
030      tgt.setDateElement(DateTime30_40.convertDateTime(src.getIdentifiedDateTimeType()));
031    if (src.hasAuthor())
032      tgt.setAuthor(Reference30_40.convertReference(src.getAuthor()));
033    for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) tgt.addImplicated(Reference30_40.convertReference(t));
034    if (src.hasDetail())
035      tgt.setDetailElement(String30_40.convertString(src.getDetailElement()));
036    if (src.hasReference())
037      tgt.setReferenceElement(Uri30_40.convertUri(src.getReferenceElement()));
038    for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation())
039      tgt.addMitigation(convertDetectedIssueMitigationComponent(t));
040    return tgt;
041  }
042
043  public static org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException {
044    if (src == null)
045      return null;
046    org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue();
047    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
048    if (src.hasIdentifier())
049      tgt.addIdentifier(Identifier30_40.convertIdentifier(src.getIdentifier()));
050    if (src.hasStatus())
051      tgt.setStatusElement(convertDetectedIssueStatus(src.getStatusElement()));
052    if (src.hasCategory())
053      tgt.setCode(CodeableConcept30_40.convertCodeableConcept(src.getCategory()));
054    if (src.hasSeverity())
055      tgt.setSeverityElement(convertDetectedIssueSeverity(src.getSeverityElement()));
056    if (src.hasPatient())
057      tgt.setPatient(Reference30_40.convertReference(src.getPatient()));
058    if (src.hasDateElement())
059      tgt.setIdentified(DateTime30_40.convertDateTime(src.getDateElement()));
060    if (src.hasAuthor())
061      tgt.setAuthor(Reference30_40.convertReference(src.getAuthor()));
062    for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated())
063      tgt.addImplicated(Reference30_40.convertReference(t));
064    if (src.hasDetail())
065      tgt.setDetailElement(String30_40.convertString(src.getDetailElement()));
066    if (src.hasReference())
067      tgt.setReferenceElement(Uri30_40.convertUri(src.getReferenceElement()));
068    for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation())
069      tgt.addMitigation(convertDetectedIssueMitigationComponent(t));
070    return tgt;
071  }
072
073  public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException {
074    if (src == null)
075      return null;
076    org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent();
077    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
078    if (src.hasAction())
079      tgt.setAction(CodeableConcept30_40.convertCodeableConcept(src.getAction()));
080    if (src.hasDateElement())
081      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
082    if (src.hasAuthor())
083      tgt.setAuthor(Reference30_40.convertReference(src.getAuthor()));
084    return tgt;
085  }
086
087  public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException {
088    if (src == null)
089      return null;
090    org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent();
091    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
092    if (src.hasAction())
093      tgt.setAction(CodeableConcept30_40.convertCodeableConcept(src.getAction()));
094    if (src.hasDateElement())
095      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
096    if (src.hasAuthor())
097      tgt.setAuthor(Reference30_40.convertReference(src.getAuthor()));
098    return tgt;
099  }
100
101  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity> convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity> src) throws FHIRException {
102    if (src == null || src.isEmpty())
103      return null;
104    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverityEnumFactory());
105    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
106    switch (src.getValue()) {
107      case HIGH:
108        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH);
109        break;
110      case MODERATE:
111        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE);
112        break;
113      case LOW:
114        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW);
115        break;
116      default:
117        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL);
118        break;
119    }
120    return tgt;
121  }
122
123  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity> convertDetectedIssueSeverity(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity> src) throws FHIRException {
124    if (src == null || src.isEmpty())
125      return null;
126    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverityEnumFactory());
127    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
128    switch (src.getValue()) {
129      case HIGH:
130        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH);
131        break;
132      case MODERATE:
133        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE);
134        break;
135      case LOW:
136        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW);
137        break;
138      default:
139        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL);
140        break;
141    }
142    return tgt;
143  }
144
145  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus> convertDetectedIssueStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus> src) throws FHIRException {
146    if (src == null || src.isEmpty())
147      return null;
148    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatusEnumFactory());
149    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
150    switch (src.getValue()) {
151      case REGISTERED:
152        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.REGISTERED);
153        break;
154      case PRELIMINARY:
155        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY);
156        break;
157      case FINAL:
158        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.FINAL);
159        break;
160      case AMENDED:
161        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.AMENDED);
162        break;
163      case CORRECTED:
164        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CORRECTED);
165        break;
166      case CANCELLED:
167        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CANCELLED);
168        break;
169      case ENTEREDINERROR:
170        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR);
171        break;
172      case UNKNOWN:
173        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.UNKNOWN);
174        break;
175      default:
176        tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.NULL);
177        break;
178    }
179    return tgt;
180  }
181
182  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus> convertDetectedIssueStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus> src) throws FHIRException {
183    if (src == null || src.isEmpty())
184      return null;
185    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatusEnumFactory());
186    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
187    switch (src.getValue()) {
188      case REGISTERED:
189        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.REGISTERED);
190        break;
191      case PRELIMINARY:
192        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY);
193        break;
194      case FINAL:
195        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.FINAL);
196        break;
197      case AMENDED:
198        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.AMENDED);
199        break;
200      case CORRECTED:
201        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CORRECTED);
202        break;
203      case CANCELLED:
204        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CANCELLED);
205        break;
206      case ENTEREDINERROR:
207        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR);
208        break;
209      case UNKNOWN:
210        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.UNKNOWN);
211        break;
212      default:
213        tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.NULL);
214        break;
215    }
216    return tgt;
217  }
218}