Search in sources :

Example 46 with Period

use of org.hl7.fhir.dstu2.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());
}
Also used : Visit(org.openmrs.Visit) Encounter(org.hl7.fhir.r4.model.Encounter) Period(org.hl7.fhir.r4.model.Period) Test(org.junit.Test)

Example 47 with Period

use of org.hl7.fhir.dstu2.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;
}
Also used : Period(org.hl7.fhir.r4.model.Period)

Example 48 with Period

use of org.hl7.fhir.dstu2.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;
}
Also used : Task(org.hl7.fhir.r4.model.Task) Reference(org.hl7.fhir.r4.model.Reference) Period(org.hl7.fhir.r4.model.Period) IdType(org.hl7.fhir.r4.model.IdType)

Example 49 with Period

use of org.hl7.fhir.dstu2.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());
}
Also used : Extension(org.hl7.fhir.dstu3.model.Extension) Identifier(org.hl7.fhir.dstu3.model.Identifier) ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) Coding(org.hl7.fhir.dstu3.model.Coding) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) CoverageMapping(gov.cms.ab2d.coverage.model.CoverageMapping) CoveragePeriod(gov.cms.ab2d.coverage.model.CoveragePeriod) CoverageSearch(gov.cms.ab2d.coverage.model.CoverageSearch) Patient(org.hl7.fhir.dstu3.model.Patient) BundleUtils.createPatient(gov.cms.ab2d.worker.processor.BundleUtils.createPatient) CoverageSearchEvent(gov.cms.ab2d.coverage.model.CoverageSearchEvent) Identifiers(gov.cms.ab2d.coverage.model.Identifiers) Test(org.junit.jupiter.api.Test)

Example 50 with Period

use of org.hl7.fhir.dstu2.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);
    }
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ParseException(java.text.ParseException) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

Period (org.hl7.fhir.r4.model.Period)87 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)44 Date (java.util.Date)42 Test (org.junit.Test)42 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)40 Coding (org.hl7.fhir.r4.model.Coding)34 Test (org.junit.jupiter.api.Test)34 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)32 Period (org.hl7.fhir.dstu3.model.Period)30 ArrayList (java.util.ArrayList)29 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)27 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)20 Encounter (org.hl7.fhir.r4.model.Encounter)20 Reference (org.hl7.fhir.r4.model.Reference)20 Patient (org.hl7.fhir.r4.model.Patient)19 Reference (org.hl7.fhir.dstu3.model.Reference)18 HashMap (java.util.HashMap)17 Identifier (org.hl7.fhir.r4.model.Identifier)17 NotImplementedException (org.apache.commons.lang3.NotImplementedException)15 List (java.util.List)14