Search in sources :

Example 76 with Money

use of org.hl7.fhir.r4b.model.Money in project synthea by synthetichealth.

the class FhirStu3 method medicationClaim.

/**
 * Create an entry for the given Claim, which references a Medication.
 *
 * @param rand Source of randomness to use when generating ids etc
 * @param personEntry Entry for the person
 * @param bundle The Bundle to add to
 * @param encounterEntry The current Encounter
 * @param claim the Claim object
 * @param medicationEntry The Entry for the Medication object, previously created
 * @return the added Entry
 */
private static BundleEntryComponent medicationClaim(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, Claim claim, BundleEntryComponent medicationEntry) {
    org.hl7.fhir.dstu3.model.Claim claimResource = new org.hl7.fhir.dstu3.model.Claim();
    org.hl7.fhir.dstu3.model.Encounter encounterResource = (org.hl7.fhir.dstu3.model.Encounter) encounterEntry.getResource();
    claimResource.setStatus(ClaimStatus.ACTIVE);
    claimResource.setUse(org.hl7.fhir.dstu3.model.Claim.Use.COMPLETE);
    // duration of encounter
    claimResource.setBillablePeriod(encounterResource.getPeriod());
    claimResource.setPatient(new Reference(personEntry.getFullUrl()));
    claimResource.setOrganization(encounterResource.getServiceProvider());
    // add item for encounter
    claimResource.addItem(new org.hl7.fhir.dstu3.model.Claim.ItemComponent(new PositiveIntType(1)).addEncounter(new Reference(encounterEntry.getFullUrl())));
    // add prescription.
    claimResource.setPrescription(new Reference(medicationEntry.getFullUrl()));
    Money moneyResource = new Money();
    moneyResource.setValue(claim.getTotalClaimCost());
    moneyResource.setCode("USD");
    moneyResource.setSystem("urn:iso:std:iso:4217");
    claimResource.setTotal(moneyResource);
    return newEntry(rand, bundle, claimResource);
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) PositiveIntType(org.hl7.fhir.dstu3.model.PositiveIntType) Money(org.hl7.fhir.dstu3.model.Money) ItemComponent(org.hl7.fhir.dstu3.model.Claim.ItemComponent) SupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Claim(org.mitre.synthea.world.concepts.Claim)

Example 77 with Money

use of org.hl7.fhir.r4b.model.Money 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 78 with Money

use of org.hl7.fhir.r4b.model.Money 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)

Example 79 with Money

use of org.hl7.fhir.r4b.model.Money in project beneficiary-fhir-data by CMSgov.

the class DMEClaimTransformerV2Test method shouldHaveLineItemAdjudicationLineDmePrchsPriceAmt.

@Test
public void shouldHaveLineItemAdjudicationLineDmePrchsPriceAmt() {
    AdjudicationComponent adjudication = TransformerTestUtilsV2.findAdjudicationByCategory("https://bluebutton.cms.gov/resources/variables/line_dme_prchs_price_amt", eob.getItemFirstRep().getAdjudication());
    AdjudicationComponent compare = new AdjudicationComponent().setCategory(new CodeableConcept().setCoding(Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/adjudication", "submitted", "Submitted Amount"), new Coding("https://bluebutton.cms.gov/resources/codesystem/adjudication", "https://bluebutton.cms.gov/resources/variables/line_dme_prchs_price_amt", "Line DME Purchase Price Amount")))).setAmount(new Money().setValue(82.29).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 80 with Money

use of org.hl7.fhir.r4b.model.Money in project beneficiary-fhir-data by CMSgov.

the class HHAClaimTransformerV2Test method shouldHavePrpayAmtFinancial.

@Test
public void shouldHavePrpayAmtFinancial() {
    BenefitComponent benefit = TransformerTestUtilsV2.findFinancial("https://bluebutton.cms.gov/resources/variables/prpayamt", eob.getBenefitBalanceFirstRep().getFinancial());
    BenefitComponent compare = new BenefitComponent().setType(new CodeableConcept().setCoding(Arrays.asList(new Coding("https://bluebutton.cms.gov/resources/codesystem/benefit-balance", "https://bluebutton.cms.gov/resources/variables/prpayamt", "NCH Primary Payer (if not Medicare) Claim Paid Amount")))).setUsed(new Money().setValueElement(new DecimalType("11.00")).setCurrency(TransformerConstants.CODED_MONEY_USD));
    assertTrue(compare.equalsDeep(benefit));
}
Also used : Money(org.hl7.fhir.r4.model.Money) Coding(org.hl7.fhir.r4.model.Coding) DecimalType(org.hl7.fhir.r4.model.DecimalType) BenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Aggregations

Money (org.hl7.fhir.r4.model.Money)129 Test (org.junit.jupiter.api.Test)122 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)117 Coding (org.hl7.fhir.r4.model.Coding)115 AdjudicationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent)61 BenefitComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent)48 DecimalType (org.hl7.fhir.r4.model.DecimalType)42 BigDecimal (java.math.BigDecimal)18 TotalComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent)9 Money (org.hl7.fhir.dstu3.model.Money)6 Extension (org.hl7.fhir.r4.model.Extension)6 Claim (org.mitre.synthea.world.concepts.Claim)6 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)6 NotImplementedException (org.apache.commons.lang3.NotImplementedException)5 PaymentComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent)5 EncounterType (org.mitre.synthea.world.concepts.HealthRecord.EncounterType)4 ItemComponent (org.hl7.fhir.dstu3.model.Claim.ItemComponent)3 Extension (org.hl7.fhir.dstu3.model.Extension)3 Reference (org.hl7.fhir.dstu3.model.Reference)3 SupplyDeliverySuppliedItemComponent (org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent)3