use of org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent in project beneficiary-fhir-data by CMSgov.
the class SNFClaimTransformerTest method assertMatches.
/**
* Verifies that the {@link ExplanationOfBenefit} "looks like" it should, if it were produced from
* the specified {@link SNFClaim}.
*
* @param claim the {@link SNFClaim} that the {@link ExplanationOfBenefit} was generated from
* @param eob the {@link ExplanationOfBenefit} that was generated from the specified {@link
* SNFClaim}
* @throws FHIRException (indicates test failure)
*/
static void assertMatches(SNFClaim claim, ExplanationOfBenefit eob) throws FHIRException {
// Test to ensure group level fields between all claim types match
TransformerTestUtils.assertEobCommonClaimHeaderData(eob, claim.getClaimId(), claim.getBeneficiaryId(), ClaimType.SNF, claim.getClaimGroupId().toPlainString(), MedicareSegment.PART_A, Optional.of(claim.getDateFrom()), Optional.of(claim.getDateThrough()), Optional.of(claim.getPaymentAmount()), claim.getFinalAction());
// test the common field provider number is set as expected in the EOB
TransformerTestUtils.assertProviderNumber(eob, claim.getProviderNumber());
// test common benefit components between SNF and Inpatient claims are set as expected
TransformerTestUtils.assertCommonGroupInpatientSNF(eob, claim.getCoinsuranceDayCount(), claim.getNonUtilizationDayCount(), claim.getDeductibleAmount(), claim.getPartACoinsuranceLiabilityAmount(), claim.getBloodPintsFurnishedQty(), claim.getNoncoveredCharge(), claim.getTotalDeductionAmount(), claim.getClaimPPSCapitalDisproportionateShareAmt(), claim.getClaimPPSCapitalExceptionAmount(), claim.getClaimPPSCapitalFSPAmount(), claim.getClaimPPSCapitalIMEAmount(), claim.getClaimPPSCapitalOutlierAmount(), claim.getClaimPPSOldCapitalHoldHarmlessAmount());
if (claim.getQualifiedStayFromDate().isPresent() || claim.getQualifiedStayThroughDate().isPresent()) {
SupportingInformationComponent nchQlyfdStayInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_QLFYD_STAY_FROM_DT, eob);
TransformerTestUtils.assertPeriodEquals(claim.getQualifiedStayFromDate(), claim.getQualifiedStayThroughDate(), (Period) nchQlyfdStayInfo.getTiming());
}
// test common eob information between SNF and Inpatient claims are set as expected
TransformerTestUtils.assertCommonEobInformationInpatientSNF(eob, claim.getNoncoveredStayFromDate(), claim.getNoncoveredStayThroughDate(), claim.getCoveredCareThroughDate(), claim.getMedicareBenefitsExhaustedDate(), claim.getDiagnosisRelatedGroupCd());
TransformerTestUtils.assertDateEquals(claim.getClaimAdmissionDate().get(), eob.getHospitalization().getStartElement());
TransformerTestUtils.assertDateEquals(claim.getBeneficiaryDischargeDate().get(), eob.getHospitalization().getEndElement());
// test common eob information between Inpatient, HHA, Hospice and SNF claims are set as
// expected
TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFEquals(eob, claim.getClaimAdmissionDate(), claim.getBeneficiaryDischargeDate(), Optional.of(claim.getUtilizationDayCount()));
// Test to ensure common group fields between Inpatient, Outpatient and SNF
TransformerTestUtils.assertEobCommonGroupInpOutSNFEquals(eob, claim.getBloodDeductibleLiabilityAmount(), claim.getOperatingPhysicianNpi(), claim.getOtherPhysicianNpi(), claim.getClaimQueryCode(), claim.getMcoPaidSw());
// Test to ensure common group fields between Inpatient, Outpatient HHA, Hospice
// and SNF match
TransformerTestUtils.assertEobCommonGroupInpOutHHAHospiceSNFEquals(eob, claim.getOrganizationNpi(), claim.getClaimFacilityTypeCode(), claim.getClaimFrequencyCode(), claim.getClaimNonPaymentReasonCode(), claim.getPatientDischargeStatusCode(), claim.getClaimServiceClassificationTypeCode(), claim.getClaimPrimaryPayerCode(), claim.getAttendingPhysicianNpi(), claim.getTotalChargeAmount(), claim.getPrimaryPayerPaidAmount(), claim.getFiscalIntermediaryNumber(), claim.getFiDocumentClaimControlNumber(), claim.getFiOriginalClaimControlNumber());
assertEquals(6, eob.getDiagnosis().size());
CCWProcedure ccwProcedure = new CCWProcedure(claim.getProcedure1Code(), claim.getProcedure1CodeVersion(), claim.getProcedure1Date());
TransformerTestUtils.assertHasCoding(ccwProcedure.getFhirSystem().toString(), claim.getProcedure1Code().get(), eob.getProcedure().get(0).getProcedureCodeableConcept().getCoding());
assertEquals(TransformerUtils.convertToDate(claim.getProcedure1Date().get()), eob.getProcedure().get(0).getDate());
assertEquals(1, eob.getItem().size());
SNFClaimLine claimLine1 = claim.getLines().get(0);
ItemComponent eobItem0 = eob.getItem().get(0);
assertEquals(claimLine1.getLineNumber(), new BigDecimal(eobItem0.getSequence()));
assertEquals(claim.getProviderStateCode(), eobItem0.getLocationAddress().getState());
TransformerTestUtils.assertHasCoding(CcwCodebookVariable.REV_CNTR, claimLine1.getRevenueCenter(), eobItem0.getRevenue());
TransformerTestUtils.assertHcpcsCodes(eobItem0, claimLine1.getHcpcsCode(), Optional.empty(), Optional.empty(), Optional.empty(), 0);
// Test to ensure common group field coinsurance between Inpatient, HHA, Hospice and SNF match
TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFCoinsuranceEquals(eobItem0, claimLine1.getDeductibleCoinsuranceCd());
String claimControlNumber = "0000000000";
// Test to ensure item level fields between Inpatient, Outpatient, HHA, Hopsice
// and SNF match
TransformerTestUtils.assertEobCommonItemRevenueEquals(eobItem0, eob, claimLine1.getRevenueCenter(), claimLine1.getRateAmount(), claimLine1.getTotalChargeAmount(), claimLine1.getNonCoveredChargeAmount(), BigDecimal.valueOf(claimLine1.getUnitCount()), claimControlNumber, claimLine1.getNationalDrugCodeQuantity(), claimLine1.getNationalDrugCodeQualifierCode(), claimLine1.getRevenueCenterRenderingPhysicianNPI(), 1);
// verify {@link
// TransformerUtils#mapEobType(CodeableConcept,ClaimType,Optional,Optional)}
// method worked as expected for this claim type
TransformerTestUtils.assertMapEobType(eob.getType(), ClaimType.SNF, Optional.of(org.hl7.fhir.dstu3.model.codesystems.ClaimType.INSTITUTIONAL), Optional.of(claim.getNearLineRecordIdCode()), Optional.of(claim.getClaimTypeCode()));
// Test lastUpdated
TransformerTestUtils.assertLastUpdatedEquals(claim.getLastUpdated(), eob);
}
use of org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent in project elexis-server by elexis.
the class ClaimTest method createClaim.
@Test
public void createClaim() {
// claim needs a coverage, a diagnose, a practitioner, an encounter and
// items
Coverage coverage = new Coverage();
// minimal coverage information
coverage.setBeneficiary(new Reference(new IdDt("Patient", AllTests.getTestDatabaseInitializer().getPatient().getId())));
coverage.setType(new CodeableConcept().addCoding(new Coding(CodingSystem.ELEXIS_COVERAGE_TYPE.getSystem(), "KVG", "Test")));
MethodOutcome coverageOutcome = client.create().resource(coverage).execute();
assertTrue(coverageOutcome.getCreated());
Bundle results = client.search().forResource(Encounter.class).where(Encounter.IDENTIFIER.exactly().systemAndIdentifier("www.elexis.info/consultationid", TestDatabaseInitializer.getBehandlung().getId())).returnBundle(Bundle.class).execute();
List<BundleEntryComponent> entries = results.getEntry();
assertFalse(entries.isEmpty());
Encounter encounter = (Encounter) entries.get(0).getResource();
Claim claim = new Claim();
claim.addInsurance().setCoverage(new Reference("Coverage/" + coverageOutcome.getId()));
claim.setProvider(new Reference("Practitioner/" + TestDatabaseInitializer.getMandant().getId()));
claim.addDiagnosis().setDiagnosis(new CodeableConcept().addCoding(new Coding(CodingSystem.ELEXIS_DIAGNOSE_TESSINERCODE.getSystem(), "A1", "")));
claim.addSupportingInfo().setValue(new StringType("Encounter/" + encounter.getId()));
ItemComponent item = claim.addItem();
item.setQuantity(new SimpleQuantity().setValue(1));
item.setProductOrService(new CodeableConcept().addCoding(new Coding("www.elexis.info/billing/tarmed", "00.0010", "")));
List<IBilled> before = AllTests.getModelService().getQuery(IBilled.class).execute();
MethodOutcome outcome = client.create().resource(claim).execute();
assertNotNull(outcome);
assertTrue(outcome.getCreated());
List<IBilled> after = AllTests.getModelService().getQuery(IBilled.class).execute();
assertTrue(after.size() - before.size() == 1);
// "00.0010" can only be billed once ...
boolean failed = false;
try {
outcome = client.create().resource(claim).execute();
} catch (InternalErrorException e) {
failed = true;
}
assertTrue(failed);
}
Aggregations