use of org.hl7.fhir.dstu2.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createExtensionQuantity.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
* Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
* specified input values
*/
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
if (!quantityValue.isPresent())
throw new IllegalArgumentException();
Quantity quantity;
if (quantityValue.get() instanceof BigDecimal)
quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
else
throw new BadCodeMonkeyException();
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, quantity);
return extension;
}
use of org.hl7.fhir.dstu2.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method addExtensionValueQuantity.
/**
* Adds an {@link Extension} to the specified {@link DomainResource}. {@link Extension#getValue()}
* will be set to a {@link Quantity} with the specified system and value.
*
* @param fhirElement the FHIR element to add the {@link Extension} to
* @param extensionUrl the {@link Extension#getUrl()} to use
* @param quantitySystem the {@link Quantity#getSystem()} to use
* @param quantityValue the {@link Quantity#getValue()} to use
*/
static void addExtensionValueQuantity(IBaseHasExtensions fhirElement, String extensionUrl, String quantitySystem, BigDecimal quantityValue) {
IBaseExtension<?, ?> extension = fhirElement.addExtension();
extension.setUrl(extensionUrl);
extension.setValue(new Quantity().setSystem(extensionUrl).setValue(quantityValue));
// CodeableConcept codeableConcept = new CodeableConcept();
// extension.setValue(codeableConcept);
//
// Coding coding = codeableConcept.addCoding();
// coding.setSystem(codingSystem).setCode(codingCode);
}
use of org.hl7.fhir.dstu2.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method createExtensionQuantity.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
* Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
* specified input values
*/
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
if (!quantityValue.isPresent()) {
throw new IllegalArgumentException();
}
Quantity quantity;
if (quantityValue.get() instanceof BigDecimal) {
quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
} else {
throw new BadCodeMonkeyException();
}
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, quantity);
return extension;
}
use of org.hl7.fhir.dstu2.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveLineItemQuantity.
@Test
public void shouldHaveLineItemQuantity() {
Quantity quantity = eob.getItemFirstRep().getQuantity();
Quantity compare = new Quantity(77);
assertTrue(compare.equalsDeep(quantity));
}
use of org.hl7.fhir.dstu2.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class DMEClaimTransformerV2 method handleClaimLines.
private static void handleClaimLines(DMEClaim claimGroup, ExplanationOfBenefit eob, Optional<Boolean> includeTaxNumbers) {
for (DMEClaimLine line : claimGroup.getLines()) {
ItemComponent item = TransformerUtilsV2.addItem(eob);
// Override the default sequence
// CLM_LINE_NUM => item.sequence
item.setSequence(line.getLineNumber().intValue());
// add an extension for the provider billing number as there is not a good place
// to map this in the existing FHIR specification
// PRVDR_NUM => ExplanationOfBenefit.provider.value
line.getProviderBillingNumber().ifPresent(c -> item.addExtension(TransformerUtilsV2.createExtensionIdentifier(CcwCodebookVariable.SUPLRNUM, line.getProviderBillingNumber())));
// PRVDR_NPI => ExplanationOfBenefit.careTeam.provider
Optional<CareTeamComponent> performing = TransformerUtilsV2.addCareTeamMember(eob, item, C4BBPractitionerIdentifierType.NPI, C4BBClaimProfessionalAndNonClinicianCareTeamRole.PERFORMING, line.getProviderNPI());
// Update the responsible flag
performing.ifPresent(p -> {
p.setResponsible(true);
// PRVDR_SPCLTY => ExplanationOfBenefit.careTeam.qualification
p.setQualification(TransformerUtilsV2.createCodeableConcept(eob, CcwCodebookVariable.PRVDR_SPCLTY, line.getProviderSpecialityCode()));
// PRTCPTNG_IND_CD => ExplanationOfBenefit.careTeam.extension
p.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.PRTCPTNG_IND_CD, line.getProviderParticipatingIndCode()));
});
// PRVDR_STATE_CD => ExplanationOfBenefit.item.location.extension
if (item.getLocation() != null) {
item.getLocation().addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.PRVDR_STATE_CD, line.getProviderStateCode()));
}
// HCPCS_CD => ExplanationOfBenefit.item.productOrService
// HCPCS_1ST_MDFR_CD => ExplanationOfBenefit.item.modifier
// HCPCS_2ND_MDFR_CD => ExplanationOfBenefit.item.modifier
// HCPCS_3RD_MDFR_CD => ExplanationOfBenefit.item.modifier
// HCPCS_4Th_MDFR_CD => ExplanationOfBenefit.item.modifier
TransformerUtilsV2.mapHcpcs(eob, item, line.getHcpcsCode(), claimGroup.getHcpcsYearCode(), Arrays.asList(line.getHcpcsInitialModifierCode(), line.getHcpcsSecondModifierCode(), line.getHcpcsThirdModifierCode(), line.getHcpcsFourthModifierCode()));
if (includeTaxNumbers.orElse(false)) {
item.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.TAX_NUM, line.getProviderTaxNumber()));
}
// REV_CNTR_PRVDR_PMT_AMT => ExplanationOfBenefit.item.adjudication
TransformerUtilsV2.addAdjudication(item, TransformerUtilsV2.createAdjudicationAmtSlice(CcwCodebookVariable.REV_CNTR_PRVDR_PMT_AMT, C4BBAdjudication.PAID_TO_PROVIDER, line.getProviderPaymentAmount()));
// TODO - check w/jack if this is right ELIGIBLE
// LINE_PRMRY_ALOWD_CHRG_AMT => ExplanationOfBenefit.item.adjudication.value
TransformerUtilsV2.addAdjudication(item, TransformerUtilsV2.createAdjudicationAmtSlice(CcwCodebookVariable.LINE_PRMRY_ALOWD_CHRG_AMT, C4BBAdjudication.ELIGIBLE, line.getPrimaryPayerAllowedChargeAmount()));
// LINE_DME_PRCHS_PRICE_AMT => ExplanationOfBenefit.item.adjudication.value
TransformerUtilsV2.addAdjudication(item, TransformerUtilsV2.createAdjudicationAmtSlice(CcwCodebookVariable.LINE_DME_PRCHS_PRICE_AMT, C4BBAdjudication.SUBMITTED, line.getPurchasePriceAmount()));
// DMERC_LINE_SCRN_SVGS_AMT => ExplanationOfBenefit.item.extension
line.getScreenSavingsAmount().ifPresent(c -> item.addExtension(// TODO should this be an adjudication?
TransformerUtilsV2.createExtensionQuantity(CcwCodebookVariable.DMERC_LINE_SCRN_SVGS_AMT, line.getScreenSavingsAmount())));
// DMERC_LINE_MTUS_CNT => ExplanationOfBenefit.item.extension
Extension mtusQuantityExtension = TransformerUtilsV2.createExtensionQuantity(CcwCodebookVariable.DMERC_LINE_MTUS_CNT, line.getMtusCount());
item.addExtension(mtusQuantityExtension);
// DMERC_LINE_MTUS_CD => ExplanationOfBenefit.item.extension
if (line.getMtusCode().isPresent()) {
Quantity mtusQuantity = (Quantity) mtusQuantityExtension.getValue();
TransformerUtilsV2.setQuantityUnitInfo(CcwCodebookVariable.DMERC_LINE_MTUS_CD, line.getMtusCode(), eob, mtusQuantity);
}
// DMERC_LINE_PRCNG_STATE_CD => ExplanationOfBenefit.item.extension
line.getPricingStateCode().ifPresent(c -> item.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.DMERC_LINE_PRCNG_STATE_CD, line.getPricingStateCode())));
// DMERC_LINE_SUPPLR_TYPE_CD => ExplanationOfBenefit.item.extension
line.getSupplierTypeCode().ifPresent(c -> item.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.DMERC_LINE_SUPPLR_TYPE_CD, line.getSupplierTypeCode())));
// Common item level fields between Carrier and DME
// LINE_NUM => ExplanationOfBenefit.item.sequence
// LINE_SRVC_CNT => ExplanationOfBenefit.item.quantity
// LINE_CMS_TYPE_SRVC_CD => ExplanationOfBenefit.item.category
// LINE_PLACE_OF_SRVC_CD => ExplanationOfBenefit.item.location
// LINE_1ST_EXPNS_DT => ExplanationOfBenefit.item.servicedPeriod
// LINE_LAST_EXPNS_DT => ExplanationOfBenefit.item.servicedPeriod
// LINE_NCH_PMT_AMT => ExplanationOfBenefit.item.adjudication
// LINE_PMT_80_100_CD => ExplanationOfBenefit.item.adjudication.extension
// PAID_TO_PATIENT => ExplanationOfBenefit.item.adjudication
// LINE_PRVDR_PMT_AMT => ExplanationOfBenefit.item.adjudication
// LINE_BENE_PTB_DDCTBL_AMT => ExplanationOfBenefit.item.adjudication
// LINE_BENE_PRMRY_PYR_CD => ExplanationOfBenefit.item.extension
// LINE_BENE_PRMRY_PYR_PD_AMT => ExplanationOfBenefit.item.adjudication
// BETOS_CD => ExplanationOfBenefit.item.extension
// LINE_COINSRNC_AMT => ExplanationOfBenefit.item.adjudication
// LINE_SBMTD_CHRG_AMT => ExplanationOfBenefit.item.adjudication
// LINE_ALOWD_CHRG_AMT => ExplanationOfBenefit.item.adjudication
// LINE_BENE_PRMRY_PYR_CD => ExplanationOfBenefit.item.extension
// LINE_SERVICE_DEDUCTIBLE => ExplanationOfBenefit.item.extension
// LINE_HCT_HGB_TYPE_CD => Observation.code
// LINE_HCT_HGB_RSLT_NUM => Observation.value
// LINE_NDC_CD => ExplanationOfBenefit.item.productOrService
// LINE_BENE_PMT_AMT => ExplanationOfBenefit.item.adjudication.value
// LINE_PRCSG_IND_CD => ExplanationOfBenefit.item.extension
// LINE_DME_PRCHS_PRICE_AMT => ExplanationOfBenefit.item.adjudication.value
TransformerUtilsV2.mapEobCommonItemCarrierDME(item, eob, claimGroup.getClaimId(), item.getSequence(), line.getServiceCount(), line.getPlaceOfServiceCode(), line.getFirstExpenseDate(), line.getLastExpenseDate(), line.getBeneficiaryPaymentAmount(), line.getProviderPaymentAmount(), line.getBeneficiaryPartBDeductAmount(), line.getPrimaryPayerCode(), line.getPrimaryPayerPaidAmount(), line.getBetosCode(), line.getPaymentAmount(), line.getPaymentCode(), line.getCoinsuranceAmount(), line.getSubmittedChargeAmount(), line.getAllowedChargeAmount(), line.getProcessingIndicatorCode(), line.getServiceDeductibleCode(), line.getHctHgbTestTypeCode(), line.getHctHgbTestResult(), line.getCmsServiceTypeCode(), line.getNationalDrugCode());
// LINE_ICD_DGNS_CD => ExplanationOfBenefit.item.diagnosisSequence
// LINE_ICD_DGNS_VRSN_CD => ExplanationOfBenefit.item.diagnosisSequence
DiagnosisUtilV2.addDiagnosisLink(eob, item, Diagnosis.from(line.getDiagnosisCode(), line.getDiagnosisCodeVersion(), DiagnosisLabel.OTHER), ClaimTypeV2.CARRIER);
// PRVDR_STATE_CD => ExplanationOfBenefit.item.location.extension
if (line.getProviderStateCode() != null) {
item.getLocation().addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.PRVDR_STATE_CD, line.getProviderStateCode()));
}
// LINE_BENE_PRMRY_PYR_CD
// claimLine.getPrimaryPayerCode()) => ExplanationOfBenefit.item.extension
line.getPrimaryPayerCode().ifPresent(c -> item.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.LINE_BENE_PRMRY_PYR_CD, line.getPrimaryPayerCode())));
// LINE_BENE_PMT_AMT
// claimLine.getBeneficiaryPaymentAmount() => ExplanationOfBenefit.item.adjudication.value
TransformerUtilsV2.addAdjudication(item, TransformerUtilsV2.createAdjudicationAmtSlice(CcwCodebookVariable.LINE_BENE_PMT_AMT, C4BBAdjudication.PAID_TO_PROVIDER, line.getPurchasePriceAmount()));
// LINE_DME_PRCHS_PRICE_AMT
// claimLine.getPurchasePriceAmount() => ExplanationOfBenefit.item.adjudication.value
TransformerUtilsV2.addAdjudication(item, TransformerUtilsV2.createAdjudicationAmtSlice(CcwCodebookVariable.LINE_DME_PRCHS_PRICE_AMT, C4BBAdjudication.SUBMITTED, line.getPurchasePriceAmount()));
}
}
Aggregations