Beispiel #1
0
        public ServiceResponseData SavePayment()
        {
            Basic_Payment report = requestData.GetData <Basic_Payment>(0);

            this.BindDb(report);
            report.save();
            responseData.AddData(true);
            return(responseData);
        }
        /// <summary>
        /// 选中网格
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void gridPayment_CurrentCellChanged(object sender, EventArgs e)
        {
            if (gridPayment.CurrentCell != null)
            {
                DataTable     dt      = gridPayment.DataSource as DataTable;
                Basic_Payment payment = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <Basic_Payment>(dt, gridPayment.CurrentCell.RowIndex);
                CurrPayment = payment;

                SetbtnState(OperType.默认);

                if (payment.DelFlag == 1)
                {
                    btnStop.Text = "启用";
                }
                else
                {
                    btnStop.Text = "停用";
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 处方正式结算
        /// </summary>
        /// <param name="curPatlist">当前病人对象</param>
        /// <param name="operatoreid">操作员ID</param>
        /// <param name="budgeInfo">预算对象</param>
        /// <param name="prescriptions">处方对象</param>
        public override void Balance(OP_PatList curPatlist, int operatoreid, List <ChargeInfo> budgeInfo, List <Prescription> prescriptions)
        {
            #region 医生站处方判断和状态修改,医技确费状态修改
            CheckDocPrsc(prescriptions);
            #endregion

            DateTime chargedate   = DateTime.Now;
            int      iAccountType = 0;

            //得到当前结账ID
            int curAccountId = NewObject <CommonMethod>().GetAccountId(operatoreid, iAccountType);

            //实际上多张处方一次结算只有一条记录
            foreach (ChargeInfo chargeInfo in budgeInfo)
            {
                string        invoiceNo    = string.Empty;
                Basic_Invoice basicInvoice = NewObject <CommonMethod>().GetCurInvoice(InvoiceType.门诊收费, operatoreid);
                string        perfChar     = string.Empty;
                invoiceNo = NewObject <InvoiceManagement>().GetInvoiceCurNOAndUse(InvoiceType.门诊收费, operatoreid, out perfChar);
                invoiceNo = perfChar + invoiceNo; //多张处方一张票号
                int   costheadid = chargeInfo.CostHeadID;
                int[] feeHeadids = chargeInfo.FeeItemHeadIDs;
                chargeInfo.InvoiceCount = 1;
                chargeInfo.ChargeDate   = chargedate;
                OP_CostHead costHead = NewObject <OP_CostHead>().getmodel(costheadid) as OP_CostHead;
                if (costHead != null && costHead.CostHeadID > 0)
                {
                    //结算主表状态和金额写入
                    costHead.ChargeEmpID  = operatoreid;
                    costHead.CostStatus   = 0;//正常收费标志改为0
                    costHead.CostDate     = chargedate;
                    costHead.CashFee      = chargeInfo.CashFee;
                    costHead.PosFee       = chargeInfo.PosFee;
                    costHead.PromFee      = chargeInfo.FavorableTotalFee;
                    costHead.RoundingFee  = chargeInfo.RoundFee;
                    costHead.EndInvoiceNO = invoiceNo;
                    costHead.BeInvoiceNO  = invoiceNo;
                    costHead.AccountID    = curAccountId;
                    costHead.InvoiceID    = basicInvoice.ID;//保存使用票据的发票卷序号
                    this.BindDb(costHead);
                    costHead.save();

                    //费用主表状态修改
                    NewDao <IOPManageDao>().UpdateFeeItemHeadStatus(costHead.CostHeadID, invoiceNo, chargedate, operatoreid);

                    //插入结算支付方式表
                    foreach (OP_CostPayMentInfo payment in chargeInfo.PayInfoList)
                    {
                        payment.PatListID  = curPatlist.PatListID;
                        payment.PatName    = curPatlist.PatName;
                        payment.PatType    = costHead.PatTypeID.ToString();
                        payment.AccountID  = curAccountId;
                        payment.CostHeadID = costHead.CostHeadID;
                        Basic_Payment basePayment = NewObject <Basic_Payment>().getmodel(payment.PayMentID) as Basic_Payment;
                        payment.PayMentCode = basePayment.PayCode;
                        payment.PayMentName = basePayment.PayName;
                        this.BindDb(payment);
                        payment.save();
                    }

                    //减虚拟库存
                    MinisStorage(prescriptions, false);

                    //会员积分
                    AddScore(curPatlist.MemberAccountID, costHead.TotalFee, costHead.CostHeadID.ToString(), operatoreid);
                    if (chargeInfo.FavorableTotalFee > 0)
                    {
                        SavePromData(costHead.PatTypeID, costHead.MemberAccountID, costHead.TotalFee, prescriptions, operatoreid, costHead.CostHeadID);
                    }

                    AddAccoutFee(costHead, curAccountId, 1, 0);
                }
                else
                {
                    throw new Exception("没有找到结算号的记录!");
                }
            }
        }
        /// <summary>
        /// 住院结算
        /// </summary>
        /// <param name="patEnterHDate">病人入院日期</param>
        /// <param name="costHead">结算头信息</param>
        /// <param name="costPayList">支付方式列表</param>
        /// <param name="resDiscountInfo">优惠信息数据</param>
        /// <param name="workID">机构ID</param>
        /// <returns>错误消息</returns>
        public string DischargeSettlement(DateTime patEnterHDate, IP_CostHead costHead, List <IP_CostPayment> costPayList, DiscountInfo resDiscountInfo, int workID)
        {
            // 检查最新费用是否发生过变化
            // 获取最新费用总额
            DataTable tempDt = NewDao <IIPManageDao>().GetPatDepositFee(costHead.PatListID);

            if (tempDt != null)
            {
                // 最新住院费用总额
                decimal tempDepositFee = Convert.ToDecimal(tempDt.Rows[0][0]);
                // 最新预交金总额
                decimal tempTotalFee = Convert.ToDecimal(tempDt.Rows[1][0]);
                if (costHead.TotalFee != tempTotalFee || costHead.DeptositFee != tempDepositFee)
                {
                    return("当前病人的费用数据已发生改变,请刷新费用列表后重新结算!");
                }
            }
            else
            {
                return("当前病人的费用已被结算!");
            }
            // 取得病人上一次结算时间
            DataTable costDateDt = NewDao <IIPManageDao>().GetPatLastCostDate(costHead.PatListID);

            // 如果病人存在结算记录,结算起始日期为上一次结算时间
            if (costDateDt != null && costDateDt.Rows.Count > 0)
            {
                costHead.CostBeginDate = Convert.ToDateTime(costDateDt.Rows[0][0]);
            }
            else
            {
                // 病人没有结算记录,结算起始时间为入院时间
                costHead.CostBeginDate = patEnterHDate;
            }

            costHead.CostEndDate = DateTime.Now;
            // 取得票据ID
            InvoiceManagement invoicemanagement = NewObject <InvoiceManagement>();
            Basic_Invoice     invoice           = invoicemanagement.GetInvoiceCurNo(InvoiceType.住院结算, costHead.CostEmpID);

            costHead.InvoiceID = invoice.ID; // 票据ID
            // 写入结算头表数据
            this.BindDb(costHead);
            costHead.save();

            string perfChar = string.Empty;

            // 使用票据号
            NewObject <InvoiceManagement>().GetInvoiceCurNOAndUse(InvoiceType.住院结算, costHead.CostEmpID, out perfChar);
            // 写入结算明细表数据
            bool result = NewDao <IIPManageDao>().SaveCostDetail(costHead.CostHeadID, costHead.InvoiceID, costHead.InvoiceNO, workID, costHead.PatListID);

            // 写入支付记录表数据
            if (costPayList.Count > 0)
            {
                foreach (IP_CostPayment costpay in costPayList)
                {
                    costpay.CostHeadID = costHead.CostHeadID;
                    // 取得支付方式名
                    Basic_Payment basePayment = NewObject <Basic_Payment>().getmodel(costpay.PaymentID) as Basic_Payment;
                    costpay.PayName = basePayment.PayName;
                    // 保存支付记录表数据
                    this.BindDb(costpay);
                    costpay.save();
                }
            }

            // 修改预交金表的结算ID
            NewDao <IIPManageDao>().CostDeposit(costHead.PatListID, costHead.CostHeadID, costHead.CostType, false);

            // 修改费用明细表数据的结算ID
            NewDao <IIPManageDao>().CostFeeItemRecord(costHead.PatListID, costHead.CostHeadID, costHead.CostType, false);

            // 出院结算和欠费结算的场合,修改病人状态
            if (costHead.CostType == 2 || costHead.CostType == 3)
            {
                NewDao <IIPManageDao>().UpdatePatStatus(costHead.PatListID, 4);
            }

            // 保存积分数据
            NewObject <MemberManagement>().SaveAddScoreList(costHead.MemberAccountID, costHead.TotalFee, 3, costHead.CostHeadID.ToString(), costHead.CostEmpID);
            // 写入优惠明细数据
            // 将结算主表ID写入优惠明细数据
            if (costHead.PromFee > 0)
            {
                // 生效优惠数据
                NewObject <PromotionManagement>().UpdateDiscountInfo(costHead.CostHeadID, resDiscountInfo.AccID);
            }

            return(string.Empty);
        }
Beispiel #5
0
        public ServiceResponseData SaveRegister()
        {
            try
            {
                OP_PatList curPatlist      = requestData.GetData <OP_PatList>(0);
                decimal    totalFee        = requestData.GetData <decimal>(1); //挂号总金额
                string     paymentCode     = requestData.GetData <string>(2);  //支付方式Code
                decimal    medicareFee     = requestData.GetData <decimal>(3); //医保统筹支付金额
                decimal    payFee          = requestData.GetData <decimal>(4); //应付金额
                decimal    promFee         = requestData.GetData <decimal>(5); //优惠金额
                decimal    medicarePersFee = requestData.GetData <decimal>(6); //医保个账支付金额
                if (string.IsNullOrEmpty(curPatlist.PatName))
                {
                    throw new Exception("请先输入病人信息");
                }

                PayMentInfoList           payinfoList     = new PayMentInfoList();
                List <OP_CostPayMentInfo> paymentInfoList = new List <OP_CostPayMentInfo>();
                if (medicareFee > 0)
                {
                    string             medicarePayMentCode = NewObject <CommonMethod>().GetOpConfig(OpConfigConstant.RegMedicareCode);//获取医保对应的支付方式Code
                    OP_CostPayMentInfo paymentinfo         = new OP_CostPayMentInfo();
                    paymentinfo.PayMentCode  = medicarePayMentCode;
                    paymentinfo.PayMentMoney = medicareFee;
                    Basic_Payment basicPayment = NewObject <CommonMethod>().GetPayMentByCode(paymentinfo.PayMentCode);
                    paymentinfo.PayMentID   = basicPayment.PaymentID;
                    paymentinfo.PayMentName = basicPayment.PayName;
                    paymentInfoList.Add(paymentinfo);
                }

                if (medicarePersFee > 0)
                {
                    OP_CostPayMentInfo paymentinfo = new OP_CostPayMentInfo();
                    paymentinfo.PayMentCode  = "04";
                    paymentinfo.PayMentMoney = medicarePersFee;
                    Basic_Payment basicPayment = NewObject <CommonMethod>().GetPayMentByCode(paymentinfo.PayMentCode);
                    paymentinfo.PayMentID   = basicPayment.PaymentID;
                    paymentinfo.PayMentName = basicPayment.PayName;
                    paymentInfoList.Add(paymentinfo);
                }

                if (promFee > 0)
                {
                    OP_CostPayMentInfo paymentinfo = new OP_CostPayMentInfo();
                    paymentinfo.PayMentCode  = "03";
                    paymentinfo.PayMentMoney = promFee;
                    Basic_Payment basicPayment = NewObject <CommonMethod>().GetPayMentByCode(paymentinfo.PayMentCode);
                    paymentinfo.PayMentID   = basicPayment.PaymentID;
                    paymentinfo.PayMentName = basicPayment.PayName;
                    paymentInfoList.Add(paymentinfo);
                }

                decimal cashFee = 0;
                decimal posFee  = 0;
                if (payFee > 0)
                {
                    OP_CostPayMentInfo paymentinfo = new OP_CostPayMentInfo();
                    paymentinfo.PayMentCode  = paymentCode;
                    paymentinfo.PayMentMoney = payFee;
                    Basic_Payment basicPayment = NewObject <CommonMethod>().GetPayMentByCode(paymentinfo.PayMentCode);
                    paymentinfo.PayMentID   = basicPayment.PaymentID;
                    paymentinfo.PayMentName = basicPayment.PayName;
                    paymentInfoList.Add(paymentinfo);

                    //现金
                    if (paymentCode == "01")
                    {
                        cashFee += payFee;
                    }

                    //POS
                    if (paymentCode == "02")
                    {
                        posFee += posFee;
                    }
                }

                payinfoList.paymentInfolist = paymentInfoList;
                DataTable dtPrint = new DataTable();
                NewObject <RegisterProcess>().SaveRegInfo(curPatlist, payinfoList, totalFee, cashFee, posFee, out dtPrint, promFee);
                responseData.AddData(dtPrint);    //打印信息
                responseData.AddData(curPatlist); //病人对象
                return(responseData);
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 收费正式结算
        /// </summary>
        /// <param name="curPatlist">病人对象</param>
        /// <param name="operatoreid">操作员ID</param>
        /// <param name="budgeInfo">预算对象</param>
        /// <param name="prescriptions">处方对象</param>
        public override void Balance(OP_PatList curPatlist, int operatoreid, List <ChargeInfo> budgeInfo, List <Prescription> prescriptions)
        {
            #region 医生站处方判断和状态修改,医技确费状态修改
            CheckDocPrsc(prescriptions);
            #endregion
            DateTime chargedate   = DateTime.Now;
            int      iAccountType = 0;

            //得到当前结账ID
            int curAccountId = NewObject <CommonMethod>().GetAccountId(operatoreid, iAccountType);

            //实际上一次结算只有一条记录结算表只一条记录
            foreach (ChargeInfo chargeInfo in budgeInfo)
            {
                int   costheadid = chargeInfo.CostHeadID;
                int[] feeHeadids = chargeInfo.FeeItemHeadIDs;

                //int invoiceNum= NewObject<CommonMethod>().GetInvoiceInfo(InvoiceType.门诊收费, operatoreid, out curInvoiceNO);
                //if (invoiceNum < feeHeadids.Length)
                //{
                //    throw new Exception("本次收费需要"+feeHeadids.Length+"张票,您的可用票据张数不足");
                //}
                chargeInfo.InvoiceCount = feeHeadids.Length;
                chargeInfo.ChargeDate   = chargedate;
                OP_CostHead costHead = NewObject <OP_CostHead>().getmodel(costheadid) as OP_CostHead;
                if (costHead != null && costHead.CostHeadID > 0)
                {
                    string        bInvoiceNo   = string.Empty;
                    string        eInvoiceNo   = string.Empty;
                    Basic_Invoice basicInvoice = NewObject <CommonMethod>().GetCurInvoice(InvoiceType.门诊收费, operatoreid);
                    if (basicInvoice.EndNO - basicInvoice.CurrentNO + 1 < feeHeadids.Length)
                    {
                        throw new Exception("本次收费需要" + feeHeadids.Length + "张票,您当前使用发票卷的可用票据张数不足");
                    }

                    for (int feeIndex = 0; feeIndex < feeHeadids.Length; feeIndex++)
                    {
                        //费用主表状态修改
                        OP_FeeItemHead feeItemHead = NewObject <OP_FeeItemHead>().getmodel(feeHeadids[feeIndex]) as OP_FeeItemHead;
                        string         invoiceNo   = string.Empty;
                        string         perfChar    = string.Empty;
                        invoiceNo = NewObject <InvoiceManagement>().GetInvoiceCurNOAndUse(InvoiceType.门诊收费, operatoreid, out perfChar);
                        invoiceNo = perfChar + invoiceNo;

                        //一张处方一张票号
                        feeItemHead.InvoiceNO    = invoiceNo;
                        feeItemHead.ChargeDate   = chargedate;
                        feeItemHead.ChargeFlag   = 1;
                        feeItemHead.ChargeStatus = 0;
                        feeItemHead.ChargeEmpID  = operatoreid;
                        feeItemHead.save();
                        if (feeIndex == 0)
                        {
                            bInvoiceNo = invoiceNo;
                        }
                        else if (feeIndex == feeHeadids.Length - 1)
                        {
                            eInvoiceNo = invoiceNo;
                        }
                    }

                    //结算主表状态和金额写入
                    costHead.ChargeEmpID  = operatoreid;
                    costHead.CostStatus   = 0;//正常收费标志改为0
                    costHead.CostDate     = chargedate;
                    costHead.CashFee      = chargeInfo.CashFee;
                    costHead.PosFee       = chargeInfo.PosFee;
                    costHead.PromFee      = chargeInfo.FavorableTotalFee;
                    costHead.RoundingFee  = chargeInfo.RoundFee;
                    costHead.EndInvoiceNO = bInvoiceNo;
                    costHead.BeInvoiceNO  = eInvoiceNo;
                    costHead.AccountID    = curAccountId;
                    costHead.InvoiceID    = basicInvoice.ID;//写入发票卷序号
                    this.BindDb(costHead);
                    costHead.save();

                    //插入结算支付方式表
                    foreach (OP_CostPayMentInfo payment in chargeInfo.PayInfoList)
                    {
                        payment.PatListID  = curPatlist.PatListID;
                        payment.PatName    = curPatlist.PatName;
                        payment.PatType    = costHead.PatTypeID.ToString();
                        payment.AccountID  = curAccountId;
                        payment.CostHeadID = costHead.CostHeadID;
                        Basic_Payment basePayment = NewObject <Basic_Payment>().getmodel(payment.PayMentID) as Basic_Payment;
                        payment.PayMentCode = basePayment.PayCode;
                        payment.PayMentName = basePayment.PayName;
                        this.BindDb(payment);
                        payment.save();
                    }

                    //减虚拟库存
                    MinisStorage(prescriptions, false);
                    AddScore(curPatlist.MemberAccountID, costHead.TotalFee, costHead.CostHeadID.ToString(), operatoreid);
                    AddAccoutFee(costHead, curAccountId, feeHeadids.Length, 0);
                }
                else
                {
                    throw new Exception("没有找到结算号的记录!");
                }
            }
        }
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="sender">控件</param>
 /// <param name="e">参数</param>
 private void btnNew_Click(object sender, EventArgs e)
 {
     SetbtnState(OperType.新增);
     CurrPayment = new Basic_Payment();
 }