You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.8 KiB
87 lines
2.8 KiB
using PEIS.Base;
|
|
using PEIS.Entity;
|
|
using PEIS.Event;
|
|
using PEIS.Presenter;
|
|
using PEIS.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PEIS.View.Base
|
|
{
|
|
public partial class PersonForm : ViewBase, IBasePatientView
|
|
{
|
|
List<BasePatient> _lstBasePatients = null;
|
|
|
|
public PersonForm()
|
|
{
|
|
InitializeComponent();
|
|
Shown += PatientForm_Shown;
|
|
|
|
// 新增体检者基础信息
|
|
OpsPatient.TsmiAdd.Click += TsmiAdd_Click;
|
|
// 性别转换
|
|
DgvPatient.CustomColumnDisplayText += DgvPatient_CustomColumnDisplayText;
|
|
// 刷新
|
|
OpsPatient.TsmiRefresh.Click += (sender, e) => OnGetBasePatient();
|
|
|
|
OpsPatient.TsmiDelete.Visible = false;
|
|
OpsPatient.TsmiSave.Visible = false;
|
|
OpsPatient.TsmiSearch.Visible = false;
|
|
OpsPatient.TstbKey.KeyDown += TstbKey_KeyDown;
|
|
|
|
DgvPatient.Initialize();
|
|
}
|
|
|
|
private void TstbKey_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter) OnGetBasePatient();
|
|
}
|
|
|
|
protected override object CreatePresenter()
|
|
{
|
|
return new BasePatientPresenter(this);
|
|
}
|
|
|
|
private void PatientForm_Shown(object sender, EventArgs e)
|
|
{
|
|
ThreadPool.QueueUserWorkItem(state => OnGetBasePatient());
|
|
}
|
|
|
|
private void DgvPatient_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
if (e.Column.FieldName == "Sex") // 替换"Sex"
|
|
{
|
|
if (e.Value != null && e.Value.ToString() == "1")
|
|
e.DisplayText = "男";
|
|
else if (e.Value != null && e.Value.ToString() == "2")
|
|
e.DisplayText = "女";
|
|
}
|
|
}
|
|
|
|
private void TsmiAdd_Click(object sender, EventArgs e)
|
|
{
|
|
NewPersonForm personForm = new NewPersonForm(null);
|
|
personForm.ShowDialog();
|
|
OnGetBasePatient();
|
|
}
|
|
|
|
#region 事件接口
|
|
|
|
// 获取体检者基础信息列表
|
|
public event EventHandler<Args<BasePatient>> GetBasePatient;
|
|
public void ShowBasePatient(List<BasePatient> items)
|
|
{
|
|
Invoke(new Action(() => _lstBasePatients = items));
|
|
Invoke(new Action(() => DgcPatient.DataSource = null));
|
|
Invoke(new Action(() => DgcPatient.DataSource = _lstBasePatients));
|
|
}
|
|
protected virtual void OnGetBasePatient()
|
|
{
|
|
GetBasePatient?.Invoke(this, new Args<BasePatient>{ Code = OpsPatient.TstbKey.Text.Trim() == "输入条件查询" ? null : string.IsNullOrEmpty(OpsPatient.TstbKey.Text) ? null : OpsPatient.TstbKey.Text.Trim() });
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |