// Sample code for these Custom XML response getViews // Nehta.VendorLibrary.PCEHR.HealthRecordOverview.healthRecordOverview // Nehta.VendorLibrary.PCEHR.PathologyIndexView.pathologyIndexView // Nehta.VendorLibrary.PCEHR.DiagnosticImagingReportView.diagnosticImagingReportView // Nehta.VendorLibrary.PCEHR.AdvanceCarePlanningView.advanceCarePlanningView public void SampleForPathXmlResponses() { // Obtain the certificate for use with TLS and signing X509Certificate2 cert = X509CertificateUtil.GetCertificate( "06fba6", X509FindType.FindBySerialNumber, StoreName.My, StoreLocation.CurrentUser, true ); // Create PCEHR header CommonPcehrHeader header = PcehrHeaderHelper.CreateHeader(); // 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 += ValidateServiceCertificate; try { getView request = new getView() { // Creates a pathologyReportView view = new pathologyReportView() { fromDate = new DateTime(1999, 01, 01), 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 pathologyReportView XmlDocument xml = new XmlDocument(); xml.PreserveWhitespace = true; xml.LoadXml(Encoding.Default.GetString(responseStatus.view.data)); pathologyReportViewResponse data = new pathologyReportViewResponse(); data = (pathologyReportViewResponse)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 GetPathologyView() { //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 pathologyReportView view = new pathologyReportView() { //2 years = 365 * 2 Days fromDate = DateTime.Now.Subtract(new TimeSpan((365 * 2), 0, 0, 0)), 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 pathologyReportView XmlDocument xml = new XmlDocument(); xml.PreserveWhitespace = true; xml.LoadXml(Encoding.Default.GetString(responseStatus.view.data)); pathologyReportViewResponse data = new pathologyReportViewResponse(); data = (pathologyReportViewResponse)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.pathologyReport.OrderByDescending(x => x.reportInformation.CDAeffectiveTime)) { Console.WriteLine($""); Console.WriteLine($"##################################################################################"); Console.WriteLine($"DocumentId: {item.reportInformation.documentId}"); Console.WriteLine($"DocumentLink: {item.reportInformation.documentLink}"); Console.WriteLine($"ReportName: {item.reportInformation.reportName}"); Console.WriteLine($"PathologistLocalReportId: {item.reportInformation.pathologistLocalReportId}"); Console.WriteLine($"ReportStatus(code): {item.reportInformation.reportStatus.code}"); Console.WriteLine($"DateTimeRequested: {item.testRequesterInformation.dateTimeRequested}"); Console.WriteLine($"CDAeffectiveTime: {item.reportInformation.CDAeffectiveTime}"); Console.WriteLine($"DateTimeReportAuthored: {item.reportInformation.dateTimeReportAuthored}"); Console.WriteLine($"DateTimeAuthorisation: {item.reportInformation.dateTimeAuthorisation}"); foreach (var Report in item.pathologyTestResult) { Console.WriteLine($" -------------------------------------------------"); Console.WriteLine($" TestResultName(code): {Report.testResultName.code}"); Console.WriteLine($" TestResultName(displayName): {Report.testResultName.displayName}"); Console.WriteLine($" TestResultName(originalText): {Report.testResultName.originalText}"); Console.WriteLine($" PathologyDiscipline(code): {Report.pathologyDiscipline.code}"); Console.WriteLine($" OverallTestResultStatus(code): {Report.overallTestResultStatus.code}"); Console.WriteLine($" SpecimenCollectionDate: {Report.specimenCollectionDate}"); } } } catch (FaultException fex) { // Handle any errors } }