Search in sources :

Example 96 with DateTimeType

use of org.hl7.fhir.dstu2.model.DateTimeType in project openmrs-module-fhir2 by openmrs.

the class ConditionTranslatorImpl_2_2Test method shouldTranslateFhirConditionOnsetToOpenMrsOnsetDate.

@Test
public void shouldTranslateFhirConditionOnsetToOpenMrsOnsetDate() {
    DateTimeType theDateTime = new DateTimeType();
    theDateTime.setValue(new Date());
    fhirCondition.setOnset(theDateTime);
    org.openmrs.Condition condition = conditionTranslator.toOpenmrsType(fhirCondition);
    assertThat(condition, notNullValue());
    assertThat(condition.getOnsetDate(), notNullValue());
    assertThat(condition.getOnsetDate(), DateMatchers.sameDay(new Date()));
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Date(java.util.Date) Test(org.junit.Test)

Example 97 with DateTimeType

use of org.hl7.fhir.dstu2.model.DateTimeType in project summary-care-record-api by NHSDigital.

the class DiagnosisMapper method mapInformant.

private void mapInformant(List<Resource> resources, Encounter encounter, Node informant) {
    DateTimeType time = parseDate(xmlUtils.getValueByXPath(informant, DIAGNOSIS_PARTICIPANT_TIME_XPATH), DateTimeType.class);
    participantMapper.map(informant).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole || it instanceof RelatedPerson).forEach(it -> encounter.addParticipant(new EncounterParticipantComponent().setPeriod(new Period().setStartElement(time)).addType(getParticipationType("INF", "informant")).setIndividual(new Reference(it))));
}
Also used : SneakyThrows(lombok.SneakyThrows) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) RequiredArgsConstructor(lombok.RequiredArgsConstructor) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Autowired(org.springframework.beans.factory.annotation.Autowired) Condition(org.hl7.fhir.r4.model.Condition) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) Encounter(org.hl7.fhir.r4.model.Encounter) Node(org.w3c.dom.Node) CodedEntryMapper(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntryMapper) Observation(org.hl7.fhir.r4.model.Observation) NodeList(org.w3c.dom.NodeList) Period(org.hl7.fhir.r4.model.Period) Resource(org.hl7.fhir.r4.model.Resource) FINISHED(org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) Component(org.springframework.stereotype.Component) List(java.util.List) XmlToFhirMapper.parseDate(uk.nhs.adaptors.scr.mappings.from.hl7.XmlToFhirMapper.parseDate) Coding(org.hl7.fhir.r4.model.Coding) FhirHelper.randomUUID(uk.nhs.adaptors.scr.utils.FhirHelper.randomUUID) Optional(java.util.Optional) XmlUtils(uk.nhs.adaptors.scr.utils.XmlUtils) Annotation(org.hl7.fhir.r4.model.Annotation) CodedEntry(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntry) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Reference(org.hl7.fhir.r4.model.Reference) Period(org.hl7.fhir.r4.model.Period) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson)

Example 98 with DateTimeType

use of org.hl7.fhir.dstu2.model.DateTimeType in project summary-care-record-api by NHSDigital.

the class FindingMapper method mapInformant.

