Search in sources :

Example 56 with DateTimeType

use of org.hl7.fhir.r5.model.DateTimeType in project fhir-bridge by ehrbase.

the class ProblemDiagnoseEvaluationConverter method convertInternal.

@Override
protected ProblemDiagnoseEvaluation convertInternal(Condition resource) {
    ProblemDiagnoseEvaluation evaluation = new ProblemDiagnoseEvaluation();
    evaluation.setLetztesDokumentationsdatumValue(OffsetDateTime.now());
    if (resource.hasSeverity() && resource.getSeverity().hasCoding()) {
        evaluation.setSchweregrad(getSchweregrad(resource.getSeverity().getCoding().get(0)));
    }
    if (resource.hasCode() && resource.getCode().hasCoding()) {
        evaluation.setNameDesProblemsDerDiagnoseDefiningCode(getNameDesProblemsDerDiagnose(resource.getCode().getCoding().get(0)));
    }
    if (resource.hasOnset()) {
        DateTimeType fhirOnsetDateTime = resource.getOnsetDateTimeType();
        evaluation.setDatumDesAuftretensDerErstdiagnoseValue(fhirOnsetDateTime.getValueAsCalendar().toZonedDateTime());
    }
    if (resource.getBodySite().size() == 1) {
        String bodySiteName = resource.getBodySite().get(0).getCoding().get(0).getDisplay();
        evaluation.setLokalisationValue("body site");
        AnatomischeLokalisationCluster anatomischeLokalisationCluster = new AnatomischeLokalisationCluster();
        anatomischeLokalisationCluster.setNameDerKoerperstelleValue(bodySiteName);
        evaluation.setAnatomischeLokalisation(List.of(anatomischeLokalisationCluster));
    }
    return evaluation;
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) ProblemDiagnoseEvaluation(org.ehrbase.fhirbridge.ehr.opt.diagnosecomposition.definition.ProblemDiagnoseEvaluation) AnatomischeLokalisationCluster(org.ehrbase.fhirbridge.ehr.opt.diagnosecomposition.definition.AnatomischeLokalisationCluster)

Example 57 with DateTimeType

use of org.hl7.fhir.r5.model.DateTimeType in project fhir-bridge by ehrbase.

the class TimeConverter method convertAgeExtensionTime.

public static TemporalAccessor convertAgeExtensionTime(Extension extension) {
    if (extension == null) {
        return OffsetDateTime.now();
    }
    Extension dataTimeOfDocumentationExtension = extension.getExtensionByUrl("dateTimeOfDocumentation");
    if (dataTimeOfDocumentationExtension == null) {
        return OffsetDateTime.now();
    }
    DateTimeType dateTimeOfDocumentationDt = (DateTimeType) dataTimeOfDocumentationExtension.getValue();
    return dateTimeOfDocumentationDt.getValueAsCalendar().toZonedDateTime();
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) DateTimeType(org.hl7.fhir.r4.model.DateTimeType)

Example 58 with DateTimeType

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

the class ECMO 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("ECMO")).setMeta(createMeta(EXTRACORPOREAL_MEMBRANE_OXYGENATION));
    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)

Example 59 with DateTimeType

use of org.hl7.fhir.r5.model.DateTimeType in project pathling by aehrc.

the class DateTimeLiteralPath method fromString.

/**
 * Returns a new instance, parsed from a FHIRPath literal.
 *
 * @param fhirPath The FHIRPath representation of the literal
 * @param context An input context that can be used to build a {@link Dataset} to represent the
 * literal
 * @return A new instance of {@link LiteralPath}
 * @throws ParseException if the literal is malformed
 */
public static DateTimeLiteralPath fromString(@Nonnull final String fhirPath, @Nonnull final FhirPath context) throws ParseException {
    final String dateTimeString = fhirPath.replaceFirst("^@", "");
    final java.util.Date date = DateTimePath.getDateFormat().parse(dateTimeString);
    final DateTimeType literalValue = new DateTimeType(date);
    literalValue.setTimeZone(DateTimePath.getTimeZone());
    return new DateTimeLiteralPath(context.getDataset(), context.getIdColumn(), literalValue);
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) BaseDateTimeType(org.hl7.fhir.r4.model.BaseDateTimeType) Date(java.util.Date)

Example 60 with DateTimeType

use of org.hl7.fhir.r5.model.DateTimeType in project pathling by aehrc.

the class TestData method newCondition.

/**
 * Returns a FHIR Condition for testing purposes.
 */
public static Condition newCondition() {
    final Condition condition = new Condition();
    // Condition based on example from FHIR:
    // https://www.hl7.org/fhir/condition-example.json.html
    condition.setId("example");
    condition.setLanguage("en_US");
    // Narrative text
    final Narrative narrative = new Narrative();
    narrative.setStatusAsString("generated");
    narrative.setDivAsString("This data was generated for test purposes.");
    final XhtmlNode node = new XhtmlNode();
    node.setNodeType(NodeType.Text);
    node.setValue("Severe burn of left ear (Date: 24-May 2012)");
    condition.setText(narrative);
    condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
    final CodeableConcept verificationStatus = new CodeableConcept();
    verificationStatus.addCoding(new Coding(ConditionVerStatus.CONFIRMED.getSystem(), ConditionVerStatus.CONFIRMED.toCode(), ConditionVerStatus.CONFIRMED.getDisplay()));
    condition.setVerificationStatus(verificationStatus);
    // Condition code
    final CodeableConcept code = new CodeableConcept();
    code.addCoding().setSystem("http://snomed.info/sct").setCode("39065001").setDisplay("Severe");
    condition.setSeverity(code);
    // Severity code
    final CodeableConcept severity = new CodeableConcept();
    severity.addCoding().setSystem("http://snomed.info/sct").setCode("24484000").setDisplay("Burn of ear").setUserSelected(true);
    condition.setSeverity(severity);
    // Onset date time
    final DateTimeType onset = new DateTimeType();
    onset.setValueAsString("2012-05-24");
    condition.setOnset(onset);
    return condition;
}
Also used : XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

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