Ejemplo n.º 1
0
        private string GetRecPaperRemoteDir(RecPaper recPaperInfo)
        {
            //链接病人根目录
            StringBuilder ftpPath = new StringBuilder();

            ftpPath.Append("/RECPAPER");

            if (recPaperInfo == null || recPaperInfo.PATIENT_ID == null)
            {
                return(ftpPath.ToString());
            }

            string szPatientID = recPaperInfo.PATIENT_ID.PadLeft(10, '0');

            for (int index = 0; index < 10; index += 2)
            {
                ftpPath.Append("/");
                ftpPath.Append(szPatientID.Substring(index, 2));
            }

            //链接就诊目录
            ftpPath.Append("/");
            ftpPath.Append("IP_");
            ftpPath.Append(recPaperInfo.VISIT_ID);
            ftpPath.Append("/");
            return(ftpPath.ToString());
        }
Ejemplo n.º 2
0
        private void virtualTree1_NodeMouseClick(object sender, VirtualTreeEventArgs e)
        {
            if (e.SubItem == null)
            {
                VirtualNode[] selectNodes = this.virtualTree1.GetCheckedNodes(null);
                this.lbl_PatientCount.Text = selectNodes.Count().ToString();
                return;
            }
            if (e.SubItem.Index == 1 || e.SubItem.Index == 2)
            {
                string   szImageName = e.SubItem.Tag as string;
                RecPaper recPaper    = e.Node.Tag as RecPaper;
                if (string.IsNullOrEmpty(szImageName))
                {
                    return;
                }
                string szPath = szImageName;

                GlobalMethods.UI.SetCursor(this.virtualTree1, Cursors.WaitCursor);
                szPath = RecPaperAccess.Instance.GetImageLocalFile(szImageName);
                if (!File.Exists(szPath))
                {
                    short shRet = RecPaperAccess.Instance.GetImageFromFtp(recPaper, szImageName, ref szPath);
                    if (shRet != SystemData.ReturnValue.OK)
                    {
                        MessageBoxEx.Show("预览图片失败");
                        return;
                    }
                }
                GlobalMethods.UI.SetCursor(this.virtualTree1, Cursors.Default);
                Heren.MedQC.Utilities.Dialogs.ImageViewerDialog diglog = new Utilities.Dialogs.ImageViewerDialog();
                diglog.ImagePath = szPath;
                diglog.ShowDialog();
            }
        }
Ejemplo n.º 3
0
        private void btnReceive_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.Rows.Count <= 0)
            {
                return;
            }
            short shRet = SystemData.ReturnValue.OK;

            foreach (DataGridViewRow item in this.dataGridView1.Rows)
            {
                RecPaper   recPaper = item.Cells[this.colCheckBox.Index].Tag as RecPaper;
                MedDocInfo doc      = item.Tag as MedDocInfo;
                if (item.Cells[this.colCheckBox.Index].Value != null &&
                    item.Cells[this.colCheckBox.Index].Value.ToString().ToLower() == "true")
                {
                    if (recPaper != null)
                    {
                        recPaper.PAPER_STATE = SystemData.PaperState.Receive;
                        shRet = RecPaperAccess.Instance.Update(recPaper);
                    }
                    else
                    {
                        recPaper             = new RecPaper();
                        recPaper.PAPER_ID    = recPaper.MakeID();
                        recPaper.DOC_ID      = doc.DOC_ID;
                        recPaper.VISIT_ID    = doc.VISIT_ID;
                        recPaper.VISIT_NO    = doc.VISIT_ID;
                        recPaper.PAPER_STATE = SystemData.PaperState.Receive;
                        recPaper.PATIENT_ID  = doc.PATIENT_ID;
                        shRet = RecPaperAccess.Instance.Insert(recPaper);
                    }
                    if (shRet != SystemData.ReturnValue.OK)
                    {
                        MessageBoxEx.ShowError("操作失败");
                        return;
                    }
                    //item.Cells[this.colCheckBox.Index].Value = true;
                }
                else
                {
                    if (recPaper != null)
                    {
                        recPaper.PAPER_STATE = SystemData.PaperState.UnReceive;
                        shRet = RecPaperAccess.Instance.Update(recPaper);
                    }
                    //item.Cells[this.colCheckBox.Index].Value = false;
                }
            }
            MessageBoxEx.ShowMessage("操作成功");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 新增一条人工核查结果信息
        /// </summary>
        /// <param name="recPaper">自动核查规则配置信息</param>
        /// <returns>SystemData.ReturnValue</returns>
        public short Insert(RecPaper recPaper)
        {
            if (recPaper == null)
            {
                LogManager.Instance.WriteLog("", new string[] { "" }
                                             , new object[] { recPaper }, "参数不能为空");
                return(SystemData.ReturnValue.PARAM_ERROR);
            }
            if (recPaper.PAPER_ID == string.Empty)
            {
                return(SystemData.ReturnValue.EXCEPTION);
            }
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();

            sbField.AppendFormat("{0},", SystemData.RecPaperTable.DOC_ID);
            sbValue.AppendFormat("'{0}',", recPaper.DOC_ID);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.IMAGE_FRONTAGE);
            sbValue.AppendFormat("'{0}',", recPaper.IMAGE_FRONTAGE);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.IMAGE_OPPOSITE);
            sbValue.AppendFormat("'{0}',", recPaper.IMAGE_OPPOSITE);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.PAPER_ID);
            sbValue.AppendFormat("'{0}',", recPaper.PAPER_ID);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.PAPER_STATE);
            sbValue.AppendFormat("{0},", recPaper.PAPER_STATE);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.PATIENT_ID);
            sbValue.AppendFormat("'{0}',", recPaper.PATIENT_ID);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.VISIT_ID);
            sbValue.AppendFormat("'{0}',", recPaper.VISIT_ID);
            sbField.AppendFormat("{0}", SystemData.RecPaperTable.VISIT_NO);
            sbValue.AppendFormat("'{0}'", recPaper.VISIT_NO);
            string szSQL  = string.Format(SystemData.SQL.INSERT, SystemData.DataTable.REC_PAPER, sbField.ToString(), sbValue.ToString());
            int    nCount = 0;

            try
            {
                nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            if (nCount <= 0)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, "SQL语句执行后返回0!");
                return(SystemData.ReturnValue.EXCEPTION);
            }
            return(SystemData.ReturnValue.OK);
        }
Ejemplo n.º 5
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];

            if (e.ColumnIndex == this.colCheckBox.Index)
            {
                if (row.Cells[this.colCheckBox.Index].Value == null ||
                    row.Cells[this.colCheckBox.Index].Value.ToString().ToLower() == "false")
                {
                    row.Cells[this.colCheckBox.Index].Value = true;
                }
                else
                {
                    row.Cells[this.colCheckBox.Index].Value = false;
                }
            }
            if (e.ColumnIndex == this.col_IMAGE_FRONTAGE.Index ||
                e.ColumnIndex == this.col_IMAGE_OPPOSITE.Index)
            {
                string   szImageName = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag as string;
                RecPaper recPaper    = row.Cells[this.colCheckBox.Index].Tag as RecPaper;
                if (string.IsNullOrEmpty(szImageName))
                {
                    return;
                }
                string szPath = szImageName;

                GlobalMethods.UI.SetCursor(this.dataGridView1, Cursors.WaitCursor);
                szPath = RecPaperAccess.Instance.GetImageLocalFile(szImageName);
                if (!File.Exists(szPath))
                {
                    short shRet = RecPaperAccess.Instance.GetImageFromFtp(recPaper, szImageName, ref szPath);
                    if (shRet != SystemData.ReturnValue.OK)
                    {
                        MessageBoxEx.Show("预览图片失败");
                        return;
                    }
                }
                GlobalMethods.UI.SetCursor(this.dataGridView1, Cursors.Default);

                Heren.MedQC.Utilities.Dialogs.ImageViewerDialog diglog = new Utilities.Dialogs.ImageViewerDialog();
                diglog.ImagePath = szPath;
                diglog.ShowDialog();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取FTP图片
        /// </summary>
        /// <param name="recPaperInfo"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public short GetImageFromFtp(RecPaper recPaperInfo, string fileName, ref string szLocalFile)
        {
            if (recPaperInfo == null)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            FtpAccess recPaperFtpAccess = base.GetRecPaperFtpAccess();

            try
            {
                if (recPaperInfo == null)
                {
                    return(SystemData.ReturnValue.PARAM_ERROR);
                }
                if (!recPaperFtpAccess.OpenConnection())
                {
                    return(SystemData.ReturnValue.FAILED);
                }
                string szRemoteFilePath = GetRecPaperRemoteDir(recPaperInfo) + fileName;
                szLocalFile = this.GetImageLocalFile(fileName);
                if (!recPaperFtpAccess.ResExists(szRemoteFilePath, false))
                {
                    return(SystemData.ReturnValue.FAILED);
                }
                if (!recPaperFtpAccess.Download(szRemoteFilePath, szLocalFile))
                {
                    szLocalFile = "";
                    return(SystemData.ReturnValue.FAILED);
                }
            }
            finally
            {
                if (recPaperFtpAccess != null)
                {
                    recPaperFtpAccess.CloseConnection();
                }
            }
            return(SystemData.ReturnValue.OK);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取所有自动核查结果信息列表
        /// </summary>
        /// <param name="lstQcCheckResults"></param>
        /// <returns>SystemData.ReturnValue</returns>
        public short GetRecPaper(string szPaperID, ref RecPaper recPaper)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            StringBuilder sbField = new StringBuilder();

            sbField.AppendFormat("{0},", SystemData.RecPaperTable.DOC_ID);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.IMAGE_FRONTAGE);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.IMAGE_OPPOSITE);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.PAPER_STATE);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.PATIENT_ID);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.PAPER_ID);
            sbField.AppendFormat("{0},", SystemData.RecPaperTable.VISIT_ID);
            sbField.AppendFormat("{0}", SystemData.RecPaperTable.VISIT_NO);
            string szCondition = string.Format("1=1");

            if (!string.IsNullOrEmpty(szPaperID))
            {
                szCondition = string.Format("{0} AND {1} = '{2}'"
                                            , szCondition
                                            , SystemData.RecPaperTable.PAPER_ID
                                            , szPaperID);
            }
            string szSQL = string.Format(SystemData.SQL.SELECT_WHERE
                                         , sbField.ToString(), SystemData.DataTable.REC_PAPER, szCondition);

            IDataReader dataReader = null;

            try
            {
                dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text);
                if (dataReader == null || dataReader.IsClosed || !dataReader.Read())
                {
                    return(SystemData.ReturnValue.RES_NO_FOUND);
                }
                if (recPaper == null)
                {
                    recPaper = new RecPaper();
                }
                for (int i = 0; i < dataReader.FieldCount; i++)
                {
                    if (dataReader.IsDBNull(i))
                    {
                        continue;
                    }
                    switch (dataReader.GetName(i))
                    {
                    case SystemData.RecPaperTable.DOC_ID:
                        recPaper.DOC_ID = dataReader.GetString(i);
                        break;

                    case SystemData.RecPaperTable.IMAGE_FRONTAGE:
                        recPaper.IMAGE_FRONTAGE = dataReader.GetString(i);
                        break;

                    case SystemData.RecPaperTable.IMAGE_OPPOSITE:
                        recPaper.IMAGE_OPPOSITE = dataReader.GetString(i);
                        break;

                    case SystemData.RecPaperTable.PAPER_ID:
                        recPaper.PAPER_ID = dataReader.GetString(i);
                        break;

                    case SystemData.RecPaperTable.PAPER_STATE:
                        recPaper.PAPER_STATE = int.Parse(dataReader.GetValue(i).ToString());
                        break;

                    case SystemData.RecPaperTable.PATIENT_ID:
                        recPaper.PATIENT_ID = dataReader.GetString(i);
                        break;

                    case SystemData.RecPaperTable.VISIT_ID:
                        recPaper.VISIT_ID = dataReader.GetString(i);
                        break;

                    case SystemData.RecPaperTable.VISIT_NO:
                        recPaper.VISIT_NO = dataReader.GetString(i);
                        break;
                    }
                }

                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            finally { base.MedQCAccess.CloseConnnection(false); }
        }