//public static string GetPOCTTestCodesFromOBS(Observation[] Obs) //{ // string r = string.Empty; // try // { // List<Observation> lstObs = Obs.OfType<Observation>().ToList(); // if (lstObs?.Count > 0) // { // foreach (Observation obs in lstObs) // { // if (r?.Length < 350) // { // r = $"{r},{obs.observation_id?.Value ?? string.Empty}"; // } // } // r = r.TrimStart(','); // } // } // catch (Exception ex) // { // Debug.WriteLine(ex.Message); // } // return r; //} public static List <PatientDiagnosticRecord> GetPatientDiagnosticRecords <T>(IMessageDecoder <T> Decoder, T Message, DeviceMessage DeviceMessage) { List <PatientDiagnosticRecord> records = new List <PatientDiagnosticRecord>(); try { RCL.LISConnector.DataEntity.SQL.Patient _patient = Decoder.GetPatient(Message); string PatientInternalId = _patient?.InternalPatientId; if (!string.IsNullOrEmpty(PatientInternalId)) { _patient.ClientId = DeviceMessage.ClientId; var _diagnosticReport = Decoder.GetDiagnosticReport(Message); if (_diagnosticReport != null) { _diagnosticReport.ReceivingApplication = Constants.ReceivingApplicationName; _diagnosticReport.ReceivingFacility = Constants.ReceivingFacility; _diagnosticReport.SendingFacility = DeviceMessage.SendingFacility; _diagnosticReport.ClientId = DeviceMessage.ClientId; var _results = Decoder.GetResults(Message); if (_results?.Count > 0) { List <Result> ulResult = new List <Result>(); foreach (Result r in _results) { r.ClientId = DeviceMessage.ClientId; ulResult.Add(r); } string TestCodes = Helpers.GetTestCodesFromResults(_results); if (!string.IsNullOrEmpty(TestCodes)) { _diagnosticReport.TestCodes = TestCodes; } PatientDiagnosticRecord _record = new PatientDiagnosticRecord { patient = _patient, diagnosticReport = _diagnosticReport, results = ulResult }; records.Add(_record); } } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } return(records); }