在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例桌面应用界面/GUI → Dicom图像自动接收并上传

Dicom图像自动接收并上传

桌面应用界面/GUI

下载此实例
  • 开发语言:C#
  • 实例大小:18.78M
  • 下载次数:113
  • 浏览次数:1340
  • 发布时间:2017-10-05
  • 实例类别:桌面应用界面/GUI
  • 发 布 人:xaxa2166
  • 文件格式:.rar
  • 所需积分:2
 相关标签: ico c 图像 d 自动

实例介绍

【实例简介】DICOM图像自动接收并上传
【实例截图】

【核心代码】

 /// <summary>
        /// 上传
        /// </summary>
        /// <param name="obj"></param> 
        /// 
        private void upload(object obj)
        {
            //定义文件路径
            string sPath = string.Empty;
            //定义文件的数量
            int num;
            //定义连接的数据库
            SQLiteConnection sQLiteConnection = new SQLiteConnection("Data Source=" Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HCPACS.db3"));
            try
            {
                //判断时间秒数小于10秒之差自动上传
                string newDateTime = DateTime.Now.AddSeconds(-10.0).ToString("yyyy-MM-dd HH:mm:ss");
                //打开数据库
                sQLiteConnection.Open();
                string strsql = "select * from pacs_study where Status='' and updateDateTime<'" newDateTime "' limit 0,1";
                SQLiteDataAdapter sQLiteDataAdapter = new SQLiteDataAdapter(strsql, sQLiteConnection);
                DataSet ds = new DataSet();
                sQLiteDataAdapter.Fill(ds);
                //判断ds是否null 数据为0
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    timerClose.Dispose();
                    IEnumerator iEnumerator = ds.Tables[0].Rows.GetEnumerator();
                    DataRow dr;
                    while (iEnumerator.MoveNext())
                    {
                        dr = (DataRow)iEnumerator.Current;
                        //获取一个值,该值指示调用方在对控件进行方法调用时是否必须调用Invoke方法
                        if (listView1.InvokeRequired)
                        {
                            //委托代理
                            listView1.Invoke(new MethodInvoker(delegate
                                {
                                    ListViewItem listViewItem = new ListViewItem(dr["PatientID"].ToString());//患者检查号
                                    listViewItem.SubItems.Add(dr["PatientName"].ToString());//患者姓名
                                    listViewItem.SubItems.Add(dr["PatientSex"].ToString());//患者性别
                                    listViewItem.SubItems.Add(dr["PatientAge"].ToString());//患者年龄
                                    listViewItem.SubItems.Add(dr["StudyDateTime"].ToString());//检查时间
                                    listViewItem.SubItems.Add(dr["Modality"].ToString());//检查类型
                                    listViewItem.SubItems.Add(dr["DicomCount"].ToString());//图像数量
                                    listViewItem.SubItems.Add("正在压缩中...");//状态
                                    listViewItem.SubItems.Add(dr["StudyID"].ToString());//自动生成的StudyID        
                                    listViewItem.SubItems.Add(dr["StudyUID"].ToString());
                                    for (int i = 0; i < listView1.Items.Count; i )
                                    {
                                        if (dr["StudyUID"].ToString().Equals(listView1.Items[i].SubItems[9].Text))
                                        {
                                            listView1.Items[i].Remove();
                                        }
                                    }
                                    //插入到集合中指定的索引处
                                    listView1.Items.Insert(0, listViewItem);
                                }));
                        }
                        try
                        {
                            //创建压缩的路径、名字
                            num = int.Parse(dr["DicomCount"].ToString());//得到图像的数量
                            sPath = dr["Path"].ToString();//得到需要压缩图像的路径
                            //定义需要压缩文件的路径以及名字
                            string str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DicomZip\\" dr["StudyUID"].ToString() ".zip");
                            //判断DicomZip是否存在
                            if (!Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DicomZip")))
                            {
                                Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DicomZip"));
                            }
                            //开始压缩文件
                            Utility utility = new Utility();
                            utility.ZipFile(sPath, str);
                            notifyIcon1.ShowBalloonTip(100, "提示", "图像压缩完毕,上传中...", ToolTipIcon.Info);
                            if (listView1.InvokeRequired)
                            {
                                listView1.Invoke(new MethodInvoker(delegate
                                    {
                                        listView1.Items[0].SubItems[7].Text = "上传中...";
                                    }));
                            }
                            //同时更改表pacs_study中字段Status
                            strsql = "select DicomCount from pacs_study where StudyID='" dr["StudyID"].ToString() "' ";
                            SQLiteCommand sQLiteCommand = new SQLiteCommand(strsql, sQLiteConnection);
                            //判断图像数量是否一样
                            if (int.Parse(sQLiteCommand.ExecuteScalar().ToString()) == num)
                            {
                                strsql = "update pacs_study set Status='上传中...' where StudyID='" dr["StudyID"].ToString() "'";
                                sQLiteCommand = new SQLiteCommand(strsql, sQLiteConnection);
                                sQLiteCommand.ExecuteNonQuery();
                            }

标签: ico c 图像 d 自动

实例下载地址

Dicom图像自动接收并上传

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有2条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警