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.Drawing; using System.Windows.Forms; namespace HL_FristAidPlatform_CriticalPregnant { public partial class Form_Pregnant_Transport : XtraForm { string patientGUID; /// /// 文本框历史记录 /// private TextBoxRemind remind = null; public Form_Pregnant_Transport(string _patientGUID = "") { InitializeComponent(); patientGUID = _patientGUID; remind = new TextBoxRemind(); InitTextBoxRemind(); } private void simpleButton2_Click(object sender, System.EventArgs e) { SaveTransport(); } public void SaveTransport() { try { T_Service_CriticalPregnant_TransportDTO transportDTO= new T_Service_CriticalPregnant_TransportDTO(); List list = new List(); transportDTO.Diagnose = memoEdit1.Text + ""; transportDTO.Treatmentprocess = memoEdit2.Text + ""; transportDTO.Systolicpressure = textEdit3.Text + ""; transportDTO.Diastolicpressure = textEdit4.Text + ""; transportDTO.Respiratoryrate = textEdit5.Text + ""; transportDTO.Pulse = textEdit6.Text + ""; transportDTO.Temperature = textEdit7.Text + ""; transportDTO.Fetalheartrate = textEdit8.Text + ""; transportDTO.Fetalcondition = radioGroup1.EditValue + ""; transportDTO.Uterinecontraction = memoEdit3.Text + ""; transportDTO.Antepartumhemorrhage = radioGroup2.EditValue + ""; if ((radioGroup2.EditValue + "") == "1") { transportDTO.Bleedingvolume = textEdit10.Text + ""; } transportDTO.Experiencedlaborprocess = memoEdit4.Text + ""; transportDTO.Reasonforreferral = memoEdit5.Text + ""; transportDTO.Transferoutofhospital = Information.Hospital.Name + ""; transportDTO.Transferouttime = timeControl1.TimeValue + ""; transportDTO.Referraldoctor = textBox1.Text + ""; transportDTO.Escortservices = textBox2.Text + ""; transportDTO.PatientGUID = patientGUID; transportDTO.CreatorID = Information.User.ID; list.Add(transportDTO); string Url = "api/service/T_Service_CriticalPregnant_Transport/AddORUpdateTransport"; //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); //访问 ListEntity t = client.Post(Url, list); 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) { throw ex; } } private void Form_Pregnant_Transport_Load(object sender, System.EventArgs e) { try { labelControl42.Text = Information.Hospital.Name + ""; string url = string.Format("api/service/T_Service_CriticalPregnant_Transport/GetByPatientGUID?PatientGuid={0}", patientGUID); T_Service_CriticalPregnant_TransportDTO transportDTO = DBHelpClass.GetDateModel(url); if (transportDTO != null) { labelControl1.Text = transportDTO.Name + ""; labelControl2.Text = transportDTO.Age + ""; labelControl4.Text = transportDTO.Nation + ""; labelControl6.Text = transportDTO.Education + ""; labelControl9.Text = transportDTO.Attack_Address + ""; labelControl11.Text = transportDTO.MobilePhone + ""; labelControl13.Text = transportDTO.Pathography + ""; memoEdit1.Text = transportDTO.Diagnose + ""; memoEdit2.Text = transportDTO.Treatmentprocess + ""; textEdit3.Text = transportDTO.Systolicpressure + ""; textEdit4.Text = transportDTO.Diastolicpressure + ""; textEdit5.Text = transportDTO.Respiratoryrate + ""; textEdit6.Text = transportDTO.Pulse + ""; textEdit7.Text = transportDTO.Temperature + ""; textEdit8.Text = transportDTO.Fetalheartrate + ""; if (!string.IsNullOrEmpty(transportDTO.Fetalcondition + "")) { radioGroup1.EditValue = transportDTO.Fetalcondition + ""; } memoEdit3.Text = transportDTO.Uterinecontraction + ""; if (!string.IsNullOrEmpty(transportDTO.Antepartumhemorrhage + "")) { radioGroup2.EditValue = transportDTO.Antepartumhemorrhage + ""; } textEdit10.Text = transportDTO.Bleedingvolume + ""; memoEdit4.Text = transportDTO.Experiencedlaborprocess + ""; memoEdit5.Text = transportDTO.Reasonforreferral + ""; if(!string.IsNullOrEmpty(transportDTO.Transferoutofhospital+"")) labelControl42.Text = transportDTO.Transferoutofhospital + ""; timeControl1.TimeValue = transportDTO.Transferouttime + ""; textBox1.Text = transportDTO.Referraldoctor + ""; textBox2.Text = transportDTO.Escortservices + ""; } } catch (Exception ex) { throw ex; } } private void textEdit3_EditValueChanged(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(textEdit3.Text.Trim() + "")) { if (int.Parse(textEdit3.Text.Trim().ToString()) > 139 || int.Parse(textEdit3.Text.Trim().ToString()) < 90) { textEdit3.ForeColor = Color.Red; } else { textEdit3.ForeColor = Color.Black; } } } private void textEdit4_EditValueChanged(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(textEdit4.Text.Trim() + "")) { if (int.Parse(textEdit4.Text.Trim().ToString()) > 89 || int.Parse(textEdit4.Text.Trim().ToString()) < 60) { textEdit4.ForeColor = Color.Red; } else { textEdit4.ForeColor = Color.Black; } } } private void textEdit5_EditValueChanged(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(textEdit5.Text.Trim() + "")) { if (int.Parse(textEdit5.Text.Trim() + "") > 20 || int.Parse(textEdit5.Text.Trim() + "") < 18) { textEdit5.ForeColor = Color.Red; } else { textEdit5.ForeColor = Color.Black; } } } private void textEdit6_EditValueChanged(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(textEdit6.Text.Trim() + "")) { if (int.Parse(textEdit6.Text.Trim() + "") > 100 || int.Parse(textEdit6.Text.Trim() + "") < 60) { textEdit6.ForeColor = Color.Red; } else { textEdit6.ForeColor = Color.Black; } } } private void textEdit7_EditValueChanged(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(textEdit7.Text.Trim() + "")) { if (double.Parse(textEdit7.Text.Trim() + "") > 37 || double.Parse(textEdit7.Text.Trim() + "") < 36) { textEdit7.ForeColor = Color.Red; } else { textEdit7.ForeColor = Color.Black; } } } private void textEdit8_EditValueChanged(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(textEdit8.Text.Trim() + "")) { if (int.Parse(textEdit8.Text.Trim() + "") > 160 || int.Parse(textEdit8.Text.Trim() + "") < 110) { textEdit8.ForeColor = Color.Red; } else { textEdit8.ForeColor = Color.Black; } } } private void radioGroup2_SelectedIndexChanged(object sender, System.EventArgs e) { if (radioGroup2.SelectedIndex == 0) { labelControl25.Visible = false; labelControl26.Visible = false; textEdit10.Visible = false; } else { labelControl25.Visible = true; labelControl26.Visible = true; textEdit10.Visible = true; } } private void InitTextBoxRemind() { textBox1.Leave += textBox_TextChanged; textBox2.Leave += textBox_TextChanged; remind.InitAutoCompleteCustomSource(textBox1); remind.InitAutoCompleteCustomSource(textBox2); } private void textBox_TextChanged(object sender, EventArgs e) { string text = ((TextBox)sender).Text.Trim(); if (text != "") { remind.Remind(text); InitTextBoxRemind(); } } } }