Search in sources :

Example 6 with SimplePerson

use of org.nhindirect.xd.transform.pojo.SimplePerson in project nhin-d by DirectProject.

the class DefaultXdsXdmTransformerTest method testTransform.

public void testTransform() throws Exception {
    // Create a collection of documents
    DirectDocuments documents = new DirectDocuments();
    documents.getSubmissionSet().setId("1");
    documents.getSubmissionSet().setName("2");
    documents.getSubmissionSet().setDescription("3");
    documents.getSubmissionSet().setSubmissionTime(new Date());
    documents.getSubmissionSet().setIntendedRecipient(Arrays.asList("5.1", "5.2"));
    documents.getSubmissionSet().setAuthorPerson("6");
    documents.getSubmissionSet().setAuthorInstitution(Arrays.asList("7.1", "7.2"));
    documents.getSubmissionSet().setAuthorRole("8");
    documents.getSubmissionSet().setAuthorSpecialty("9");
    documents.getSubmissionSet().setAuthorTelecommunication("10");
    documents.getSubmissionSet().setContentTypeCode("11");
    documents.getSubmissionSet().setContentTypeCode_localized("12");
    documents.getSubmissionSet().setUniqueId("13");
    documents.getSubmissionSet().setSourceId("14");
    documents.getSubmissionSet().setPatientId("xxx");
    DirectDocument2 doc1 = new DirectDocument2();
    doc1.setData(new String("data1").getBytes());
    DirectDocument2.Metadata metadata1 = doc1.getMetadata();
    metadata1.setMimeType("text/xml");
    metadata1.setId("1.2");
    metadata1.setDescription("1.3");
    metadata1.setCreationTime(new Date());
    metadata1.setLanguageCode("1.5");
    metadata1.setServiceStartTime(new Date());
    metadata1.setServiceStopTime(new Date());
    metadata1.setSourcePatient(new SimplePerson("1.Bob", "1.Smith"));
    metadata1.setAuthorPerson("1.10");
    metadata1.setAuthorInstitution(Arrays.asList("1.11.1", "1.11.2"));
    metadata1.setAuthorRole("1.12");
    metadata1.setAuthorSpecialty("1.13");
    metadata1.setClassCode(ClassCodeEnum.HISTORY_AND_PHYSICAL.getValue());
    metadata1.setClassCode_localized(ClassCodeEnum.HISTORY_AND_PHYSICAL.getValue());
    metadata1.setConfidentialityCode("1.16");
    metadata1.setConfidentialityCode_localized("1.17");
    metadata1.setFormatCode(FormatCodeEnum.HL7_CCD_DOCUMENT);
    metadata1.setHealthcareFacilityTypeCode(HealthcareFacilityTypeCodeEnum.OF.getValue());
    metadata1.setHealthcareFacilityTypeCode_localized(HealthcareFacilityTypeCodeEnum.OF.getValue());
    metadata1.setPracticeSettingCode(PracticeSettingCodeEnum.MULTIDISCIPLINARY.getValue());
    metadata1.setPracticeSettingCode_localized(PracticeSettingCodeEnum.MULTIDISCIPLINARY.getValue());
    metadata1.setLoinc(LoincEnum.LOINC_34133_9.getValue());
    metadata1.setLoinc_localized(LoincEnum.LOINC_34133_9.getValue());
    metadata1.setPatientId("xxx");
    metadata1.setUniqueId("1.27");
    DirectDocument2 doc2 = new DirectDocument2();
    doc2.setData(new String("data2").getBytes());
    DirectDocument2.Metadata metadata2 = doc2.getMetadata();
    metadata2.setMimeType("text/xml");
    metadata2.setId("2.2");
    metadata2.setDescription("2.3");
    metadata2.setCreationTime(new Date());
    metadata2.setLanguageCode("2.5");
    metadata2.setServiceStartTime(new Date());
    metadata2.setServiceStopTime(new Date());
    metadata2.setSourcePatient(new SimplePerson("2.Bob", "2.Smith"));
    metadata2.setAuthorPerson("2.10");
    metadata2.setAuthorInstitution(Arrays.asList("2.11.1", "2.11.2"));
    metadata2.setAuthorRole("2.12");
    metadata2.setAuthorSpecialty("2.13");
    metadata2.setClassCode(ClassCodeEnum.HISTORY_AND_PHYSICAL.getValue());
    metadata2.setClassCode_localized(ClassCodeEnum.HISTORY_AND_PHYSICAL.getValue());
    metadata2.setConfidentialityCode("2.16");
    metadata2.setConfidentialityCode_localized("2.17");
    metadata2.setFormatCode(FormatCodeEnum.IMMUNIZATION_REGISTRY_CONTENT_CRC);
    metadata2.setHealthcareFacilityTypeCode(HealthcareFacilityTypeCodeEnum.OF.getValue());
    metadata2.setHealthcareFacilityTypeCode_localized(HealthcareFacilityTypeCodeEnum.OF.getValue());
    metadata2.setPracticeSettingCode(PracticeSettingCodeEnum.MULTIDISCIPLINARY.getValue());
    metadata2.setPracticeSettingCode_localized(PracticeSettingCodeEnum.MULTIDISCIPLINARY.getValue());
    metadata2.setLoinc(LoincEnum.LOINC_34133_9.getValue());
    metadata2.setLoinc_localized(LoincEnum.LOINC_34133_9.getValue());
    metadata2.setPatientId("xxx");
    metadata2.setUniqueId("2.27");
    documents.getDocuments().add(doc1);
    documents.getDocuments().add(doc2);
    ProvideAndRegisterDocumentSetRequestType request = documents.toProvideAndRegisterDocumentSetRequestType();
    QName qname = new QName("urn:ihe:iti:xds-b:2007", "ProvideAndRegisterDocumentSet_bRequest");
    String body = XmlUtils.marshal(qname, request, ihe.iti.xds_b._2007.ObjectFactory.class);
    System.out.println(body);
    XdsXdmTransformer transformer = new DefaultXdsXdmTransformer();
    File f = transformer.transform(request);
    System.out.println(f.getAbsolutePath());
}
Also used : QName(javax.xml.namespace.QName) XdsXdmTransformer(org.nhindirect.xd.transform.XdsXdmTransformer) Date(java.util.Date) DirectDocument2(org.nhindirect.xd.common.DirectDocument2) DirectDocuments(org.nhindirect.xd.common.DirectDocuments) File(java.io.File) SimplePerson(org.nhindirect.xd.transform.pojo.SimplePerson) ProvideAndRegisterDocumentSetRequestType(ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType)

