Search in sources :

Example 21 with MEDICATIONSTATEMENT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.MEDICATIONSTATEMENT in project fhir-bridge by ehrbase.

the class AceHemmerBeliebigesEreignisPointEventConverter method convertInternal.

@Override
protected AceHemmerBeliebigesEreignisPointEvent convertInternal(MedicationStatement medicationStatement) {
    AceHemmerBeliebigesEreignisPointEvent aceHemmerBeliebigesEreignisPointEvent = new AceHemmerBeliebigesEreignisPointEvent();
    for (Coding coding : medicationStatement.getMedicationCodeableConcept().getCoding()) {
        if (coding.getSystem().equals("http://fhir.de/CodeSystem/bfarm/atc")) {
            DvCodedTextParser.getInstance().parseFHIRCoding(coding).ifPresent(aceHemmerBeliebigesEreignisPointEvent::setArzneimittelName);
        }
    }
    getGrundDefiningCode(medicationStatement).ifPresent(aceHemmerBeliebigesEreignisPointEvent::setGrund);
    return aceHemmerBeliebigesEreignisPointEvent;
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) AceHemmerBeliebigesEreignisPointEvent(org.ehrbase.fhirbridge.ehr.opt.geccomedikationcomposition.definition.AceHemmerBeliebigesEreignisPointEvent)

Example 22 with MEDICATIONSTATEMENT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.MEDICATIONSTATEMENT in project fhir-bridge by ehrbase.

the class AceHemmerObservationConverter method convertInternal.

@Override
protected AceHemmerObservation convertInternal(MedicationStatement resource) {
    AceHemmerObservation aceHemmerObservation = new AceHemmerObservation();
    List<AceHemmerBeliebigesEreignisChoice> ereignisList = new ArrayList<>();
    for (Coding coding : resource.getMedicationCodeableConcept().getCoding()) {
        if (coding.getSystem().equals("http://fhir.de/CodeSystem/bfarm/atc")) {
            ereignisList.add(new AceHemmerBeliebigesEreignisPointEventConverter().convert(resource));
        }
    }
    aceHemmerObservation.setBeliebigesEreignis(ereignisList);
    return aceHemmerObservation;
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) AceHemmerObservation(org.ehrbase.fhirbridge.ehr.opt.geccomedikationcomposition.definition.AceHemmerObservation) ArrayList(java.util.ArrayList) AceHemmerBeliebigesEreignisChoice(org.ehrbase.fhirbridge.ehr.opt.geccomedikationcomposition.definition.AceHemmerBeliebigesEreignisChoice)

Example 23 with MEDICATIONSTATEMENT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.MEDICATIONSTATEMENT in project fhir-bridge by ehrbase.

the class Covid19TherapieBeliebigesEreignisPointEventConverter method convertInternal.

@Override
protected Covid19TherapieBeliebigesEreignisPointEvent convertInternal(MedicationStatement resource) {
    Covid19TherapieBeliebigesEreignisPointEvent covid19TherapieBeliebigesEreignisPointEvent = new Covid19TherapieBeliebigesEreignisPointEvent();
    for (Coding coding : resource.getMedicationCodeableConcept().getCoding()) {
        if (coding.getSystem().equals("http://fhir.de/CodeSystem/bfarm/atc")) {
            DvCodedTextParser.getInstance().parseFHIRCoding(coding).ifPresent(covid19TherapieBeliebigesEreignisPointEvent::setArzneimittelName);
        }
    }
    getGrundDefiningCode(resource).ifPresent(covid19TherapieBeliebigesEreignisPointEvent::setGrund);
    return covid19TherapieBeliebigesEreignisPointEvent;
}
Also used : Covid19TherapieBeliebigesEreignisPointEvent(org.ehrbase.fhirbridge.ehr.opt.geccomedikationcomposition.definition.Covid19TherapieBeliebigesEreignisPointEvent) Coding(org.hl7.fhir.r4.model.Coding)

Example 24 with MEDICATIONSTATEMENT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.MEDICATIONSTATEMENT in project fhir-bridge by ehrbase.

the class ProvideMedicationStatementTransactionIT method provideMedicationStatementConditionalUpdate.

