Example #1
0
        /// <summary>
        /// 生成结算主信息
        /// </summary>
        /// <param name="invoiceNO">发票号</param>
        /// <param name="operTime">操作时间</param>
        /// <param name="balanceNO">结算序号</param>
        /// <param name="balanceLists">承载BalanceList的范型集合</param>
        /// <returns>成功:发票住表信息实体 失败: null</returns>
        protected Neusoft.HISFC.Models.Fee.Inpatient.Balance MakeBalanceFromBalanceList(string invoiceNO, DateTime operTime, int balanceNO, ArrayList balanceLists)
        {
            Neusoft.HISFC.Models.Fee.Inpatient.Balance balance = new Neusoft.HISFC.Models.Fee.Inpatient.Balance();

            balance    = ((Neusoft.HISFC.Models.Fee.Inpatient.Balance)(balanceLists[0] as BalanceList).BalanceBase).Clone();
            balance.FT = new Neusoft.HISFC.Models.Base.FT();

            foreach (BalanceList balanceList in balanceLists)
            {
                balance.FT.TotCost += balanceList.BalanceBase.FT.TotCost;
                balance.FT.OwnCost += balanceList.BalanceBase.FT.OwnCost;
                balance.FT.PayCost += balanceList.BalanceBase.FT.PayCost;
                balance.FT.PubCost += balanceList.BalanceBase.FT.PubCost;
            }

            balance.CancelType    = Neusoft.HISFC.Models.Base.CancelTypes.Valid;
            balance.FT.SupplyCost = balance.FT.TotCost;
            balance.BeginTime     = operTime;
            balance.EndTime       = operTime;
            balance.PrintTimes    = 1;
            balance.IsMainInvoice = true;
            balance.IsLastBalance = false;
            balance.ID            = balanceNO.ToString();

            return(balance);
        }
Example #2
0
        /// <summary>
        /// 发票打印
        /// </summary>
        /// <param name="alBalanceList">结算大类数组</param>
        /// <param name="balanceForInvoice">结算主实体</param>
        protected virtual void PrintInvoice(ArrayList alBalanceList, Neusoft.HISFC.Models.Fee.Inpatient.Balance balanceForInvoice)
        {
            //Balance.ucBalanceInvoice balanceInvoice = new UFC.InpatientFee.Balance.ucBalanceInvoice();
            Neusoft.HISFC.BizProcess.Interface.FeeInterface.IBalanceInvoicePrintmy balanceInvoice = Neusoft.FrameWork.WinForms.Classes.UtilInterface.CreateObject(this.GetType(), typeof(Neusoft.HISFC.BizProcess.Interface.FeeInterface.IBalanceInvoicePrintmy)) as Neusoft.HISFC.BizProcess.Interface.FeeInterface.IBalanceInvoicePrintmy;

            if (balanceInvoice == null)
            {
                return;
            }
            balanceInvoice.PatientInfo = this.patientInfo;
            //{D0D3A300-FD19-4fef-B763-FD5697274BBD}
            if (balanceInvoice.SetValueForPrint(this.patientInfo, balanceForInvoice, alBalanceList, null) == -1)
            {
                return;
            }
            //调打印类
            balanceInvoice.Print();
        }
