/// <summary>
        /// 按照执行科室排序
        /// </summary>
        /// <param name="feeItemLists">费用明细</param>
        /// <returns>成功 排序好的处方明细 失败 null</returns>
        private ArrayList CollectFeeItemListsByExeDeptCode(ArrayList feeItemLists)
        {
            feeItemLists.Sort(new SortFeeItemListByExeDeptCode());

            ArrayList sorList = new ArrayList();

            while (feeItemLists.Count > 0)
            {
                ArrayList   sameFeeItemLists = new ArrayList();
                FeeItemList compareItem      = feeItemLists[0] as FeeItemList;
                foreach (FeeItemList f in feeItemLists)
                {
                    if (f.ExecOper.Dept.ID == compareItem.ExecOper.Dept.ID)
                    {
                        sameFeeItemLists.Add(f);
                    }
                    else
                    {
                        break;
                    }
                }
                sorList.Add(sameFeeItemLists);
                foreach (FeeItemList f in sameFeeItemLists)
                {
                    feeItemLists.Remove(f);
                }
            }

            return(sorList);
        }
Example #2
0
 /// <summary>
 /// 作废医嘱信息
 /// </summary>
 /// <param name="r">患者挂号信息</param>
 /// <param name="order">医嘱实体</param>
 /// <param name="errText">错误信息</param>
 /// <returns></returns>
 public int CancelOrder(Register r, Neusoft.HISFC.Models.Order.OutPatient.Order order, ref string errText)
 {
     //普通患者
     if (r.Pact.ID == "6" || r.Pact.ID == "7" || r.Pact.ID == "8")
     {
         FeeItemList f = outPatientFee.QueryFeeItemListFromMOOrder(order.ID);
         if (f == null)
         {
             errText = "查询患者费用信息失败!";
             return(-1);
         }
         if (!string.IsNullOrEmpty(f.Invoice.ID))
         {
             errText = "发票已打印请去收费处退费!";
             return(-1);
         }
         int resultValue = 0;
         if (f.IsConfirmed)
         {
             resultValue = this.CancelOrderConfirm(r, f, order.DCOper.OperTime, ref errText);
         }
         else
         {
             resultValue = this.CancelOrderNOConfirm(r, f, order.DCOper.OperTime, ref errText);
         }
         return(resultValue);
     }
     return(0);
 }
        /// <summary>
        /// 按照最小费用限制数量分明细
        /// </summary>
        /// <param name="payKindCode">患者的支付方式类别</param>
        /// <param name="feeItemLists">费用明细</param>
        /// <returns></returns>
        private ArrayList SplitByFeeCodeCount(string payKindCode, ArrayList feeItemLists)
        {
            int count = this.GetSplitCount(payKindCode);

            ArrayList splitArrayList = new ArrayList();
            ArrayList groupList      = new ArrayList();

            while (feeItemLists.Count > count)
            {
                groupList = new ArrayList();

                for (int i = 0; i < count; i++)
                {
                    FeeItemList f = feeItemLists[i] as FeeItemList;

                    groupList.Add(f);
                }
                foreach (FeeItemList d in groupList)
                {
                    feeItemLists.Remove(d);
                }
                splitArrayList.Add(groupList);
            }
            if (feeItemLists.Count > 0)
            {
                splitArrayList.Add(feeItemLists);
            }

            return(splitArrayList);
        }
Example #4
0
        /// <summary>
        /// 冲费用明细
        /// </summary>
        /// <param name="f">费用实体</param>
        /// <param name="cancelTime">作废时间</param>
        /// <param name="errText">错误信息</param>
        /// <returns></returns>
        private int CancelFeeItemList(FeeItemList f, DateTime cancelTime, ref string errText)
        {
            #region 更新费用退费标记
            if (this.outPatientFee.UpdateFeeItemListCancelType(f.RecipeNO, f.SequenceNO, CancelTypes.Canceled) <= 0)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                errText = "作废患者明细出错!" + outPatientFee.Err;
                return(-1);
            }
            #endregion

            f.TransType           = Neusoft.HISFC.Models.Base.TransTypes.Negative;
            f.FT.OwnCost          = -f.FT.OwnCost;
            f.FT.PayCost          = -f.FT.PayCost;
            f.FT.PubCost          = -f.FT.PubCost;
            f.FT.TotCost          = f.FT.OwnCost + f.FT.PubCost + f.FT.PayCost;
            f.Item.Qty            = -f.Item.Qty;
            f.CancelType          = Neusoft.HISFC.Models.Base.CancelTypes.Canceled;
            f.FeeOper.ID          = this.outPatientFee.Operator.ID;
            f.FeeOper.OperTime    = cancelTime;
            f.ChargeOper.OperTime = cancelTime;
            int iReturn = this.outPatientFee.InsertFeeItemList(f);
            if (iReturn <= 0)
            {
                errText = "插入费用明细冲帐信息出错!" + outPatientFee.Err;
                return(-1);
            }



            return(1);
        }
