Esempio n. 1
0
        private void  除选中记录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listBox1.Items.Count > 0)
            {
                if (listBox1.SelectedIndex >= 0)
                {
                    if (XtraMessageBox.Show(@"是否确定删除选中的参考记录?", @"删除提示:", MessageBoxButtons.OKCancel,
                                            MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        if (!richTextBox1.ReadOnly)
                        {
                            DateTime shotTime = Convert.ToDateTime(listBox1.SelectedItem.ToString());
                            string   delSql   = "DELETE FROM Tb_Snapshot WHERE ApplicationID='" + _applicationId + "' AND SnapshotTime='" + shotTime.ToString("s") + "'";


                            _sqHelper.SqliteDelete(delSql);

                            richTextBox1.Text = string.Empty;
                            lblMsg.Text       = @"提示:";
                            BindSnapInfo();//绑定参考记录信息
                            if (listBox1.Items.Count > 0)
                            {
                                listBox1.SelectedIndex = 0;
                                listBox1_Click(null, null);
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show(@"非本地判读不能删除!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else
                {
                    XtraMessageBox.Show(@"未选中任何参考记录!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else
            {
                XtraMessageBox.Show(@"您还没有添加任何参考记录,删除操作无效!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 保存心电数据
        /// </summary>
        private void SaveEcgData()
        {
            _dCount++;
            var pm = new PermissionModel();

            for (int i = 1; i < pace_makingOptions.Pacing_signal_list.Count - 2; i++)
            {
                if (pace_makingOptions.Pacing_signal_list[i] == 1 && pace_makingOptions.Pacing_signal_list[i - 1] != 1)
                {
                    _paceCount++;
                }

                if (pace_makingOptions.Pacing_signal_list[i] == 1)
                {
                    _totPaceCount++;
                }
            }
            if (_paceCount > 0 && _totPaceCount > 0)
            {
                _isQiBo = "1";
            }
            _paceCount    = 0;
            _totPaceCount = 0;
            try
            {
                _ecgDataDicAfterFilter = serialPortOption.CreateInstance().EcgData_Dic_AfterFilter;
            }
            catch
            {
                _ecgDataDicAfterFilter = serialPortOption.CreateInstance().EcgData_Dic;
            }
            int ecgCount = (_ecgDataDicAfterFilter.Count > 0 ? _ecgDataDicAfterFilter[0].Count : 0);

            try
            {
                for (int leadIndex = 0; leadIndex < 12; leadIndex++)
                {
                    var leadEcgData = new List <float>();
                    for (int i = 0; i < ecgCount; i++)
                    {
                        if (serialPortOption.CreateInstance().EcgData_Dic_AfterFilter.Count > 0 && i < _ecgDataDicAfterFilter[leadIndex].Count)
                        {
                            leadEcgData.Add(_ecgDataDicAfterFilter[leadIndex][i]);
                        }
                    }
                    pm.Add(leadIndex, leadEcgData);
                }
            }
            catch (Exception ex)
            {
            }
            byte[] hospitalTel = pm.Compress(pm.Dict); string ednPathDir = Application.StartupPath + "\\ECG_DATA_NEW";
            if (!Directory.Exists(ednPathDir))
            {
                Directory.CreateDirectory(ednPathDir);
            }
            try
            {
                var fs = new FileStream(ednPathDir + "\\" + ConfigHelper.AppId + "_0", FileMode.CreateNew, FileAccess.Write);
                var bw = new BinaryWriter(fs, Encoding.UTF8);
                bw.Write(hospitalTel);
                bw.Close();
                //fs.Close();
            }
            catch (Exception ex)
            {
            }
            _filter = "低通:75Hz";

            var pLocs = new StringBuilder();

            for (int k = 0; k < serialPortOption.CreateInstance().PaceLocs.Count; k++)
            {
                serialPortOption.CreateInstance().PaceLocs[k] = serialPortOption.CreateInstance().PaceLocs[k] + serialPortOption.CreateInstance().PaceOffset;
                if (serialPortOption.CreateInstance().PaceLocs[k] < 2500)
                {
                    serialPortOption.CreateInstance().PaceLocs.RemoveAt(k);
                }
                else
                {
                    pLocs.Append(serialPortOption.CreateInstance().PaceLocs[k] - 2500).Append(",");
                }
            }
            string strdel       = "delete from data_packs where ApplicationID='" + ConfigHelper.AppId + "'";
            string strsql       = "insert into data_packs (ApplicationID,beginTime,dataSizePerLead,EcgFilter,isLead,LeadEndTime,paceLocs) values ('" + ConfigHelper.AppId + "','" + _beginCollectTime + "','" + Dataperlead + "','" + _filter + "','0','" + _endCollectTime + "','" + pLocs.ToString().TrimEnd(',') + "') ";
            string strsqlUpdate = "update tb_patientinfo set IsQiBo='" + _isQiBo + "' where PatientID='" + _patientId + "'";

            //执行SQL语句,将数据插入表中
            try
            {
                if (hospitalTel.Length > 0)
                {
                    _sqlite.SqliteDelete(strdel);
                    _sqlite.SqliteAdd(strsql);
                    _sqlite.SqliteUpdate(strsqlUpdate);
                }
                serialPortOption.CreateInstance().PaceLocs.Clear();
            }
            catch (Exception ex)
            {
            }
        }