StableVersion4.3/HL_FristAidPlatform_Critica.../Form_PatientMainInfo.cs

430 lines
17 KiB
C#
Raw Permalink 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.Utils;
using DevExpress.Utils.Layout;
using DevExpress.XtraEditors;
using HL_FristAidPlatform_CriticalPregnant.Properties;
using HL_FristAidPlatform_Public;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace HL_FristAidPlatform_CriticalPregnant
{
public partial class Form_PatientMainInfo : XtraForm
{
public int pageIndex;
public string guid = "";
public string name = "";
public string age = "";
public string emergencyState = "";
public string comeHospitalWay = "";
private Form_PatientScore patientScore;
private Form_Pregnant_Transport transport;
private Form_Pregnant_Pastmedicalhistory pastmedicalhistory;
private Form_BasicInformation form_BasicInformation;
public TablePanel tab;
public Form_PatientMainInfo(string _guid, string _name, string _age, string _emergencyState, string _comeHospitalWay)
{
InitializeComponent();
guid = _guid;
name = _name;
age = _age;
emergencyState = _emergencyState;
comeHospitalWay = _comeHospitalWay;
}
private void Form_PatientMainInfo_Load(object sender, System.EventArgs e)
{
lbl_name.Text = name;
lbl_Age.Text = age;
if (emergencyState == "0")
lbl_state.Text = "急救中";
if (emergencyState == "1")
lbl_state.Text = "住院中";
if (emergencyState == "0")
lbl_state.Text = "已转归";
if (comeHospitalWay == "1")
lbl_comehospitalway.Text = "呼救120或其它)";
if (comeHospitalWay == "2")
lbl_comehospitalway.Text = "自行来院";
if (comeHospitalWay == "3")
lbl_comehospitalway.Text = "转院(包含任何医疗机构)";
if (comeHospitalWay == "4")
lbl_comehospitalway.Text = "院内发病";
GetCriticalPregnanTime();
}
#region 菜单点击变色效果
public void MenuClick(PictureBox picture, LabelControl label, int index)
{
picture.BackColor = Color.FromArgb(17, 131, 251);
label.BackColor = Color.FromArgb(17, 131, 251);
pageIndex = index;
}
public void UnMenuClick2(PictureBox picture, LabelControl label)
{
picture.BackColor = Color.Transparent;
label.BackColor = Color.Transparent;
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
MenuClick(picture_info, lbl_info, 1);
UnMenuClick2(picture_jwbs, lbl_jwbs);
UnMenuClick2(picture_sorce, lbl_sorce);
UnMenuClick2(picture_zy, lbl_zy);
MdiChildrenClose();
if (!ShowChildrenForm("Form_BasicInformation"))
{
panelControl6.Controls.Clear();
form_BasicInformation = new Form_BasicInformation(guid);
form_BasicInformation.WindowState = FormWindowState.Maximized;
form_BasicInformation.MdiParent = this;
form_BasicInformation.TopLevel = false;// 将子窗体设置为非顶级控件
form_BasicInformation.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
form_BasicInformation.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
form_BasicInformation.Show();
panelControl6.Controls.Add(form_BasicInformation);
}
}
private void lbl_info_Click(object sender, System.EventArgs e)
{
MenuClick(picture_info, lbl_info, 1);
UnMenuClick2(picture_jwbs, lbl_jwbs);
UnMenuClick2(picture_sorce, lbl_sorce);
UnMenuClick2(picture_zy, lbl_zy);
MdiChildrenClose();
if (!ShowChildrenForm("Form_BasicInformation"))
{
panelControl6.Controls.Clear();
form_BasicInformation = new Form_BasicInformation(guid);
form_BasicInformation.WindowState = FormWindowState.Maximized;
form_BasicInformation.MdiParent = this;
form_BasicInformation.TopLevel = false;// 将子窗体设置为非顶级控件
form_BasicInformation.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
form_BasicInformation.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
form_BasicInformation.Show();
panelControl6.Controls.Add(form_BasicInformation);
}
}
private void picture_jwbs_Click(object sender, System.EventArgs e)
{
MenuClick(picture_jwbs, lbl_jwbs, 2);
UnMenuClick2(picture_info, lbl_info);
UnMenuClick2(picture_sorce, lbl_sorce);
UnMenuClick2(picture_zy, lbl_zy);
if (!ShowChildrenForm("Form_Pregnant_Pastmedicalhistory"))
{
panelControl6.Controls.Clear();
pastmedicalhistory = new Form_Pregnant_Pastmedicalhistory(guid);
pastmedicalhistory.WindowState = FormWindowState.Maximized;
pastmedicalhistory.MdiParent = this;
pastmedicalhistory.TopLevel = false;// 将子窗体设置为非顶级控件
pastmedicalhistory.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
pastmedicalhistory.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
pastmedicalhistory.Show();
panelControl6.Controls.Add(pastmedicalhistory);
}
}
private void lbl_jwbs_Click(object sender, System.EventArgs e)
{
MenuClick(picture_jwbs, lbl_jwbs, 2);
UnMenuClick2(picture_info, lbl_info);
UnMenuClick2(picture_sorce, lbl_sorce); ;
UnMenuClick2(picture_zy, lbl_zy);
if (!ShowChildrenForm("Form_Pregnant_Pastmedicalhistory"))
{
panelControl6.Controls.Clear();
pastmedicalhistory = new Form_Pregnant_Pastmedicalhistory(guid);
pastmedicalhistory.WindowState = FormWindowState.Maximized;
pastmedicalhistory.MdiParent = this;
pastmedicalhistory.TopLevel = false;// 将子窗体设置为非顶级控件
pastmedicalhistory.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
pastmedicalhistory.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
pastmedicalhistory.Show();
panelControl6.Controls.Add(pastmedicalhistory);
}
}
private void picture_sorce_Click(object sender, System.EventArgs e)
{
MenuClick(picture_sorce, lbl_sorce, 3);
UnMenuClick2(picture_jwbs, lbl_jwbs);
UnMenuClick2(picture_info, lbl_info);
UnMenuClick2(picture_zy, lbl_zy);
if (!ShowChildrenForm("Form_PatientScore"))
{
panelControl6.Controls.Clear();
patientScore = new Form_PatientScore(guid);
patientScore.WindowState = FormWindowState.Maximized;
patientScore.MdiParent = this;
patientScore.TopLevel = false;// 将子窗体设置为非顶级控件
patientScore.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
patientScore.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
patientScore.Show();
panelControl6.Controls.Add(patientScore);
}
}
private void lbl_sorce_Click(object sender, System.EventArgs e)
{
MenuClick(picture_sorce, lbl_sorce, 3);
UnMenuClick2(picture_jwbs, lbl_jwbs);
UnMenuClick2(picture_info, lbl_info);
UnMenuClick2(picture_zy, lbl_zy);
if (!ShowChildrenForm("Form_PatientScore"))
{
panelControl6.Controls.Clear();
patientScore = new Form_PatientScore(guid);
patientScore.WindowState = FormWindowState.Maximized;
patientScore.MdiParent = this;
patientScore.TopLevel = false;// 将子窗体设置为非顶级控件
patientScore.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
patientScore.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
patientScore.Show();
panelControl6.Controls.Add(patientScore);
}
}
private void picture_zy_Click(object sender, System.EventArgs e)
{
MenuClick(picture_zy, lbl_zy, 5);
UnMenuClick2(picture_jwbs, lbl_jwbs);
UnMenuClick2(picture_sorce, lbl_sorce);
UnMenuClick2(picture_info, lbl_info);
if (!ShowChildrenForm("Form_Pregnant_Transport"))
{
panelControl6.Controls.Clear();
transport = new Form_Pregnant_Transport(guid);
transport.WindowState = FormWindowState.Maximized;
transport.MdiParent = this;
transport.TopLevel = false;// 将子窗体设置为非顶级控件
transport.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
transport.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
transport.Show();
panelControl6.Controls.Add(transport);
}
}
private void lbl_zy_Click(object sender, System.EventArgs e)
{
MenuClick(picture_zy, lbl_zy, 5);
UnMenuClick2(picture_jwbs, lbl_jwbs);
UnMenuClick2(picture_sorce, lbl_sorce);
UnMenuClick2(picture_info, lbl_info);
if (!ShowChildrenForm("Form_Pregnant_Transport"))
{
panelControl6.Controls.Clear();
transport = new Form_Pregnant_Transport(guid);
transport.WindowState = FormWindowState.Maximized;
transport.MdiParent = this;
transport.TopLevel = false;// 将子窗体设置为非顶级控件
transport.FormBorderStyle = FormBorderStyle.None;//设置无边框
//turnOver.Parent = this;//设置窗体容器
transport.Dock = DockStyle.Fill; //容器大小随着调整窗体大小自动变化
transport.Show();
panelControl6.Controls.Add(transport);
}
}
#endregion
private bool ShowChildrenForm(string p_ChildrenFormText)
{
int i;
//依次检测当前窗体的子窗体
for (i = 0; i < MdiChildren.Length; i++)
{
//判断当前子窗体的Text属性值是否与传入的字符串值相同
if (MdiChildren[i].Name == p_ChildrenFormText)
{
//如果值相同则表示此子窗体为想要调用的子窗体激活此子窗体并返回true值
MdiChildren[i].Activate();
return true;
}
}
//如果没有相同的值则表示要调用的子窗体还没有被打开返回false值
return false;
}
public void GetCriticalPregnanTime()
{
string url = string.Format("api/service/T_Service_CriticalPregnan_Time/GetCriticalPregnanTime?patientGuid={0}", guid);
List<TimeModel> list = DBHelpClass.GetList<TimeModel>(url);
if (list != null && list.Count > 0)
{
CreateTabPanel(list);
}
}
public class TimeModel
{
/// <summary>
///
/// </summary>
public string Name { get; set; }
/// <summary>
///
/// </summary>
public string Key { get; set; }
/// <summary>
///
/// </summary>
public string Value { get; set; }
}
/// <summary>
/// 创建动态表格
/// </summary>
/// <param name="total">数据条数</param>
/// <param name="dt">数据</param>
public void CreateTabPanel(List<TimeModel> list)
{
panel_time.Controls.Clear();
int rowCount = list.Count * 2 - 1;//行数
tab = new TablePanel();
tab.Columns.Clear();
tab.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Relative, 30));
tab.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Relative, 70));
tab.Rows.Clear();
for (int i = 0; i < rowCount; i++)
{
int odd = i % 2;
if (odd == 0)
tab.Rows.Add(new TablePanelRow(TablePanelEntityStyle.Absolute, 50));
if (odd != 0)
tab.Rows.Add(new TablePanelRow(TablePanelEntityStyle.Absolute, 70));
}
tab.Dock = DockStyle.Top;
tab.AutoSize = true;
for (int i = 0; i < list.Count; i++)//循环行
{
int index1 = i * 2;//数据行
int index2 = i * 2 + 1;//非数据行
PanelControl panel = new PanelControl();
panel.Dock = DockStyle.Fill;
panel.BorderStyle = (DevExpress.XtraEditors.Controls.BorderStyles)BorderStyle.None;
LabelControl key = new LabelControl();
key.Dock = DockStyle.Top;
key.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
key.AutoSizeMode = LabelAutoSizeMode.None;
key.ForeColor = Color.FromArgb(0, 9, 64, 58);
key.Text = list[i].Name;
LabelControl value = new LabelControl();
value.Dock = DockStyle.Bottom;
value.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
value.AutoSizeMode = LabelAutoSizeMode.None;
if (!string.IsNullOrEmpty(list[i].Value))
{
value.Text = list[i].Value;
value.ForeColor = Color.FromArgb(48, 49, 51);
}
else
{
value.Text = "暂无时间信息";
value.ForeColor = Color.FromArgb(144, 147, 153);
}
panel.Controls.AddRange(new Control[] { key, value });
SeparatorControl line = new SeparatorControl();
//线条
line.LineColor = Color.FromArgb(92, 173, 255);
line.Dock = DockStyle.Fill;
line.LineOrientation = Orientation.Vertical;
line.LineThickness = 2;
if (!string.IsNullOrEmpty(list[i].Value))
{
PictureBox drop1 = new PictureBox();
drop1.Dock = DockStyle.Fill;
drop1.SizeMode = PictureBoxSizeMode.Zoom;
drop1.Margin = new Padding(12, 12, 12, 12);
drop1.Image = Resources.green;
tab.SetCell(drop1, index1, 0);
tab.SetCell(panel, index1, 1);
tab.SetCell(line, index2, 0);
tab.Controls.AddRange(new Control[] { drop1, panel, line });
}
else
{
PictureBox drop2 = new PictureBox();
drop2.Dock = DockStyle.Fill;
drop2.SizeMode = PictureBoxSizeMode.Zoom;
drop2.Margin = new Padding(12, 12, 12, 12);
drop2.Image = Resources.grey;
tab.SetCell(drop2, index1, 0);
tab.SetCell(panel, index1, 1);
tab.SetCell(line, index2, 0);
tab.Controls.AddRange(new Control[] { drop2, panel, line });
}
}
panel_time.Controls.Add(tab);
}
public void MdiChildrenClose()
{
//关闭所有已经打开的子窗体
if (MdiChildren.Length > 0)
{
foreach (Form myForm in this.MdiChildren)
{
myForm.Close();
}
}
}
private void simpleButton1_Click(object sender, System.EventArgs e)
{
switch (pageIndex)
{
case 1:
form_BasicInformation.Save();
break;
case 2:
pastmedicalhistory.SavePastmedicalhistory();
break;
case 3:
patientScore.SavePatientScore();
break;
case 4:
//_Thrombolysis.SaveThrombolysis();
break;
case 5:
transport.SaveTransport();
break;
}
}
}
}