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 Form_Surgery : XtraForm { string patientGUID; string flag; public Form_Surgery(string _patientGUID = "", string _flag = "") { InitializeComponent(); patientGUID = _patientGUID; flag = _flag; } private void Form_Surgery_Load(object sender, EventArgs e) { LoadSurgery(); } private void LoadSurgery() { try { string url = string.Format("api/service/T_Service_Apoplexy_Community/GetSurgeryByPatientGuidAndFlag?patientGuid={0}&flag={1}", patientGUID, flag); T_Service_Apoplexy_Community_SurgeryDTO temp = DBHelpClass.GetDateModel(url); if (temp != null) { if (!string.IsNullOrEmpty(temp.IsCAS + "")) { radioGroup37.EditValue = temp.IsCAS + ""; if (temp.IsCAS + "" == "1") { if (!string.IsNullOrEmpty(temp.CASLocation + "")) { radioGroup38.EditValue = temp.CASLocation + ""; } if (!string.IsNullOrEmpty(temp.CASTime + "")) { dateTimePicker1.Text = temp.CASTime + ""; } } } if (!string.IsNullOrEmpty(temp.IsCEA + "")) { radioGroup40.EditValue = temp.IsCEA + ""; if (temp.IsCEA + "" == "1") { if (!string.IsNullOrEmpty(temp.CEALocation + "")) { radioGroup39.EditValue = temp.CEALocation + ""; } if (!string.IsNullOrEmpty(temp.CEATime + "")) { dateTimePicker2.Text = temp.CEATime + ""; //dateTimePicker2.Text = temp.CEATime + ""; } } } if (!string.IsNullOrEmpty(temp.IsBypassSurgery + "")) { radioGroup42.EditValue = temp.IsBypassSurgery + ""; if (!string.IsNullOrEmpty(temp.BypassSurgeryTime + "")) { dateTimePicker3.Text = temp.BypassSurgeryTime + ""; //dateTimePicker3.Text = temp.BypassSurgeryTime + ""; } } if (!string.IsNullOrEmpty(temp.IsPCI + "")) { radioGroup41.EditValue = temp.IsPCI + ""; if (!string.IsNullOrEmpty(temp.PCITime + "")) { dateTimePicker4.Text = temp.PCITime + ""; //dateTimePicker4.Text = temp.PCITime + ""; } } if (!string.IsNullOrEmpty(temp.IsCABG + "")) { radioGroup43.EditValue = temp.IsCABG + ""; if (!string.IsNullOrEmpty(temp.CABGTime + "")) { dateTimePicker5.Text = temp.CABGTime + ""; //dateTimePicker5.Text = temp.CABGTime + ""; } } if (!string.IsNullOrEmpty(temp.IsSurgicalIntervention + "")) { radioGroup45.EditValue = temp.IsSurgicalIntervention + ""; if (temp.IsSurgicalIntervention + "" == "1") { if (!string.IsNullOrEmpty(temp.SurgicalInterventionTreatment + "")) { textEdit9.Text = temp.SurgicalInterventionTreatment + ""; } if (!string.IsNullOrEmpty(temp.SurgicalInterventionTime + "")) { dateTimePicker6.Text = temp.SurgicalInterventionTime + ""; //dateTimePicker6.Text = temp.SurgicalInterventionTime + ""; } } } } } catch (Exception ex) { throw ex; } } public void SaveSurgery() { try { T_Service_Apoplexy_Community_SurgeryDTO surgeryDTO = new T_Service_Apoplexy_Community_SurgeryDTO(); surgeryDTO.PatientGUID = patientGUID; surgeryDTO.Flag = flag; if (string.IsNullOrEmpty(surgeryDTO.CreatorID + "")) { surgeryDTO.CreatorID = Information.User.ID; } if (radioGroup37.SelectedIndex > -1) surgeryDTO.IsCAS = radioGroup37.EditValue + ""; if (surgeryDTO.IsCAS == "1") { if (radioGroup38.SelectedIndex > -1) surgeryDTO.CASLocation = radioGroup38.EditValue + ""; surgeryDTO.CASTime = dateTimePicker1.Text + ""; } if (radioGroup40.SelectedIndex > -1) surgeryDTO.IsCEA = radioGroup40.EditValue + ""; if (surgeryDTO.IsCEA == "1") { if (radioGroup39.SelectedIndex > -1) surgeryDTO.CEALocation = radioGroup39.EditValue + ""; surgeryDTO.CEATime = dateTimePicker2.Text + ""; } if (radioGroup42.SelectedIndex > -1) { surgeryDTO.IsBypassSurgery = radioGroup42.EditValue + ""; surgeryDTO.BypassSurgeryTime = dateTimePicker3.Text + ""; } if (radioGroup41.SelectedIndex > -1) { surgeryDTO.IsPCI = radioGroup41.EditValue + ""; surgeryDTO.PCITime = dateTimePicker4.Text + ""; } if (radioGroup43.SelectedIndex > -1) { surgeryDTO.IsCABG = radioGroup43.EditValue + ""; surgeryDTO.CABGTime = dateTimePicker5.Text + ""; } if (radioGroup45.SelectedIndex > -1) surgeryDTO.IsSurgicalIntervention = radioGroup45.EditValue + ""; if (surgeryDTO.IsSurgicalIntervention == "1") { surgeryDTO.SurgicalInterventionTreatment = textEdit9.Text + ""; surgeryDTO.SurgicalInterventionTime = dateTimePicker6.Text + ""; } List surgeryDTOs = new List(); string Url = string.Format("api/service/T_Service_Apoplexy_Community/AddORUpdateSurgery"); ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); surgeryDTOs.Add(surgeryDTO); //访问 ListEntity t = client.Post(Url, surgeryDTOs); if (t.Success) { if (!string.IsNullOrEmpty(t.DataString)) { if (t.DataString.Contains("Success")) { 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 radioGroup37_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup37.SelectedIndex == 1) { radioGroup38.Visible = true; labelControl64.Visible = true; dateTimePicker1.Visible = true; } else { radioGroup38.Visible = false; labelControl64.Visible = false; dateTimePicker1.Visible = false; } } private void radioGroup40_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup40.SelectedIndex == 1) { radioGroup39.Visible = true; labelControl65.Visible = true; dateTimePicker2.Visible = true; } else { radioGroup39.Visible = false; labelControl65.Visible = false; dateTimePicker2.Visible = false; } } private void radioGroup42_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup42.SelectedIndex == 1) { labelControl67.Visible = true; dateTimePicker3.Visible = true; } else { labelControl67.Visible = false; dateTimePicker3.Visible = false; } } private void radioGroup41_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup41.SelectedIndex == 1) { labelControl69.Visible = true; dateTimePicker4.Visible = true; } else { labelControl69.Visible = false; dateTimePicker4.Visible = false; } } private void radioGroup43_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup43.SelectedIndex == 1) { labelControl71.Visible = true; dateTimePicker5.Visible = true; } else { labelControl71.Visible = false; dateTimePicker5.Visible = false; } } private void radioGroup45_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup45.SelectedIndex == 1) { labelControl75.Visible = true; textEdit9.Visible = true; labelControl73.Visible = true; dateTimePicker6.Visible = true; } else { labelControl75.Visible = false; textEdit9.Visible = false; labelControl73.Visible = false; dateTimePicker6.Visible = false; } } } }