Search in sources :

Example 36 with AdjudicationComponent

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.

the class PartDEventTransformerV2Test method shouldHaveLineItemAdjudicationPlroAmt.

@Test
public void shouldHaveLineItemAdjudicationPlroAmt() {
    AdjudicationComponent adjudication = TransformerTestUtilsV2.findAdjudicationByCategory("https://bluebutton.cms.gov/resources/variables/plro_amt", eob.getItemFirstRep().getAdjudication());
    AdjudicationComponent compare = new AdjudicationComponent().setCategory(new CodeableConcept().setCoding(Arrays.asList(new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBAdjudication", "priorpayerpaid", "Prior payer paid"), new Coding("https://bluebutton.cms.gov/resources/codesystem/adjudication", "https://bluebutton.cms.gov/resources/variables/plro_amt", "Reduction in patient liability due to payments by other payers (PLRO)")))).setAmount(new Money().setValue(42.42).setCurrency(TransformerConstants.CODED_MONEY_USD));
    assertTrue(compare.equalsDeep(adjudication));
}
Also used : Money(org.hl7.fhir.r4.model.Money) Coding(org.hl7.fhir.r4.model.Coding) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 37 with AdjudicationComponent

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.

the class PartDEventTransformerV2Test method shouldHaveLineItemAdjudicationOthrTroopAmt.

@Test
public void shouldHaveLineItemAdjudicationOthrTroopAmt() {
    AdjudicationComponent adjudication = TransformerTestUtilsV2.findAdjudicationByCategory("https://bluebutton.cms.gov/resources/variables/othr_troop_amt", eob.getItemFirstRep().getAdjudication());
    // Need to maintain trailing 0s in USD amount
    BigDecimal amt = new BigDecimal(17.30);
    amt = amt.setScale(2, RoundingMode.HALF_DOWN);
    AdjudicationComponent compare = new AdjudicationComponent().setCategory(new CodeableConcept().setCoding(Arrays.asList(new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBAdjudication", "priorpayerpaid", "Prior payer paid"), new Coding("https://bluebutton.cms.gov/resources/codesystem/adjudication", "https://bluebutton.cms.gov/resources/variables/othr_troop_amt", "Other True Out-of-Pocket (TrOOP) Amount")))).setAmount(new Money().setValue(amt).setCurrency(TransformerConstants.CODED_MONEY_USD));
    assertTrue(compare.equalsDeep(adjudication));
}
Also used : Money(org.hl7.fhir.r4.model.Money) Coding(org.hl7.fhir.r4.model.Coding) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) BigDecimal(java.math.BigDecimal) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 38 with AdjudicationComponent

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method createAdjudicationWithReason.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
 *     AdjudicationComponent} will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface} being coded
 * @param reasonCode the value to use for the {@link AdjudicationComponent#getReason()}'s {@link
 *     Coding#getCode()} for the resulting {@link Coding}
 * @return the output {@link AdjudicationComponent} for the specified input values
 */
static AdjudicationComponent createAdjudicationWithReason(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Object reasonCode) {
    // Cheating here, since they use the same URL.
    String categoryConceptCode = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    CodeableConcept category = createCodeableConcept(TransformerConstants.CODING_CCW_ADJUDICATION_CATEGORY, categoryConceptCode);
    category.getCodingFirstRep().setDisplay(ccwVariable.getVariable().getLabel());
    AdjudicationComponent adjudication = new AdjudicationComponent(category);
    adjudication.setReason(createCodeableConcept(rootResource, ccwVariable, reasonCode));
    return adjudication;
}
Also used : AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 39 with AdjudicationComponent

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method mapEobCommonItemCarrierDME.

/**
 * Transforms the common item level data elements between the {@link CarrierClaimLine} and {@link
 * DMEClaimLine} claim types to FHIR. The method parameter fields from {@link CarrierClaimLine}
 * and {@link DMEClaimLine} are listed below and their corresponding RIF CCW fields (denoted in
 * all CAPS below from {@link CarrierClaimColumn} and {@link DMEClaimColumn}).
 *
 * @param item the {@ ItemComponent} to modify
 * @param eob the {@ ExplanationOfBenefit} to modify
 * @param claimId CLM_ID,
 * @param serviceCount LINE_SRVC_CNT,
 * @param placeOfServiceCode LINE_PLACE_OF_SRVC_CD,
 * @param firstExpenseDate LINE_1ST_EXPNS_DT,
 * @param lastExpenseDate LINE_LAST_EXPNS_DT,
 * @param beneficiaryPaymentAmount LINE_BENE_PMT_AMT,
 * @param providerPaymentAmount LINE_PRVDR_PMT_AMT,
 * @param beneficiaryPartBDeductAmount LINE_BENE_PTB_DDCTBL_AMT,
 * @param primaryPayerCode LINE_BENE_PRMRY_PYR_CD,
 * @param primaryPayerPaidAmount LINE_BENE_PRMRY_PYR_PD_AMT,
 * @param betosCode BETOS_CD,
 * @param paymentAmount LINE_NCH_PMT_AMT,
 * @param paymentCode LINE_PMT_80_100_CD,
 * @param coinsuranceAmount LINE_COINSRNC_AMT,
 * @param submittedChargeAmount LINE_SBMTD_CHRG_AMT,
 * @param allowedChargeAmount LINE_ALOWD_CHRG_AMT,
 * @param processingIndicatorCode LINE_PRCSG_IND_CD,
 * @param serviceDeductibleCode LINE_SERVICE_DEDUCTIBLE,
 * @param diagnosisCode LINE_ICD_DGNS_CD,
 * @param diagnosisCodeVersion LINE_ICD_DGNS_VRSN_CD,
 * @param hctHgbTestTypeCode LINE_HCT_HGB_TYPE_CD
 * @param hctHgbTestResult LINE_HCT_HGB_RSLT_NUM,
 * @param cmsServiceTypeCode LINE_CMS_TYPE_SRVC_CD,
 * @param nationalDrugCode LINE_NDC_CD,
 * @param beneficiaryId BENE_ID,
 * @param referringPhysicianNpi RFR_PHYSN_NPI
 * @return the {@link ItemComponent}
 */
static ItemComponent mapEobCommonItemCarrierDME(ItemComponent item, ExplanationOfBenefit eob, String claimId, BigDecimal serviceCount, String placeOfServiceCode, Optional<LocalDate> firstExpenseDate, Optional<LocalDate> lastExpenseDate, BigDecimal beneficiaryPaymentAmount, BigDecimal providerPaymentAmount, BigDecimal beneficiaryPartBDeductAmount, Optional<Character> primaryPayerCode, BigDecimal primaryPayerPaidAmount, Optional<String> betosCode, BigDecimal paymentAmount, Optional<Character> paymentCode, BigDecimal coinsuranceAmount, BigDecimal submittedChargeAmount, BigDecimal allowedChargeAmount, Optional<String> processingIndicatorCode, Optional<Character> serviceDeductibleCode, Optional<String> diagnosisCode, Optional<Character> diagnosisCodeVersion, Optional<String> hctHgbTestTypeCode, BigDecimal hctHgbTestResult, char cmsServiceTypeCode, Optional<String> nationalDrugCode) {
    SimpleQuantity serviceCnt = new SimpleQuantity();
    serviceCnt.setValue(serviceCount);
    item.setQuantity(serviceCnt);
    item.setCategory(createCodeableConcept(eob, CcwCodebookVariable.LINE_CMS_TYPE_SRVC_CD, cmsServiceTypeCode));
    item.setLocation(createCodeableConcept(eob, CcwCodebookVariable.LINE_PLACE_OF_SRVC_CD, placeOfServiceCode));
    if (betosCode.isPresent()) {
        item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.BETOS_CD, betosCode));
    }
    if (firstExpenseDate.isPresent() && lastExpenseDate.isPresent()) {
        validatePeriodDates(firstExpenseDate, lastExpenseDate);
        item.setServiced(new Period().setStart((convertToDate(firstExpenseDate.get())), TemporalPrecisionEnum.DAY).setEnd((convertToDate(lastExpenseDate.get())), TemporalPrecisionEnum.DAY));
    }
    AdjudicationComponent adjudicationForPayment = item.addAdjudication();
    adjudicationForPayment.setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_NCH_PMT_AMT)).setAmount(createMoney(paymentAmount));
    if (paymentCode.isPresent())
        adjudicationForPayment.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_PMT_80_100_CD, paymentCode));
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_BENE_PMT_AMT)).setAmount(createMoney(beneficiaryPaymentAmount));
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_PRVDR_PMT_AMT)).setAmount(createMoney(providerPaymentAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.LINE_BENE_PTB_DDCTBL_AMT)).setAmount(createMoney(beneficiaryPartBDeductAmount));
    if (primaryPayerCode.isPresent()) {
        item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_BENE_PRMRY_PYR_CD, primaryPayerCode));
    }
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_BENE_PRMRY_PYR_PD_AMT)).setAmount(createMoney(primaryPayerPaidAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.LINE_COINSRNC_AMT)).setAmount(createMoney(coinsuranceAmount));
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_SBMTD_CHRG_AMT)).setAmount(createMoney(submittedChargeAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.LINE_ALOWD_CHRG_AMT)).setAmount(createMoney(allowedChargeAmount));
    if (processingIndicatorCode.isPresent())
        item.addAdjudication(createAdjudicationWithReason(eob, CcwCodebookVariable.LINE_PRCSG_IND_CD, processingIndicatorCode));
    if (serviceDeductibleCode.isPresent())
        item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_SERVICE_DEDUCTIBLE, serviceDeductibleCode));
    Optional<Diagnosis> lineDiagnosis = Diagnosis.from(diagnosisCode, diagnosisCodeVersion);
    if (lineDiagnosis.isPresent())
        addDiagnosisLink(eob, item, lineDiagnosis.get());
    if (hctHgbTestTypeCode.isPresent()) {
        Observation hctHgbObservation = new Observation();
        hctHgbObservation.setStatus(ObservationStatus.UNKNOWN);
        hctHgbObservation.setCode(createCodeableConcept(eob, CcwCodebookVariable.LINE_HCT_HGB_TYPE_CD, hctHgbTestTypeCode));
        hctHgbObservation.setValue(new Quantity().setValue(hctHgbTestResult));
        Extension hctHgbObservationReference = new Extension(CCWUtils.calculateVariableReferenceUrl(CcwCodebookVariable.LINE_HCT_HGB_RSLT_NUM), new Reference(hctHgbObservation));
        item.addExtension(hctHgbObservationReference);
    }
    if (nationalDrugCode.isPresent()) {
        addExtensionCoding(item, TransformerConstants.CODING_NDC, TransformerConstants.CODING_NDC, TransformerUtils.retrieveFDADrugCodeDisplay(nationalDrugCode.get()), nationalDrugCode.get());
    }
    return item;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) Reference(org.hl7.fhir.dstu3.model.Reference) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) Observation(org.hl7.fhir.dstu3.model.Observation) Period(org.hl7.fhir.dstu3.model.Period) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) Quantity(org.hl7.fhir.dstu3.model.Quantity) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis)

