use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method addAdjudicationTotal.
/**
* @param eob the {@link ExplanationOfBenefit} that the adjudication total should be part of
* @param categoryVariable the {@link CcwCodebookInterface} to map to the adjudication's <code>
* category</code>
* @param amountValue the {@link Money#getValue()} for the adjudication total
* @return the new {@link BenefitBalanceComponent}, which will have already been added to the
* appropriate {@link ExplanationOfBenefit#getBenefitBalance()} entry
*/
static void addAdjudicationTotal(ExplanationOfBenefit eob, CcwCodebookInterface categoryVariable, Optional<? extends Number> amountValue) {
/*
* TODO Once we switch to STU4 (expected >= Q3 2018), remap these to the new
* `ExplanationOfBenefit.total` field. In anticipation of that, the CcwCodebookVariable param
* here is named `category`: right now it's used for the `Extension.url` but can be changed to
* `ExplanationOfBenefit.total.category` once this mapping is moved to STU4.
*/
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(categoryVariable);
Money adjudicationTotalAmount = createMoney(amountValue);
Extension adjudicationTotalEextension = new Extension(extensionUrl, adjudicationTotalAmount);
eob.addExtension(adjudicationTotalEextension);
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method addAdjudicationTotal.
/**
* @param eob the {@link ExplanationOfBenefit} that the adjudication total should be part of
* @param categoryVariable the {@link CcwCodebookInterface} to map to the adjudication's <code>
* category</code>
* @param amountValue the {@link Money#getValue()} for the adjudication total
* @return the new {@link BenefitBalanceComponent}, which will have already been added to the
* appropriate {@link ExplanationOfBenefit#getBenefitBalance()} entry
*/
static void addAdjudicationTotal(ExplanationOfBenefit eob, CcwCodebookInterface categoryVariable, Optional<? extends Number> amountValue) {
if (amountValue.isPresent()) {
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(categoryVariable);
Money adjudicationTotalAmount = createMoney(amountValue);
Extension adjudicationTotalEextension = new Extension(extensionUrl, adjudicationTotalAmount);
eob.addExtension(adjudicationTotalEextension);
}
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent 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;
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertHasBenefitComponent.
/**
* @param ccwVariable the {@link CcwCodebookVariable} matching the {@link
* BenefitComponent#getType()} to find
* @param eob the {@link ExplanationOfBenefit} to search
* @return the {@link BenefitComponent} that was found (if one wasn't, the method will instead
* fail with an {@link AssertionFailedError})
*/
private static BenefitComponent assertHasBenefitComponent(CcwCodebookInterface ccwVariable, ExplanationOfBenefit eob) {
// We only ever map one root EOB.benefitBalance.
BenefitBalanceComponent benefitBalanceComponent = eob.getBenefitBalanceFirstRep();
assertNotNull(benefitBalanceComponent);
Optional<BenefitComponent> benefitOptional = benefitBalanceComponent.getFinancial().stream().filter(bc -> isCodeInConcept(bc.getType(), TransformerConstants.CODING_BBAPI_BENEFIT_BALANCE_TYPE, CCWUtils.calculateVariableReferenceUrl(ccwVariable))).findFirst();
assertTrue(benefitOptional.isPresent());
return benefitOptional.get();
}
Aggregations