public void TerminationTest() { try { var newHeader = new DxI800TerminationRecord(); Debug.WriteLine(newHeader.Create()); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
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); } }
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()); } }
private List <string> CreateOrderFrame(List <string> orderList) { var astmBaseRecordsList = new List <AstmBaseRecord>(); var retList = new List <string>(); //Tạo Header mới var newHeaderRecord = (DxI800HeaderRecord)_clsHRecord.Clone(); //newHeaderRecord.CommentOrSpecialInstructions.Data = "TSDWN^REPLY"; newHeaderRecord.SenderNameOrId.Data = ""; // _clsHRecord.ReveiverId.Data; newHeaderRecord.ReceiverId.Data = ""; // _clsHRecord.SenderNameOrId.Data; // string sTemp = newHeaderRecord.Create(); astmBaseRecordsList.Add(newHeaderRecord); //var sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "1", newHeaderRecord.Create(), DeviceHelper.ETX); //var checksum = DeviceHelper.GetCheckSumValue(sTemp); //retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); ////Add Patient Record //_clsPRecord.SequenceNumber.Data = "1"; //_clsPRecord.PatientSex.Data = "U"; ////_clsPRecord.LaboratoryAssignedPatientId.Data = _sQBarcode; //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ả nếu có chỉ định thì xử lý chuỗi P và O //Nếu không có thì không hiển thị chuỗi P và O if ((orderList != null) && (orderList.Count != 0)) { _clsPRecord.SequenceNumber.Data = "1"; _clsPRecord.PracticeAssignedPatientID.Data = string.Format("{0}{1}", DateTime.Now.ToString("yyMMdd"), _sQBarcode); //sTemp = string.Concat(sTemp, _clsPRecord.Create()); //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)); astmBaseRecordsList.Add(_clsPRecord); //Add OrderRecord _clsORecord = new DxI800TestOrderRecord(); _clsORecord.SequenceNumber.Data = "1"; _clsORecord.SpecimenId.Data = _sQBarcode; //string[] tempIsId = _clsQRecord.StartingRangeIdNumber.Data.Split(_clsQRecord.Rules.ComponentDelimiter); //_clsORecord.InstrumentSpecimenId.Data = string.Join(_clsORecord.Rules.ComponentDelimiter.ToString(), // new[] // { // tempIsId[3], tempIsId[4], tempIsId[5], // tempIsId[6], tempIsId[7], tempIsId[8] // }); _clsORecord.UniversalTestId.Data = _clsORecord.CreateUniversalTestid(orderList); _clsORecord.Priority.Data = "R"; //_clsORecord.SpecimenCollectionDateAndTime.Data = DateTime.Now.ToString("yyyyMMddHHmmss"); //_clsORecord.DateTimeResultReportedOrLastModified.Data = DateTime.Now.ToString("yyyyMMddHHmmss"); _clsORecord.ActionCode.Data = "A"; _clsORecord.SpecimenDescriptor.Data = "Serum"; //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.ReportTypes.Data = "F"; astmBaseRecordsList.Add(_clsORecord); //sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsORecord.Create(), DeviceHelper.ETB); //sTemp = string.Concat(sTemp, _clsORecord.Create()); //checksum = DeviceHelper.GetCheckSumValue(sTemp); //retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); //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)); } _clsTRecord = new DxI800TerminationRecord { TerminationCode = { Data = "F" } }; //sTemp = string.Concat(sTemp, _clsTRecord.Create()); astmBaseRecordsList.Add(_clsTRecord); //sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "2", _clsTRecord.Create(), DeviceHelper.ETX); //checksum = DeviceHelper.GetCheckSumValue(sTemp); //retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); //else //{ // _clsORecord = new DxI800TestOrderRecord(); // _clsORecord.SequenceNumber.Data = "1"; // _clsORecord.SpecimenId.Data = _sQBarcode; // //string[] tempIsId = _clsQRecord.StartingRangeIdNumber.Data.Split(_clsQRecord.Rules.ComponentDelimiter); // //_clsORecord.InstrumentSpecimenId.Data = string.Join(_clsORecord.Rules.ComponentDelimiter.ToString(), // // new[] // // { // // tempIsId[3], tempIsId[4], tempIsId[5], // // tempIsId[6], tempIsId[7], tempIsId[8] // // }); // _clsORecord.UniversalTestId.Data = string.Empty; // _clsORecord.Priority.Data = "R"; // _clsORecord.ActionCode.Data = "A"; // _clsORecord.SpecimenDescriptor.Data = "1"; // //_clsORecord.ReportTypes.Data = "O"; // sTemp = string.Concat(sTemp, _clsORecord.Create()); // //sTemp = String.Concat(DeviceHelper.STX, "3", _clsORecord.Create(), DeviceHelper.ETB); // //checksum = DeviceHelper.GetCheckSumValue(sTemp); // //retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); // _clsTRecord = new DxI800TerminationRecord { TerminationCode = { Data = "F" } }; // sTemp = string.Concat(sTemp, _clsTRecord.Create()); // //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)); //} //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)); //} //sTemp = String.Concat(DeviceHelper.STX,"1", sTemp, DeviceHelper.ETX); //checksum = DeviceHelper.GetCheckSumValue(sTemp); //Log.Debug("Checksum:"+checksum); //string orderFrame = String.Concat(sTemp, checksum, DeviceHelper.CRLF); //Log.Debug("Order frame1: <"+ orderFrame); retList = CreateEachRecord(astmBaseRecordsList, DeviceHelper.ETX); return(retList); }