Search in sources :

Example 6 with BenefitBalanceComponent

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);
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) Money(org.hl7.fhir.dstu3.model.Money)

Example 7 with BenefitBalanceComponent

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);
    }
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Money(org.hl7.fhir.r4.model.Money)

Example 8 with BenefitBalanceComponent

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;
}
Also used : BenefitBalanceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent) BenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 9 with BenefitBalanceComponent

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();
}
Also used : IBaseHasExtensions(org.hl7.fhir.instance.model.api.IBaseHasExtensions) Arrays(java.util.Arrays) CarrierClaimColumn(gov.cms.bfd.model.rif.CarrierClaimColumn) CcwCodebookInterface(gov.cms.bfd.model.codebook.model.CcwCodebookInterface) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) Extension(org.hl7.fhir.dstu3.model.Extension) IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) SNFClaimColumn(gov.cms.bfd.model.rif.SNFClaimColumn) BigDecimal(java.math.BigDecimal) FhirContext(ca.uhn.fhir.context.FhirContext) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) HHAClaimColumn(gov.cms.bfd.model.rif.HHAClaimColumn) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) Duration(java.time.Duration) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) Method(java.lang.reflect.Method) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Reference(org.hl7.fhir.dstu3.model.Reference) DiagnosisComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.DiagnosisComponent) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) InpatientClaimColumn(gov.cms.bfd.model.rif.InpatientClaimColumn) Instant(java.time.Instant) InvocationTargetException(java.lang.reflect.InvocationTargetException) Quantity(org.hl7.fhir.dstu3.model.Quantity) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) OutpatientClaimColumn(gov.cms.bfd.model.rif.OutpatientClaimColumn) HospiceClaimLine(gov.cms.bfd.model.rif.HospiceClaimLine) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) HospiceClaimColumn(gov.cms.bfd.model.rif.HospiceClaimColumn) Money(org.hl7.fhir.dstu3.model.Money) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine) ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) CCWUtils(gov.cms.bfd.server.war.commons.CCWUtils) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Period(org.hl7.fhir.dstu3.model.Period) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DMEClaimLine(gov.cms.bfd.model.rif.DMEClaimLine) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) BenefitCategory(org.hl7.fhir.dstu3.model.codesystems.BenefitCategory) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Resource(org.hl7.fhir.dstu3.model.Resource) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) IOException(java.io.IOException) Observation(org.hl7.fhir.dstu3.model.Observation) BaseDateTimeType(org.hl7.fhir.dstu3.model.BaseDateTimeType) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) DMEClaimColumn(gov.cms.bfd.model.rif.DMEClaimColumn) FHIRException(org.hl7.fhir.exceptions.FHIRException) IdentifierType(gov.cms.bfd.server.war.commons.IdentifierType) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent)

Aggregations

TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)4 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)4 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)4 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)4 CCWUtils (gov.cms.bfd.server.war.commons.CCWUtils)4 MedicareSegment (gov.cms.bfd.server.war.commons.MedicareSegment)4 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)4 BadCodeMonkeyException (gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException)4 IOException (java.io.IOException)4 BigDecimal (java.math.BigDecimal)4 Instant (java.time.Instant)4 LocalDate (java.time.LocalDate)4 Arrays (java.util.Arrays)4 CarrierClaimColumn (gov.cms.bfd.model.rif.CarrierClaimColumn)3 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)3 DMEClaim (gov.cms.bfd.model.rif.DMEClaim)3 DMEClaimColumn (gov.cms.bfd.model.rif.DMEClaimColumn)3 DMEClaimLine (gov.cms.bfd.model.rif.DMEClaimLine)3 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)3 BenefitBalanceComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent)3