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.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HL_FristAidPlatform_Apoplexy { public partial class UserControl_Hematencephalon : UserControl { string tempvalues = ""; string temptexts = ""; private string patientGUID; private PatientGCSDTO gcs = new PatientGCSDTO(); private PatientGCSDTO gcs1 = new PatientGCSDTO(); public UserControl_Hematencephalon(string _patientGUID = "") { patientGUID = _patientGUID; InitializeComponent(); } private void radioGroup1_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup1.SelectedIndex == 0) { labelControl5.Visible = false; timeControl2.Visible = false; timeControl2.TimeValue = ""; GetInMintus(); } else { labelControl5.Visible = true; timeControl2.Visible = true; GetInMintus(); } } private void radioGroup9_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup9.SelectedIndex == 0) { labelControl14.Visible = true; labelControl15.Visible = true; textBox1.Visible = true; simpleButton1.Visible = true; } else { labelControl14.Visible = false; labelControl15.Visible = false; textBox1.Visible = false; simpleButton1.Visible = false; } } private void radioGroup4_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup4.SelectedIndex == 0) { panelControl13.Visible = true; } else { panelControl13.Visible = false; } if (radioGroup4.SelectedIndex == 1) { panelControl12.Visible = true; } else { panelControl12.Visible = false; } { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl5, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues) && tempvalues.Contains("04")) { panelControl15.Visible = true; } else { panelControl15.Visible = false; } } { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl1, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues) && tempvalues.Contains("02")) { panelControl16.Visible = true; } else { panelControl16.Visible = false; } } } private void checkedListBoxControl5_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e) { if (checkedListBoxControl5.Text == "其他") { if (e.State == CheckState.Checked) { labelControl39.Visible = true; textBox7.Visible = true; } else { labelControl39.Visible = false; textBox7.Visible = false; } } if (checkedListBoxControl5.Text == "钻孔血肿抽吸术") { if (e.State == CheckState.Checked) { panelControl15.Visible = true; } else { panelControl15.Visible = false; } } } private void checkedListBoxControl6_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e) { if (checkedListBoxControl6.Text == "其他") { if (e.State == CheckState.Checked) { labelControl38.Visible = true; textBox8.Visible = true; } else { labelControl38.Visible = false; textBox8.Visible = false; } } if (checkedListBoxControl6.Text == "无") { if (e.State == CheckState.Checked) { //清空本窗体 for (int i = 0; i < checkedListBoxControl6.Items.Count - 1; i++) checkedListBoxControl6.SetItemChecked(i, false); } } } private void radioGroup7_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup7.SelectedIndex == 0) { labelControl31.Visible = true; labelControl32.Visible = true; textBox5.Visible = true; simpleButton2.Visible = true; } else { labelControl31.Visible = false; labelControl32.Visible = false; textBox5.Visible = false; simpleButton2.Visible = false; } } private void radioGroup5_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup5.SelectedIndex == 3) { textBox6.Visible = true; } else { textBox6.Visible = false; } } private void UserControl_Hematencephalon_Load(object sender, EventArgs e) { try { string url = string.Format("api/service/T_Service_Intervention/GetHematencephalonByPatientGuid?patientGuid={0}", patientGUID); T_Service_Intervention_HematencephalonDTO temp = DBHelpClass.GetDateModel(url); if (temp != null) { if (!string.IsNullOrEmpty(temp.NCXJZFBSJ + "")) { radioGroup3.EditValue = temp.NCXJZFBSJ + ""; } if (!string.IsNullOrEmpty(temp.NCXJZZyCz + "")) { radioGroup1.EditValue = temp.NCXJZZyCz + ""; } if (!string.IsNullOrEmpty(temp.NCXJZFaBingTime)) { timeControl1.TimeValue = temp.NCXJZFaBingTime + ""; } if (!string.IsNullOrEmpty(temp.NCXJZDaoYuanTime)) { timeControl2.TimeValue = temp.NCXJZDaoYuanTime + ""; } //checkedListBoxControl2 if (!string.IsNullOrEmpty(temp.NCXCause + "")) { PublicClass.SetItemChecked(checkedListBoxControl2, temp.NCXCause, ';'); } if (!string.IsNullOrEmpty(temp.ZWMPGGCSYN)) { radioGroup9.EditValue = temp.ZWMPGGCSYN + ""; if (radioGroup9.EditValue + "" == "1") { if (!string.IsNullOrEmpty(temp.ZWMPGGCS)) { textBox1.Text = temp.ZWMPGGCS + ""; } } } if (!string.IsNullOrEmpty(temp.ZWMPGNaoShanYN)) { radioGroup2.EditValue = temp.ZWMPGNaoShanYN + ""; } //checkedListBoxControl3 if (!string.IsNullOrEmpty(temp.NCXLSite + "")) { PublicClass.SetItemChecked(checkedListBoxControl3, temp.NCXLSite, ';'); } //checkedListBoxControl4 if (!string.IsNullOrEmpty(temp.NCXRSite + "")) { PublicClass.SetItemChecked(checkedListBoxControl4, temp.NCXRSite, ';'); } if (!string.IsNullOrEmpty(temp.NCXArea)) { textBox2.Text = temp.NCXArea + ""; } if (!string.IsNullOrEmpty(temp.NCXOpYN)) { radioGroup4.EditValue = temp.NCXOpYN + ""; if (radioGroup4.EditValue + "" == "1") { if (!string.IsNullOrEmpty(temp.NCXOpStartTime)) { timeControl3.TimeValue = temp.NCXOpStartTime + ""; } textBox3.Text = temp.NCXOpThEndTime + ""; textBox4.Text = temp.NCXOpStEndTime + ""; if (!string.IsNullOrEmpty(temp.NCXOpMaZui + "")) { radioGroup6.EditValue = temp.NCXOpMaZui + ""; } //checkedListBoxControl5 if (!string.IsNullOrEmpty(temp.NCXOpWays + "")) { PublicClass.SetItemChecked(checkedListBoxControl5, temp.NCXOpWays, ';'); if (temp.NCXOpWays.Contains("99")) { textBox7.Visible = true; textBox7.Text = temp.NCXOpWayOther + ""; } if (temp.NCXOpWays.Contains("04")) { panelControl15.Visible = true; if (!string.IsNullOrEmpty(temp.Str2 + "")) PublicClass.SetItemChecked(checkedListBoxControl1, temp.Str2, ';'); if (temp.Str2.Contains("02")) { panelControl16.Visible = true; if (!string.IsNullOrEmpty(temp.Str3 + "")) PublicClass.SetItemChecked(checkedListBoxControl7, temp.Str3, ';'); } } } if (!string.IsNullOrEmpty(temp.NCXOpBFZ + "")) { PublicClass.SetItemChecked(checkedListBoxControl6, temp.NCXOpBFZ, ';'); if (temp.NCXOpBFZ.Contains("99")) { textBox8.Visible = true; textBox8.Text = temp.NCXOpBFZNR + ""; } } if (!string.IsNullOrEmpty(temp.NCXOpYuHou)) { radioGroup8.EditValue = temp.NCXOpYuHou + ""; } } else if (radioGroup4.EditValue + "" == "2") { if (!string.IsNullOrEmpty(temp.NCXOpReason)) { radioGroup5.EditValue = temp.NCXOpReason + ""; if (radioGroup5.EditValue + "" == "4") { textBox6.Text = temp.NCXOpReasonOther + ""; } } } } if (!string.IsNullOrEmpty(temp.ZWMPGCYGCSYN)) { radioGroup7.EditValue = temp.ZWMPGCYGCSYN + ""; if (radioGroup7.EditValue + "" == "1") { textBox5.Text = temp.ZWMPGCYGCS + ""; } } } } catch (Exception ex) { throw ex; } } public void SaveHematencephalon() { try { T_Service_Intervention_HematencephalonDTO hematencephalonDTO = new T_Service_Intervention_HematencephalonDTO(); hematencephalonDTO.PatientGuid = patientGUID; hematencephalonDTO.CreateUser = Information.User.ID; hematencephalonDTO.NCXJZFBSJ = radioGroup3.EditValue + ""; hematencephalonDTO.NCXJZZyCz = radioGroup1.EditValue + ""; hematencephalonDTO.NCXJZFaBingTime = timeControl1.TimeValue + ""; if (radioGroup1.EditValue + "" == "2") { hematencephalonDTO.NCXJZDaoYuanTime = timeControl2.TimeValue + ""; } { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl2, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.NCXCause = ";" + tempvalues + ";"; } hematencephalonDTO.ZWMPGGCSYN = radioGroup9.EditValue + ""; if (radioGroup9.EditValue + "" == "1") { hematencephalonDTO.ZWMPGGCS = textBox1.Text + ""; } hematencephalonDTO.ZWMPGNaoShanYN = radioGroup2.EditValue + ""; { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl3, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.NCXLSite = ";" + tempvalues + ";"; } { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl4, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.NCXRSite = ";" + tempvalues + ";"; } hematencephalonDTO.NCXArea = textBox2.Text + ""; hematencephalonDTO.NCXOpYN = radioGroup4.EditValue + ""; if (radioGroup4.EditValue + "" == "2") { hematencephalonDTO.NCXOpReason = radioGroup5.EditValue + ""; if (radioGroup5.EditValue + "" == "4") { hematencephalonDTO.NCXOpReasonOther = textBox6.Text + ""; } } else if (radioGroup4.EditValue + "" == "1") { hematencephalonDTO.NCXOpStartTime = timeControl3.TimeValue + ""; hematencephalonDTO.NCXOpThEndTime = textBox3.Text + ""; hematencephalonDTO.NCXOpStEndTime = textBox4.Text + ""; hematencephalonDTO.NCXOpMaZui = radioGroup6.EditValue + ""; { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl5, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.NCXOpWays = ";" + tempvalues + ";"; if (tempvalues.Contains("99")) { hematencephalonDTO.NCXOpWayOther = textBox7.Text + ""; } if (tempvalues.Contains("04")) { { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl1, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.Str2 = ";" + tempvalues + ";"; if (tempvalues.Contains("02")) { { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl7, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.Str3 = ";" + tempvalues + ";"; } } } } } { tempvalues = ""; temptexts = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl6, ";", out tempvalues, out temptexts); if (!string.IsNullOrEmpty(tempvalues)) hematencephalonDTO.NCXOpBFZ = ";" + tempvalues + ";"; if (tempvalues.Contains("99")) { hematencephalonDTO.NCXOpBFZNR = textBox8.Text + ""; } } hematencephalonDTO.NCXOpYuHou = radioGroup8.EditValue + ""; hematencephalonDTO.ZWMPGCYGCSYN = radioGroup7.EditValue + ""; if (radioGroup7.EditValue + "" == "1") { hematencephalonDTO.ZWMPGCYGCS = textBox5.Text + ""; } } List hematencephalonDTOs = new List(); string Url = string.Format("api/service/T_Service_Intervention/SaveHematencephalon"); ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); hematencephalonDTOs.Add(hematencephalonDTO); //访问 ListEntity t = client.Post(Url, hematencephalonDTOs); if (t.Success) { if (!string.IsNullOrEmpty(t.DataString)) { if (t.DataString.Contains("Success")) { SaveGCS(gcs); SaveGCS(gcs1); JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString); string msg = jo["Msg"].ToString(); if (!string.IsNullOrEmpty(msg)) { XtraMessageBox.Show(msg); } } else { string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", ""); XtraMessageBox.Show(msg1); } } else { XtraMessageBox.Show("保存失败"); } } else { XtraMessageBox.Show("保存失败"); } } catch (Exception ex) { PublicClass.WriteErrorLog(this.Text, "保存干预表急诊脑梗死信息:\r\n" + ex); } } private void timeControl3_TimeValueChanged(object sender, EventArgs e) { GetInMintus(); } public void GetInMintus() { if (!string.IsNullOrEmpty(timeControl1.TimeValue + "") && !string.IsNullOrEmpty(timeControl3.TimeValue + "")) { textBox3.Text = PublicClass.DiffMinutes(Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl3.TimeValue)).TotalMinutes + ""; } else { textBox3.Text = ""; } if (!string.IsNullOrEmpty(timeControl1.TimeValue + "") && !string.IsNullOrEmpty(timeControl3.TimeValue + "")) { textBox4.Text = PublicClass.DiffMinutes(Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl3.TimeValue)).TotalMinutes + ""; } else { textBox4.Text = ""; } } private void simpleButton1_Click(object sender, EventArgs e) { string strText = string.Empty; InputDialog_trans.ShowForGCS(out strText, out gcs, 1); if (!string.IsNullOrEmpty(strText)) { textBox1.Text = strText; gcs.CreateUser = Information.User.ID; gcs.PatientGUID = patientGUID; gcs.Flag = 1; } } private void SaveGCS(PatientGCSDTO gcs) { List PrehospitalDTOs = new List(); //PatientMRSDTO PrehospitalDTO = new PatientMRSDTO(); string Url = string.Format("api/service/T_Service_Patient/SaveGCS"); ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); //patientMRSDTO.PatientGUID = Cur_PatientGuid; PrehospitalDTOs.Add(gcs); //访问 ListEntity t = client.Post(Url, PrehospitalDTOs); } private void simpleButton2_Click(object sender, EventArgs e) { string strText = string.Empty; InputDialog_trans.ShowForGCS(out strText, out gcs, 1); if (!string.IsNullOrEmpty(strText)) { textBox5.Text = strText; gcs1.CreateUser = Information.User.ID; gcs1.PatientGUID = patientGUID; gcs1.Flag = 2; } } private void timeControl1_TimeValueChanged(object sender, EventArgs e) { GetInMintus(); } private void timeControl2_TimeValueChanged(object sender, EventArgs e) { GetInMintus(); } private void checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e) { if (checkedListBoxControl1.Text == "神经外科手术机器人手术") { if (e.State == CheckState.Checked) { panelControl16.Visible = true; } else { panelControl16.Visible = false; } } } } }