StableVersion4.3/HL_FristAidPlatform_Apoplexy/Screen/UserControl/UC_TCD.cs

107 lines
4.0 KiB
C#

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_TCD : UserControl
{
public string patientGuid;
public UC_TCD(string _patientGuid)
{
InitializeComponent();
patientGuid = _patientGuid;
}
private void UC_TCD_Load(object sender, EventArgs e)
{
TCDDTO dto = new TCDDTO();
string url = string.Format("api/service/T_Service_ApoplexyScreen/GetScreenTCD?patientGuid={0}", patientGuid);
dto = DBHelpClass.GetDateModel<TCDDTO>(url);
if (dto != null)
{
radio_IsTCD.EditValue = dto.IsTCD;
time_InspectionTime.TimeValue = dto.InspectionTime;
txt_InspectionUser.Text = dto.InspectionUser;
txt_InspectionInstitutionName.Text = dto.InspectionInstitutionName;
memo_UltrasoundFindings.Text = dto.UltrasoundFindings;
memo_UltrasoundReminder.Text = dto.UltrasoundReminder;
txt_ScreenName.Text = dto.ScreenName;
}
else {
txt_InspectionInstitutionName.Text = Information.Hospital.Name;
}
}
/// <summary>
/// 保存TCD经颅多普勒超声
/// </summary>
public void SaveScreenTCD()
{
try
{
TCDDTO dto = new TCDDTO();
List<TCDDTO> list = new List<TCDDTO>();
dto.PatientGUID = patientGuid;
dto.ScreenName = txt_ScreenName.Text;
dto.IsTCD = radio_IsTCD.SelectedIndex > -1 ? radio_IsTCD.EditValue.ToString() : "";
dto.InspectionTime = time_InspectionTime.TimeValue.ToString() != "" ? Convert.ToDateTime(time_InspectionTime.TimeValue).ToString("yyyy-MM-dd") : "";
dto.InspectionUser = txt_InspectionUser.Text.Trim();
dto.InspectionInstitutionName = txt_InspectionInstitutionName.Text;
dto.UltrasoundFindings = memo_UltrasoundFindings.Text.Trim();
dto.UltrasoundReminder = memo_UltrasoundReminder.Text.Trim();
dto.ScreenName = txt_ScreenName.Text;
list.Add(dto);
string Url = "api/service/T_Service_ApoplexyScreen/SaveScreenTCD";
//初始化两个工厂
ClientFactory<TCDDTO> httpClient = new HttpClientFactory<TCDDTO>();
Client<TCDDTO> client = httpClient.VisitFactory();
//访问
ListEntity<TCDDTO> 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("保存失败");
}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}