public List <Patient> SearchPatients(string searchString) { var patientResults = new List <Patient>(); Hl7.Fhir.Rest.FhirClient fhirClient = FhirClientManager.CreateClientConnection(Configuration); fhirClient = FhirClientManager.CreateClientConnection(Configuration); Hl7.Fhir.Model.Bundle ReturnedSearchBundle = fhirClient.Search <Hl7.Fhir.Model.Patient>(new string[] { $"name={searchString}" }); foreach (var resource in ReturnedSearchBundle.Entry) { patientResults.Add((Patient)resource.Resource); } return(patientResults); }
public List <Prescription> FindMedication(string patientId) { var prescriptionResults = new List <Prescription>(); Hl7.Fhir.Rest.FhirClient fhirClient = FhirClientManager.CreateClientConnection(Configuration); fhirClient = FhirClientManager.CreateClientConnection(Configuration); Hl7.Fhir.Model.Bundle ReturnedSearchBundle = fhirClient.Search <Hl7.Fhir.Model.MedicationRequest>(new string[] { $"patient={patientId}" }); foreach (var resource in ReturnedSearchBundle.Entry) { var prescription = (Prescription)resource.Resource; prescriptionResults.Add(prescription); } return(prescriptionResults); }
public List <Diagnosis> FindDiagnosis(string patientId) { var diagnosticResults = new List <Diagnosis>(); Hl7.Fhir.Rest.FhirClient fhirClient = FhirClientManager.CreateClientConnection(Configuration); fhirClient = FhirClientManager.CreateClientConnection(Configuration); Hl7.Fhir.Model.Bundle ReturnedSearchBundle = fhirClient.Search <Hl7.Fhir.Model.DiagnosticReport>(new string[] { $"patient={patientId}" }); foreach (var resource in ReturnedSearchBundle.Entry) { var diagnosticReport = (DiagnosticReport)resource.Resource; foreach (var item in diagnosticReport.Contained) { diagnosticResults.Add((Diagnosis)item); } } return(diagnosticResults); }