//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); }
public void ProcessMessage() { bool b = false; List <PatientDiagnosticRecord> _diagnosticRecords = _processor.ProcessMessage(_deviceMessage); PatientDiagnosticRecord _diagnosticRecord = _diagnosticRecords[0]; try { Patient patient = _diagnosticRecord.patient; if (patient?.InternalPatientId != "0003") { Assert.Fail(); } if (patient?.FamilyName != "Fab") { Assert.Fail(); } if (patient?.GivenName != "Cesc") { Assert.Fail(); } if (patient?.DateOfBirth.Value.ToString("yyyyMMdd") != "19890811") { Assert.Fail(); } if (patient?.Sex != "M") { Assert.Fail(); } if (patient?.AccountNumber != "V003") { Assert.Fail(); } if (patient?.ClientId != ClientId) { Assert.Fail(); } DiagnosticReport report = _diagnosticRecord.diagnosticReport; if (report?.SendingApplication != "cobasIT1000") { Assert.Fail(); } if (report?.ReceivingApplication != LISMessageProcessor.Helpers.Constants.ReceivingApplicationName) { Assert.Fail(); } if (report?.ReceivingFacility != LISMessageProcessor.Helpers.Constants.ReceivingFacility) { Assert.Fail(); } if (report?.PatientInternalId != "0003") { Assert.Fail(); } if (report?.FamilyName != "Fab") { Assert.Fail(); } if (report?.GivenName != "Cesc") { Assert.Fail(); } if (report?.Sex != "M") { Assert.Fail(); } if (report?.DateOfBirth.Value.ToString("yyyyMMdd") != "19890811") { Assert.Fail(); } if (report?.AnalyzerName != "ACI II UU13013667") { Assert.Fail(); } if (report?.AnalyzerDateTime.Value.ToString("yyyyMMddHHmmss") != "20130514114122") { Assert.Fail(); } if (report?.OperatorId != "ROCHE") { Assert.Fail(); } if (report?.TestCodes != "Glu2") { Assert.Fail(); } if (report?.ClientId != ClientId) { Assert.Fail(); } List <Result> _results = _diagnosticRecord.results; Result _result = _results[0]; if (_result?.TestCode != "Glu2") { Assert.Fail(); } if (_result?.Value != "67") { Assert.Fail(); } if (_result?.Units != "mg/dL") { Assert.Fail(); } if (_result?.ReferenceRange != "-") { Assert.Fail(); } if (_result?.ResultDateTime.Value.ToString("yyyyMMddHHmmss") != "20130514114122") { Assert.Fail(); } if (_result?.Comments != "Doctor Notified") { Assert.Fail(); } if (_result?.ClientId != ClientId) { Assert.Fail(); } b = true; } catch (Exception ex) { Debug.WriteLine(ex.Message); } Assert.IsTrue(b); }
public void ProcessMessage() { bool b = false; List <PatientDiagnosticRecord> _diagnosticRecords = _processor.ProcessMessage(_deviceMessage); PatientDiagnosticRecord _diagnosticRecord = _diagnosticRecords[0]; try { RCL.LISConnector.DataEntity.SQL.Patient patient = _diagnosticRecord.patient; if (patient?.InternalPatientId != "PT222-55-7777") { Assert.Fail(); } if (patient?.FamilyName != "Patient") { Assert.Fail(); } if (patient?.GivenName != "Janet") { Assert.Fail(); } if (patient?.DateOfBirth.Value.ToString("yyyy-MM-dd") != "1960-08-29") { Assert.Fail(); } if (patient?.Sex != "F") { Assert.Fail(); } if (patient?.ClientId != ClientId) { Assert.Fail(); } DiagnosticReport report = _diagnosticRecord.diagnosticReport; if (report?.SendingApplication != "ICU-4 Glucose") { Assert.Fail(); } if (report?.ReceivingApplication != LISMessageProcessor.Helpers.Constants.ReceivingApplicationName) { Assert.Fail(); } if (report?.ReceivingFacility != LISMessageProcessor.Helpers.Constants.ReceivingFacility) { Assert.Fail(); } if (patient?.InternalPatientId != "PT222-55-7777") { Assert.Fail(); } if (patient?.FamilyName != "Patient") { Assert.Fail(); } if (patient?.GivenName != "Janet") { Assert.Fail(); } if (patient?.DateOfBirth.Value.ToString("yyyy-MM-dd") != "1960-08-29") { Assert.Fail(); } if (patient?.Sex != "F") { Assert.Fail(); } if (report?.AnalyzerName != "ICU-4 Glucose") { Assert.Fail(); } if (report?.AnalyzerDateTime.Value.ToString("yyyy-MM-dd") != "2001-11-01") { Assert.Fail(); } if (report?.OperatorId != "OP777-88-9999") { Assert.Fail(); } if (report?.TestCodes != "1517-2") { Assert.Fail(); } if (report?.ClientId != ClientId) { Assert.Fail(); } List <Result> _results = _diagnosticRecord.results; Result _result = _results[0]; if (_result?.TestCode != "1517-2") { Assert.Fail(); } if (_result?.Value != "85") { Assert.Fail(); } if (_result?.Units != "mg/dL") { Assert.Fail(); } if (_result?.ReferenceRange != "[Normal][80;120] [Critical][30;160] mg/dL") { Assert.Fail(); } if (_result?.ResultDateTime.Value.ToString("yyyy-MM-dd") != "2001-11-01") { Assert.Fail(); } if (_result?.Comments != "Temp warning") { Assert.Fail(); } if (_result?.ClientId != ClientId) { Assert.Fail(); } b = true; } catch (Exception ex) { Debug.WriteLine(ex.Message); } Assert.IsTrue(b); }