Ejemplo n.º 1
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;
     }
 }
Ejemplo n.º 2
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;
     }
 }