public RadiologyReportTO getImagingReport(string ssn, string accessionNumber) { RadiologyReportTO result = new RadiologyReportTO(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (String.IsNullOrEmpty(ssn)) { result.fault = new FaultTO("Missing SSN"); } else if (String.IsNullOrEmpty(accessionNumber)) { result.fault = new FaultTO("Missing Accession Number"); } if (result.fault != null) { return(result); } try { PatientApi patientApi = new PatientApi(); Patient[] matches = patientApi.match(mySession.ConnectionSet.BaseConnection, ssn); if (matches == null || matches.Length != 1) { result.fault = new FaultTO("More than one patient has that SSN in this site (" + mySession.ConnectionSet.BaseConnection.DataSource.SiteId.Id + ")"); return(result); } RadiologyReport report = ImagingExam.getReportText(mySession.ConnectionSet.BaseConnection, matches[0].LocalPid, accessionNumber); result = new RadiologyReportTO(report); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }