public bool BackReg()
        {
            if (ifrmRegInvoiceInput.HaveMedicarePay)
            {
                try
                {
                    //先调用医保接口退号
                    MIOPInterface.MiRefundRegister(ifrmRegInvoiceInput.RegPatList.VisitNO, string.Empty, ifrmRegInvoiceInput.InputVoiceNO);
                }
                catch (Exception err)
                {
                    MessageBoxShow(err.Message, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }

            try
            {
                string invoiceNO = ifrmRegInvoiceInput.InputVoiceNO;
                Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
                {
                    request.AddData(invoiceNO);           //票据号
                    request.AddData(LoginUserInfo.EmpId); //操作员ID
                });
                ServiceResponseData retdata = InvokeWcfService("OPProject.Service", "RegisterController", "BackReg", requestAction);

                return(true);
            }
            catch (Exception err)
            {
                MessageBoxShow(err.Message, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                return(false);
            }
        }
        public bool SaveRegister()
        {
            //调用医保读卡接口,获取医保卡号和医保卡相关信息
            OP_PatList curPatlist = ifrmRegister.CurPatlist;

            curPatlist.OperatorID = LoginUserInfo.EmpId;
            if (!string.IsNullOrEmpty(ifrmRegister.MedicardReadInfo))
            {
                try
                {
                    //调用医保接口正式结算 如果医保结算失败,直接return
                    MIOPInterface.MiRegister(ifrmRegPayMentInfo.MIBudgetID, string.Empty);
                }
                catch (Exception err)
                {
                    MessageBoxShow(err.Message, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }

            try
            {
                decimal totalRegFee    = ifrmRegPayMentInfo.RegTotalFee;
                string  regPayMentCode = ifrmRegPayMentInfo.GetPatMentCode;
                //decimal medicarcPay = ifrmRegPayMentInfo.MedicarePay;
                decimal medicarcPay     = ifrmRegPayMentInfo.MedicareMIPay;
                decimal medicarePersPay = ifrmRegPayMentInfo.MedicarePersPay;
                decimal shouldPay       = ifrmRegPayMentInfo.ShoudPay;
                decimal promFee         = ifrmRegPayMentInfo.PromFee;
                Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
                {
                    request.AddData(curPatlist);      //病人对象
                    request.AddData(totalRegFee);     //挂号总金额
                    request.AddData(regPayMentCode);  //支付方式Code
                    request.AddData(medicarcPay);     //医保统筹支付金额
                    request.AddData(shouldPay);       //应付金额
                    request.AddData(promFee);         //优惠金额
                    request.AddData(medicarePersPay); //医保个账支付金额
                });
                ServiceResponseData retdata     = InvokeWcfService("OPProject.Service", "RegisterController", "SaveRegister", requestAction);
                DataTable           dtRegPrint  = retdata.GetData <DataTable>(0);
                OP_PatList          backPatlist = retdata.GetData <OP_PatList>(1);
                if (dtRegPrint == null || dtRegPrint.Rows.Count == 0)
                {
                    MessageBoxShowError("找不到打印数据");
                    return(false);
                }

                if (!string.IsNullOrEmpty(ifrmRegister.MedicardReadInfo))
                {
                    MIOPInterface.MiRegisterComplete(ifrmRegPayMentInfo.MIBudgetID, backPatlist.VisitNO, dtRegPrint.Rows[0]["invoiceNO"].ToString());
                }

                //票据打印
                RegInvoicePrint(dtRegPrint);
                return(true);
            }
            catch (Exception err)
            {
                MessageBoxShow(err.Message, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                if (ifrmRegPayMentInfo.MIBudgetID > 0)
                {
                    //需要回退医保挂号
                    MIOPInterface.MiRefundRegister(string.Empty, ifrmRegPayMentInfo.MIBudgetID.ToString(), string.Empty);
                }

                return(false);
            }
        }