@Test
void provideMedicationStatementConditionalUpdate() throws IOException {
    MethodOutcome outcome;
    outcome = create("MedicationStatement/transactions/provide-medication-statement-create.json");
    var id = outcome.getId();
    outcome = update("MedicationStatement/transactions/provide-medication-statement-update.json", "MedicationStatement?_id=" + id.getIdPart() + "&subject.identifier=" + PATIENT_ID);
    Assertions.assertEquals(id.getIdPart(), outcome.getId().getIdPart());
    Assertions.assertEquals(id.getVersionIdPartAsLong() + 1, outcome.getId().getVersionIdPartAsLong());
    var medicationStatement = (MedicationStatement) outcome.getResource();
    Assertions.assertEquals(PATIENT_ID, medicationStatement.getSubject().getIdentifier().getValue());
    Assertions.assertEquals(MedicationStatement.MedicationStatementStatus.ONHOLD, medicationStatement.getStatus());
}
Also used : MedicationStatement(org.hl7.fhir.r4.model.MedicationStatement) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Test(org.junit.jupiter.api.Test)

Example 25 with MEDICATIONSTATEMENT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.MEDICATIONSTATEMENT in project odm2fhir by num-codex.

the class Anticoagulation method createMedicationStatement.

private MedicationStatement createMedicationStatement(ItemData generalCoding, ItemData specificCoding, ItemData accurateCodingOrText, ItemData dateCoding, ItemData reasonCoding) {
    var medicationStatement = (MedicationStatement) new MedicationStatement().addIdentifier(createIdentifier(MEDICATIONSTATEMENT, specificCoding)).setEffective(createDateTimeType(dateCoding)).addReasonCode(createCodeableConcept(!reasonCoding.isEmpty() ? createCoding(reasonCoding) : createCoding(SNOMED_CT, "373808002", "Curative - procedure intent (qualifier value)"))).setMeta(createMeta(PHARMACOLOGICAL_THERAPY_ANTICOAGULANTS));
    var medicationCodeableConcept = createCodeableConcept(generalCoding);
    for (var coding : createCodings(specificCoding)) {
        switch(coding.getCode()) {
            case // Answer = YES
            "410605003":
                medicationStatement.setStatus(MedicationStatementStatus.ACTIVE);
                break;
            case // Answer = NO
            "410594000":
                medicationStatement.setStatus(NOTTAKEN);
                break;
            case // Answer = Unknown
            "261665006":
                medicationStatement.setStatus(MedicationStatementStatus.UNKNOWN);
                break;
            case // Answer = Sonstige/Other
            "385432009":
                medicationCodeableConcept.addCoding(coding.setDisplay("Not applicable (qualifier value)"));
                if (endsWith(accurateCodingOrText.getItemOID(), "_textfeld") && !accurateCodingOrText.isEmpty()) {
                    medicationCodeableConcept.setText(accurateCodingOrText.getValue());
                }
                break;
            default:
                // add Medication Codes
                if (accurateCodingOrText.isEmpty()) {
                    medicationCodeableConcept.addCoding(coding);
                }
                break;
        }
    }
    // insert coding of used medication
    if (!accurateCodingOrText.isEmpty() && !endsWith(accurateCodingOrText.getItemOID(), "_textfeld")) {
        for (var coding : createCodings(accurateCodingOrText)) {
            medicationCodeableConcept.addCoding(coding);
        }
    }
    return medicationCodeableConcept.isEmpty() ? new MedicationStatement() : medicationStatement.setMedication(medicationCodeableConcept);
}
Also used : MedicationStatement(org.hl7.fhir.r4.model.MedicationStatement)

Aggregations

ArrayList (java.util.ArrayList)11 MedicationStatement (org.hl7.fhir.r4.model.MedicationStatement)9 Test (org.junit.jupiter.api.Test)9 Coding (org.hl7.fhir.r4.model.Coding)8 Reference (org.hl7.fhir.dstu3.model.Reference)6 IdType (org.hl7.fhir.dstu3.model.IdType)5 Date (java.util.Date)4 RCMRMT030101UK04Component2 (org.hl7.v3.RCMRMT030101UK04Component2)4 RCMRMT030101UK04EhrExtract (org.hl7.v3.RCMRMT030101UK04EhrExtract)4 DateTimeType (org.hl7.fhir.dstu3.model.DateTimeType)3 Extension (org.hl7.fhir.dstu3.model.Extension)3 Bundle (org.hl7.fhir.r4.model.Bundle)3 UnprocessableEntityException (ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException)2 FileOutputStream (java.io.FileOutputStream)2 List (java.util.List)2 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)2 MedicationRequest (org.hl7.fhir.dstu3.model.MedicationRequest)2 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)2 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)2 Condition (org.hl7.fhir.r4.model.Condition)2