use of org.hl7.fhir.dstu3.model.UnsignedIntType in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createBundle.
/**
* Create a bundle from the entire search result
*
* @param resources a list of {@link ExplanationOfBenefit}s, {@link Coverage}s, or {@link
* Patient}s, all of which will be added to the bundle
* @param paging contains the {@link LinkBuilder} information to add to the bundle
* @param transactionTime date for the bundle
* @return Returns a {@link Bundle} of either {@link ExplanationOfBenefit}s, {@link Coverage}s, or
* {@link Patient}s, which may contain multiple matching resources, or may also be empty.
*/
public static Bundle createBundle(List<IBaseResource> resources, LinkBuilder paging, Instant transactionTime) {
Bundle bundle = new Bundle();
TransformerUtils.addResourcesToBundle(bundle, resources);
paging.addLinks(bundle);
bundle.setTotalElement(paging.isPagingRequested() ? new UnsignedIntType() : new UnsignedIntType(resources.size()));
/*
* Dev Note: the Bundle's lastUpdated timestamp is the known last update time for the whole
* database. Because the filterManager's tracking of this timestamp is lazily updated for
* performance reason, the resources of the bundle may be after the filter manager's version of
* the timestamp.
*/
Instant maxBundleDate = resources.stream().map(r -> r.getMeta().getLastUpdated().toInstant()).filter(Objects::nonNull).max(Instant::compareTo).orElse(transactionTime);
bundle.getMeta().setLastUpdated(transactionTime.isAfter(maxBundleDate) ? Date.from(transactionTime) : Date.from(maxBundleDate));
return bundle;
}
use of org.hl7.fhir.dstu3.model.UnsignedIntType in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method addCommonGroupInpatientSNF.
/**
* Adds field values to the benefit balance component that are common between the Inpatient and
* SNF claim types.
*
* @param eob the {@link ExplanationOfBenefit} to map the fields into
* @param coinsuranceDayCount BENE_TOT_COINSRNC_DAYS_CNT: a {@link BigDecimal} shared field
* representing the coinsurance day count for the claim
* @param nonUtilizationDayCount CLM_NON_UTLZTN_DAYS_CNT: a {@link BigDecimal} shared field
* representing the non-utilization day count for the claim
* @param deductibleAmount NCH_BENE_IP_DDCTBL_AMT: a {@link BigDecimal} shared field representing
* the deductible amount for the claim
* @param partACoinsuranceLiabilityAmount NCH_BENE_PTA_COINSRNC_LBLTY_AM: a {@link BigDecimal}
* shared field representing the part A coinsurance amount for the claim
* @param bloodPintsFurnishedQty NCH_BLOOD_PNTS_FRNSHD_QTY: a {@link BigDecimal} shared field
* representing the blood pints furnished quantity for the claim
* @param noncoveredCharge NCH_IP_NCVRD_CHRG_AMT: a {@link BigDecimal} shared field representing
* the non-covered charge for the claim
* @param totalDeductionAmount NCH_IP_TOT_DDCTN_AMT: a {@link BigDecimal} shared field
* representing the total deduction amount for the claim
* @param claimPPSCapitalDisproportionateShareAmt CLM_PPS_CPTL_DSPRPRTNT_SHR_AMT: an {@link
* Optional}<{@link BigDecimal}> shared field representing the claim PPS capital
* disproportionate share amount for the claim
* @param claimPPSCapitalExceptionAmount CLM_PPS_CPTL_EXCPTN_AMT: an {@link Optional}<{@link
* BigDecimal}> shared field representing the claim PPS capital exception amount for the
* claim
* @param claimPPSCapitalFSPAmount CLM_PPS_CPTL_FSP_AMT: an {@link Optional}<{@link
* BigDecimal}> shared field representing the claim PPS capital FSP amount for the claim
* @param claimPPSCapitalIMEAmount CLM_PPS_CPTL_IME_AMT: an {@link Optional}<{@link
* BigDecimal}> shared field representing the claim PPS capital IME amount for the claim
* @param claimPPSCapitalOutlierAmount CLM_PPS_CPTL_OUTLIER_AMT: an {@link Optional}<{@link
* BigDecimal}> shared field representing the claim PPS capital outlier amount for the
* claim
* @param claimPPSOldCapitalHoldHarmlessAmount CLM_PPS_OLD_CPTL_HLD_HRMLS_AMT: an {@link
* Optional}<{@link BigDecimal}> shared field representing the claim PPS old capital
* hold harmless amount for the claim
*/
static void addCommonGroupInpatientSNF(ExplanationOfBenefit eob, BigDecimal coinsuranceDayCount, BigDecimal nonUtilizationDayCount, BigDecimal deductibleAmount, BigDecimal partACoinsuranceLiabilityAmount, BigDecimal bloodPintsFurnishedQty, BigDecimal noncoveredCharge, BigDecimal totalDeductionAmount, Optional<BigDecimal> claimPPSCapitalDisproportionateShareAmt, Optional<BigDecimal> claimPPSCapitalExceptionAmount, Optional<BigDecimal> claimPPSCapitalFSPAmount, Optional<BigDecimal> claimPPSCapitalIMEAmount, Optional<BigDecimal> claimPPSCapitalOutlierAmount, Optional<BigDecimal> claimPPSOldCapitalHoldHarmlessAmount) {
BenefitComponent beneTotCoinsrncDaysCntFinancial = addBenefitBalanceFinancial(eob, BenefitCategory.MEDICAL, CcwCodebookVariable.BENE_TOT_COINSRNC_DAYS_CNT);
beneTotCoinsrncDaysCntFinancial.setUsed(new UnsignedIntType(coinsuranceDayCount.intValueExact()));
BenefitComponent clmNonUtlztnDaysCntFinancial = addBenefitBalanceFinancial(eob, BenefitCategory.MEDICAL, CcwCodebookVariable.CLM_NON_UTLZTN_DAYS_CNT);
clmNonUtlztnDaysCntFinancial.setUsed(new UnsignedIntType(nonUtilizationDayCount.intValueExact()));
addAdjudicationTotal(eob, CcwCodebookVariable.NCH_BENE_IP_DDCTBL_AMT, deductibleAmount);
addAdjudicationTotal(eob, CcwCodebookVariable.NCH_BENE_PTA_COINSRNC_LBLTY_AMT, partACoinsuranceLiabilityAmount);
SupportingInformationComponent nchBloodPntsFrnshdQtyInfo = addInformation(eob, CcwCodebookVariable.NCH_BLOOD_PNTS_FRNSHD_QTY);
Quantity bloodPintsQuantity = new Quantity();
bloodPintsQuantity.setValue(bloodPintsFurnishedQty);
bloodPintsQuantity.setSystem(TransformerConstants.CODING_SYSTEM_UCUM).setCode(TransformerConstants.CODING_SYSTEM_UCUM_PINT_CODE).setUnit(TransformerConstants.CODING_SYSTEM_UCUM_PINT_DISPLAY);
nchBloodPntsFrnshdQtyInfo.setValue(bloodPintsQuantity);
addAdjudicationTotal(eob, CcwCodebookVariable.NCH_IP_NCVRD_CHRG_AMT, noncoveredCharge);
addAdjudicationTotal(eob, CcwCodebookVariable.NCH_IP_TOT_DDCTN_AMT, totalDeductionAmount);
if (claimPPSCapitalDisproportionateShareAmt.isPresent()) {
addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PPS_CPTL_DSPRPRTNT_SHR_AMT, claimPPSCapitalDisproportionateShareAmt);
}
if (claimPPSCapitalExceptionAmount.isPresent()) {
addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PPS_CPTL_EXCPTN_AMT, claimPPSCapitalExceptionAmount);
}
if (claimPPSCapitalFSPAmount.isPresent()) {
addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PPS_CPTL_FSP_AMT, claimPPSCapitalFSPAmount);
}
if (claimPPSCapitalIMEAmount.isPresent()) {
addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PPS_CPTL_IME_AMT, claimPPSCapitalIMEAmount);
}
if (claimPPSCapitalOutlierAmount.isPresent()) {
addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PPS_CPTL_OUTLIER_AMT, claimPPSCapitalOutlierAmount);
}
if (claimPPSOldCapitalHoldHarmlessAmount.isPresent()) {
addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PPS_OLD_CPTL_HLD_HRMLS_AMT, claimPPSOldCapitalHoldHarmlessAmount);
}
}
use of org.hl7.fhir.dstu3.model.UnsignedIntType in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method mapEobCommonGroupInpHHAHospiceSNF.
/**
* Transforms the common group level data elements between the {@link InpatientClaim} {@link
* HHAClaim} {@link HospiceClaim} and {@link SNFClaim} claim types to FHIR. The method parameter
* fields from {@link InpatientClaim} {@link HHAClaim} {@link HospiceClaim} and {@link SNFClaim}
* are listed below and their corresponding RIF CCW fields (denoted in all CAPS below from {@link
* InpatientClaimColumn} {@link HHAClaimColumn} {@link HospiceColumn} and {@link SNFClaimColumn}).
*
* @param eob the {@link ExplanationOfBenefit} to modify
* @param claimAdmissionDate CLM_ADMSN_DT,
* @param benficiaryDischargeDate,
* @param utilizedDays CLM_UTLZTN_CNT,
* @return the {@link ExplanationOfBenefit}
*/
static ExplanationOfBenefit mapEobCommonGroupInpHHAHospiceSNF(ExplanationOfBenefit eob, Optional<LocalDate> claimAdmissionDate, Optional<LocalDate> beneficiaryDischargeDate, Optional<BigDecimal> utilizedDays) {
if (claimAdmissionDate.isPresent() || beneficiaryDischargeDate.isPresent()) {
TransformerUtils.validatePeriodDates(claimAdmissionDate, beneficiaryDischargeDate);
Period period = new Period();
if (claimAdmissionDate.isPresent()) {
period.setStart(TransformerUtils.convertToDate(claimAdmissionDate.get()), TemporalPrecisionEnum.DAY);
}
if (beneficiaryDischargeDate.isPresent()) {
period.setEnd(TransformerUtils.convertToDate(beneficiaryDischargeDate.get()), TemporalPrecisionEnum.DAY);
}
eob.setHospitalization(period);
}
if (utilizedDays.isPresent()) {
BenefitComponent clmUtlztnDayCntFinancial = TransformerUtils.addBenefitBalanceFinancial(eob, BenefitCategory.MEDICAL, CcwCodebookVariable.CLM_UTLZTN_DAY_CNT);
clmUtlztnDayCntFinancial.setUsed(new UnsignedIntType(utilizedDays.get().intValue()));
}
return eob;
}
use of org.hl7.fhir.dstu3.model.UnsignedIntType in project beneficiary-fhir-data by CMSgov.
the class SNFClaimTransformerV2Test method shouldHaveClmUtlztnDayCntFinancial.
@Test
public void shouldHaveClmUtlztnDayCntFinancial() {
BenefitComponent benefit = TransformerTestUtilsV2.findFinancial("https://bluebutton.cms.gov/resources/variables/clm_utlztn_day_cnt", 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/clm_utlztn_day_cnt", "Claim Medicare Utilization Day Count")))).setUsed(new UnsignedIntType().setValue(17));
assertTrue(compare.equalsDeep(benefit));
}
use of org.hl7.fhir.dstu3.model.UnsignedIntType in project beneficiary-fhir-data by CMSgov.
the class SNFClaimTransformerV2Test method shouldHaveClmNonUtlztnDaysCntFinancial.
@Test
public void shouldHaveClmNonUtlztnDaysCntFinancial() {
BenefitComponent benefit = TransformerTestUtilsV2.findFinancial("https://bluebutton.cms.gov/resources/variables/clm_non_utlztn_days_cnt", 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/clm_non_utlztn_days_cnt", "Claim Medicare Non Utilization Days Count")))).setUsed(new UnsignedIntType().setValue(0));
assertTrue(compare.equalsDeep(benefit));
}
Aggregations