Esempio n. 1
0
        /// <summary>
        /// 设置消息状态
        /// </summary>
        /// <param name="IsDeal"></param>
        /// <param name="EmployeeId"></param>
        /// <param name="IpAddress"></param>
        public void SetStatus(bool IsDeal, int EmployeeId, string IpAddress)
        {
            //0,未处理,1、仅标记为已读,2、已做处理
            string sql = "update pub_message_record set DealStatus = {0},FirstReader={1},ReadTime=getdate(),ReadByIP = '{2}'  where MsgId = '{3}'";

            sql += " and FirstReader=0 and ReadTime is null and ReadByIP=''";
            if (IsDeal)
            {
                sql = string.Format(sql, 2, EmployeeId, IpAddress, this.messageId.ToString());
            }
            else
            {
                sql = string.Format(sql, 1, EmployeeId, IpAddress, this.messageId.ToString());
            }
            try
            {
                RelationalDatabase database = new TrasenClasses.DatabaseAccess.MsSqlServer();
                database.Initialize(TrasenFrame.Classes.WorkStaticFun.GetConnnectionString_Default(TrasenFrame.Classes.ConnectionType.SQLSERVER));
                database.Open();
                database.DoCommand(sql);
                database.Close();
            }
            catch (Exception error)
            {
                TrasenFrame.Forms.FrmMdiMain.WriteFrameLocalLog(new string[] { "更改消息状态失败!", error.Message, error.StackTrace }, true);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 事件分类
        /// </summary>
        /// <param name="treeView"></param>
        public void CreateMZTree(System.Windows.Forms.TreeListView treeListView)
        {
            TreeListViewItem item = new TreeListViewItem("门诊事件", 0);

            item.Tag = Convert.ToInt64(0).ToString();
            treeListView.Items.Add(item);

            RelationalDatabase db = new TrasenClasses.DatabaseAccess.MsSqlServer();

            db.Initialize(strConnectionString);

            string ssql = "select  EVENT,'' as eventName from event_mz_hjb where FINISH = 0 group by EVENT ";

            try
            {
                DataTable tb = db.GetDataTable(ssql);
                tb = GetEventName(tb);
                for (int i = 0; i <= tb.Rows.Count - 1; i++)
                {
                    TreeListViewItem itemA = new TreeListViewItem(tb.Rows[i]["EVENT"].ToString(), 1);
                    itemA.SubItems.Add(tb.Rows[i]["eventName"].ToString());
                    item.Items.Add(itemA);

                    item.ExpandAll();
                }
            }
            catch
            { }
            finally
            {
                db.Close();
                db.Dispose();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 重发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void butsend_Click(object sender, EventArgs e)
        {
            DataView dv   = (DataView)dgveventlog.DataSource;
            int      nrow = dgveventlog.CurrentCell.RowIndex;

            DataRow[] rows = dv.Table.Select("选择=true", "id asc ");

            if (MessageBox.Show(this, "您确定要重发 [" + rows.Length.ToString() + "] 条消息吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            RelationalDatabase db = new TrasenClasses.DatabaseAccess.MsSqlServer();

            db.Initialize(strConnectionString);

            try
            {
                db.BeginTransaction();

                for (int i = 0; i <= rows.Length - 1; i++)
                {
                    string id       = rows[i]["id"].ToString();
                    string bizid    = rows[i]["bizid"].ToString();
                    string sevent   = rows[i]["event"].ToString();
                    string CATEGORY = rows[i]["CATEGORY"].ToString();

                    string ssql = @"insert into event_mz_hjb(EVENT,CATEGORY,BIZID,MESSAGE,TS,ENABLE,RETURNDESC,finish)values('" + sevent + "','" + CATEGORY + "','" + bizid + "','',GETDATE(),1,'',0 )";

                    int n = db.DoCommand(ssql);
                    if (n > 0)
                    {
                        ssql = "update event_mz_hjb set finish=1,message='取消并已重新发送' where finish=0 and bizid='" + bizid + "' and event='" + sevent + "' and id=" + id + " ";
                        n    = db.DoCommand(ssql);
                        //if (n == 0) throw new Exception("没有影响到行,消息可行已被正常执行,无需重新发送");
                    }
                }

                db.CommitTransaction();
                MessageBox.Show("发送成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                butview_Click(null, null);
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                db.Close();
                db.Dispose();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取门诊事件数据(数据库:192.168.201.2)
        /// </summary>
        /// <param name="eventtype"></param>
        /// <param name="P_eventtype"></param>
        /// <param name="rq1"></param>
        /// <param name="rq2"></param>
        /// <param name="eventname"></param>
        /// <param name="bizid"></param>
        /// <param name="bk"></param>
        /// <param name="finish"></param>
        /// <param name="dv"></param>
        public void GetMzEventlog(string P_eventtype, string rq1, string rq2, string eventname, string bizid, bool bk, int finish, Trasen.Controls.DataGridView dv)
        {
            string ssql = "select CAST(0 as smallint) 选择,ID,EVENT,CATEGORY,BIZID,MESSAGE,TS,RETURNDESC,FINISH_DATE from event_mz_hjb where 1=1   "; //and url <> ''

            if (finish == 0)
            {
                ssql = ssql + " and  finish=" + finish + "";
            }
            else if (finish > 0)
            {
                ssql = ssql + " and  finish>=" + finish + "";
            }
            if (!string.IsNullOrEmpty(P_eventtype))
            {
                ssql = ssql + " and  EVENT='" + P_eventtype + "'";
            }
            ssql = ssql + " and ts>='" + rq1 + "' and ts<='" + rq2 + "'";
            if (bizid.Trim() != "")
            {
                ssql = ssql + " and bizid='" + bizid + "'";
            }
            if (eventname.Trim() != "")
            {
                ssql = ssql + " and EVENT like '%" + eventname + "%'";
            }
            ssql = ssql + " order by ID";


            RelationalDatabase db = new TrasenClasses.DatabaseAccess.MsSqlServer();

            db.Initialize(strConnectionString);
            try
            {
                DataTable tb = db.GetDataTable(ssql);
                dv.DataSource = tb.DefaultView;
            }
            catch
            {
                dv.DataSource = null;
            }
            finally
            {
                db.Close();
                db.Dispose();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 取消执行消息
        /// </summary>
        /// <param name="ids"></param>
        public void CancelEventMzHjb(string[] ids)
        {
            RelationalDatabase db = new TrasenClasses.DatabaseAccess.MsSqlServer();

            db.Initialize(strConnectionString);
            try
            {
                string[] sqls = new string[ids.Length];
                for (int i = 0; i <= ids.Length - 1; i++)
                {
                    sqls[i] = "update event_mz_hjb set finish=2,returndesc='取消执行 By " + InstanceForm.BCurrentUser.Name + " at " + DateTime.Now.ToString() + "' where id=" + ids[i];
                }

                db.DoCommand(null, null, null, sqls);
            }
            catch
            {
            }
            finally
            {
                db.Close();
                db.Dispose();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 测试方法
        /// </summary>
        /// <param name="s"></param>
        private void Search(string s)
        {
            RelationalDatabase db = new TrasenClasses.DatabaseAccess.MsSqlServer();

            db.Initialize(strConn);

            try
            {
                if (checkBox1.Checked == false && checkBox2.Checked == false && checkBox3.Checked == false)
                {
                    MessageBox.Show("请勾选要查询的项目!", "提示");
                    return;
                }
                this.Cursor = PubStaticFun.WaitCursor();
                string strItem = "";
                if (checkBox1.Checked)
                {
                    //查询十二通道常规心电图检查+心电事件记录的OrderId
                    string strResult = GetOrderId(checkBox1.Text);
                    if (!string.IsNullOrEmpty(strResult))
                    {
                        strItem += strResult;
                    }
                }
                if (checkBox2.Checked)
                {
                    //查询动态心电图监测+心率变异性分析记录的OrderId
                    string strResult = GetOrderId(checkBox2.Text);
                    if (!string.IsNullOrEmpty(strResult))
                    {
                        if (string.IsNullOrEmpty(strItem))
                        {
                            strItem += strResult;
                        }
                        else
                        {
                            strItem += "," + strResult;
                        }
                    }
                }
                if (checkBox3.Checked)
                {
                    //查询长程动态血压监测的OrderId
                    string strResult = GetOrderId(checkBox3.Text);
                    if (!string.IsNullOrEmpty(strResult))
                    {
                        if (string.IsNullOrEmpty(strItem))
                        {
                            strItem += strResult;
                        }
                        else
                        {
                            strItem += "," + strResult;
                        }
                    }
                }

                if (string.IsNullOrEmpty(strItem))
                {
                    MessageBox.Show("没有查询到项目对应的OrderId,请联系管理员!", "提示");
                    return;
                }
                strItem = "7948,7537,7842";

                string strHead = @"SELECT f.xh ,f.ks ,f.xmmc ,SUM(f.sl) AS sl ,CAST(f.dj AS NVARCHAR(20)) AS dj,SUM(f.je) AS je
                            from (SELECT  item.xh ,item.ks ,item.xmmc ,item.sl ,SUM(item.dj) AS dj ,SUM(item.je) AS je
                            FROM (select 0 xh, dbo.fun_getDeptname(b.DEPT_ID) as ks,b.ORDER_CONTEXT as xmmc,a.PRESCRIPTION_ID,
                                cast(SUM(a.NUM*(CASE WHEN a.DOSAGE<=0 THEN 1 ELSE a.DOSAGE END)) as float) as sl,
                                cast(a.RETAIL_PRICE as float) as dj,
                                cast(SUM(a.NUM*a.RETAIL_PRICE) as float) as je from 
                            (
		                        SELECT INPATIENT_ID,ORDER_ID,NUM,DOSAGE,RETAIL_PRICE,XMID,EXECDEPT_ID,DEPT_ID,CHARGE_DATE,DELETE_BIT,PRESCRIPTION_ID
		                        FROM  ZY_FEE_SPECI
		                        UNION ALL
		                        SELECT INPATIENT_ID,ORDER_ID,NUM,DOSAGE,RETAIL_PRICE,XMID,EXECDEPT_ID,DEPT_ID,CHARGE_DATE,DELETE_BIT,PRESCRIPTION_ID
		                        FROM  ZY_FEE_SPECI_H 
                            ) as a 
	                        join (
		                        select  INPATIENT_ID,ORDER_ID,DEPT_ID,HOITEM_ID,ORDER_CONTEXT,DELETE_BIT
		                        from ZY_ORDERRECORD
		                        UNION ALL
		                        select INPATIENT_ID,ORDER_ID,DEPT_ID,HOITEM_ID,ORDER_CONTEXT,DELETE_BIT
		                        from ZY_ORDERRECORD_H
		                        ) as b 
	                        on a.INPATIENT_ID = b.INPATIENT_ID and a.ORDER_ID=b.ORDER_ID
	                        and b.HOITEM_ID in("     + strItem
                                 + ") where a.DELETE_BIT= 0 and b.DELETE_BIT= 0 and a.EXECDEPT_ID=105 "; //and a.EXECDEPT_ID =" + BCurrentDept.DeptId;
                string strEnd   = @" GROUP BY b.DEPT_ID,b.ORDER_CONTEXT,a.RETAIL_PRICE,a.PRESCRIPTION_ID ) AS item
                                   GROUP BY item.PRESCRIPTION_ID ,item.xmmc ,item.xh ,item.ks ,item.sl) AS f 
                                   GROUP BY f.xmmc ,f.xh , f.ks ,f.dj";
                string strWhere = " and a.CHARGE_DATE>='" + dtStart.Value.ToShortDateString() + " 00:00:00' and a.CHARGE_DATE<='" + dtEnd.Value.ToShortDateString() + " 23:59:59'";

                DataTable tb = db.GetDataTable(strHead + strWhere + strEnd);
                //tb = UpdateDataTable(tb, true);
                ////1.根据处方id,项目名称GroupBy DataTable
                //tb = GroupbyDataTable(tb, new string[] { "xh", "ks", "xmmc", "sl", "PRESCRIPTION_ID" }, new string[] { "dj", "je" }, new string[] { "sum", "sum" }, null);
                ////2.移除处方id这一列
                //tb.Columns.Remove("PRESCRIPTION_ID");
                ////3.更新DataTable字段数值型的值
                //tb = UpdateDataTable(tb, false);
                ////4.根据科室,项目名称GroupBy DataTable
                //tb = GroupbyDataTable(tb, new string[] { "xh", "ks", "xmmc", "dj" }, new string[] { "sl", "je" }, new string[] { "sum", "sum" }, null);


                DataTable tbClone = tb.Copy();
                DataRow[] dr      = tbClone.Select("xmmc like '%十二通道常规心电图检查+心电事件记录%'");
                //十二通道常规心电图检查+心电事件记录
                DataRow rowcc = tb.NewRow();
                rowcc["xh"]   = 0;
                rowcc["ks"]   = "小计";
                rowcc["xmmc"] = "十二通道常规心电图检查+心电事件记录";
                rowcc["dj"]   = "";
                decimal Dsl = 0.00M;
                decimal Dje = 0.00M;
                for (int i = 0; i < dr.Length; i++)
                {
                    Dsl += Convert.ToDecimal(dr[i]["sl"]);
                    Dje += Convert.ToDecimal(dr[i]["je"]);
                }
                rowcc["sl"] = (float)Dsl;
                rowcc["je"] = (float)Dje;

                dr = tbClone.Select("xmmc like '%动态心电图监测+心率变异性分析%'");
                //动态心电图监测+心率变异性分析
                DataRow rowxd = tb.NewRow();
                rowxd["xh"]   = 0;
                rowxd["ks"]   = "小计";
                rowxd["xmmc"] = "动态心电图监测+心率变异性分析";
                rowxd["dj"]   = "";
                Dsl           = 0.00M;
                Dje           = 0.00M;
                for (int i = 0; i < dr.Length; i++)
                {
                    Dsl += Convert.ToDecimal(dr[i]["sl"]);
                    Dje += Convert.ToDecimal(dr[i]["je"]);
                }
                rowxd["sl"] = (float)Dsl;
                rowxd["je"] = (float)Dje;

                dr = tbClone.Select("xmmc like '%长程动态血压监测%'");
                //长程动态血压监测
                DataRow rowxy = tb.NewRow();
                rowxy["xh"]   = 0;
                rowxy["ks"]   = "小计";
                rowxy["xmmc"] = "长程动态血压监测";
                rowxy["dj"]   = "";
                Dsl           = 0.00M;
                Dje           = 0.00M;
                for (int i = 0; i < dr.Length; i++)
                {
                    Dsl += Convert.ToDecimal(dr[i]["sl"]);
                    Dje += Convert.ToDecimal(dr[i]["je"]);
                }
                rowxy["sl"] = (float)Dsl;
                rowxy["je"] = (float)Dje;

                //合计
                DataRow rowKs = tb.NewRow();
                rowKs["xh"]   = 0;
                rowKs["ks"]   = "合计";
                rowKs["xmmc"] = "";
                rowKs["dj"]   = "";
                Dsl           = 0.00M;
                Dje           = 0.00M;
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    Dsl += Convert.ToDecimal(tb.Rows[i]["sl"]);
                    Dje += Convert.ToDecimal(tb.Rows[i]["je"]);
                }
                rowKs["sl"] = (float)Dsl;
                rowKs["je"] = (float)Dje;

                if (tb.Rows.Count > 0)
                {
                    if (checkBox1.Checked)
                    {
                        tb.Rows.Add(rowcc);
                    }
                    if (checkBox2.Checked)
                    {
                        tb.Rows.Add(rowxd);
                    }
                    if (checkBox3.Checked)
                    {
                        tb.Rows.Add(rowxy);
                    }
                }
                tb.Rows.Add(rowKs);

                //序列号初始化
                AddRowtNo(tb);

                // FunBase.AddRowtNo(tb);
                tb.TableName = "Tb";
                this.myDataGrid1.DataSource = tb;

                this.myDataGrid1.Columns["序号"].DisplayIndex   = 1;
                this.myDataGrid1.Columns["科室"].DisplayIndex   = 2;
                this.myDataGrid1.Columns["项目名称"].DisplayIndex = 3;
                this.myDataGrid1.Columns["数量"].DisplayIndex   = 4;
                this.myDataGrid1.Columns["单价"].DisplayIndex   = 5;
                this.myDataGrid1.Columns["金额"].DisplayIndex   = 6;

                AddRowColor(myDataGrid1, "科室", "小计", Color.LightBlue, true);
                AddRowColor(myDataGrid1, "科室", "合计", Color.LightGreen, true);
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
                db.Close();
                db.Dispose();
            }
        }