private void lblOK_Click(object sender, EventArgs e) { this.AnsyWorker(ui => { ui.UpdateTitle("正在缴费中,请稍等..."); ui.SynUpdateUI(() => { #region 验证缴费处方信息 DataTable dtMain = dsRecipe.Tables[0].DefaultView.ToTable(); IEnumerable <string> _CLINICRECIPEIDs = dtMain.AsEnumerable().Where(b => b.Field <bool>("PITCHON1") == true).Select(a => a.Field <string>("CLINICRECIPEID")).Distinct(); if (_CLINICRECIPEIDs.Count() == 0) { SkyComm.ShowMessageInfo("请选择要缴费的处方!"); return; } this.ucTime1.timer1.Stop(); //选中处方的金额 decimal sumMoney = DecimalRound.Round(Convert.ToDecimal(dtMain.Compute("SUM(TOTALMONEY)", "PITCHON1 = true")), 2); ClinicPhysicianRecipeFacade clinicPhysicianRecipeFacade = new ClinicPhysicianRecipeFacade(); DataSet dsTemp = clinicPhysicianRecipeFacade.FindRecipeDetailByDiagnoseID(SkyComm.DiagnoseID, string.Empty, "3"); DataSet ds = dsTemp.Clone(); foreach (DataRow row in dsTemp.Tables[0].Rows) { if (_CLINICRECIPEIDs.Contains(row["CLINICRECIPEID"].ToString())) { ds.Tables[0].ImportRow(row); } } if (ds.Tables[0].Rows.Count < 1) { SkyComm.ShowMessageInfo("没有找到可进行缴费的处方记录,请检查处方号"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } //调用大通审方系统 if (!CheckDTPass(ds)) { return; } #endregion #region 组织缴费处方信息 CommonFacade commonFacade = new CommonFacade(); DateTime ServerTime = commonFacade.GetServerDateTime(); LeechdomCharge charge = new LeechdomCharge(SkyComm.DiagnoseID, SysOperatorInfo.OperatorID); charge.AddRecipeCharge(ds); decimal decHisMoney = DecimalRound.Round(Convert.ToDecimal(charge.detailAccountData.Tables[0].Compute("SUM(MONEY)", "")), 2); if (decHisMoney != sumMoney) { charge.detailAccountData.Clear(); charge.ecipeMedicineData.Clear(); SkyComm.ShowMessageInfo("选择的处方金额不正确,请在门诊窗口进行缴费!"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } if (decHisMoney > SkyComm.cardBlance) { charge.detailAccountData.Clear(); charge.ecipeMedicineData.Clear(); SkyComm.ShowMessageInfo("余额不足,请先进行自助预存,再进行缴费!"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } #endregion #region 缴费 try { //验证西北妇幼高值耗材 if (!CheckHValueMaterial(charge.detailAccountData)) { throw new Exception("缴费信息中有高值耗材,请在门诊窗口进行缴费!"); } DetailAccountFacade detailAccountFacade = new DetailAccountFacade(); DataSet dads = detailAccountFacade.insertEntityNoInvoice(charge.detailAccountData, ref charge.ecipeMedicineData); SkyComm.GetCardBalance(); SkyComm.ShowMessageInfo("缴费成功!"); //根据“药房自动配药接口类型”配置为2时,调用西北妇幼的派昂接口 19797 string AutoDoseConfig = SystemInfo.SystemConfigs["药房自动配药接口类型"].DefaultValue; string strCK = string.Empty; if (AutoDoseConfig == "2" && charge.ecipeMedicineData.Tables[0].Rows.Count > 0) { strCK = UploadAngPaiData(dads, charge.ecipeMedicineData, dsTemp); } PrintReport(dads, strCK, dsRecipe);//打印交费凭证 } catch (Exception err) { charge.detailAccountData.Clear(); charge.ecipeMedicineData.Clear(); Skynet.LoggingService.LogService.GlobalInfoMessage(SkyComm.DiagnoseID + "缴费失败:" + err.Message); SkyComm.ShowMessageInfo("缴费失败:" + err.Message); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } dsRecipe = GetRecipeInfo(); if (dsRecipe == null || dsRecipe.Tables[0].Rows.Count == 0) { SkyComm.CloseWin(this); } else { this.gdcMain.DataSource = dsRecipe.Tables[0].DefaultView; lblYE.Text = SkyComm.cardBlance.ToString(); refreshUI(); } #endregion }); }); }
/// <summary> /// 点击支付宝缴费 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void label2_Click(object sender, EventArgs e) { this.ucTime1.timer1.Stop(); #region 验证缴费处方信息 DataTable dtMain = dsRecipe.Tables[0].DefaultView.ToTable(); IEnumerable <string> _CLINICRECIPEIDs = dtMain.AsEnumerable().Where(b => b.Field <bool>("PITCHON1") == true).Select(a => a.Field <string>("CLINICRECIPEID")).Distinct(); if (_CLINICRECIPEIDs.Count() == 0) { SkyComm.ShowMessageInfo("请选择要缴费的处方!"); return; } this.ucTime1.timer1.Stop(); //选中处方的金额 decimal sumMoney = DecimalRound.Round(Convert.ToDecimal(dtMain.Compute("SUM(TOTALMONEY)", "PITCHON1 = true")), 2); ClinicPhysicianRecipeFacade clinicPhysicianRecipeFacade = new ClinicPhysicianRecipeFacade(); DataSet dsTemp = clinicPhysicianRecipeFacade.FindRecipeDetailByDiagnoseID(SkyComm.DiagnoseID, string.Empty, "3"); DataSet ds = dsTemp.Clone(); foreach (DataRow row in dsTemp.Tables[0].Rows) { if (_CLINICRECIPEIDs.Contains(row["CLINICRECIPEID"].ToString())) { ds.Tables[0].ImportRow(row); } } if (ds.Tables[0].Rows.Count < 1) { SkyComm.ShowMessageInfo("没有找到可进行缴费的处方记录,请检查处方号"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } ////调用大通审方系统 //if (!CheckDTPass(ds)) //{ // return; //} #endregion #region 组织缴费处方信息 CommonFacade commonFacade = new CommonFacade(); DateTime ServerTime = commonFacade.GetServerDateTime(); LeechdomCharge charge = new LeechdomCharge(SkyComm.DiagnoseID, SysOperatorInfo.OperatorID); charge.AddRecipeCharge(ds); decimal decHisMoney = DecimalRound.Round(Convert.ToDecimal(charge.detailAccountData.Tables[0].Compute("SUM(MONEY)", "")), 2); if (decHisMoney != sumMoney) { charge.detailAccountData.Clear(); charge.ecipeMedicineData.Clear(); SkyComm.ShowMessageInfo("选择的处方金额不正确,请在门诊窗口进行缴费!"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } #endregion FrmNetPay payFrm = new FrmNetPay(); payFrm.PayMoney = Decimal.Parse(lblTotalMoney.Text.ToString()); payFrm.ServiceType = "3"; payFrm.PayMethod = "2"; payFrm.PayType = "缴费"; DialogResult mDialogResult = payFrm.ShowDialog(); if (mDialogResult == DialogResult.OK) { string hisno = payFrm.hisNo; NetPay(hisno, "线上支付宝"); SkyComm.ShowMessageInfo(payFrm.PayType + "成功!"); } else { this.ucTime1.timer1.Start();//计时器动 } }
public void NetPay(string hisno, string payMethod) { this.AnsyWorker(ui => { ui.UpdateTitle("正在缴费中,请稍等..."); ui.SynUpdateUI(() => { #region 验证缴费处方信息 DataTable dtMain = dsRecipe.Tables[0].DefaultView.ToTable(); IEnumerable <string> _CLINICRECIPEIDs = dtMain.AsEnumerable().Where(b => b.Field <bool>("PITCHON1") == true).Select(a => a.Field <string>("CLINICRECIPEID")).Distinct(); if (_CLINICRECIPEIDs.Count() == 0) { SkyComm.ShowMessageInfo("请选择要缴费的处方!"); return; } this.ucTime1.timer1.Stop(); //选中处方的金额 decimal sumMoney = DecimalRound.Round(Convert.ToDecimal(dtMain.Compute("SUM(TOTALMONEY)", "PITCHON1 = true")), 2); ClinicPhysicianRecipeFacade clinicPhysicianRecipeFacade = new ClinicPhysicianRecipeFacade(); DataSet dsTemp = clinicPhysicianRecipeFacade.FindRecipeDetailByDiagnoseID(SkyComm.DiagnoseID, string.Empty, "3"); DataSet ds = dsTemp.Clone(); foreach (DataRow row in dsTemp.Tables[0].Rows) { if (_CLINICRECIPEIDs.Contains(row["CLINICRECIPEID"].ToString())) { ds.Tables[0].ImportRow(row); } } if (ds.Tables[0].Rows.Count < 1) { SkyComm.ShowMessageInfo("没有找到可进行缴费的处方记录,请检查处方号"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } //调用大通审方系统 if (!CheckDTPass(ds)) { return; } #endregion #region 组织缴费处方信息 CommonFacade commonFacade = new CommonFacade(); DateTime ServerTime = commonFacade.GetServerDateTime(); LeechdomCharge charge = new LeechdomCharge(SkyComm.DiagnoseID, SysOperatorInfo.OperatorID); charge.AddRecipeCharge(ds); decimal decHisMoney = DecimalRound.Round(Convert.ToDecimal(charge.detailAccountData.Tables[0].Compute("SUM(MONEY)", "")), 2); if (decHisMoney != sumMoney) { charge.detailAccountData.Clear(); charge.ecipeMedicineData.Clear(); SkyComm.ShowMessageInfo("选择的处方金额不正确,请在门诊窗口进行缴费!"); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } #endregion #region 缴费 try { //验证西北妇幼高值耗材 if (!CheckHValueMaterial(charge.detailAccountData)) { throw new Exception("缴费信息中有高值耗材,请在门诊窗口进行缴费!"); } DetailAccountFacade detailAccountFacade = new DetailAccountFacade(); DataSet data = new DataSet(); Hashtable hashtable = new Hashtable(); hashtable.Add("@HISSEQNO", hisno); string mSql = "SELECT * FROM T_BANKHISEXCHANGE_TRANS where HISSEQNO = @HISSEQNO";// and BANKSTATE = '1' QuerySolutionFacade querySolutionFacade = new QuerySolutionFacade(); data = querySolutionFacade.ExeQuery(mSql, hashtable); TBankhisexchangeTransData transData = new TBankhisexchangeTransData(); transData.Bankseqno = data.Tables[0].Rows[0]["BANKSEQNO"].ToString(); transData.Hisseqno = data.Tables[0].Rows[0]["HISSEQNO"].ToString(); transData.Ohisseqno = data.Tables[0].Rows[0]["OHISSEQNO"].ToString(); transData.Bankstate = data.Tables[0].Rows[0]["BANKSTATE"].ToString(); transData.Hisstate = data.Tables[0].Rows[0]["HISSTATE"].ToString(); transData.Buscd = data.Tables[0].Rows[0]["BUSCD"].ToString(); transData.Hisid = data.Tables[0].Rows[0]["HISID"].ToString(); transData.Trfamt = data.Tables[0].Rows[0]["TRFAMT"].ToString(); transData.Usetype = data.Tables[0].Rows[0]["USETYPE"].ToString(); transData.Operatorid = data.Tables[0].Rows[0]["OPERATORID"].ToString(); transData.Operatetime = Convert.ToDateTime(data.Tables[0].Rows[0]["OPERATETIME"].ToString()); transData.Diagnoseid = data.Tables[0].Rows[0]["DIAGNOSEID"].ToString(); transData.BusinessType = data.Tables[0].Rows[0]["BUSINESSTYPE"].ToString(); transData.DataSources = data.Tables[0].Rows[0]["DATASOURCES"].ToString(); transData.DataSources = data.Tables[0].Rows[0]["DATASOURCES"].ToString(); transData.RefundType = Convert.ToInt32(data.Tables[0].Rows[0]["REFUNDTYPE"].ToString()); transData.RefundMoney = Convert.ToDecimal(data.Tables[0].Rows[0]["REFUNDMONEY"].ToString()); transData.Remark = "_FromPayForRecipeForm"; foreach (DataRow Row in charge.detailAccountData.Tables[0].Rows) { Row.BeginEdit(); Row["ISBANKCARD"] = 1; Row["BALANCEMODE"] = payMethod; Row["BANKTRANSNO"] = transData.Hisseqno; Row["IS_FEECHARGING_CARD"] = "1"; Row.EndEdit(); decHisMoney += Convert.ToDecimal(Row["MONEY"]); } DataSet dads = detailAccountFacade.insertEntityNoInvoiceZZZD(charge.detailAccountData, ref charge.ecipeMedicineData, transData); //DataSet dads = detailAccountFacade.insertEntityNoInvoice(charge.detailAccountData, ref charge.ecipeMedicineData); SkyComm.GetCardBalance(); SkyComm.ShowMessageInfo("缴费成功!"); //根据“药房自动配药接口类型”配置为2时,调用西北妇幼的派昂接口 19797 string AutoDoseConfig = SystemInfo.SystemConfigs["药房自动配药接口类型"].DefaultValue; string strCK = string.Empty; if (AutoDoseConfig == "2" && charge.ecipeMedicineData.Tables[0].Rows.Count > 0) { strCK = UploadAngPaiData(dads, charge.ecipeMedicineData, dsTemp); } PrintReport(dads, strCK, dsRecipe);//打印交费凭证 } catch (Exception err) { charge.detailAccountData.Clear(); charge.ecipeMedicineData.Clear(); Skynet.LoggingService.LogService.GlobalInfoMessage(SkyComm.DiagnoseID + "缴费失败:" + err.Message); SkyComm.ShowMessageInfo("缴费失败:" + err.Message); this.ucTime1.Sec = 60; this.ucTime1.timer1.Start(); return; } dsRecipe = GetRecipeInfo(); if (dsRecipe == null || dsRecipe.Tables[0].Rows.Count == 0) { SkyComm.CloseWin(this); } else { this.gdcMain.DataSource = dsRecipe.Tables[0].DefaultView; lblYE.Text = SkyComm.cardBlance.ToString(); refreshUI(); } #endregion }); }); }