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.general40_50.Money40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Period40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.SimpleQuantity40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Date40_50;
011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Decimal40_50;
013import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.PositiveInt40_50;
014import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
015import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
016import org.hl7.fhir.exceptions.FHIRException;
017
018/*
019  Copyright (c) 2011+, HL7, Inc.
020  All rights reserved.
021  
022  Redistribution and use in source and binary forms, with or without modification, 
023  are permitted provided that the following conditions are met:
024  
025   * Redistributions of source code must retain the above copyright notice, this 
026     list of conditions and the following disclaimer.
027   * Redistributions in binary form must reproduce the above copyright notice, 
028     this list of conditions and the following disclaimer in the documentation 
029     and/or other materials provided with the distribution.
030   * Neither the name of HL7 nor the names of its contributors may be used to 
031     endorse or promote products derived from this software without specific 
032     prior written permission.
033  
034  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
035  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
036  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
037  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
038  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
039  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
040  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
041  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
042  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
043  POSSIBILITY OF SUCH DAMAGE.
044  
045*/
046// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
047public class Claim40_50 {
048
049  public static org.hl7.fhir.r5.model.Claim convertClaim(org.hl7.fhir.r4.model.Claim src) throws FHIRException {
050    if (src == null)
051      return null;
052    org.hl7.fhir.r5.model.Claim tgt = new org.hl7.fhir.r5.model.Claim();
053    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
054    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
055      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
056    if (src.hasStatus())
057      tgt.setStatusElement(convertClaimStatus(src.getStatusElement()));
058    if (src.hasType())
059      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
060    if (src.hasSubType())
061      tgt.setSubType(CodeableConcept40_50.convertCodeableConcept(src.getSubType()));
062    if (src.hasUse())
063      tgt.setUseElement(convertUse(src.getUseElement()));
064    if (src.hasPatient())
065      tgt.setPatient(Reference40_50.convertReference(src.getPatient()));
066    if (src.hasBillablePeriod())
067      tgt.setBillablePeriod(Period40_50.convertPeriod(src.getBillablePeriod()));
068    if (src.hasCreated())
069      tgt.setCreatedElement(DateTime40_50.convertDateTime(src.getCreatedElement()));
070    if (src.hasEnterer())
071      tgt.setEnterer(Reference40_50.convertReference(src.getEnterer()));
072    if (src.hasInsurer())
073      tgt.setInsurer(Reference40_50.convertReference(src.getInsurer()));
074    if (src.hasProvider())
075      tgt.setProvider(Reference40_50.convertReference(src.getProvider()));
076    if (src.hasPriority())
077      tgt.setPriority(CodeableConcept40_50.convertCodeableConcept(src.getPriority()));
078    if (src.hasFundsReserve())
079      tgt.setFundsReserve(CodeableConcept40_50.convertCodeableConcept(src.getFundsReserve()));
080    for (org.hl7.fhir.r4.model.Claim.RelatedClaimComponent t : src.getRelated())
081      tgt.addRelated(convertRelatedClaimComponent(t));
082    if (src.hasPrescription())
083      tgt.setPrescription(Reference40_50.convertReference(src.getPrescription()));
084    if (src.hasOriginalPrescription())
085      tgt.setOriginalPrescription(Reference40_50.convertReference(src.getOriginalPrescription()));
086    if (src.hasPayee())
087      tgt.setPayee(convertPayeeComponent(src.getPayee()));
088    if (src.hasReferral())
089      tgt.setReferral(Reference40_50.convertReference(src.getReferral()));
090    if (src.hasFacility())
091      tgt.setFacility(Reference40_50.convertReference(src.getFacility()));
092    for (org.hl7.fhir.r4.model.Claim.CareTeamComponent t : src.getCareTeam())
093      tgt.addCareTeam(convertCareTeamComponent(t));
094    for (org.hl7.fhir.r4.model.Claim.SupportingInformationComponent t : src.getSupportingInfo())
095      tgt.addSupportingInfo(convertSupportingInformationComponent(t));
096    for (org.hl7.fhir.r4.model.Claim.DiagnosisComponent t : src.getDiagnosis())
097      tgt.addDiagnosis(convertDiagnosisComponent(t));
098    for (org.hl7.fhir.r4.model.Claim.ProcedureComponent t : src.getProcedure())
099      tgt.addProcedure(convertProcedureComponent(t));
100    for (org.hl7.fhir.r4.model.Claim.InsuranceComponent t : src.getInsurance())
101      tgt.addInsurance(convertInsuranceComponent(t));
102    if (src.hasAccident())
103      tgt.setAccident(convertAccidentComponent(src.getAccident()));
104    for (org.hl7.fhir.r4.model.Claim.ItemComponent t : src.getItem()) tgt.addItem(convertItemComponent(t));
105    if (src.hasTotal())
106      tgt.setTotal(Money40_50.convertMoney(src.getTotal()));
107    return tgt;
108  }
109
110  public static org.hl7.fhir.r4.model.Claim convertClaim(org.hl7.fhir.r5.model.Claim src) throws FHIRException {
111    if (src == null)
112      return null;
113    org.hl7.fhir.r4.model.Claim tgt = new org.hl7.fhir.r4.model.Claim();
114    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
115    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
116      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
117    if (src.hasStatus())
118      tgt.setStatusElement(convertClaimStatus(src.getStatusElement()));
119    if (src.hasType())
120      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
121    if (src.hasSubType())
122      tgt.setSubType(CodeableConcept40_50.convertCodeableConcept(src.getSubType()));
123    if (src.hasUse())
124      tgt.setUseElement(convertUse(src.getUseElement()));
125    if (src.hasPatient())
126      tgt.setPatient(Reference40_50.convertReference(src.getPatient()));
127    if (src.hasBillablePeriod())
128      tgt.setBillablePeriod(Period40_50.convertPeriod(src.getBillablePeriod()));
129    if (src.hasCreated())
130      tgt.setCreatedElement(DateTime40_50.convertDateTime(src.getCreatedElement()));
131    if (src.hasEnterer())
132      tgt.setEnterer(Reference40_50.convertReference(src.getEnterer()));
133    if (src.hasInsurer())
134      tgt.setInsurer(Reference40_50.convertReference(src.getInsurer()));
135    if (src.hasProvider())
136      tgt.setProvider(Reference40_50.convertReference(src.getProvider()));
137    if (src.hasPriority())
138      tgt.setPriority(CodeableConcept40_50.convertCodeableConcept(src.getPriority()));
139    if (src.hasFundsReserve())
140      tgt.setFundsReserve(CodeableConcept40_50.convertCodeableConcept(src.getFundsReserve()));
141    for (org.hl7.fhir.r5.model.Claim.RelatedClaimComponent t : src.getRelated())
142      tgt.addRelated(convertRelatedClaimComponent(t));
143    if (src.hasPrescription())
144      tgt.setPrescription(Reference40_50.convertReference(src.getPrescription()));
145    if (src.hasOriginalPrescription())
146      tgt.setOriginalPrescription(Reference40_50.convertReference(src.getOriginalPrescription()));
147    if (src.hasPayee())
148      tgt.setPayee(convertPayeeComponent(src.getPayee()));
149    if (src.hasReferral())
150      tgt.setReferral(Reference40_50.convertReference(src.getReferral()));
151    if (src.hasFacility())
152      tgt.setFacility(Reference40_50.convertReference(src.getFacility()));
153    for (org.hl7.fhir.r5.model.Claim.CareTeamComponent t : src.getCareTeam())
154      tgt.addCareTeam(convertCareTeamComponent(t));
155    for (org.hl7.fhir.r5.model.Claim.SupportingInformationComponent t : src.getSupportingInfo())
156      tgt.addSupportingInfo(convertSupportingInformationComponent(t));
157    for (org.hl7.fhir.r5.model.Claim.DiagnosisComponent t : src.getDiagnosis())
158      tgt.addDiagnosis(convertDiagnosisComponent(t));
159    for (org.hl7.fhir.r5.model.Claim.ProcedureComponent t : src.getProcedure())
160      tgt.addProcedure(convertProcedureComponent(t));
161    for (org.hl7.fhir.r5.model.Claim.InsuranceComponent t : src.getInsurance())
162      tgt.addInsurance(convertInsuranceComponent(t));
163    if (src.hasAccident())
164      tgt.setAccident(convertAccidentComponent(src.getAccident()));
165    for (org.hl7.fhir.r5.model.Claim.ItemComponent t : src.getItem()) tgt.addItem(convertItemComponent(t));
166    if (src.hasTotal())
167      tgt.setTotal(Money40_50.convertMoney(src.getTotal()));
168    return tgt;
169  }
170
171  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> convertClaimStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Claim.ClaimStatus> src) throws FHIRException {
172    if (src == null || src.isEmpty())
173      return null;
174    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodesEnumFactory());
175    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
176    switch (src.getValue()) {
177      case ACTIVE:
178        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE);
179        break;
180      case CANCELLED:
181        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED);
182        break;
183      case DRAFT:
184        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT);
185        break;
186      case ENTEREDINERROR:
187        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
188        break;
189      default:
190        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.NULL);
191        break;
192    }
193    return tgt;
194  }
195
196  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Claim.ClaimStatus> convertClaimStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> src) throws FHIRException {
197    if (src == null || src.isEmpty())
198      return null;
199    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Claim.ClaimStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Claim.ClaimStatusEnumFactory());
200    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
201    switch (src.getValue()) {
202      case ACTIVE:
203        tgt.setValue(org.hl7.fhir.r4.model.Claim.ClaimStatus.ACTIVE);
204        break;
205      case CANCELLED:
206        tgt.setValue(org.hl7.fhir.r4.model.Claim.ClaimStatus.CANCELLED);
207        break;
208      case DRAFT:
209        tgt.setValue(org.hl7.fhir.r4.model.Claim.ClaimStatus.DRAFT);
210        break;
211      case ENTEREDINERROR:
212        tgt.setValue(org.hl7.fhir.r4.model.Claim.ClaimStatus.ENTEREDINERROR);
213        break;
214      default:
215        tgt.setValue(org.hl7.fhir.r4.model.Claim.ClaimStatus.NULL);
216        break;
217    }
218    return tgt;
219  }
220
221  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.Claim.Use> src) throws FHIRException {
222    if (src == null || src.isEmpty())
223      return null;
224    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());
225    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
226    switch (src.getValue()) {
227      case CLAIM:
228        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.CLAIM);
229        break;
230      case PREAUTHORIZATION:
231        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.PREAUTHORIZATION);
232        break;
233      case PREDETERMINATION:
234        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.PREDETERMINATION);
235        break;
236      default:
237        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.Use.NULL);
238        break;
239    }
240    return tgt;
241  }
242
243  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Claim.Use> convertUse(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.Use> src) throws FHIRException {
244    if (src == null || src.isEmpty())
245      return null;
246    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Claim.Use> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Claim.UseEnumFactory());
247    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
248    switch (src.getValue()) {
249      case CLAIM:
250        tgt.setValue(org.hl7.fhir.r4.model.Claim.Use.CLAIM);
251        break;
252      case PREAUTHORIZATION:
253        tgt.setValue(org.hl7.fhir.r4.model.Claim.Use.PREAUTHORIZATION);
254        break;
255      case PREDETERMINATION:
256        tgt.setValue(org.hl7.fhir.r4.model.Claim.Use.PREDETERMINATION);
257        break;
258      default:
259        tgt.setValue(org.hl7.fhir.r4.model.Claim.Use.NULL);
260        break;
261    }
262    return tgt;
263  }
264
265  public static org.hl7.fhir.r5.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r4.model.Claim.RelatedClaimComponent src) throws FHIRException {
266    if (src == null)
267      return null;
268    org.hl7.fhir.r5.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r5.model.Claim.RelatedClaimComponent();
269    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
270    if (src.hasClaim())
271      tgt.setClaim(Reference40_50.convertReference(src.getClaim()));
272    if (src.hasRelationship())
273      tgt.setRelationship(CodeableConcept40_50.convertCodeableConcept(src.getRelationship()));
274    if (src.hasReference())
275      tgt.setReference(Identifier40_50.convertIdentifier(src.getReference()));
276    return tgt;
277  }
278
279  public static org.hl7.fhir.r4.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r5.model.Claim.RelatedClaimComponent src) throws FHIRException {
280    if (src == null)
281      return null;
282    org.hl7.fhir.r4.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r4.model.Claim.RelatedClaimComponent();
283    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
284    if (src.hasClaim())
285      tgt.setClaim(Reference40_50.convertReference(src.getClaim()));
286    if (src.hasRelationship())
287      tgt.setRelationship(CodeableConcept40_50.convertCodeableConcept(src.getRelationship()));
288    if (src.hasReference())
289      tgt.setReference(Identifier40_50.convertIdentifier(src.getReference()));
290    return tgt;
291  }
292
293  public static org.hl7.fhir.r5.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r4.model.Claim.PayeeComponent src) throws FHIRException {
294    if (src == null)
295      return null;
296    org.hl7.fhir.r5.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r5.model.Claim.PayeeComponent();
297    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
298    if (src.hasType())
299      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
300    if (src.hasParty())
301      tgt.setParty(Reference40_50.convertReference(src.getParty()));
302    return tgt;
303  }
304
305  public static org.hl7.fhir.r4.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r5.model.Claim.PayeeComponent src) throws FHIRException {
306    if (src == null)
307      return null;
308    org.hl7.fhir.r4.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r4.model.Claim.PayeeComponent();
309    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
310    if (src.hasType())
311      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
312    if (src.hasParty())
313      tgt.setParty(Reference40_50.convertReference(src.getParty()));
314    return tgt;
315  }
316
317  public static org.hl7.fhir.r5.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r4.model.Claim.CareTeamComponent src) throws FHIRException {
318    if (src == null)
319      return null;
320    org.hl7.fhir.r5.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r5.model.Claim.CareTeamComponent();
321    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
322    if (src.hasSequence())
323      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
324    if (src.hasProvider())
325      tgt.setProvider(Reference40_50.convertReference(src.getProvider()));
326    if (src.hasResponsible())
327      tgt.setResponsibleElement(Boolean40_50.convertBoolean(src.getResponsibleElement()));
328    if (src.hasRole())
329      tgt.setRole(CodeableConcept40_50.convertCodeableConcept(src.getRole()));
330    if (src.hasQualification())
331      tgt.setSpecialty(CodeableConcept40_50.convertCodeableConcept(src.getQualification()));
332    return tgt;
333  }
334
335  public static org.hl7.fhir.r4.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r5.model.Claim.CareTeamComponent src) throws FHIRException {
336    if (src == null)
337      return null;
338    org.hl7.fhir.r4.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r4.model.Claim.CareTeamComponent();
339    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
340    if (src.hasSequence())
341      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
342    if (src.hasProvider())
343      tgt.setProvider(Reference40_50.convertReference(src.getProvider()));
344    if (src.hasResponsible())
345      tgt.setResponsibleElement(Boolean40_50.convertBoolean(src.getResponsibleElement()));
346    if (src.hasRole())
347      tgt.setRole(CodeableConcept40_50.convertCodeableConcept(src.getRole()));
348    if (src.hasSpecialty())
349      tgt.setQualification(CodeableConcept40_50.convertCodeableConcept(src.getSpecialty()));
350    return tgt;
351  }
352
353  public static org.hl7.fhir.r5.model.Claim.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r4.model.Claim.SupportingInformationComponent src) throws FHIRException {
354    if (src == null)
355      return null;
356    org.hl7.fhir.r5.model.Claim.SupportingInformationComponent tgt = new org.hl7.fhir.r5.model.Claim.SupportingInformationComponent();
357    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
358    if (src.hasSequence())
359      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
360    if (src.hasCategory())
361      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
362    if (src.hasCode())
363      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
364    if (src.hasTiming())
365      tgt.setTiming(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getTiming()));
366    if (src.hasValue())
367      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
368    if (src.hasReason())
369      tgt.setReason(CodeableConcept40_50.convertCodeableConcept(src.getReason()));
370    return tgt;
371  }
372
373  public static org.hl7.fhir.r4.model.Claim.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r5.model.Claim.SupportingInformationComponent src) throws FHIRException {
374    if (src == null)
375      return null;
376    org.hl7.fhir.r4.model.Claim.SupportingInformationComponent tgt = new org.hl7.fhir.r4.model.Claim.SupportingInformationComponent();
377    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
378    if (src.hasSequence())
379      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
380    if (src.hasCategory())
381      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
382    if (src.hasCode())
383      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
384    if (src.hasTiming())
385      tgt.setTiming(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getTiming()));
386    if (src.hasValue())
387      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
388    if (src.hasReason())
389      tgt.setReason(CodeableConcept40_50.convertCodeableConcept(src.getReason()));
390    return tgt;
391  }
392
393  public static org.hl7.fhir.r5.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Claim.DiagnosisComponent src) throws FHIRException {
394    if (src == null)
395      return null;
396    org.hl7.fhir.r5.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Claim.DiagnosisComponent();
397    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
398    if (src.hasSequence())
399      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
400    if (src.hasDiagnosis())
401      tgt.setDiagnosis(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getDiagnosis()));
402    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
403      tgt.addType(CodeableConcept40_50.convertCodeableConcept(t));
404    if (src.hasOnAdmission())
405      tgt.setOnAdmission(CodeableConcept40_50.convertCodeableConcept(src.getOnAdmission()));
406//    if (src.hasPackageCode())
407//      tgt.setPackageCode(CodeableConcept40_50.convertCodeableConcept(src.getPackageCode()));
408    return tgt;
409  }
410
411  public static org.hl7.fhir.r4.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Claim.DiagnosisComponent src) throws FHIRException {
412    if (src == null)
413      return null;
414    org.hl7.fhir.r4.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Claim.DiagnosisComponent();
415    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
416    if (src.hasSequence())
417      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
418    if (src.hasDiagnosis())
419      tgt.setDiagnosis(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getDiagnosis()));
420    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType())
421      tgt.addType(CodeableConcept40_50.convertCodeableConcept(t));
422    if (src.hasOnAdmission())
423      tgt.setOnAdmission(CodeableConcept40_50.convertCodeableConcept(src.getOnAdmission()));
424//    if (src.hasPackageCode())
425//      tgt.setPackageCode(CodeableConcept40_50.convertCodeableConcept(src.getPackageCode()));
426    return tgt;
427  }
428
429  public static org.hl7.fhir.r5.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r4.model.Claim.ProcedureComponent src) throws FHIRException {
430    if (src == null)
431      return null;
432    org.hl7.fhir.r5.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r5.model.Claim.ProcedureComponent();
433    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
434    if (src.hasSequence())
435      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
436    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
437      tgt.addType(CodeableConcept40_50.convertCodeableConcept(t));
438    if (src.hasDate())
439      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
440    if (src.hasProcedure())
441      tgt.setProcedure(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getProcedure()));
442    for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
443    return tgt;
444  }
445
446  public static org.hl7.fhir.r4.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r5.model.Claim.ProcedureComponent src) throws FHIRException {
447    if (src == null)
448      return null;
449    org.hl7.fhir.r4.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r4.model.Claim.ProcedureComponent();
450    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
451    if (src.hasSequence())
452      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
453    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType())
454      tgt.addType(CodeableConcept40_50.convertCodeableConcept(t));
455    if (src.hasDate())
456      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
457    if (src.hasProcedure())
458      tgt.setProcedure(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getProcedure()));
459    for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
460    return tgt;
461  }
462
463  public static org.hl7.fhir.r5.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.Claim.InsuranceComponent src) throws FHIRException {
464    if (src == null)
465      return null;
466    org.hl7.fhir.r5.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r5.model.Claim.InsuranceComponent();
467    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
468    if (src.hasSequence())
469      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
470    if (src.hasFocal())
471      tgt.setFocalElement(Boolean40_50.convertBoolean(src.getFocalElement()));
472    if (src.hasIdentifier())
473      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
474    if (src.hasCoverage())
475      tgt.setCoverage(Reference40_50.convertReference(src.getCoverage()));
476    if (src.hasBusinessArrangement())
477      tgt.setBusinessArrangementElement(String40_50.convertString(src.getBusinessArrangementElement()));
478    for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef())
479      tgt.getPreAuthRef().add(String40_50.convertString(t));
480    if (src.hasClaimResponse())
481      tgt.setClaimResponse(Reference40_50.convertReference(src.getClaimResponse()));
482    return tgt;
483  }
484
485  public static org.hl7.fhir.r4.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.Claim.InsuranceComponent src) throws FHIRException {
486    if (src == null)
487      return null;
488    org.hl7.fhir.r4.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r4.model.Claim.InsuranceComponent();
489    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
490    if (src.hasSequence())
491      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
492    if (src.hasFocal())
493      tgt.setFocalElement(Boolean40_50.convertBoolean(src.getFocalElement()));
494    if (src.hasIdentifier())
495      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
496    if (src.hasCoverage())
497      tgt.setCoverage(Reference40_50.convertReference(src.getCoverage()));
498    if (src.hasBusinessArrangement())
499      tgt.setBusinessArrangementElement(String40_50.convertString(src.getBusinessArrangementElement()));
500    for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef())
501      tgt.getPreAuthRef().add(String40_50.convertString(t));
502    if (src.hasClaimResponse())
503      tgt.setClaimResponse(Reference40_50.convertReference(src.getClaimResponse()));
504    return tgt;
505  }
506
507  public static org.hl7.fhir.r5.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r4.model.Claim.AccidentComponent src) throws FHIRException {
508    if (src == null)
509      return null;
510    org.hl7.fhir.r5.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r5.model.Claim.AccidentComponent();
511    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
512    if (src.hasDate())
513      tgt.setDateElement(Date40_50.convertDate(src.getDateElement()));
514    if (src.hasType())
515      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
516    if (src.hasLocation())
517      tgt.setLocation(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getLocation()));
518    return tgt;
519  }
520
521  public static org.hl7.fhir.r4.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r5.model.Claim.AccidentComponent src) throws FHIRException {
522    if (src == null)
523      return null;
524    org.hl7.fhir.r4.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r4.model.Claim.AccidentComponent();
525    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
526    if (src.hasDate())
527      tgt.setDateElement(Date40_50.convertDate(src.getDateElement()));
528    if (src.hasType())
529      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
530    if (src.hasLocation())
531      tgt.setLocation(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getLocation()));
532    return tgt;
533  }
534
535  public static org.hl7.fhir.r5.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r4.model.Claim.ItemComponent src) throws FHIRException {
536    if (src == null)
537      return null;
538    org.hl7.fhir.r5.model.Claim.ItemComponent tgt = new org.hl7.fhir.r5.model.Claim.ItemComponent();
539    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
540    if (src.hasSequence())
541      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
542    for (org.hl7.fhir.r4.model.PositiveIntType t : src.getCareTeamSequence())
543      tgt.getCareTeamSequence().add(PositiveInt40_50.convertPositiveInt(t));
544    for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDiagnosisSequence())
545      tgt.getDiagnosisSequence().add(PositiveInt40_50.convertPositiveInt(t));
546    for (org.hl7.fhir.r4.model.PositiveIntType t : src.getProcedureSequence())
547      tgt.getProcedureSequence().add(PositiveInt40_50.convertPositiveInt(t));
548    for (org.hl7.fhir.r4.model.PositiveIntType t : src.getInformationSequence())
549      tgt.getInformationSequence().add(PositiveInt40_50.convertPositiveInt(t));
550    if (src.hasRevenue())
551      tgt.setRevenue(CodeableConcept40_50.convertCodeableConcept(src.getRevenue()));
552    if (src.hasCategory())
553      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
554    if (src.hasProductOrService())
555      tgt.setProductOrService(CodeableConcept40_50.convertCodeableConcept(src.getProductOrService()));
556    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier())
557      tgt.addModifier(CodeableConcept40_50.convertCodeableConcept(t));
558    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode())
559      tgt.addProgramCode(CodeableConcept40_50.convertCodeableConcept(t));
560    if (src.hasServiced())
561      tgt.setServiced(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getServiced()));
562    if (src.hasLocation())
563      tgt.setLocation(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getLocation()));
564    if (src.hasQuantity())
565      tgt.setQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getQuantity()));
566    if (src.hasUnitPrice())
567      tgt.setUnitPrice(Money40_50.convertMoney(src.getUnitPrice()));
568    if (src.hasFactor())
569      tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
570    if (src.hasNet())
571      tgt.setNet(Money40_50.convertMoney(src.getNet()));
572    for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
573    if (src.hasBodySite())
574      tgt.getBodySiteFirstRep().addSite(CodeableConcept40_50.convertCodeableConceptToCodeableReference(src.getBodySite()));
575    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite())
576      tgt.getBodySiteFirstRep().addSubSite(CodeableConcept40_50.convertCodeableConcept(t));
577    for (org.hl7.fhir.r4.model.Reference t : src.getEncounter()) tgt.addEncounter(Reference40_50.convertReference(t));
578    for (org.hl7.fhir.r4.model.Claim.DetailComponent t : src.getDetail()) tgt.addDetail(convertDetailComponent(t));
579    return tgt;
580  }
581
582  public static org.hl7.fhir.r4.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.Claim.ItemComponent src) throws FHIRException {
583    if (src == null)
584      return null;
585    org.hl7.fhir.r4.model.Claim.ItemComponent tgt = new org.hl7.fhir.r4.model.Claim.ItemComponent();
586    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
587    if (src.hasSequence())
588      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
589    for (org.hl7.fhir.r5.model.PositiveIntType t : src.getCareTeamSequence())
590      tgt.getCareTeamSequence().add(PositiveInt40_50.convertPositiveInt(t));
591    for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDiagnosisSequence())
592      tgt.getDiagnosisSequence().add(PositiveInt40_50.convertPositiveInt(t));
593    for (org.hl7.fhir.r5.model.PositiveIntType t : src.getProcedureSequence())
594      tgt.getProcedureSequence().add(PositiveInt40_50.convertPositiveInt(t));
595    for (org.hl7.fhir.r5.model.PositiveIntType t : src.getInformationSequence())
596      tgt.getInformationSequence().add(PositiveInt40_50.convertPositiveInt(t));
597    if (src.hasRevenue())
598      tgt.setRevenue(CodeableConcept40_50.convertCodeableConcept(src.getRevenue()));
599    if (src.hasCategory())
600      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
601    if (src.hasProductOrService())
602      tgt.setProductOrService(CodeableConcept40_50.convertCodeableConcept(src.getProductOrService()));
603    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier())
604      tgt.addModifier(CodeableConcept40_50.convertCodeableConcept(t));
605    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode())
606      tgt.addProgramCode(CodeableConcept40_50.convertCodeableConcept(t));
607    if (src.hasServiced())
608      tgt.setServiced(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getServiced()));
609    if (src.hasLocation())
610      tgt.setLocation(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getLocation()));
611    if (src.hasQuantity())
612      tgt.setQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getQuantity()));
613    if (src.hasUnitPrice())
614      tgt.setUnitPrice(Money40_50.convertMoney(src.getUnitPrice()));
615    if (src.hasFactor())
616      tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
617    if (src.hasNet())
618      tgt.setNet(Money40_50.convertMoney(src.getNet()));
619    for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
620    if (src.getBodySiteFirstRep().hasSite())
621      tgt.setBodySite(CodeableConcept40_50.convertCodeableReferenceToCodeableConcept(src.getBodySiteFirstRep().getSiteFirstRep()));
622    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySiteFirstRep().getSubSite())
623      tgt.addSubSite(CodeableConcept40_50.convertCodeableConcept(t));
624    for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) tgt.addEncounter(Reference40_50.convertReference(t));
625    for (org.hl7.fhir.r5.model.Claim.DetailComponent t : src.getDetail()) tgt.addDetail(convertDetailComponent(t));
626    return tgt;
627  }
628
629  public static org.hl7.fhir.r5.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r4.model.Claim.DetailComponent src) throws FHIRException {
630    if (src == null)
631      return null;
632    org.hl7.fhir.r5.model.Claim.DetailComponent tgt = new org.hl7.fhir.r5.model.Claim.DetailComponent();
633    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
634    if (src.hasSequence())
635      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
636    if (src.hasRevenue())
637      tgt.setRevenue(CodeableConcept40_50.convertCodeableConcept(src.getRevenue()));
638    if (src.hasCategory())
639      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
640    if (src.hasProductOrService())
641      tgt.setProductOrService(CodeableConcept40_50.convertCodeableConcept(src.getProductOrService()));
642    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier())
643      tgt.addModifier(CodeableConcept40_50.convertCodeableConcept(t));
644    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode())
645      tgt.addProgramCode(CodeableConcept40_50.convertCodeableConcept(t));
646    if (src.hasQuantity())
647      tgt.setQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getQuantity()));
648    if (src.hasUnitPrice())
649      tgt.setUnitPrice(Money40_50.convertMoney(src.getUnitPrice()));
650    if (src.hasFactor())
651      tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
652    if (src.hasNet())
653      tgt.setNet(Money40_50.convertMoney(src.getNet()));
654    for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
655    for (org.hl7.fhir.r4.model.Claim.SubDetailComponent t : src.getSubDetail())
656      tgt.addSubDetail(convertSubDetailComponent(t));
657    return tgt;
658  }
659
660  public static org.hl7.fhir.r4.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r5.model.Claim.DetailComponent src) throws FHIRException {
661    if (src == null)
662      return null;
663    org.hl7.fhir.r4.model.Claim.DetailComponent tgt = new org.hl7.fhir.r4.model.Claim.DetailComponent();
664    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
665    if (src.hasSequence())
666      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
667    if (src.hasRevenue())
668      tgt.setRevenue(CodeableConcept40_50.convertCodeableConcept(src.getRevenue()));
669    if (src.hasCategory())
670      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
671    if (src.hasProductOrService())
672      tgt.setProductOrService(CodeableConcept40_50.convertCodeableConcept(src.getProductOrService()));
673    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier())
674      tgt.addModifier(CodeableConcept40_50.convertCodeableConcept(t));
675    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode())
676      tgt.addProgramCode(CodeableConcept40_50.convertCodeableConcept(t));
677    if (src.hasQuantity())
678      tgt.setQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getQuantity()));
679    if (src.hasUnitPrice())
680      tgt.setUnitPrice(Money40_50.convertMoney(src.getUnitPrice()));
681    if (src.hasFactor())
682      tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
683    if (src.hasNet())
684      tgt.setNet(Money40_50.convertMoney(src.getNet()));
685    for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
686    for (org.hl7.fhir.r5.model.Claim.SubDetailComponent t : src.getSubDetail())
687      tgt.addSubDetail(convertSubDetailComponent(t));
688    return tgt;
689  }
690
691  public static org.hl7.fhir.r5.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r4.model.Claim.SubDetailComponent src) throws FHIRException {
692    if (src == null)
693      return null;
694    org.hl7.fhir.r5.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r5.model.Claim.SubDetailComponent();
695    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
696    if (src.hasSequence())
697      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
698    if (src.hasRevenue())
699      tgt.setRevenue(CodeableConcept40_50.convertCodeableConcept(src.getRevenue()));
700    if (src.hasCategory())
701      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
702    if (src.hasProductOrService())
703      tgt.setProductOrService(CodeableConcept40_50.convertCodeableConcept(src.getProductOrService()));
704    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier())
705      tgt.addModifier(CodeableConcept40_50.convertCodeableConcept(t));
706    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode())
707      tgt.addProgramCode(CodeableConcept40_50.convertCodeableConcept(t));
708    if (src.hasQuantity())
709      tgt.setQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getQuantity()));
710    if (src.hasUnitPrice())
711      tgt.setUnitPrice(Money40_50.convertMoney(src.getUnitPrice()));
712    if (src.hasFactor())
713      tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
714    if (src.hasNet())
715      tgt.setNet(Money40_50.convertMoney(src.getNet()));
716    for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
717    return tgt;
718  }
719
720  public static org.hl7.fhir.r4.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.Claim.SubDetailComponent src) throws FHIRException {
721    if (src == null)
722      return null;
723    org.hl7.fhir.r4.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r4.model.Claim.SubDetailComponent();
724    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
725    if (src.hasSequence())
726      tgt.setSequenceElement(PositiveInt40_50.convertPositiveInt(src.getSequenceElement()));
727    if (src.hasRevenue())
728      tgt.setRevenue(CodeableConcept40_50.convertCodeableConcept(src.getRevenue()));
729    if (src.hasCategory())
730      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
731    if (src.hasProductOrService())
732      tgt.setProductOrService(CodeableConcept40_50.convertCodeableConcept(src.getProductOrService()));
733    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier())
734      tgt.addModifier(CodeableConcept40_50.convertCodeableConcept(t));
735    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode())
736      tgt.addProgramCode(CodeableConcept40_50.convertCodeableConcept(t));
737    if (src.hasQuantity())
738      tgt.setQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getQuantity()));
739    if (src.hasUnitPrice())
740      tgt.setUnitPrice(Money40_50.convertMoney(src.getUnitPrice()));
741    if (src.hasFactor())
742      tgt.setFactorElement(Decimal40_50.convertDecimal(src.getFactorElement()));
743    if (src.hasNet())
744      tgt.setNet(Money40_50.convertMoney(src.getNet()));
745    for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) tgt.addUdi(Reference40_50.convertReference(t));
746    return tgt;
747  }
748}