Search in sources :

Example 6 with FamilyMemberHistory

use of org.hl7.fhir.r4.model.FamilyMemberHistory in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeFamilyMemberHistory.

protected void composeFamilyMemberHistory(Complex parent, String parentType, String name, FamilyMemberHistory element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "FamilyMemberHistory", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "FamilyMemberHistory", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getInstantiatesCanonical().size(); i++) composeCanonical(t, "FamilyMemberHistory", "instantiatesCanonical", element.getInstantiatesCanonical().get(i), i);
    for (int i = 0; i < element.getInstantiatesUri().size(); i++) composeUri(t, "FamilyMemberHistory", "instantiatesUri", element.getInstantiatesUri().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "FamilyMemberHistory", "status", element.getStatusElement(), -1);
    if (element.hasDataAbsentReason())
        composeCodeableConcept(t, "FamilyMemberHistory", "dataAbsentReason", element.getDataAbsentReason(), -1);
    if (element.hasPatient())
        composeReference(t, "FamilyMemberHistory", "patient", element.getPatient(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "FamilyMemberHistory", "date", element.getDateElement(), -1);
    if (element.hasNameElement())
        composeString(t, "FamilyMemberHistory", "name", element.getNameElement(), -1);
    if (element.hasRelationship())
        composeCodeableConcept(t, "FamilyMemberHistory", "relationship", element.getRelationship(), -1);
    if (element.hasSex())
        composeCodeableConcept(t, "FamilyMemberHistory", "sex", element.getSex(), -1);
    if (element.hasBorn())
        composeType(t, "FamilyMemberHistory", "born", element.getBorn(), -1);
    if (element.hasAge())
        composeType(t, "FamilyMemberHistory", "age", element.getAge(), -1);
    if (element.hasEstimatedAgeElement())
        composeBoolean(t, "FamilyMemberHistory", "estimatedAge", element.getEstimatedAgeElement(), -1);
    if (element.hasDeceased())
        composeType(t, "FamilyMemberHistory", "deceased", element.getDeceased(), -1);
    for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "FamilyMemberHistory", "reasonCode", element.getReasonCode().get(i), i);
    for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "FamilyMemberHistory", "reasonReference", element.getReasonReference().get(i), i);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "FamilyMemberHistory", "note", element.getNote().get(i), i);
    for (int i = 0; i < element.getCondition().size(); i++) composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(t, "FamilyMemberHistory", "condition", element.getCondition().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 7 with FamilyMemberHistory

use of org.hl7.fhir.r4.model.FamilyMemberHistory in project elexis-server by elexis.

the class FamilyMemberHistoryTest method createFamilyMemberHistory.

@Test
public void createFamilyMemberHistory() {
    FamilyMemberHistory familyMemberHistory = new FamilyMemberHistory();
    Narrative narrative = new Narrative();
    String divEncodedText = "Test\nText".replaceAll("(\r\n|\r|\n)", "<br />");
    narrative.setDivAsString(divEncodedText);
    familyMemberHistory.setText(narrative);
    MethodOutcome outcome = client.create().resource(familyMemberHistory).execute();
    assertNotNull(outcome);
    assertTrue(outcome.getCreated());
    assertNotNull(outcome.getId());
    FamilyMemberHistory readFamilyMemberHistory = client.read().resource(FamilyMemberHistory.class).withId(outcome.getId()).execute();
    assertNotNull(readFamilyMemberHistory);
    assertEquals(outcome.getId().getIdPart(), readFamilyMemberHistory.getIdElement().getIdPart());
}
Also used : FamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory) IFamilyMemberHistory(ch.elexis.core.findings.IFamilyMemberHistory) Narrative(org.hl7.fhir.r4.model.Narrative) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Test(org.junit.Test)

Example 8 with FamilyMemberHistory

use of org.hl7.fhir.r4.model.FamilyMemberHistory in project elexis-server by elexis.

the class FamilyMemberHistoryResourceProvider method findFamilyMemberHistory.

