001package org.hl7.fhir.convertors.conv40_50;
002
003
004import org.hl7.fhir.convertors.VersionConvertor_40_50;
005import org.hl7.fhir.exceptions.FHIRException;
006
007/*
008  Copyright (c) 2011+, HL7, Inc.
009  All rights reserved.
010  
011  Redistribution and use in source and binary forms, with or without modification, 
012  are permitted provided that the following conditions are met:
013  
014   * Redistributions of source code must retain the above copyright notice, this 
015     list of conditions and the following disclaimer.
016   * Redistributions in binary form must reproduce the above copyright notice, 
017     this list of conditions and the following disclaimer in the documentation 
018     and/or other materials provided with the distribution.
019   * Neither the name of HL7 nor the names of its contributors may be used to 
020     endorse or promote products derived from this software without specific 
021     prior written permission.
022  
023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
026  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
027  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
028  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
029  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
030  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
031  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
032  POSSIBILITY OF SUCH DAMAGE.
033  
034*/
035// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
036public class ExplanationOfBenefit40_50 extends VersionConvertor_40_50 {
037
038    public static org.hl7.fhir.r5.model.ExplanationOfBenefit convertExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit src) throws FHIRException {
039        if (src == null)
040            return null;
041        org.hl7.fhir.r5.model.ExplanationOfBenefit tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit();
042        copyDomainResource(src, tgt);
043        for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
044        if (src.hasStatus())
045            tgt.setStatusElement(convertExplanationOfBenefitStatus(src.getStatusElement()));
046        if (src.hasType())
047            tgt.setType(convertCodeableConcept(src.getType()));
048        if (src.hasSubType())
049            tgt.setSubType(convertCodeableConcept(src.getSubType()));
050        if (src.hasUse())
051            tgt.setUseElement(convertUse(src.getUseElement()));
052        if (src.hasPatient())
053            tgt.setPatient(convertReference(src.getPatient()));
054        if (src.hasBillablePeriod())
055            tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod()));
056        if (src.hasCreated())
057            tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
058        if (src.hasEnterer())
059            tgt.setEnterer(convertReference(src.getEnterer()));
060        if (src.hasInsurer())
061            tgt.setInsurer(convertReference(src.getInsurer()));
062        if (src.hasProvider())
063            tgt.setProvider(convertReference(src.getProvider()));
064        if (src.hasPriority())
065            tgt.setPriority(convertCodeableConcept(src.getPriority()));
066        if (src.hasFundsReserveRequested())
067            tgt.setFundsReserveRequested(convertCodeableConcept(src.getFundsReserveRequested()));
068        if (src.hasFundsReserve())
069            tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve()));
070        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent t : src.getRelated()) tgt.addRelated(convertRelatedClaimComponent(t));
071        if (src.hasPrescription())
072            tgt.setPrescription(convertReference(src.getPrescription()));
073        if (src.hasOriginalPrescription())
074            tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription()));
075        if (src.hasPayee())
076            tgt.setPayee(convertPayeeComponent(src.getPayee()));
077        if (src.hasReferral())
078            tgt.setReferral(convertReference(src.getReferral()));
079        if (src.hasFacility())
080            tgt.setFacility(convertReference(src.getFacility()));
081        if (src.hasClaim())
082            tgt.setClaim(convertReference(src.getClaim()));
083        if (src.hasClaimResponse())
084            tgt.setClaimResponse(convertReference(src.getClaimResponse()));
085        if (src.hasOutcome())
086            tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
087        if (src.hasDisposition())
088            tgt.setDispositionElement(convertString(src.getDispositionElement()));
089        for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef()) tgt.getPreAuthRef().add(convertString(t));
090        for (org.hl7.fhir.r4.model.Period t : src.getPreAuthRefPeriod()) tgt.addPreAuthRefPeriod(convertPeriod(t));
091        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent t : src.getCareTeam()) tgt.addCareTeam(convertCareTeamComponent(t));
092        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent t : src.getSupportingInfo()) tgt.addSupportingInfo(convertSupportingInformationComponent(t));
093        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(convertDiagnosisComponent(t));
094        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent t : src.getProcedure()) tgt.addProcedure(convertProcedureComponent(t));
095        if (src.hasPrecedence())
096            tgt.setPrecedenceElement(convertPositiveInt(src.getPrecedenceElement()));
097        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent t : src.getInsurance()) tgt.addInsurance(convertInsuranceComponent(t));
098        if (src.hasAccident())
099            tgt.setAccident(convertAccidentComponent(src.getAccident()));
100        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent t : src.getItem()) tgt.addItem(convertItemComponent(t));
101        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent t : src.getAddItem()) tgt.addAddItem(convertAddedItemComponent(t));
102        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
103        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent t : src.getTotal()) tgt.addTotal(convertTotalComponent(t));
104        if (src.hasPayment())
105            tgt.setPayment(convertPaymentComponent(src.getPayment()));
106        if (src.hasFormCode())
107            tgt.setFormCode(convertCodeableConcept(src.getFormCode()));
108        if (src.hasForm())
109            tgt.setForm(convertAttachment(src.getForm()));
110        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent t : src.getProcessNote()) tgt.addProcessNote(convertNoteComponent(t));
111        if (src.hasBenefitPeriod())
112            tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod()));
113        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent t : src.getBenefitBalance()) tgt.addBenefitBalance(convertBenefitBalanceComponent(t));
114        return tgt;
115    }
116
117    public static org.hl7.fhir.r4.model.ExplanationOfBenefit convertExplanationOfBenefit(org.hl7.fhir.r5.model.ExplanationOfBenefit src) throws FHIRException {
118        if (src == null)
119            return null;
120        org.hl7.fhir.r4.model.ExplanationOfBenefit tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit();
121        copyDomainResource(src, tgt);
122        for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
123        if (src.hasStatus())
124            tgt.setStatusElement(convertExplanationOfBenefitStatus(src.getStatusElement()));
125        if (src.hasType())
126            tgt.setType(convertCodeableConcept(src.getType()));
127        if (src.hasSubType())
128            tgt.setSubType(convertCodeableConcept(src.getSubType()));
129        if (src.hasUse())
130            tgt.setUseElement(convertUse(src.getUseElement()));
131        if (src.hasPatient())
132            tgt.setPatient(convertReference(src.getPatient()));
133        if (src.hasBillablePeriod())
134            tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod()));
135        if (src.hasCreated())
136            tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
137        if (src.hasEnterer())
138            tgt.setEnterer(convertReference(src.getEnterer()));
139        if (src.hasInsurer())
140            tgt.setInsurer(convertReference(src.getInsurer()));
141        if (src.hasProvider())
142            tgt.setProvider(convertReference(src.getProvider()));
143        if (src.hasPriority())
144            tgt.setPriority(convertCodeableConcept(src.getPriority()));
145        if (src.hasFundsReserveRequested())
146            tgt.setFundsReserveRequested(convertCodeableConcept(src.getFundsReserveRequested()));
147        if (src.hasFundsReserve())
148            tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve()));
149        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent t : src.getRelated()) tgt.addRelated(convertRelatedClaimComponent(t));
150        if (src.hasPrescription())
151            tgt.setPrescription(convertReference(src.getPrescription()));
152        if (src.hasOriginalPrescription())
153            tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription()));
154        if (src.hasPayee())
155            tgt.setPayee(convertPayeeComponent(src.getPayee()));
156        if (src.hasReferral())
157            tgt.setReferral(convertReference(src.getReferral()));
158        if (src.hasFacility())
159            tgt.setFacility(convertReference(src.getFacility()));
160        if (src.hasClaim())
161            tgt.setClaim(convertReference(src.getClaim()));
162        if (src.hasClaimResponse())
163            tgt.setClaimResponse(convertReference(src.getClaimResponse()));
164        if (src.hasOutcome())
165            tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
166        if (src.hasDisposition())
167            tgt.setDispositionElement(convertString(src.getDispositionElement()));
168        for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) tgt.getPreAuthRef().add(convertString(t));
169        for (org.hl7.fhir.r5.model.Period t : src.getPreAuthRefPeriod()) tgt.addPreAuthRefPeriod(convertPeriod(t));
170        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent t : src.getCareTeam()) tgt.addCareTeam(convertCareTeamComponent(t));
171        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent t : src.getSupportingInfo()) tgt.addSupportingInfo(convertSupportingInformationComponent(t));
172        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(convertDiagnosisComponent(t));
173        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent t : src.getProcedure()) tgt.addProcedure(convertProcedureComponent(t));
174        if (src.hasPrecedence())
175            tgt.setPrecedenceElement(convertPositiveInt(src.getPrecedenceElement()));
176        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent t : src.getInsurance()) tgt.addInsurance(convertInsuranceComponent(t));
177        if (src.hasAccident())
178            tgt.setAccident(convertAccidentComponent(src.getAccident()));
179        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent t : src.getItem()) tgt.addItem(convertItemComponent(t));
180        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent t : src.getAddItem()) tgt.addAddItem(convertAddedItemComponent(t));
181        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
182        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent t : src.getTotal()) tgt.addTotal(convertTotalComponent(t));
183        if (src.hasPayment())
184            tgt.setPayment(convertPaymentComponent(src.getPayment()));
185        if (src.hasFormCode())
186            tgt.setFormCode(convertCodeableConcept(src.getFormCode()));
187        if (src.hasForm())
188            tgt.setForm(convertAttachment(src.getForm()));
189        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent t : src.getProcessNote()) tgt.addProcessNote(convertNoteComponent(t));
190        if (src.hasBenefitPeriod())
191            tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod()));
192        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent t : src.getBenefitBalance()) tgt.addBenefitBalance(convertBenefitBalanceComponent(t));
193        return tgt;
194    }
195
196    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus> convertExplanationOfBenefitStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus> src) throws FHIRException {
197        if (src == null || src.isEmpty())
198            return null;
199        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory());
200        VersionConvertor_40_50.copyElement(src, tgt);
201        switch(src.getValue()) {
202            case ACTIVE:
203                tgt.setValue(org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ACTIVE);
204                break;
205            case CANCELLED:
206                tgt.setValue(org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.CANCELLED);
207                break;
208            case DRAFT:
209                tgt.setValue(org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.DRAFT);
210                break;
211            case ENTEREDINERROR:
212                tgt.setValue(org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ENTEREDINERROR);
213                break;
214            default:
215                tgt.setValue(org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL);
216                break;
217        }
218        return tgt;
219    }
220
221    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus> convertExplanationOfBenefitStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus> src) throws FHIRException {
222        if (src == null || src.isEmpty())
223            return null;
224        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory());
225        VersionConvertor_40_50.copyElement(src, tgt);
226        switch(src.getValue()) {
227            case ACTIVE:
228                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ACTIVE);
229                break;
230            case CANCELLED:
231                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.CANCELLED);
232                break;
233            case DRAFT:
234                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.DRAFT);
235                break;
236            case ENTEREDINERROR:
237                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ENTEREDINERROR);
238                break;
239            default:
240                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL);
241                break;
242        }
243        return tgt;
244    }
245
246    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.Use> convertUse(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.Use> src) throws FHIRException {
247        if (src == null || src.isEmpty())
248            return null;
249        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.Use> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.UseEnumFactory());
250        VersionConvertor_40_50.copyElement(src, tgt);
251        switch(src.getValue()) {
252            case CLAIM:
253                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.CLAIM);
254                break;
255            case PREAUTHORIZATION:
256                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.PREAUTHORIZATION);
257                break;
258            case PREDETERMINATION:
259                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.PREDETERMINATION);
260                break;
261            default:
262                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.NULL);
263                break;
264        }
265        return tgt;
266    }
267
268    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.Use> convertUse(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.Use> src) throws FHIRException {
269        if (src == null || src.isEmpty())
270            return null;
271        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.Use> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ExplanationOfBenefit.UseEnumFactory());
272        VersionConvertor_40_50.copyElement(src, tgt);
273        switch(src.getValue()) {
274            case CLAIM:
275                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.CLAIM);
276                break;
277            case PREAUTHORIZATION:
278                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.PREAUTHORIZATION);
279                break;
280            case PREDETERMINATION:
281                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.PREDETERMINATION);
282                break;
283            default:
284                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.NULL);
285                break;
286        }
287        return tgt;
288    }
289
290    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes> convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome> src) throws FHIRException {
291        if (src == null || src.isEmpty())
292            return null;
293        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodesEnumFactory());
294        VersionConvertor_40_50.copyElement(src, tgt);
295        switch(src.getValue()) {
296            case QUEUED:
297                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.QUEUED);
298                break;
299            case COMPLETE:
300                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.COMPLETE);
301                break;
302            case ERROR:
303                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.ERROR);
304                break;
305            case PARTIAL:
306                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.PARTIAL);
307                break;
308            default:
309                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.NULL);
310                break;
311        }
312        return tgt;
313    }
314
315    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome> convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes> src) throws FHIRException {
316        if (src == null || src.isEmpty())
317            return null;
318        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcomeEnumFactory());
319        VersionConvertor_40_50.copyElement(src, tgt);
320        switch(src.getValue()) {
321            case QUEUED:
322                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.QUEUED);
323                break;
324            case COMPLETE:
325                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.COMPLETE);
326                break;
327            case ERROR:
328                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.ERROR);
329                break;
330            case PARTIAL:
331                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.PARTIAL);
332                break;
333            default:
334                tgt.setValue(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.NULL);
335                break;
336        }
337        return tgt;
338    }
339
340    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent src) throws FHIRException {
341        if (src == null)
342            return null;
343        org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent();
344        copyElement(src, tgt);
345        if (src.hasClaim())
346            tgt.setClaim(convertReference(src.getClaim()));
347        if (src.hasRelationship())
348            tgt.setRelationship(convertCodeableConcept(src.getRelationship()));
349        if (src.hasReference())
350            tgt.setReference(convertIdentifier(src.getReference()));
351        return tgt;
352    }
353
354    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent src) throws FHIRException {
355        if (src == null)
356            return null;
357        org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent();
358        copyElement(src, tgt);
359        if (src.hasClaim())
360            tgt.setClaim(convertReference(src.getClaim()));
361        if (src.hasRelationship())
362            tgt.setRelationship(convertCodeableConcept(src.getRelationship()));
363        if (src.hasReference())
364            tgt.setReference(convertIdentifier(src.getReference()));
365        return tgt;
366    }
367
368    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent convertPayeeComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent src) throws FHIRException {
369        if (src == null)
370            return null;
371        org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent();
372        copyElement(src, tgt);
373        if (src.hasType())
374            tgt.setType(convertCodeableConcept(src.getType()));
375        if (src.hasParty())
376            tgt.setParty(convertReference(src.getParty()));
377        return tgt;
378    }
379
380    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent convertPayeeComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent src) throws FHIRException {
381        if (src == null)
382            return null;
383        org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent();
384        copyElement(src, tgt);
385        if (src.hasType())
386            tgt.setType(convertCodeableConcept(src.getType()));
387        if (src.hasParty())
388            tgt.setParty(convertReference(src.getParty()));
389        return tgt;
390    }
391
392    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent src) throws FHIRException {
393        if (src == null)
394            return null;
395        org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent();
396        copyElement(src, tgt);
397        if (src.hasSequence())
398            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
399        if (src.hasProvider())
400            tgt.setProvider(convertReference(src.getProvider()));
401        if (src.hasResponsible())
402            tgt.setResponsibleElement(convertBoolean(src.getResponsibleElement()));
403        if (src.hasRole())
404            tgt.setRole(convertCodeableConcept(src.getRole()));
405        if (src.hasQualification())
406            tgt.setQualification(convertCodeableConcept(src.getQualification()));
407        return tgt;
408    }
409
410    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent src) throws FHIRException {
411        if (src == null)
412            return null;
413        org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent();
414        copyElement(src, tgt);
415        if (src.hasSequence())
416            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
417        if (src.hasProvider())
418            tgt.setProvider(convertReference(src.getProvider()));
419        if (src.hasResponsible())
420            tgt.setResponsibleElement(convertBoolean(src.getResponsibleElement()));
421        if (src.hasRole())
422            tgt.setRole(convertCodeableConcept(src.getRole()));
423        if (src.hasQualification())
424            tgt.setQualification(convertCodeableConcept(src.getQualification()));
425        return tgt;
426    }
427
428    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent src) throws FHIRException {
429        if (src == null)
430            return null;
431        org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent();
432        copyElement(src, tgt);
433        if (src.hasSequence())
434            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
435        if (src.hasCategory())
436            tgt.setCategory(convertCodeableConcept(src.getCategory()));
437        if (src.hasCode())
438            tgt.setCode(convertCodeableConcept(src.getCode()));
439        if (src.hasTiming())
440            tgt.setTiming(convertType(src.getTiming()));
441        if (src.hasValue())
442            tgt.setValue(convertType(src.getValue()));
443        if (src.hasReason())
444            tgt.setReason(convertCoding(src.getReason()));
445        return tgt;
446    }
447
448    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent src) throws FHIRException {
449        if (src == null)
450            return null;
451        org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent();
452        copyElement(src, tgt);
453        if (src.hasSequence())
454            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
455        if (src.hasCategory())
456            tgt.setCategory(convertCodeableConcept(src.getCategory()));
457        if (src.hasCode())
458            tgt.setCode(convertCodeableConcept(src.getCode()));
459        if (src.hasTiming())
460            tgt.setTiming(convertType(src.getTiming()));
461        if (src.hasValue())
462            tgt.setValue(convertType(src.getValue()));
463        if (src.hasReason())
464            tgt.setReason(convertCoding(src.getReason()));
465        return tgt;
466    }
467
468    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent src) throws FHIRException {
469        if (src == null)
470            return null;
471        org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent();
472        copyElement(src, tgt);
473        if (src.hasSequence())
474            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
475        if (src.hasDiagnosis())
476            tgt.setDiagnosis(convertType(src.getDiagnosis()));
477        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(convertCodeableConcept(t));
478        if (src.hasOnAdmission())
479            tgt.setOnAdmission(convertCodeableConcept(src.getOnAdmission()));
480        if (src.hasPackageCode())
481            tgt.setPackageCode(convertCodeableConcept(src.getPackageCode()));
482        return tgt;
483    }
484
485    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent src) throws FHIRException {
486        if (src == null)
487            return null;
488        org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent();
489        copyElement(src, tgt);
490        if (src.hasSequence())
491            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
492        if (src.hasDiagnosis())
493            tgt.setDiagnosis(convertType(src.getDiagnosis()));
494        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(convertCodeableConcept(t));
495        if (src.hasOnAdmission())
496            tgt.setOnAdmission(convertCodeableConcept(src.getOnAdmission()));
497        if (src.hasPackageCode())
498            tgt.setPackageCode(convertCodeableConcept(src.getPackageCode()));
499        return tgt;
500    }
501
502    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent src) throws FHIRException {
503        if (src == null)
504            return null;
505        org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent();
506        copyElement(src, tgt);
507        if (src.hasSequence())
508            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
509        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(convertCodeableConcept(t));
510        if (src.hasDate())
511            tgt.setDateElement(convertDateTime(src.getDateElement()));
512        if (src.hasProcedure())
513            tgt.setProcedure(convertType(src.getProcedure()));
514        for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
515        return tgt;
516    }
517
518    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent src) throws FHIRException {
519        if (src == null)
520            return null;
521        org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent();
522        copyElement(src, tgt);
523        if (src.hasSequence())
524            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
525        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(convertCodeableConcept(t));
526        if (src.hasDate())
527            tgt.setDateElement(convertDateTime(src.getDateElement()));
528        if (src.hasProcedure())
529            tgt.setProcedure(convertType(src.getProcedure()));
530        for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
531        return tgt;
532    }
533
534    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent src) throws FHIRException {
535        if (src == null)
536            return null;
537        org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent();
538        copyElement(src, tgt);
539        if (src.hasFocal())
540            tgt.setFocalElement(convertBoolean(src.getFocalElement()));
541        if (src.hasCoverage())
542            tgt.setCoverage(convertReference(src.getCoverage()));
543        for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef()) tgt.getPreAuthRef().add(convertString(t));
544        return tgt;
545    }
546
547    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent src) throws FHIRException {
548        if (src == null)
549            return null;
550        org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent();
551        copyElement(src, tgt);
552        if (src.hasFocal())
553            tgt.setFocalElement(convertBoolean(src.getFocalElement()));
554        if (src.hasCoverage())
555            tgt.setCoverage(convertReference(src.getCoverage()));
556        for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) tgt.getPreAuthRef().add(convertString(t));
557        return tgt;
558    }
559
560    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent convertAccidentComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent src) throws FHIRException {
561        if (src == null)
562            return null;
563        org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent();
564        copyElement(src, tgt);
565        if (src.hasDate())
566            tgt.setDateElement(convertDate(src.getDateElement()));
567        if (src.hasType())
568            tgt.setType(convertCodeableConcept(src.getType()));
569        if (src.hasLocation())
570            tgt.setLocation(convertType(src.getLocation()));
571        return tgt;
572    }
573
574    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent convertAccidentComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent src) throws FHIRException {
575        if (src == null)
576            return null;
577        org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent();
578        copyElement(src, tgt);
579        if (src.hasDate())
580            tgt.setDateElement(convertDate(src.getDateElement()));
581        if (src.hasType())
582            tgt.setType(convertCodeableConcept(src.getType()));
583        if (src.hasLocation())
584            tgt.setLocation(convertType(src.getLocation()));
585        return tgt;
586    }
587
588    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent convertItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent src) throws FHIRException {
589        if (src == null)
590            return null;
591        org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent();
592        copyElement(src, tgt);
593        if (src.hasSequence())
594            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
595        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getCareTeamSequence()) tgt.getCareTeamSequence().add(convertPositiveInt(t));
596        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDiagnosisSequence()) tgt.getDiagnosisSequence().add(convertPositiveInt(t));
597        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getProcedureSequence()) tgt.getProcedureSequence().add(convertPositiveInt(t));
598        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getInformationSequence()) tgt.getInformationSequence().add(convertPositiveInt(t));
599        if (src.hasRevenue())
600            tgt.setRevenue(convertCodeableConcept(src.getRevenue()));
601        if (src.hasCategory())
602            tgt.setCategory(convertCodeableConcept(src.getCategory()));
603        if (src.hasProductOrService())
604            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
605        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
606        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
607        if (src.hasServiced())
608            tgt.setServiced(convertType(src.getServiced()));
609        if (src.hasLocation())
610            tgt.setLocation(convertType(src.getLocation()));
611        if (src.hasQuantity())
612            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
613        if (src.hasUnitPrice())
614            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
615        if (src.hasFactor())
616            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
617        if (src.hasNet())
618            tgt.setNet(convertMoney(src.getNet()));
619        for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
620        if (src.hasBodySite())
621            tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
622        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) tgt.addSubSite(convertCodeableConcept(t));
623        for (org.hl7.fhir.r4.model.Reference t : src.getEncounter()) tgt.addEncounter(convertReference(t));
624        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
625        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
626        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent t : src.getDetail()) tgt.addDetail(convertDetailComponent(t));
627        return tgt;
628    }
629
630    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent src) throws FHIRException {
631        if (src == null)
632            return null;
633        org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent();
634        copyElement(src, tgt);
635        if (src.hasSequence())
636            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
637        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getCareTeamSequence()) tgt.getCareTeamSequence().add(convertPositiveInt(t));
638        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDiagnosisSequence()) tgt.getDiagnosisSequence().add(convertPositiveInt(t));
639        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getProcedureSequence()) tgt.getProcedureSequence().add(convertPositiveInt(t));
640        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getInformationSequence()) tgt.getInformationSequence().add(convertPositiveInt(t));
641        if (src.hasRevenue())
642            tgt.setRevenue(convertCodeableConcept(src.getRevenue()));
643        if (src.hasCategory())
644            tgt.setCategory(convertCodeableConcept(src.getCategory()));
645        if (src.hasProductOrService())
646            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
647        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
648        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
649        if (src.hasServiced())
650            tgt.setServiced(convertType(src.getServiced()));
651        if (src.hasLocation())
652            tgt.setLocation(convertType(src.getLocation()));
653        if (src.hasQuantity())
654            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
655        if (src.hasUnitPrice())
656            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
657        if (src.hasFactor())
658            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
659        if (src.hasNet())
660            tgt.setNet(convertMoney(src.getNet()));
661        for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
662        if (src.hasBodySite())
663            tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
664        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) tgt.addSubSite(convertCodeableConcept(t));
665        for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) tgt.addEncounter(convertReference(t));
666        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
667        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
668        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent t : src.getDetail()) tgt.addDetail(convertDetailComponent(t));
669        return tgt;
670    }
671
672    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent convertAdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent src) throws FHIRException {
673        if (src == null)
674            return null;
675        org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent();
676        copyElement(src, tgt);
677        if (src.hasCategory())
678            tgt.setCategory(convertCodeableConcept(src.getCategory()));
679        if (src.hasReason())
680            tgt.setReason(convertCodeableConcept(src.getReason()));
681        if (src.hasAmount())
682            tgt.setAmount(convertMoney(src.getAmount()));
683        if (src.hasValue())
684            tgt.setValueElement(convertDecimal(src.getValueElement()));
685        return tgt;
686    }
687
688    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent convertAdjudicationComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent src) throws FHIRException {
689        if (src == null)
690            return null;
691        org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent();
692        copyElement(src, tgt);
693        if (src.hasCategory())
694            tgt.setCategory(convertCodeableConcept(src.getCategory()));
695        if (src.hasReason())
696            tgt.setReason(convertCodeableConcept(src.getReason()));
697        if (src.hasAmount())
698            tgt.setAmount(convertMoney(src.getAmount()));
699        if (src.hasValue())
700            tgt.setValueElement(convertDecimal(src.getValueElement()));
701        return tgt;
702    }
703
704    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent convertDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent src) throws FHIRException {
705        if (src == null)
706            return null;
707        org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent();
708        copyElement(src, tgt);
709        if (src.hasSequence())
710            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
711        if (src.hasRevenue())
712            tgt.setRevenue(convertCodeableConcept(src.getRevenue()));
713        if (src.hasCategory())
714            tgt.setCategory(convertCodeableConcept(src.getCategory()));
715        if (src.hasProductOrService())
716            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
717        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
718        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
719        if (src.hasQuantity())
720            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
721        if (src.hasUnitPrice())
722            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
723        if (src.hasFactor())
724            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
725        if (src.hasNet())
726            tgt.setNet(convertMoney(src.getNet()));
727        for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
728        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
729        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
730        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent t : src.getSubDetail()) tgt.addSubDetail(convertSubDetailComponent(t));
731        return tgt;
732    }
733
734    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent convertDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent src) throws FHIRException {
735        if (src == null)
736            return null;
737        org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent();
738        copyElement(src, tgt);
739        if (src.hasSequence())
740            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
741        if (src.hasRevenue())
742            tgt.setRevenue(convertCodeableConcept(src.getRevenue()));
743        if (src.hasCategory())
744            tgt.setCategory(convertCodeableConcept(src.getCategory()));
745        if (src.hasProductOrService())
746            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
747        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
748        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
749        if (src.hasQuantity())
750            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
751        if (src.hasUnitPrice())
752            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
753        if (src.hasFactor())
754            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
755        if (src.hasNet())
756            tgt.setNet(convertMoney(src.getNet()));
757        for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
758        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
759        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
760        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent t : src.getSubDetail()) tgt.addSubDetail(convertSubDetailComponent(t));
761        return tgt;
762    }
763
764    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent src) throws FHIRException {
765        if (src == null)
766            return null;
767        org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent();
768        copyElement(src, tgt);
769        if (src.hasSequence())
770            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
771        if (src.hasRevenue())
772            tgt.setRevenue(convertCodeableConcept(src.getRevenue()));
773        if (src.hasCategory())
774            tgt.setCategory(convertCodeableConcept(src.getCategory()));
775        if (src.hasProductOrService())
776            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
777        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
778        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
779        if (src.hasQuantity())
780            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
781        if (src.hasUnitPrice())
782            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
783        if (src.hasFactor())
784            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
785        if (src.hasNet())
786            tgt.setNet(convertMoney(src.getNet()));
787        for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
788        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
789        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
790        return tgt;
791    }
792
793    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent src) throws FHIRException {
794        if (src == null)
795            return null;
796        org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent();
797        copyElement(src, tgt);
798        if (src.hasSequence())
799            tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement()));
800        if (src.hasRevenue())
801            tgt.setRevenue(convertCodeableConcept(src.getRevenue()));
802        if (src.hasCategory())
803            tgt.setCategory(convertCodeableConcept(src.getCategory()));
804        if (src.hasProductOrService())
805            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
806        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
807        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
808        if (src.hasQuantity())
809            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
810        if (src.hasUnitPrice())
811            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
812        if (src.hasFactor())
813            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
814        if (src.hasNet())
815            tgt.setNet(convertMoney(src.getNet()));
816        for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(convertReference(t));
817        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
818        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
819        return tgt;
820    }
821
822    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent convertAddedItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent src) throws FHIRException {
823        if (src == null)
824            return null;
825        org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent();
826        copyElement(src, tgt);
827        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getItemSequence()) tgt.getItemSequence().add(convertPositiveInt(t));
828        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDetailSequence()) tgt.getDetailSequence().add(convertPositiveInt(t));
829        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getSubDetailSequence()) tgt.getSubDetailSequence().add(convertPositiveInt(t));
830        for (org.hl7.fhir.r4.model.Reference t : src.getProvider()) tgt.addProvider(convertReference(t));
831        if (src.hasProductOrService())
832            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
833        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
834        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
835        if (src.hasServiced())
836            tgt.setServiced(convertType(src.getServiced()));
837        if (src.hasLocation())
838            tgt.setLocation(convertType(src.getLocation()));
839        if (src.hasQuantity())
840            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
841        if (src.hasUnitPrice())
842            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
843        if (src.hasFactor())
844            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
845        if (src.hasNet())
846            tgt.setNet(convertMoney(src.getNet()));
847        if (src.hasBodySite())
848            tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
849        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) tgt.addSubSite(convertCodeableConcept(t));
850        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
851        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
852        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent t : src.getDetail()) tgt.addDetail(convertAddedItemDetailComponent(t));
853        return tgt;
854    }
855
856    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent convertAddedItemComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent src) throws FHIRException {
857        if (src == null)
858            return null;
859        org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent();
860        copyElement(src, tgt);
861        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getItemSequence()) tgt.getItemSequence().add(convertPositiveInt(t));
862        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDetailSequence()) tgt.getDetailSequence().add(convertPositiveInt(t));
863        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getSubDetailSequence()) tgt.getSubDetailSequence().add(convertPositiveInt(t));
864        for (org.hl7.fhir.r5.model.Reference t : src.getProvider()) tgt.addProvider(convertReference(t));
865        if (src.hasProductOrService())
866            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
867        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
868        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) tgt.addProgramCode(convertCodeableConcept(t));
869        if (src.hasServiced())
870            tgt.setServiced(convertType(src.getServiced()));
871        if (src.hasLocation())
872            tgt.setLocation(convertType(src.getLocation()));
873        if (src.hasQuantity())
874            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
875        if (src.hasUnitPrice())
876            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
877        if (src.hasFactor())
878            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
879        if (src.hasNet())
880            tgt.setNet(convertMoney(src.getNet()));
881        if (src.hasBodySite())
882            tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
883        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) tgt.addSubSite(convertCodeableConcept(t));
884        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
885        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
886        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent t : src.getDetail()) tgt.addDetail(convertAddedItemDetailComponent(t));
887        return tgt;
888    }
889
890    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent convertAddedItemDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent src) throws FHIRException {
891        if (src == null)
892            return null;
893        org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent();
894        copyElement(src, tgt);
895        if (src.hasProductOrService())
896            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
897        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
898        if (src.hasQuantity())
899            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
900        if (src.hasUnitPrice())
901            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
902        if (src.hasFactor())
903            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
904        if (src.hasNet())
905            tgt.setNet(convertMoney(src.getNet()));
906        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
907        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
908        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent t : src.getSubDetail()) tgt.addSubDetail(convertAddedItemDetailSubDetailComponent(t));
909        return tgt;
910    }
911
912    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent convertAddedItemDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent src) throws FHIRException {
913        if (src == null)
914            return null;
915        org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent();
916        copyElement(src, tgt);
917        if (src.hasProductOrService())
918            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
919        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
920        if (src.hasQuantity())
921            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
922        if (src.hasUnitPrice())
923            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
924        if (src.hasFactor())
925            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
926        if (src.hasNet())
927            tgt.setNet(convertMoney(src.getNet()));
928        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
929        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
930        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent t : src.getSubDetail()) tgt.addSubDetail(convertAddedItemDetailSubDetailComponent(t));
931        return tgt;
932    }
933
934    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent convertAddedItemDetailSubDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent src) throws FHIRException {
935        if (src == null)
936            return null;
937        org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
938        copyElement(src, tgt);
939        if (src.hasProductOrService())
940            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
941        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
942        if (src.hasQuantity())
943            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
944        if (src.hasUnitPrice())
945            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
946        if (src.hasFactor())
947            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
948        if (src.hasNet())
949            tgt.setNet(convertMoney(src.getNet()));
950        for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
951        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
952        return tgt;
953    }
954
955    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent convertAddedItemDetailSubDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent src) throws FHIRException {
956        if (src == null)
957            return null;
958        org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
959        copyElement(src, tgt);
960        if (src.hasProductOrService())
961            tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
962        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
963        if (src.hasQuantity())
964            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
965        if (src.hasUnitPrice())
966            tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
967        if (src.hasFactor())
968            tgt.setFactorElement(convertDecimal(src.getFactorElement()));
969        if (src.hasNet())
970            tgt.setNet(convertMoney(src.getNet()));
971        for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) tgt.getNoteNumber().add(convertPositiveInt(t));
972        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) tgt.addAdjudication(convertAdjudicationComponent(t));
973        return tgt;
974    }
975
976    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent convertTotalComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent src) throws FHIRException {
977        if (src == null)
978            return null;
979        org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent();
980        copyElement(src, tgt);
981        if (src.hasCategory())
982            tgt.setCategory(convertCodeableConcept(src.getCategory()));
983        if (src.hasAmount())
984            tgt.setAmount(convertMoney(src.getAmount()));
985        return tgt;
986    }
987
988    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent convertTotalComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent src) throws FHIRException {
989        if (src == null)
990            return null;
991        org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent();
992        copyElement(src, tgt);
993        if (src.hasCategory())
994            tgt.setCategory(convertCodeableConcept(src.getCategory()));
995        if (src.hasAmount())
996            tgt.setAmount(convertMoney(src.getAmount()));
997        return tgt;
998    }
999
1000    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent convertPaymentComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent src) throws FHIRException {
1001        if (src == null)
1002            return null;
1003        org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent();
1004        copyElement(src, tgt);
1005        if (src.hasType())
1006            tgt.setType(convertCodeableConcept(src.getType()));
1007        if (src.hasAdjustment())
1008            tgt.setAdjustment(convertMoney(src.getAdjustment()));
1009        if (src.hasAdjustmentReason())
1010            tgt.setAdjustmentReason(convertCodeableConcept(src.getAdjustmentReason()));
1011        if (src.hasDate())
1012            tgt.setDateElement(convertDate(src.getDateElement()));
1013        if (src.hasAmount())
1014            tgt.setAmount(convertMoney(src.getAmount()));
1015        if (src.hasIdentifier())
1016            tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
1017        return tgt;
1018    }
1019
1020    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent convertPaymentComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent src) throws FHIRException {
1021        if (src == null)
1022            return null;
1023        org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent();
1024        copyElement(src, tgt);
1025        if (src.hasType())
1026            tgt.setType(convertCodeableConcept(src.getType()));
1027        if (src.hasAdjustment())
1028            tgt.setAdjustment(convertMoney(src.getAdjustment()));
1029        if (src.hasAdjustmentReason())
1030            tgt.setAdjustmentReason(convertCodeableConcept(src.getAdjustmentReason()));
1031        if (src.hasDate())
1032            tgt.setDateElement(convertDate(src.getDateElement()));
1033        if (src.hasAmount())
1034            tgt.setAmount(convertMoney(src.getAmount()));
1035        if (src.hasIdentifier())
1036            tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
1037        return tgt;
1038    }
1039
1040    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent convertNoteComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent src) throws FHIRException {
1041        if (src == null)
1042            return null;
1043        org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent();
1044        copyElement(src, tgt);
1045        if (src.hasNumber())
1046            tgt.setNumberElement(convertPositiveInt(src.getNumberElement()));
1047        if (src.hasType())
1048            tgt.setTypeElement(Enumerations40_50.convertNoteType(src.getTypeElement()));
1049        if (src.hasText())
1050            tgt.setTextElement(convertString(src.getTextElement()));
1051        if (src.hasLanguage())
1052            tgt.setLanguage(convertCodeableConcept(src.getLanguage()));
1053        return tgt;
1054    }
1055
1056    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent convertNoteComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent src) throws FHIRException {
1057        if (src == null)
1058            return null;
1059        org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent();
1060        copyElement(src, tgt);
1061        if (src.hasNumber())
1062            tgt.setNumberElement(convertPositiveInt(src.getNumberElement()));
1063        if (src.hasType())
1064            tgt.setTypeElement(Enumerations40_50.convertNoteType(src.getTypeElement()));
1065        if (src.hasText())
1066            tgt.setTextElement(convertString(src.getTextElement()));
1067        if (src.hasLanguage())
1068            tgt.setLanguage(convertCodeableConcept(src.getLanguage()));
1069        return tgt;
1070    }
1071
1072    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent convertBenefitBalanceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent src) throws FHIRException {
1073        if (src == null)
1074            return null;
1075        org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent();
1076        copyElement(src, tgt);
1077        if (src.hasCategory())
1078            tgt.setCategory(convertCodeableConcept(src.getCategory()));
1079        if (src.hasExcluded())
1080            tgt.setExcludedElement(convertBoolean(src.getExcludedElement()));
1081        if (src.hasName())
1082            tgt.setNameElement(convertString(src.getNameElement()));
1083        if (src.hasDescription())
1084            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
1085        if (src.hasNetwork())
1086            tgt.setNetwork(convertCodeableConcept(src.getNetwork()));
1087        if (src.hasUnit())
1088            tgt.setUnit(convertCodeableConcept(src.getUnit()));
1089        if (src.hasTerm())
1090            tgt.setTerm(convertCodeableConcept(src.getTerm()));
1091        for (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent t : src.getFinancial()) tgt.addFinancial(convertBenefitComponent(t));
1092        return tgt;
1093    }
1094
1095    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent convertBenefitBalanceComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent src) throws FHIRException {
1096        if (src == null)
1097            return null;
1098        org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent();
1099        copyElement(src, tgt);
1100        if (src.hasCategory())
1101            tgt.setCategory(convertCodeableConcept(src.getCategory()));
1102        if (src.hasExcluded())
1103            tgt.setExcludedElement(convertBoolean(src.getExcludedElement()));
1104        if (src.hasName())
1105            tgt.setNameElement(convertString(src.getNameElement()));
1106        if (src.hasDescription())
1107            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
1108        if (src.hasNetwork())
1109            tgt.setNetwork(convertCodeableConcept(src.getNetwork()));
1110        if (src.hasUnit())
1111            tgt.setUnit(convertCodeableConcept(src.getUnit()));
1112        if (src.hasTerm())
1113            tgt.setTerm(convertCodeableConcept(src.getTerm()));
1114        for (org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent t : src.getFinancial()) tgt.addFinancial(convertBenefitComponent(t));
1115        return tgt;
1116    }
1117
1118    public static org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent convertBenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent src) throws FHIRException {
1119        if (src == null)
1120            return null;
1121        org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent();
1122        copyElement(src, tgt);
1123        if (src.hasType())
1124            tgt.setType(convertCodeableConcept(src.getType()));
1125        if (src.hasAllowed())
1126            tgt.setAllowed(convertType(src.getAllowed()));
1127        if (src.hasUsed())
1128            tgt.setUsed(convertType(src.getUsed()));
1129        return tgt;
1130    }
1131
1132    public static org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent convertBenefitComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent src) throws FHIRException {
1133        if (src == null)
1134            return null;
1135        org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent();
1136        copyElement(src, tgt);
1137        if (src.hasType())
1138            tgt.setType(convertCodeableConcept(src.getType()));
1139        if (src.hasAllowed())
1140            tgt.setAllowed(convertType(src.getAllowed()));
1141        if (src.hasUsed())
1142            tgt.setUsed(convertType(src.getUsed()));
1143        return tgt;
1144    }
1145}