StableVersion4.3/HL_FristAidPlatform_Trauma/Form_PatientInfoGCS.cs

187 lines
6.1 KiB
C#

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_PatientInfoGCS : XtraForm
{
public string guid;
private int eyesOpenScore;
private int verbalResponseScore;
private int limbExerciseScore;
private int gcsLeve;
public Form_PatientInfoGCS(string _guid)
{
InitializeComponent();
guid = _guid;
}
private void radioGroup1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (radioGroup1.SelectedIndex)
{
case 0:
eyesOpenScore = 4;
break;
case 1:
eyesOpenScore = 3;
break;
case 2:
eyesOpenScore = 2;
break;
case 3:
eyesOpenScore = 1;
break;
}
lbl_TotalScore.Text = (eyesOpenScore + verbalResponseScore + limbExerciseScore).ToString();
}
private void radioGroup2_SelectedIndexChanged(object sender, EventArgs e)
{
switch (radioGroup2.SelectedIndex)
{
case 0:
verbalResponseScore = 5;
break;
case 1:
verbalResponseScore = 4;
break;
case 2:
verbalResponseScore = 3;
break;
case 3:
verbalResponseScore = 2;
break;
case 4:
verbalResponseScore = 1;
break;
}
lbl_TotalScore.Text = (eyesOpenScore + verbalResponseScore + limbExerciseScore).ToString();
}
private void radioGroup3_SelectedIndexChanged(object sender, EventArgs e)
{
switch (radioGroup3.SelectedIndex)
{
case 0:
limbExerciseScore = 6;
break;
case 1:
limbExerciseScore = 5;
break;
case 2:
limbExerciseScore = 4;
break;
case 3:
limbExerciseScore = 3;
break;
case 4:
limbExerciseScore = 2;
break;
case 5:
limbExerciseScore = 1;
break;
}
lbl_TotalScore.Text = (eyesOpenScore + verbalResponseScore + limbExerciseScore).ToString();
}
private void Form_PatientInfoGCS_Load(object sender, EventArgs e)
{
radioGroup1.SelectedIndex = -1;
radioGroup2.SelectedIndex = -1;
radioGroup3.SelectedIndex = -1;
}
private void lbl_TotalScore_TextChanged(object sender, EventArgs e)
{
int score = int.Parse(lbl_TotalScore.Text);
if (score >= 13 && score <= 14)
{
lbl_GCSLeve.Text = "轻度昏迷";
gcsLeve = 1;
}
if (score >= 9 && score <= 12)
{
lbl_GCSLeve.Text = "中度昏迷";
gcsLeve = 2;
}
if (score >= 3 && score <= 8)
{
lbl_GCSLeve.Text = "重度昏迷";
gcsLeve = 3;
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
if (radioGroup1.SelectedIndex == -1)
{
XtraMessageBox.Show("睁眼反应选择项为空!", "提示", 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_PatientGCSDTO> list = new List<FirstAid_PatientGCSDTO>();
FirstAid_PatientGCSDTO dto = new FirstAid_PatientGCSDTO();
dto.CreateUser = Information.User.ID;
dto.PatientGUID = guid;
dto.EyesOpenScore = eyesOpenScore;
dto.VerbalResponseScore = verbalResponseScore;
dto.LimbExerciseScore = limbExerciseScore;
dto.TotalScore = int.Parse(lbl_TotalScore.Text);
dto.GCSLevel = gcsLeve;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/FirstAid_PatientScore/AddGCS";
//初始化两个工厂
ClientFactory<FirstAid_PatientGCSDTO> httpClient = new HttpClientFactory<FirstAid_PatientGCSDTO>();
Client<FirstAid_PatientGCSDTO> 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(guid);
this.Close();
}
}
catch (Exception)
{
throw;
}
}
}
}