/// <summary> /// 获取平台交易总账数据 /// </summary> /// <returns></returns> public List <string[]> getData(List <string> listdate) { List <string[]> list = new List <string[]>(); List <string[]> response = new List <string[]>(); foreach (var date in listdate) { list = GetDBdata.getPtData(date); if (list.Count != 0) { string s1 = list[1][0].ToString().Split(' ')[0].Replace("/", "-"); string[] ss = s1.Split('-'); if (ss[1].Length == 1) { ss[1] = "0" + ss[1]; } if (ss[2].Length == 1) { ss[2] = "0" + ss[2]; } s1 = ss[0] + "-" + ss[1] + "-" + ss[2]; string s2 = (Convert.ToDouble(list[(list.Count - 1)][1]) - Convert.ToDouble(list[(list.Count - 1)][2])).ToString(); string s3 = list[(list.Count - 1)][0].ToString(); string[] str = { s1, s2, s3 }; response.Add(str); } } return(response); }
/// <summary> /// 获取his入参 /// </summary> public string gethisReq(string begindata, string enddata) { string req = string.Empty; string request = string.Empty; string pagesize = ConfigurationManager.AppSettings["PageSize"]; //ReadIni.ReadIniValue("LOCALHOST_SERVERS", "PageSize");//HIS接口数据查询量 string hiskey = ConfigurationManager.AppSettings["Hiskey"]; //ReadIni.ReadIniValue("LOCALHOST_SERVERS", "Hiskey");//His密匙 string service = ConfigurationManager.AppSettings["Service"]; //ReadIni.ReadIniValue("LOCALHOST_SERVERS", "Service");//接口名称 string partner = ConfigurationManager.AppSettings["Partner"]; //ReadIni.ReadIniValue("LOCALHOST_SERVERS", "Partner");//接入方接口用户 string hospitalCode = ConfigurationManager.AppSettings["HospitalCode"]; //ReadIni.ReadIniValue("LOCALHOST_SERVERS", "HospitalCode");//接入医疗机构编码 req = @"<?xml version=""1.0"" encoding=""UTF-8""?> <request> <startDate><![CDATA[" + begindata + @" ]]></startDate> <endDate><![CDATA[" + enddata + @"]]></endDate> <currentPage><![CDATA[1]]></currentPage> <pageSize><![CDATA[" + pagesize + @"]]></pageSize> </request>"; string encryptKey = hiskey; string encryptString = req; req = AES.Encrypt(encryptKey, encryptString); IDictionary <string, string> dict = new Dictionary <string, string>(); string sign = string.Empty; dict.Add("service", service); dict.Add("partner", partner); dict.Add("hospitalCode", hospitalCode); dict.Add("inputCharset", "utf-8"); dict.Add("dataFormat", "xml"); dict.Add("requestEncrypted", req); string signString = GetDBdata.CreateLinkString(GetDBdata.SortDictPara(dict)); signString += "&key=" + encryptKey; sign = GetDBdata.Encode(signString).ToUpper(); request = @"<root> <service><![CDATA[" + service + @"]]></service> <partner><![CDATA[" + partner + @"]]></partner> <hospitalCode><![CDATA[" + hospitalCode + @"]]></hospitalCode> <inputCharset><![CDATA[utf-8]]></inputCharset> <dataFormat><![CDATA[xml]]></dataFormat> <sign><![CDATA[" + sign + @"]]></sign> <signType><![CDATA[md5]]></signType> <requestEncrypted><![CDATA[" + req + @"]]></requestEncrypted> </root>"; return(request); }
/// <summary> /// 获取平台交易明细账数据 /// </summary>async Task<List<string[]>> /// <returns></returns> public static List <string[]> getDataList(List <string> listdate) { List <string[]> list = new List <string[]>(); List <string[]> response = new List <string[]>(); foreach (var date in listdate) { list = GetDBdata.getPtData(date); if (list.Count != 0) { list.RemoveAt(0); list.RemoveAt((list.Count - 3)); list.RemoveAt((list.Count - 2)); list.RemoveAt((list.Count - 1)); foreach (var str in list) { response.Add(str); } } } return(response); }
protected void GridView_Count_RowCommand(object sender, GridViewCommandEventArgs e) { GridView.Visible = false; if (e.CommandName == "Check") { initJavascript(); int id = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridView_Count.Rows[id]; string CheckDate = row.Cells[0].Text.ToString();//Convert.ToString(this.GridView_Count.Rows[id].Cells[0].ToString()); if (dt_wy != null && dt_his != null) { try { tLoadHISRequest tloadhisRequest = new tLoadHISRequest(gethisReq); IAsyncResult result = tloadhisRequest.BeginInvoke(CheckDate, CheckDate, null, null); tLoadWYRequest tLoadwyRequest = new tLoadWYRequest(getReq); IAsyncResult result2 = tLoadwyRequest.BeginInvoke(CheckDate, CheckDate, null, null); string _requesthis = tloadhisRequest.EndInvoke(result); string _request = tLoadwyRequest.EndInvoke(result2); tLoadHISData tloadhis = new tLoadHISData(gethisXml); IAsyncResult resulthis = tloadhis.BeginInvoke(_requesthis, null, null); tLoadWYData tloadwy = new tLoadWYData(getXml); IAsyncResult result_WY = tloadwy.BeginInvoke(_request, null, null); string strhisxml = tloadhis.EndInvoke(resulthis); string strxml = tloadwy.EndInvoke(result_WY); dt_his = GetDBdata.XmlToDataTable(strhisxml); dt_wy = GetDBdata.XmlToDataTable(strxml); this.GridView.DataSource = dt_wy.DefaultView; this.GridView.DataBind(); for (int i = dt_his.Rows.Count - 1; i >= 0; i--) { for (int k = 0; k < dt_wy.Rows.Count; k++) { if (dt_his.Rows[i][3].ToString() == dt_wy.Rows[k][11].ToString() && dt_his.Rows[i][13].ToString() == dt_wy.Rows[k][1].ToString() && dt_his.Rows[i][1].ToString() == dt_wy.Rows[k][2].ToString()) { GridView.Rows[k].BackColor = System.Drawing.Color.Green; } } } DetailsListTitle.Visible = true; DetailsListTitle.Text = CheckDate + "的明细单。 备注:绿色是匹配成功的订单,白色是HIS没有的订单"; } catch (Exception ex) { Logging.WriteBuglog(ex); } finally { this.GridView.Visible = true; } } else { //this.GridView.Visible = true; } } }
/// <summary> /// 刷新数据明细数据 /// </summary> public void RefreshCheckData() { #region 查询明细数据 //initJavascript(); tLoadHISRequest tloadhisRequest = new tLoadHISRequest(gethisReq); IAsyncResult result_his = tloadhisRequest.BeginInvoke(txt_startDate.Text.Trim(), txt_endDate.Text.Trim(), null, null); tLoadWYRequest tLoadwyRequest = new tLoadWYRequest(getReq); IAsyncResult result2 = tLoadwyRequest.BeginInvoke(txt_startDate.Text.Trim(), txt_endDate.Text.Trim(), null, null); string _requesthis = tloadhisRequest.EndInvoke(result_his); string _request = tLoadwyRequest.EndInvoke(result2); tLoadHISData tloadhis = new tLoadHISData(gethisXml); IAsyncResult result = tloadhis.BeginInvoke(_requesthis, null, null); tLoadWYData tloadwy = new tLoadWYData(getXml); IAsyncResult result_WY = tloadwy.BeginInvoke(_request, null, null); string strhisxml = tloadhis.EndInvoke(result); string strxml = tloadwy.EndInvoke(result_WY); dt_his = GetDBdata.XmlToDataTable(strhisxml); dt_wy = GetDBdata.XmlToDataTable(strxml); if (dt_wy != null && dt_his != null) { try { //this.GridView.DataSource = dt_wy.DefaultView; //this.GridView.DataBind(); //for (int i = dt_his.Rows.Count-1;i>=0; i--) //{ // for (int k =0; k < dt_wy.Rows.Count; k++) // { // if (dt_his.Rows[i][3].ToString() == dt_wy.Rows[k][11].ToString() && dt_his.Rows[i][13].ToString() == dt_wy.Rows[k][1].ToString() && dt_his.Rows[i][1].ToString() == dt_wy.Rows[k][2].ToString()) // { // GridView.Rows[k].BackColor = System.Drawing.Color.Green; // } // } //} #region 统计所有数据 dt_his_Result = GetDBdata.GetResult(dt_his); dt_wy_Result = GetDBdata.GetResult(dt_wy); DtAll = GetDBdata.UniteDataTable(dt_his_Result, dt_wy_Result, "合并Dt"); DtAll.Columns.AddRange(new DataColumn[] { new DataColumn("different", typeof(double)) }); DataRow drw = DtAll.NewRow(); double different_money = 0.00; for (int i = 0; i < DtAll.Rows.Count; i++) { foreach (DataRow dr in DtAll.Rows) { different_money = different_money + (Convert.ToDouble(DtAll.Rows[i]["Amounthis"]) - Convert.ToDouble(DtAll.Rows[i]["wxAmount"])); DtAll.Rows[i]["different"] = different_money.ToString("f2"); different_money = 0; } } this.GridView.Visible = false; this.GridView_Count.DataSource = DtAll.DefaultView; this.GridView_Count.DataBind(); #endregion #region 账不平的变红色 for (int k = 0; k < DtAll.Rows.Count; k++) { if (DtAll.Rows[k][6].ToString() != "0") { GridView_Count.Rows[k].BackColor = System.Drawing.Color.Red; //Logging.WriteHISlog("记录日志:","HIS的CARD_NO="+dt_his.Rows[i][3].ToString()+ "\r\n"+"微医的HOSP_PATIENT_ID="+ dt_wy.Rows[k][11].ToString() + "\r\n" + "HIS的TRANS_NO="+dt_his.Rows[i][13].ToString()+"微医的HOSP_ORDER_ID = "+ dt_wy.Rows[k][1].ToString() + "\r\n" + "HIS的TRANS_TYPE=" + dt_his.Rows[i][1].ToString() + "\r\n" + "微医的ORDER_TYPE=" + dt_wy.Rows[k][2].ToString() + ""); } } #endregion } catch (Exception Exc) { Logging.WriteBuglog(Exc); } finally { Logging.WriteWYlog(txt_startDate.Text + "至" + txt_endDate.Text + "的日志", strxml); Logging.WriteHISlog(txt_startDate.Text + "至" + txt_endDate.Text + "的日志", strhisxml); } } else { this.GridView.DataSource = ""; this.GridView.DataBind(); } #endregion }
/// <summary> /// 获取his交易数据 /// </summary> /// <returns></returns> //public async Task<string> gethisXml(string request) //{ // string response = GetDBdata.gethis(request); // return response; //} public string gethisXml(string request) { string response = GetDBdata.gethis(request); return(response); }
/// <summary> /// 刷新数据明细数据 /// </summary> public void RefreshCheckData(List <string> request, string request_his) { #region 计算耗时方法,可删 //Stopwatch sw = new Stopwatch(); //sw.Start(); #endregion initJavascript(); #region datatable创建 dt_wy.Columns.Add("交易时间", typeof(string)); dt_wy.Columns.Add("业务平台流水", typeof(string)); dt_wy.Columns.Add("平台交易流水", typeof(string)); dt_wy.Columns.Add("业务退款流水", typeof(string)); dt_wy.Columns.Add("平台退款流水", typeof(string)); dt_wy.Columns.Add("交易金额", typeof(decimal)); dt_wy.Columns.Add("退款金额", typeof(decimal)); dt_wy.Columns.Add("补贴金额", typeof(decimal)); dt_wy.Columns.Add("实付金额", typeof(decimal)); dt_wy.Columns.Add("实退金额", typeof(decimal)); dt_wy.Columns.Add("第三方支付交易流水号", typeof(string)); dt_wy.Columns.Add("第三方支付退款流水号", typeof(string)); dt_wy.Columns.Add("支付类型", typeof(string)); dt_wy.Columns.Add("交易状态", typeof(string)); dt_wy.Columns.Add("退款状态", typeof(string)); dt_wy.Columns.Add("商户名称", typeof(string)); dt_wy.Columns.Add("商品名称", typeof(string)); dt_wy.Columns.Add("商户号", typeof(string)); dt_wy.Columns.Add("接入应用ID", typeof(string)); dt_wy.Columns.Add("第三方商户号", typeof(string)); #endregion dt_wy.TableName = "ACCOUNT_LIST"; System.Data.DataTable dt_his = new System.Data.DataTable(); DataTable dtResulthis = new DataTable(); tLoadHISData tloadhis = new tLoadHISData(gethisXml); IAsyncResult result = tloadhis.BeginInvoke(request_his, null, null); tLoadWYData tloadwy = new tLoadWYData(getDataList); IAsyncResult result_WY = tloadwy.BeginInvoke(request, null, null); string strxmlhis = tloadhis.EndInvoke(result); List <string[]> response2 = tloadwy.EndInvoke(result_WY);// gethisXml(request_his); //string strxmlhis = gethisXml(request_his); //tLoadWYData tloadwy = new tLoadWYData(getDataList); //IAsyncResult result_WY = tloadwy.BeginInvoke(request, null, null); dt_his = GetDBdata.XmlToDataTable(strxmlhis); dtResulthis = GetDBdata.GetResult(dt_his); // HIS_RowsCount = dt_his.Rows.Count; foreach (DataRow dr in dtResulthis.Rows) { Counthis += double.Parse(dr["Counthis"].ToString()); Amounthis += double.Parse(dr["Amounthis"].ToString()); } HIS_TotalFeeCount.Text = Convert.ToDecimal(Amounthis).ToString("f2") + "元"; // HIS_TotalDealCount.Text = Convert.ToString(Counthis) + "笔"; HIS_TotalFeeCount.Visible = false; HIS_TotalDealCount.Visible = false; try { //List<string[]> response = tloadwy.EndInvoke(result_WY);// getDataList(request); ;// getDataList(request); // List<string[]> response = response2;//getDataList(request); // List<string> result = new List<string>(); //int _count = response.Count; sum_totalCount = response2.Count; //_count; for (int k = 0; k < sum_totalCount; k++) { dt_wy.Rows.Add(response2[k]); } this.GridView.DataSource = dt_wy.DefaultView; this.GridView.DataBind(); for (int i = dt_his.Rows.Count - 1; i >= 0; i--) { for (int k = 0; k < dt_wy.Rows.Count; k++) { if (dt_his.Rows[i][1].ToString() == dt_wy.Rows[k][1].ToString()) { GridView.Rows[k].BackColor = System.Drawing.Color.Green; //Logging.WriteHISlog("记录日志:","HIS的ORDER_ID="+dt_his.Rows[i][3].ToString()+ "\r\n"+"微医的平台订单号="+ dt_wy.Rows[k][11].ToString() + "\r\n" + "HIS的TRANS_NO="+dt_his.Rows[i][13].ToString()+"微医的HOSP_ORDER_ID = "+ dt_wy.Rows[k][1].ToString() + "\r\n" + "HIS的TRANS_TYPE=" + dt_his.Rows[i][1].ToString() + "\r\n" + "微医的ORDER_TYPE=" + dt_wy.Rows[k][2].ToString() + ""); } } } #region 统计所有数据 dtResulthis = GetDBdata.GetResult(dt_his); dtWYResulthis = GetDBdata.GetResult(dt_wy); DtAll = GetDBdata.UniteDataTable(dtResulthis, dtWYResulthis, "合并Dt"); DtAll.Columns.AddRange(new DataColumn[] { new DataColumn("different", typeof(double)) }); DataRow drw = DtAll.NewRow(); double different_money = 0.00; for (int i = 0; i < DtAll.Rows.Count; i++) { foreach (DataRow dr in DtAll.Rows) { different_money = different_money + (Convert.ToDouble(DtAll.Rows[i]["Amounthis"]) - Convert.ToDouble(DtAll.Rows[i]["wxAmount"])); DtAll.Rows[i]["different"] = different_money.ToString("f2"); different_money = 0; } } this.GridView_Count.DataSource = DtAll.DefaultView; this.GridView_Count.DataBind(); #endregion #region 账不平的变红色 for (int k = 0; k < DtAll.Rows.Count; k++) { if (DtAll.Rows[k][6].ToString() != "0") { GridView_Count.Rows[k].BackColor = System.Drawing.Color.Red; } } #endregion } catch (Exception Exc) { Logging.WriteBuglog(Exc); return; } finally { string LogXml = GetDBdata.DataTable2Xml(dt_wy); Logging.WriteWYlog(txt_startDate.Text.Trim() + "至" + txt_endDate.Text.Trim() + "的明细日志", LogXml); Logging.WriteHISlog(txt_startDate.Text + "至" + txt_endDate.Text + "的日志", strxmlhis); //sw.Stop(); //TimeSpan ts2 = sw.Elapsed; //Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); //结束耗时显示多久 //Logging.WriteKeylog("Stopwatch总共花费",Convert.ToString(ts2.TotalMilliseconds)); } }