public void SampleForDIXmlResponses() { // Obtain the certificate for use with TLS and signing X509Certificate2 cert = X509CertificateUtil.GetCertificate( "Serial Number", X509FindType.FindBySerialNumber, StoreName.My, StoreLocation.CurrentUser, true ); // Create PCEHR header CommonPcehrHeader header = PcehrHeaderHelper.CreateHeader(); // Override this value to the current patient's IHI. header.IhiNumber = "IHI"; // Instantiate the client // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getView" // production endpoint is "https://services.ehealth.gov.au/getView" GetViewClient getViewClient = new GetViewClient(new Uri("https://GetViewEndpoint"), cert, cert); // Add server certificate validation callback ServicePointManager.ServerCertificateValidationCallback += ValidateServiceCertificate; try { getView request = new getView() { // Creates a diagnosticImagingReportView view = new diagnosticImagingReportView() { fromDate = DateTime.Now.AddDays(-10), toDate = DateTime.Now, // versionNumber can be found in the "PCEHR View Service - Technical Service Specification" via // https://digitalhealth.gov.au/implementation-resources/national-infrastructure/EP-2109-2015 // If the specification doesn't specify the version number then it is 1.0 versionNumber = "Version number here" } }; var responseStatus = getViewClient.GetView(header, request); // Convert XML response into Class for diagnosticImagingReportView XmlDocument xml = new XmlDocument(); xml.PreserveWhitespace = true; xml.LoadXml(Encoding.Default.GetString(responseStatus.view.data)); diagnosticImagingReportViewResponse data = new diagnosticImagingReportViewResponse(); data = (diagnosticImagingReportViewResponse)DeserialiseElementToClass(xml.DocumentElement, data); // Get the soap request and response string soapRequest = getViewClient.SoapMessages.SoapRequest; string soapResponse = getViewClient.SoapMessages.SoapResponse; } catch (FaultException fex) { // Handle any errors } }
public void GetDiagnosticImagingView() { //Get Certificate and Header objects CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get( certSerial: "06fba6", serialHPIO: "8003629900019338", patientType: Support.PatientType.CalebDerrington); // Obtain the certificate for use with TLS and signing X509Certificate2 cert = CertAndHeaderInfo.Certificate; // Create PCEHR header CommonPcehrHeader header = CertAndHeaderInfo.Header; // Instantiate the client // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getView" // production endpoint is "https://services.ehealth.gov.au/getView" GetViewClient getViewClient = new GetViewClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getView"), cert, cert); // Add server certificate validation callback ServicePointManager.ServerCertificateValidationCallback += Support.CertificateHelper.ValidateServiceCertificate; try { getView request = new getView() { // Creates a diagnosticImagingReportView view = new diagnosticImagingReportView() { //2 years = 365 * 2 Days fromDate = new DateTime(2016, 1, 1), toDate = DateTime.Now, // versionNumber can be found in the "PCEHR View Service - Technical Service Specification" via // https://digitalhealth.gov.au/implementation-resources/national-infrastructure/EP-2109-2015 // If the specification doesn't specify the version number then it is 1.0 versionNumber = "1.0" } }; var responseStatus = getViewClient.GetView(header, request); // Convert XML response into Class for diagnosticImagingReportView XmlDocument xml = new XmlDocument(); xml.PreserveWhitespace = true; xml.LoadXml(Encoding.Default.GetString(responseStatus.view.data)); diagnosticImagingReportViewResponse data = new diagnosticImagingReportViewResponse(); data = (diagnosticImagingReportViewResponse)DeserialiseElementToClass(xml.DocumentElement, data); // Get the soap request and response string soapRequest = getViewClient.SoapMessages.SoapRequest; string soapResponse = getViewClient.SoapMessages.SoapResponse; foreach (var item in data.diagnosticImagingReport.OrderByDescending(x => x.reportInformation.CDAeffectiveTime)) { Console.WriteLine($""); Console.WriteLine($"##################################################################################"); Console.WriteLine($"DocumentId: {item.reportInformation.documentId}"); Console.WriteLine($"DocumentLink: {item.reportInformation.documentLink}"); Console.WriteLine($"ReportDescription: {item.reportInformation.reportDescription}"); Console.WriteLine($"AccessionNumber: {item.reportInformation.accessionNumber}"); Console.WriteLine($"ReportStatus(code): {item.reportInformation.reportStatus.code}"); Console.WriteLine($"DateTimeRequested: {item.imagingRequesterInformation.dateTimeRequested}"); Console.WriteLine($"CDAeffectiveTime: {item.reportInformation.CDAeffectiveTime}"); Console.WriteLine($"DateTimeReportAuthored: {item.reportInformation.dateTimeReportAuthored}"); Console.WriteLine($"DateTimeAuthorisation: {item.reportInformation.dateTimeAuthorisation}"); foreach (var Report in item.imagingExaminationResult) { Console.WriteLine($" -------------------------------------------------"); Console.WriteLine($" ExaminationResultName(code): {Report.examinationResultName.code}"); Console.WriteLine($" ExaminationResultName(displayName): {Report.examinationResultName.displayName}"); Console.WriteLine($" ExaminationResultName(originalText): {Report.examinationResultName.originalText}"); Console.WriteLine($" Modality(code): {Report.modality.code}"); Console.WriteLine($" OverallTestResultStatus(code): {Report.overallTestResultStatus.code}"); Console.WriteLine($" SpecimenCollectionDate: {Report.imagingServiceDateTime}"); } } } catch (FaultException fex) { // Handle any errors } }