001package org.hl7.fhir.convertors.conv43_50.resources43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Annotation43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Quantity43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50; 012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 013import org.hl7.fhir.exceptions.FHIRException; 014import org.hl7.fhir.r5.model.CodeableReference; 015 016/* 017 Copyright (c) 2011+, HL7, Inc. 018 All rights reserved. 019 020 Redistribution and use in source and binary forms, with or without modification, 021 are permitted provided that the following conditions are met: 022 023 * Redistributions of source code must retain the above copyright notice, this 024 list of conditions and the following disclaimer. 025 * Redistributions in binary form must reproduce the above copyright notice, 026 this list of conditions and the following disclaimer in the documentation 027 and/or other materials provided with the distribution. 028 * Neither the name of HL7 nor the names of its contributors may be used to 029 endorse or promote products derived from this software without specific 030 prior written permission. 031 032 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 033 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 034 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 035 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 036 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 037 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 038 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 039 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 040 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 041 POSSIBILITY OF SUCH DAMAGE. 042 043*/ 044// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 045public class ChargeItem43_50 { 046 047 public static org.hl7.fhir.r5.model.ChargeItem convertChargeItem(org.hl7.fhir.r4b.model.ChargeItem src) throws FHIRException { 048 if (src == null) 049 return null; 050 org.hl7.fhir.r5.model.ChargeItem tgt = new org.hl7.fhir.r5.model.ChargeItem(); 051 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 052 for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) 053 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 054 for (org.hl7.fhir.r4b.model.UriType t : src.getDefinitionUri()) tgt.getDefinitionUri().add(Uri43_50.convertUri(t)); 055 for (org.hl7.fhir.r4b.model.CanonicalType t : src.getDefinitionCanonical()) 056 tgt.getDefinitionCanonical().add(Canonical43_50.convertCanonical(t)); 057 if (src.hasStatus()) 058 tgt.setStatusElement(convertChargeItemStatus(src.getStatusElement())); 059 for (org.hl7.fhir.r4b.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference43_50.convertReference(t)); 060 if (src.hasCode()) 061 tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode())); 062 if (src.hasSubject()) 063 tgt.setSubject(Reference43_50.convertReference(src.getSubject())); 064 if (src.hasContext()) 065 tgt.setEncounter(Reference43_50.convertReference(src.getContext())); 066 if (src.hasOccurrence()) 067 tgt.setOccurrence(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOccurrence())); 068 for (org.hl7.fhir.r4b.model.ChargeItem.ChargeItemPerformerComponent t : src.getPerformer()) 069 tgt.addPerformer(convertChargeItemPerformerComponent(t)); 070 if (src.hasPerformingOrganization()) 071 tgt.setPerformingOrganization(Reference43_50.convertReference(src.getPerformingOrganization())); 072 if (src.hasRequestingOrganization()) 073 tgt.setRequestingOrganization(Reference43_50.convertReference(src.getRequestingOrganization())); 074 if (src.hasCostCenter()) 075 tgt.setCostCenter(Reference43_50.convertReference(src.getCostCenter())); 076 if (src.hasQuantity()) 077 tgt.setQuantity(Quantity43_50.convertQuantity(src.getQuantity())); 078 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getBodysite()) 079 tgt.addBodysite(CodeableConcept43_50.convertCodeableConcept(t)); 080// if (src.hasFactorOverride()) 081// tgt.setFactorOverrideElement(Decimal43_50.convertDecimal(src.getFactorOverrideElement())); 082// if (src.hasPriceOverride()) 083// tgt.setPriceOverride(Money43_50.convertMoney(src.getPriceOverride())); 084 if (src.hasOverrideReason()) 085 tgt.getOverrideReason().setTextElement(String43_50.convertString(src.getOverrideReasonElement())); 086 if (src.hasEnterer()) 087 tgt.setEnterer(Reference43_50.convertReference(src.getEnterer())); 088 if (src.hasEnteredDate()) 089 tgt.setEnteredDateElement(DateTime43_50.convertDateTime(src.getEnteredDateElement())); 090 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getReason()) 091 tgt.addReason(CodeableConcept43_50.convertCodeableConcept(t)); 092 for (org.hl7.fhir.r4b.model.Reference t : src.getService()) tgt.addService(Reference43_50.convertReferenceToCodeableReference(t)); 093 if (src.hasProductCodeableConcept()) 094 tgt.addProduct().setConcept(CodeableConcept43_50.convertCodeableConcept(src.getProductCodeableConcept())); 095 else if (src.hasProductReference()) 096 tgt.addProduct().setReference(Reference43_50.convertReference(src.getProductReference())); 097 for (org.hl7.fhir.r4b.model.Reference t : src.getAccount()) tgt.addAccount(Reference43_50.convertReference(t)); 098 for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 099 for (org.hl7.fhir.r4b.model.Reference t : src.getSupportingInformation()) 100 tgt.addSupportingInformation(Reference43_50.convertReference(t)); 101 return tgt; 102 } 103 104 public static org.hl7.fhir.r4b.model.ChargeItem convertChargeItem(org.hl7.fhir.r5.model.ChargeItem src) throws FHIRException { 105 if (src == null) 106 return null; 107 org.hl7.fhir.r4b.model.ChargeItem tgt = new org.hl7.fhir.r4b.model.ChargeItem(); 108 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 109 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 110 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 111 for (org.hl7.fhir.r5.model.UriType t : src.getDefinitionUri()) tgt.getDefinitionUri().add(Uri43_50.convertUri(t)); 112 for (org.hl7.fhir.r5.model.CanonicalType t : src.getDefinitionCanonical()) 113 tgt.getDefinitionCanonical().add(Canonical43_50.convertCanonical(t)); 114 if (src.hasStatus()) 115 tgt.setStatusElement(convertChargeItemStatus(src.getStatusElement())); 116 for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference43_50.convertReference(t)); 117 if (src.hasCode()) 118 tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode())); 119 if (src.hasSubject()) 120 tgt.setSubject(Reference43_50.convertReference(src.getSubject())); 121 if (src.hasEncounter()) 122 tgt.setContext(Reference43_50.convertReference(src.getEncounter())); 123 if (src.hasOccurrence()) 124 tgt.setOccurrence(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOccurrence())); 125 for (org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent t : src.getPerformer()) 126 tgt.addPerformer(convertChargeItemPerformerComponent(t)); 127 if (src.hasPerformingOrganization()) 128 tgt.setPerformingOrganization(Reference43_50.convertReference(src.getPerformingOrganization())); 129 if (src.hasRequestingOrganization()) 130 tgt.setRequestingOrganization(Reference43_50.convertReference(src.getRequestingOrganization())); 131 if (src.hasCostCenter()) 132 tgt.setCostCenter(Reference43_50.convertReference(src.getCostCenter())); 133 if (src.hasQuantity()) 134 tgt.setQuantity(Quantity43_50.convertQuantity(src.getQuantity())); 135 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodysite()) 136 tgt.addBodysite(CodeableConcept43_50.convertCodeableConcept(t)); 137// if (src.hasFactorOverride()) 138// tgt.setFactorOverrideElement(Decimal43_50.convertDecimal(src.getFactorOverrideElement())); 139// if (src.hasPriceOverride()) 140// tgt.setPriceOverride(Money43_50.convertMoney(src.getPriceOverride())); 141 if (src.getOverrideReason().hasText()) 142 tgt.setOverrideReasonElement(String43_50.convertString(src.getOverrideReason().getTextElement())); 143 if (src.hasEnterer()) 144 tgt.setEnterer(Reference43_50.convertReference(src.getEnterer())); 145 if (src.hasEnteredDate()) 146 tgt.setEnteredDateElement(DateTime43_50.convertDateTime(src.getEnteredDateElement())); 147 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) 148 tgt.addReason(CodeableConcept43_50.convertCodeableConcept(t)); 149 for (CodeableReference t : src.getService()) tgt.addService(Reference43_50.convertCodeableReferenceToReference(t)); 150 if (src.getProductFirstRep().hasConcept()) 151 tgt.setProduct(CodeableConcept43_50.convertCodeableConcept(src.getProductFirstRep().getConcept())); 152 if (src.getProductFirstRep().hasReference()) 153 tgt.setProduct(Reference43_50.convertReference(src.getProductFirstRep().getReference())); 154 for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) tgt.addAccount(Reference43_50.convertReference(t)); 155 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 156 for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) 157 tgt.addSupportingInformation(Reference43_50.convertReference(t)); 158 return tgt; 159 } 160 161 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus> convertChargeItemStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus> src) throws FHIRException { 162 if (src == null || src.isEmpty()) 163 return null; 164 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatusEnumFactory()); 165 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 166 switch (src.getValue()) { 167 case PLANNED: 168 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.PLANNED); 169 break; 170 case BILLABLE: 171 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.BILLABLE); 172 break; 173 case NOTBILLABLE: 174 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.NOTBILLABLE); 175 break; 176 case ABORTED: 177 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.ABORTED); 178 break; 179 case BILLED: 180 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.BILLED); 181 break; 182 case ENTEREDINERROR: 183 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.ENTEREDINERROR); 184 break; 185 case UNKNOWN: 186 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.UNKNOWN); 187 break; 188 default: 189 tgt.setValue(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.NULL); 190 break; 191 } 192 return tgt; 193 } 194 195 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus> convertChargeItemStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus> src) throws FHIRException { 196 if (src == null || src.isEmpty()) 197 return null; 198 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatusEnumFactory()); 199 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 200 switch (src.getValue()) { 201 case PLANNED: 202 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.PLANNED); 203 break; 204 case BILLABLE: 205 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.BILLABLE); 206 break; 207 case NOTBILLABLE: 208 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.NOTBILLABLE); 209 break; 210 case ABORTED: 211 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.ABORTED); 212 break; 213 case BILLED: 214 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.BILLED); 215 break; 216 case ENTEREDINERROR: 217 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.ENTEREDINERROR); 218 break; 219 case UNKNOWN: 220 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.UNKNOWN); 221 break; 222 default: 223 tgt.setValue(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemStatus.NULL); 224 break; 225 } 226 return tgt; 227 } 228 229 public static org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent convertChargeItemPerformerComponent(org.hl7.fhir.r4b.model.ChargeItem.ChargeItemPerformerComponent src) throws FHIRException { 230 if (src == null) 231 return null; 232 org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent tgt = new org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent(); 233 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 234 if (src.hasFunction()) 235 tgt.setFunction(CodeableConcept43_50.convertCodeableConcept(src.getFunction())); 236 if (src.hasActor()) 237 tgt.setActor(Reference43_50.convertReference(src.getActor())); 238 return tgt; 239 } 240 241 public static org.hl7.fhir.r4b.model.ChargeItem.ChargeItemPerformerComponent convertChargeItemPerformerComponent(org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent src) throws FHIRException { 242 if (src == null) 243 return null; 244 org.hl7.fhir.r4b.model.ChargeItem.ChargeItemPerformerComponent tgt = new org.hl7.fhir.r4b.model.ChargeItem.ChargeItemPerformerComponent(); 245 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 246 if (src.hasFunction()) 247 tgt.setFunction(CodeableConcept43_50.convertCodeableConcept(src.getFunction())); 248 if (src.hasActor()) 249 tgt.setActor(Reference43_50.convertReference(src.getActor())); 250 return tgt; 251 } 252}