Esempio n. 1
0
        public void ResultTest()
        {
            try
            {
                //var newHeader = new CobasE6000ResultRecord(@"R|1|^^^2/1/not|8.60|nmol/L||N||F||BMSERV|||E11");
                var newHeader = new CobasE6000ResultRecord(@"R|1|^^^64/1/not|46.22|IU/L||H||F||BMSERV|20050915150011||E11");

                //Debug.WriteLine(tempP.Create());
                Debug.WriteLine(newHeader.Create());
                var resultItem = newHeader.GetResult();
                Debug.WriteLine(resultItem.ToString());
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
Esempio n. 2
0
        private void ProcessData()
        {
            try
            {
                var arrRecords = new string[] {};

                if (_bufferData != string.Empty)
                {
                    arrRecords = _bufferData.Split(new[] { _clsRRecord.Rules.EndOfRecordCharacter },
                                                   StringSplitOptions.RemoveEmptyEntries);
                }
                var i = 0;
                while (i < arrRecords.Length)
                {
                    var arrFields = arrRecords[i].Split(_clsPRecord.Rules.FieldDelimiter);

                    if (arrFields[0].Equals(_clsRRecord.RecordType.Data))
                    {
                        _clsRRecord = new CobasE6000ResultRecord(arrRecords[i]);
                        AddResult(_clsRRecord.GetResult());
                        _newResult = true;
                    }
                    if (arrFields[0].StartsWith(_clsPRecord.RecordType.Data))
                    {
                        _clsPRecord = new CobasE6000PatientInformationRecord(arrRecords[i]);
                    }
                    else if (arrFields[0].StartsWith(_clsORecord.RecordType.Data))
                    {
                        _clsORecord        = new CobasE6000TestOrderRecord(arrRecords[i]);
                        TestResult.Barcode = _clsORecord.SpecimenId.Data.Trim();
                        var tempDate = _clsORecord.DateTimeResultReportedOrLastModified.Data;
                        TestResult.TestDate = string.Format("{0}/{1}/{2}", tempDate.Substring(6, 2),
                                                            tempDate.Substring(4, 2), tempDate.Substring(0, 4));
                    }
                    else if (arrFields[0].Equals(_clsQRecord.RecordType.Data))
                    {
                        _clsQRecord = new CobasE6000RequestInformationRecord(arrRecords[i]);
                        _sQBarcode  = _clsQRecord.GetOrderBarcode();
                        _newQuery   = true;
                        var regList = GetRegList(_sQBarcode);
                        if (regList != null)
                        {
                            if (regList.Count > 0)
                            {
                                Log.Debug(string.Format("So order: {0}", regList.Count.ToString()));
                                foreach (string s in regList)
                                {
                                    Log.Debug(string.Format("{0}\r\n", s));
                                }
                            }
                            else
                            {
                                Log.Debug("No order!");
                            }
                        }
                        else
                        {
                            Log.Debug("No order!");
                        }
                        _prvRequestArray.Enqueue(CreateOrderFrame(regList));
                    }
                    else if (arrFields[0].Equals(_clsHRecord.RecordType.Data))
                    {
                        _clsHRecord = new CobasE6000HeaderRecord(arrRecords[i]);
                    }

                    i++;
                }

                if (_newQuery)
                {
                    //Send((int)EventID.OpenNewOutputSession, _sQBarcode);
                    _objAstm.CallGetQuery(_objDataEventArgs);
                    if ((_prvRequestArray != null) && (_prvRequestArray.Count != 0))
                    {
                        _currentOrder.Clear();
                        _currentOrder    = _prvRequestArray.Dequeue();
                        _currentOrderIdx = 0;
                    }
                    //SendByte((byte)DeviceHelper.ENQ);
                    _newQuery = false;
                }

                if (_newResult)
                {
                    Log.Debug("Begin Import Result");
                    Log.Debug(ImportResults() ? "Import Result Success" : "Error While Import Result");
                    _newResult = false;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Fatal Error:{0}", ex.ToString());
            }
        }
        public override bool ProcessData(string inputBuffer, ref List <string> orderList)
        {
            try
            {
                var arrRecords = new string[] {};

                if (inputBuffer != string.Empty)
                {
                    arrRecords = inputBuffer.Split(new[] { _clsRRecord.Rules.EndOfRecordCharacter },
                                                   StringSplitOptions.RemoveEmptyEntries);
                }
                int  i          = 0;
                bool _newResult = false;
                while (i < arrRecords.Length)
                {
                    string[] arrFields = arrRecords[i].Split(_clsPRecord.Rules.FieldDelimiter);

                    if (arrFields[0].Equals(_clsRRecord.RecordType.Data))
                    {
                        _clsRRecord = new CobasE6000ResultRecord(arrRecords[i]);
                        AddResult(_clsRRecord.GetResult());
                        _newResult = true;
                    }
                    if (arrFields[0].StartsWith(_clsPRecord.RecordType.Data))
                    {
                        _clsPRecord = new CobasE6000PatientInformationRecord(arrRecords[i]);
                    }
                    else if (arrFields[0].StartsWith(_clsORecord.RecordType.Data))
                    {
                        _clsORecord        = new CobasE6000TestOrderRecord(arrRecords[i]);
                        TestResult.Barcode = _clsORecord.SpecimenId.Data.Trim();
                        string tempDate = _clsORecord.DateTimeResultReportedOrLastModified.Data;
                        TestResult.TestDate = string.Format("{0}/{1}/{2}", tempDate.Substring(6, 2),
                                                            tempDate.Substring(4, 2), tempDate.Substring(0, 4));
                    }
                    else if (arrFields[0].Equals(_clsQRecord.RecordType.Data))
                    {
                        _clsQRecord = new CobasE6000RequestInformationRecord(arrRecords[i]);
                        _sQBarcode  = _clsQRecord.GetOrderBarcode();

                        List <string> regList = GetRegList(_sQBarcode);
                        if (regList != null)
                        {
                            if (regList.Count > 0)
                            {
                                Log.Debug(string.Format("So order: {0}", regList.Count));
                                foreach (string s in regList)
                                {
                                    Log.Debug(string.Format("{0}\r\n", s));
                                }
                            }
                            else
                            {
                                Log.Debug("No order!");
                            }
                        }
                        else
                        {
                            Log.Debug("No order!");
                        }
                        orderList = CreateOrderFrame(regList);
                        return(true);
                    }
                    else if (arrFields[0].Equals(_clsHRecord.RecordType.Data))
                    {
                        _clsHRecord = new CobasE6000HeaderRecord(arrRecords[i]);
                    }

                    i++;
                }


                if (_newResult)
                {
                    Log.Debug("Begin Import Result");
                    Log.Debug(ImportResults() ? "Import Result Success" : "Error While Import Result");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Fatal Error:{0}", ex.ToString());
            }
            return(false);
        }