예제 #1
0
 public CI4100Manager()
 {
     try
     {
         _clsHRecord = new CI4100HeaderRecord();
         _clsPRecord = new CI4100PatientInformationRecord();
         _clsORecord = new CI4100TestOrderRecord();
         _clsQRecord = new CI4100RequestInformationRecord();
         _clsRRecord = new CI4100ResultRecord();
         _clsTRecord = new CI4100TerminationRecord();
     }
     catch (Exception ex)
     {
         Log.Error("Fatal Error: {0}", ex);
     }
 }
예제 #2
0
 public void HeaderTest()
 {
     try
     {
         const string rawHeader = @"H|\^&||||||||||P|1";
         var          oldHeader = new CI4100HeaderRecord();
         oldHeader.Parse(rawHeader);
         //h.Parse(rawHeader);
         Debug.WriteLine(oldHeader.RecordType);
         var newHeader = new CI4100HeaderRecord();
         Debug.WriteLine(newHeader.Create());
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
 }
예제 #3
0
        private List <string> CreateOrderFrame(List <string> orderList)
        {
            var retList = new List <string>();

            //Tạo Header mới
            var newHeaderRecord = new CI4100HeaderRecord();

            string sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "1", newHeaderRecord.Create(),
                                         DeviceHelper.ETX);
            string checksum = DeviceHelper.GetCheckSumValue(sTemp);

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

            //Xử lý kết quả
            if ((orderList != null) && (orderList.Count != 0))
            {
                //Add Patient Record
                _clsPRecord.SequenceNumber.Data = "1";
                if (_patientName.Length > 20)
                {
                    _patientName = _patientName.Substring(_patientName.Length - 20);
                }
                _clsPRecord.PatientName.Data = string.Format("{0}^^", _patientName.Trim());
                //_clsPRecord.PatientSex.Data = "U";
                //_clsPRecord.LaboratoryAssignedPatientId.Data = _sQBarcode;

                sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "2", _clsPRecord.Create(), DeviceHelper.ETX);

                checksum = DeviceHelper.GetCheckSumValue(sTemp);
                retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));

                if (orderList.Count > 20)
                {
                    List <string> firstOrderList = orderList.GetRange(0, 20);
                    List <string> restOrderList  = orderList.GetRange(20, orderList.Count - 20);
                    //Add OrderRecord
                    _clsORecord = new CI4100TestOrderRecord();

                    _clsORecord.SpecimenId.Data = _sQBarcode;


                    //_clsORecord.SpecimenCollectionDateAndTime.Data = DateTime.Now.ToString("yyyyMMddHHmmss");

                    _clsORecord.ActionCode.Data = "A";

                    _clsORecord.ReportTypes.Data = "Q";

                    _clsORecord.SequenceNumber.Data = "1";

                    _clsORecord.UniversalTestId.Data = _clsORecord.CreateUniversalTestid(firstOrderList);

                    sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsORecord.Create(), DeviceHelper.ETX);
                    checksum = DeviceHelper.GetCheckSumValue(sTemp);
                    retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));

                    _clsORecord.SequenceNumber.Data = "2";

                    _clsORecord.UniversalTestId.Data = _clsORecord.CreateUniversalTestid(restOrderList);

                    sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "4", _clsORecord.Create(), DeviceHelper.ETX);
                    checksum = DeviceHelper.GetCheckSumValue(sTemp);
                    retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));

                    _clsTRecord = new CI4100TerminationRecord();
                    sTemp       = String.Concat(DeviceHelper.STX, "5", _clsTRecord.Create(), DeviceHelper.ETX);
                    checksum    = DeviceHelper.GetCheckSumValue(sTemp);
                    retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));
                }
                else
                {
                    //Add OrderRecord
                    _clsORecord = new CI4100TestOrderRecord();
                    _clsORecord.SequenceNumber.Data = "1";
                    _clsORecord.SpecimenId.Data     = _sQBarcode;


                    _clsORecord.UniversalTestId.Data = _clsORecord.CreateUniversalTestid(orderList);

                    //_clsORecord.SpecimenCollectionDateAndTime.Data = DateTime.Now.ToString("yyyyMMddHHmmss");

                    _clsORecord.ActionCode.Data = "A";

                    _clsORecord.ReportTypes.Data = "Q";

                    sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsORecord.Create(), DeviceHelper.ETX);
                    checksum = DeviceHelper.GetCheckSumValue(sTemp);
                    retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));

                    _clsTRecord = new CI4100TerminationRecord();
                    sTemp       = String.Concat(DeviceHelper.STX, "4", _clsTRecord.Create(), DeviceHelper.ETX);
                    checksum    = DeviceHelper.GetCheckSumValue(sTemp);
                    retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));
                }
            }
            else
            {
                _clsQRecord = new CI4100RequestInformationRecord
                {
                    StatusCode      = new AstmField(12, @"X"),
                    SequenceNumber  = new AstmField(1, "1"),
                    IDNumber        = new AstmField(2, string.Format(@"^{0}", _sQBarcode)),
                    UniversalTestId = new AstmField(4, "^^^ALL")
                };
                sTemp    = String.Concat(DeviceHelper.STX, "2", _clsQRecord.Create(), DeviceHelper.ETX);
                checksum = DeviceHelper.GetCheckSumValue(sTemp);
                retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));

                _clsTRecord = new CI4100TerminationRecord();
                sTemp       = String.Concat(DeviceHelper.STX, "3", _clsTRecord.Create(), DeviceHelper.ETX);
                checksum    = DeviceHelper.GetCheckSumValue(sTemp);
                retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));
            }

            return(retList);
        }