@Search()
public List<FamilyMemberHistory> findFamilyMemberHistory(@RequiredParam(name = FamilyMemberHistory.SP_PATIENT) IdType patientId) {
    if (patientId != null && !patientId.isEmpty()) {
        Optional<IPatient> patient = modelService.load(patientId.getIdPart(), IPatient.class);
        if (patient.isPresent()) {
            if (patient.get().isPatient()) {
                List<FamilyMemberHistory> ret = new ArrayList<>();
                List<IFamilyMemberHistory> findings = findingsService.getPatientsFindings(patientId.getIdPart(), IFamilyMemberHistory.class);
                if (findings != null && !findings.isEmpty()) {
                    for (IFamilyMemberHistory iFinding : findings) {
                        Optional<FamilyMemberHistory> fhirFamilyMemberHistory = getTransformer().getFhirObject(iFinding);
                        if (fhirFamilyMemberHistory.isPresent()) {
                            ret.add(fhirFamilyMemberHistory.get());
                        }
                    }
                }
                return ret;
            }
        }
    }
    return Collections.emptyList();
}
Also used : FamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory) IFamilyMemberHistory(ch.elexis.core.findings.IFamilyMemberHistory) IFamilyMemberHistory(ch.elexis.core.findings.IFamilyMemberHistory) ArrayList(java.util.ArrayList) IPatient(ch.elexis.core.model.IPatient) Search(ca.uhn.fhir.rest.annotation.Search)

Example 9 with FamilyMemberHistory

use of org.hl7.fhir.r4.model.FamilyMemberHistory in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent.

protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(Complex parent, String parentType, String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "condition", name, element, index);
    if (element.hasCode())
        composeCodeableConcept(t, "FamilyMemberHistory", "code", element.getCode(), -1);
    if (element.hasOutcome())
        composeCodeableConcept(t, "FamilyMemberHistory", "outcome", element.getOutcome(), -1);
    if (element.hasOnset())
        composeType(t, "FamilyMemberHistory", "onset", element.getOnset(), -1);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "FamilyMemberHistory", "note", element.getNote().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 10 with FamilyMemberHistory

use of org.hl7.fhir.r4.model.FamilyMemberHistory in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent.

protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(Complex parent, String parentType, String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "condition", name, element, index);
    if (element.hasCode())
        composeCodeableConcept(t, "FamilyMemberHistory", "code", element.getCode(), -1);
    if (element.hasOutcome())
        composeCodeableConcept(t, "FamilyMemberHistory", "outcome", element.getOutcome(), -1);
    if (element.hasContributedToDeathElement())
        composeBoolean(t, "FamilyMemberHistory", "contributedToDeath", element.getContributedToDeathElement(), -1);
    if (element.hasOnset())
        composeType(t, "FamilyMemberHistory", "onset", element.getOnset(), -1);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "FamilyMemberHistory", "note", element.getNote().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Aggregations

IFamilyMemberHistory (ch.elexis.core.findings.IFamilyMemberHistory)3 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)2 FileOutputStream (java.io.FileOutputStream)2 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)2 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 FamilyMemberHistory (org.hl7.fhir.r4.model.FamilyMemberHistory)2 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)2 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)2 Test (org.junit.jupiter.api.Test)2 Create (ca.uhn.fhir.rest.annotation.Create)1 Search (ca.uhn.fhir.rest.annotation.Search)1 InternalErrorException (ca.uhn.fhir.rest.server.exceptions.InternalErrorException)1 IPatient (ch.elexis.core.model.IPatient)1 ArrayList (java.util.ArrayList)1 XmlParser (org.hl7.fhir.dstu2.formats.XmlParser)1 ProfileComparer (org.hl7.fhir.dstu2.utils.ProfileComparer)1 ProfileComparison (org.hl7.fhir.dstu2.utils.ProfileComparer.ProfileComparison)1 ProfileComparer (org.hl7.fhir.dstu3.conformance.ProfileComparer)1 ProfileComparison (org.hl7.fhir.dstu3.conformance.ProfileComparer.ProfileComparison)1