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

472 lines
18 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_Operation : UserControl
{
public string patientGuid;
public string flag;
public UC_Operation(string _patientGuid, string _flag)
{
InitializeComponent();
patientGuid = _patientGuid;
flag = _flag;
}
private void UC_Operation_Load(object sender, EventArgs e)
{
GetScreenAngiopathy();
}
/// <summary>
/// 获取血管病变的外科手术或介入治疗情况
/// </summary>
public void GetScreenAngiopathy()
{
ScreenAngiopathyDTO dto = new ScreenAngiopathyDTO();
string url = string.Format("api/service/T_Service_ApoplexyScreen/GetScreenAngiopathy?patientGuid={0}&flag={1}", patientGuid, flag);
dto = DBHelpClass.GetDateModel<ScreenAngiopathyDTO>(url);
if (dto != null)
{
txt_AngiopathyScreenName.Text = dto.ScreenName;
radio_IsCAS.EditValue = dto.IsCAS;
radio_CASPosition.EditValue = dto.CASPosition;
txt_CASTime.Text = dto.CASTime;
txt_CASMechanism.Text = dto.CASMechanism;
radio_CASReviews.EditValue = dto.CASReviews;
if (!string.IsNullOrEmpty(dto.CASReviewsTime))
{
PublicClass.SetItemChecked(check_CASReviewsTime, dto.CASReviewsTime, ';');
PublicClass.SetItemChecked(check_CASReviewsType, dto.CASReviewsType, ';');
}
radio_CASNarrow.EditValue = dto.CASNarrow;
radio_CASIntervene.EditValue = dto.CASIntervene;
if (!string.IsNullOrEmpty(dto.CASTreatmentType))
PublicClass.SetItemChecked(check_CASTreatmentType, dto.CASTreatmentType, ';');
radio_IsCEA.EditValue = dto.IsCEA;
radio_CEAPosition.EditValue = dto.CEAPosition;
txt_CEATime.Text = dto.CEATime;
radio_CEAReviews.EditValue = dto.CEAReviews;
txt_CEAMechanism.Text = dto.CEAMechanism;
if (!string.IsNullOrEmpty(dto.CEAReviewsTime))
PublicClass.SetItemChecked(check_CEAReviewsTime, dto.CEAReviewsTime, ';');
if (!string.IsNullOrEmpty(dto.CEAReviewsType))
PublicClass.SetItemChecked(check_CEAReviewsType, dto.CEAReviewsType, ';');
radio_CEANarrow.EditValue = dto.CEANarrow;
radio_CEAIntervene.EditValue = dto.CEAIntervene;
if (!string.IsNullOrEmpty(dto.CEATreatmentType))
PublicClass.SetItemChecked(check_CEATreatmentType, dto.CEATreatmentType, ';');
radio_ECICBypass.EditValue = dto.ECICBypass;
txt_ECICBypassTime.Text = dto.ECICBypassTime;
radio_PCI.EditValue = dto.PCI;
txt_PCITime.Text = dto.PCITime;
radio_CABG.EditValue = dto.CABG;
txt_CABGTime.Text = dto.CABGTime;
radio_Hemorrhagic.EditValue = dto.Hemorrhagic;
txt_HemorrhagicType.Text = dto.HemorrhagicType;
txt_HemorrhagicTime.Text = dto.HemorrhagicTime;
}
}
/// <summary>
/// 保存血管病变的外科手术或介入治疗情况
/// </summary>
public void SaveScreenAngiopathy()
{
try
{
string value = "";
string text = "";
ScreenAngiopathyDTO dto = new ScreenAngiopathyDTO();
List<ScreenAngiopathyDTO> list = new List<ScreenAngiopathyDTO>();
dto.Flag = flag;
dto.PatientGUID = patientGuid;
dto.ScreenName = txt_AngiopathyScreenName.Text.Trim();
dto.IsCAS = GetEditValue(radio_IsCAS);
if (dto.IsCAS == "1")
{
dto.CASPosition = GetEditValue(radio_CASPosition);
dto.CASTime = txt_CASTime.Text.Trim();
dto.CASMechanism = txt_CASMechanism.Text.Trim();
dto.CASReviews = GetEditValue(radio_CASReviews);
if (dto.CASReviews == "1")
{
for (int i = 0; i < check_CASReviewsTime.Items.Count; i++)
{
if (check_CASReviewsTime.Items[i].CheckState == CheckState.Checked)
{
dto.CASReviewsTime += ";" + check_CASReviewsTime.GetItemValue(i);
}
}
if (!string.IsNullOrEmpty(dto.CASReviewsTime))
dto.CASReviewsTime += ";";
for (int i = 0; i < check_CASReviewsType.Items.Count; i++)
{
if (check_CASReviewsType.Items[i].CheckState == CheckState.Checked)
{
dto.CASReviewsType += ";" + check_CASReviewsType.GetItemValue(i);
}
}
if (!string.IsNullOrEmpty(dto.CASReviewsType))
dto.CASReviewsType += ";";
}
dto.CASNarrow = GetEditValue(radio_CASNarrow);
dto.CASIntervene = GetEditValue(radio_CASIntervene);
if (dto.CASIntervene == "1")
{
for (int i = 0; i < check_CASTreatmentType.Items.Count; i++)
{
if (check_CASTreatmentType.Items[i].CheckState == CheckState.Checked)
{
dto.CASTreatmentType += ";" + check_CASTreatmentType.GetItemValue(i);
}
}
if (!string.IsNullOrEmpty(dto.CASTreatmentType))
dto.CASTreatmentType += ";";
}
}
dto.IsCEA = GetEditValue(radio_IsCEA);
if (dto.IsCEA == "1")
{
dto.CEAPosition = GetEditValue(radio_CEAPosition);
dto.CEATime = txt_CEATime.Text.Trim();
dto.CEAMechanism = txt_CEAMechanism.Text.Trim();
dto.CEAReviews = GetEditValue(radio_CEAReviews);
if (dto.CEAReviews == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_CEAReviewsTime, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CEAReviewsTime = ";" + value + ";";
PublicClass.GetCheckedListBoxItemValues(check_CEAReviewsType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CEAReviewsType = ";" + value + ";";
}
dto.CEANarrow = GetEditValue(radio_CEANarrow);
dto.CEAIntervene = GetEditValue(radio_CEAIntervene);
if (dto.CEAIntervene == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_CEATreatmentType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CEATreatmentType += ";" + value + ";";
}
}
dto.ECICBypass = GetEditValue(radio_ECICBypass);
if (dto.ECICBypass == "1")
dto.ECICBypassTime = txt_ECICBypassTime.Text;
dto.PCI = GetEditValue(radio_PCI);
if (dto.PCI == "1")
dto.PCITime = txt_PCITime.Text.Trim();
dto.CABG = GetEditValue(radio_CABG);
if (dto.CABG == "1")
dto.CABGTime = txt_CABGTime.Text.Trim();
dto.Hemorrhagic = GetEditValue(radio_Hemorrhagic);
if (dto.Hemorrhagic == "1")
{
dto.HemorrhagicType = txt_HemorrhagicType.Text.Trim();
dto.HemorrhagicTime = txt_HemorrhagicTime.Text.Trim();
}
dto.CreateID = Information.User.ID;
list.Add(dto);
string Url = "api/service/T_Service_ApoplexyScreen/SaveScreenAngiopathy";
//初始化两个工厂
ClientFactory<ScreenAngiopathyDTO> httpClient = new HttpClientFactory<ScreenAngiopathyDTO>();
Client<ScreenAngiopathyDTO> client = httpClient.VisitFactory();
//访问
ListEntity<ScreenAngiopathyDTO> 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);
GetScreenAngiopathy();
}
}
else
{
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
XtraMessageBox.Show(msg1);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取单选组件value
/// </summary>
/// <param name="radio"></param>
/// <returns></returns>
public string GetEditValue(RadioGroup radio)
{
string value = "";
if (radio.SelectedIndex > -1 && radio.EditValue.ToString() != null)
value = radio.EditValue.ToString();
return value;
}
/// <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="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 radio_IsCAS_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_IsCAS.SelectedIndex == 1)
{
panel_CAS1.Visible = true;
}
else
{
panel_CAS1.Visible = false;
radio_CASReviews.SelectedIndex = -1;
radio_CASNarrow.SelectedIndex = -1;
}
}
private void radio_CASReviews_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CASReviews.SelectedIndex == 1) { panel_CAS2.Visible = true; } else { panel_CAS2.Visible = false; }
}
private void radio_CASNarrow_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CASNarrow.SelectedIndex == 1)
{ panel_CAS4.Visible = true; } else { panel_CAS4.Visible = false; }
}
private void radio_IsCEA_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_IsCEA.SelectedIndex == 1)
{
panel_CEA1.Visible = true;
if (radio_CEAReviews.SelectedIndex == 1)
{
panel_CEA4.Visible = true;
if (radio_CEANarrow.SelectedIndex == 1)
{
panel_CEA2.Visible = true;
}
}
}
else
{
panel_CEA1.Visible = false;
panel_CEA4.Visible = false;
panel_CEA2.Visible = false;
radio_CEAReviews.SelectedIndex = -1;
radio_CEANarrow.SelectedIndex = -1;
}
}
private void radio_CEAReviews_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CEAReviews.SelectedIndex == 1)
{
panel_CEA2.Visible = true;
if (radio_CEANarrow.SelectedIndex == 1)
{
panel_CEA4.Visible = true;
}
}
else
{
panel_CEA2.Visible = false;
panel_CEA4.Visible = false;
}
}
private void radio_CEANarrow_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CEANarrow.SelectedIndex == 1)
{
panel_CEA4.Visible = true;
}
else
{
panel_CEA4.Visible = false;
}
}
private void radio_CASIntervene_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CASIntervene.SelectedIndex == 1)
{
lbl_CASTreatmentType.Visible = true;
check_CASTreatmentType.Visible = true;
}
else
{
lbl_CASTreatmentType.Visible = true;
check_CASTreatmentType.Visible = true;
}
}
private void radio_CEAIntervene_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CEAIntervene.SelectedIndex == 1)
{
lbl_CEATreatmentType.Visible = true;
check_CEATreatmentType.Visible = true;
}
else
{
lbl_CEATreatmentType.Visible = false;
check_CEATreatmentType.Visible = false;
}
}
private void radio_ECICBypass_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_ECICBypass.SelectedIndex == 1)
{
panel_ECICBypassTime.Visible = true;
}
else
{
panel_ECICBypassTime.Visible = true;
}
}
private void radio_PCI_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_PCI.SelectedIndex == 1)
{
lbl_PCITime.Visible = true;
txt_PCITime.Visible = true;
lbl_PCITime1.Visible = true;
}
else
{
lbl_PCITime.Visible = false;
txt_PCITime.Visible = false;
lbl_PCITime1.Visible = false;
}
}
private void radio_CABG_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CABG.SelectedIndex == 1)
{
lbl_CABGTime.Visible = true;
txt_CABGTime.Visible = true;
lbl_CABGTime1.Visible = true;
}
else
{
lbl_CABGTime.Visible = false;
txt_CABGTime.Visible = false;
lbl_CABGTime1.Visible = false;
}
}
private void radio_Hemorrhagic_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_Hemorrhagic.SelectedIndex == 1) { panel__HemorrhagicType.Visible = true; } else { panel__HemorrhagicType.Visible = false; }
}
}
}