use of org.hl7.fhir.r4.model.codesystems.ExBenefitcategory in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method findOrAddBenefitBalance.
/**
* @param eob the {@link ExplanationOfBenefit} that the {@link BenefitComponent} should be part of
* @param benefitCategory the {@link BenefitCategory} to map to {@link
* BenefitBalanceComponent#getCategory()}
* @return the already-existing {@link BenefitBalanceComponent} that matches the specified
* parameters, or a new one
*/
private static BenefitBalanceComponent findOrAddBenefitBalance(ExplanationOfBenefit eob, ExBenefitcategory benefitCategory) {
Optional<BenefitBalanceComponent> matchingBenefitBalance = eob.getBenefitBalance().stream().filter(bb -> isCodeInConcept(bb.getCategory(), benefitCategory.getSystem(), benefitCategory.toCode())).findAny();
// Found an existing BenefitBalance that matches the coding system
if (matchingBenefitBalance.isPresent()) {
return matchingBenefitBalance.get();
}
CodeableConcept benefitCategoryConcept = new CodeableConcept();
benefitCategoryConcept.addCoding().setSystem(benefitCategory.getSystem()).setCode(benefitCategory.toCode()).setDisplay(benefitCategory.getDisplay());
BenefitBalanceComponent newBenefitBalance = new BenefitBalanceComponent(benefitCategoryConcept);
eob.addBenefitBalance(newBenefitBalance);
return newBenefitBalance;
}
use of org.hl7.fhir.r4.model.codesystems.ExBenefitcategory in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method addBenefitBalanceFinancial.
/**
* @param eob the {@link ExplanationOfBenefit} that the {@link ExBenefitcategory} should be part
* of
* @param benefitCategoryCode the code representing an {@link ExBenefitcategory}
* @param financialType the {@link CcwCodebookInterface} to map to {@link
* BenefitComponent#getType()}
* @return the new {@link BenefitBalanceComponent}, which will have already been added to the
* appropriate {@link ExplanationOfBenefit#getBenefitBalance()} entry
*/
static BenefitComponent addBenefitBalanceFinancial(ExplanationOfBenefit eob, ExBenefitcategory benefitCategoryCode, CcwCodebookInterface financialType) {
BenefitBalanceComponent eobPrimaryBenefitBalance = findOrAddBenefitBalance(eob, benefitCategoryCode);
CodeableConcept financialTypeConcept = TransformerUtilsV2.createCodeableConcept(TransformerConstants.CODING_BBAPI_BENEFIT_BALANCE_TYPE, CCWUtils.calculateVariableReferenceUrl(financialType));
financialTypeConcept.getCodingFirstRep().setDisplay(financialType.getVariable().getLabel());
BenefitComponent financialEntry = new BenefitComponent(financialTypeConcept);
eobPrimaryBenefitBalance.getFinancial().add(financialEntry);
return financialEntry;
}
Aggregations