92 lines
3.2 KiB
C#
92 lines
3.2 KiB
C#
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace JJMediSys
|
|||
|
|
{
|
|||
|
|
public partial class LisLog : Form
|
|||
|
|
{
|
|||
|
|
public LisLog()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void groupBox1_Enter(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void LisLog_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
gridView1.OptionsBehavior.Editable = false;
|
|||
|
|
gridView1.OptionsView.ShowIndicator = false;// 显示最左边空白列
|
|||
|
|
// 禁用多选模式
|
|||
|
|
gridView1.OptionsSelection.MultiSelect = false;
|
|||
|
|
// 设置选择模式为“按行”
|
|||
|
|
gridView1.OptionsSelection.MultiSelectMode = GridMultiSelectMode.RowSelect;
|
|||
|
|
dateStart.DateTime = DateTime.Now.AddDays(-1);
|
|||
|
|
dateEnd.DateTime = DateTime.Now;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BSearch_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string sql = "";
|
|||
|
|
if (TextSearhCardNo.Text.Length>0)
|
|||
|
|
{
|
|||
|
|
sql = "select * from lis_log where PatID ='" + TextSearhCardNo.Text + "' and DBExcTime >'" + dateStart.DateTime.Date.ToString("yyyy-MM-dd") + "' and DBExcTime <='" + dateEnd.DateTime.Date.AddDays(1).ToString("yyyy-MM-dd") + "'";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sql = "select * from lis_log where DBExcTime >'" + dateStart.DateTime.Date.ToString("yyyy-MM-dd") + "' and DBExcTime <='" + dateEnd.DateTime.Date.AddDays(1).ToString("yyyy-MM-dd") + "'";
|
|||
|
|
}
|
|||
|
|
MainForm.logger.Info("Mysql sql=" + sql);
|
|||
|
|
DataSet dataSet = DoDBMySql.Query(sql);
|
|||
|
|
BindingSource bindingSource = new BindingSource();
|
|||
|
|
bindingSource.DataSource = dataSet;
|
|||
|
|
bindingSource.DataMember = "ds";
|
|||
|
|
gridControl1.DataSource = bindingSource;
|
|||
|
|
gridControl1.RefreshDataSource();
|
|||
|
|
gridView1.RefreshData();
|
|||
|
|
LabNote.Text = $"共检索到: {gridView1.DataRowCount} 条记录";
|
|||
|
|
return ;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(ex.Message);
|
|||
|
|
return ;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
// 获取当前焦点行的数据对象
|
|||
|
|
object focusedRow = gridView1.GetFocusedRow();
|
|||
|
|
if (focusedRow != null)
|
|||
|
|
{
|
|||
|
|
DataRowView dataRowView = focusedRow as DataRowView;
|
|||
|
|
|
|||
|
|
if (dataRowView != null) {
|
|||
|
|
TextReq.Text = dataRowView["Req"].ToString();
|
|||
|
|
TextRes.Text = dataRowView["Res"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|