public void Query() { dataLayoutControl1.Validate(); T_JCXX_DAL dal = new T_JCXX_DAL(); var sqlFilter = sqlFilterBindingSource.Current as SqlFilter; var list1 = new List <T_JCXX>(); SplashScreenManager.ShowDefaultWaitForm($"正在查询"); try { var sqlWhere = "1 =1 "; sqlWhere += $" and f_bz<>'' "; if (sqlFilter.Blk != null && (sqlFilter.Blk != "全部" && sqlFilter.Blk != "")) { sqlWhere += $" and f_blk='{sqlFilter.Blk}' "; } if (sqlFilter.Bgrq1.HasValue) { //收到日期 sqlWhere += $" and CONVERT(datetime,f_bgrq) >= CONVERT(datetime,'{sqlFilter.Bgrq1.Value.Date}') "; } if (sqlFilter.Bgrq2.HasValue) { sqlWhere += $" and CONVERT(datetime,f_bgrq) <=CONVERT(datetime,'{sqlFilter.Bgrq2.Value.Date.AddDays(1)}') "; } if (!string.IsNullOrEmpty(sqlFilter.CrisisText)) { sqlWhere += $" and f_bz like '%{sqlFilter.CrisisText}%' "; } list1 = T_JCXX_DAL.GetBySqlWhere(sqlWhere, "f_bgrq"); } catch (Exception exception) { MessageBox.Show(exception.ToString()); return; } finally { try { SplashScreenManager.CloseDefaultWaitForm(); } catch { } } if (list1.Any() == false) { XtraMessageBox.Show("没有找到任何结果!"); } tJCXXBindingSource.DataSource = list1; gridView1.RefreshData(); gridView1.ExpandAllGroups(); gridView1.BestFitColumns(); }
private void btnShowLog_Click(object sender, EventArgs e) { var f = new UploadLog(); f.OnImportUploadList += list => { var dal = new T_JCXX_DAL(); var count = 0; var tempList = new List <string>(); _lstJcxx = new List <T_JCXX>(); foreach (string blh in list) { tempList.Add(blh); //每次用in查出500条 if (tempList.Count == 500 || list[list.Count - 1] == blh) { var blhString = ""; tempList.ForEach(o => blhString += $"'{o}',"); blhString = blhString.TrimEnd(','); var sqlWhere = $" and f_blh in ({blhString}) "; _lstJcxx.AddRange(dal.GetBySqlWhere(sqlWhere)); tempList.Clear(); } } BindData(); lblStatus.Text = $"等待上传,共{_lstJcxx.Count}条"; }; f.ShowDialog(); }
public void Query() { dataLayoutControl1.Validate(); var dal = new T_JCXX_DAL(); var sqlFilter = sqlFilterBindingSource.Current as SqlFilter; var list1 = new List <T_JCXX>(); SplashScreenManager.ShowDefaultWaitForm($"正在查询"); try { var sqlWhere = "1 =1 "; //病例库 if (sqlFilter.Blk != null && sqlFilter.Blk != "全部" && sqlFilter.Blk != "") { sqlWhere += $" and f_blk='{sqlFilter.Blk}' "; } //收到日期 if (sqlFilter.Sdrq1.HasValue) { sqlWhere += $" and CONVERT(datetime,f_sdrq) >= CONVERT(datetime,'{sqlFilter.Sdrq1.Value.Date}') "; } if (sqlFilter.Sdrq2.HasValue) { sqlWhere += $" and CONVERT(datetime,f_sdrq) <=CONVERT(datetime,'{sqlFilter.Sdrq2.Value.Date.AddDays(1)}') "; } //报告状态 if (sqlFilter.Bgzt != Bgzts.全部) { sqlWhere += $" and f_bgzt = '{sqlFilter.Bgzt}' "; } else { sqlWhere += $" and f_bgzt in ('已写报告','已审核') "; } //医嘱项目 if (string.IsNullOrEmpty(sqlFilter.Yzxm) == false && sqlFilter.Yzxm != "全部") { sqlWhere += $" and f_yzxm = '{sqlFilter.Yzxm}' "; } //项目分类 if (sqlFilter.Xmfl != null && (sqlFilter.Xmfl != "全部" && sqlFilter.Xmfl.Trim() != "")) { sqlWhere += $" and f_bblx='{sqlFilter.Xmfl}' "; } list1 = T_JCXX_DAL.GetBySqlWhere(sqlWhere); //处理报告发放天数 foreach (T_JCXX jcxx in list1) { jcxx.发放天数 = GetDays(jcxx); //去掉项目前面的编号 if (jcxx.F_YZXM.Split('^').Length > 1) { jcxx.F_YZXM = jcxx.F_YZXM.Split('^')[1]; } } //获得合计 var reportCountList = (from o in list1 group o by o.发放天数 into g orderby Convert.ToInt32(g.Key) select new { 工作日 = g.Key.ToString(), 数量 = g.Count() } ).ToList(); var totalCount = reportCountList.Sum(o => o.数量); reportCountList.Add(new { 工作日 = "合计", 数量 = totalCount }); gridControl2.DataSource = reportCountList; } catch (Exception exception) { MessageBox.Show(exception.ToString()); return; } finally { try { SplashScreenManager.CloseDefaultWaitForm(); } catch { } } if (list1.Any() == false) { XtraMessageBox.Show("没有找到任何结果!"); } tJCXXBindingSource.DataSource = list1; gridView1.RefreshData(); gridView1.ExpandAllGroups(); gridView1.BestFitColumns(); }
public void Query() { dataLayoutControl1.Validate(); var dal = new T_JCXX_DAL(); var sqlFilter = sqlFilterBindingSource.Current as SqlFilter; var list1 = new List <T_JCXX>(); SplashScreenManager.ShowDefaultWaitForm($"正在查询"); try { var sqlWhere = "1 =1 "; //病例库 if (sqlFilter.Blk != null && sqlFilter.Blk != "全部" && sqlFilter.Blk != "") { sqlWhere += $" and f_blk='{sqlFilter.Blk}' "; } //收到日期 if (sqlFilter.Sdrq1.HasValue) { sqlWhere += $" and CONVERT(datetime,f_sdrq) >= CONVERT(datetime,'{sqlFilter.Sdrq1.Value.Date}') "; } if (sqlFilter.Sdrq2.HasValue) { sqlWhere += $" and CONVERT(datetime,f_sdrq) <=CONVERT(datetime,'{sqlFilter.Sdrq2.Value.Date.AddDays(1)}') "; } //报告状态 if (sqlFilter.Bgzt != Bgzts.全部) { sqlWhere += $" and f_bgzt = '{sqlFilter.Bgzt}' "; } //项目分类 if (sqlFilter.Xmfl != null && (sqlFilter.Xmfl != "全部" && sqlFilter.Xmfl.Trim() != "")) { sqlWhere += $" and f_bblx='{sqlFilter.Xmfl}' "; } //医嘱项目 if (string.IsNullOrEmpty(sqlFilter.Yzxm.Trim()) == false && sqlFilter.Yzxm != "全部") { sqlWhere += $" and f_yzxm = '{sqlFilter.Yzxm}' "; } sqlWhere += " and ( ltrim(rtrim(f_WFBGYY))!='' or ltrim(rtrim(f_spare9))!= '' )"; list1 = T_JCXX_DAL.GetBySqlWhere(sqlWhere); } catch (Exception exception) { MessageBox.Show(exception.ToString()); return; } finally { try { SplashScreenManager.CloseDefaultWaitForm(); } catch { } } if (list1.Any() == false) { XtraMessageBox.Show("没有找到任何结果!"); } tJCXXBindingSource.DataSource = list1; gridView1.RefreshData(); gridView1.ExpandAllGroups(); gridView1.BestFitColumns(); }