Example 40 with AdjudicationComponent

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.

the class DMEClaimTransformerV2Test method shouldHaveLineItemAdjudicationLineBenePtbDdctblAmt.

@Test
public void shouldHaveLineItemAdjudicationLineBenePtbDdctblAmt() {
    AdjudicationComponent adjudication = TransformerTestUtilsV2.findAdjudicationByCategory("https://bluebutton.cms.gov/resources/variables/line_bene_ptb_ddctbl_amt", eob.getItemFirstRep().getAdjudication());
    // Need to maintain trailing 0s in USD amount
    BigDecimal amt = new BigDecimal(18.00);
    amt = amt.setScale(2, RoundingMode.HALF_DOWN);
    AdjudicationComponent compare = new AdjudicationComponent().setCategory(new CodeableConcept().setCoding(Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/adjudication", "deductible", "Deductible"), new Coding("https://bluebutton.cms.gov/resources/codesystem/adjudication", "https://bluebutton.cms.gov/resources/variables/line_bene_ptb_ddctbl_amt", "Line Beneficiary Part B Deductible Amount")))).setAmount(new Money().setValue(amt).setCurrency(TransformerConstants.CODED_MONEY_USD));
    assertTrue(compare.equalsDeep(adjudication));
}
Also used : Money(org.hl7.fhir.r4.model.Money) Coding(org.hl7.fhir.r4.model.Coding) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) BigDecimal(java.math.BigDecimal) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Aggregations

CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)67 AdjudicationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent)67 Coding (org.hl7.fhir.r4.model.Coding)65 Test (org.junit.jupiter.api.Test)64 Money (org.hl7.fhir.r4.model.Money)62 BigDecimal (java.math.BigDecimal)18 DecimalType (org.hl7.fhir.r4.model.DecimalType)8 AdjudicationComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent)5 IBaseExtension (org.hl7.fhir.instance.model.api.IBaseExtension)5 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)4 Extension (org.hl7.fhir.dstu3.model.Extension)4 Observation (org.hl7.fhir.dstu3.model.Observation)4 Reference (org.hl7.fhir.dstu3.model.Reference)4 FhirContext (ca.uhn.fhir.context.FhirContext)3 TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)3 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)3 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)3 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)3 Period (org.hl7.fhir.dstu3.model.Period)3 Quantity (org.hl7.fhir.dstu3.model.Quantity)3