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 UC_Proposal : UserControl { public string patientGuid; public UC_Proposal(string _patientGuid) { InitializeComponent(); patientGuid = _patientGuid; } private void UC_Proposal_Load(object sender, EventArgs e) { GetScreenPropsal(); } public void GetScreenPropsal() { ProposalDTO dto = new ProposalDTO(); string url = string.Format("api/service/T_Service_ApoplexyScreen/GetScreenProposal?patientGuid={0}", patientGuid); dto = DBHelpClass.GetDateModel(url); if (dto != null) { radio_IsHospitalized.EditValue = dto.IsHospitalized; if (!string.IsNullOrEmpty(dto.Proposal)) { if (dto.Proposal.Contains("1")) ck_Proposal1.Checked = true; if (dto.Proposal.Contains("2")) ck_Proposal2.Checked = true; if (dto.Proposal.Contains("3")) ck_Proposal3.Checked = true; if (dto.Proposal.Contains("4")) ck_Proposal4.Checked = true; } txt_Destination.Text = dto.Destination; txt_ScreenName.Text = dto.ScreenName; } } /// /// 保存指导治疗与建议 /// public void SaveScreenProposal() { try { ProposalDTO dto = new ProposalDTO(); List list = new List(); dto.PatientGUID = patientGuid; dto.ScreenName = txt_ScreenName.Text; if (ck_Proposal1.Checked == true) dto.Proposal = "1"; if (ck_Proposal2.Checked == true) dto.Proposal = "1,2"; if (ck_Proposal3.Checked == true) dto.Proposal = "1,2,3"; if (ck_Proposal4.Checked == true) dto.Proposal = "1,2,3,4"; dto.Destination = txt_Destination.Text; dto.IsHospitalized = radio_IsHospitalized.SelectedIndex > -1 ? radio_IsHospitalized.EditValue.ToString() : ""; dto.ScreenName = txt_ScreenName.Text; list.Add(dto); string Url = "api/service/T_Service_ApoplexyScreen/SaveScreenProposal"; //初始化两个工厂 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); GetScreenPropsal(); } } else { string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", ""); XtraMessageBox.Show(msg1); } } else { XtraMessageBox.Show("保存失败"); } } } catch (Exception ex) { throw ex; } } } }