502 lines
21 KiB
C#
502 lines
21 KiB
C#
using DevExpress.XtraEditors;
|
||
using HL_FristAidPlatform_DTO;
|
||
using HL_FristAidPlatform_Public;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Windows.Forms;
|
||
|
||
namespace HL_FristAidPlatform_EMRS
|
||
{
|
||
public partial class POCT : XtraForm
|
||
{
|
||
private int systemId;
|
||
#region 变量
|
||
/// <summary>
|
||
/// 当前病人编号
|
||
/// </summary>
|
||
private string Cur_PatientGuid = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 当前患者所有的肌钙蛋白报告
|
||
/// </summary>
|
||
private DataTable Cur_BindDT = new DataTable();
|
||
|
||
/// <summary>
|
||
/// 当前修改的记录信息
|
||
/// </summary>
|
||
private DataTable Cur_DetailDT = new DataTable();
|
||
#endregion
|
||
public POCT(string _patientGuid, int _systemId)
|
||
{
|
||
InitializeComponent();
|
||
Cur_PatientGuid = _patientGuid;
|
||
systemId = _systemId;
|
||
}
|
||
|
||
private void Form_PatientCTNT_Load(object sender, EventArgs e)
|
||
{
|
||
Bind_List();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定肌钙蛋白
|
||
/// </summary>
|
||
private void Bind_List()
|
||
{
|
||
try
|
||
{
|
||
string Url = string.Format("api/service/T_Service_ChestPain_CTNT/GetByPatientGuid?patientGuid={0}", Cur_PatientGuid);
|
||
Cur_BindDT = DBHelpClass.Get(Url);
|
||
gridControl_CTNT.DataSource = Cur_BindDT;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定肌钙蛋白:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
private void grv_CTNT_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
||
{
|
||
|
||
if (e.Column.FieldName == "Type")
|
||
{
|
||
int value = PublicClass.ToInt32(e.Value, 0);
|
||
switch (value)
|
||
{
|
||
case 1:
|
||
e.DisplayText = "TnT";
|
||
break;
|
||
case 2:
|
||
e.DisplayText = "Tnl";
|
||
break;
|
||
default:
|
||
e.DisplayText = "";
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (e.Column.FieldName == "Unit")
|
||
{
|
||
int value = PublicClass.ToInt32(e.Value, 0);
|
||
switch (value)
|
||
{
|
||
case 1:
|
||
e.DisplayText = "ng/mL";
|
||
break;
|
||
case 2:
|
||
e.DisplayText = "ug/L";
|
||
break;
|
||
case 3:
|
||
e.DisplayText = "ng/L";
|
||
break;
|
||
case 4:
|
||
e.DisplayText = "pg/mL";
|
||
break;
|
||
case 5:
|
||
e.DisplayText = "mg/L";
|
||
break;
|
||
default:
|
||
e.DisplayText = "";
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (e.Column.FieldName == "Status")
|
||
{
|
||
int value = PublicClass.ToInt32(e.Value, 0);
|
||
switch (value)
|
||
{
|
||
case 1:
|
||
e.DisplayText = "阳性";
|
||
break;
|
||
case 2:
|
||
e.DisplayText = "阴性";
|
||
break;
|
||
case 3:
|
||
e.DisplayText = "未选择";
|
||
break;
|
||
default:
|
||
e.DisplayText = "";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
private void btn_Save_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (Cur_BindDT.Rows.Count >= 3 && Cur_DetailDT.Rows.Count == 0)
|
||
{
|
||
if (XtraMessageBox.Show("当前已有三个肌钙蛋白的报告,因数据填报平台只需传送三个肌钙蛋白结果!\r\n如果继续新增将按添加的先后顺序传送前三条到数据填报平台,请知晓!\r\n请问是否继续新增?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
#region 验证
|
||
string Type = PublicClass.ToString(radioGroup_CTNT.EditValue, "");
|
||
if (string.IsNullOrEmpty(Type))
|
||
{
|
||
XtraMessageBox.Show("请选择肌钙蛋白类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
radioGroup_CTNT.Focus();
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_CTNT_Value.Text))
|
||
{
|
||
XtraMessageBox.Show("请填写肌钙蛋白值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
txt_CTNT_Value.Focus();
|
||
return;
|
||
}
|
||
int Unit = PublicClass.ToInt32(comboBox_CTNT_Unit.SelectedIndex, 0);
|
||
if (Unit <= 0)
|
||
{
|
||
XtraMessageBox.Show("请选择肌钙蛋白单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
comboBox_CTNT_Unit.Focus();
|
||
return;
|
||
}
|
||
int Status = PublicClass.ToInt32(comboBox_CTNT_Status.SelectedIndex, 0);
|
||
if (Status <= 0)
|
||
{
|
||
XtraMessageBox.Show("请选择肌钙蛋白状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
comboBox_CTNT_Status.Focus();
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(time_CTNT_Blood_Time.TimeValue))
|
||
{
|
||
XtraMessageBox.Show("请填写抽血完成时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
time_CTNT_Blood_Time.Focus();
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(time_CTNT_Report_Time.TimeValue))
|
||
{
|
||
XtraMessageBox.Show("请填写获得报告时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
time_CTNT_Report_Time.Focus();
|
||
return;
|
||
}
|
||
#endregion
|
||
|
||
if (Save_CTNT())
|
||
{
|
||
XtraMessageBox.Show("保存肌钙蛋白报告成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
//重新绑定
|
||
Bind_List();
|
||
if (systemId == 2)
|
||
{
|
||
UpdateTreatmentInfo(Cur_PatientGuid);
|
||
}
|
||
|
||
|
||
btn_Add.Enabled = true;
|
||
btn_Update.Enabled = true;
|
||
btn_Delete.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
XtraMessageBox.Show("保存肌钙蛋白报告失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "保存:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存肌钙蛋白
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private bool Save_CTNT()
|
||
{
|
||
try
|
||
{
|
||
string Url = string.Empty;
|
||
|
||
#region 保存肌钙蛋白
|
||
List<T_Service_ChestPain_CTNTDTO> list_Model = new List<T_Service_ChestPain_CTNTDTO>();
|
||
T_Service_ChestPain_CTNTDTO model = new T_Service_ChestPain_CTNTDTO();
|
||
|
||
//存在则修改 否则新增
|
||
if (Cur_DetailDT != null && Cur_DetailDT.Rows.Count > 0)
|
||
{
|
||
Url = "api/service/T_Service_ChestPain_CTNT/Update";
|
||
model.ID = PublicClass.ToInt64(lbl_CTNT.Tag, -1);
|
||
model.GUID = txt_CTNT_Value.Tag.ToString();
|
||
model.DeleteFlag = PublicClass.ToInt32(Cur_DetailDT.Rows[0]["DeleteFlag"], -1);
|
||
|
||
model.CreatorID = PublicClass.ToInt64(Cur_DetailDT.Rows[0]["CreatorID"], 0);
|
||
model.Creator = Cur_DetailDT.Rows[0]["Creator"].ToString();
|
||
model.CreationDate = Cur_DetailDT.Rows[0]["CreationDate"].ToString();
|
||
model.EditorID = Information.User.ID;
|
||
model.Editor = Information.User.FullName;
|
||
model.EditTime = PublicClass.DateTimeNow();
|
||
}
|
||
else
|
||
{
|
||
Url = "api/service/T_Service_ChestPain_CTNT";
|
||
model.GUID = Guid.NewGuid().ToString();
|
||
model.DeleteFlag = 0;
|
||
|
||
model.CreatorID = Information.User.ID;
|
||
model.Creator = Information.User.FullName;
|
||
model.CreationDate = PublicClass.DateTimeNow();
|
||
}
|
||
|
||
model.PatientGuid = Cur_PatientGuid;
|
||
//类型 1:TnT 2:Tnl
|
||
model.Type = PublicClass.ToString(radioGroup_CTNT.EditValue, "");
|
||
//cTnI值
|
||
if (comboBox_CTNT_Operational.Text == "=")
|
||
{
|
||
model.Value = txt_CTNT_Value.Text;
|
||
}
|
||
else
|
||
{
|
||
model.Value = comboBox_CTNT_Operational.Text + txt_CTNT_Value.Text;
|
||
}
|
||
|
||
//单位 1:ng/mL 2:ug/L 3:ng/L 4:pg/mL 5:mg/L
|
||
model.Unit = comboBox_CTNT_Unit.SelectedIndex == 0 ? "" : comboBox_CTNT_Unit.SelectedIndex.ToString();
|
||
//状态 1:阳性 2:阴性 3:未选择
|
||
model.Status = comboBox_CTNT_Status.SelectedIndex == 0 ? "" : comboBox_CTNT_Status.SelectedIndex.ToString();
|
||
//抽血完成时间
|
||
model.Blood_Time = time_CTNT_Blood_Time.TimeValue;
|
||
//获得报告时间
|
||
model.Report_Time = time_CTNT_Report_Time.TimeValue;
|
||
list_Model.Add(model);
|
||
|
||
//初始化两个工厂
|
||
ClientFactory<T_Service_ChestPain_CTNTDTO> httpClient = new HttpClientFactory<T_Service_ChestPain_CTNTDTO>();
|
||
Client<T_Service_ChestPain_CTNTDTO> client = httpClient.VisitFactory();
|
||
#endregion
|
||
|
||
//访问
|
||
return client.Post(Url, list_Model).Success;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "保存肌钙蛋白:\r\n" + ex);
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新胸痛诊疗表中是否有肌钙蛋白的字段值
|
||
/// </summary>
|
||
/// <param name="_patientGuid">患者编号</param>
|
||
private void UpdateTreatmentInfo(string _patientGuid)
|
||
{
|
||
string Url = string.Format("api/service/T_Service_ChestPain_TreatmentInfo/GetByPatientGuid?patientGuid={0}", _patientGuid);
|
||
DataTable Cur_TreatmentInfoDT = DBHelpClass.Get(Url);
|
||
if (Cur_TreatmentInfoDT != null && Cur_TreatmentInfoDT.Rows.Count > 0)
|
||
{
|
||
string Is_CTNT = PublicClass.ToString(Cur_TreatmentInfoDT.Rows[0]["Is_CTNT"], "");
|
||
if (Is_CTNT == "")
|
||
{
|
||
List<T_Service_ChestPain_TreatmentInfoDTO> list_Model = new List<T_Service_ChestPain_TreatmentInfoDTO>();
|
||
T_Service_ChestPain_TreatmentInfoDTO model = new T_Service_ChestPain_TreatmentInfoDTO();
|
||
|
||
Url = "api/service/T_Service_ChestPain_TreatmentInfo/UpdateNotNullColumns";
|
||
model.ID = PublicClass.ToInt64(Cur_TreatmentInfoDT.Rows[0]["ID"], -1);
|
||
model.GUID = Cur_TreatmentInfoDT.Rows[0]["GUID"].ToString();
|
||
model.DeleteFlag = PublicClass.ToInt32(Cur_TreatmentInfoDT.Rows[0]["DeleteFlag"], -1);
|
||
|
||
model.CreatorID = PublicClass.ToInt64(Cur_TreatmentInfoDT.Rows[0]["CreatorID"], 0);
|
||
model.Creator = Cur_TreatmentInfoDT.Rows[0]["Creator"].ToString();
|
||
model.CreationDate = Cur_TreatmentInfoDT.Rows[0]["CreationDate"].ToString();
|
||
model.EditorID = Information.User.ID;
|
||
model.Editor = Information.User.FullName;
|
||
model.EditTime = PublicClass.DateTimeNow();
|
||
|
||
model.Is_CTNT = "1";
|
||
list_Model.Add(model);
|
||
|
||
//初始化两个工厂
|
||
ClientFactory<T_Service_ChestPain_TreatmentInfoDTO> httpClient = new HttpClientFactory<T_Service_ChestPain_TreatmentInfoDTO>();
|
||
Client<T_Service_ChestPain_TreatmentInfoDTO> client = httpClient.VisitFactory();
|
||
}
|
||
}
|
||
}
|
||
|
||
private void btn_Add_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
if (Cur_BindDT.Rows.Count >= 3)
|
||
{
|
||
if (XtraMessageBox.Show("当前已有三个肌钙蛋白的报告,因数据填报平台只需传送三个肌钙蛋白结果!\r\n如果继续新增将按添加的先后顺序传送前三条到数据填报平台,请知晓!\r\n请问是否继续新增?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||
{
|
||
PublicClass.EnabledControl(groupControl_CTNT, true, true);
|
||
return;
|
||
}
|
||
}
|
||
|
||
PublicClass.EnabledControl(groupControl_CTNT, false, true);
|
||
Cur_DetailDT = new DataTable();
|
||
lbl_CTNT.Tag = "";
|
||
txt_CTNT_Value.Tag = "";
|
||
|
||
btn_Update.Enabled = false;
|
||
btn_Delete.Enabled = false;
|
||
}
|
||
|
||
private void btn_Update_Click(object sender, EventArgs e)
|
||
{
|
||
BindDetail();
|
||
|
||
PublicClass.EnabledControl(groupControl_CTNT, false, false);
|
||
|
||
btn_Add.Enabled = false;
|
||
btn_Delete.Enabled = false;
|
||
}
|
||
|
||
private void btn_Delete_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (grv_CTNT.DataRowCount > 0)
|
||
{
|
||
int selectRow = grv_CTNT.GetSelectedRows()[0];
|
||
long ID = PublicClass.ToInt64(grv_CTNT.GetRowCellValue(selectRow, "ID"), 0);
|
||
if (ID == 0)
|
||
{
|
||
XtraMessageBox.Show("请先选择要删除的报告记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
return;
|
||
}
|
||
|
||
if (XtraMessageBox.Show("确定要删除当前报告记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||
{
|
||
List<T_Service_ChestPain_CTNTDTO> list = new List<T_Service_ChestPain_CTNTDTO>();
|
||
T_Service_ChestPain_CTNTDTO model = new T_Service_ChestPain_CTNTDTO();
|
||
|
||
string Url = "api/service/T_Service_ChestPain_CTNT/LogicalDelete";
|
||
model.ID = ID;
|
||
model.DeleteFlag = 1;
|
||
model.EditorID = Information.User.ID;
|
||
model.Editor = Information.User.FullName;
|
||
model.EditTime = PublicClass.DateTimeNow();
|
||
list.Add(model);
|
||
|
||
//初始化两个工厂
|
||
ClientFactory<T_Service_ChestPain_CTNTDTO> httpClient = new HttpClientFactory<T_Service_ChestPain_CTNTDTO>();
|
||
Client<T_Service_ChestPain_CTNTDTO> client = httpClient.VisitFactory();
|
||
|
||
if (client.Post(Url, list).Success)
|
||
{
|
||
XtraMessageBox.Show("删除报告记录成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
PublicClass.EnabledControl(this.groupControl_CTNT, true, false);
|
||
//列表分页数据绑定
|
||
Bind_List();
|
||
}
|
||
else
|
||
{
|
||
XtraMessageBox.Show("删除报告记录失败,请稍后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "删除:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
private void gridControl_CTNT_MouseClick(object sender, MouseEventArgs e)
|
||
{
|
||
PublicClass.EnabledControl(this.groupControl_CTNT, true, false);
|
||
BindDetail();
|
||
|
||
btn_Add.Enabled = true;
|
||
btn_Update.Enabled = true;
|
||
btn_Delete.Enabled = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定肌钙蛋白详情
|
||
/// </summary>
|
||
private void BindDetail()
|
||
{
|
||
try
|
||
{
|
||
if (grv_CTNT.DataRowCount > 0)
|
||
{
|
||
int selectRow = grv_CTNT.GetSelectedRows()[0];
|
||
long ID = Convert.ToInt64(grv_CTNT.GetRowCellValue(selectRow, "ID").ToString());
|
||
Cur_DetailDT = DBHelpClass.GetDataRow(string.Format("api/service/T_Service_ChestPain_CTNT/{0}", ID));
|
||
if (Cur_DetailDT != null && Cur_DetailDT.Rows.Count > 0)
|
||
{
|
||
lbl_CTNT.Tag = Cur_DetailDT.Rows[0]["ID"].ToString();
|
||
txt_CTNT_Value.Tag = Cur_DetailDT.Rows[0]["GUID"].ToString();
|
||
//类型
|
||
radioGroup_CTNT.EditValue = PublicClass.ToString(Cur_DetailDT.Rows[0]["Type"], "");
|
||
|
||
#region cTnI值
|
||
//cTnI值
|
||
string CTnI_Value = Cur_DetailDT.Rows[0]["Value"].ToString().Trim();
|
||
if (!string.IsNullOrEmpty(CTnI_Value))
|
||
{
|
||
if (CTnI_Value.Contains(">="))
|
||
{
|
||
comboBox_CTNT_Operational.Text = ">=";
|
||
CTnI_Value = CTnI_Value.Replace(">=", "");
|
||
}
|
||
else if (CTnI_Value.Contains("<="))
|
||
{
|
||
comboBox_CTNT_Operational.Text = "<=";
|
||
CTnI_Value = CTnI_Value.Replace("<=", "");
|
||
}
|
||
else if (CTnI_Value.Contains("="))
|
||
{
|
||
comboBox_CTNT_Operational.Text = "=";
|
||
CTnI_Value = CTnI_Value.Replace("=", "");
|
||
}
|
||
else if (CTnI_Value.Contains(">"))
|
||
{
|
||
comboBox_CTNT_Operational.Text = ">";
|
||
CTnI_Value = CTnI_Value.Replace(">", "");
|
||
}
|
||
else if (CTnI_Value.Contains("<"))
|
||
{
|
||
comboBox_CTNT_Operational.Text = "<";
|
||
CTnI_Value = CTnI_Value.Replace("<", "");
|
||
}
|
||
else
|
||
{
|
||
comboBox_CTNT_Operational.Text = "=";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
comboBox_CTNT_Operational.Text = "=";
|
||
}
|
||
|
||
txt_CTNT_Value.Text = CTnI_Value;
|
||
#endregion
|
||
|
||
//单位 1:ng/mL 2:ug/L 3:ng/L 4:pg/mL 5:mg/L
|
||
comboBox_CTNT_Unit.SelectedIndex = PublicClass.ToInt32(Cur_DetailDT.Rows[0]["Unit"], 0);
|
||
//状态 1:阳性 2:阴性 3:未选择
|
||
comboBox_CTNT_Status.SelectedIndex = PublicClass.ToInt32(Cur_DetailDT.Rows[0]["Status"], 0);
|
||
//抽血时间
|
||
time_CTNT_Blood_Time.TimeValue = Cur_DetailDT.Rows[0]["Blood_Time"].ToString();
|
||
//获得报告时间
|
||
time_CTNT_Report_Time.TimeValue = Cur_DetailDT.Rows[0]["Report_Time"].ToString();
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定肌钙蛋白详情:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
private void POCT_FormClosing(object sender, FormClosingEventArgs e)
|
||
{
|
||
Form_EMRInfo info;
|
||
info = (Form_EMRInfo)this.Owner;
|
||
info.ParentInfo(Cur_PatientGuid);
|
||
this.Dispose();
|
||
}
|
||
}
|
||
}
|