Search in sources :

Example 1 with XpnName

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

the class Iti65RequestConverter method transform.

/**
 * FHIR HumanName -> XDS Name
 * @param name
 * @return
 */
public Name transform(HumanName name) {
    Name targetName = new XpnName();
    if (name.hasPrefix())
        targetName.setPrefix(name.getPrefixAsSingleString());
    if (name.hasSuffix())
        targetName.setSuffix(name.getSuffixAsSingleString());
    targetName.setFamilyName(name.getFamily());
    List<StringType> given = name.getGiven();
    if (given != null && !given.isEmpty()) {
        targetName.setGivenName(given.get(0).getValue());
        if (given.size() > 1) {
            StringBuffer restOfName = new StringBuffer();
            for (int part = 1; part < given.size(); part++) {
                if (part > 1)
                    restOfName.append(" ");
                restOfName.append(given.get(part).getValue());
            }
            targetName.setSecondAndFurtherGivenNames(restOfName.toString());
        }
    }
    return targetName;
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) XpnName(org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName) ContactPoint(org.hl7.fhir.r4.model.ContactPoint) HumanName(org.hl7.fhir.r4.model.HumanName) Name(org.openehealth.ipf.commons.ihe.xds.core.metadata.Name) XpnName(org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName)

Example 2 with XpnName

use of org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName in project ipf by oehf.

the class SourcePatientNamePIDTransformerTest method testToHL7.

@Test
public void testToHL7() {
    var patientInfo = new PatientInfo();
    Name name = new XpnName();
    name.setFamilyName("Jo|man");
    name.setGivenName("Jo|chen");
    name.setSecondAndFurtherGivenNames("Jo|achim");
    name.setSuffix("von Jo|del");
    name.setPrefix("Jo|dler");
    patientInfo.getNames().add(name);
    var iterator = patientInfo.getHl7FieldIterator("PID-5");
    assertEquals("Jo\\F\\man^Jo\\F\\chen^Jo\\F\\achim^von Jo\\F\\del^Jo\\F\\dler", iterator.next());
    assertFalse(iterator.hasNext());
}
Also used : XpnName(org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName) PatientInfo(org.openehealth.ipf.commons.ihe.xds.core.metadata.PatientInfo) Name(org.openehealth.ipf.commons.ihe.xds.core.metadata.Name) XcnName(org.openehealth.ipf.commons.ihe.xds.core.metadata.XcnName) XpnName(org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName) Test(org.junit.jupiter.api.Test)

Aggregations

Name (org.openehealth.ipf.commons.ihe.xds.core.metadata.Name)2 XpnName (org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName)2 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)1 HumanName (org.hl7.fhir.r4.model.HumanName)1 StringType (org.hl7.fhir.r4.model.StringType)1 Test (org.junit.jupiter.api.Test)1 PatientInfo (org.openehealth.ipf.commons.ihe.xds.core.metadata.PatientInfo)1 XcnName (org.openehealth.ipf.commons.ihe.xds.core.metadata.XcnName)1