use of org.hl7.fhir.r4b.model.Period in project ab2d by CMSgov.
the class PatientClaimsCollectorTest method whenEarlyAttestation_allowEarlyEobs.
@DisplayName("Early attestation still allows valid billable periods")
@Test
void whenEarlyAttestation_allowEarlyEobs() {
try {
CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
// Valid billable period and old attestation date
ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
eob.getBillablePeriod().setStart(SDF.parse("01/02/2020"));
eob.getBillablePeriod().setEnd(SDF.parse("01/03/2020"));
IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now().minusYears(100), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
collector.filterAndAddEntries(oldBundle, coverageSummary);
assertEquals(1, collector.getEobs().size());
} catch (ParseException pe) {
fail("could not build dates", pe);
}
}
use of org.hl7.fhir.r4b.model.Period in project ab2d by CMSgov.
the class PatientClaimsCollectorTest method whenAttestationToday_blockEobs.
@DisplayName("Attestation today valid billable periods should be blocked")
@Test
void whenAttestationToday_blockEobs() {
try {
CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
// Valid billable period and attestation day of today
ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
eob.getBillablePeriod().setStart(SDF.parse("01/02/2020"));
eob.getBillablePeriod().setEnd(SDF.parse("01/03/2020"));
IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now(), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
collector.filterAndAddEntries(oldBundle, coverageSummary);
assertTrue(collector.getEobs().isEmpty());
} catch (ParseException pe) {
fail("could not build dates", pe);
}
}
use of org.hl7.fhir.r4b.model.Period in project ab2d by CMSgov.
the class PatientClaimsCollectorTest method oldSinceOldAttestation_thenFilterOut.
@DisplayName("Old since and attestation doesn't work if before ab2d epoch")
@Test
void oldSinceOldAttestation_thenFilterOut() {
try {
CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
// Old billable period date and older attestation date should return nothing
ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
eob.getBillablePeriod().setStart(SDF.parse("10/13/1970"));
eob.getBillablePeriod().setEnd(SDF.parse("10/13/1970"));
IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now().minusYears(100), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
collector.filterAndAddEntries(oldBundle, coverageSummary);
assertTrue(collector.getEobs().isEmpty());
} catch (ParseException pe) {
fail("could not build dates", pe);
}
}
use of org.hl7.fhir.r4b.model.Period in project integration-adaptor-111 by nhsconnect.
the class ParticipantMapperTest method shouldMapParticipant.
@Test
public void shouldMapParticipant() {
POCDMT000002UK01Participant1 encounterParticipant = mock(POCDMT000002UK01Participant1.class);
POCDMT000002UK01AssociatedEntity associatedEntity = mock(POCDMT000002UK01AssociatedEntity.class);
IVLTS time = mock(IVLTS.class);
when(encounterParticipant.getTypeCode()).thenReturn("CON");
when(encounterParticipant.getAssociatedEntity()).thenReturn(associatedEntity);
when(encounterParticipant.isSetTime()).thenReturn(true);
when(encounterParticipant.getTime()).thenReturn(time);
when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
when(practitionerMapper.mapPractitioner(ArgumentMatchers.isA(POCDMT000002UK01AssociatedEntity.class))).thenReturn(practitioner);
when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterParticipant(encounterParticipant);
assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
assertThat(participantComponent.getPeriod()).isEqualTo(period);
assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
use of org.hl7.fhir.r4b.model.Period in project integration-adaptor-111 by nhsconnect.
the class ParticipantMapperTest method shouldMapEncounterRelatedPerson.
@Test
public void shouldMapEncounterRelatedPerson() {
IVLTS time = IVLTS.Factory.newInstance();
POCDMT000002UK01RelatedEntity relatedEntity = POCDMT000002UK01RelatedEntity.Factory.newInstance();
relatedEntity.setEffectiveTime(time);
POCDMT000002UK01Informant12 informant = POCDMT000002UK01Informant12.Factory.newInstance();
informant.setTypeCode("INF");
informant.setRelatedEntity(relatedEntity);
Encounter encounter = new Encounter();
RelatedPerson relatedPerson = new RelatedPerson();
relatedPerson.setId(RELATED_PERSON_ID);
when(relatedPersonMapper.mapRelatedPerson(informant, encounter)).thenReturn(relatedPerson);
when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
when(resourceUtil.createReference(relatedPerson)).thenReturn(new Reference(relatedPerson));
Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterRelatedPerson(informant, encounter);
assertThat(participantComponent.getType().get(0).getText()).isEqualTo("Informant");
assertThat(participantComponent.getIndividualTarget().getId()).isEqualTo(RELATED_PERSON_ID);
assertThat(participantComponent.getPeriod()).isEqualTo(period);
}
Aggregations