/// <summary>
        /// 通过票据号获取票据号对应的挂号支付信息
        /// </summary>
        /// <param name="invoiceNO">票据号</param>
        /// <param name="payMentInfoList">支付信息</param>
        /// <param name="opPatlist">病人对象</param>
        /// <returns>挂号支付信息</returns>
        public bool GetRegInfoByInvoiceNO(string invoiceNO, out PayMentInfoList payMentInfoList, out OP_PatList opPatlist)
        {
            bool result = false;
            List <OP_CostHead> costList = NewObject <OP_CostHead>().getlist <OP_CostHead>(" EndInvoiceNO='" + invoiceNO + "' and regflag=1");

            if (costList == null || costList.Count == 0)
            {
                throw new Exception("找不到该票据号对应的挂号信息");
            }
            else if (costList[0].CostStatus != 0)
            {
                throw new Exception("该票据号已经退费,不能再退");
            }
            else if (costList[0].CostStatus == 0 && costList[0].CostDate.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))
            {
                throw new Exception("已超过退号日期,只能退当天挂的号");
            }
            else
            {
                opPatlist = NewObject <OP_PatList>().getmodel(costList[0].PatListID) as OP_PatList;
                if (opPatlist.VisitStatus != 0)
                {
                    throw new Exception("您已就诊,不能再退号");
                }

                payMentInfoList = new PayMentInfoList();
                List <OP_CostPayMentInfo> payInfos = NewObject <OP_CostPayMentInfo>().getlist <OP_CostPayMentInfo>(" costheadid=" + costList[0].CostHeadID);
                payMentInfoList.paymentInfolist = payInfos;
                result = true;
            }

            return(result);
        }
