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);
}
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);
}
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));
}
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));
}
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));
}
Aggregations