Exemplo n.º 1
0
        //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);
        }
Exemplo n.º 2
0
        public RCL.LISConnector.DataEntity.SQL.Patient GetPatient(POCTMessage message)
        {
            RCL.LISConnector.DataEntity.SQL.Patient patient = new RCL.LISConnector.DataEntity.SQL.Patient();

            try
            {
                Service svc = message.svc;

                if (!string.IsNullOrEmpty(svc?.patient?.patient_id?.Value))
                {
                    patient.InternalPatientId = svc.patient.patient_id.Value;
                }

                if (!string.IsNullOrEmpty(svc?.patient?.patientName?.family?.Value))
                {
                    patient.FamilyName = svc.patient.patientName.family.Value;
                }

                if (!string.IsNullOrEmpty(svc?.patient?.patientName?.given?.Value))
                {
                    patient.GivenName = svc.patient.patientName.given.Value;
                }

                if (!string.IsNullOrEmpty(svc?.patient?.birth_date?.Value))
                {
                    patient.DateOfBirth = Helpers.Converters.ConvertPOCTStringToDateTime(svc.patient.birth_date.Value);
                }

                if (!string.IsNullOrEmpty(svc?.patient?.gender_cd?.Value))
                {
                    patient.Sex = svc?.patient?.gender_cd?.Value;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }

            return(patient);
        }
Exemplo n.º 3
0
        public void GetPatient()
        {
            bool b = false;

            RCL.LISConnector.DataEntity.SQL.Patient patient = _decoder.GetPatient(_message);

            try
            {
                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();
                }

                b = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            Assert.IsTrue(b);
        }
Exemplo n.º 4
0
        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);
        }