Example #2
0
        public ServiceResponseData GetRegInfoByInvoiceNO()
        {
            try
            {
                string          invoiceNO           = requestData.GetData <string>(0);//票据号
                PayMentInfoList payInfolist         = new PayMentInfoList();
                OP_PatList      regPatList          = new OP_PatList();
                bool            result              = NewObject <RegisterProcess>().GetRegInfoByInvoiceNO(invoiceNO, out payInfolist, out regPatList);
                bool            isMedicarePay       = false;
                string          medicarePayMentCode = NewObject <CommonMethod>().GetOpConfig(OpConfigConstant.RegMedicareCode);//获取医保对应的支付方式Code
                for (int index = 0; index < payInfolist.paymentInfolist.Count; index++)
                {
                    //有医保支付的
                    if (payInfolist.paymentInfolist[index].PayMentCode == medicarePayMentCode)
                    {
                        isMedicarePay = true;
                    }
                }

                responseData.AddData(result);        //是否可退号
                responseData.AddData(payInfolist);   //原支付信息
                responseData.AddData(isMedicarePay); //是否有医保支付
                responseData.AddData(regPatList);    //原病人对象
                return(responseData);
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
        }
        public bool GetRegInfoByInvoiceNO()
        {
            try
            {
                string invoiceNO = ifrmRegInvoiceInput.InputVoiceNO;
                Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
                {
                    request.AddData(invoiceNO);//票据号
                });
                ServiceResponseData retdata = InvokeWcfService("OPProject.Service", "RegisterController", "GetRegInfoByInvoiceNO", requestAction);
                bool result = retdata.GetData <bool>(0);
                if (result)
                {
                    PayMentInfoList payInfoList = retdata.GetData <PayMentInfoList>(1);
                    DataTable       dtPayInfo   = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToDataTable(payInfoList.paymentInfolist);
                    ifrmRegInvoiceInput.LoadPayInfo(dtPayInfo);
                    bool haveMedicarePay = retdata.GetData <bool>(2);
                    ifrmRegInvoiceInput.HaveMedicarePay = haveMedicarePay;
                    ifrmRegInvoiceInput.RegPatList      = retdata.GetData <OP_PatList>(3);
                }

                return(true);
            }
            catch (Exception err)
            {
                MessageBoxShow(err.Message, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                return(false);
            }
        }
        /// <summary>
        /// 挂号提交
        /// </summary>
        /// <param name="curPatlist">病人对象</param>
        /// <param name="paymentInfoList">支付对象</param>
        /// <param name="totalFee">总金额</param>
        /// <param name="cashFee">现金金额</param>
        /// <param name="posFee">POS金额</param>
        /// <param name="dtPrint">返回的打印数据</param>
        /// <param name="promFee">优惠金额</param>
        /// <returns>true成功false失败</returns>
        public bool SaveRegInfo(OP_PatList curPatlist, PayMentInfoList paymentInfoList, decimal totalFee, decimal cashFee, decimal posFee, out DataTable dtPrint, decimal promFee)
        {
            try
            {
                dtPrint = new DataTable();
                bool result = false;

                //插入挂号就诊表记录
                #region 插入挂号就诊表记录
                SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>();
                curPatlist.VisitNO     = serialNumberSource.GetSerialNumber(SnType.门诊流水号);
                curPatlist.CureDeptID  = curPatlist.RegDeptID;
                curPatlist.CureEmpID   = curPatlist.RegEmpID;
                curPatlist.RegDate     = DateTime.Now;
                curPatlist.VisitStatus = 0;
                curPatlist.RegStatus   = 0;
                curPatlist.RegCategory = 0;
                DataTable dtOld = NewObject <OP_PatList>().gettable(" MemberID=" + curPatlist.MemberID);
                if (dtOld != null && dtOld.Rows.Count > 0)
                {
                    curPatlist.IsNew = 0;
                }
                else
                {
                    curPatlist.IsNew = 1;
                }

                this.BindDb(curPatlist);
                curPatlist.save();
                #endregion
                int iAccountType = 0;

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

                //插入结算主表对象
                #region 插入结算主表对象
                OP_CostHead costHead = new OP_CostHead();
                SetRegCostHead(costHead, curPatlist);
                costHead.CashFee   = cashFee;
                costHead.PosFee    = posFee;
                costHead.TotalFee  = totalFee;
                costHead.PromFee   = promFee;
                costHead.AccountID = curAccountId;
                this.BindDb(costHead);
                costHead.save();
                #endregion

                #region 插入费用表

                //插入费用主表 OP_FeeItemHead
                OP_FeeItemHead feeItemHead = new OP_FeeItemHead();
                SetRegFeeHeadValue(feeItemHead, costHead, curPatlist);
                this.BindDb(feeItemHead);
                feeItemHead.save();

                //插入费用明细表 OP_FeeItemDetail
                List <OP_FeeItemDetail> feeDetials = SetRegFeeDetailValue(feeItemHead.FeeItemHeadID, curPatlist);
                foreach (OP_FeeItemDetail feeDetial in feeDetials)
                {
                    this.BindDb(feeDetial);
                    feeDetial.save();
                }
                #endregion

                //插入结算明细表
                #region 插入结算明细表
                DataTable dtRegFeeDetail = NewDao <IOPManageDao>().GetRegItemFeeByStat(curPatlist.RegTypeID);
                for (int rowindex = 0; rowindex < dtRegFeeDetail.Rows.Count; rowindex++)
                {
                    OP_CostDetail costDetail = new OP_CostDetail();
                    costDetail.CostHeadID    = costHead.CostHeadID;
                    costDetail.FeeItemHeadID = feeItemHead.FeeItemHeadID;
                    costDetail.ExeDeptID     = curPatlist.RegDeptID;
                    costDetail.PresEmpID     = curPatlist.RegEmpID;
                    costDetail.PresDeptID    = curPatlist.RegDeptID;
                    costDetail.TotalFee      = Convert.ToDecimal(dtRegFeeDetail.Rows[rowindex]["statFee"]);
                    costDetail.StatID        = Convert.ToInt32(dtRegFeeDetail.Rows[rowindex]["statId"]);
                    this.BindDb(costDetail);
                    costDetail.save();
                }
                #endregion

                //插入结算支付方式明细表
                #region 插入结算支付方式明细表
                foreach (OP_CostPayMentInfo costpaymentinfo in paymentInfoList.paymentInfolist)
                {
                    if (costpaymentinfo.PayMentMoney > 0)
                    {
                        costpaymentinfo.AccountID  = curAccountId;
                        costpaymentinfo.CostHeadID = costHead.CostHeadID;
                        costpaymentinfo.PatListID  = curPatlist.PatListID;
                        costpaymentinfo.PatName    = curPatlist.PatName;
                        costpaymentinfo.PatType    = costHead.PatTypeID.ToString();
                        this.BindDb(costpaymentinfo);
                        costpaymentinfo.save();
                    }
                }
                #endregion

                //挂号记录表回写costheadid
                curPatlist.CostHeadID = costHead.CostHeadID;
                curPatlist.ChargeFlag = 1;
                this.BindDb(curPatlist);
                curPatlist.save();

                //结账表插入汇总金额
                NewObject <CommonMethod>().AddAccoutFee(costHead, curAccountId, 1, 0);

                //查数据库得到打印dtPrint
                dtPrint = NewObject <IOPManageDao>().GetRegPrint(curPatlist.PatListID);
                result  = true;
                return(result);
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
        }
Example #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);
            }
        }