public override bool ExecQuery() { int num = 0; base.m_Comm.SetTimeOut(0x7530); base.m_Comm.Send(this.CommandReadStart); Thread.Sleep(500); do { num++; base.ResultData = new byte[15]; if (base.m_Comm.Recv(ref this.ResultData, 15) > 14) { string str = ""; foreach (byte num2 in base.ResultData) { string str2 = num2.ToString("X2"); str = str + str2 + " "; } ClsQCTDEVICEBC adevicebc = this; string str3 = adevicebc.AllBuffer + str; adevicebc.AllBuffer = str3; if ((base.ResultData[13] == 13) && (base.ResultData[14] == 10)) { break; } } Thread.Sleep(0x3e8); }while (num < 3); Thread.Sleep(200); base.m_Comm.Send(this.CommandClose); Thread.Sleep(200); base.m_Comm.Send(this.CommandClose); if ((this.AllBuffer == "") || (base.ResultData.Length <= 14)) { return(false); } ClsResult.DeviceName = "QCTBC"; ClsResult.DeviceFriendName = "综合数据采集仪"; ClsResult.DeviceAddress = ""; ClsResult.DeviceValue = new valueItem(); ClsResult.m_UnitList = new List <TYPEANDVALUE>(); ClsResult.m_UnitList.Clear(); ClsResult.DeviceValue.QCTBC.AllData = this.AllBuffer; ClsResult.DeviceValue.QCTBC.BarCode = base.ResultData[5].ToString() + base.ResultData[6].ToString() + base.ResultData[7].ToString() + base.ResultData[8].ToString(); byte num3 = base.ResultData[9]; TYPEANDVALUE item = new TYPEANDVALUE(); switch (num3) { case 1: ClsResult.DeviceValue.QCTBC.DataType = "幽门螺杆菌"; ClsResult.DeviceValue.QCTBC.ChildType = "幽门螺杆菌"; ClsResult.DeviceValue.QCTBC.HP_YouMen = Encoding.ASCII.GetString(base.ResultData, 10, 3).Replace('\0', ' ').Trim(); item.ChildType = "幽门螺杆菌"; item.Value = Encoding.ASCII.GetString(base.ResultData, 10, 3).Replace('\0', ' ').Trim(); ClsResult.m_UnitList.Add(item); break; case 2: { ClsResult.DeviceValue.QCTBC.DataType = "三围"; ClsResult.DeviceValue.QCTBC.ChildType = "三围"; string str4 = Convert.ToInt16(base.ResultData[10]).ToString(); ClsResult.DeviceValue.QCTBC.Xiongwei = str4; string str5 = Convert.ToInt16(base.ResultData[11]).ToString(); ClsResult.DeviceValue.QCTBC.Yaowei = str5; string str6 = Convert.ToInt16(base.ResultData[12]).ToString(); ClsResult.DeviceValue.QCTBC.Tunwei = str6; item.ChildType = "胸围"; item.Value = ClsResult.DeviceValue.QCTBC.Xiongwei; ClsResult.m_UnitList.Add(item); item.ChildType = "腰围"; item.Value = ClsResult.DeviceValue.QCTBC.Yaowei; ClsResult.m_UnitList.Add(item); item.ChildType = "臀围"; item.Value = ClsResult.DeviceValue.QCTBC.Tunwei; ClsResult.m_UnitList.Add(item); break; } case 3: ClsResult.DeviceValue.QCTBC.DataType = "身高"; ClsResult.DeviceValue.QCTBC.ChildType = "身高"; ClsResult.DeviceValue.QCTBC.Height = Convert.ToString(base.ResultData[12]).ToString(); item.ChildType = "身高"; item.Value = Convert.ToInt16(base.ResultData[12]).ToString(); ClsResult.m_UnitList.Add(item); break; default: ClsResult.DeviceValue.QCTBC.DataType = "err"; break; } ClsResult.ResultFlag = true; return(true); }
private void GetValueFromCode(string code) { TYPEANDVALUE item = new TYPEANDVALUE(); string str = code.Substring(0, code.IndexOf(":")).Trim(); string str2 = code.Substring(code.IndexOf(":") + 1, (code.Length - code.IndexOf(":")) - 1); if (str2.Contains("mmol")) { string str3 = str2.Trim(); if (str3.StartsWith("<") || str3.StartsWith(">")) { str3 = str3.Substring(1, str3.Length - 1); } string str4 = str3.Substring(0, str3.IndexOf("mmol")).Trim(); switch (str) { case "CHOL": ClsResult.DeviceValue.QCTBU.DanGuChun = str4; item.ChildType = "总胆固醇"; item.Value = str4; ClsResult.m_UnitList.Add(item); ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; case "GLUCOSE": ClsResult.DeviceValue.QCTBU.XueTang = str4; item.ChildType = "血糖"; item.Value = str4; ClsResult.m_UnitList.Add(item); ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; case "HDL CHOL": ClsResult.DeviceValue.QCTBU.GaoMiDu = str4; item.ChildType = "高密度脂蛋白"; item.Value = str4; ClsResult.m_UnitList.Add(item); ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; case "CALC LDL": ClsResult.DeviceValue.QCTBU.DiMiDu = str4; item.ChildType = "低密度脂蛋白"; item.Value = str4; ClsResult.m_UnitList.Add(item); ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; case "TRIG": ClsResult.DeviceValue.QCTBU.GanYouSanZhi = str4; item.ChildType = "甘油三酯"; item.Value = str4; ClsResult.m_UnitList.Add(item); ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; case "KETONE": ClsResult.DeviceValue.QCTBU.XueTongTi = str4; item.ChildType = "血酮体"; item.Value = str4; ClsResult.m_UnitList.Add(item); ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; case "CREAT": ClsResult.DeviceValue.QCTBU.JiGan = str4; item.ChildType = "肌酐"; item.Value = str4; ClsResult.DeviceValue.QCTBU.ChildType = item.ChildType; return; } } }