use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method eobReadDme.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* DME claims
*/
public static String eobReadDme() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
DMEClaim dmeClaim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.DME, dmeClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method adjustDmeRecordForSamhsaDiagnosis.
/**
* Adjusts the first DME record to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustDmeRecordForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
DMEClaim dmeRifRecord = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
entityManager.getTransaction().begin();
dmeRifRecord = entityManager.find(DMEClaim.class, dmeRifRecord.getClaimId());
dmeRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
dmeRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(dmeRifRecord);
entityManager.getTransaction().commit();
}
use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method readEobForExistingDMEClaim.
/**
* Verifies that {@link ExplanationOfBenefitResourceProvider#read(IdType, RequestDetails)} works
* as expected for a {@link DMEClaim}-derived {@link ExplanationOfBenefit} that does exist in the
* DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingDMEClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
DMEClaim claim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.DME, claim.getClaimId())).execute();
assertNotNull(eob);
DMEClaimTransformerTest.assertMatches(claim, eob, Optional.empty());
}
use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class RifFilesProcessorTest method process1DMEClaimRecord.
/**
* Ensures that {@link RifFilesProcessor} can correctly handle {@link
* StaticRifResource#SAMPLE_A_DME}.
*/
@Test
public void process1DMEClaimRecord() {
RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_DME.toRifFile());
RifFilesProcessor processor = new RifFilesProcessor();
RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
assertEquals(StaticRifResource.SAMPLE_A_DME.getRecordCount(), rifEventsList.size());
RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
assertEquals(StaticRifResource.SAMPLE_A_DME.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
assertNotNull(rifRecordEvent.getRecord());
assertTrue(rifRecordEvent.getRecord() instanceof DMEClaim);
// Verify the claim header.
DMEClaim claimGroup = (DMEClaim) rifRecordEvent.getRecord();
assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
assertEquals(claimGroup.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
assertEquals("567834", claimGroup.getBeneficiaryId());
assertEquals("2188888888", claimGroup.getClaimId());
assertEquals(new BigDecimal(900), claimGroup.getClaimGroupId());
assertEquals('M', claimGroup.getNearLineRecordIdCode());
assertEquals("82", claimGroup.getClaimTypeCode());
assertEquals(LocalDate.of(2014, 02, 03), claimGroup.getDateFrom());
assertEquals(LocalDate.of(2014, 02, 03), claimGroup.getDateThrough());
assertEquals(LocalDate.of(2014, 02, 14), claimGroup.getWeeklyProcessDate());
assertEquals('1', claimGroup.getClaimEntryCode());
assertEquals("01", claimGroup.getClaimDispositionCode());
assertEquals("99999", claimGroup.getCarrierNumber());
assertEquals("1", claimGroup.getPaymentDenialCode());
assertEquals(new BigDecimal("777.75"), claimGroup.getPaymentAmount());
assertEquals(new BigDecimal("0"), claimGroup.getPrimaryPayerPaidAmount());
assertEquals('A', claimGroup.getProviderAssignmentIndicator());
assertEquals(new BigDecimal("666.75"), claimGroup.getProviderPaymentAmount());
assertEquals(new BigDecimal("666.66"), claimGroup.getBeneficiaryPaymentAmount());
assertEquals(new BigDecimal("1752.75"), claimGroup.getSubmittedChargeAmount());
assertEquals(new BigDecimal("754.79"), claimGroup.getAllowedChargeAmount());
assertEquals(new BigDecimal("777.00"), claimGroup.getBeneficiaryPartBDeductAmount());
assertEquals('3', claimGroup.getHcpcsYearCode().get().charValue());
assertEquals("R5555", claimGroup.getDiagnosis1Code().get());
assertEquals('0', claimGroup.getDiagnosis1CodeVersion().get().charValue());
assertEquals("1306849450", claimGroup.getReferringPhysicianNpi().get());
assertEquals("0", claimGroup.getClinicalTrialNumber().get());
assertEquals(1, claimGroup.getLines().size());
assertEquals("74655592568216", claimGroup.getClaimCarrierControlNumber().get());
// Verify one of the claim lines.
DMEClaimLine claimLine = claimGroup.getLines().get(0);
assertEquals(new BigDecimal(1), claimLine.getLineNumber());
assertEquals("9994931888", claimLine.getProviderTaxNumber());
assertEquals("A5", claimLine.getProviderSpecialityCode().get());
assertEquals('1', claimLine.getProviderParticipatingIndCode().get().charValue());
assertEquals(new BigDecimal("60"), claimLine.getServiceCount());
assertEquals('P', claimLine.getCmsServiceTypeCode());
assertEquals("12", claimLine.getPlaceOfServiceCode());
assertEquals(LocalDate.of(2014, 02, 03), claimLine.getFirstExpenseDate().get());
assertEquals(LocalDate.of(2014, 02, 03), claimLine.getLastExpenseDate().get());
assertEquals("345", claimLine.getHcpcsCode().get());
assertFalse(claimLine.getHcpcsSecondModifierCode().isPresent());
assertFalse(claimLine.getHcpcsThirdModifierCode().isPresent());
assertFalse(claimLine.getHcpcsFourthModifierCode().isPresent());
assertEquals("D9Z", claimLine.getBetosCode().get());
assertEquals(new BigDecimal("123.45"), claimLine.getPaymentAmount());
assertEquals(new BigDecimal("11.00"), claimLine.getBeneficiaryPaymentAmount());
assertEquals(new BigDecimal("120.00"), claimLine.getProviderPaymentAmount());
assertEquals(new BigDecimal("18.00"), claimLine.getBeneficiaryPartBDeductAmount());
assertTrue(claimLine.getPrimaryPayerCode().isPresent());
assertEquals(new BigDecimal("11.00"), claimLine.getPrimaryPayerPaidAmount());
assertEquals(new BigDecimal("20.20"), claimLine.getCoinsuranceAmount());
assertEquals(new BigDecimal("20.29"), claimLine.getPrimaryPayerAllowedChargeAmount());
assertEquals(new BigDecimal("130.45"), claimLine.getSubmittedChargeAmount());
assertEquals(new BigDecimal("129.45"), claimLine.getAllowedChargeAmount());
assertEquals("A", claimLine.getProcessingIndicatorCode().get());
assertEquals('0', claimLine.getPaymentCode().get().charValue());
assertEquals('0', claimLine.getServiceDeductibleCode().get().charValue());
assertEquals(new BigDecimal("82.29"), claimLine.getPurchasePriceAmount());
assertEquals("1244444444", claimLine.getProviderNPI().get());
assertEquals("AL", claimLine.getPricingStateCode().get());
assertEquals("MO", claimLine.getProviderStateCode());
assertEquals(new Character('3'), claimLine.getSupplierTypeCode().get());
assertEquals(new BigDecimal("0.00"), claimLine.getScreenSavingsAmount().get());
assertEquals(new BigDecimal("60"), claimLine.getMtusCount());
assertEquals('3', claimLine.getMtusCode().get().charValue());
assertEquals(new BigDecimal("44.4"), claimLine.getHctHgbTestResult());
assertEquals("R2", claimLine.getHctHgbTestTypeCode().get());
assertEquals("500904610", claimLine.getNationalDrugCode().get());
}
use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class RifFilesProcessor method buildDMEClaimEvent.
/**
* @param fileEvent the {@link RifFileEvent} being processed
* @param csvRecords the {@link CSVRecord}s to be mapped, which must be from a {@link
* RifFileType#DME} {@link RifFile}
* @return a {@link RifRecordEvent} built from the specified {@link CSVRecord}s
*/
private static RifRecordEvent<DMEClaim> buildDMEClaimEvent(RifFileEvent fileEvent, List<CSVRecord> csvRecords) {
if (LOGGER.isTraceEnabled())
LOGGER.trace(csvRecords.toString());
CSVRecord firstCsvRecord = csvRecords.get(0);
RecordAction recordAction = RecordAction.match(firstCsvRecord.get("DML_IND"));
DMEClaim claim = DMEClaimParser.parseRif(csvRecords);
return new RifRecordEvent<DMEClaim>(fileEvent, csvRecords, recordAction, claim.getBeneficiaryId(), claim);
}
Aggregations