StableVersion4.3/HL_FristAidPlatform_Trauma/Page/UCPrehospitalInfo.cs

568 lines
21 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma.Page
{
public partial class UCPrehospitalInfo : UserControl
{
string _guid = "";
public UCPrehospitalInfo()
{
InitializeComponent();
}
public UCPrehospitalInfo(string patientGUID)
{
InitializeComponent();
_guid = patientGUID;
}
private void UCPrehospitalInfo_Load(object sender, EventArgs e)
{
try
{
DataTable dt = DBHelpClass.GetDataRow(string.Format("api/service/T_Service_Trauma_FirstAidInfo/GetByPatientGuid?patientGuid={0}", _guid));
if (dt != null && dt.Rows.Count > 0)
{
//时间进程
timeControl2.TimeValue = (dt.Rows[0]["OnsetTime"]+"").ToString();
timeControl3.TimeValue = (dt.Rows[0]["CallTime"]+"").ToString();
timeControl4.TimeValue = (dt.Rows[0]["AmbulanceOut"]+"").ToString();
timeControl8.TimeValue = (dt.Rows[0]["ArriveScene"]+"").ToString();
timeControl5.TimeValue = (dt.Rows[0]["LeaveScene"]+"").ToString();
timeControl1.TimeValue = (dt.Rows[0]["WarningTime"]+"").ToString();
timeControl7.TimeValue = (dt.Rows[0]["ArriveHospital"]+"").ToString();
//timeControl6.TimeValue = (dt.Rows[0]["DeathTime"]+"").ToString();
//院前诊断
memoEdit1.Text= dt.Rows[0]["Diagnosis"].ToString();
//主诉
memoEdit2.Text = dt.Rows[0]["ChiefComplaint"].ToString();
//过敏史
memoEdit8.Text= dt.Rows[0]["AllergyHistory"].ToString();
//现病史
memoEdit3.Text = dt.Rows[0]["PresentIllness"].ToString();
//既往病史
memoEdit4.Text = dt.Rows[0]["HistoryIllness"].ToString();
//无法测量
if (dt.Rows[0]["UnableMeasure"].ToString() == "0")
{
//收缩压
textEdit15.Text= dt.Rows[0]["SystolicPressure"].ToString();
//舒张压
textEdit14.Text= dt.Rows[0]["DiastolicPressure"].ToString();
}
else if (dt.Rows[0]["UnableMeasure"].ToString() == "1")
{
checkEdit1.Checked = true;
}
if (string.IsNullOrEmpty(dt.Rows[0]["UnableMeasure"] + ""))
{
//收缩压
textEdit15.Text = dt.Rows[0]["SystolicPressure"].ToString();
//舒张压
textEdit14.Text = dt.Rows[0]["DiastolicPressure"].ToString();
}
//心率
textEdit13.Text = dt.Rows[0]["HeartRate"].ToString();
//脉搏
textEdit12.Text = dt.Rows[0]["Pulse"].ToString();
//呼吸频率
textEdit11.Text = dt.Rows[0]["RespiratoryRate"].ToString();
//体温
textEdit5.Text = dt.Rows[0]["Temperature"].ToString();
//血糖
textEdit4.Text = dt.Rows[0]["BloodSugar"].ToString();
//血氧饱和度
textEdit3.Text = dt.Rows[0]["BloodOxygenSaturation"].ToString();
//体格检查
//瞳孔
radioGroup3.EditValue = dt.Rows[0]["Pupil"].ToString();
//光反射
radioGroup1.EditValue = dt.Rows[0]["LightReflection"].ToString();
//意识
radioGroup2.EditValue = dt.Rows[0]["Consciousness"].ToString();
//气道
radioGroup6.EditValue = dt.Rows[0]["Airway"].ToString();
//循环
radioGroup5.EditValue = dt.Rows[0]["Loop"].ToString();
//心率
radioGroup4.EditValue = dt.Rows[0]["HeartRhythm"].ToString();
//胸部
radioGroup11.EditValue = dt.Rows[0]["Chest"].ToString();
//腹部
//radioGroup10.EditValue = dt.Rows[0]["Abdomen"].ToString();
PublicClass.SetItemChecked(checkedListBoxControl2, PublicClass.ToString(dt.Rows[0]["Abdomen"], ""), ';');
//肠鸣
radioGroup9.EditValue = dt.Rows[0]["BowelSound"].ToString();
//肌张力
radioGroup8.EditValue = dt.Rows[0]["MuscleTone"].ToString();
//骨折
radioGroup7.EditValue = dt.Rows[0]["Osteolysis"].ToString();
//体格其他
memoEdit5.Text = dt.Rows[0]["PhysiqueOther"].ToString();
//院前抢救措施
PublicClass.SetItemChecked(checkedListBoxControl1, PublicClass.ToString(dt.Rows[0]["RescueMeasures"], ""), ';');
memo_RescueMeasuresOther.Text= dt.Rows[0]["RescueMeasuresOther"].ToString();
//抢救措施说明
memoEdit7.Text = dt.Rows[0]["RescueMeasuresDescription"].ToString();
//治疗药物
memoEdit6.Text = dt.Rows[0]["TherapeuticDrugs"].ToString();
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "加载院前信息:\r\n" + ex);
}
}
public void SavePrehospitalInfo()
{
try
{
List<T_Service_Trauma_FirstAidInfoDTO> list = new List<T_Service_Trauma_FirstAidInfoDTO>();
T_Service_Trauma_FirstAidInfoDTO dto = new T_Service_Trauma_FirstAidInfoDTO();
//时间进程记录
if (!string.IsNullOrEmpty(timeControl2.TimeValue + ""))
{
dto.OnsetTime = Convert.ToDateTime(timeControl2.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl3.TimeValue + ""))
{
dto.CallTime = Convert.ToDateTime(timeControl3.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl4.TimeValue + ""))
{
dto.AmbulanceOut = Convert.ToDateTime(timeControl4.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl8.TimeValue + ""))
{
dto.ArriveScene = Convert.ToDateTime(timeControl8.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl5.TimeValue + ""))
{
dto.LeaveScene = Convert.ToDateTime(timeControl5.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl1.TimeValue + ""))
{
dto.WarningTime = Convert.ToDateTime(timeControl1.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl7.TimeValue + ""))
{
dto.ArriveHospital = Convert.ToDateTime(timeControl7.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
if (!string.IsNullOrEmpty(timeControl6.TimeValue + ""))
{
dto.DeathTime = Convert.ToDateTime(timeControl6.TimeValue + "").ToString("yyyy-MM-dd HH:mm");
}
//院前诊断
dto.Diagnosis = memoEdit1.Text + "";
//主诉
dto.ChiefComplaint = memoEdit2.Text + "";
//过敏史
dto.AllergyHistory = memoEdit8.Text + "";
//现病史
dto.PresentIllness = memoEdit3.Text + "";
//既往病史
dto.HistoryIllness = memoEdit4.Text + "";
//无法测量
if (checkEdit1.Checked == true)
dto.UnableMeasure = "1";
if (checkEdit1.Checked == false)
dto.UnableMeasure = "0";
if (dto.UnableMeasure == "0")
{
//收缩压
dto.SystolicPressure = textEdit15.Text + "";
//舒张压
dto.DiastolicPressure = textEdit14.Text + "";
}
//心率
dto.HeartRate = textEdit13.Text + "";
//脉搏
dto.Pulse = textEdit12.Text + "";
//呼吸频率
dto.RespiratoryRate = textEdit11.Text + "";
//体温
dto.Temperature = textEdit5.Text + "";
//血糖
dto.BloodSugar = textEdit4.Text + "";
//血氧饱和度
dto.BloodOxygenSaturation = textEdit3.Text + "";
//体格检查
//瞳孔
dto.Pupil = radioGroup3.EditValue + "";
//光反射
dto.LightReflection = radioGroup1.EditValue + "";
//意识
dto.Consciousness = radioGroup2.EditValue + "";
//气道
dto.Airway = radioGroup6.EditValue + "";
//循环
dto.Loop = radioGroup5.EditValue + "";
//心率
dto.HeartRhythm = radioGroup4.EditValue + "";
//胸部
dto.Chest = radioGroup11.EditValue + "";
//腹部
//dto.Abdomen = radioGroup10.EditValue + "";
{
string SyndromeNumber = "";
string Syndrome = "";
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl2, ";", out SyndromeNumber, out Syndrome);
dto.Abdomen = "" + SyndromeNumber + "";
}
//肠鸣
dto.BowelSound = radioGroup9.EditValue + "";
//肌张力
dto.MuscleTone = radioGroup8.EditValue + "";
//骨折
dto.Osteolysis = radioGroup7.EditValue + "";
//体格其他
dto.PhysiqueOther = memoEdit5.Text + "";
//院前抢救措施
//PublicClass.SetItemChecked(checkedListBox_YXJbXgCheck, PublicClass.ToString(dataTable.Rows[0]["YXJbXgCheck"], ""), ';');
//PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl_acZLType, ";", out SyndromeNumber, out Syndrome);
//model.acZLType = ";" + SyndromeNumber + ";";
{
string SyndromeNumber = "";
string Syndrome = "";
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl1, ";", out SyndromeNumber, out Syndrome);
dto.RescueMeasures = "" + SyndromeNumber + "";
}
if (!string.IsNullOrEmpty(dto.RescueMeasures) && dto.RescueMeasures.Contains("18"))
{ dto.RescueMeasuresOther = memo_RescueMeasuresOther.Text.Trim(); }
else { dto.RescueMeasuresOther = ""; }
//抢救措施说明
dto.RescueMeasuresDescription = memoEdit7.Text + "";
//治疗药物
dto.TherapeuticDrugs = memoEdit6.Text + "";
dto.PatientGuid = _guid;
list.Add(dto);
string Url = "api/service/T_Service_Trauma_FirstAidInfo/SaveFirstAidInfo";
//初始化两个工厂
ClientFactory<T_Service_Trauma_FirstAidInfoDTO> httpClient = new HttpClientFactory<T_Service_Trauma_FirstAidInfoDTO>();
Client<T_Service_Trauma_FirstAidInfoDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_Trauma_FirstAidInfoDTO> t = client.Post(Url, list);
if (t.Success)
{
JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
string msg = jo["Msg"].ToString();
if (!string.IsNullOrEmpty(msg))
{
XtraMessageBox.Show(msg);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存创伤院前信息:\r\n" + ex);
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
try
{
//Form_SelectDiseaseTemplate frm = new Form_SelectDiseaseTemplate(100005);
//if (frm.ShowDialog() == DialogResult.OK)
//{
// memoEdit1.Text += frm.SelDiseaseTemplateS;
//}
Form_Diagnosis form_Diagnosis = new Form_Diagnosis();
form_Diagnosis.ShowDialog();
if (string.IsNullOrEmpty(memoEdit1.Text))
{
memoEdit1.Text = form_Diagnosis.diagnosisValue;
}
else
{
memoEdit1.Text = memoEdit1.Text + "," + form_Diagnosis.diagnosisValue;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择主诉模板:\r\n" + ex);
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
memoEdit4.Text += simpleButton1.Text + "、";
}
private void simpleButton3_Click(object sender, EventArgs e)
{
memoEdit4.Text += simpleButton3.Text + "、";
}
private void simpleButton7_Click(object sender, EventArgs e)
{
memoEdit4.Text += simpleButton7.Text + "、";
}
private void simpleButton5_Click(object sender, EventArgs e)
{
memoEdit4.Text += simpleButton5.Text + "、";
}
private void simpleButton6_Click(object sender, EventArgs e)
{
memoEdit4.Text += simpleButton6.Text + "、";
}
private void simpleButton4_Click(object sender, EventArgs e)
{
memoEdit4.Text += simpleButton4.Text + "、";
}
private void checkEdit1_CheckedChanged(object sender, EventArgs e)
{
if (checkEdit1.Checked == true)
{
//收缩压
textEdit15.ReadOnly = true;
textEdit15.Text = "";
//舒张压
textEdit14.ReadOnly = true;
textEdit14.Text = "";
}else if(checkEdit1.Checked == false)
{
textEdit15.ReadOnly = false;
textEdit14.ReadOnly = false;
}
}
private void checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
if (checkedListBoxControl1.Text == "无")
{
if (e.State == CheckState.Checked)
{
for (int i = 0; i < checkedListBoxControl1.Items.Count - 1; i++)
checkedListBoxControl1.SetItemChecked(i, false);
}
}
string checkState = checkedListBoxControl1.GetItemCheckState(17).ToString();
if (checkState == "Checked")
{
memo_RescueMeasuresOther.Enabled = true;
}
else
{
memo_RescueMeasuresOther.Enabled = false;
}
}
private void simpleButton10_Click(object sender, EventArgs e)
{
memoEdit8.Text += simpleButton10.Text + "、";
}
private void simpleButton11_Click(object sender, EventArgs e)
{
memoEdit8.Text += simpleButton11.Text + "、";
}
private void simpleButton9_Click(object sender, EventArgs e)
{
Form_ChestPain_ECG frm = new Form_ChestPain_ECG(_guid);
frm.ShowDialog();
}
private void simpleButton12_Click(object sender, EventArgs e)
{
try
{
Print.PrintCaseHandoverForm(_guid,Information.Hospital.Name);
}
catch (Exception)
{
throw;
}
}
private void textEdit15_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit15.Text.Trim() + ""))
{
if (int.Parse(textEdit15.Text.Trim().ToString()) > 139 || int.Parse(textEdit15.Text.Trim().ToString()) < 90)
{
textEdit15.ForeColor = Color.Red;
}
else
{
textEdit15.ForeColor = Color.Black;
}
}
}
private void textEdit14_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit14.Text.Trim() + ""))
{
if (int.Parse(textEdit14.Text.Trim().ToString()) > 89 || int.Parse(textEdit14.Text.Trim().ToString()) < 60)
{
textEdit14.ForeColor = Color.Red;
}
else
{
textEdit14.ForeColor = Color.Black;
}
}
}
private void textEdit13_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit13.Text.Trim() + ""))
{
if (int.Parse(textEdit13.Text.Trim().ToString()) > 100 || int.Parse(textEdit13.Text.Trim().ToString()) < 60)
{
textEdit13.ForeColor = Color.Red;
}
else
{
textEdit13.ForeColor = Color.Black;
}
}
}
private void textEdit12_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit12.Text.Trim() + ""))
{
if (int.Parse(textEdit12.Text.Trim() + "") > 100 || int.Parse(textEdit12.Text.Trim() + "") < 60)
{
textEdit12.ForeColor = Color.Red;
}
else
{
textEdit12.ForeColor = Color.Black;
}
}
}
private void textEdit11_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit11.Text.Trim() + ""))
{
if (int.Parse(textEdit11.Text.Trim() + "") > 20 || int.Parse(textEdit11.Text.Trim() + "") < 18)
{
textEdit11.ForeColor = Color.Red;
}
else
{
textEdit11.ForeColor = Color.Black;
}
}
}
private void textEdit5_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit5.Text.Trim() + ""))
{
if (double.Parse(textEdit5.Text.Trim() + "") > 37 || double.Parse(textEdit5.Text.Trim() + "") < 36)
{
textEdit5.ForeColor = Color.Red;
}
else
{
textEdit5.ForeColor = Color.Black;
}
}
}
private void textEdit4_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit4.Text.Trim() + ""))
{
if (double.Parse(textEdit4.Text.Trim() + "") > 11.1 || double.Parse(textEdit4.Text.Trim() + "") < 3.9)
{
textEdit4.ForeColor = Color.Red;
}
else
{
textEdit4.ForeColor = Color.Black;
}
}
}
private void textEdit3_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit3.Text.Trim() + ""))
{
if (int.Parse(textEdit3.Text.Trim().ToString()) < 95)
{
textEdit3.ForeColor = Color.Red;
}
else
{
textEdit3.ForeColor = Color.Black;
}
}
}
private void simpleButton8_Click(object sender, EventArgs e)
{
memoEdit6.Text = "";
}
}
}