using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using Newtonsoft.Json; using System; using System.Data; using System.Reflection; using System.Windows.Forms; namespace HL_FristAidPlatform_DynamicElectrocardiogram { public partial class Form_DynamicElectrocardiogramMain : XtraForm { #region 变量 /// /// 合同号 /// private string Cur_WardshipId = string.Empty; /// /// 当前患者姓名 /// private string Cur_PatientName = string.Empty; /// /// 当前患者性别 /// private string Cur_PatientGender = string.Empty; /// /// 当前患者年龄 /// private string Cur_PatientAge = string.Empty; #endregion public Form_DynamicElectrocardiogramMain() { InitializeComponent(); } /// /// 窗体加载 /// /// /// private void Form_DynamicElectrocardiogramMain_Load(object sender, EventArgs e) { BindList(); } /// /// 绑定设备列表 /// private void BindList() { try { #region 绑定在线心电设备 DataTable dataTable = PublicHelp.BindEquipmentNumber(); DataTable Cur_PatientDT = new DataTable(); if (dataTable != null && dataTable.Rows.Count > 0) { DataRow[] rowSelect = dataTable.Select("useStatus=1"); if (rowSelect.Length > 0) { labelControl_Info.Visible = false; foreach (DataRow item in rowSelect) { string URL = string.Format("api/service/T_Service_Patient/GetModelByReport?where=GUID=(select top 1 GUID " + "from T_Service_Patient where EqmtNo = '{0}' order by ID desc)", item["eqmtNo"]); Cur_PatientDT = DBHelpClass.Get(URL); if (Cur_PatientDT != null && Cur_PatientDT.Rows.Count > 0) { Cur_PatientName = Cur_PatientDT.Rows[0]["Name"].ToString(); Cur_PatientGender = Cur_PatientDT.Rows[0]["Gender"].ToString(); Cur_PatientAge = Cur_PatientDT.Rows[0]["Age"].ToString(); Cur_WardshipId = Cur_PatientDT.Rows[0]["WardshipId"].ToString(); } Panel panel = new Panel(); panel.Height = 200; panel.Width = 300; panel.Visible = true; flowLayoutPanel1.Controls.Add(panel); PatientInfo patientInfo = new PatientInfo(); patientInfo.patientName = Cur_PatientName; patientInfo.patientAge = Cur_PatientAge; patientInfo.patientSex = Cur_PatientGender == "1" ? "男" : "女"; ECGShowParameter parameter = new ECGShowParameter(); parameter.height = panel.Height.ToString(); parameter.width = panel.Width.ToString(); parameter.patientFlag = "1"; parameter.patientInfo = patientInfo; parameter.wardNo = Cur_WardshipId; parameter.orgCode = Information.Hospital.Ecg_OrgCode; string paras = JsonConvert.SerializeObject(parameter); string dllPath = string.Format(Application.StartupPath + "\\ECG\\Hwyl.ECG_New.dll", System.Environment.CurrentDirectory);//dll组件路径 Assembly pAss = Assembly.LoadFrom(dllPath);//加载组件 Type pType = pAss.GetType("Hwyl.ECG_New.ECGViewControl");//获得类,ECG_New命名空间,ECGViewControl类名 MethodInfo pMtInfo = pType.GetMethod("ECGViewControl");//获得方法,ECGViewControl方法名 object o = Activator.CreateInstance(pType, paras);//创建类实例 panel.Controls.Add((Control)o); } } else { labelControl_Info.Text = "暂时没有正在使用的设备,请确认!"; labelControl_Info.Visible = true; } } else { labelControl_Info.Text = "当前院区未绑定任何设备,请确认!"; labelControl_Info.Visible = true; } #endregion } catch (Exception ex) { PublicClass.WriteErrorLog(Text, "窗体加载:\r\n" + ex); } } } }