Example usage for javax.xml.bind JAXBElement JAXBElement

List of usage examples for javax.xml.bind JAXBElement JAXBElement

Introduction

In this page you can find the example usage for javax.xml.bind JAXBElement JAXBElement.

Prototype

public JAXBElement(QName name, Class<T> declaredType, T value) 

Source Link

Document

Construct an xml element instance.

Usage

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static org.hl7.v3.PRPAMT201301UV02Patient create201301Patient(PRPAMT201306UV02ParameterList paramList,
        String aaId) {/*  www .  jav a 2s  . c o m*/
    PRPAMT201301UV02Patient result = new PRPAMT201301UV02Patient();

    PRPAMT201301UV02Person person = new PRPAMT201301UV02Person();

    if (paramList == null) {
        return null;
    }
    // Set the Subject Gender Code
    if (paramList.getLivingSubjectAdministrativeGender() != null
            && paramList.getLivingSubjectAdministrativeGender().size() > 0) {
        CE genderCode = paramList.getLivingSubjectAdministrativeGender().get(0).getValue().get(0);

        person.setAdministrativeGenderCode(genderCode);
    }

    // Set the Subject Birth Time
    if (paramList.getLivingSubjectBirthTime() != null && paramList.getLivingSubjectBirthTime().size() > 0) {

        person.setBirthTime(createBirthTime(paramList.getLivingSubjectBirthTime().get(0)));
    }
    // Set the address
    if (paramList.getPatientAddress() != null && paramList.getPatientAddress().size() > 0) {
        for (PRPAMT201306UV02PatientAddress patAdd : paramList.getPatientAddress()) {
            for (ADExplicit newAdd : patAdd.getValue()) {
                person.getAddr().add(newAdd);
            }
        }
    }
    //Set the telcom
    if (paramList.getPatientTelecom() != null && paramList.getPatientTelecom().size() > 0) {
        for (PRPAMT201306UV02PatientTelecom telcom : paramList.getPatientTelecom()) {
            if (telcom != null) {
                for (TELExplicit newTelcom : telcom.getValue()) {
                    person.getTelecom().add(newTelcom);
                }
            }

        }
    }

    // Set the Subject Name
    if (paramList.getLivingSubjectName() != null && paramList.getLivingSubjectName().size() > 0) {
        for (PRPAMT201306UV02LivingSubjectName subjName : paramList.getLivingSubjectName()) {

            for (ENExplicit name : subjName.getValue()) {
                PNExplicit newName = HL7DataTransformHelper.convertENtoPN(name);
                newName = HL7ArrayTransforms.copyNullFlavors(name, newName);
                person.getName().add(newName);
            }
        }
        //paramList.getLivingSubjectName().get(index)
    }

    // Set the subject Id
    if (paramList.getLivingSubjectId() != null && paramList.getLivingSubjectId().size() > 0) {
        for (PRPAMT201306UV02LivingSubjectId subjId : paramList.getLivingSubjectId()) {
            for (II id : subjId.getValue()) {
                if (id.getRoot().equalsIgnoreCase(aaId)) {
                    result.getId().add(id);
                } else {
                    PRPAMT201301UV02OtherIDs otherId = new PRPAMT201301UV02OtherIDs();
                    otherId.getId().add(id);
                    person.getAsOtherIDs().add(otherId);
                }
            }
        }
    }

    person = HL7ArrayTransforms.copyNullFlavors(paramList, person);

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201301UV02Person> jaxbPerson = new JAXBElement<PRPAMT201301UV02Person>(xmlqname,
            PRPAMT201301UV02Person.class, person);

    jaxbPerson.setValue(person);

    result.setPatientPerson(jaxbPerson);

    return result;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

private static JAXBElement<PRPAMT201304UV02Person> create201304PatientPerson(List<PatientIdentifier> ids) {
    PRPAMT201304UV02Person person = new PRPAMT201304UV02Person();
    person.setDeterminerCode(HL7Constants.DETERMINER_CODE_INSTANCE);
    person.getClassCode().add(HL7Constants.CLASS_CODE_PSN);
    PNExplicit patName = new PNExplicit();
    patName.getNullFlavor().add("NA");
    person.getName().add(patName);/*  w w  w .  ja v a 2s . c o m*/
    //        if (ids.size() > 1) {
    //           for (int i=1; i < ids.size(); i++) {
    //              PatientIdentifier id = ids.get(i);
    //               II ii = HL7DataTransformHelper.IIFactory(id.getAssigningAuthority().getUniversalId(), id.getId());
    //               PRPAMT201304UV02OtherIDs otherId = new PRPAMT201304UV02OtherIDs();
    //               otherId.getId().add(ii);
    //               COCTMT150002UV01Organization scopingOrg = new COCTMT150002UV01Organization();
    //               scopingOrg.setClassCode(HL7Constants.CLASS_CODE_ORG);
    //               scopingOrg.setDeterminerCode(HL7Constants.DETERMINER_CODE_INSTANCE);
    //               II orgId = HL7DataTransformHelper.IIFactory(id.getAssigningAuthority().getUniversalId());
    //               scopingOrg.getId().add(orgId);
    //               otherId.setScopingOrganization(scopingOrg);
    //               person.getAsOtherIDs().add(otherId);
    //           }
    //        }
    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201304UV02Person> result = new JAXBElement<PRPAMT201304UV02Person>(xmlqname,
            PRPAMT201304UV02Person.class, person);
    return result;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201301UV02Person> create201301PatientPerson(PNExplicit patName, CE gender,
        TSExplicit birthTime, PRPAMT201301UV02OtherIDs otherIds) {
    PRPAMT201301UV02Person person = new PRPAMT201301UV02Person();

    // Set the Subject Name
    if (patName != null) {
        person.getName().add(patName);// w w w  . jav a  2s .c  om
    }

    // Set the Subject Gender
    if (gender != null) {
        person.setAdministrativeGenderCode(gender);
    }

    // Set the Birth Time
    if (birthTime != null) {
        person.setBirthTime(birthTime);
    }

    // Set the SSN
    if (otherIds != null) {
        person.getAsOtherIDs().add(otherIds);
    }

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201301UV02Person> result = new JAXBElement<PRPAMT201301UV02Person>(xmlqname,
            PRPAMT201301UV02Person.class, person);

    return result;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201310UV02Person> create201310PatientPerson(PNExplicit patName, CE gender,
        TSExplicit birthTime, PRPAMT201310UV02OtherIDs otherIds) {
    PRPAMT201310UV02Person person = new PRPAMT201310UV02Person();

    // Set the Subject Name
    if (patName != null) {
        person.getName().add(patName);/*from   w w w.  jav  a  2  s  .  co m*/
    }

    // Set the Subject Gender
    if (gender != null) {
        person.setAdministrativeGenderCode(gender);
    }

    // Set the Birth Time
    if (birthTime != null) {
        person.setBirthTime(birthTime);
    }

    // Set the SSN
    if (otherIds != null) {
        person.getAsOtherIDs().add(otherIds);
    }

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201310UV02Person> result = new JAXBElement<PRPAMT201310UV02Person>(xmlqname,
            PRPAMT201310UV02Person.class, person);

    return result;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201302UV02PatientPatientPerson> create201302PatientPerson(PNExplicit patName,
        CE gender, TSExplicit birthTime, PRPAMT201302UV02OtherIDs otherIds) {
    PRPAMT201302UV02PatientPatientPerson person = new PRPAMT201302UV02PatientPatientPerson();

    // Set the Subject Name
    if (patName != null) {
        person.getName().add(patName);/*from   w w w . j a  va  2 s .  co  m*/
    }

    // Set the Subject Gender
    if (gender != null) {
        person.setAdministrativeGenderCode(gender);
    }

    // Set the Birth Time
    if (birthTime != null) {
        person.setBirthTime(birthTime);
    }

    // Set the SSN
    if (otherIds != null) {
        person.getAsOtherIDs().add(otherIds);
    }

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201302UV02PatientPatientPerson> result = new JAXBElement<PRPAMT201302UV02PatientPatientPerson>(
            xmlqname, PRPAMT201302UV02PatientPatientPerson.class, person);

    return result;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201301UV02BirthPlace> createPRPAMT201301UVBirthPlace(
        PRPAMT201310UV02BirthPlace birthPlace) {
    PRPAMT201301UV02BirthPlace result = new PRPAMT201301UV02BirthPlace();

    if (birthPlace == null) {
        return null;
    }/*w  w  w .  j  a  v a 2  s  .  c  om*/

    if (birthPlace.getBirthplace() != null) {
        result.setBirthplace(birthPlace.getBirthplace());
    }
    if (Utilities.isNotNullish(birthPlace.getClassCode())) {
        for (String code : birthPlace.getClassCode()) {
            result.getClassCode().add(code);
        }
    }
    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "birthPlace");
    JAXBElement<PRPAMT201301UV02BirthPlace> element = new JAXBElement<PRPAMT201301UV02BirthPlace>(xmlqname,
            PRPAMT201301UV02BirthPlace.class, result);

    return element;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201301UV02Person> create201301PatientPerson(PRPAMT201310UV02Person person) {
    PRPAMT201301UV02Person result = new PRPAMT201301UV02Person();

    if (person == null) {
        return null;
    }//  w  w w. j a  va  2  s. com

    for (PNExplicit name : person.getName()) {
        result.getName().add(name);
    }

    result.setAdministrativeGenderCode(person.getAdministrativeGenderCode());

    result.setBirthTime(person.getBirthTime());

    for (ADExplicit add : person.getAddr()) {
        result.getAddr().add(add);
    }

    if (person.getBirthPlace() != null) {
        result.setBirthPlace(createPRPAMT201301UVBirthPlace(person.getBirthPlace().getValue()));
    }

    for (II id : person.getId()) {
        result.getId().add(id);
    }

    for (TELExplicit telephone : person.getTelecom()) {
        result.getTelecom().add(telephone);
    }

    if (person.getAsOtherIDs() != null) {
        for (PRPAMT201310UV02OtherIDs otherId : person.getAsOtherIDs()) {
            PRPAMT201301UV02OtherIDs newId = new PRPAMT201301UV02OtherIDs();
            if (otherId != null && Utilities.isNotNullish(otherId.getId()) && otherId.getId().get(0) != null) {
                newId.getId().add(otherId.getId().get(0));
                result.getAsOtherIDs().add(newId);
            }
        }
    }
    result.setDeceasedInd(person.getDeceasedInd());
    result.setDeceasedTime(person.getDeceasedTime());
    result.setDeterminerCode(person.getDeterminerCode());
    result.setDesc(person.getDesc());
    result.setEducationLevelCode(person.getEducationLevelCode());
    result.setLivingArrangementCode(person.getLivingArrangementCode());
    result.setMaritalStatusCode(person.getMaritalStatusCode());
    result.setMultipleBirthInd(person.getMultipleBirthInd());
    result.setMultipleBirthOrderNumber(person.getMultipleBirthOrderNumber());
    result.setOrganDonorInd(person.getOrganDonorInd());
    result.setReligiousAffiliationCode(person.getReligiousAffiliationCode());
    result.setTypeId(person.getTypeId());

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201301UV02Person> element = new JAXBElement<PRPAMT201301UV02Person>(xmlqname,
            PRPAMT201301UV02Person.class, result);

    return element;

}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201301UV02Person> create201301PatientPerson(
        JAXBElement<PRPAMT201302UV02PatientPatientPerson> person) {
    PRPAMT201301UV02Person result = new PRPAMT201301UV02Person();

    if (person == null) {
        return null;
    }/*  w  ww  .j a  va 2s.c  o  m*/

    for (PNExplicit name : person.getValue().getName()) {
        result.getName().add(name);
    }

    result.setAdministrativeGenderCode(person.getValue().getAdministrativeGenderCode());

    result.setBirthTime(person.getValue().getBirthTime());

    for (ADExplicit add : person.getValue().getAddr()) {
        result.getAddr().add(add);
    }

    if (person.getValue().getBirthPlace() != null) {
        result.setBirthPlace(createPRPAMT201301UVBirthPlace(person.getValue().getBirthPlace()));
    }

    for (II id : person.getValue().getId()) {
        result.getId().add(id);
    }

    for (TELExplicit telephone : person.getValue().getTelecom()) {
        result.getTelecom().add(telephone);
    }

    result.setDeceasedInd(person.getValue().getDeceasedInd());
    result.setDeceasedTime(person.getValue().getDeceasedTime());
    result.setDeterminerCode(person.getValue().getDeterminerCode());
    result.setDesc(person.getValue().getDesc());
    result.setEducationLevelCode(person.getValue().getEducationLevelCode());
    result.setLivingArrangementCode(person.getValue().getLivingArrangementCode());
    result.setMaritalStatusCode(person.getValue().getMaritalStatusCode());
    result.setMultipleBirthInd(person.getValue().getMultipleBirthInd());
    result.setMultipleBirthOrderNumber(person.getValue().getMultipleBirthOrderNumber());
    result.setOrganDonorInd(person.getValue().getOrganDonorInd());
    result.setReligiousAffiliationCode(person.getValue().getReligiousAffiliationCode());
    result.setTypeId(person.getValue().getTypeId());

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201301UV02Person> element = new JAXBElement<PRPAMT201301UV02Person>(xmlqname,
            PRPAMT201301UV02Person.class, result);

    return element;

}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static JAXBElement<PRPAMT201301UV02BirthPlace> createPRPAMT201301UVBirthPlace(
        JAXBElement<PRPAMT201302UV02BirthPlace> value) {
    PRPAMT201301UV02BirthPlace result = new PRPAMT201301UV02BirthPlace();
    PRPAMT201302UV02BirthPlace birthPlace;

    if (value == null) {
        return null;
    }//from   w  w  w  .  j a va  2  s  . c om

    birthPlace = value.getValue();

    if (birthPlace.getBirthplace() != null) {
        result.setBirthplace(birthPlace.getBirthplace());
    }
    if (Utilities.isNotNullish(birthPlace.getClassCode())) {
        for (String code : birthPlace.getClassCode()) {
            result.getClassCode().add(code);
        }
    }
    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "birthPlace");
    JAXBElement<PRPAMT201301UV02BirthPlace> element = new JAXBElement<PRPAMT201301UV02BirthPlace>(xmlqname,
            PRPAMT201301UV02BirthPlace.class, result);

    return element;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

private static JAXBElement<PRPAMT201302UV02PatientPatientPerson> createPRPAMT201302UV02PatientPerson(
        Patient pat, List<PatientIdentifier> ids) {
    PRPAMT201302UV02PatientPatientPerson person = new PRPAMT201302UV02PatientPatientPerson();
    person.getClassCode().add(HL7Constants.CLASS_CODE_PSN);
    person.setDeterminerCode(HL7Constants.DETERMINER_CODE_INSTANCE);
    PNExplicit name = null;/*from   w  ww.  j  a va 2 s. c o m*/
    if (Utilities.isNotNullish(pat.getPatientName().getFirstName())
            && Utilities.isNotNullish(pat.getPatientName().getLastName())) {
        name = HL7DataTransformHelper.CreatePNExplicit(pat.getPatientName().getFirstName(),
                pat.getPatientName().getLastName());
    }
    person.getName().add(name);

    //        if (ids.size() > 1) {
    //           for (int i=1; i < ids.size(); i++) {
    //              PatientIdentifier id = ids.get(i);
    //               PRPAMT201302UV02OtherIDs otherId = new PRPAMT201302UV02OtherIDs();
    //               PRPAMT201302UV02OtherIDsId pid = new PRPAMT201302UV02OtherIDsId();
    //               pid.setRoot(id.getAssigningAuthority().getUniversalId());
    //               pid.setExtension(id.getId());
    //               otherId.getId().add(pid);
    //               COCTMT150002UV01Organization scopingOrg = new COCTMT150002UV01Organization();
    //               scopingOrg.setClassCode(HL7Constants.CLASS_CODE_ORG);
    //               scopingOrg.setDeterminerCode(HL7Constants.DETERMINER_CODE_INSTANCE);
    //               II orgId = HL7DataTransformHelper.IIFactory(id.getAssigningAuthority().getUniversalId());
    //               scopingOrg.getId().add(orgId);
    //               otherId.setScopingOrganization(scopingOrg);
    //               person.getAsOtherIDs().add(otherId);
    //           }
    //        }
    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201302UV02PatientPatientPerson> result = new JAXBElement<PRPAMT201302UV02PatientPatientPerson>(
            xmlqname, PRPAMT201302UV02PatientPatientPerson.class, person);
    return result;
}