1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 | package gov.hhs.fha.nhinc.common.patientcorrelationfacade.dte;
|
---|
6 |
|
---|
7 | import gov.hhs.fha.nhinc.common.nhinccommon.QualifiedSubjectIdentifierType;
|
---|
8 | import gov.hhs.fha.nhinc.common.patientcorrelationfacade.RetrievePatientCorrelationsResponseType;
|
---|
9 | import java.util.List;
|
---|
10 | import org.hl7.v3.*;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | *
|
---|
14 | * @author rayj
|
---|
15 | */
|
---|
16 | public class FacadeRetrieveResponseBuilder {
|
---|
17 |
|
---|
18 | public static CreateFacadeRetrieveResultResponseType createFacadeRetrieveResult(CreateFacadeRetrieveResultRequestType createFacadeRetrieveResultRequest) {
|
---|
19 | PRPAIN201310UV pixRetrieveResponse = createFacadeRetrieveResultRequest.getPRPAIN201310UV();
|
---|
20 | RetrievePatientCorrelationsResponseType facadeRetrieveResult = createFacadeRetrieveResult(pixRetrieveResponse);
|
---|
21 | CreateFacadeRetrieveResultResponseType response = new CreateFacadeRetrieveResultResponseType();
|
---|
22 | response.setRetrievePatientCorrelationsResponse(facadeRetrieveResult);
|
---|
23 | return response;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public static RetrievePatientCorrelationsResponseType createFacadeRetrieveResult(PRPAIN201310UV pixRetrieveResponse) {
|
---|
27 | RetrievePatientCorrelationsResponseType response = new RetrievePatientCorrelationsResponseType();
|
---|
28 |
|
---|
29 | List<II> idList;
|
---|
30 |
|
---|
31 | idList = pixRetrieveResponse.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId();
|
---|
32 |
|
---|
33 | gov.hhs.fha.nhinc.common.nhinccommon.QualifiedSubjectIdentifiersType qualifedIds;
|
---|
34 |
|
---|
35 | for (II patId : idList) {
|
---|
36 | QualifiedSubjectIdentifierType id;
|
---|
37 | id = new QualifiedSubjectIdentifierType();
|
---|
38 | id.setAssigningAuthorityIdentifier(patId.getRoot());
|
---|
39 | id.setSubjectIdentifier(patId.getExtension());
|
---|
40 |
|
---|
41 | response.getQualifiedPatientIdentifier().add(id);
|
---|
42 | }
|
---|
43 |
|
---|
44 | return response;
|
---|
45 | }
|
---|
46 | }
|
---|