private void mapInformant(List<Resource> resources, Encounter encounter, Node informant) {
    DateTimeType time = parseDate(xmlUtils.getValueByXPath(informant, FINDING_PARTICIPANT_TIME_XPATH), DateTimeType.class);
    participantMapper.map(informant).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole || it instanceof RelatedPerson).map(Reference::new).forEach(it -> encounter.addParticipant(new EncounterParticipantComponent().setPeriod(new Period().setStartElement(time)).addType(getParticipationType("INF", "informant")).setIndividual(it)));
}
Also used : SneakyThrows(lombok.SneakyThrows) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Autowired(org.springframework.beans.factory.annotation.Autowired) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) FINAL(org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL) Encounter(org.hl7.fhir.r4.model.Encounter) ENTEREDINERROR(org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR) Node(org.w3c.dom.Node) CodedEntryMapper(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntryMapper) Meta(org.hl7.fhir.r4.model.Meta) Observation(org.hl7.fhir.r4.model.Observation) NodeList(org.w3c.dom.NodeList) Period(org.hl7.fhir.r4.model.Period) Resource(org.hl7.fhir.r4.model.Resource) FINISHED(org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) Component(org.springframework.stereotype.Component) List(java.util.List) XmlToFhirMapper.parseDate(uk.nhs.adaptors.scr.mappings.from.hl7.XmlToFhirMapper.parseDate) Coding(org.hl7.fhir.r4.model.Coding) PerformerParticipationMode.getParticipationModeDisplay(uk.nhs.adaptors.scr.mappings.from.hl7.PerformerParticipationMode.getParticipationModeDisplay) FhirHelper.randomUUID(uk.nhs.adaptors.scr.utils.FhirHelper.randomUUID) Optional(java.util.Optional) XmlUtils(uk.nhs.adaptors.scr.utils.XmlUtils) CodedEntry(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntry) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Period(org.hl7.fhir.r4.model.Period) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson)

Example 99 with DateTimeType

use of org.hl7.fhir.dstu2.model.DateTimeType in project integration-adaptor-111 by nhsconnect.

the class PeriodMapper method mapPeriod.

public Period mapPeriod(IVLTS ivlts) {
    DateTimeType high = DateUtil.parse(ivlts.getHigh().getValue());
    DateTimeType low = DateUtil.parse(ivlts.getLow().getValue());
    return new Period().setStartElement(low).setEndElement(high);
}
Also used : DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Period(org.hl7.fhir.dstu3.model.Period)

Example 100 with DateTimeType

use of org.hl7.fhir.dstu2.model.DateTimeType in project odm2fhir by num-codex.

the class Apheresis method createProcedure.

private Procedure createProcedure(ItemData generalCoding, ItemData answerCoding) {
    var procedure = (Procedure) new Procedure().addIdentifier(createIdentifier(PROCEDURE, generalCoding)).setPerformed(// TODO Set actual DateTime value
    UNKNOWN_DATE_TIME).setCategory(createCodeableConcept(createCoding(SNOMED_CT, "277132007", "Therapeutic procedure (procedure)"))).setCode(createCodeableConcept(generalCoding).setText("Apheresis")).setMeta(createMeta(APHERESIS));
    createCodings(answerCoding).forEach(coding -> {
        if (ProcedureStatus.UNKNOWN.getSystem().equals(coding.getSystem())) {
            procedure.setStatus(ProcedureStatus.fromCode(coding.getCode()));
        } else {
            procedure.setPerformed((DateTimeType) new DateTimeType().addExtension(createExtension(coding)));
        }
    });
    return procedure;
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Procedure(org.hl7.fhir.r4.model.Procedure)

Aggregations

DateTimeType (org.hl7.fhir.r4.model.DateTimeType)65 Date (java.util.Date)28 Test (org.junit.Test)25 Coding (org.hl7.fhir.r4.model.Coding)23 DateTimeType (org.hl7.fhir.dstu3.model.DateTimeType)18 Period (org.hl7.fhir.r4.model.Period)18 ArrayList (java.util.ArrayList)17 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)17 Observation (org.hl7.fhir.r4.model.Observation)16 Test (org.junit.jupiter.api.Test)16 Patient (org.hl7.fhir.r4.model.Patient)14 DateTimeType (org.hl7.fhir.r4b.model.DateTimeType)14 HashMap (java.util.HashMap)13 DateTimeType (org.hl7.fhir.r5.model.DateTimeType)13 NotImplementedException (org.apache.commons.lang3.NotImplementedException)12 Reference (org.hl7.fhir.r4.model.Reference)12 List (java.util.List)11 Reference (org.hl7.fhir.dstu3.model.Reference)11 FHIRException (org.hl7.fhir.exceptions.FHIRException)11 Resource (org.hl7.fhir.r4.model.Resource)11