Search in sources :

Example 1 with Telecom

use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom in project MobileAccessGateway by i4mi.

the class Iti65RequestConverter method transform.

/**
 * FHIR ContactPoint -> XDS Telecom
 * @param contactPoint
 * @return
 */
public Telecom transform(ContactPoint contactPoint) {
    if (contactPoint == null)
        return null;
    Telecom result = new Telecom();
    if (contactPoint.getSystem().equals(ContactPointSystem.EMAIL) || contactPoint.getSystem().equals(ContactPointSystem.URL)) {
        result.setEmail(contactPoint.getValue());
        result.setUse("NET");
        result.setType("Internet");
    } else {
        result.setUnformattedPhoneNumber(contactPoint.getValue());
        if (contactPoint.hasSystem())
            switch(contactPoint.getSystem()) {
                case SMS:
                case PHONE:
                    result.setType("PH");
                    break;
                case FAX:
                    result.setType("FX");
                    break;
                case PAGER:
                    result.setType("BP");
                    break;
            }
        if (contactPoint.hasUse())
            switch(contactPoint.getUse()) {
                case HOME:
                    result.setUse("PRN");
                    break;
                case WORK:
                    result.setUse("WPN");
                    break;
                case MOBILE:
                    result.setType("CP");
                    break;
            }
    }
    return result;
}
Also used : Telecom(org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom)

Example 2 with Telecom

use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom in project MobileAccessGateway by i4mi.

the class BaseQueryResponseConverter method transformAuthor.

/**
 * XDS Author -> FHIR Reference
 * @param author
 * @return
 */
public Reference transformAuthor(Author author) {
    Person person = author.getAuthorPerson();
    if (isPatientAuthor(author)) {
        Patient patient = transformPatient(person);
        Reference result = new Reference();
        List<Telecom> telecoms = author.getAuthorTelecom();
        for (Telecom telecom : telecoms) patient.addTelecom(transform(telecom));
        result.setResource(patient);
        return result;
    }
    Practitioner containedPerson = transformPractitioner(person);
    PractitionerRole role = null;
    List<org.openehealth.ipf.commons.ihe.xds.core.metadata.Organization> orgs = author.getAuthorInstitution();
    List<Identifiable> roles = author.getAuthorRole();
    List<Identifiable> specialities = author.getAuthorSpecialty();
    if (!orgs.isEmpty() || !roles.isEmpty() || !specialities.isEmpty()) {
        role = new PractitionerRole();
        if (containedPerson != null)
            role.setPractitioner((Reference) new Reference().setResource(containedPerson));
    }
    for (org.openehealth.ipf.commons.ihe.xds.core.metadata.Organization org : orgs) {
        role.setOrganization((Reference) new Reference().setResource(transform(org)));
    }
    for (Identifiable roleId : roles) {
        role.addCode(transform(roleId));
    }
    for (Identifiable specId : specialities) {
        role.addSpecialty(transform(specId));
    }
    Reference result = new Reference();
    List<Telecom> telecoms = author.getAuthorTelecom();
    if (role == null) {
        for (Telecom telecom : telecoms) containedPerson.addTelecom(transform(telecom));
        result.setResource(containedPerson);
    } else {
        for (Telecom telecom : telecoms) role.addTelecom(transform(telecom));
        result.setResource(role);
    }
    return result;
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Reference(org.hl7.fhir.r4.model.Reference) Patient(org.hl7.fhir.r4.model.Patient) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) Practitioner(org.hl7.fhir.r4.model.Practitioner) Telecom(org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom) Person(org.openehealth.ipf.commons.ihe.xds.core.metadata.Person)

Aggregations

Telecom (org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom)2 Organization (org.hl7.fhir.r4.model.Organization)1 Patient (org.hl7.fhir.r4.model.Patient)1 Practitioner (org.hl7.fhir.r4.model.Practitioner)1 PractitionerRole (org.hl7.fhir.r4.model.PractitionerRole)1 Reference (org.hl7.fhir.r4.model.Reference)1 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)1 Person (org.openehealth.ipf.commons.ihe.xds.core.metadata.Person)1