Пример #1
0
        private void btnMonitor_Click(object sender, EventArgs e)
        {
            if (null != btnMonitor.Tag)
            {
                btnMonitor.Tag     = null;
                btnMonitor.Enabled = false;
            }

            txtInfo.Text = "";
            bool   hadChk   = false;
            string delRtRcp = "";

            foreach (ListViewItem item in lvOrders.Items)
            {
                if (item.Checked)
                {
                    hadChk = true;
                    if (!"-1".Equals(item.SubItems[9].Text))
                    {
                        delRtRcp += "'" + item.SubItems[6].Text + "',";
                    }
                }
            }

            if (!hadChk)
            {
                BLPublic.Dialogs.Alert("选择要审方的医嘱.");
                return;
            }

            if (!string.IsNullOrWhiteSpace(delRtRcp))
            {
                if (BLPublic.Dialogs.Yes != BLPublic.Dialogs.Ask("当前选医嘱中有已经审方的医嘱,重审将删除原来的审方记录了。\r\n是否继续?"))
                {
                    return;
                }

                delRtRcp = delRtRcp.Substring(0, delRtRcp.Length - 1);
                if (!this.db.ExecSQL(string.Format(DEL_TPNMNT_BYRCP, delRtRcp)))
                {
                    BLPublic.Dialogs.Alert("删除TPN审方记录失败:" + this.db.Error);
                    return;
                }
            }


            if (null == this.tpnMnt)
            {
                this.tpnMnt = new tpnmonitor.TPNMonitor();
                this.tpnMnt.init(this.db, "9999");
            }

            string mntRcps = "";

            btnMonitor.Tag  = 1;
            btnMonitor.Text = "取消";
            btnMonitor.Refresh();
            Application.DoEvents();

            foreach (ListViewItem item in lvOrders.Items)
            {
                if (item.Checked)
                {
                    if (null == btnMonitor.Tag)
                    {
                        break;
                    }

                    OrdersModel odr = (OrdersModel)item.Tag;

                    bool rt = this.tpnMnt.Monitor(odr.PatientCode, odr.AgeMonth, odr.Sex, odr.RecipeID);
                    if (rt)
                    {
                        this.tpnMnt.saveTPNValue();
                        mntRcps     += "'" + odr.RecipeID + "',";
                        item.Checked = false;

                        txtInfo.Text += "[" + odr.RecipeID + "]:成功." + this.tpnMnt.getError() + "\r\n";
                    }
                    else
                    {
                        txtInfo.Text += "[" + odr.RecipeID + "]:" + this.tpnMnt.getError() + "\r\n";
                    }

                    Application.DoEvents();
                }
            }

            if (!string.IsNullOrWhiteSpace(mntRcps))
            {
                refCheckLevel(mntRcps);
            }

            btnMonitor.Enabled = true;
            btnMonitor.Tag     = null;
            btnMonitor.Text    = "审方";
        }