예제 #1
0
        private void btnDispense_Click(object sender, EventArgs e)
        {
            try
            {
                if (ConfigManager.IsChecking(_currentDeptId) == true)
                {
                    MessageBox.Show("药品正在盘点中......");
                    return;
                }
                if (_currentPat.InvoiceNum == "" || _presList.Rows.Count <= 0)
                {
                    MessageBox.Show("没有病人需要发药");
                    return;
                }
                List <YP_DRMaster> listMaster = new List <YP_DRMaster>();
                for (int index = 0; index < _presList.Rows.Count; index++)
                {
                    Prescription dispPres   = GetPresFromDt(index);
                    YP_DRMaster  dispMaster = _billProcessor.BuildNewDispenseMaster(dispPres, (int)_currentDeptId,
                                                                                    (int)_currentUserId);
                    listMaster.Add(dispMaster);
                    List <BillOrder> dispList = _billProcessor.BuildNewDispOrder((DataTable)_recipeTb[dispPres.PrescriptionID], dispMaster, 0);
                    if (dispList != null)
                    {
                        _billProcessor.SaveBill(dispMaster, dispList, _currentDeptId);
                    }
                }
                MessageBox.Show("发药成功,请注意库存...", "发药成功提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                ////2010.10.20 门诊住院发药打印发药清单 add by heyan
                //YP_Printer printer= PrintFactory.GetPrinter(ConfigManager.OP_YF_DISPENSE + "MZ"); ;
                //string startPath = Application.StartupPath+"\\report\\门诊发药单据.grf";
                //for (int i = 0; i < listMaster.Count; i++)
                //{
                //    printer.PrintBill(listMaster[i], null, startPath, (int)_currentUserId);
                //}

                for (int i = 0; i < listMaster.Count; i++) //update by heyan 2010.10.29 点发药时直接打印处方
                {
                    mz_Interface.PrintDocPres(listMaster[i].RecipeID);
                }
                lstPatInfo_DoubleClick(null, null);
                if (chkRefresh.Checked == true)
                {
                    btnRefresh_Click(null, null);
                }
                this.txtQueryNum.Focus();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }
예제 #2
0
 private void btnRefund_Click(object sender, EventArgs e)
 {
     try
     {
         if (ConfigManager.IsChecking(_currentDeptId))
         {
             MessageBox.Show("药品正在盘点中......");
             return;
         }
         if (MessageBox.Show("您确定要退以下药品么?", "退药确认",
                             MessageBoxButtons.OKCancel) == DialogResult.Cancel)
         {
             return;
         }
         if (_dispOrder == null || _dispOrder.Rows.Count < 1)
         {
             MessageBox.Show("没有药品可退", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             return;
         }
         if (CheckRefundNum() == false)
         {
             MessageBox.Show("药品退药数量过多,请重新输入");
             return;
         }
         List <YP_DRMaster> printList = new List <YP_DRMaster>();
         for (int index = 0; index < listMaster.Rows.Count; index++)
         {
             YP_DRMaster dispMaster = GetDRMasterFromDt(index);
             YP_DRMaster refMaster  = _billProcessor.BuildNewDispenseMaster(dispMaster,
                                                                            (int)_currentDeptId, (int)_currentUserId);
             List <BillOrder> refList = _billProcessor.BuildNewDispOrder(_dispOrder, dispMaster, 0);
             if (refList.Count > 0)
             {
                 _billProcessor.SaveBill(refMaster, refList, _currentDeptId);
                 printList.Add(refMaster);
             }
         }
         MessageBox.Show("退药成功,请注意库存...", "退药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
     finally
     {
         LoadData(Convert.ToInt32(txtQueryNum.Text).ToString());
         this.txtQueryNum.Focus();
     }
 }
예제 #3
0
 private void btnRefund_Click(object sender, EventArgs e)
 {
     try
     {
         if (ConfigManager.IsChecking(_currentDeptId))
         {
             MessageBox.Show("药品正在盘点中......");
             return;
         }
         if (MessageBox.Show("您确定要退以下药品么?", "退药确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
         {
             return;
         }
         if (_dispOrder == null || _dispOrder.Rows.Count < 1)
         {
             MessageBox.Show("没有药品可退", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             return;
         }
         this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
         ZY_DispPresInfo presInfo = new ZY_DispPresInfo();
         presInfo.CureDocCode = _currentZYPat.CureDocCode;
         presInfo.CureNo      = _currentZYPat.CureNo;
         presInfo.drFlag      = 0;
         presInfo.opType      = ConfigManager.OP_YF_REFUND;
         presInfo.PatListId   = _currentZYPat.PatListID;
         presInfo.PatName     = _currentZYPat.PatientInfo.PatName;
         presInfo.presDeptId  = Convert.ToInt32(_currentZYPat.CurrDeptCode);
         presInfo.recipeNum   = 1;
         YP_DRMaster      refMaster = _billProcessor.BuildNewDispenseMaster(presInfo, (int)_currentDeptId, (int)_currentUserId);
         List <BillOrder> refList   = _billProcessor.BuildNewDispOrder(_dispOrder, refMaster, 1);
         _billProcessor.SaveBill(refMaster, refList, _currentDeptId);
         MessageBox.Show("退药成功,请及时告知记账护士进行冲账");
         this.txtQueryNum.Focus();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
     finally
     {
         _dispOrder = IN_InterFace.QueryRefRecipeOrder(_currentZYPat, (int)_currentDeptId,
                                                       cobBeginDate.Value, cobEndDate.Value);
         dgrdDispOrder.DataSource = _dispOrder;
         this.Cursor = DefaultCursor;
     }
 }
예제 #4
0
 private void btnDispense_Click(object sender, EventArgs e)
 {
     try
     {
         Decimal newDispFee = 0;
         this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
         if (ConfigManager.IsChecking(_currentDeptId) == true)
         {
             MessageBox.Show("药品正在盘点中......");
             return;
         }
         if (this._recipeOrder == null)
         {
             MessageBox.Show("没有药品可发");
             return;
         }
         if (this._recipeOrder.Rows.Count < 1)
         {
             MessageBox.Show("没有药品可发");
             return;
         }
         if (_dispenseModel == 1)
         {
             if (_currentZYPat == null)
             {
                 MessageBox.Show("没有病人需要发药");
                 return;
             }
             YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(_currentZYPat, (int)_currentDeptId, (int)_currentUserId);
             newDispFee = IN_InterFace.QueryPatDispFee(_currentZYPat, (int)_currentDeptId);
             if (this.CompareFee(newDispFee) == false)
             {
                 MessageBox.Show("该病人因费用冲账发药信息需要刷新,请重新刷新");
                 return;
             }
             if (_recipeOrder != null)
             {
                 List <BillOrder> dispList = _billProcessor.BuildNewDispOrder(_recipeOrder, dispMaster, _dispenseModel);
                 _billProcessor.SaveBill(dispMaster, dispList, _currentDeptId);
                 MessageBox.Show("发药成功...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 _recipeOrder = IN_InterFace.QueryRecipeOrder(_currentZYPat, (int)_currentDeptId);
                 dgrdRecipeInfo.DataSource = _recipeOrder;
             }
         }
         //如果是住院统领
         else
         {
             ZY_PatList dispPat;
             for (int index = 0; index < lstPatInfo.CheckedItems.Count; index++)
             {
                 dispPat     = (ZY_PatList)lstPatInfo.CheckedItems[index].Tag;
                 newDispFee += IN_InterFace.QueryPatDispFee(dispPat, (int)_currentDeptId);
             }
             if (CompareFee(newDispFee) == false)
             {
                 MessageBox.Show("有病人因费用冲账发药信息需要刷新,请重新刷新");
                 return;
             }
             List <BillMaster> dispList = new List <BillMaster>();
             for (int index = 0; index < lstPatInfo.CheckedItems.Count; index++)
             {
                 dispPat = (ZY_PatList)lstPatInfo.CheckedItems[index].Tag;
                 YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(dispPat, (int)_currentDeptId, (int)_currentUserId);
                 dispList.Add(dispMaster);
             }
             YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _searchDeptId, _allDispPats));
             MessageBox.Show("发药成功,开始打印统领发药单据...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             PrintDispTL(dispList, newDispDept);
             LoadTLMessage();
         }
         this.txtQueryNum.Focus();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
     finally
     {
         this.Cursor = DefaultCursor;
     }
 }
예제 #5
0
        private void btnDispense_Click(object sender, EventArgs e)
        {
            try
            {
                Decimal newDispFee = 0;
                this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
                if (ConfigManager.IsChecking(_currentDeptId) == true)
                {
                    MessageBox.Show("药品正在盘点中......");
                    return;
                }
                if (this._recipeOrder == null)
                {
                    MessageBox.Show("没有药品可发");
                    return;
                }
                if (this._recipeOrder.Rows.Count < 1)
                {
                    MessageBox.Show("没有药品可发");
                    return;
                }

                for (int index = 0; index < selectPat.Count; index++)
                {
                    newDispFee += IN_InterFace.QueryPatDispFee(selectPat[index], (int)_currentDeptId);
                }
                if (CompareFee(newDispFee) == false)
                {
                    MessageBox.Show("有病人因费用冲账发药信息需要刷新,请重新刷新");
                    return;
                }
                List <BillMaster> dispList = new List <BillMaster>();
                for (int index = 0; index < selectPat.Count; index++)
                {
                    DataTable   dt         = (DataTable)_allDispPats[selectPat[index].CureNo];
                    YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(selectPat[index], (int)_currentDeptId, (int)_currentUserId,
                                                                                   Convert.ToInt32(dt.Rows[0]["presamount"].ToString()), Convert.ToInt32(dt.Rows[0]["group_id"].ToString()));
                    dispList.Add(dispMaster);
                    for (int j = 1; j < dt.Rows.Count; j++)
                    {
                        if (dt.Rows[j]["group_id"].ToString().Trim() != dt.Rows[j - 1]["group_id"].ToString().Trim())
                        {
                            dispMaster = _billProcessor.BuildNewDispenseMaster(selectPat[index], (int)_currentDeptId, (int)_currentUserId,
                                                                               Convert.ToInt32(dt.Rows[j]["presamount"].ToString()), Convert.ToInt32(dt.Rows[j]["group_id"].ToString()));
                            dispList.Add(dispMaster);
                        }
                    }
                }
                YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _searchDeptId, _allDispPats));
                MessageBox.Show("发药成功,开始打印摆药单...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                PrintBy();
                // PrintDispTL(dispList, newDispDept);
                dgrdRecipeInfo.DataSource = null;
                LoadMsgMaster();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
            finally
            {
                this.Cursor = DefaultCursor;
            }
        }
예제 #6
0
 /// <summary>
 /// 根据发药明细按单个病人构造数据容器(hashtable:key为病人ID,object 为该病人的发药明细)
 /// </summary>
 /// <param name="allDispPats">构建后的数据容器</param>
 /// <returns></returns>
 private List <BillMaster> PutDrugByOrder(Hashtable allDispPats)
 {
     try
     {
         if (allDispPats == null)
         {
             throw new Exception("发药信息为空");
         }
         allDispPats.Clear();
         List <BillMaster> dispList = new List <BillMaster>();
         for (int index = 0; index < _recipeOrder.Rows.Count; index++)
         {
             DataRow currentRow = _recipeOrder.Rows[index];
             if (currentRow["ISDISPENSE"] == DBNull.Value)
             {
                 continue;
             }
             if (Convert.ToInt32(currentRow["ISDISPENSE"]) == 1)
             {
                 BillMaster findMaster = dispList.Find(
                     delegate(HIS.Model.BillMaster searchMaster)
                 {
                     YP_DRMaster drMaster = (YP_DRMaster)searchMaster;
                     if (drMaster.DrugOC_Flag == 1 && Convert.ToInt32(currentRow["drugnum"]) >= 0)
                     {
                         return(currentRow["CURENO"].ToString() == ((YP_DRMaster)searchMaster).InpatientID);
                     }
                     else if (drMaster.DrugOC_Flag == 0 && Convert.ToInt32(currentRow["drugnum"]) < 0)
                     {
                         return(currentRow["CURENO"].ToString() == ((YP_DRMaster)searchMaster).InpatientID);
                     }
                     else
                     {
                         return(false);
                     }
                 });
                 if (findMaster == null)
                 {
                     ZY_DispPresInfo presInfo = new ZY_DispPresInfo();
                     presInfo.CureDocCode = currentRow["CUREDOC"].ToString();
                     presInfo.CureNo      = currentRow["CURENO"].ToString();
                     presInfo.drFlag      = Convert.ToInt32(currentRow["drugnum"]) >= 0 ? 1 : 0;
                     presInfo.opType      = presInfo.drFlag == 1 ? ConfigManager.OP_YF_DISPENSE : ConfigManager.OP_YF_REFUND;
                     presInfo.PatListId   = Convert.ToInt32(currentRow["PATID"]);
                     presInfo.PatName     = currentRow["PATNAME"].ToString();
                     presInfo.presDeptId  = Convert.ToInt32(currentRow["CUREDEPT"]);
                     presInfo.recipeNum   = 1;
                     YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(presInfo,
                                                                                    (int)_currentDeptId, (int)_currentUserId);
                     dispList.Add(dispMaster);
                     DataTable orderDt = _recipeOrder.Clone();
                     orderDt.Rows.Add(currentRow.ItemArray);
                     allDispPats.Add(dispMaster.InpatientID + dispMaster.DrugOC_Flag.ToString(), orderDt);
                 }
                 else
                 {
                     YP_DRMaster dispMaster = (YP_DRMaster)findMaster;
                     ((DataTable)allDispPats[dispMaster.InpatientID + dispMaster.DrugOC_Flag.ToString()]).Rows.Add(currentRow.ItemArray);
                 }
             }
         }
         return(dispList);
     }
     catch (Exception error)
     {
         throw error;
     }
 }