예제 #1
0
 public ImmuliteXpiManager()
 {
     try
     {
         _clsHRecord = new ImmuliteXpiHeaderRecord();
         _clsPRecord = new ImmuliteXpiPatientInformationRecord();
         _clsORecord = new ImmuliteXpiTestOrderRecord();
         _clsQRecord = new ImmuliteXpiRequestInformationRecord();
         _clsRRecord = new ImmuliteXpiResultRecord();
         _clsTRecord = new ImmuliteXpiTerminationRecord();
     }
     catch (Exception ex)
     {
         Log.Error("Fatal Error: {0}", ex);
     }
 }
예제 #2
0
        private List <string> CreateOrderFrame(List <string> orderList, string patientName)
        {
            var retList = new List <string>();

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

            newHeaderRecord.SenderNameOrId.Data = _clsHRecord.ReceiverID.Data;
            newHeaderRecord.ReceiverID.Data     = _clsHRecord.SenderNameOrId.Data;
            newHeaderRecord.CurrentDate.Data    = DateTime.Now.ToString("yyyyMMddHHmmss");

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

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

            //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.PracticeAssignedPatientID.Data = string.Format("{0}{1}", DateTime.Now.ToString("yyMMdd"),
                                                                       _sQBarcode);
            _clsPRecord.Birthdate.Data   = "20000101";
            _clsPRecord.PatientName.Data = string.Format("{0}^^", patientName);
            _clsPRecord.PatientSex.Data  = "M";

            sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "2", _clsPRecord.Create(), DeviceHelper.ETB);
            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 OrderRecord
                _clsORecord = new ImmuliteXpiTestOrderRecord();
                _clsORecord.SequenceNumber.Data = "1";
                //_clsORecord.SpecimenId.Data = string.Format("{0}{1}",DateTime.Now.ToString("yyMMdd"),_sQBarcode);
                _clsORecord.SpecimenId.Data                    = string.Format("{0}", _sQBarcode);
                _clsORecord.RequestedDateAndTime.Data          = DateTime.Now.ToString("yyyyMMddHHmmss");
                _clsORecord.SpecimenCollectionDateAndTime.Data = DateTime.Now.ToString("yyyyMMddHHmmss");
                _clsORecord.UniversalTestId.Data               = _clsORecord.CreateUniversalTestid(orderList);
                sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsORecord.Create(), DeviceHelper.ETB);
                checksum = DeviceHelper.GetCheckSumValue(sTemp);
                retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));

                _clsTRecord = new ImmuliteXpiTerminationRecord {
                    TerminationCode = { Data = "F" }
                };
                sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "4", _clsTRecord.Create(), DeviceHelper.ETX);
                checksum = DeviceHelper.GetCheckSumValue(sTemp);
                retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));
            }
            else
            {
                _clsTRecord = new ImmuliteXpiTerminationRecord {
                    TerminationCode = { Data = "F" }
                };
                sTemp    = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsTRecord.Create(), DeviceHelper.ETX);
                checksum = DeviceHelper.GetCheckSumValue(sTemp);
                retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF));
            }
            return(retList);
        }