/// <summary> /// 打开小窝牛 /// </summary> private void OpenBloodSport() { bool isOpen = true; while (isOpen) { try { if (!string.IsNullOrEmpty(SerialPortClass.CreateInstance().ComBluetooth)) { isOpen = SerialPortClass.CreateInstance().ReadComPort_Bluetooth(SerialPortClass.CreateInstance().ComBluetooth); } if (isOpen) { SerialPortClass.CreateInstance().StartThread(); isOpen = false; } } catch (Exception ex) { WatchDog.Write(@"打开小蜗牛:", ex); } Thread.Sleep(3000); } }
/// <summary> /// 获取远程申请验证token /// </summary> private void GetToken() { while (null == ConfigHelper.Cvur) { try { var request = (HttpWebRequest)WebRequest.Create(ConfigHelper.UrlDistanceString + "/token"); request.Method = "post"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; var stream = request.GetRequestStream(); using (var writer = new StreamWriter(stream)) { writer.Write("grant_type=password&username="******"&password="******" 获取远程申请验证token:", ex); } } }
private void timer_Tem_Tick(object sender, EventArgs e) { try { lb_C.ForeColor = Color.FromArgb(233, 155, 1); lb_CF.ForeColor = Color.FromArgb(233, 155, 1); string T = SerialPortClass.CreateInstance().T; if (T != "L" && T != "——" && !string.IsNullOrEmpty(T)) { if (Convert.ToDecimal(T) >= 36 && Convert.ToDecimal(T) <= 37) { lb_C.ForeColor = Color.FromArgb(2, 234, 17); lb_CF.ForeColor = Color.FromArgb(2, 234, 17); } if (Convert.ToDecimal(T) > 37) { lb_C.ForeColor = Color.FromArgb(234, 85, 3); lb_CF.ForeColor = Color.FromArgb(234, 85, 3); } } lb_C.Text = SerialPortClass.CreateInstance().T; lb_CF.Text = SerialPortClass.CreateInstance().F; } catch (Exception ex) { WatchDog.Write(@"获取温度:", ex); } }
private void timerBloodPressure_Tick(object sender, EventArgs e) { try { lb_SYS.ForeColor = Color.FromArgb(233, 155, 1); lb_DIA.ForeColor = Color.FromArgb(233, 155, 1); if (!string.IsNullOrEmpty(SerialPortClass.CreateInstance().SYS)) { if (Convert.ToInt32(SerialPortClass.CreateInstance().SYS) > 90 && Convert.ToInt32(SerialPortClass.CreateInstance().SYS) < 140) { lb_SYS.ForeColor = Color.FromArgb(2, 234, 17); } if (Convert.ToInt32(SerialPortClass.CreateInstance().SYS) >= 140) { lb_SYS.ForeColor = Color.FromArgb(234, 85, 3); } } if (!string.IsNullOrEmpty(SerialPortClass.CreateInstance().DIA)) { if (Convert.ToInt32(SerialPortClass.CreateInstance().DIA) > 60 && Convert.ToInt32(SerialPortClass.CreateInstance().DIA) < 90) { lb_DIA.ForeColor = Color.FromArgb(2, 234, 17); } if (Convert.ToInt32(SerialPortClass.CreateInstance().DIA) >= 90) { lb_DIA.ForeColor = Color.FromArgb(234, 85, 3); } } lb_SYS.Text = SerialPortClass.CreateInstance().SYS; //收缩压 lb_DIA.Text = SerialPortClass.CreateInstance().DIA; //舒张压 if (string.IsNullOrEmpty(SerialPortClass.CreateInstance().MsbCatch)) { lb_MBSCatch.Visible = false; } else { lb_MBSCatch.Visible = true; } lb_MBSCatch.Text = SerialPortClass.CreateInstance().MsbCatch; } catch (Exception ex) { WatchDog.Write(@"获取血压:", ex); } }
/// <summary> /// 在线程池中等待申请的数据 /// </summary> private void WaitAppData(object extContract) { try { if (null == ConfigHelper.Cvur) { var request = (HttpWebRequest)WebRequest.Create(ConfigHelper.UrlDistanceString + @"/token"); request.Method = "post"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; var stream = request.GetRequestStream(); using (var writer = new StreamWriter(stream)) { writer.Write("grant_type=password&username="******"&password="******"/api/AllInOne/Create", json); if (msg != null) { bool msgOk = msg.IsOk; if (msgOk) { UpdateApplicationStatus(ext.Trans.ApplicationID, "2"); SelEcgList(ext.God.PatientID); _isGetAppData = true; } else { WatchDog.WriteMsg(@"申请失败:" + msg.Content); } } } } catch (Exception ex) { WatchDog.Write(@" 待申请的数据:", ex); } }
private void timer_Spo2_Tick(object sender, EventArgs e) { try { lb_Spo2.ForeColor = Color.FromArgb(233, 155, 1); lbBloodOxygenBpm.ForeColor = Color.FromArgb(233, 155, 1); if (!string.IsNullOrEmpty(SerialPortClass.CreateInstance().Spo2)) { if (Convert.ToInt32(SerialPortClass.CreateInstance().Spo2) >= 94) { lb_Spo2.ForeColor = Color.FromArgb(2, 234, 17); } } lb_Spo2.Text = SerialPortClass.CreateInstance().Spo2; if (!string.IsNullOrEmpty(SerialPortClass.CreateInstance().Bpm)) { if (Convert.ToInt32(SerialPortClass.CreateInstance().Bpm) >= 60 && Convert.ToInt32(SerialPortClass.CreateInstance().Bpm) <= 100) { lbBloodOxygenBpm.ForeColor = Color.FromArgb(2, 234, 17); } if (Convert.ToInt32(SerialPortClass.CreateInstance().Bpm) > 100) { lbBloodOxygenBpm.ForeColor = Color.FromArgb(234, 85, 3); } } lbBloodOxygenBpm.Text = SerialPortClass.CreateInstance().Bpm; if (string.IsNullOrEmpty(SerialPortClass.CreateInstance().SpoCatch.ToString()) || SerialPortClass.CreateInstance().SpoCatch.ToString() == "——") { lb_SpoCatch.Visible = false; } else { lb_SpoCatch.Visible = true; } lb_SpoCatch.Text = SerialPortClass.CreateInstance().SpoCatch.ToString(); } catch (Exception ex) { WatchDog.Write(@"获取血氧:", ex); } }
private bool _isGetAppData = true;//是否开始获取判读结果 /// <summary> /// 获取判读结果 /// </summary> private void WaitGetAppData() { while (true) { try { if (null == ConfigHelper.Cvur) { var request = (HttpWebRequest)WebRequest.Create(ConfigHelper.UrlDistanceString + @"/token"); request.Method = "post"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; var stream = request.GetRequestStream(); using (var writer = new StreamWriter(stream)) { writer.Write("grant_type=password&username="******"&password="******"/api/AllInOne/Result", strReturn); if (null != rresult) { Msg mg = rresult.State; if (mg.IsOk) { foreach (var result in rresult.Result) { UpdateApplicationStatus(result.ContractId, "3"); UpdateApplicationDiagnosis(result.ContractId, result.BeginTime, result.Diagnosis); DataRow dr = ((DataRowView)gc_PatientManage.CurrentRow.DataBoundItem).Row; if (null != dr) { SelEcgList(dr["PatientId"].ToString()); } } } } } else { _isGetAppData = false; } } } } catch (Exception ex) { WatchDog.Write(@"获取判读结果:", ex); } Thread.Sleep(5000); } }