예제 #1
0
        /// <summary>
        /// 获取E100----COM串口
        /// </summary>
        /// <returns></returns>
        public static List <string> GetHljwComs()
        {
            var sesarcher = new ManagementObjectSearcher("select * from Win32_SerialPort");

            var coms = (from ManagementObject mo in sesarcher.Get() let p = mo.Properties["DeviceID"].Value.ToString() let name = mo.Properties["Caption"].Value.ToString() where name.Contains("YJL USB Driver") select p).ToList();

            WatchDog.WriteMsg("Com数量:" + coms.Count);
            int com1 = 3;
            int com2 = 4;

            if (coms.Count >= 2)
            {
                try
                {
                    com1 = Convert.ToInt32(coms[0].Substring(coms[0].LastIndexOf('M') + 1).TrimEnd(')'));
                    com2 = Convert.ToInt32(coms[1].Substring(coms[1].LastIndexOf('M') + 1).TrimEnd(')'));
                }
                catch (Exception ex)
                {
                    WatchDog.Fatal("系统异常1:" + ex.StackTrace + "\r\n" + ex.InnerException, ex);
                }
                WatchDog.WriteMsg("Com1数量:" + com1);
                CommandComPortOrEcgDataComPort(com1, com2);
            }
            return(coms);
        }
예제 #2
0
 static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
 {
     WatchDog.WriteMsg("系统异常3StackTrace:" + e.Exception.StackTrace);
     WatchDog.WriteMsg("系统异常3Source:" + e.Exception.Source);
     WatchDog.WriteMsg("系统异常3TargetSite:" + e.Exception.TargetSite);
     WatchDog.WriteMsg("系统异常3ToString:" + e.Exception.ToString());
     WatchDog.WriteMsg("系统异常3Message:" + e.Exception.Message);
     WatchDog.WriteMsg("系统异常3InnerException:" + e.Exception.InnerException);
 }
예제 #3
0
 /// <summary>
 /// 添加患者信息
 /// </summary>
 /// <param name="patientMd"></param>
 /// <returns></returns>
 public bool PatientInfo_Add(PatientMd patientMd)
 {
     try
     {
         const string sql = "insert into Tb_PatientInfo (ID,PatientID,PatientName,Gender,Birthday,P_Id,CreateDate,Folk,Address,Agency,ExpireStart,ExpireEnd,DoctorId,WorkUnits,Phone,Levelofeducation,Marriage,PermanentType,BloodType,SleepStatus,Drinking,Professional,PhysicalExercise,Height,Waistline,Hipline,Weight,DisabilityStatus,Allergy,ExposureHistory,DiseasesHistory,OperationHistory,RtaumaHistory,TransfusionHistory)" +
                            "Values(@ID,@PatientID,@PatientName,@Gender,@Birthday,@P_Id,datetime('now', 'localtime'),@Folk,@Address,@Agency,@ExpireStart,@ExpireEnd,@DoctorId,@WorkUnits,@Phone,@Levelofeducation,@Marriage,@PermanentType,@BloodType,@SleepStatus,@Drinking,@Professional,@PhysicalExercise,@Height,@Waistline,@Hipline,@Weight,@DisabilityStatus,@Allergy,@ExposureHistory,@DiseasesHistory,@OperationHistory,@RtaumaHistory,@TransfusionHistory)";
         var ls = new List <SQLiteParameter>
         {
             new SQLiteParameter("@ID", Guid.NewGuid().ToString()),
             new SQLiteParameter("@PatientID", patientMd.PatientID),
             new SQLiteParameter("@PatientName", patientMd.PatientName),
             new SQLiteParameter("@Gender", patientMd.Gender),
             new SQLiteParameter("@Birthday", patientMd.Birthday),
             new SQLiteParameter("@P_Id", patientMd.P_Id),
             new SQLiteParameter("@Folk", patientMd.Folk),
             new SQLiteParameter("@Address", patientMd.Address),
             new SQLiteParameter("@Agency", patientMd.Agency),
             new SQLiteParameter("@ExpireStart", patientMd.ExpireStart),
             new SQLiteParameter("@ExpireEnd", patientMd.ExpireEnd),
             new SQLiteParameter("@DoctorId", ConfigHelper.LoginId),
             new SQLiteParameter("@WorkUnits", patientMd.WorkUnits),
             new SQLiteParameter("@Phone", patientMd.Phone),
             new SQLiteParameter("@Levelofeducation", patientMd.Levelofeducation),
             new SQLiteParameter("@Marriage", patientMd.Marriage),
             new SQLiteParameter("@PermanentType", patientMd.PermanentType),
             new SQLiteParameter("@BloodType", patientMd.BloodType),
             new SQLiteParameter("@SleepStatus", patientMd.SleepStatus),
             new SQLiteParameter("@Drinking", patientMd.Drinking),
             new SQLiteParameter("@Professional", patientMd.Professional),
             new SQLiteParameter("@PhysicalExercise", patientMd.PhysicalExercise),
             new SQLiteParameter("@Height", patientMd.Height),
             new SQLiteParameter("@Waistline", patientMd.Waistline),
             new SQLiteParameter("@Hipline", patientMd.Hipline),
             new SQLiteParameter("@Weight", patientMd.Weight),
             new SQLiteParameter("@DisabilityStatus", patientMd.DisabilityStatus),
             new SQLiteParameter("@Allergy", patientMd.Allergy),
             new SQLiteParameter("@ExposureHistory", patientMd.ExposureHistory),
             new SQLiteParameter("@DiseasesHistory", patientMd.DiseasesHistory),
             new SQLiteParameter("@OperationHistory", patientMd.OperationHistory),
             new SQLiteParameter("@RtaumaHistory", patientMd.RtaumaHistory),
             new SQLiteParameter("@TransfusionHistory", patientMd.TransfusionHistory)
         };
         WatchDog.WriteMsg(DateTime.Now + "==添加患者:" + patientMd.PatientName);
         _sqlite.ExecuteSql(sql, ls.ToArray());
         ls.Clear();
         return(true);
     }
     catch (Exception ex)
     {
         WatchDog.WriteMsg(DateTime.Now + "==添加患者失败:" + patientMd.PatientName + ex.StackTrace);
         return(false);
     }
 }