Example 7 with SimplePerson

use of org.nhindirect.xd.transform.pojo.SimplePerson in project nhin-d by DirectProject.

the class SimplePersonTest method testSimplePerson.

/**
     * Test methods in the SimplePerson class.
     */
@SuppressWarnings("unchecked")
public void testSimplePerson() {
    SimplePerson person = new SimplePerson();
    String firstName = "A";
    String lastName = "B";
    String middleName = "C";
    String streetAddress1 = "D";
    String streetAddress2 = "E";
    String telephone = "F";
    String birthDateTime = "G";
    String languageCode = "H";
    String ethnicityCode = "I";
    String age = "J";
    String ageUnits = "K";
    String genderCode = "L";
    String zipCode = "M";
    String state = "N";
    String county = "O";
    String city = "P";
    String country = "Q";
    String pcpOid = "R";
    String pcpName = "S";
    String ethnicityCodeSystem = "T";
    String ethnicityCodeName = "U";
    String genderCodeSystem = "V";
    String patientEuid = "W";
    String localId = "X";
    String localOrg = "Y";
    String ssn = "Z";
    String npi = "AA";
    String email = "BB";
    String department = "CC";
    String suffix = "DD";
    String title = "EE";
    String systemCode = "FF";
    String systemName = "GG";
    String phoneExt = "HH";
    Map otherOrgIds = new HashMap();
    otherOrgIds.put("A", "B");
    person.setFirstName(firstName);
    person.setLastName(lastName);
    person.setMiddleName(middleName);
    person.setStreetAddress1(streetAddress1);
    person.setStreetAddress2(streetAddress2);
    person.setTelephone(telephone);
    person.setBirthDateTime(birthDateTime);
    person.setLanguageCode(languageCode);
    person.setEthnicityCode(ethnicityCode);
    person.setAge(age);
    person.setAgeUnits(ageUnits);
    person.setGenderCode(genderCode);
    person.setZipCode(zipCode);
    person.setState(state);
    person.setCounty(county);
    person.setCity(city);
    person.setCountry(country);
    person.setPcpOid(pcpOid);
    person.setPcpName(pcpName);
    person.setEthnicityCodeSystem(ethnicityCodeSystem);
    person.setEthnicityCodeName(ethnicityCodeName);
    person.setGenderCodeSystem(genderCodeSystem);
    person.setPatientEuid(patientEuid);
    person.setLocalId(localId);
    person.setLocalOrg(localOrg);
    person.setSsn(ssn);
    person.setNpi(npi);
    person.setEmail(email);
    person.setDepartment(department);
    person.setSuffix(suffix);
    person.setTitle(title);
    person.setSystemCode(systemCode);
    person.setSystemName(systemName);
    person.setPhoneExt(phoneExt);
    person.setOtherOrgIds(otherOrgIds);
    assertEquals("Actual value does not match expected", firstName, person.getFirstName());
    assertEquals("Actual value does not match expected", lastName, person.getLastName());
    assertEquals("Actual value does not match expected", middleName, person.getMiddleName());
    assertEquals("Actual value does not match expected", streetAddress1, person.getStreetAddress1());
    assertEquals("Actual value does not match expected", streetAddress2, person.getStreetAddress2());
    assertEquals("Actual value does not match expected", telephone, person.getTelephone());
    assertEquals("Actual value does not match expected", birthDateTime, person.getBirthDateTime());
    assertEquals("Actual value does not match expected", languageCode, person.getLanguageCode());
    assertEquals("Actual value does not match expected", ethnicityCode, person.getEthnicityCode());
    assertEquals("Actual value does not match expected", age, person.getAge());
    assertEquals("Actual value does not match expected", ageUnits, person.getAgeUnits());
    assertEquals("Actual value does not match expected", genderCode, person.getGenderCode());
    assertEquals("Actual value does not match expected", zipCode, person.getZipCode());
    assertEquals("Actual value does not match expected", state, person.getState());
    assertEquals("Actual value does not match expected", county, person.getCounty());
    assertEquals("Actual value does not match expected", city, person.getCity());
    assertEquals("Actual value does not match expected", country, person.getCountry());
    assertEquals("Actual value does not match expected", pcpOid, person.getPcpOid());
    assertEquals("Actual value does not match expected", pcpName, person.getPcpName());
    assertEquals("Actual value does not match expected", ethnicityCodeSystem, person.getEthnicityCodeSystem());
    assertEquals("Actual value does not match expected", ethnicityCodeName, person.getEthnicityCodeName());
    assertEquals("Actual value does not match expected", genderCodeSystem, person.getGenderCodeSystem());
    assertEquals("Actual value does not match expected", patientEuid, person.getPatientEuid());
    assertEquals("Actual value does not match expected", localId, person.getLocalId());
    assertEquals("Actual value does not match expected", localOrg, person.getLocalOrg());
    assertEquals("Actual value does not match expected", ssn, person.getSsn());
    assertEquals("Actual value does not match expected", npi, person.getNpi());
    assertEquals("Actual value does not match expected", email, person.getEmail());
    assertEquals("Actual value does not match expected", department, person.getDepartment());
    assertEquals("Actual value does not match expected", suffix, person.getSuffix());
    assertEquals("Actual value does not match expected", title, person.getTitle());
    assertEquals("Actual value does not match expected", systemCode, person.getSystemCode());
    assertEquals("Actual value does not match expected", systemName, person.getSystemName());
    assertEquals("Actual value does not match expected", phoneExt, person.getPhoneExt());
    assertEquals("Actual value does not match expected", otherOrgIds, person.getOtherOrgIds());
    person.setSsn(null);
    person.setSSN(ssn);
    assertEquals("Actual value does not match expected", ssn, person.getSSN());
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) SimplePerson(org.nhindirect.xd.transform.pojo.SimplePerson)

Aggregations

SimplePerson (org.nhindirect.xd.transform.pojo.SimplePerson)7 Date (java.util.Date)6 File (java.io.File)2 DirectDocument2 (org.nhindirect.xd.common.DirectDocument2)2 DirectDocuments (org.nhindirect.xd.common.DirectDocuments)2 ProvideAndRegisterDocumentSetRequestType (ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 QName (javax.xml.namespace.QName)1 XdsXdmTransformer (org.nhindirect.xd.transform.XdsXdmTransformer)1