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.Windows.Forms; namespace HL_FristAidPlatform_EmergencyTriage { public partial class Form_SpecialityCheckUpInfo : XtraForm { private string _patientGuid; private string guid; private string guid1; private string guid2; public Form_SpecialityCheckUpInfo(string patientGuid) { InitializeComponent(); _patientGuid = patientGuid; } private void Form_SpecialityCheckUpInfo_Load(object sender, EventArgs e) { QueryInfo(_patientGuid); } public void QueryInfo(string guid) { string url = string.Format("/api/service/T_Service_FirstAid_SpecialityCheckUp/GetSpecialityCheckUpInfo?guid={0}", _patientGuid); DataTable dt = DBHelpClass.GetDataRow(url); if (dt != null) { if (dt.Rows.Count > 0) { guid1 = dt.Rows[0]["GUID"].ToString(); #region 专科检查 radioGroup_BrainType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["BrainType"], -1); memo_BrainInjury.Text = dt.Rows[0]["BranInjury"].ToString(); radioGroup_MaxillofacialType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["MaxillofacialType"], -1); memo_MaxillofacialInjury.Text = dt.Rows[0]["MaxillofacialInjury"].ToString(); radioGroup_ChestType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["ChestType"], -1); memo_ChestInjury.Text = dt.Rows[0]["ChestInjury"].ToString(); radioGroup_AbdomenType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["AbdomenType"], -1); memo_AbdomenInjury.Text = dt.Rows[0]["AbdomenInjury"].ToString(); radioGroup_BackType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["BackType"], -1); memo_BackInjury.Text = dt.Rows[0]["BackInjury"].ToString(); radioGroup_SpineType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["SpineType"], -1); memo_SpineInjury.Text = dt.Rows[0]["SpineInjury"].ToString(); radioGroup_limbType.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["limbType"], -1); memo_limbInjury.Text = dt.Rows[0]["limbInjury"].ToString(); #endregion } } } public void SaveSpecialityCheckUpInfo() { try { SpecialityCheckUpDTO dto = new SpecialityCheckUpDTO(); List list = new List(); dto.PatientGUID = _patientGuid; dto.SpecialityCheckUp = new SpecialityCheckUp(); dto.SpecialityCheckUp.GUID = guid1; dto.SpecialityCheckUp.PatientGUID = _patientGuid; #region 4.专科检查 dto.SpecialityCheckUp.BrainType = radioGroup_BrainType.SelectedIndex; dto.SpecialityCheckUp.BranInjury = memo_BrainInjury.Text.ToString(); dto.SpecialityCheckUp.MaxillofacialType = radioGroup_MaxillofacialType.SelectedIndex; dto.SpecialityCheckUp.MaxillofacialInjury = memo_MaxillofacialInjury.Text.ToString(); dto.SpecialityCheckUp.ChestType = radioGroup_ChestType.SelectedIndex; dto.SpecialityCheckUp.ChestInjury = memo_ChestInjury.Text.ToString(); dto.SpecialityCheckUp.AbdomenType = radioGroup_AbdomenType.SelectedIndex; dto.SpecialityCheckUp.AbdomenInjury = memo_AbdomenInjury.Text.ToString(); dto.SpecialityCheckUp.BackType = radioGroup_BackType.SelectedIndex; dto.SpecialityCheckUp.BackInjury = memo_BackInjury.Text.ToString(); dto.SpecialityCheckUp.SpineType = radioGroup_SpineType.SelectedIndex; dto.SpecialityCheckUp.SpineInjury = memo_SpineInjury.Text.ToString(); dto.SpecialityCheckUp.limbType = radioGroup_limbType.SelectedIndex; dto.SpecialityCheckUp.limbInjury = memo_limbInjury.Text.ToString(); #endregion list.Add(dto); string Url = string.Empty; Url = "api/service/T_Service_FirstAid_SpecialityCheckUp/UpdateOrInsert"; //初始化两个工厂 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) { throw; } } private void simpleButton1_Click(object sender, EventArgs e) { SpecialityCheckUpDTO dto = new SpecialityCheckUpDTO(); List list = new List(); dto.PatientGUID = _patientGuid; dto.SpecialityCheckUp = new SpecialityCheckUp(); dto.SpecialityCheckUp.GUID = guid1; dto.SpecialityCheckUp.PatientGUID = _patientGuid; #region 4.专科检查 dto.SpecialityCheckUp.BrainType = radioGroup_BrainType.SelectedIndex; dto.SpecialityCheckUp.BranInjury = memo_BrainInjury.Text.ToString(); dto.SpecialityCheckUp.MaxillofacialType = radioGroup_MaxillofacialType.SelectedIndex; dto.SpecialityCheckUp.MaxillofacialInjury = memo_MaxillofacialInjury.Text.ToString(); dto.SpecialityCheckUp.ChestType = radioGroup_ChestType.SelectedIndex; dto.SpecialityCheckUp.ChestInjury = memo_ChestInjury.Text.ToString(); dto.SpecialityCheckUp.AbdomenType = radioGroup_AbdomenType.SelectedIndex; dto.SpecialityCheckUp.AbdomenInjury = memo_AbdomenInjury.Text.ToString(); dto.SpecialityCheckUp.BackType = radioGroup_BackType.SelectedIndex; dto.SpecialityCheckUp.BackInjury = memo_BackInjury.Text.ToString(); dto.SpecialityCheckUp.SpineType = radioGroup_SpineType.SelectedIndex; dto.SpecialityCheckUp.SpineInjury = memo_SpineInjury.Text.ToString(); dto.SpecialityCheckUp.limbType = radioGroup_limbType.SelectedIndex; dto.SpecialityCheckUp.limbInjury = memo_limbInjury.Text.ToString(); #endregion list.Add(dto); string Url = string.Empty; Url = "api/service/T_Service_FirstAid_SpecialityCheckUp/UpdateOrInsert"; //初始化两个工厂 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("保存失败"); } } private void panel1_Paint(object sender, PaintEventArgs e) { } } }