Example #5
0
 /// <summary>
 /// 冲费用明细
 /// </summary>
 /// <param name="r">患者挂号信息</param>
 /// <param name="f">费用实体</param>
 /// <param name="cancelTime">作废时间</param>
 /// <param name="errText">错误信息</param>
 /// <returns></returns>
 private int CancelFeeItemList(Neusoft.HISFC.Models.Registration.Register r, FeeItemList f, DateTime cancelTime, ref string errText)
 {
     if (r.Pact.ID == "8")
     {
         ArrayList al = outPatientFee.QueryValidFeeDetailbyComoNOAndClinicCode(f.Order.Combo.ID, r.ID);
         if (al == null || al.Count == 0)
         {
             errText = "查询费用信息失败!";
             return(-1);
         }
         foreach (FeeItemList tempf in al)
         {
             if (CancelFeeItemList(tempf, cancelTime, ref errText) < 0)
             {
                 return(-1);
             }
         }
     }
     else
     {
         if (CancelFeeItemList(f, cancelTime, ref errText) < 0)
         {
             return(-1);
         }
     }
     return(1);
 }
        /// <summary>
        /// 显示非药品费用信息
        /// </summary>
        /// <param name="f">非药品费用信息</param>
        private void SetUnDrugFp(FeeItemList f)
        {
            int count = 0;

            count = fpFee_Undrug.Rows.Count;
            this.fpFee_Undrug.Rows.Add(count, 1);
            this.fpFee_Undrug.Cells[count, 0].Text = f.Item.Name;
            this.fpFee_Undrug.Cells[count, 1].Text = f.FeePack == "1" ?
                                                     Neusoft.FrameWork.Public.String.FormatNumber(f.Item.Qty / f.Item.PackQty, 2).ToString() :
                                                     Neusoft.FrameWork.Public.String.FormatNumber(f.Item.Qty, 2).ToString();
            this.fpFee_Undrug.Cells[count, 2].Text = f.Item.PriceUnit;
            this.fpFee_Undrug.Cells[count, 3].Text = f.Item.Price.ToString();
            this.fpFee_Undrug.Cells[count, 4].Text = f.FT.OwnCost.ToString();
        }
Example #7
0
        /// <summary>
        /// 作废已确认的医嘱
        /// </summary>
        /// <returns></returns>
        private int CancelOrderConfirm(Neusoft.HISFC.Models.Registration.Register r, FeeItemList f, DateTime cancelTime, ref string errText)
        {
            if (f.NoBackQty != f.Item.Qty)
            {
                if (f.Item.ItemType == EnumItemType.Drug)
                {
                    errText = f.Item.Name + "已发药,请终端将药品全部后再作废医嘱!";
                    return(-1);
                }
                else
                {
                    errText = f.Item.Name + "终端已确认,请取消确认后再作废医嘱!";
                    return(-1);
                }
            }
            #region 冲费用明细

            if (CancelFeeItemList(r, f, cancelTime, ref errText) < 0)
            {
                return(-1);
            }
            #endregion

            #region 作废退费申请数据
            ArrayList al = returnApplyManager.QueryReturnApplys(f.Patient.PID.CardNO, f.RecipeNO, f.SequenceNO, "1");
            if (al == null)
            {
                errText = "查询退费申请数据失败!" + returnApplyManager.Err;
                return(-1);
            }

            foreach (Neusoft.HISFC.Models.Fee.ReturnApply returnApply in al)
            {
                returnApply.CancelType          = CancelTypes.Valid;
                returnApply.CancelOper.ID       = outPatientFee.Operator.ID;
                returnApply.CancelOper.OperTime = cancelTime;
                if (returnApplyManager.UpdateApplyCharge(returnApply) <= 0)
                {
                    errText = "更新申请表退费标记失败!" + returnApplyManager.Err;
                    return(-1);
                }
            }
            #endregion

            return(1);
        }
        /// <summary>
        /// 获得退费的项目
        /// </summary>
        /// <returns>成功 已退项目集合 失败 null</returns>
        private List <FeeItemList> GetConfirmDrugItem()
        {
            List <FeeItemList> feeItemLists = new List <FeeItemList>();

            for (int i = 0; i < this.fpQuit_SheetDrug.Rows.Count; i++)
            {
                if (this.fpQuit_SheetDrug.Rows[i].Tag != null && this.fpQuit_SheetDrug.Rows[i].Tag is FeeItemList)
                {
                    FeeItemList feeItemList = this.fpQuit_SheetDrug.Rows[i].Tag as FeeItemList;
                    if (feeItemList.NoBackQty > 0)
                    {
                        feeItemList.Item.Qty              = feeItemList.NoBackQty;
                        feeItemList.NoBackQty             = 0;
                        feeItemList.FT.TotCost            = feeItemList.Item.Price * feeItemList.Item.Qty / feeItemList.Item.PackQty;
                        feeItemList.FT.OwnCost            = feeItemList.FT.TotCost;
                        feeItemList.IsNeedUpdateNoBackQty = true;

                        feeItemLists.Add(feeItemList);
                    }
                }
            }

            return(feeItemLists);
        }