예제 #4
0
 /// <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);
     }
 }
예제 #5
0
        public void CaiJi()
        {
            _listPort = Program.GetHljwComs();//获取端口Port
            bool isOk = false;

            if (_listPort.Count == 2)
            {
                try
                {
                    WatchDog.WriteMsg(DateTime.Now + "==开始初始化滤波:" + (ConfigHelper.BASE_HZ | ConfigHelper.MC_HZ | ConfigHelper.AC_HZ | ConfigHelper.LP_HZ));
                    serialPortOption.CreateInstance().filterPara_Init(ConfigHelper.BASE_HZ | ConfigHelper.MC_HZ | ConfigHelper.AC_HZ | ConfigHelper.LP_HZ); //初始化滤波
                    WatchDog.WriteMsg(DateTime.Now + "==结束初始化滤波:");
                    serialPortOption.CreateInstance().IsClear = true;                                                                                       // 一个患者结束心电数据采集后,清理临时数据
                    serialPortOption.CreateInstance().IniserialPortOption();
                    serialPortOption.CreateInstance().StartEcgDataReadThread();                                                                             //启动数据读取线程
                    isOk = serialPortOption.CreateInstance().writeStartAD_Command();                                                                        //下发AD采集命令
                    WatchDog.WriteMsg(DateTime.Now + "==点击采集按钮结束:");
                }
                catch (Exception ex)
                {
                    WatchDog.WriteMsg("设备异常3" + ex.StackTrace);
                    XtraMessageBox.Show("设备异常,请您按以下提示进行操作:\r\n\r\n①请退出系统,先插入设备,再打开系统\r\n\r\n②如果第①条操作不成功,请您退出系统以后,重新插拔一下设备,然后再打开系统\r\n\r\n③如果第②条操作不成功,请重新启动您的电脑,即可恢复\r\n\r\n④如果以上措施均不成功,请更换USB的插入口,再进行以上操作\r\n\r\n⑤如果以上4条还不能解决,请联系懿加乐通信科技(北京)有限公司技术支持:400-010-2568", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            if (isOk)
            {
                string ptientId      = ConfigHelper.PatientId;
                string patientName   = ConfigHelper.PatientName;
                string patientGender = ConfigHelper.PatientGender;
                string patientAge    = ConfigHelper.PatientAge;
                var    egf           = new EcgGatherFrm(ptientId, patientName, patientGender, patientAge)
                {
                    TopMost = true, FormBorderStyle = FormBorderStyle.None
                };
                egf.Show();
                WatchDog.WriteMsg(DateTime.Now + "==采集患者心电数据:" + patientName + "&&PtientId" + ptientId);
            }
            else
            {
                WatchDog.WriteMsg(DateTime.Now + "==下发停止命令失败返回值为false:");
            }
        }
예제 #6
0
        /// <summary>
        /// 修改信息
        /// </summary>
        /// <param name="patientMd"></param>
        /// <returns></returns>
        public bool PatientInfo_Mod(PatientMd patientMd)
        {
            try
            {
                const string sql = "update Tb_PatientInfo set  WorkUnits=@WorkUnits,Phone=@Phone,Levelofeducation=@Levelofeducation,Marriage=@Marriage,PermanentType=@PermanentType,BloodType=@BloodType,SleepStatus=@SleepStatus,Drinking=@Drinking,Professional=@Professional,PhysicalExercise=@PhysicalExercise,Height=@Height,Waistline=@Waistline,Hipline=@Hipline,Weight=@Weight,DisabilityStatus=@DisabilityStatus,Allergy=@Allergy,ExposureHistory=@ExposureHistory,DiseasesHistory=@DiseasesHistory,OperationHistory=@OperationHistory,RtaumaHistory=@RtaumaHistory,TransfusionHistory=@TransfusionHistory where PatientID=@PatientID";

                var ls = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@PatientID", patientMd.PatientID),
                    new SQLiteParameter("@WorkUnits", patientMd.WorkUnits),
                    new SQLiteParameter("@Phone", patientMd.Phone),
                    new SQLiteParameter("@Levelofeducation", patientMd.Levelofeducation),
                    new SQLiteParameter("@Marriage", patientMd.Marriage),
                    new SQLiteParameter("@PermanentType", patientMd.PermanentType),
                    new SQLiteParameter("@BloodType", patientMd.BloodType),
                    new SQLiteParameter("@SleepStatus", patientMd.SleepStatus),
                    new SQLiteParameter("@Drinking", patientMd.Drinking),
                    new SQLiteParameter("@Professional", patientMd.Professional),
                    new SQLiteParameter("@PhysicalExercise", patientMd.PhysicalExercise),
                    new SQLiteParameter("@Height", patientMd.Height),
                    new SQLiteParameter("@Waistline", patientMd.Waistline),
                    new SQLiteParameter("@Hipline", patientMd.Hipline),
                    new SQLiteParameter("@Weight", patientMd.Weight),
                    new SQLiteParameter("@DisabilityStatus", patientMd.DisabilityStatus),
                    new SQLiteParameter("@Allergy", patientMd.Allergy),
                    new SQLiteParameter("@ExposureHistory", patientMd.ExposureHistory),
                    new SQLiteParameter("@DiseasesHistory", patientMd.DiseasesHistory),
                    new SQLiteParameter("@OperationHistory", patientMd.OperationHistory),
                    new SQLiteParameter("@RtaumaHistory", patientMd.RtaumaHistory),
                    new SQLiteParameter("@TransfusionHistory", patientMd.TransfusionHistory)
                };
                WatchDog.WriteMsg(DateTime.Now + "==修改患者:" + patientMd.PatientName);
                _sqlite.ExecuteSql(sql, ls.ToArray());
                ls.Clear();
                return(true);
            }
            catch (Exception ex)
            {
                WatchDog.WriteMsg(DateTime.Now + "==修改患者失败:" + patientMd.PatientName + ex.StackTrace);
                return(false);
            }
        }
예제 #7
0
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     WatchDog.WriteMsg("系统异常4:" + (e.ExceptionObject as Exception).StackTrace);
 }
예제 #8
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Print_Click(object sender, EventArgs e)
        {
            string udSql = "UPDATE Tb_Application set InterpretationStatus='已打印' WHERE ApplicationID='" + _applicationId + "'";

            if (ConfigHelper.DB_SIGN == 0)
            {
                _sqHelper.SqliteUpdate(udSql);
            }


            if (_ecgDataDicAfterFilter.Count <= 0)
            {
                XtraMessageBox.Show(@"未发现任何心电数据不能进行打印!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (_isFastPrint)
            {
                WatchDog.WriteMsg(DateTime.Now + @"快速打印患者:" + label2.Text);
            }
            else
            {
                WatchDog.WriteMsg(DateTime.Now + @"普通打印患者:" + label2.Text);
            }

            Image  image = richTextBox1.ReadOnly ? _electronicSignatureRemote : _electronicSignature;
            string address;

            if (richTextBox1.ReadOnly)
            {
                address = _remoteAddress;
            }
            else
            {
                address = _localAddress;
            }
            int tempValue = ConfigHelper.PrintSampleRate;

            if (_isQiBo == "1")
            {
                ConfigHelper.PrintSampleRate = 1000;
            }
            GetEcgViewDataImage(image, address);

            ConfigHelper.PrintSampleRate = tempValue;
            _bitArray.Add(_sourceCegBmp);//将画好的高精度心电图保存到列表中
            _sourceCegBmp.Save(Application.StartupPath + "\\ECGImage\\" + _idStr + ".jpg", ImageFormat.Jpeg);
            try
            {
                var pd1 = new PrintDocument
                {
                    DefaultPageSettings = { Landscape = true, Margins = { Top = 0, Left = 0, Right = 0, Bottom = 0 } }
                };
                pd1.PrintPage += pd1_PrintPage;
                pd1.Print();
            }
            catch
            {
                XtraMessageBox.Show(@"打印失败,请稍后重试:\r\n\r\n①请确保已经安装了打印机\r\n\r\n②检查打印机是否开机,纸张油墨是否充足\r\n\r\n③如果打印机工作正常而打印失败,您还可以联系我们!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }


            if (_ecgBitMap != null)
            {
                _ecgBitMap.Dispose();
            }
            if (!_isApped)
            {
                listBox1_Click(null, null);
            }
        }
예제 #9
0
        private void gc_PatientManage_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            if (gc_PatientManage.RowCount > 0)
            {
                _rowIndex = e.RowIndex;
                DataRow dr        = ((DataRowView)gc_PatientManage.Rows[e.RowIndex].DataBoundItem).Row;
                string  patientId = string.Empty;
                if (null != dr)
                {
                    patientId               = dr["PatientID"].ToString();
                    qrCodePatientId.Text    = @"YJL-" + patientId;
                    qrCodePatientId.Visible = true;
                }
                #region  除
                if (gc_PatientManage.Columns[e.ColumnIndex] == DeletePatient)
                {
                    if (gc_EcgList.RowCount > 0)
                    {
                        bool status = Check_App_status(patientId);
                        if (status)
                        {
                            XtraMessageBox.Show(@"此患者已有关联信息,不允许删除!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }

                    if (XtraMessageBox.Show(@"是否确定删除选中的患者?", @"患者删除提示:", MessageBoxButtons.OKCancel,
                                            MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        var sqls = new string[6];
                        sqls[0] = "DELETE FROM data_packs WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')";
                        sqls[1] = "DELETE FROM Tb_Snapshot WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')";
                        sqls[2] = "DELETE FROM AutoDiagnosis WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')";
                        sqls[3] = "delete from Tb_ReportTitle where ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')";
                        sqls[4] = "DELETE FROM tb_Application WHERE PatientID='" + patientId + "'";
                        sqls[5] = "DELETE FROM Tb_PatientInfo WHERE PatientID='" + patientId + "'";
                        WatchDog.WriteMsg(DateTime.Now + "==删除数据:" + dr["PatientName"] + ",患者ID:" + patientId);

                        DataTable tbl       = _sqlite.ExcuteSqlite("SELECT * FROM data_packs WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')");
                        bool      isSuccess = _sqlite.SqliteExecuteNonQuery(sqls);
                        if (isSuccess)
                        {
                            if (tbl != null && tbl.Rows.Count > 0)
                            {
                                string ednPathDir = Application.StartupPath + "\\ECG_DATA_NEW";
                                for (int j = 0; j < tbl.Rows.Count; j++)
                                {
                                    if (tbl.Rows[j]["pureData"] == DBNull.Value)
                                    {
                                        try
                                        {
                                            File.Delete(ednPathDir + "\\" + tbl.Rows[j]["ApplicationID"].ToString() + "_" + tbl.Rows[j]["isLead"].ToString());
                                        }
                                        catch
                                        { }
                                    }
                                }
                            }
                        }
                        var pIndex = (int)Math.Ceiling(Convert.ToDouble(_recordCount) / ConfigHelper.PAGE_SIZE);
                        if (_recordCount % ConfigHelper.PAGE_SIZE == 0 && wp.PageIndex == pIndex)
                        {
                            if (wp.PageIndex > 1)
                            {
                                wp.PageIndex = wp.PageIndex - 1;
                            }
                        }
                        gc_EcgList.DataSource = null;
                        wp.Bind();


                        txtID.Text = string.Empty;
                        //XtraMessageBox.Show("患者信息删除成功!");
                        qrCodePatientId.Visible = false;
                    }
                    if (gc_PatientManage.RowCount > 0)
                    {
                        gc_PatientManage.CurrentCell = gc_PatientManage.Rows[e.RowIndex].Cells[0];
                    }
                }
                #endregion

                #region 绑定右侧历史数据

                if (gc_PatientManage.Columns[e.ColumnIndex] != EcgGather &&
                    gc_PatientManage.Columns[e.ColumnIndex] != EditPatient &&
                    gc_PatientManage.Columns[e.ColumnIndex] != DeletePatient)
                {
                    SelEcgList(patientId);
                }

                #endregion

                #region 公共卫生信息
                if (gc_PatientManage.Columns[e.ColumnIndex] == EditPatient)
                {
                    if (dr != null)
                    {
                        string pId = dr["PatientID"].ToString();
                        var    pif = new PatientInfoForm(pId)
                        {
                            WindowState = FormWindowState.Maximized
                        };
                        pif.ShowDialog();
                    }
                    gc_PatientManage.CurrentCell = gc_PatientManage.Rows[e.RowIndex].Cells[0];
                }
                #endregion
            }
            else
            {
                gc_EcgList.DataSource = null;
            }
        }