use of org.hl7.fhir.r5.model.Address in project beneficiary-fhir-data by CMSgov.
the class HHAClaimTransformer method transformClaim.
/**
* @param claimGroup the CCW {@link HHAClaim} to transform
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* HHAClaim}
*/
private static ExplanationOfBenefit transformClaim(HHAClaim claimGroup) {
ExplanationOfBenefit eob = new ExplanationOfBenefit();
// Common group level fields between all claim types
TransformerUtils.mapEobCommonClaimHeaderData(eob, claimGroup.getClaimId(), claimGroup.getBeneficiaryId(), ClaimType.HHA, claimGroup.getClaimGroupId().toPlainString(), MedicareSegment.PART_B, Optional.of(claimGroup.getDateFrom()), Optional.of(claimGroup.getDateThrough()), Optional.of(claimGroup.getPaymentAmount()), claimGroup.getFinalAction());
TransformerUtils.mapEobWeeklyProcessDate(eob, claimGroup.getWeeklyProcessDate());
// map eob type codes into FHIR
TransformerUtils.mapEobType(eob, ClaimType.HHA, Optional.of(claimGroup.getNearLineRecordIdCode()), Optional.of(claimGroup.getClaimTypeCode()));
// set the provider number which is common among several claim types
TransformerUtils.setProviderNumber(eob, claimGroup.getProviderNumber());
// Common group level fields between Inpatient, Outpatient Hospice, HHA and SNF
TransformerUtils.mapEobCommonGroupInpOutHHAHospiceSNF(eob, claimGroup.getOrganizationNpi(), claimGroup.getClaimFacilityTypeCode(), claimGroup.getClaimFrequencyCode(), claimGroup.getClaimNonPaymentReasonCode(), claimGroup.getPatientDischargeStatusCode(), claimGroup.getClaimServiceClassificationTypeCode(), claimGroup.getClaimPrimaryPayerCode(), claimGroup.getAttendingPhysicianNpi(), claimGroup.getTotalChargeAmount(), claimGroup.getPrimaryPayerPaidAmount(), claimGroup.getFiscalIntermediaryNumber(), claimGroup.getFiDocumentClaimControlNumber(), claimGroup.getFiOriginalClaimControlNumber());
for (Diagnosis diagnosis : TransformerUtils.extractDiagnoses1Thru12(claimGroup.getDiagnosisPrincipalCode(), claimGroup.getDiagnosisPrincipalCodeVersion(), claimGroup.getDiagnosis1Code(), claimGroup.getDiagnosis1CodeVersion(), claimGroup.getDiagnosis2Code(), claimGroup.getDiagnosis2CodeVersion(), claimGroup.getDiagnosis3Code(), claimGroup.getDiagnosis3CodeVersion(), claimGroup.getDiagnosis4Code(), claimGroup.getDiagnosis4CodeVersion(), claimGroup.getDiagnosis5Code(), claimGroup.getDiagnosis5CodeVersion(), claimGroup.getDiagnosis6Code(), claimGroup.getDiagnosis6CodeVersion(), claimGroup.getDiagnosis7Code(), claimGroup.getDiagnosis7CodeVersion(), claimGroup.getDiagnosis8Code(), claimGroup.getDiagnosis8CodeVersion(), claimGroup.getDiagnosis9Code(), claimGroup.getDiagnosis9CodeVersion(), claimGroup.getDiagnosis10Code(), claimGroup.getDiagnosis10CodeVersion(), claimGroup.getDiagnosis11Code(), claimGroup.getDiagnosis11CodeVersion(), claimGroup.getDiagnosis12Code(), claimGroup.getDiagnosis12CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
for (Diagnosis diagnosis : TransformerUtils.extractDiagnoses13Thru25(claimGroup.getDiagnosis13Code(), claimGroup.getDiagnosis13CodeVersion(), claimGroup.getDiagnosis14Code(), claimGroup.getDiagnosis14CodeVersion(), claimGroup.getDiagnosis15Code(), claimGroup.getDiagnosis15CodeVersion(), claimGroup.getDiagnosis16Code(), claimGroup.getDiagnosis16CodeVersion(), claimGroup.getDiagnosis17Code(), claimGroup.getDiagnosis17CodeVersion(), claimGroup.getDiagnosis18Code(), claimGroup.getDiagnosis18CodeVersion(), claimGroup.getDiagnosis19Code(), claimGroup.getDiagnosis19CodeVersion(), claimGroup.getDiagnosis20Code(), claimGroup.getDiagnosis20CodeVersion(), claimGroup.getDiagnosis21Code(), claimGroup.getDiagnosis21CodeVersion(), claimGroup.getDiagnosis22Code(), claimGroup.getDiagnosis22CodeVersion(), claimGroup.getDiagnosis23Code(), claimGroup.getDiagnosis23CodeVersion(), claimGroup.getDiagnosis24Code(), claimGroup.getDiagnosis24CodeVersion(), claimGroup.getDiagnosis25Code(), claimGroup.getDiagnosis25CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
for (Diagnosis diagnosis : TransformerUtils.extractExternalDiagnoses1Thru12(claimGroup.getDiagnosisExternalFirstCode(), claimGroup.getDiagnosisExternalFirstCodeVersion(), claimGroup.getDiagnosisExternal1Code(), claimGroup.getDiagnosisExternal1CodeVersion(), claimGroup.getDiagnosisExternal2Code(), claimGroup.getDiagnosisExternal2CodeVersion(), claimGroup.getDiagnosisExternal3Code(), claimGroup.getDiagnosisExternal3CodeVersion(), claimGroup.getDiagnosisExternal4Code(), claimGroup.getDiagnosisExternal4CodeVersion(), claimGroup.getDiagnosisExternal5Code(), claimGroup.getDiagnosisExternal5CodeVersion(), claimGroup.getDiagnosisExternal6Code(), claimGroup.getDiagnosisExternal6CodeVersion(), claimGroup.getDiagnosisExternal7Code(), claimGroup.getDiagnosisExternal7CodeVersion(), claimGroup.getDiagnosisExternal8Code(), claimGroup.getDiagnosisExternal8CodeVersion(), claimGroup.getDiagnosisExternal9Code(), claimGroup.getDiagnosisExternal9CodeVersion(), claimGroup.getDiagnosisExternal10Code(), claimGroup.getDiagnosisExternal10CodeVersion(), claimGroup.getDiagnosisExternal11Code(), claimGroup.getDiagnosisExternal11CodeVersion(), claimGroup.getDiagnosisExternal12Code(), claimGroup.getDiagnosisExternal12CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
if (claimGroup.getClaimLUPACode().isPresent()) {
TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.CLM_HHA_LUPA_IND_CD, CcwCodebookVariable.CLM_HHA_LUPA_IND_CD, claimGroup.getClaimLUPACode());
}
if (claimGroup.getClaimReferralCode().isPresent()) {
TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.CLM_HHA_RFRL_CD, CcwCodebookVariable.CLM_HHA_RFRL_CD, claimGroup.getClaimReferralCode());
}
BenefitComponent clmHhaTotVisitCntFinancial = TransformerUtils.addBenefitBalanceFinancial(eob, BenefitCategory.MEDICAL, CcwCodebookVariable.CLM_HHA_TOT_VISIT_CNT);
clmHhaTotVisitCntFinancial.setUsed(new UnsignedIntType(claimGroup.getTotalVisitCount().intValue()));
// Common group level fields between Inpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonGroupInpHHAHospiceSNF(eob, claimGroup.getCareStartDate(), Optional.empty(), Optional.empty());
for (HHAClaimLine claimLine : claimGroup.getLines()) {
ItemComponent item = eob.addItem();
item.setSequence(claimLine.getLineNumber().intValue());
item.setLocation(new Address().setState((claimGroup.getProviderStateCode())));
if (claimLine.getRevCntr1stAnsiCd().isPresent()) {
item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.REV_CNTR_1ST_ANSI_CD)).setReason(TransformerUtils.createCodeableConcept(eob, CcwCodebookVariable.REV_CNTR_1ST_ANSI_CD, claimLine.getRevCntr1stAnsiCd()));
}
TransformerUtils.mapHcpcs(eob, item, Optional.empty(), claimLine.getHcpcsCode(), Arrays.asList(claimLine.getHcpcsInitialModifierCode(), claimLine.getHcpcsSecondModifierCode()));
// Common item level fields between Inpatient, Outpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonItemRevenue(item, eob, claimLine.getRevenueCenterCode(), claimLine.getRateAmount(), claimLine.getTotalChargeAmount(), claimLine.getNonCoveredChargeAmount(), claimLine.getUnitCount(), claimLine.getNationalDrugCodeQuantity(), claimLine.getNationalDrugCodeQualifierCode(), claimLine.getRevenueCenterRenderingPhysicianNPI());
// Common item level fields between Outpatient, HHA and Hospice
TransformerUtils.mapEobCommonItemRevenueOutHHAHospice(item, claimLine.getRevenueCenterDate(), claimLine.getPaymentAmount());
// set revenue center status indicator codes for the claim
item.getRevenue().addExtension(TransformerUtils.createExtensionCoding(eob, CcwCodebookVariable.REV_CNTR_STUS_IND_CD, claimLine.getStatusCode()));
// Common group level fields between Inpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonGroupInpHHAHospiceSNFCoinsurance(eob, item, claimLine.getDeductibleCoinsuranceCd());
}
TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated());
return eob;
}
use of org.hl7.fhir.r5.model.Address in project beneficiary-fhir-data by CMSgov.
the class InpatientClaimTransformer method transformClaim.
/**
* @param claimGroup the CCW {@link InpatientClaim} to transform
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* InpatientClaim}
*/
private static ExplanationOfBenefit transformClaim(InpatientClaim claimGroup) {
ExplanationOfBenefit eob = new ExplanationOfBenefit();
// Common group level fields between all claim types
TransformerUtils.mapEobCommonClaimHeaderData(eob, claimGroup.getClaimId(), claimGroup.getBeneficiaryId(), ClaimType.INPATIENT, claimGroup.getClaimGroupId().toPlainString(), MedicareSegment.PART_A, Optional.of(claimGroup.getDateFrom()), Optional.of(claimGroup.getDateThrough()), Optional.of(claimGroup.getPaymentAmount()), claimGroup.getFinalAction());
TransformerUtils.mapEobWeeklyProcessDate(eob, claimGroup.getWeeklyProcessDate());
// map eob type codes into FHIR
TransformerUtils.mapEobType(eob, ClaimType.INPATIENT, Optional.of(claimGroup.getNearLineRecordIdCode()), Optional.of(claimGroup.getClaimTypeCode()));
// set the provider number which is common among several claim types
TransformerUtils.setProviderNumber(eob, claimGroup.getProviderNumber());
if (claimGroup.getPatientStatusCd().isPresent()) {
TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, claimGroup.getPatientStatusCd());
}
// add EOB information to fields that are common between the Inpatient and SNF claim types
TransformerUtils.addCommonEobInformationInpatientSNF(eob, claimGroup.getAdmissionTypeCd(), claimGroup.getSourceAdmissionCd(), claimGroup.getNoncoveredStayFromDate(), claimGroup.getNoncoveredStayThroughDate(), claimGroup.getCoveredCareThoughDate(), claimGroup.getMedicareBenefitsExhaustedDate(), claimGroup.getDiagnosisRelatedGroupCd());
// Claim Operational Indirect Medical Education Amount
if (claimGroup.getIndirectMedicalEducationAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.IME_OP_CLM_VAL_AMT, claimGroup.getIndirectMedicalEducationAmount());
}
// Claim Operational disproportionate Amount
if (claimGroup.getDisproportionateShareAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.DSH_OP_CLM_VAL_AMT, claimGroup.getDisproportionateShareAmount());
}
// TODO If actually nullable, should be Optional.
if (claimGroup.getPassThruPerDiemAmount() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PASS_THRU_PER_DIEM_AMT, claimGroup.getPassThruPerDiemAmount());
}
// TODO If actually nullable, should be Optional.
if (claimGroup.getProfessionalComponentCharge() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.NCH_PROFNL_CMPNT_CHRG_AMT, claimGroup.getProfessionalComponentCharge());
}
// TODO If actually nullable, should be Optional.
if (claimGroup.getClaimTotalPPSCapitalAmount() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.CLM_TOT_PPS_CPTL_AMT, claimGroup.getClaimTotalPPSCapitalAmount());
}
if (claimGroup.getIndirectMedicalEducationAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.IME_OP_CLM_VAL_AMT, claimGroup.getIndirectMedicalEducationAmount().get());
}
// Claim Uncompensated Care Payment Amount
if (claimGroup.getClaimUncompensatedCareAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.CLM_UNCOMPD_CARE_PMT_AMT, claimGroup.getClaimUncompensatedCareAmount().get());
}
/*
* add field values to the benefit balances that are common between the
* Inpatient and SNF claim types
*/
TransformerUtils.addCommonGroupInpatientSNF(eob, claimGroup.getCoinsuranceDayCount(), claimGroup.getNonUtilizationDayCount(), claimGroup.getDeductibleAmount(), claimGroup.getPartACoinsuranceLiabilityAmount(), claimGroup.getBloodPintsFurnishedQty(), claimGroup.getNoncoveredCharge(), claimGroup.getTotalDeductionAmount(), claimGroup.getClaimPPSCapitalDisproportionateShareAmt(), claimGroup.getClaimPPSCapitalExceptionAmount(), claimGroup.getClaimPPSCapitalFSPAmount(), claimGroup.getClaimPPSCapitalIMEAmount(), claimGroup.getClaimPPSCapitalOutlierAmount(), claimGroup.getClaimPPSOldCapitalHoldHarmlessAmount());
// TODO If this is actually nullable, should be Optional.
if (claimGroup.getDrgOutlierApprovedPaymentAmount() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.NCH_DRG_OUTLIER_APRVD_PMT_AMT, claimGroup.getDrgOutlierApprovedPaymentAmount());
}
// Common group level fields between Inpatient, Outpatient and SNF
TransformerUtils.mapEobCommonGroupInpOutSNF(eob, claimGroup.getBloodDeductibleLiabilityAmount(), claimGroup.getOperatingPhysicianNpi(), claimGroup.getOtherPhysicianNpi(), claimGroup.getClaimQueryCode(), claimGroup.getMcoPaidSw());
// Common group level fields between Inpatient, Outpatient Hospice, HHA and SNF
TransformerUtils.mapEobCommonGroupInpOutHHAHospiceSNF(eob, claimGroup.getOrganizationNpi(), claimGroup.getClaimFacilityTypeCode(), claimGroup.getClaimFrequencyCode(), claimGroup.getClaimNonPaymentReasonCode(), claimGroup.getPatientDischargeStatusCode(), claimGroup.getClaimServiceClassificationTypeCode(), claimGroup.getClaimPrimaryPayerCode(), claimGroup.getAttendingPhysicianNpi(), claimGroup.getTotalChargeAmount(), claimGroup.getPrimaryPayerPaidAmount(), claimGroup.getFiscalIntermediaryNumber(), claimGroup.getFiDocumentClaimControlNumber(), claimGroup.getFiOriginalClaimControlNumber());
// Common group level fields between Inpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonGroupInpHHAHospiceSNF(eob, claimGroup.getClaimAdmissionDate(), claimGroup.getBeneficiaryDischargeDate(), Optional.of(claimGroup.getUtilizationDayCount()));
for (Diagnosis diagnosis : extractDiagnoses(claimGroup)) TransformerUtils.addDiagnosisCode(eob, diagnosis);
for (CCWProcedure procedure : TransformerUtils.extractCCWProcedures(claimGroup.getProcedure1Code(), claimGroup.getProcedure1CodeVersion(), claimGroup.getProcedure1Date(), claimGroup.getProcedure2Code(), claimGroup.getProcedure2CodeVersion(), claimGroup.getProcedure2Date(), claimGroup.getProcedure3Code(), claimGroup.getProcedure3CodeVersion(), claimGroup.getProcedure3Date(), claimGroup.getProcedure4Code(), claimGroup.getProcedure4CodeVersion(), claimGroup.getProcedure4Date(), claimGroup.getProcedure5Code(), claimGroup.getProcedure5CodeVersion(), claimGroup.getProcedure5Date(), claimGroup.getProcedure6Code(), claimGroup.getProcedure6CodeVersion(), claimGroup.getProcedure6Date(), claimGroup.getProcedure7Code(), claimGroup.getProcedure7CodeVersion(), claimGroup.getProcedure7Date(), claimGroup.getProcedure8Code(), claimGroup.getProcedure8CodeVersion(), claimGroup.getProcedure8Date(), claimGroup.getProcedure9Code(), claimGroup.getProcedure9CodeVersion(), claimGroup.getProcedure9Date(), claimGroup.getProcedure10Code(), claimGroup.getProcedure10CodeVersion(), claimGroup.getProcedure10Date(), claimGroup.getProcedure11Code(), claimGroup.getProcedure11CodeVersion(), claimGroup.getProcedure11Date(), claimGroup.getProcedure12Code(), claimGroup.getProcedure12CodeVersion(), claimGroup.getProcedure12Date(), claimGroup.getProcedure13Code(), claimGroup.getProcedure13CodeVersion(), claimGroup.getProcedure13Date(), claimGroup.getProcedure14Code(), claimGroup.getProcedure14CodeVersion(), claimGroup.getProcedure14Date(), claimGroup.getProcedure15Code(), claimGroup.getProcedure15CodeVersion(), claimGroup.getProcedure15Date(), claimGroup.getProcedure16Code(), claimGroup.getProcedure16CodeVersion(), claimGroup.getProcedure16Date(), claimGroup.getProcedure17Code(), claimGroup.getProcedure17CodeVersion(), claimGroup.getProcedure17Date(), claimGroup.getProcedure18Code(), claimGroup.getProcedure18CodeVersion(), claimGroup.getProcedure18Date(), claimGroup.getProcedure19Code(), claimGroup.getProcedure19CodeVersion(), claimGroup.getProcedure19Date(), claimGroup.getProcedure20Code(), claimGroup.getProcedure20CodeVersion(), claimGroup.getProcedure20Date(), claimGroup.getProcedure21Code(), claimGroup.getProcedure21CodeVersion(), claimGroup.getProcedure21Date(), claimGroup.getProcedure22Code(), claimGroup.getProcedure22CodeVersion(), claimGroup.getProcedure22Date(), claimGroup.getProcedure23Code(), claimGroup.getProcedure23CodeVersion(), claimGroup.getProcedure23Date(), claimGroup.getProcedure24Code(), claimGroup.getProcedure24CodeVersion(), claimGroup.getProcedure24Date(), claimGroup.getProcedure25Code(), claimGroup.getProcedure25CodeVersion(), claimGroup.getProcedure25Date())) TransformerUtils.addProcedureCode(eob, procedure);
for (InpatientClaimLine claimLine : claimGroup.getLines()) {
ItemComponent item = eob.addItem();
item.setSequence(claimLine.getLineNumber().intValue());
TransformerUtils.mapHcpcs(eob, item, Optional.empty(), claimLine.getHcpcsCode(), Collections.emptyList());
item.setLocation(new Address().setState((claimGroup.getProviderStateCode())));
// Common item level fields between Inpatient, Outpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonItemRevenue(item, eob, claimLine.getRevenueCenter(), claimLine.getRateAmount(), claimLine.getTotalChargeAmount(), claimLine.getNonCoveredChargeAmount(), claimLine.getUnitCount(), claimLine.getNationalDrugCodeQuantity(), claimLine.getNationalDrugCodeQualifierCode(), claimLine.getRevenueCenterRenderingPhysicianNPI());
// Common group level field coinsurance between Inpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonGroupInpHHAHospiceSNFCoinsurance(eob, item, claimLine.getDeductibleCoinsuranceCd());
}
TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated());
return eob;
}
use of org.hl7.fhir.r5.model.Address in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveLineItemLocation.
@Test
public void shouldHaveLineItemLocation() {
Address address = eob.getItemFirstRep().getLocationAddress();
Address compare = new Address().setState("KY");
assertTrue(compare.equalsDeep(address));
}
use of org.hl7.fhir.r5.model.Address in project beneficiary-fhir-data by CMSgov.
the class InpatientClaimTransformerV2Test method shouldHaveLineItemLocation.
@Test
public void shouldHaveLineItemLocation() {
Address address = eob.getItemFirstRep().getLocationAddress();
Address compare = new Address().setState("IA");
assertTrue(compare.equalsDeep(address));
}
use of org.hl7.fhir.r5.model.Address in project beneficiary-fhir-data by CMSgov.
the class BeneficiaryTransformerV2Test method shouldMatchAddressWithAddrHeader.
/**
* Verifies that {@link gov.cms.bfd.server.war.r4.providers.BeneficiaryTransformerV2} works
* correctly when passed a {@link Beneficiary} with includeAddressFields header values.
*/
@Test
public void shouldMatchAddressWithAddrHeader() {
RequestHeaders reqHdr = getRHwithIncldAddrFldHdr("true");
createPatient(reqHdr);
assertNotNull(patient);
List<Address> addrList = patient.getAddress();
assertEquals(1, addrList.size());
assertEquals(6, addrList.get(0).getLine().size());
Address compare = new Address();
compare.setPostalCode("12345");
compare.setState("MO");
compare.setCity("PODUNK");
ArrayList<StringType> lineList = new ArrayList<>(Arrays.asList(new StringType("204 SOUTH ST"), new StringType("7560 123TH ST"), new StringType("SURREY"), new StringType("DAEJEON SI 34867"), new StringType("COLOMBIA"), new StringType("SURREY")));
compare.setLine(lineList);
assertTrue(compare.equalsDeep(addrList.get(0)));
}
Aggregations