001 package com.bea.medrec.webservices;
002
003 import com.bea.medrec.controller.PatientSession;
004 import com.bea.medrec.controller.RecordSession;
005 import com.bea.medrec.utils.MedRecLog4jFactory;
006 import com.bea.medrec.value.Patient;
007 import com.bea.medrec.value.Record;
008 import com.bea.medrec.value.RecordsSummary;
009 import javax.jws.WebMethod;
010 import javax.jws.WebService;
011 import javax.jws.soap.SOAPBinding;
012 import org.apache.log4j.Logger;
013 import weblogic.jws.WLHttpTransport;
014
015 // Standard JWS annotation that specifies that the name of the Web Service is
016 // "MedRecWebServices", its public service name is "MedRecWebServices", and the
017 // targetNamespace used in the generated WSDL is "http://www.bea.com/medrec"
018 @WebService(name = "MedRecWebServicesPortType",
019 serviceName = "MedRecWebServices",
020 targetNamespace = "http://www.bea.com/medrec")
021
022 // Standard JWS annotation that specifies this is a document-literal-wrapped
023 // Web Service REVIEWME - review comment
024 @SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
025 use=SOAPBinding.Use.LITERAL,
026 parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
027
028 // WebLogic-specific JWS annotation that specifies the port name is "MedRecWebServicesPort",
029 // and the context path and service URI used to build the URI of the Web
030 // Service is "ws_medrec/MedRecWebServices"
031 @WLHttpTransport(portName = "MedRecWebServicesPort",
032 contextPath = "ws_medrec",
033 serviceUri = "MedRecWebServices")
034
035 /**
036 * <p>MedRecWebServices provides an interface for all MedRec Web services.</p>
037 *
038 * @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
039 */
040 public class MedRecWebServices extends MedRecBaseWebServices {
041 private static Logger logger =
042 MedRecLog4jFactory.getLogger(MedRecWebServices.class.getName());
043
044 // G E T A R E C O R D
045 /**
046 * <p>Retrieves all information for a visit given a record id.
047 * This includes vital signs, the record, and any prescriptions.</p>
048 *
049 * @param pRecordId Id of the record.
050 * @return Record Record value object
051 * @throws Exception
052 */
053 @WebMethod()
054 public Record getRecord(Integer pRecordId) throws Exception {
055 logger.info("Getting record.");
056 logger.debug("Record id: "+pRecordId);
057
058 // Declare local variables.
059 RecordSession recordSession = null;
060 Record record = null;
061
062 try {
063 recordSession = getRecordSession();
064 record = recordSession.getRecord(pRecordId);
065 } catch (Exception e) {
066 logger.error(e);
067 throw e;
068 }
069 return record;
070 }
071
072 // G E T R E C O R D S S U M M A R Y
073 /**
074 * <p>Retrieves all medical record summary.
075 * This includes a List of abbreviated records, and
076 * a List of current and recent prescriptions.</p>
077 *
078 * @param pPatientId Id of the record.
079 * @return RecordsSummary Record Summary value object
080 * @throws Exception
081 */
082 @WebMethod()
083 public RecordsSummary getRecordsSummary(Integer pPatientId)
084 throws Exception {
085 logger.info("Getting records summary.");
086 logger.debug("Patient ID: "+pPatientId);
087
088 // Declare local variables.
089 RecordSession recordSession = null;
090 RecordsSummary recSumaryVO = null;
091
092 try {
093 recordSession = getRecordSession();
094 recSumaryVO = recordSession.getRecordsSummary(pPatientId);
095 } catch (Exception e) {
096 logger.error(e);
097 throw e;
098 }
099 return recSumaryVO;
100 }
101
102 // G E T P A T I E N T
103 /**
104 * <p>Find patient by last name. Wild card search- %lastName%.</p>
105 *
106 * @param pLastname Last name substring
107 * @return Patient[] Array of Patient value objects.
108 * @throws Exception
109 */
110 @WebMethod()
111 public Patient[] findPatientByLastNameWild(String pLastname)
112 throws Exception {
113 logger.info("Finding patient by wildcard last name.");
114 logger.debug("Last name: "+pLastname);
115
116 // Declare local variables.
117 PatientSession patientSession = null;
118 Patient[] patientVOs = null;
119 try {
120 patientSession = getPatientSession();
121 patientVOs = patientSession.findPatientByLastNameWild(pLastname);
122 } catch (Exception e) {
123 logger.error(e);
124 throw e;
125 }
126 return patientVOs;
127 }
128
129 // G E T P A T I E N T B Y S S N
130 /**
131 * <p>Get patient by patient id.</p>
132 *
133 * @param pPatientSSN SSN of patient.
134 * @return Patient Patient value object
135 * @throws Exception
136 */
137 @WebMethod()
138 public Patient findPatientBySsn(String pPatientSSN)
139 throws Exception {
140 logger.info("Finding patient by ssn.");
141 logger.debug("SSN: "+pPatientSSN);
142
143 // Declare local variables.
144 PatientSession recordSession = null;
145 Patient patientVO = null;
146
147 try {
148 // Get handle on patient session bean.
149 recordSession = getPatientSession();
150 // Find patient.
151 patientVO = recordSession.findPatientBySsn(pPatientSSN);
152 } catch (Exception e) {
153 logger.error(e);
154 throw e;
155 }
156 return patientVO;
157 }
158
159 // U P D A T E P A T I E N T
160 /**
161 * <p>Accesses MedRec Web service to update patient info.</p>
162 *
163 * @param pPatientVO
164 * @return Patient
165 */
166 @WebMethod()
167 public Patient updatePatient(Patient pPatientVO) throws Exception {
168 logger.info("Updating patient.");
169 logger.debug(pPatientVO.toString());
170
171 // Declare local variables.
172 PatientSession patientSession = null;
173 Patient updatedPatient = null;
174
175 try {
176 patientSession = getPatientSession();
177 updatedPatient = patientSession.updatePatient(pPatientVO);
178 } catch (Exception e) {
179 logger.error(e);
180 throw e;
181 }
182
183 return updatedPatient;
184 }
185 }
|