StableVersion4.3/HL_FristAidPlatform_Trauma/Form_PatientInfoRTS.cs

173 lines
5.8 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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma
{
public partial class Form_PatientInfoRTS : XtraForm
{
private string _patientGUID;
private float gcs;
private float systolicPressureScore;
private float breathingScore;
public Form_PatientInfoRTS(string patientGUID)
{
InitializeComponent();
_patientGUID = patientGUID;
}
private void Form_PatientInfoRTS_Load(object sender, EventArgs e)
{
radioGroup1.SelectedIndex = -1;
radioGroup2.SelectedIndex = -1;
radioGroup3.SelectedIndex = -1;
}
private void radioGroup1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (radioGroup1.SelectedIndex)
{
case 0:
gcs = 0;
break;
case 1:
gcs = 1;
break;
case 2:
gcs = 2;
break;
case 3:
gcs = 3;
break;
case 4:
gcs = 4;
break;
}
lbl_TotalScore.Text = (float.Parse((gcs * 0.9368).ToString()) + float.Parse((systolicPressureScore * 0.7326).ToString()) + float.Parse((breathingScore * 7.8408).ToString())).ToString();
}
private void radioGroup2_SelectedIndexChanged(object sender, EventArgs e)
{
switch (radioGroup2.SelectedIndex)
{
case 0:
systolicPressureScore = 0;
break;
case 1:
systolicPressureScore = 1;
break;
case 2:
systolicPressureScore = 2;
break;
case 3:
systolicPressureScore = 3;
break;
case 4:
systolicPressureScore = 4;
break;
}
lbl_TotalScore.Text = (float.Parse((gcs * 0.9368).ToString()) + float.Parse((systolicPressureScore * 0.7326).ToString()) + float.Parse((breathingScore * 7.8408).ToString())).ToString();
}
private void radioGroup3_SelectedIndexChanged(object sender, EventArgs e)
{
switch (radioGroup3.SelectedIndex)
{
case 0:
breathingScore = 0;
break;
case 1:
breathingScore = 1;
break;
case 2:
breathingScore = 2;
break;
case 3:
breathingScore = 3;
break;
case 4:
breathingScore = 4;
break;
}
lbl_TotalScore.Text = (float.Parse((gcs * 0.9368).ToString()) + float.Parse((systolicPressureScore * 0.7326).ToString()) + float.Parse((breathingScore * 7.8408).ToString())).ToString();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
if (radioGroup1.SelectedIndex == -1)
{
XtraMessageBox.Show("GCS选择项为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
radioGroup1.Focus();
return;
}
if (radioGroup2.SelectedIndex == -1)
{
XtraMessageBox.Show("收缩压选择项为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
radioGroup2.Focus();
return;
}
if (radioGroup3.SelectedIndex == -1)
{
XtraMessageBox.Show("呼吸频率选择项为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
radioGroup3.Focus();
return;
}
List<FirstAid_PatientRTSDTO> list = new List<FirstAid_PatientRTSDTO>();
FirstAid_PatientRTSDTO dto = new FirstAid_PatientRTSDTO();
dto.PatientGUID = _patientGUID;
dto.CreateUser = Information.User.ID;
dto.GCS = gcs;
dto.SystolicPressureScore = systolicPressureScore;
dto.BreathingScore = breathingScore;
dto.TotalScore = float.Parse(lbl_TotalScore.Text);
if (dto.TotalScore > 11)
{
dto.RTSLevel = 1;
}
else
{
dto.RTSLevel = 2;
}
list.Add(dto);
string Url = string.Empty;
Url = "api/service/FirstAid_PatientScore/AddRTS";
//初始化两个工厂
ClientFactory<FirstAid_PatientRTSDTO> httpClient = new HttpClientFactory<FirstAid_PatientRTSDTO>();
Client<FirstAid_PatientRTSDTO> client = httpClient.VisitFactory();
if (client.Post(Url, list).Success)
{
XtraMessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Form_PatientFristAidInfo info;
info = (Form_PatientFristAidInfo)this.Owner;
info.FirstAidScore(_patientGUID);
this.Close();
}
}
catch (Exception)
{
throw;
}
}
}
}