Example #3
0
        /// <summary>
        /// 保存收费信息
        /// </summary>
        /// <returns>成功 1 失败 -1</returns>
        public int Save()
        {
            if (!this.IsValid())
            {
                return(-1);
            }

            //开始数据库事务
            //Transaction t = new Transaction(this.inpatientManager.Connection);
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
            this.inpatientManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.feeIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.radtIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.controlManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.pharmacyInterate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);


            //变量定义
            ArrayList feeItemlists   = new ArrayList();                                    //当前要收费项目列表
            string    invoiceNO      = string.Empty;                                       //发票号
            DateTime  nowTime        = this.inpatientManager.GetDateTimeFromSysDateTime(); //当前系统时间
            int       balanceNO      = 0;                                                  //结算序号
            string    recipeDoctCode = string.Empty;                                       //开立医生编码
            int       returnValue    = 0;                                                  //返回值
            string    errText        = string.Empty;                                       //错误信息

            recipeDoctCode = this.ucInpatientCharge1.RecipeDoctCode;

            //获得发票号
            //{C3C5304F-2034-4fbd-A42C-EFE4F6EA6E8E}
            //invoiceNO = this.feeIntegrate.GetNewInvoiceNO(Neusoft.HISFC.Models.Fee.EnumInvoiceType.I);
            invoiceNO = this.feeIntegrate.GetNewInvoiceNO("I");
            if (invoiceNO == null || invoiceNO.Trim() == string.Empty)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("请领取住院结算发票!"));

                return(-1);
            }

            //获得结算序号
            balanceNO = this.GetBalanceNO();
            if (balanceNO == -1)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("获得结算序号出错!") + this.inpatientManager.Err);

                return(-1);
            }

            //如果是手工输入的姓名,当作重新登记患者处理
            if (this.isInputName)
            {
                this.patientInfo.BalanceNO = balanceNO;

                if (this.InsertPatientInfo() == -1)
                {
                    this.feeIntegrate.Rollback();
                    MessageBox.Show(Language.Msg("插入患者基本信息!") + this.radtIntegrate.Err);

                    return(-1);
                }
            }

            //获得当前所有要收费的项目信息,并且赋值医生,当前时间等信息
            feeItemlists = this.ucInpatientCharge1.QueryFeeItemArrayList(recipeDoctCode, nowTime, "0");
            if (feeItemlists == null)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("获得收费明细出错!"));

                return(-1);
            }
            if (feeItemlists.Count == 0)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("请录入收费明细!"));

                return(-1);
            }

            //循环对费用明细赋值
            foreach (FeeItemList f in feeItemlists)
            {
                f.TransType = Neusoft.HISFC.Models.Base.TransTypes.Positive;
                f.Patient   = this.patientInfo.Clone();
                f.PayType   = Neusoft.HISFC.Models.Base.PayTypes.Balanced;
                //f.ExecOper.ID = this.inpatientManager.Operator.ID;
                //f.ExecOper.OperTime = nowTime;
                f.FeeOper.ID         = this.inpatientManager.Operator.ID;
                f.FeeOper.OperTime   = nowTime;
                f.BalanceNO          = balanceNO;
                f.BalanceState       = "1";
                f.NoBackQty          = f.Item.Qty;
                f.Invoice.ID         = invoiceNO;
                f.RecipeOper.ID      = recipeDoctCode;
                f.RecipeOper.Dept.ID = this.patientInfo.PVisit.PatientLocation.Dept.ID;
                f.StockOper.Dept.ID  = f.ExecOper.Dept.ID;
            }

            //调用收费函数
            this.feeIntegrate.MessageType = Neusoft.HISFC.Models.Base.MessType.N;
            returnValue = this.feeIntegrate.FeeItem(this.patientInfo, ref feeItemlists);
            if (returnValue == -1)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("调用收费函数出错!") + this.feeIntegrate.Err);

                return(-1);
            }

            //插入发药申请
            foreach (FeeItemList f in feeItemlists)
            {
                //if (f.Item.IsPharmacy)
                if (f.Item.ItemType == Neusoft.HISFC.Models.Base.EnumItemType.Drug)
                {
                    returnValue = this.pharmacyInterate.ApplyOut(this.patientInfo, f, nowTime, true);
                    if (returnValue == -1)
                    {
                        this.feeIntegrate.Rollback();
                        MessageBox.Show(Language.Msg("调用发药申请函数出错!") + this.pharmacyInterate.Err);

                        return(-1);
                    }
                }
            }

            //生成结算明细
            ArrayList balanceList = this.MakeBalanceListFromFeeItemList(invoiceNO, nowTime, balanceNO, feeItemlists, ref errText);

            if (balanceList == null)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("生成结算明细出错!") + errText);

                return(-1);
            }

            //插入结算明细信息
            returnValue = this.feeIntegrate.InsertBalanceList(this.patientInfo, balanceList);
            if (returnValue == -1)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("插入结算明细出错!") + this.feeIntegrate.Err);

                return(-1);
            }

            //生成结算头信息
            Neusoft.HISFC.Models.Fee.Inpatient.Balance balance = this.MakeBalanceFromBalanceList(invoiceNO, nowTime, balanceNO, balanceList);
            if (balance == null)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("生成结算头出错!"));

                return(-1);
            }

            //插入结算头信息
            returnValue = this.inpatientManager.InsertBalance(this.patientInfo, balance);
            if (returnValue == -1)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("插入结算头表出错!") + this.inpatientManager.Err);

                return(-1);
            }

            balancePayControl = new Neusoft.HISFC.Components.Common.Controls.ucBalancePay();

            balancePayControl.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            balancePayControl.IsShowButton = true;
            balancePayControl.Init();
            balancePayControl.ServiceType = Neusoft.HISFC.Models.Base.ServiceTypes.I;
            balancePayControl.TotOwnCost  = balance.FT.OwnCost;
            balancePayControl.RealCost    = balance.FT.OwnCost;

            Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(balancePayControl);

            if (!balancePayControl.IsCurrentChoose)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("请正确选择支付方式!"));

                return(-1);
            }

            ArrayList balancePayList = this.balancePayControl.QueryBalancePayList();

            if (balancePayList == null || balancePayList.Count == 0)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("请重新选择支付方式!"));

                return(-1);
            }

            foreach (Neusoft.HISFC.Models.Fee.Inpatient.BalancePay balancePay in balancePayList)
            {
                balancePay.Invoice.ID           = invoiceNO;
                balancePay.BalanceNO            = balanceNO;
                balancePay.TransKind.ID         = "1";
                balancePay.BalanceOper.ID       = this.inpatientManager.Operator.ID;
                balancePay.BalanceOper.OperTime = nowTime;
                returnValue = this.inpatientManager.InsertBalancePay(balancePay);
                if (returnValue == -1)
                {
                    this.feeIntegrate.Rollback();
                    MessageBox.Show(Language.Msg("插入支付方式失败!") + this.inpatientManager.Err);

                    return(-1);
                }
            }

            returnValue = this.inpatientManager.UpdateInMainInfoBalanced(this.patientInfo, nowTime, balanceNO, balance.FT);
            if (returnValue != 1)
            {
                this.feeIntegrate.Rollback();
                MessageBox.Show(Language.Msg("更新住院主表失败!") + this.inpatientManager.Err);

                return(-1);
            }

            //如果是手工输入的姓名,当作重新登记患者处理
            if (this.isInputName)
            {
                Neusoft.HISFC.Models.RADT.InStateEnumService status = new InStateEnumService();
                status.ID = Neusoft.HISFC.Models.Base.EnumInState.O;
                //更新患者状态为出院结算状态
                if (this.radtIntegrate.UpdatePatientState(this.patientInfo, status) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg("更新患者状态发生错误!") + this.feeIntegrate.Err);

                    return(-1);
                }
            }

            this.feeIntegrate.Commit();

            MessageBox.Show(Language.Msg("收费成功!"));

            this.PrintInvoice(balanceList, balance);

            this.Clear();

            return(1);
        }