StableVersion4.3/HL_FristAidPlatform_Trauma/Form_AddPatient.cs

251 lines
9.9 KiB
C#
Raw Normal View History

2024-03-11 09:47:34 +08:00
using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma
{
public partial class Form_AddPatient : XtraForm
{
public int gender = -1;
/// <summary>
/// 病情程度 0 轻伤 1 重伤 2 严重伤
/// </summary>
public int level = -1;
/// <summary>
/// 事件标识 0 单伤 1群伤
/// </summary>
public int evenflag { get; set; }
public StringBuilder MPDS;
public StringBuilder OtherMPDS;
/// <summary>
/// 来院方式
/// 1.120来院
/// 2.转院(包含任何机构)
/// 3.自行来院
/// 4.院内发病
/// 5.其他
/// </summary>
public string comeHosptialWay = "-1";
public Form_AddPatient()
{
InitializeComponent();
}
private void ucButtonExt5_BtnClick(object sender, EventArgs e)
{
this.Close();
}
private void Form_AddPatient_Load(object sender, EventArgs e)
{
//MPDS:创伤
DataTable dt = DBHelpClass.Get(string.Format("api/base/T_Base_MPDS/GetListOfType?type=1"));
checkedListBoxControl1.DataSource = dt;//显示分页结果
this.checkedListBoxControl1.DisplayMember = "SymptomName";
this.checkedListBoxControl1.ValueMember = "GUID";
//MPDS:其他
DataTable dt2 = DBHelpClass.Get(string.Format("api/base/T_Base_MPDS/GetListOfType?type=4"));
checkedListBoxControl2.DataSource = dt2;//显示分页结果
this.checkedListBoxControl2.DisplayMember = "SymptomName";
this.checkedListBoxControl2.ValueMember = "GUID";
}
private void comboBoxEdit1_SelectedValueChanged(object sender, EventArgs e)
{
/// <summary>
/// 来院方式
/// 1.120来院
/// 2.转院(包含任何机构)
/// 3.自行来院
/// 4.院内发病
/// 5.其他
/// </summary>
switch (comboBoxEdit1.Text)
{
case "120来院":
comeHosptialWay = "1";
break;
case "转院(包含任何机构)":
labelControl13.Visible = true;
labelControl13.Text = "医院名称";
txt_HospitalName.Visible = true;
comboBoxEdit2.Visible = false;
comeHosptialWay = "2";
break;
case "自行来院":
labelControl13.Visible = true;
labelControl13.Text = "自行来院";
comboBoxEdit2.Visible = true;
txt_HospitalName.Visible = false;
comeHosptialWay = "3";
break;
case "院内发病":
comeHosptialWay = "4";
break;
case "其他":
comeHosptialWay = "5";
break;
default:
labelControl13.Visible = false;
txt_HospitalName.Visible = false;
comboBoxEdit2.Visible = false;
break;
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
simpleButton2.Appearance.BackColor = System.Drawing.Color.FromArgb(25, 190, 107);
simpleButton2.Appearance.BackColor2 = System.Drawing.Color.FromArgb(25, 190, 107);
simpleButton2.ForeColor = System.Drawing.Color.White;
simpleButton3.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton3.Appearance.BackColor2 = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton3.ForeColor = System.Drawing.Color.Black;
simpleButton4.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton4.Appearance.BackColor2 = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton4.ForeColor = System.Drawing.Color.Black;
level = 0;
}
private void simpleButton3_Click(object sender, EventArgs e)
{
simpleButton3.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 140, 0);
simpleButton3.Appearance.BackColor2 = System.Drawing.Color.FromArgb(255, 140, 0);
simpleButton3.ForeColor = System.Drawing.Color.White;
simpleButton2.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton2.Appearance.BackColor2 = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton2.ForeColor = System.Drawing.Color.Black;
simpleButton4.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton4.Appearance.BackColor2 = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton4.ForeColor = System.Drawing.Color.Black;
level = 1;
}
private void simpleButton4_Click(object sender, EventArgs e)
{
simpleButton4.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 69, 0);
simpleButton4.Appearance.BackColor2 = System.Drawing.Color.FromArgb(255, 69, 0);
simpleButton4.ForeColor = System.Drawing.Color.White;
simpleButton2.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton2.Appearance.BackColor2 = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton2.ForeColor = System.Drawing.Color.Black;
simpleButton3.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton3.Appearance.BackColor2 = System.Drawing.Color.FromArgb(245, 245, 245);
simpleButton3.ForeColor = System.Drawing.Color.Black;
level = 2;
}
private void simpleButton5_Click(object sender, EventArgs e)
{
List<T_Service_TraumaPatientDTO> list = new List<T_Service_TraumaPatientDTO>();
T_Service_TraumaPatientDTO dto = new T_Service_TraumaPatientDTO();
if (string.IsNullOrEmpty(txt_Name.Text))
{
XtraMessageBox.Show("患者姓名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Name.Focus();
return;
}
if (string.IsNullOrEmpty(time_Birthday.TimeValue))
{
XtraMessageBox.Show("患者出生日期不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
time_Birthday.Focus();
return;
}
if (string.IsNullOrEmpty(txt_Name.Text))
{
XtraMessageBox.Show("患者姓名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Name.Focus();
return;
}
if (string.IsNullOrEmpty(txt_Name.Text))
{
XtraMessageBox.Show("患者姓名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Name.Focus();
return;
}
MPDS = new StringBuilder();
for (int i = 0; i < checkedListBoxControl1.CheckedItems.Count; i++)
{
if (MPDS.ToString().Length > 0)
{
MPDS.Append(", ");
}
MPDS.Append(checkedListBoxControl1.CheckedItems[i].ToString());
}
OtherMPDS = new StringBuilder();
for (int i = 0; i < checkedListBoxControl2.CheckedItems.Count; i++)
{
if (OtherMPDS.ToString().Length > 0)
{
OtherMPDS.Append(", ");
}
OtherMPDS.Append(checkedListBoxControl2.CheckedItems[i].ToString());
}
dto.Name = txt_Name.Text;
dto.ComeHosptialWay = comeHosptialWay;
dto.Brithday = time_Birthday.TimeValue;
dto.Gender = gender;
dto.EventFlag = evenflag;
dto.IllnessLevel = level;
dto.HospitalGuid = Information.Hospital.GUID;
dto.CreatorId = Information.User.ID;
dto.Brithday = Convert.ToDateTime(time_Birthday.TimeValue).ToString("yyyy-MM-dd");
dto.MPDS = MPDS.ToString();
dto.OtherMPDS = OtherMPDS.ToString();
dto.IdentityCard = txt_IdentityCard.Text;
dto.Address = txt_Address.Text;
dto.Attack_Address = txt_Attack_Address.Text;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_TraumaPatient/AddTraumaPatient";
//初始化两个工厂
ClientFactory<T_Service_TraumaPatientDTO> httpClient = new HttpClientFactory<T_Service_TraumaPatientDTO>();
Client<T_Service_TraumaPatientDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_TraumaPatientDTO> t = client.Post(Url, list);
if (t.Success)
{
XtraMessageBox.Show("创建成功");
Form_PatientList info;
info = (Form_PatientList)this.Owner;
info.PatientList(Information.Hospital.GUID, "", -1, -1, "", "");
this.Close();
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
gender = 1;
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked == true)
{
gender = 2;
}
}
}
}