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

287 lines
14 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_Vascular : UserControl
{
public string patientGuid;
public string flag;
public UC_Vascular(string _patientGuid, string _flag)
{
InitializeComponent();
patientGuid = _patientGuid;
flag = _flag;
}
private void UC_Vascular_Load(object sender, EventArgs e)
{
GetScreenCervical();
}
/// <summary>
/// 获取颈部血管超声
/// </summary>
public void GetScreenCervical()
{
ScreenCervicalDTO dto = new ScreenCervicalDTO();
string url = string.Format("api/service/T_Service_ApoplexyScreen/GetScreenCervical?patientGuid={0}&flag={1}", patientGuid, flag);
dto = DBHelpClass.GetDateModel<ScreenCervicalDTO>(url);
if (dto != null)
{
radio_CervicalInspect.EditValue = dto.CervicalInspect;
time_InspectionTime.TimeValue = SetTimeValue(dto.InspectionTime);
txt_InspectionName.Text = dto.InspectionName;
txt_InspectionMechanism.Text = dto.InspectionMechanism;
radio_InspectionResult.EditValue = dto.InspectionResult;
txt_IMTJZL.SelectedIndex = string.IsNullOrEmpty(dto.IMTJZL) ? -1 : int.Parse(dto.IMTJZL);
txt_IMTJZR.SelectedIndex = string.IsNullOrEmpty(dto.IMTJZR) ? -1 : int.Parse(dto.IMTJZR);
radio_BKPatchesNumber.SelectedIndex = !string.IsNullOrEmpty(dto.BKPatchesNumber) ? int.Parse(dto.BKPatchesNumber) : -1;
txt_BKShapeJZL.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeJZL) ? -1 : int.Parse(dto.BKShapeJZL);
txt_BKShapeJZR.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeJZR) ? -1 : int.Parse(dto.BKShapeJZR);
txt_BKShapeDBL.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeDBL) ? -1 : int.Parse(dto.BKShapeDBL);
txt_BKShapeDBR.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeDBR) ? -1 : int.Parse(dto.BKShapeDBR);
txt_BKShapeJNL.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeJNL) ? -1 : int.Parse(dto.BKShapeJNL);
txt_BKShapeJNR.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeJNR) ? -1 : int.Parse(dto.BKShapeJNR);
txt_BKShapeSAL.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeSAL) ? -1 : int.Parse(dto.BKShapeSAL);
txt_BKShapeSAR.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeSAR) ? -1 : int.Parse(dto.BKShapeSAR);
txt_BKShapeVAL.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeVAL) ? -1 : int.Parse(dto.BKShapeVAL);
txt_BKShapeVAR.SelectedIndex = string.IsNullOrEmpty(dto.BKShapeVAR) ? -1 : int.Parse(dto.BKShapeVAR);
txt_BKUlcerJZL.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerJZL) ? -1 : int.Parse(dto.BKUlcerJZL);
txt_BKUlcerJZR.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerJZR) ? -1 : int.Parse(dto.BKUlcerJZR);
txt_BKUlcerDBL.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerDBL) ? -1 : int.Parse(dto.BKUlcerDBL);
txt_BKUlcerDBR.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerDBR) ? -1 : int.Parse(dto.BKUlcerDBR);
txt_BKUlcerJNL.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerJNL) ? -1 : int.Parse(dto.BKUlcerJNL);
txt_BKUlcerJNR.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerJNR) ? -1 : int.Parse(dto.BKUlcerJNR);
txt_BKUlcerSAL.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerSAL) ? -1 : int.Parse(dto.BKUlcerSAL);
txt_BKUlcerSAR.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerSAR) ? -1 : int.Parse(dto.BKUlcerSAR);
txt_BKUlcerVAL.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerVAL) ? -1 : int.Parse(dto.BKUlcerVAL);
txt_BKUlcerVAR.SelectedIndex = string.IsNullOrEmpty(dto.BKUlcerVAR) ? -1 : int.Parse(dto.BKUlcerVAR);
txt_BKEchoJZL.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoJZL) ? -1 : int.Parse(dto.BKEchoJZL) - 1;
txt_BKEchoJZR.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoJZR) ? -1 : int.Parse(dto.BKEchoJZR) - 1;
txt_BKEchoDBL.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoDBL) ? -1 : int.Parse(dto.BKEchoDBL) - 1;
txt_BKEchoDBR.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoDBR) ? -1 : int.Parse(dto.BKEchoDBR) - 1;
txt_BKEchoJNL.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoJNL) ? -1 : int.Parse(dto.BKEchoJNL) - 1;
txt_BKEchoJNR.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoJNR) ? -1 : int.Parse(dto.BKEchoJNR) - 1;
txt_BKEchoSAL.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoSAL) ? -1 : int.Parse(dto.BKEchoSAL) - 1;
txt_BKEchoSAR.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoSAR) ? -1 : int.Parse(dto.BKEchoSAR) - 1;
txt_BKEchoVAL.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoVAL) ? -1 : int.Parse(dto.BKEchoVAL) - 1;
txt_BKEchoVAR.SelectedIndex = string.IsNullOrEmpty(dto.BKEchoVAR) ? -1 : int.Parse(dto.BKEchoVAR) - 1;
txt_NarrowJZL.SelectedIndex = string.IsNullOrEmpty(dto.NarrowJZL) ? -1 : int.Parse(dto.NarrowJZL);
txt_NarrowJZR.SelectedIndex = string.IsNullOrEmpty(dto.NarrowJZR) ? -1 : int.Parse(dto.NarrowJZR);
txt_NarrowDBL.SelectedIndex = string.IsNullOrEmpty(dto.NarrowDBL) ? -1 : int.Parse(dto.NarrowDBL);
txt_NarrowDBR.SelectedIndex = string.IsNullOrEmpty(dto.NarrowDBR) ? -1 : int.Parse(dto.NarrowDBR);
txt_NarrowJNL.SelectedIndex = string.IsNullOrEmpty(dto.NarrowJNL) ? -1 : int.Parse(dto.NarrowJNL);
txt_NarrowJNR.SelectedIndex = string.IsNullOrEmpty(dto.NarrowJNR) ? -1 : int.Parse(dto.NarrowJNR);
txt_NarrowSAL.SelectedIndex = string.IsNullOrEmpty(dto.NarrowSAL) ? -1 : int.Parse(dto.NarrowSAL);
txt_NarrowSAR.SelectedIndex = string.IsNullOrEmpty(dto.NarrowSAR) ? -1 : int.Parse(dto.NarrowSAR);
txt_NarrowVAL.SelectedIndex = string.IsNullOrEmpty(dto.NarrowVAL) ? -1 : int.Parse(dto.NarrowVAL);
txt_NarrowVAR.SelectedIndex = string.IsNullOrEmpty(dto.NarrowVAR) ? -1 : int.Parse(dto.NarrowVAR);
}
else
{
txt_InspectionMechanism.Text = Information.Hospital.Name;
}
}
/// <summary>
/// 保存颈部血管超声
/// </summary>
public void SaveScreenCervical()
{
try
{
ScreenCervicalDTO dto = new ScreenCervicalDTO();
List<ScreenCervicalDTO> list = new List<ScreenCervicalDTO>();
dto.Flag = flag;
dto.PatientGUID = patientGuid;
dto.CervicalInspect = radio_CervicalInspect.SelectedIndex > -1 ? radio_CervicalInspect.EditValue.ToString() : "";
dto.InspectionTime = GetTimeValue(time_InspectionTime);
dto.InspectionName = txt_InspectionName.Text;
dto.InspectionMechanism = txt_InspectionMechanism.Text;
dto.InspectionResult = GetEditValue(radio_InspectionResult);
dto.IMTJZL = GetValue(txt_IMTJZL);
dto.IMTJZR = GetValue(txt_IMTJZR);
dto.BKPatchesNumber = GetEditValue(radio_BKPatchesNumber);
dto.BKShapeJZL = GetValue(txt_BKShapeJZL);
dto.BKShapeJZR = GetValue(txt_BKShapeJZR);
dto.BKShapeDBL = GetValue(txt_BKShapeDBL);
dto.BKShapeDBR = GetValue(txt_BKShapeDBR);
dto.BKShapeJNL = GetValue(txt_BKShapeJNL);
dto.BKShapeJNR = GetValue(txt_BKShapeJNR);
dto.BKShapeSAL = GetValue(txt_BKShapeSAL);
dto.BKShapeSAR = GetValue(txt_BKShapeSAR);
dto.BKShapeVAL = GetValue(txt_BKShapeVAL);
dto.BKShapeVAR = GetValue(txt_BKShapeVAR);
dto.BKUlcerJZL = GetValue(txt_BKUlcerJZL);
dto.BKUlcerJZR = GetValue(txt_BKUlcerJZR);
dto.BKUlcerDBL = GetValue(txt_BKUlcerDBL);
dto.BKUlcerDBR = GetValue(txt_BKUlcerDBR);
dto.BKUlcerJNL = GetValue(txt_BKUlcerJNL);
dto.BKUlcerJNR = GetValue(txt_BKUlcerJNR);
dto.BKUlcerSAL = GetValue(txt_BKUlcerSAL);
dto.BKUlcerSAR = GetValue(txt_BKUlcerSAR);
dto.BKUlcerVAL = GetValue(txt_BKUlcerVAL);
dto.BKUlcerVAR = GetValue(txt_BKUlcerVAR);
dto.BKEchoJZL = GetValue(txt_BKEchoJZL);
dto.BKEchoJZR = GetValue(txt_BKEchoJZR);
dto.BKEchoDBL = GetValue(txt_BKEchoDBL);
dto.BKEchoDBR = GetValue(txt_BKEchoDBR);
dto.BKEchoJNL = GetValue(txt_BKEchoJNL);
dto.BKEchoJNR = GetValue(txt_BKEchoJNR);
dto.BKEchoSAL = GetValue(txt_BKEchoSAL);
dto.BKEchoSAR = GetValue(txt_BKEchoSAR);
dto.BKEchoVAL = GetValue(txt_BKEchoVAL);
dto.BKEchoVAR = GetValue(txt_BKEchoVAR);
dto.NarrowJZL = GetValue(txt_NarrowJZL);
dto.NarrowJZR = GetValue(txt_NarrowJZR);
dto.NarrowDBL = GetValue(txt_NarrowDBL);
dto.NarrowDBR = GetValue(txt_NarrowDBR);
dto.NarrowJNL = GetValue(txt_NarrowJNL);
dto.NarrowJNR = GetValue(txt_NarrowJNR);
dto.NarrowSAL = GetValue(txt_NarrowSAL);
dto.NarrowSAR = GetValue(txt_NarrowSAR);
dto.NarrowVAL = GetValue(txt_NarrowVAL);
dto.NarrowVAR = GetValue(txt_NarrowVAR);
dto.CreateID = Information.User.ID;
list.Add(dto);
string Url = "api/service/T_Service_ApoplexyScreen/SaveScreenCervical";
//初始化两个工厂
ClientFactory<ScreenCervicalDTO> httpClient = new HttpClientFactory<ScreenCervicalDTO>();
Client<ScreenCervicalDTO> client = httpClient.VisitFactory();
//访问
ListEntity<ScreenCervicalDTO> 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);
GetScreenCervical();
}
}
else
{
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
XtraMessageBox.Show(msg1);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 设置组件TimeValue
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public string SetTimeValue(string time)
{
string value = "";
if (!string.IsNullOrEmpty(time))
value = time;
return value;
}
/// <summary>
/// 获取单选组件value
/// </summary>
/// <param name="radio"></param>
/// <returns></returns>
public string GetEditValue(RadioGroup radio)
{
string value = "";
if (radio.SelectedIndex > -1 && !string.IsNullOrEmpty(radio.EditValue.ToString()))
value = radio.EditValue.ToString();
return value;
}
/// <summary>
/// 获取时间组件value
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public string GetTimeValue(TimeControl time)
{
string value = "";
if (!string.IsNullOrEmpty(time.TimeValue))
value = Convert.ToDateTime(time.TimeValue).ToString("yyyy-MM-dd");
return value;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="combo"></param>
/// <returns></returns>
public string GetValue(ComboBoxEdit combo)
{
string result = "";
if (combo.Text == "否")
result = "0";
if (combo.Text == "是")
result = "1";
if (combo.Text == "规则")
result = "0";
if (combo.Text == "不规则")
result = "1";
if (combo.Text == "无")
result = "0";
if (combo.Text == "有")
result = "1";
if (combo.Text == "强回声")
result = "1";
if (combo.Text == "中等回声")
result = "2";
if (combo.Text == "低回声")
result = "3";
if (combo.Text == "混合回声")
result = "4";
if (combo.Text == "无狭窄")
result = "0";
if (combo.Text == "1-49%")
result = "1";
if (combo.Text == "50-69%")
result = "2";
if (combo.Text == "70-99%")
result = "3";
if (combo.Text == "闭塞")
result = "4";
return result;
}
private void tableLayoutPanel3_Paint(object sender, PaintEventArgs e)
{
}
}
}