コード例 #1
0
ファイル: _Bs800Test.cs プロジェクト: vunb/CoreServicesNew
 public void QueryTest()
 {
     try
     {
         //var newHeader = new CobasE6000RequestInformationRecord(@"Q|1|^^                      ^1^5032^1^^S1^SC||ALL||||||||O");
         var    newHeader    = new Bs800RequestInformationRecord(@"Q|1|^SAMPLE123||||||||||O");
         string orderBarcode = newHeader.GetOrderBarcode();
         Debug.WriteLine(orderBarcode);
         Debug.WriteLine(newHeader.Create());
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
 }
コード例 #2
0
ファイル: Bs800Manager.cs プロジェクト: vunb/CoreServicesNew
 public Bs800Manager()
 {
     try
     {
         _clsHRecord = new Bs800HeaderRecord();
         _clsPRecord = new Bs800PatientInformationRecord();
         _clsORecord = new Bs800TestOrderRecord();
         _clsQRecord = new Bs800RequestInformationRecord();
         _clsRRecord = new Bs800ResultRecord();
         _clsTRecord = new Bs800TerminationRecord();
     }
     catch (Exception ex)
     {
         Log.Error("Fatal Error: {0}", ex);
     }
 }
コード例 #3
0
ファイル: Bs800Manager.cs プロジェクト: vunb/CoreServicesNew
        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 Bs800ResultRecord(arrRecords[i]);
                        AddResult(_clsRRecord.GetResult());
                        newResult = true;
                    }
                    else if (arrFields[0].StartsWith(_clsPRecord.RecordType.Data))
                    {
                        _clsPRecord = new Bs800PatientInformationRecord(arrRecords[i]);
                    }
                    else if (arrFields[0].StartsWith(_clsORecord.RecordType.Data))
                    {
                        _clsORecord = new Bs800TestOrderRecord(arrRecords[i]);
                        string barcode = _clsORecord.InstrumentSpecimenId.Data.Trim();
                        while (barcode.IndexOf(".") >= 0)
                        {
                            barcode = barcode.Replace(".", "");
                        }
                        TestResult.Barcode = barcode;

                        string tempDate = _clsORecord.SpecimenCollectionDateAndTime.Data.Trim() == ""
                            ? _clsORecord.RequestedDateAndTime.Data.Trim()
                            : _clsORecord.SpecimenCollectionDateAndTime.Data.Trim();

                        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))
                    {
                        string patientName = "";
                        _clsQRecord = new Bs800RequestInformationRecord(arrRecords[i]);
                        _sQBarcode  = _clsQRecord.GetOrderBarcode();
                        Log.Debug("Barcode is:{0}", _sQBarcode);

                        var regList = new List <string>();
                        //if(System.Diagnostics.Debugger.IsAttached)
                        //{
                        //    regList.AddRange(new[]{"002","006"});
                        //}
                        //else
                        //{
                        regList = GetRegList(_sQBarcode.Replace(".", ""), ref patientName);
                        //}

                        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, patientName);
                        return(true);
                    }
                    else if (arrFields[0].Equals(_clsHRecord.RecordType.Data))
                    {
                        _clsHRecord = new Bs800HeaderRecord(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);
        }