Example #9
0
        /// <summary>
        /// 重写基类的取消退费操作,这里为取消退费申请信息
        /// </summary>
        /// <returns></returns>
        protected override int CancelQuitOperation()
        {
            if (this.fpQuit.ActiveSheet.RowCount == 0)
            {
                return(-1);
            }
            //当前选中的行
            int selectedIndex = this.fpQuit.ActiveSheet.ActiveRowIndex;

            if (this.fpQuit.ActiveSheet.Rows[selectedIndex].Tag == null)
            {
                return(-1);
            }

            //获得当前选中项目
            FeeItemList feeItemList = this.fpQuit.ActiveSheet.Rows[selectedIndex].Tag as FeeItemList;

            //判断是否已经确认退费,如果退费,那么不允许取消
            if (feeItemList.Item.User01 == "1")
            {
                MessageBox.Show(Language.Msg("该退药申请药房已做退药确认 无法撤销申请"));

                return(-1);
            }
            //如果该项目是本次未提交数据库的记录,那么直接调用基类的取消操作.
            if (feeItemList.Memo != "OLD")
            {
                return(base.CancelQuitOperation());
            }
            else//取消的项目为提交数据库的记录,那么需要删除数据库记录,判断并发等操作.
            {
                //判断当前退费申请科室,是否为该条记录的退费申请科室,暂时代码没有写.至于为什么没有写,问God.

                DialogResult result = MessageBox.Show(Language.Msg("确认取消本条退费申请信息"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
                                                      MessageBoxOptions.RightAlign);

                if (result == DialogResult.No)
                {
                    return(-1);
                }

                //Transaction t = new Transaction(this.inpatientManager.Connection);
                Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
                this.inpatientManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
                this.phamarcyIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
                this.returnApplyManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

                //对由病区退费申请表获取得退费申请数据 判断退费申请取消并发
                if (feeItemList.User01 == "0")
                {
                    //判断数据是否已被退费确认
                    bool      isStill = false;
                    ArrayList tempAl  = null;

                    tempAl = this.returnApplyManager.QueryDrugReturnApplys(feeItemList.Patient.ID, false, true);

                    foreach (Neusoft.HISFC.Models.Fee.ReturnApply info in tempAl)
                    {
                        if (info.RecipeNO == feeItemList.RecipeNO && info.SequenceNO == feeItemList.SequenceNO)
                        {
                            isStill = true;

                            break;
                        }
                    }

                    if (isStill)
                    {  //数据已被确认
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg("该数据已被退费确认,无法撤销申请"));

                        return(-1);
                    }
                }

                //if (feeItemList.Item.IsPharmacy)
                if (feeItemList.Item.ItemType == Neusoft.HISFC.Models.Base.EnumItemType.Drug)
                {
                    //更新药品明细表中的可退数量,防止并发
                    int returnValue = this.inpatientManager.UpdateNoBackQtyForDrug(feeItemList.RecipeNO, feeItemList.SequenceNO, -feeItemList.Item.Qty, feeItemList.BalanceState);
                    if (returnValue == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg("更新药品可退数量出错!") + this.inpatientManager.Err);

                        return(-1);
                    }
                    else if (returnValue == 0)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg("数据发生变动!请刷新窗口"));

                        return(-1);
                    }

                    //取消退药申请,并判断并发操作
                    //根据不同数据来源进行不同处理
                    //已做过发药确认 作废出库申请
                    if (feeItemList.PayType == Neusoft.HISFC.Models.Base.PayTypes.PhaConfim)
                    {
                        returnValue = this.phamarcyIntegrate.CancelApplyOut(feeItemList.RecipeNO, feeItemList.SequenceNO);
                        if (returnValue == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(Language.Msg("取消退费申请出错!") + this.phamarcyIntegrate.Err);

                            return(-1);
                        }
                        else if (returnValue == 0)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(Language.Msg("数据发生变动!请刷新窗口"));

                            return(-1);
                        }
                    }
                    else//没有发药确认
                    {
                        //恢复出库申请记录为有效   待添加
                        returnValue = this.phamarcyIntegrate.UndoCancelApplyOut(feeItemList.RecipeNO, feeItemList.SequenceNO);
                        if (returnValue == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(this.phamarcyIntegrate.Err);

                            return(-1);
                        }
                        else if (returnValue == 0)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(Language.Msg("该数据已被取消,无法撤销申请"));

                            return(-1);
                        }

                        //取消退费申请 改状态为2 删除退费申请数据
                        //绝对不会错
                        if (this.returnApplyManager.CancelReturnApply(feeItemList.User03, this.returnApplyManager.Operator.ID) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(this.returnApplyManager.Err);

                            return(-1);
                        }
                    }
                }
                else
                {//更新非药品明细表中的可退数量,防止并发
                    int returnValue = this.inpatientManager.UpdateNoBackQtyForUndrug(feeItemList.RecipeNO, feeItemList.SequenceNO, -feeItemList.Item.Qty, feeItemList.BalanceState);
                    if (returnValue == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(this.inpatientManager.Err);

                        return(-1);
                    }
                    else if (returnValue == 0)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg("数据发生变动!请刷新窗口"));

                        return(-1);
                    }

                    //取消退费申请 改状态为2 删除退费申请数据
                    //绝对不会错
                    if (this.returnApplyManager.CancelReturnApply(feeItemList.User03, this.returnApplyManager.Operator.ID) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(this.returnApplyManager.Err);

                        return(-1);
                    }
                }

                Neusoft.FrameWork.Management.PublicTrans.Commit();

                MessageBox.Show(Language.Msg("退费申请取消成功!"));

                base.ClearItemList();

                this.Retrive(false);
            }

            return(1);
        }
