Пример #1
0
 public void HeaderTest()
 {
     try
     {
         const string rawHeader = @"H|\^&|||BS800^01.03.07.03^123456|||||||PR|1394-97|20090910102501";
         var          oldHeader = new Bs800HeaderRecord();
         oldHeader.Parse(rawHeader);
         //h.Parse(rawHeader);
         Debug.WriteLine(oldHeader.RecordType);
         var newHeader = (Bs800HeaderRecord)oldHeader.Clone();
         Debug.WriteLine(newHeader.Create());
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
 }
Пример #2
0
        private List <string> CreateOrderFrame(List <string> orderList, string patientName)
        {
            var retList = new List <string>();

            //Tạo Header mới
            var newHeaderRecord = (Bs800HeaderRecord)_clsHRecord.Clone();

            newHeaderRecord.SenderNameOrId.Data = "LIS^^"; // _clsHRecord.ReveiverId.Data;
            newHeaderRecord.ProcessingId.Data   = "QA";
            newHeaderRecord.CurrentDate.Data    = DateTime.Now.ToString("yyyyMMddHHmmss");

            string sTemp = newHeaderRecord.Create();

            _clsPRecord.SequenceNumber.Data = "1";

            //Todo: TestOnly
            //_clsPRecord.PatientId.Data = "0003";
            //_clsPRecord.PatientName.Data = "NGUYEN VAN A^^";
            //_clsPRecord.PatientSex.Data = "U";
            _clsPRecord.PatientId.Data   = _sQBarcode;
            _clsPRecord.PatientName.Data = string.Format("{0}^^", patientName);
            _clsPRecord.PatientSex.Data  = "U";
            sTemp = string.Concat(sTemp, _clsPRecord.Create());

            //Xử lý kết quả )
            if ((orderList != null) && (orderList.Count != 0))
            {
                //Add OrderRecord
                _clsORecord = new Bs800TestOrderRecord();
                _clsORecord.SequenceNumber.Data                = "1";
                _clsORecord.InstrumentSpecimenId.Data          = _sQBarcode;
                _clsORecord.SampleId.Data                      = _sQBarcode;
                _clsORecord.UniversalTestId.Data               = _clsORecord.CreateUniversalTestid(orderList);
                _clsORecord.Priority.Data                      = "R";
                _clsORecord.ReportTypes.Data                   = "Q";
                _clsORecord.RequestedDateAndTime.Data          = DateTime.Now.ToString("yyyyMMddHHmmss");
                _clsORecord.SpecimenCollectionDateAndTime.Data = _clsORecord.RequestedDateAndTime.Data;
                sTemp       = string.Concat(sTemp, _clsORecord.Create());
                _clsTRecord = new Bs800TerminationRecord();
                sTemp       = string.Concat(sTemp, _clsTRecord.Create());
            }
            else
            {
                _clsORecord = new Bs800TestOrderRecord();
                _clsORecord.SequenceNumber.Data                = "1";
                _clsORecord.InstrumentSpecimenId.Data          = _sQBarcode;
                _clsORecord.SampleId.Data                      = _sQBarcode;
                _clsORecord.UniversalTestId.Data               = "";
                _clsORecord.Priority.Data                      = "R";
                _clsORecord.ReportTypes.Data                   = "Q";
                _clsORecord.RequestedDateAndTime.Data          = DateTime.Now.ToString("yyyyMMddHHmmss");
                _clsORecord.SpecimenCollectionDateAndTime.Data = _clsORecord.RequestedDateAndTime.Data;
                sTemp       = string.Concat(sTemp, _clsORecord.Create());
                _clsTRecord = new Bs800TerminationRecord {
                    TerminationCode = { Data = "I" }
                };
                sTemp = string.Concat(sTemp, _clsTRecord.Create());
            }

            //// Bỏ qua đoạn kiểm tra độ dài của chuỗi

            //if (sTemp.Length > 240)
            //{
            //    string sTempFirst = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "1", sTemp.Substring(0, 240),
            //                                      DeviceHelper.ETB);
            //    string checksum = DeviceHelper.GetCheckSumValue(sTempFirst);
            //    retList.Add(string.Format("{0}{1}{2}", sTempFirst, checksum, DeviceHelper.CRLF));
            //    string sTempSecond = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "2", sTemp.Substring(240),
            //                                       DeviceHelper.ETX);
            //    checksum = DeviceHelper.GetCheckSumValue(sTempSecond);
            //    retList.Add(string.Format("{0}{1}{2}", sTempSecond, checksum, DeviceHelper.CRLF));
            //}
            //else
            //{
            string sTempFirst = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "1", sTemp, DeviceHelper.ETX);
            string checksum   = DeviceHelper.GetCheckSumValue(sTempFirst);

            retList.Add(string.Format("{0}{1}{2}", sTempFirst, checksum, DeviceHelper.CRLF));
            //}

            return(retList);
        }