Esempio n. 1
0
 public DxI800Manager()
 {
     try
     {
         //if (DateTime.Now > new DateTime(2013, 06, 06)) throw new Exception("XXX");
         _clsHRecord = new DxI800HeaderRecord();
         _clsPRecord = new DxI800PatientInformationRecord();
         _clsORecord = new DxI800TestOrderRecord();
         _clsQRecord = new DxI800RequestInformationRecord();
         _clsRRecord = new DxI800ResultRecord();
         _clsTRecord = new DxI800TerminationRecord();
     }
     catch (Exception ex)
     {
         Log.Error("Fatal Error: {0}", ex);
     }
 }
Esempio n. 2
0
 public void HeaderTest()
 {
     try
     {
         const string rawHeader = @"1H|\^&|||ACCESS^600138|||||LIS||P|1|20130507152052";
         var          oldHeader = new DxI800HeaderRecord();
         oldHeader.Parse(rawHeader);
         //h.Parse(rawHeader);
         Debug.WriteLine(oldHeader.RecordType);
         var newHeader = (DxI800HeaderRecord)oldHeader.Clone();
         newHeader.ReceiverId.Data     = oldHeader.ReceiverId.Data;
         newHeader.RecordType.Data     = oldHeader.RecordType.Data.PadRight(1);
         newHeader.SenderNameOrId.Data = oldHeader.SenderNameOrId.Data;
         Debug.WriteLine(newHeader.Create());
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
 }
Esempio n. 3
0
        public void MessagesTest()
        {
            try
            {
                var           astmBaseRecordsList = new List <AstmBaseRecord>();
                List <string> retList             = new List <string>();
                var           _clsHRecord         = new DxI800HeaderRecord(@"H|\^&||||||||||P|1|20130507152052");
                astmBaseRecordsList.Add(_clsHRecord);

                var _clsPRecord = new DxI800PatientInformationRecord(@"P|1|CasperJane|||Johnson^Joan||19580101|F");
                astmBaseRecordsList.Add(_clsPRecord);

                var _clsORecord = new DxI800TestOrderRecord();
                _clsORecord.SequenceNumber.Data = "1";
                _clsORecord.SpecimenId.Data     = "3120";
                List <string> orderList = new List <string> {
                    "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin", "Ferritin"
                };
                _clsORecord.UniversalTestId.Data = _clsORecord.CreateUniversalTestid(orderList);
                _clsORecord.Priority.Data        = "R";

                _clsORecord.ActionCode.Data         = "A";
                _clsORecord.SpecimenDescriptor.Data = "Serum";
                astmBaseRecordsList.Add(_clsORecord);

                var _clsTRecord = new DxI800TerminationRecord {
                    TerminationCode = { Data = "F" }
                };
                astmBaseRecordsList.Add(_clsTRecord);
                //sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "1", sTemp, DeviceHelper.ETX);

                //var retList = new List<string>();
                var a = CreateEachRecord(astmBaseRecordsList, DeviceHelper.ETX);

                //Debug.WriteLine(sTemp);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
Esempio n. 4
0
        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 DxI800ResultRecord(arrRecords[i]);
                        AddResult(_clsRRecord.GetResult());
                        _newResult = true;
                    }
                    if (arrFields[0].Equals(_clsHRecord.RecordType.Data))
                    {
                        _clsHRecord = new DxI800HeaderRecord(arrRecords[i]);
                        string tempDate = _clsHRecord.DateTime.Data;
                        TestResult.TestDate = string.Format("{0}/{1}/{2}", tempDate.Substring(6, 2),
                                                            tempDate.Substring(4, 2), tempDate.Substring(0, 4));
                    }
                    if (arrFields[0].StartsWith(_clsPRecord.RecordType.Data))
                    {
                        _clsPRecord = new DxI800PatientInformationRecord(arrRecords[i]);
                    }
                    else if (arrFields[0].StartsWith(_clsORecord.RecordType.Data))
                    {
                        _clsORecord        = new DxI800TestOrderRecord(arrRecords[i]);
                        TestResult.Barcode = _clsORecord.SpecimenId.Data.Trim();
                    }
                    else if (arrFields[0].Equals(_clsQRecord.RecordType.Data))
                    {
                        _clsQRecord = new DxI800RequestInformationRecord(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);
                    }
                    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);
        }