Example #10
0
        /// <summary>
        /// 作废未确认的医嘱项目
        /// </summary>
        /// <param name="f"></param>
        /// <param name="cancelTime"></param>
        /// <param name="errText"></param>
        /// <returns></returns>
        private int CancelOrderNOConfirm(Neusoft.HISFC.Models.Registration.Register r, FeeItemList f, DateTime cancelTime, ref string errText)
        {
            if (f.NoBackQty == 0)
            {
                if (f.Item.ItemType == EnumItemType.Drug)
                {
                    errText = f.Item.Name + "已发药,请终端审核后再作废医嘱!";
                    return(-1);
                }
                else
                {
                    errText = f.Item.Name + "终端已确认,请取消确认后再作废医嘱!";
                    return(-1);
                }
            }

            #region 冲费用明细
            if (CancelFeeItemList(r, f, cancelTime, ref errText) < 0)
            {
                return(-1);
            }
            #endregion

            #region  除申请数据
            if (f.Item.ItemType == EnumItemType.Drug)
            {
                #region  除药品申请表数据

                if (!f.IsConfirmed)
                {
                    if (!f.Item.IsNeedConfirm)
                    {
                        if (pharmarcyManager.CancelApplyOutClinic(f.RecipeNO, f.SequenceNO) < 0)
                        {
                            errText = "作废药房发药申请失败!" + pharmarcyManager.Err;
                            return(-1);
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region  除非药品申请表数据
                if (!f.IsConfirmed)
                {
                    if (f.Item.IsNeedConfirm)
                    {
                        if (f.Order.ID == null || f.Order.ID == string.Empty)
                        {
                            f.Order.ID = orderManager.GetNewOrderID();
                        }
                        if (f.Order.ID == null || f.Order.ID == string.Empty)
                        {
                            errText = "获得医嘱流水号出错!";

                            return(-1);
                        }

                        if (confirmIntegrate.DelTecApply(f.RecipeNO, f.SequenceNO.ToString()) < 0)
                        {
                            errText = "删除终端申请信息失败!" + confirmIntegrate.Err;
                            return(-1);
                        }
                    }
                }
                #endregion
            }
            #endregion

            return(1);
        }