use of org.hl7.fhir.r4.model.Period in project openmrs-module-fhir2 by openmrs.
the class VisitTranslatorImplTest method toOpenmrsType_shouldConvertPeriodWithNullValues.
@Test
public void toOpenmrsType_shouldConvertPeriodWithNullValues() {
Encounter encounter = new Encounter();
Period period = new Period();
encounter.setPeriod(period);
when(visitPeriodTranslator.toOpenmrsType(any(), any())).thenCallRealMethod();
Visit result = visitTranslator.toOpenmrsType(new Visit(), encounter);
assertThat(result, notNullValue());
assertThat(result.getStartDatetime(), nullValue());
assertThat(result.getStopDatetime(), nullValue());
}
use of org.hl7.fhir.r4.model.Period in project openmrs-module-fhir2 by openmrs.
the class EncounterPeriodTranslatorImpl method toFhirResource.
@Override
public Period toFhirResource(@Nonnull Encounter encounter) {
Period result = new Period();
result.setStart(encounter.getEncounterDatetime());
return result;
}
use of org.hl7.fhir.r4.model.Period in project Gravity-SDOH-Exchange-RI by FHIR.
the class PatientTaskBundleFactory method createTask.
protected Task createTask() {
Task task = new Task();
task.getMeta().addProfile(SDOHProfiles.PATIENT_TASK);
task.setStatus(Task.TaskStatus.READY);
task.setIntent(Task.TaskIntent.ORDER);
task.setPriority(priority.getTaskPriority());
task.setAuthoredOnElement(DateTimeType.now());
task.setLastModifiedElement(DateTimeType.now());
task.setDescription(name);
task.setFor(getPatientReference());
task.setOwner(getPatientReference());
if (occurrence.isPeriod()) {
task.setExecutionPeriod(new Period().setStartElement(occurrence.getStart()).setEndElement(occurrence.getEnd()));
} else {
task.setExecutionPeriod(new Period().setEndElement(occurrence.getEnd()));
}
task.setRequester(requester);
if (!Strings.isNullOrEmpty(comment)) {
task.addNote().setText(comment).setTimeElement(DateTimeType.now()).setAuthor(new Reference(new IdType(user.getUserType(), user.getId())).setDisplay(user.getName()));
}
return task;
}
use of org.hl7.fhir.r4.model.Period in project ab2d by CMSgov.
the class CoverageMappingCallableTest method testNullMbi.
@Test
void testNullMbi() {
ContractDTO contract = new ContractDTO("TESTING", "TESTING", null, null);
CoveragePeriod period = new CoveragePeriod();
period.setContractNumber(contract.getContractNumber());
period.setYear(2020);
period.setMonth(1);
CoverageSearchEvent cse = new CoverageSearchEvent();
cse.setCoveragePeriod(period);
CoverageSearch search = new CoverageSearch();
search.setPeriod(period);
CoverageMapping mapping = new CoverageMapping(cse, search);
CoverageMappingCallable callable = new CoverageMappingCallable(STU3, mapping, bfdClient, mapping.getPeriod().getYear());
Patient patient = new Patient();
Identifiers ids = callable.extractPatientId(patient);
assertNull(ids);
Identifier beneId = new Identifier();
beneId.setSystem(BENEFICIARY_ID);
beneId.setValue("1");
patient.getIdentifier().add(beneId);
ids = callable.extractPatientId(patient);
assertEquals(1L, ids.getBeneficiaryId());
assertNull(ids.getCurrentMbi());
assertEquals(0, ids.getHistoricMbis().size());
Identifier mbiHist = new Identifier();
mbiHist.setSystem(MBI_ID);
mbiHist.setValue("HIST_MBI");
Extension extension = new Extension();
extension.setUrl(CURRENCY_IDENTIFIER);
Coding code1 = new Coding();
code1.setCode("historic");
extension.setValue(code1);
mbiHist.getExtension().add(extension);
patient.getIdentifier().add(mbiHist);
ids = callable.extractPatientId(patient);
assertEquals(1L, ids.getBeneficiaryId());
assertNull(ids.getCurrentMbi());
assertEquals(1, ids.getHistoricMbis().size());
assertEquals("HIST_MBI", ids.getHistoricMbis().stream().findAny().get());
Identifier mbiCurrent = new Identifier();
mbiCurrent.setSystem(MBI_ID);
mbiCurrent.setValue("CURR_MBI");
Extension extension2 = new Extension();
extension2.setUrl(CURRENCY_IDENTIFIER);
Coding code2 = new Coding();
code2.setCode("current");
extension2.setValue(code2);
mbiCurrent.getExtension().add(extension2);
patient.getIdentifier().add(mbiCurrent);
ids = callable.extractPatientId(patient);
assertEquals(1L, ids.getBeneficiaryId());
assertEquals(1, ids.getHistoricMbis().size());
assertEquals("CURR_MBI", ids.getCurrentMbi());
assertEquals(1, ids.getHistoricMbis().size());
assertEquals("HIST_MBI", ids.getHistoricMbis().stream().findAny().get());
}
use of org.hl7.fhir.r4.model.Period in project ab2d by CMSgov.
the class PatientClaimsCollectorTest method whenEarlyAttestation_blockEarlyEobs.
@DisplayName("Early attestation still blocks old billable periods")
@Test
void whenEarlyAttestation_blockEarlyEobs() {
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("12/29/2019"));
eob.getBillablePeriod().setEnd(SDF.parse("12/30/2019"));
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);
}
}
Aggregations