
001package org.hl7.fhir.convertors.conv40_50.resources40_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext40_50; 004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50; 007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50; 009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; 010import org.hl7.fhir.exceptions.FHIRException; 011import org.hl7.fhir.r5.model.DetectedIssue; 012import org.hl7.fhir.r5.model.Enumeration; 013 014/* 015 Copyright (c) 2011+, HL7, Inc. 016 All rights reserved. 017 018 Redistribution and use in source and binary forms, with or without modification, 019 are permitted provided that the following conditions are met: 020 021 * Redistributions of source code must retain the above copyright notice, this 022 list of conditions and the following disclaimer. 023 * Redistributions in binary form must reproduce the above copyright notice, 024 this list of conditions and the following disclaimer in the documentation 025 and/or other materials provided with the distribution. 026 * Neither the name of HL7 nor the names of its contributors may be used to 027 endorse or promote products derived from this software without specific 028 prior written permission. 029 030 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 031 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 032 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 033 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 034 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 035 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 036 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 037 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 038 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 039 POSSIBILITY OF SUCH DAMAGE. 040 041*/ 042// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 043public class DetectedIssue40_50 { 044 045 public static org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException { 046 if (src == null) 047 return null; 048 org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); 049 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 050 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 051 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 052 if (src.hasStatus()) 053 tgt.setStatusElement(convertDetectedIssueStatus(src.getStatusElement())); 054 if (src.hasCode()) 055 tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode())); 056 if (src.hasSeverity()) 057 tgt.setSeverityElement(convertDetectedIssueSeverity(src.getSeverityElement())); 058 if (src.hasPatient()) 059 tgt.setSubject(Reference40_50.convertReference(src.getPatient())); 060 if (src.hasIdentified()) 061 tgt.setIdentified(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getIdentified())); 062 if (src.hasAuthor()) 063 tgt.setAuthor(Reference40_50.convertReference(src.getAuthor())); 064 for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) tgt.addImplicated(Reference40_50.convertReference(t)); 065 for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent t : src.getEvidence()) 066 tgt.addEvidence(convertDetectedIssueEvidenceComponent(t)); 067 if (src.hasDetail()) 068 tgt.setDetailElement(String40_50.convertStringToMarkdown(src.getDetailElement())); 069 if (src.hasReference()) 070 tgt.setReferenceElement(Uri40_50.convertUri(src.getReferenceElement())); 071 for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) 072 tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); 073 return tgt; 074 } 075 076 public static org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { 077 if (src == null) 078 return null; 079 org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue(); 080 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 081 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 082 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 083 if (src.hasStatus()) 084 tgt.setStatusElement(convertDetectedIssueStatus(src.getStatusElement())); 085 if (src.hasCode()) 086 tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode())); 087 if (src.hasSeverity()) 088 tgt.setSeverityElement(convertDetectedIssueSeverity(src.getSeverityElement())); 089 if (src.hasSubject()) 090 tgt.setPatient(Reference40_50.convertReference(src.getSubject())); 091 if (src.hasIdentified()) 092 tgt.setIdentified(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getIdentified())); 093 if (src.hasAuthor()) 094 tgt.setAuthor(Reference40_50.convertReference(src.getAuthor())); 095 for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) tgt.addImplicated(Reference40_50.convertReference(t)); 096 for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent t : src.getEvidence()) 097 tgt.addEvidence(convertDetectedIssueEvidenceComponent(t)); 098 if (src.hasDetail()) 099 tgt.setDetailElement(String40_50.convertString(src.getDetailElement())); 100 if (src.hasReference()) 101 tgt.setReferenceElement(Uri40_50.convertUri(src.getReferenceElement())); 102 for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) 103 tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); 104 return tgt; 105 } 106 107 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus> convertDetectedIssueStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus> src) throws FHIRException { 108 if (src == null || src.isEmpty()) 109 return null; 110 Enumeration<DetectedIssue.DetectedIssueStatus> tgt = new Enumeration<>(new DetectedIssue.DetectedIssueStatusEnumFactory()); 111 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 112 if (src.getValue() == null) { 113 tgt.setValue(null); 114 } else { 115 switch (src.getValue()) { 116 case REGISTERED: 117 tgt.setValue(DetectedIssue.DetectedIssueStatus.PRELIMINARY); 118 break; 119 case PRELIMINARY: 120 tgt.setValue(DetectedIssue.DetectedIssueStatus.PRELIMINARY); 121 break; 122 case FINAL: 123 tgt.setValue(DetectedIssue.DetectedIssueStatus.FINAL); 124 break; 125 case AMENDED: 126 tgt.setValue(DetectedIssue.DetectedIssueStatus.FINAL); 127 break; 128 case CORRECTED: 129 tgt.setValue(DetectedIssue.DetectedIssueStatus.MITIGATED); 130 break; 131 case CANCELLED: 132 tgt.setValue(DetectedIssue.DetectedIssueStatus.MITIGATED); 133 break; 134 case ENTEREDINERROR: 135 tgt.setValue(DetectedIssue.DetectedIssueStatus.ENTEREDINERROR); 136 break; 137 case UNKNOWN: 138 tgt.setValue(DetectedIssue.DetectedIssueStatus.NULL); 139 break; 140 default: 141 tgt.setValue(DetectedIssue.DetectedIssueStatus.NULL); 142 break; 143 } 144 } 145 return tgt; 146 } 147 148 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus> convertDetectedIssueStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus> src) throws FHIRException { 149 if (src == null || src.isEmpty()) 150 return null; 151 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()); 152 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 153 if (src.getValue() == null) { 154 tgt.setValue(null); 155 } else { 156 switch (src.getValue()) { 157 case PRELIMINARY: 158 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY); 159 break; 160 case FINAL: 161 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.FINAL); 162 break; 163 case MITIGATED: 164 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CORRECTED); 165 break; 166 case ENTEREDINERROR: 167 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR); 168 break; 169 default: 170 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.NULL); 171 break; 172 } 173 } 174 return tgt; 175 } 176 177 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity> convertDetectedIssueSeverity(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity> src) throws FHIRException { 178 if (src == null || src.isEmpty()) 179 return null; 180 Enumeration<DetectedIssue.DetectedIssueSeverity> tgt = new Enumeration<>(new DetectedIssue.DetectedIssueSeverityEnumFactory()); 181 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 182 if (src.getValue() == null) { 183 tgt.setValue(null); 184 } else { 185 switch (src.getValue()) { 186 case HIGH: 187 tgt.setValue(DetectedIssue.DetectedIssueSeverity.HIGH); 188 break; 189 case MODERATE: 190 tgt.setValue(DetectedIssue.DetectedIssueSeverity.MODERATE); 191 break; 192 case LOW: 193 tgt.setValue(DetectedIssue.DetectedIssueSeverity.LOW); 194 break; 195 default: 196 tgt.setValue(DetectedIssue.DetectedIssueSeverity.NULL); 197 break; 198 } 199 } 200 return tgt; 201 } 202 203 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity> convertDetectedIssueSeverity(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity> src) throws FHIRException { 204 if (src == null || src.isEmpty()) 205 return null; 206 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()); 207 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 208 if (src.getValue() == null) { 209 tgt.setValue(null); 210 } else { 211 switch (src.getValue()) { 212 case HIGH: 213 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH); 214 break; 215 case MODERATE: 216 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE); 217 break; 218 case LOW: 219 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW); 220 break; 221 default: 222 tgt.setValue(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL); 223 break; 224 } 225 } 226 return tgt; 227 } 228 229 public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent convertDetectedIssueEvidenceComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent src) throws FHIRException { 230 if (src == null) 231 return null; 232 org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent(); 233 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 234 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) 235 tgt.addCode(CodeableConcept40_50.convertCodeableConcept(t)); 236 for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) tgt.addDetail(Reference40_50.convertReference(t)); 237 return tgt; 238 } 239 240 public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent convertDetectedIssueEvidenceComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent src) throws FHIRException { 241 if (src == null) 242 return null; 243 org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent(); 244 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 245 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) 246 tgt.addCode(CodeableConcept40_50.convertCodeableConcept(t)); 247 for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) tgt.addDetail(Reference40_50.convertReference(t)); 248 return tgt; 249 } 250 251 public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { 252 if (src == null) 253 return null; 254 org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); 255 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 256 if (src.hasAction()) 257 tgt.setAction(CodeableConcept40_50.convertCodeableConcept(src.getAction())); 258 if (src.hasDate()) 259 tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement())); 260 if (src.hasAuthor()) 261 tgt.setAuthor(Reference40_50.convertReference(src.getAuthor())); 262 return tgt; 263 } 264 265 public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { 266 if (src == null) 267 return null; 268 org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent(); 269 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 270 if (src.hasAction()) 271 tgt.setAction(CodeableConcept40_50.convertCodeableConcept(src.getAction())); 272 if (src.hasDate()) 273 tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement())); 274 if (src.hasAuthor()) 275 tgt.setAuthor(Reference40_50.convertReference(src.getAuthor())); 276 return tgt; 277 } 278}