source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/PatientCorrelationEJB/src/java/gov/hhs/fha/nhinc/patientcorrelationservice/parsers/PRPAIN201309UV/PRPAIN201309UVParser.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 4.4 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.patientcorrelationservice.parsers.PRPAIN201309UV;
6
7import gov.hhs.fha.nhinc.patientcorrelation.model.CorrelatedIdentifiers;
8import java.util.ArrayList;
9import java.util.List;
10import javax.xml.bind.JAXBElement;
11import org.apache.commons.logging.Log;
12import org.apache.commons.logging.LogFactory;
13import org.hl7.v3.CS;
14import org.hl7.v3.II;
15import org.hl7.v3.MCCIMT000300UV01Acknowledgement;
16import org.hl7.v3.MFMIMT700711UV01QueryAck;
17import org.hl7.v3.PRPAIN201309UV;
18import org.hl7.v3.PRPAIN201309UVQUQIMT021001UV01ControlActProcess;
19import org.hl7.v3.PRPAIN201310UV;
20import org.hl7.v3.PRPAIN201310UVMFMIMT700711UV01ControlActProcess;
21import org.hl7.v3.PRPAIN201310UVMFMIMT700711UV01RegistrationEvent;
22import org.hl7.v3.PRPAIN201310UVMFMIMT700711UV01Subject1;
23import org.hl7.v3.PRPAIN201310UVMFMIMT700711UV01Subject2;
24import org.hl7.v3.PRPAMT201304UVPatient;
25import org.hl7.v3.PRPAMT201304UVPerson;
26import org.hl7.v3.PRPAMT201307UVDataSource;
27import org.hl7.v3.PRPAMT201307UVParameterList;
28import org.hl7.v3.PRPAMT201307UVPatientIdentifier;
29import org.hl7.v3.PRPAMT201307UVQueryByParameter;
30
31/**
32 *
33 * @author svalluripalli
34 */
35public class PRPAIN201309UVParser {
36
37 private static Log log = LogFactory.getLog(PRPAIN201309UVParser.class);
38 private static String CODE = "CA";
39 private static String CNTRL_MODCODE = "EVN";
40 private static String CNTRL_CODE = "PRPA_TE201310UV";
41 private static String CNTRL_SUBJ_TYPECODE = "SUBJ";
42 private static String STATUS_CD = "active";
43 private static String CNTRL_SUBJ_EVENT_SUBJ_CLASS_CODE = "PAT";
44 private static String PATIENTPERSON_CLASSCODE = "PSN";
45 //private static String DETERMINER_CODE = "INSTANCE";
46 private static String QUERY_RESPONSE = "OK";
47
48 private static CS getCS(String value) {
49 CS cs = new CS();
50 cs.setCode(value);
51 return cs;
52 }
53
54 public static PRPAMT201307UVParameterList parseHL7ParameterListFrom201309Message(PRPAIN201309UV message) {
55 if (message == null) {
56 return null;
57 }
58 PRPAIN201309UVQUQIMT021001UV01ControlActProcess ctrlAccess = message.getControlActProcess();
59 if (ctrlAccess == null) {
60 return null;
61 }
62 JAXBElement<PRPAMT201307UVQueryByParameter> queryByParameter = ctrlAccess.getQueryByParameter();
63 if (queryByParameter == null) {
64 return null;
65 }
66 PRPAMT201307UVParameterList parameterList = (queryByParameter.getValue() != null) ? queryByParameter.getValue().getParameterList() : null;
67 if (parameterList == null) {
68 return null;
69 }
70 return parameterList;
71 }
72
73 public static PRPAMT201307UVPatientIdentifier parseHL7PatientPersonFrom201309Message(PRPAIN201309UV message) {
74 log.debug("---- Begin PRPAIN201309UVParser.parseHL7PatientPersonFrom201309Message()----");
75 PRPAMT201307UVParameterList parameterList = parseHL7ParameterListFrom201309Message(message);
76 PRPAMT201307UVPatientIdentifier patientIdentifier = (parameterList.getPatientIdentifier() != null) ? parameterList.getPatientIdentifier().get(0) : null;
77 log.debug("---- End PRPAIN201309UVParser.parseHL7PatientPersonFrom201309Message()----");
78 return patientIdentifier;
79 }
80
81 public static List<II> buildAssigningAuthorityInclusionFilterList(PRPAIN201309UV message) {
82 List<II> list = new ArrayList<II>();
83 PRPAMT201307UVParameterList parameterList = parseHL7ParameterListFrom201309Message(message);
84 List<PRPAMT201307UVDataSource> dataSourceList;
85 if (parameterList != null) {
86 dataSourceList = parameterList.getDataSource();
87 for (PRPAMT201307UVDataSource dataSource : dataSourceList) {
88 for (II dataSourceValue : dataSource.getValue()) {
89 list.add(dataSourceValue);
90 }
91 }
92 }
93 return list;
94 }
95
96 public static PRPAMT201307UVQueryByParameter ExtractQueryId(PRPAIN201309UV message) {
97 PRPAMT201307UVQueryByParameter queryByParameter = null;
98 if (message.getControlActProcess() != null) {
99 JAXBElement<PRPAMT201307UVQueryByParameter> queryByParamterElement = message.getControlActProcess().getQueryByParameter();
100 if (queryByParamterElement != null) {
101 queryByParameter = queryByParamterElement.getValue();
102 }
103 }
104 return queryByParameter;
105 }
106}
Note: See TracBrowser for help on using the repository browser.