Esempio n. 1
0
        private void ReMonitor_Click(object sender, RoutedEventArgs e)
        {
            if (null == grdOrders.SelectedItem)
            {
                BLPublic.Dialogs.Alert("请选择要重审的医嘱.");
                grdOrders.Focus();
                return;
            }

            if (BLPublic.Dialogs.Yes != BLPublic.Dialogs.Ask("此操作将会删除现在的TPN审方结果,是否继续?"))
            {
                grdOrders.Focus();
                return;
            }

            DataRowView drv      = (DataRowView)grdOrders.SelectedItem;
            string      recipeID = drv.Row["RecipeID"].ToString();

            if (!this.db.ExecSQL(string.Format(SQL.DEL_TPNMNT_BYRCP, recipeID)))
            {
                BLPublic.Dialogs.Alert("删除TPN审方失败:" + this.db.Error);
                return;
            }


            ((Button)sender).IsEnabled = false;

            tpnmonitor.TPNMonitor tpnMnt = new tpnmonitor.TPNMonitor();
            tpnMnt.init(this.db, LoginEmpCode);
            tpnMnt.loadConfig();
            bool rt = tpnMnt.Monitor(drv.Row["PatientCode"].ToString(), 0, "", recipeID);

            ((Button)sender).IsEnabled = true;

            if (!rt)
            {
                BLPublic.Dialogs.Error("重审失败:" + tpnMnt.getError());
                return;
            }

            tpnMnt.saveTPNValue();
            loadOrders();

            foreach (object o in grdOrders.Items)
            {
                if (((DataRowView)o).Row["RecipeID"].ToString().Equals(recipeID))
                {
                    grdOrders.SelectedItem = o;
                    break;
                }
            }

            BLPublic.Dialogs.Info("重审成功");
        }
Esempio n. 2
0
        /// <summary>
        /// 加载使用营养药医嘱
        /// </summary>
        private void loadOrders(string _deptCode, string _patientCode)
        {
            lbOrders.Items.Clear();

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

            if (null == this.tblOrders)
            {
                this.tblOrders = new DataTable();

                DataColumn col = new DataColumn("Capacity", typeof(double));
                col.DefaultValue = -1;
                this.tblOrders.Columns.Add(col);
            }
            else
            {
                this.tblOrders.Clear();
            }

            string sql = "";

            if (true == cbOnlyUse.IsChecked)
            {
                sql = string.Format(SQL.SEL_ACT_ORDERS, _deptCode, _patientCode);
            }
            else
            {
                sql = string.Format(SQL.SEL_ALL_ORDERS, _deptCode, _patientCode);
            }

            if (AppConst.db.GetRecordSet(sql, ref this.tblOrders))
            {
                listOrders();
            }
            else
            {
                BLPublic.Dialogs.Error("加载医嘱失败:" + AppConst.db.Error);
            }
        }
Esempio n. 3
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    = "审方";
        }
Esempio n. 4
0
        public void monitor()
        {
            this.logOp = new BLPublic.LogOperate(this.appPath + @"\log\", "tpnmonitorlog");
            this.db    = new BLPublic.DBOperate(this.appPath + @"\bl_server.lcf", "CPMATE");
            if (!this.db.IsConnected)
            {
                this.logOp.log("连接服务器失败:" + this.db.Error);
                return;
            }

            DataTable tblPatient = null;

            if (!this.db.GetRecordSet(SEL_ORDERS_NOCHK, ref tblPatient))
            {
                this.logOp.log("加载未审方医嘱失败:" + this.db.Error);
                return;
            }

            if ((null == tblPatient) || (0 == tblPatient.Rows.Count))
            {
                this.logOp.log("审方结束");
            }

            this.tpnMnt = new tpnmonitor.TPNMonitor();
            this.tpnMnt.init(this.db, "9999");

            int      month = 0;
            DateTime birthday;
            bool     rt = false;

            foreach (DataRow row in tblPatient.Rows)
            {
                if (!Convert.IsDBNull(row["Birthday"]))
                {
                    birthday = Convert.ToDateTime(row["Birthday"].ToString());

                    month = DateTime.Now.Month - birthday.Month;
                    month = (DateTime.Now.Year - birthday.Year) * 12 + month;
                    if (DateTime.Now.Day - birthday.Day < -15)
                    {
                        month--;
                    }
                    else if (DateTime.Now.Day - birthday.Day > 14)
                    {
                        month++;
                    }
                }
                else
                {
                    month = 0;
                }

                rt = this.tpnMnt.Monitor(row["PatientCode"].ToString(), month,
                                         "f".Equals(row["Sex"].ToString()) ? "女" : "男",
                                         row["RecipeID"].ToString());
                if (rt)
                {
                    this.tpnMnt.saveTPNValue();
                }
                else
                {
                    this.logOp.log("审核医嘱'" + row["RecipeID"].ToString() + "'失败:" + this.tpnMnt.getError());
                }
            }

            tblPatient.Clear();
            this.logOp.log("审方结束");

            endMonitor();
        }