StableVersion4.3/HL_FristAidPlatform_ChestPain/Part/UC_TreatmentPCI.cs

896 lines
42 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace HL_FristAidPlatform_ChestPain.Part
{
public partial class UC_TreatmentPCI : XtraForm, ISave
{
#region 变量
/// <summary>
/// 当前病人编号(GUID)
/// </summary>
private string Cur_PatientGuid;
/// <summary>
/// 当前病人所属院区编号(GUID)
/// </summary>
private string Cur_HospitalGuid;
/// <summary>
/// 导管室 V2.1
/// </summary>
private DataTable Cur_TreatmentPCIInfoDT = new DataTable();
/// <summary>
/// 冠状动脉造影 V2.1
/// </summary>
private DataTable Cur_CoronaryAngiographieDT = new DataTable();
/// <summary>
/// 时间源
/// </summary>
private DataTable Cur_TimeAxisDT = new DataTable();
/// <summary>
/// 当前患者所属院区信息及配置
/// </summary>
private DataTable Cur_HospitalDT = new DataTable();
/// <summary>
/// 当前患者诊断
/// </summary>
private string CP_Diagnosis_Code = string.Empty;
/// <summary>
/// 等待窗体
/// </summary>
private Loading loading = new Loading();
#endregion 变量
/// <summary>
/// 导管室
/// </summary>
/// <param name="_hospitalGuid">所属院区编号(GUID)</param>
/// <param name="_patientGuid">患者编号(GUID)</param>
public UC_TreatmentPCI(string _hospitalGuid, string _patientGuid)
{
InitializeComponent();
Cur_HospitalGuid = _hospitalGuid;
Cur_PatientGuid = _patientGuid;
}
/// <summary>
/// 加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UC_TreatmentPCI_Load(object sender, EventArgs e)
{
//减小tableLayoutPanel绘制时闪烁的情况
//table_TreatmentPCI.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(table_TreatmentPCI, true, null);
BindInfo(Cur_PatientGuid, Cur_HospitalGuid);
}
#region 绑定
/// <summary>
/// 绑定业务数据
/// </summary>
/// <param name="_patientGuid">患者编号(GUID)</param>
/// <param name="_hospitalGuid">所属院区编号(GUID)</param>
private void BindInfo(string patientGuid, string hospitalGuid)
{
//绑定时间源
BindTimeAxisDT(patientGuid);
//获取当前患者所属院区的配置信息
GetHospital(hospitalGuid);
//绑定胸痛诊疗
BindTreatmentInfo(patientGuid);
//绑定导管室信息
Bind_TreatmentPCIInfo(patientGuid, 1);
}
/// <summary>
/// 绑定时间源
/// </summary>
/// <param name="_patientGuid">患者编号(GUID)</param>
private void BindTimeAxisDT(string _patientGuid)
{
try
{
string Url = string.Format("api/service/T_Service_ChestPain_PatientsTimeAxis/GetPatientTime?patientGuid={0}", Cur_PatientGuid);
Cur_TimeAxisDT = DBHelpClass.GetJsonText(Url);
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定时间源:\r\n" + ex);
}
}
/// <summary>
/// 获取当前患者所属院区的配置信息
/// 调取自定义的D2B参考时长
/// </summary>
/// <param name="hospitalGuid">当前患者的医院编号</param>
private void GetHospital(string hospitalGuid)
{
try
{
Cur_HospitalDT = DBHelpClass.Get(string.Format("api/base/T_Base_Hospital/GetByGuid?guid={0}", hospitalGuid));
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "获取当前患者所属院区的配置信息:\r\n" + ex);
}
}
/// <summary>
/// 根据病人编号绑定胸痛病人 胸痛诊疗 信息
/// </summary>
/// <param name="_patientGuid">病人编号</param>
private void BindTreatmentInfo(string _patientGuid)
{
try
{
#region 胸痛诊疗信息
if (!string.IsNullOrEmpty(_patientGuid))
{
DataTable TreatmentInfoDT = DBHelpClass.Get(string.Format("api/service/T_Service_ChestPain_TreatmentInfo/GetByPatientGuid?patientGuid={0}", _patientGuid));
if (TreatmentInfoDT != null && TreatmentInfoDT.Rows.Count > 0)
{
#region 诊断
//初步诊断1:STEMI 2:NSTEMI 3:UA 4:主动脉夹层 5:肺动脉栓塞 6:非ACS心源性胸痛 7:其它非心源性胸痛 8:待查
CP_Diagnosis_Code = PublicClass.ToString(TreatmentInfoDT.Rows[0]["CP_Diagnosis_Code"], "");
#endregion
}
}
#endregion
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "根据病人编号绑定胸痛病人 胸痛诊疗 信息:\r\n" + ex);
}
}
/// <summary>
/// 绑定导管室信息
/// </summary>
/// <param name="type">
/// 1:直接PCI:基本信息需要panel_DGS_JBXX_JBXX
/// 2:转运PCI接收患者+溶栓后介入:不需要基本信息
/// 3:紧急介入治疗:不需要D2W时间
/// </param>
/// <returns></returns>
private void Bind_TreatmentPCIInfo(string patientGuid, int type)
{
try
{
string Url = string.Format("api/service/T_Service_ChestPain_TreatmentPCIInfo/GetByPatientGuid?patientGuid={0}", patientGuid);
Cur_TreatmentPCIInfoDT = DBHelpClass.Get(Url);
if (Cur_TreatmentPCIInfoDT != null && Cur_TreatmentPCIInfoDT.Rows.Count > 0)
{
if (type == 1 || type == 3)
{
//导管室激活时间
time_Activate_Conduit_Time.TimeValue = Cur_TreatmentPCIInfoDT.Rows[0]["Activate_Conduit_Time"].ToString();
//患者到达导管室
time_Patient_Arrived_Conduit_Time.TimeValue = Cur_TreatmentPCIInfoDT.Rows[0]["Patient_Arrived_Conduit_Time"].ToString();
//介入医师
txt_Intervention_Person.Text = Cur_TreatmentPCIInfoDT.Rows[0]["Intervention_Person"].ToString();
//开始穿刺时间
time_Start_Puncture_Time.TimeValue = Cur_TreatmentPCIInfoDT.Rows[0]["Start_Puncture_Time"].ToString();
//造影开始时间
time_Start_Radiography_Time.TimeValue = Cur_TreatmentPCIInfoDT.Rows[0]["Start_Radiography_Time"].ToString();
radioGroup_DGS_PREOPERATIVE_TIMI_LEVEL.EditValue = Cur_TreatmentPCIInfoDT.Rows[0]["PREOPERATIVE_TIMI_LEVEL"].ToString();
//术中抗凝给药时间
time_Anticoagulation_Time.TimeValue = Cur_TreatmentPCIInfoDT.Rows[0]["Anticoagulation_Time"].ToString();
//抗凝药物 1普通肝素 2低分子肝素 3比伐卢定 4磺达肝癸钠
comboBox_Anticoagulation_Drug.SelectedIndex = PublicClass.ToInt32(Cur_TreatmentPCIInfoDT.Rows[0]["Anticoagulation_Drug"], 0);
//抗凝药物(剂量)
txt_Anticoagulation_Dose.Text = Cur_TreatmentPCIInfoDT.Rows[0]["Anticoagulation_Dose"].ToString();
//术中抗凝药物(单位)
txt_Anticoagulation_Unit.Text = Cur_TreatmentPCIInfoDT.Rows[0]["Anticoagulation_Unit"].ToString();
//手术结束时间
time_End_Operation_Time.TimeValue = Cur_TreatmentPCIInfoDT.Rows[0]["End_Operation_Time"].ToString();
if (type == 1)
{
//D2W时间
txt_DTwoB_Time.Text = Cur_TreatmentPCIInfoDT.Rows[0]["DTwoB_Time"].ToString();
//是否延误 1: 是 0
string Is_Delay = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Is_Delay"], "");
radioGroup_Is_Delay.EditValue = Is_Delay;
if (Is_Delay == "1")
{
//延误原因 多选用竖线隔开。如"1|2|3"
PublicClass.SetItemChecked(checkedListBox_Delay_Reason, PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Delay_Reason"], ""), '|');
}
}
}
//入路
radioGroup_Route.EditValue = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Route"], "");
//冠脉造影表记录
Bind_CoronaryAngiographie();
//腔内影像1:IVUS 2:OCT 3:其他 4:未做
radioGroup_Intracavity_Image.EditValue = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Intracavity_Image"], "");
//功能检测1:FFR 2:其他 3:未做 4:iFR 5:IMR
string Function_Test = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Function_Test"], "");
radioGroup_Function_Test.EditValue = Function_Test;
if (Function_Test == "1" || Function_Test == "4" || Function_Test == "5")
{
//功能检测(数值)
txt_Function_Test_Value.Text = Cur_TreatmentPCIInfoDT.Rows[0]["Function_Test_Value"].ToString(); ;
}
//IABP 0否 1
radioGroup_IABP.EditValue = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["IABP"], "");
//临时起搏器 0否 1
radioGroup_Pacemaker.EditValue = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Pacemaker"], "");
//ECMO 0否 1
radioGroup_ECMO.EditValue = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["ECMO"], "");
//左心室辅助装置 0否 1
radioGroup_Auxiliary_Device.EditValue = PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Auxiliary_Device"], "");
//术中并发症 多选用竖线隔开。如"1|2|3"
PublicClass.SetItemChecked(checkedListBox_Complication, PublicClass.ToString(Cur_TreatmentPCIInfoDT.Rows[0]["Complication"], ""), '|');
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定导管室信息:\r\n" + ex);
}
}
#endregion
#region 冠状动脉造影
/// <summary>
/// 绑定冠状动脉造影
/// </summary>
private void Bind_CoronaryAngiographie()
{
try
{
string Url = string.Format("api/service/T_Service_ChestPain_CoronaryAngiographie/GetByPatientGuid?patientGuid={0}", Cur_PatientGuid);
Cur_CoronaryAngiographieDT = DBHelpClass.Get(Url);
if (Cur_CoronaryAngiographieDT != null && Cur_CoronaryAngiographieDT.Rows.Count > 0)
{
//禁用保存第一个冠状动脉造影记录按钮
btn_Save_Position.Enabled = false;
//部位
radioGroup_Position.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Position"], "");
//狭窄程度 1:<50% 2:50~69% 3:70~89% 4:90~99% 5:100%
radioGroup_Narrow_Level.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Narrow_Level"], "");
//造影时TIMI血流 0:0级 1:1级 2:2级 3:3级
radioGroup_Preoperative_TIMI_Level.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Preoperative_TIMI_Level"], "");
//支架内血栓 1:阳性 2:阴性
radioGroup_Bracket_Thrombus.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Bracket_Thrombus"], "");
//是否分叉病变 0:否 1:是
radioGroup_Branching_Sick.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Branching_Sick"], "");
//是否CTO 0:否 1:是
radioGroup_CTO.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["CTO"], "");
//钙化病变 0:否 1:是
radioGroup_CA_Sick.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["CA_Sick"], "");
//罪犯病变 0:否 1:是
radioGroup_Criminal_Sick.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Criminal_Sick"], "");
//PCI 0:否 1:是
string PCI = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["PCI"], "");
radioGroup_PCI.EditValue = PCI;
if (PCI == "1")
{
//术中处理 多选用竖线隔开。如"1|2|3"
PublicClass.SetItemChecked(checkedListBox_Intraoperative_Handle, PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Intraoperative_Handle"], ""), '|');
//导丝通过时间
time_Balloon_Expansion_Time.TimeValue = Cur_CoronaryAngiographieDT.Rows[0]["Balloon_expansion_Time"].ToString();
//术后TIMI血流
radioGroup_TIMI.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["TIMI"], "");
//植入支架个数 1:0枚 2:1枚 3:2枚 4:>=3枚
string Bracket_Num = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Bracket_Num"], "");
radioGroup_Bracket_Num.EditValue = Bracket_Num;
if (Bracket_Num != "" && Bracket_Num != "0")
{
//支架种类 1:BMS 2:DES 3:可降解支架 4:其他
radioGroup_Braket_Type.EditValue = PublicClass.ToString(Cur_CoronaryAngiographieDT.Rows[0]["Braket_Type"], "");
}
}
}
else
{
//启用保存第一个冠状动脉造影记录按钮
btn_Save_Position.Enabled = true;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定冠状动脉造影:\r\n" + ex);
}
}
/// <summary>
/// 保存冠状动脉造影
/// </summary>
/// <returns></returns>
private bool Save_CoronaryAngiographie()
{
try
{
string Url = string.Empty;
#region 保存冠状动脉造影
List<T_Service_ChestPain_CoronaryAngiographieDTO> list_Model = new List<T_Service_ChestPain_CoronaryAngiographieDTO>();
T_Service_ChestPain_CoronaryAngiographieDTO model = new T_Service_ChestPain_CoronaryAngiographieDTO();
//存在则修改 否则新增
if (Cur_CoronaryAngiographieDT != null && Cur_CoronaryAngiographieDT.Rows.Count > 0)
{
Url = "api/service/T_Service_ChestPain_CoronaryAngiographie/Update";
model.ID = PublicClass.ToInt64(Cur_CoronaryAngiographieDT.Rows[0]["ID"], -1);
model.GUID = Cur_CoronaryAngiographieDT.Rows[0]["GUID"].ToString();
model.DeleteFlag = PublicClass.ToInt32(Cur_CoronaryAngiographieDT.Rows[0]["DeleteFlag"], -1);
model.CreatorID = PublicClass.ToInt64(Cur_CoronaryAngiographieDT.Rows[0]["CreatorID"], 0);
model.Creator = Cur_CoronaryAngiographieDT.Rows[0]["Creator"].ToString();
model.CreationDate = Cur_CoronaryAngiographieDT.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_CoronaryAngiographie";
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;
//部位
model.Position = PublicClass.ToString(radioGroup_Position.EditValue, "");
//狭窄程度 1:<50% 2:50~69% 3:70~89% 4:90~99% 5:100%
model.Narrow_Level = PublicClass.ToString(radioGroup_Narrow_Level.EditValue, "");
//造影时TIMI血流 0:0级 1:1级 2:2级 3:3级
model.Preoperative_TIMI_Level = PublicClass.ToString(radioGroup_Preoperative_TIMI_Level.EditValue, "");
//支架内血栓 1:阳性 2:阴性
model.Bracket_Thrombus = PublicClass.ToString(radioGroup_Bracket_Thrombus.EditValue, "");
//是否分叉病变 0:否 1:是
model.Branching_Sick = PublicClass.ToString(radioGroup_Branching_Sick.EditValue, "");
//是否CTO 0:否 1:是
model.CTO = PublicClass.ToString(radioGroup_CTO.EditValue, "");
//钙化病变 0:否 1:是
model.CA_Sick = PublicClass.ToString(radioGroup_CA_Sick.EditValue, "");
//罪犯病变 0:否 1:是
model.Criminal_Sick = PublicClass.ToString(radioGroup_Criminal_Sick.EditValue, "");
//PCI 0:否 1:是
string PCI = PublicClass.ToString(radioGroup_PCI.EditValue, "");
model.PCI = PCI;
if (PCI == "1")
{
//术中处理 多选用竖线隔开。如"1|2|3"
string Intraoperative_Handle = string.Empty;
string Intraoperative_HandleText = string.Empty;
PublicClass.GetCheckedListBoxItemValues(checkedListBox_Intraoperative_Handle, "|", out Intraoperative_Handle, out Intraoperative_HandleText);
model.Intraoperative_Handle = Intraoperative_Handle;
//导丝通过时间
model.Balloon_expansion_Time = time_Balloon_Expansion_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_Balloon_Expansion_Time.TimeValue, PublicClassForDataBase.Config1027);
//术后TIMI血流
model.TIMI = PublicClass.ToString(radioGroup_TIMI.EditValue, "");
//植入支架个数 1:0枚 2:1枚 3:2枚 4:>=3枚
string Bracket_Num = PublicClass.ToString(radioGroup_Bracket_Num.EditValue, "");
model.Bracket_Num = Bracket_Num;
if (Bracket_Num != "" && Bracket_Num != "0")
{
//支架种类 1:BMS 2:DES 3:可降解支架 4:其他
model.Braket_Type = PublicClass.ToString(radioGroup_Braket_Type.EditValue, "");
}
}
list_Model.Add(model);
//初始化两个工厂
ClientFactory<T_Service_ChestPain_CoronaryAngiographieDTO> httpClient = new HttpClientFactory<T_Service_ChestPain_CoronaryAngiographieDTO>();
Client<T_Service_ChestPain_CoronaryAngiographieDTO> client = httpClient.VisitFactory();
#endregion
//访问
return client.Post(Url, list_Model).Success;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存 冠状动脉造影:\r\n" + ex);
return false;
}
}
#endregion
#region 保存
/// <summary>
/// 实现统一保存接口
/// </summary>
/// <summary>
/// 实现统一保存接口
/// </summary>
public void Save()
{
if (!string.IsNullOrEmpty(Cur_PatientGuid))
{
//统一验证
if (!CheckingDataAvailability())
return;
loading.ShowMessage("请稍后", "正在保存数据...");
if (!Save_TreatmentPCIInfo(1))
{
loading.HideMessage();
XtraMessageBox.Show("保存导管室患者信息失败,请重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
loading.HideMessage();
XtraMessageBox.Show("保存所填写的信息成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
//保存成功后重新加载 以便更新操作标记
BindInfo(Cur_PatientGuid, Cur_HospitalGuid);
}
}
/// <summary>
/// 检查数据有效性
/// </summary>
/// <returns></returns>
private bool CheckingDataAvailability()
{
//是延误,必须勾选延误原因
if (PublicClass.ToString(radioGroup_Is_Delay.EditValue, "") == "1")
{
//延误原因选项值,分割 多选
string Reason_For_Delay = string.Empty;
string Reason_For_DelayText = string.Empty;
PublicClass.GetCheckedListBoxItemValues(checkedListBox_Delay_Reason, ",", out Reason_For_Delay, out Reason_For_DelayText);
if (string.IsNullOrEmpty(Reason_For_Delay))
{
XtraMessageBox.Show("请选择延误原因!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
return true;
}
/// <summary>
/// 保存导管室信息
/// </summary>
/// <param name="type">
/// 1:直接PCI:基本信息需要panel_DGS_JBXX_JBXX
/// 2:转运PCI接收患者+溶栓后介入:不需要基本信息
/// 3:紧急介入治疗:不需要D2W时间
/// </param>
/// <returns></returns>
private bool Save_TreatmentPCIInfo(int type)
{
try
{
string Url = string.Empty;
#region 保存导管室信息
List<T_Service_ChestPain_TreatmentPCIInfoDTO> list_Model = new List<T_Service_ChestPain_TreatmentPCIInfoDTO>();
T_Service_ChestPain_TreatmentPCIInfoDTO model = new T_Service_ChestPain_TreatmentPCIInfoDTO();
//存在则修改 否则新增
if (Cur_TreatmentPCIInfoDT != null && Cur_TreatmentPCIInfoDT.Rows.Count > 0)
{
Url = "api/service/T_Service_ChestPain_TreatmentPCIInfo/Update";
model.ID = PublicClass.ToInt64(Cur_TreatmentPCIInfoDT.Rows[0]["ID"], -1);
model.GUID = Cur_TreatmentPCIInfoDT.Rows[0]["GUID"].ToString();
model.DeleteFlag = PublicClass.ToInt32(Cur_TreatmentPCIInfoDT.Rows[0]["DeleteFlag"], -1);
model.CreatorID = PublicClass.ToInt64(Cur_TreatmentPCIInfoDT.Rows[0]["CreatorID"], 0);
model.Creator = Cur_TreatmentPCIInfoDT.Rows[0]["Creator"].ToString();
model.CreationDate = Cur_TreatmentPCIInfoDT.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_TreatmentPCIInfo";
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;
//TIMI 血流等级(仅造影时)
model.PREOPERATIVE_TIMI_LEVEL = radioGroup_DGS_PREOPERATIVE_TIMI_LEVEL.EditValue + "";
if (type == 1 || type == 3)
{
//导管室激活时间
model.Activate_Conduit_Time = time_Activate_Conduit_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_Activate_Conduit_Time.TimeValue, PublicClassForDataBase.Config1022);
//患者到达导管室
model.Patient_Arrived_Conduit_Time = time_Patient_Arrived_Conduit_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_Patient_Arrived_Conduit_Time.TimeValue, PublicClassForDataBase.Config1023);
//介入医师
model.Intervention_Person = txt_Intervention_Person.Text;
//开始穿刺时间
model.Start_Puncture_Time = time_Start_Puncture_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_Start_Puncture_Time.TimeValue, PublicClassForDataBase.Config1024);
//造影开始时间
model.Start_Radiography_Time = time_Start_Radiography_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_Start_Radiography_Time.TimeValue, PublicClassForDataBase.Config1020);
//术中抗凝给药时间
model.Anticoagulation_Time = time_Anticoagulation_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_Anticoagulation_Time.TimeValue, PublicClassForDataBase.Config1026);
//抗凝药物 1普通肝素 2低分子肝素 3比伐卢定 4磺达肝癸钠
model.Anticoagulation_Drug = comboBox_Anticoagulation_Drug.SelectedIndex == 0 ? "" : comboBox_Anticoagulation_Drug.SelectedIndex.ToString();
//抗凝药物(剂量)
model.Anticoagulation_Dose = txt_Anticoagulation_Dose.Text;
//术中抗凝药物(单位)
model.Anticoagulation_Unit = txt_Anticoagulation_Unit.Text;
//手术结束时间
model.End_Operation_Time = time_End_Operation_Time.TimeValue;
PublicClassForDataBase.UpdateTime_ChestPain(Cur_PatientGuid, time_End_Operation_Time.TimeValue, PublicClassForDataBase.Config1028);
if (type == 1)
{
//D2W时间
model.DTwoB_Time = txt_DTwoB_Time.Text;
//是否延误 1: 是 0
string Is_Delay = PublicClass.ToString(radioGroup_Is_Delay.EditValue, "");
model.Is_Delay = Is_Delay;
if (Is_Delay == "1")
{
//延误原因 多选用竖线隔开。如"1|2|3"
string Delay_Reason = string.Empty;
string Delay_ReasonText = string.Empty;
PublicClass.GetCheckedListBoxItemValues(checkedListBox_Delay_Reason, "|", out Delay_Reason, out Delay_ReasonText);
model.Delay_Reason = Delay_Reason;
}
}
}
//入路
model.Route = PublicClass.ToString(radioGroup_Route.EditValue, "");
//冠脉造影表记录新增
string Position = PublicClass.ToString(radioGroup_Position.EditValue, "");
//部位
model.Position = Position;
if (!string.IsNullOrEmpty(Position))
{
Save_CoronaryAngiographie();
}
//腔内影像1:IVUS 2:OCT 3:其他 4:未做
model.Intracavity_Image = PublicClass.ToString(radioGroup_Intracavity_Image.EditValue, "");
//功能检测1:FFR 2:其他 3:未做 4:iFR 5:IMR
string Function_Test = PublicClass.ToString(radioGroup_Function_Test.EditValue, "");
model.Function_Test = Function_Test;
if (Function_Test == "1" || Function_Test == "4" || Function_Test == "5")
{
//功能检测(数值)
model.Function_Test_Value = txt_Function_Test_Value.Text;
}
//IABP 0否 1
model.IABP = PublicClass.ToString(radioGroup_IABP.EditValue, "");
//临时起搏器 0否 1
model.Pacemaker = PublicClass.ToString(radioGroup_Pacemaker.EditValue, "");
//ECMO 0否 1
model.ECMO = PublicClass.ToString(radioGroup_ECMO.EditValue, "");
//左心室辅助装置 0否 1
model.Auxiliary_Device = PublicClass.ToString(radioGroup_Auxiliary_Device.EditValue, "");
//术中并发症 多选用竖线隔开。如"1|2|3"
string Complication = string.Empty;
string ComplicationText = string.Empty;
PublicClass.GetCheckedListBoxItemValues(checkedListBox_Complication, "|", out Complication, out ComplicationText);
model.Complication = Complication;
list_Model.Add(model);
//初始化两个工厂
ClientFactory<T_Service_ChestPain_TreatmentPCIInfoDTO> httpClient = new HttpClientFactory<T_Service_ChestPain_TreatmentPCIInfoDTO>();
Client<T_Service_ChestPain_TreatmentPCIInfoDTO> client = httpClient.VisitFactory();
#endregion
//访问
return client.Post(Url, list_Model).Success;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存 胸痛诊疗:\r\n" + ex);
return false;
}
}
#endregion 保存
#region 计算D2B时间+计算进入医院大门到造影开始时间
/// <summary>
/// 计算D2B时间
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void time_Balloon_Expansion_Time_TimeValueChanged(object sender, EventArgs e)
{
CalculateD2B();
}
/// <summary>
/// 计算D2B时间
/// </summary>
//private double CalculateD2B()
//{
// double TotalMinutes = 0;
// try
// {
// //导丝通过时间
// DateTime Balloon_Expansion_Time = PublicClass.ToDateTime(time_Balloon_Expansion_Time.TimeValue, PublicClass.DefaultTime);
// if (Balloon_Expansion_Time != PublicClass.DefaultTime)
// {
// if (Cur_TimeAxisDT != null && Cur_TimeAxisDT.Rows.Count > 0)
// {
// //D2B时间患者进入本院大门到球囊扩张之间的时间差系统自动计算
// DataRow[] DataRow_Config = Cur_TimeAxisDT.Select("ID='" + PublicClassForDataBase.Config1007 + "'");
// if (DataRow_Config.Length > 0)
// {
// //到达医院大门时间
// DateTime Arrived_Hospital_Time = PublicClass.ToDateTime(DataRow_Config[0]["RecordingTime"], PublicClass.DefaultTime);
// //都不为默认时间则开始计算
// if (Arrived_Hospital_Time != PublicClass.DefaultTime)
// {
// TotalMinutes = PublicClass.DiffMinutes(Arrived_Hospital_Time, Balloon_Expansion_Time).TotalMinutes;
// txt_DTwoB_Time.Text = PublicClass.Round(Convert.ToDecimal(TotalMinutes), 2).ToString();
// //是否延误
// bool Is_Delay = CalculateIsDelay(TotalMinutes);
// if (Is_Delay)
// {
// radioGroup_Is_Delay.SelectedIndex = 1;
// radioGroup_Is_Delay.ForeColor = Color.Red;
// }
// else
// {
// radioGroup_Is_Delay.SelectedIndex = 0;
// radioGroup_Is_Delay.ForeColor = Color.Black;
// }
// }
// else
// {
// TotalMinutes = 0;
// txt_DTwoB_Time.Text = "";
// }
// }
// }
// }
// }
// catch (Exception ex)
// {
// PublicClass.WriteErrorLog(this.Text, "计算D2B时间\r\n" + ex);
// }
// return TotalMinutes;
//}
/// <summary>
/// 计算D2B时间
/// </summary>
private double CalculateD2B()
{
double TotalMinutes = 0;
try
{
//导丝通过时间
DateTime Balloon_Expansion_Time = PublicClass.ToDateTime(time_Balloon_Expansion_Time.TimeValue, PublicClass.DefaultTime);
if (Balloon_Expansion_Time != PublicClass.DefaultTime)
{
if (Cur_TimeAxisDT != null && Cur_TimeAxisDT.Rows.Count > 0)
{
//院内发病患者 D-W计算方式 导丝通过时间 - 首次医疗接触
string url = string.Format("api/service/T_Service_ChestPain_FirstAIDInfo/GetByPatientGuidForApp?patientGuid={0}", Cur_PatientGuid);
DataTable dt = DBHelpClass.Get(url);
if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["CW_Coming_Way_Code"].ToString() == "4")
{
DateTime CW_YNFB_First_MC_Time = PublicClass.ToDateTime(dt.Rows[0]["CW_YNFB_First_MC_Time"], PublicClass.DefaultTime);
TotalMinutes = PublicClass.DiffMinutes(CW_YNFB_First_MC_Time, Balloon_Expansion_Time).TotalMinutes;
txt_DTwoB_Time.Text = PublicClass.Round(Convert.ToDecimal(TotalMinutes), 2).ToString();
}
else
{
//D2B时间患者进入本院大门到球囊扩张之间的时间差系统自动计算
DataRow[] DataRow_Config = Cur_TimeAxisDT.Select("ID='" + PublicClassForDataBase.Config1007 + "'");
if (DataRow_Config.Length > 0)
{
//到达医院大门时间
DateTime Arrived_Hospital_Time = PublicClass.ToDateTime(DataRow_Config[0]["RecordingTime"], PublicClass.DefaultTime);
//都不为默认时间则开始计算
if (Arrived_Hospital_Time != PublicClass.DefaultTime)
{
TotalMinutes = PublicClass.DiffMinutes(Arrived_Hospital_Time, Balloon_Expansion_Time).TotalMinutes;
txt_DTwoB_Time.Text = PublicClass.Round(Convert.ToDecimal(TotalMinutes), 2).ToString();
//是否延误
bool Is_Delay = CalculateIsDelay(TotalMinutes);
//string CP_Diagnosis_Code = PublicClass.ToString(radioGroup_CP_Diagnosis_Code.EditValue, "");
//if (Is_Delay && CP_Diagnosis_Code == "1") //STEMI
if (Is_Delay)
{
radioGroup_Is_Delay.SelectedIndex = 1;
radioGroup_Is_Delay.ForeColor = Color.Red;
}
else
{
radioGroup_Is_Delay.SelectedIndex = 0;
radioGroup_Is_Delay.ForeColor = Color.Black;
}
}
else
{
TotalMinutes = 0;
txt_DTwoB_Time.Text = "";
}
}
}
}
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "计算D2B时间\r\n" + ex);
}
return TotalMinutes;
}
/// <summary>
/// 计算是否延迟
/// </summary>
/// <param name="totalMinutes">间隔总数</param>
private bool CalculateIsDelay(double totalMinutes)
{
bool IsDelay = false;
double STEMI_D2B_DelayTime_ReferenceValue = 90;
double NSTEMI_D2B_DelayTime_ReferenceValue = 120;
//设置的参考值
double STEMI_D2B_DelayTime_ReferenceValue_Config = 0;
double NSTEMI_D2B_DelayTime_ReferenceValueCofig = 0;
if (Cur_HospitalDT != null && Cur_HospitalDT.Rows.Count > 0)
{
#region 获取数据库配置
STEMI_D2B_DelayTime_ReferenceValue_Config = PublicClass.ToDouble(Cur_HospitalDT.Rows[0]["STEMI_D2B_DelayTime_ReferenceValue"], 0);
NSTEMI_D2B_DelayTime_ReferenceValueCofig = PublicClass.ToDouble(Cur_HospitalDT.Rows[0]["NSTEMI_D2B_DelayTime_ReferenceValue"], 0);
#endregion
}
#region 判断
//STEMI 对STEMI急诊PCI患者D2B时间>本院当前的目标值即为延误;
if (CP_Diagnosis_Code == "1")
{
if (totalMinutes > STEMI_D2B_DelayTime_ReferenceValue)
{
//延误
IsDelay = true;
}
//设置值<实际值<90
else if (STEMI_D2B_DelayTime_ReferenceValue_Config > 0 && (STEMI_D2B_DelayTime_ReferenceValue_Config < totalMinutes && totalMinutes < STEMI_D2B_DelayTime_ReferenceValue))
{
//未延误
IsDelay = false;
}
else
{
//未延误
IsDelay = false;
}
}
//NSTEMI 对紧急介入治疗的极高危NSTEMI患者D2B时间>120分钟即为延误
else if (CP_Diagnosis_Code == "2")
{
if (totalMinutes > NSTEMI_D2B_DelayTime_ReferenceValue)
{
//延误
IsDelay = true;
}
//设置值<实际值<120
else if (NSTEMI_D2B_DelayTime_ReferenceValueCofig > 0 && (NSTEMI_D2B_DelayTime_ReferenceValueCofig < totalMinutes && totalMinutes < NSTEMI_D2B_DelayTime_ReferenceValue))
{
//未延误
IsDelay = false;
}
else
{
//未延误
IsDelay = false;
}
}
#endregion
return IsDelay;
}
#endregion
#region 控件显示隐藏
/// <summary>
/// 是否延误
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void radioGroup_Is_Delay_SelectedIndexChanged(object sender, EventArgs e)
{
string EditValue = PublicClass.ToString(radioGroup_Is_Delay.EditValue, "");
if (EditValue == "1")
{
checkedListBox_Delay_Reason.Enabled = true;
}
else
{
checkedListBox_Delay_Reason.Enabled = false;
}
}
/// <summary>
/// 术中并发症选择项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void checkedListBox_Complication_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
string Type = string.Empty;
string TypeText = string.Empty;
PublicClass.GetCheckedListBoxItemValues(checkedListBox_Complication, "|", out Type, out TypeText);
if (!string.IsNullOrEmpty(Type))
{
string[] List = Type.Split('|');
foreach (string str in List)
{
//发病后曾出现心脏骤停
if (str == "00")
{
PublicClass.SetItemNotChecked(checkedListBox_Complication);
PublicClass.SetItemChecked(checkedListBox_Complication, "00", '|');
break;
}
}
}
}
#endregion 控件显示隐藏
private void simpleButton1_Click(object sender, EventArgs e)
{
Save();
}
private void btn_Add_MorePosition_Click(object sender, EventArgs e)
{
//弹出新的界面
Form_ChestPain_CoronaryAngiographie frm = new Form_ChestPain_CoronaryAngiographie(Cur_PatientGuid);
frm.ShowDialog();
}
}
}