Esempio n. 1
0
 /// <summary>
 /// 长期医嘱选项卡数据源(过滤掉中草药和医技项目)
 /// </summary>
 /// <returns></returns>
 public static DataTable LoadShowCardlong()
 {
     try
     {
         DataTable show   = ShowCard.Clone();
         string    config = OP_Config.GetValue("005");
         DataRow[] rows   = null;
         if (config != null && config.ToString() == "1") //长期医嘱中能开精神类药品
         {
             rows = ShowCard.Select("order_type<>3 and order_type <> 0 and order_type<>5 and virulent_flag<>1 and narcotic_flag<>1 and costly_flag<>1");
         }
         else //长期医嘱中不能开精神类药品
         {
             rows = ShowCard.Select("order_type<>3 and order_type <> 0 and order_type<>5 and virulent_flag<>1 and narcotic_flag<>1 and costly_flag<>1 and lunacy_flag<>1");
         }
         show.Clear();
         foreach (DataRow dr in rows)
         {
             show.Rows.Add(dr.ItemArray);
         }
         return(show);
     }
     catch (System.Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 药房是否可以开库存为0的药品
 /// </summary>
 /// <returns></returns>
 public bool CanPresZero()
 {
     if (OP_Config.GetValue("001") == "0")
     {
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
 public bool IsLis()
 {
     if (OP_Config.GetValue("003") == "1")
     {
         return(true);
     }
     return(false);
 }
Esempio n. 4
0
        /// <summary>
        /// 获得科室开药的药房名称
        /// </summary>
        /// <param name="deptid"></param>
        /// <returns></returns>
        public DataTable  Get_dept_yfName(int deptid)
        {
            //string deptyf = OP_Config.GetValue("004");
            //if (deptyf != null)
            //{
            //    string[] yf = deptyf.Split(',');
            //    for (int i = 0; i < yf.Length; i++)
            //    {
            //        string[] dept = yf[i].Split('-');
            //        if (deptid.ToString() == dept[0].ToString())
            //        {
            //            //return HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetDeptName(dept[1].ToString());
            //            return dept[1].ToString();  //20100523.0.04  药房参数设置默认药房没用.
            //        }
            //    }
            //}
            //return null;

            DataTable dt = new DataTable();

            dt.Columns.Add("Name", Type.GetType("System.String"));
            dt.Columns.Add("Value", Type.GetType("System.String"));
            try
            {
                string   drugDeptIds = "";
                string[] drugDepts   = OP_Config.GetValue("004").Split(',');
                foreach (string drugDept in drugDepts)
                {
                    string[] values = drugDept.Split('-');
                    drugDeptIds += (Convert.ToInt32(values[0]) == deptid ? (values[1] + ",") : "");
                }
                if (drugDeptIds.Trim() != "")
                {
                    drugDeptIds = drugDeptIds.Substring(0, drugDeptIds.Length - 1);
                    dt.Rows.Add("默认药房", drugDeptIds);
                }
            }
            catch
            {
            }

            dt.Rows.Add("全部药房", -1);

            DataTable yf = BindEntity <Model.YP_DeptDic> .CreateInstanceDAL(oleDb).GetList("DEPTTYPE1='药房'");

            if (yf != null)
            {
                foreach (DataRow row in yf.Rows)
                {
                    dt.Rows.Add(row["DeptName"].ToString().Trim(), row["DeptId"]);
                }
            }
            return(dt);
        }
Esempio n. 5
0
        private void btn_Out_Click(object sender, EventArgs e)
        {
            string strconfirm;//确认出区信息

            errorMsg  = "";
            unsettled = "";

            if (patlistid == 0)//是否选择患者
            {
                MessageBox.Show(this, "未选择患者", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            currentpat = new Patient(patlistid);
            if (!op_patientout.MayLeave(patlistid, out errorMsg, out unsettled))//是否有未停医嘱,未记账费用
            {
                string strtmp = tabPageControl1.SelectedTab.Text;
                MessageBox.Show(errorMsg + strtmp + unsettled, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string UnProvideItems = op_patientout.UnProvide(patlistid);  //判断是否有未发药品

            if (UnProvideItems != "")
            {
                MessageBox.Show("该病人“" + currentpat.patname + "”【有未发药品,请及时统领以下药品】:" + UnProvideItems, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (OP_Config.GetValue("001") == 1)    //001表示未发药是否能够定义出院,返回0表示能,返回1表示不能
                {
                    return;
                }
            }

            string UnWithDrawalItems = op_patientout.UnWithDrawal(patlistid);//判断是否有未退药品

            if (UnWithDrawalItems != "")
            {
                MessageBox.Show("该病人“" + currentpat.patname + "”有未退药品!未退药品如下:" + UnWithDrawalItems, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (OP_Config.GetValue("002") == 1)   //001表示未退药是否能够定义出院,返回0表示能,返回1表示不能
                {
                    return;
                }
            }

            //定义出院要判断患者是否在床,以及是否处于出院结算状态
            if (tabPageControl1.SelectedTab == tab_Leave)
            {
                errorMsg = "";
                if (op_patientout.isOnbed(patlistid)) //病人是否在床
                {
                    errorMsg = "对不起,病人“" + currentpat.patname + "”还未开出院医嘱!";
                }
                else if (op_patientout.isOnbalance(patlistid))//结算中,已出院
                {
                    errorMsg = "对不起,病人“" + currentpat.patname + "”已经定义出院!";
                }
                if (errorMsg != "")
                {
                    MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                strconfirm = "确认“" + currentpat.patname + "”定义出院吗?";
                if (MessageBox.Show(this, strconfirm, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                {
                    return;
                }
                DataTable dtPresorder = op_patientout.getDtPresorder(patlistid); //出院操作
                if (dtPresorder.Rows.Count != 0)                                 //未统领药品进统领单
                {
                    List <string[]> depts = new List <string[]>();
                    for (int n = 0; n < dtPresorder.Rows.Count; n++)
                    {
                        if (depts.Exists(x => x[0] == dtPresorder.Rows[n]["presdeptcode"].ToString().Trim() && x[1] == dtPresorder.Rows[n]["execdeptcode"].ToString().Trim()) == false)
                        {
                            depts.Add(new string[] { dtPresorder.Rows[n]["presdeptcode"].ToString().Trim(), dtPresorder.Rows[n]["execdeptcode"].ToString().Trim() });
                        }
                    }

                    for (int m = 0; m < depts.Count; m++)
                    {
                        OP_SendDrugMessage op_sendDrugMessage = new OP_SendDrugMessage();
                        DateTime           sendtime           = XcDate.ServerDateTime;
                        int masterid = op_sendDrugMessage.InsertDrugMaster(sendtime, currentUser.UserID, currentUser.Name, depts[m][0], depts[m][1]);
                        for (int i = 0; i < dtPresorder.Rows.Count; i++)
                        {
                            if (dtPresorder.Rows[i]["presdeptcode"].ToString().Trim() == depts[m][0] && dtPresorder.Rows[i]["execdeptcode"].ToString().Trim() == depts[m][1])
                            {
                                op_sendDrugMessage.InsertDrugMessageRecord(Convert.ToInt32(dtPresorder.Rows[i]["presorderid"]), masterid);
                            }
                        }
                    }
                }
                DataTable dtDBPresorder = op_patientout.getDrawBackDtPresorder(patlistid);
                if (dtDBPresorder.Rows.Count != 0)
                {
                    List <string[]> depts = new List <string[]>();
                    for (int n = 0; n < dtDBPresorder.Rows.Count; n++)
                    {
                        if (depts.Exists(x => x[0] == dtDBPresorder.Rows[n]["presdeptcode"].ToString().Trim() && x[1] == dtDBPresorder.Rows[n]["execdeptcode"].ToString().Trim()) == false)
                        {
                            depts.Add(new string[] { dtDBPresorder.Rows[n]["presdeptcode"].ToString().Trim(), dtDBPresorder.Rows[n]["execdeptcode"].ToString().Trim() });
                        }
                    }
                    for (int m = 0; m < depts.Count; m++)
                    {
                        OP_SendDrugMessage op_sendDrugMessage = new OP_SendDrugMessage();//未退药品进统领单
                        DateTime           sendtime           = XcDate.ServerDateTime;
                        int masterid = op_sendDrugMessage.InsertDBDrugMaster(sendtime, currentUser.UserID, currentUser.Name, depts[m][0], depts[m][1]);
                        for (int i = 0; i < dtDBPresorder.Rows.Count; i++)
                        {
                            if (dtDBPresorder.Rows[i]["presdeptcode"].ToString().Trim() == depts[m][0] && dtDBPresorder.Rows[i]["execdeptcode"].ToString().Trim() == depts[m][1])
                            {
                                op_sendDrugMessage.InsertDBDrugMessageRecord(Convert.ToInt32(dtDBPresorder.Rows[i]["presorderid"]), masterid);
                            }
                        }
                    }
                }
                op_patientout.ApplyLeave(Convert.ToInt32(patlistid), Convert.ToInt32(_currentUser.UserID), out errorMsg);//出区操作
            }
            //病人转科操作
            else if (tabPageControl1.SelectedTab == tab_Transfer)
            {
                strconfirm = "确认“" + currentpat.patname + "”转到“" + BaseData.GetDeptName(getdept) + "”吗?";
                //是否确认转科
                DateTime ServerDate     = XcDate.ServerDateTime.AddDays(1);
                bool     IsCanTransDept = op_patientout.TorrowDrug(patlistid, ServerDate);
                if (IsCanTransDept == true)
                {
                    if (MessageBox.Show(this, strconfirm, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                    {
                        return;
                    }
                    //DataTable dtPresorder = op_patientout.getDtPresorder(patlistid);//出院操作
                    //if (dtPresorder.Rows.Count != 0)//未统领药品进统领单
                    //{
                    //    OP_SendDrugMessage op_sendDrugMessage = new OP_SendDrugMessage();
                    //    DateTime sendtime = XcDate.ServerDateTime;
                    //    int masterid = op_sendDrugMessage.InsertDrugMaster(sendtime, currentUser.UserID, currentUser.Name);
                    //    for (int i = 0; i < dtPresorder.Rows.Count; i++)
                    //    {
                    //        op_sendDrugMessage.InsertDrugMessageRecord(Convert.ToInt32(dtPresorder.Rows[i]["presorderid"]), masterid);
                    //    }
                    //}
                    //DataTable dtDBPresorder = op_patientout.getDrawBackDtPresorder(patlistid);
                    //if (dtDBPresorder.Rows.Count != 0)
                    //{
                    //    OP_SendDrugMessage op_sendDrugMessage = new OP_SendDrugMessage();//未退药品进统领单
                    //    DateTime sendtime = XcDate.ServerDateTime;
                    //    int masterid = op_sendDrugMessage.InsertDBDrugMaster(sendtime, currentUser.UserID, currentUser.Name);
                    //    for (int i = 0; i < dtDBPresorder.Rows.Count; i++)
                    //    {
                    //        op_sendDrugMessage.InsertDBDrugMessageRecord(Convert.ToInt32(dtDBPresorder.Rows[i]["presorderid"]), masterid);
                    //    }
                    //}
                }
                op_patientout.ApplyTransfer(patlistid, Convert.ToInt32(_currentUser.UserID), transdeptid, getdept, out errorMsg);

                if (errorMsg != "")
                {
                    MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                MessageBox.Show(tabPageControl1.SelectedTab.Text + "操作成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessagePromptManager.Messenger senders  = new MessagePromptManager.Messenger(_currentUser.UserID, _currentDept.DeptID, "");
                MessagePromptManager.Messenger receiver = new MessagePromptManager.Messenger(-1, -1, "");
                MessagePromptManager.Messages  message  = new MessagePromptManager.Messages("005", "病人定义出区", "已经成功办理了出区病人,姓名:" + currentpat.patname + ",住院号为:" + currentpat.cureno + ",请及时处理!");
                senders.SendMessage(receiver, message);
            }
            else
            {
                MessageBox.Show("该病人有明日药品费用,请将该部分费用冲正掉后再进行操作!");
            }

            //刷新界面
            this.frmload();

            #region 可以不停医嘱转科

            /*
             * errorMsg = "";
             *
             * //判断是否选中患者
             * if (patlistid == 0)
             * {
             *  MessageBox.Show("您还未选择病人", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             *  return;
             * }
             *
             * //是否有未转抄医嘱
             * if (op_patientout.hasUntranscribeOrder(patlistid))
             * {
             *  errorMsg = "对不起,该病人有未转抄的医嘱,不允许转科!";
             *  MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             *
             * //是否有未执行临时医嘱
             * if(op_patientout.hasUndoTempOrder(patlistid))
             * {
             *  errorMsg = "对不起,该病人有未执行的临时医嘱,不允许转科!";
             *  MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             *
             #region 是否执行长期医嘱
             * //执行长期医嘱
             * if (MessageBox.Show("是否运行执行长期医嘱?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             * {
             *  if (op_patientout.LongOrderStatus(patlistid) == 12 || op_patientout.LongOrderStatus(patlistid) == 112)
             *  {
             *      errorMsg = "对不起,该病人有未执行的长期医嘱,不允许转科!";
             *      MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *      return;
             *  }
             *  else
             *  {
             *      //今天无未执行的长嘱,进入下一个流程,无需代码段
             *  }
             * }
             * //不执行长期医嘱
             * else
             * {
             *  //不执行长期医嘱,直接进入下一个流程,无需代码段
             * }
             *
             #endregion
             *
             * //是否有未停长期账单
             * if (op_patientout.hasUnstopLongTab(patlistid))
             * {
             *  errorMsg = "对不起,该病人有未停止的长期账单,不允许转科!";
             *  MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             * //是否确定转科
             * if (MessageBox.Show("确认“" + patname + "”转到“" + getdept + "”吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
             * {
             *  return;
             * }
             *
             * op_patientout.ApplyTransfer(patlistid, Convert.ToInt32(_currentUser.UserID), transdeptid, getdept, out errorMsg);
             *
             * if (errorMsg != "")
             * {
             *  MessageBox.Show(errorMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             *
             * MessageBox.Show("转科操作成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             *
             * this.frmload();
             */
            #endregion
        }