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

570 lines
26 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_IntervenePastHistory : UserControl
{
public string patientGuid;
public UC_IntervenePastHistory(string _patientGuid)
{
InitializeComponent();
patientGuid = _patientGuid;
}
private void UC_IntervenePastHistory_Load(object sender, EventArgs e)
{
GetIntervenePastHistory();
}
/// <summary>
/// 获取既往病史及控制情况
/// </summary>
public void GetIntervenePastHistory()
{
IntervenePastHistoryDTO dto = new IntervenePastHistoryDTO();
string url = string.Format("api/service/T_Service_ApoplexyScreen/GetIntervenePastHistory?patientGuid={0}", patientGuid);
dto = DBHelpClass.GetDateModel<IntervenePastHistoryDTO>(url);
if (dto != null)
{
txt_PastHistoryScreener.Text = dto.Screener;
radio_CerebrovascularHistory.EditValue = dto.CerebrovascularHistory;
if (dto.CerebrovascularHistory == "1")
{
if (!string.IsNullOrEmpty(dto.CerebrovascularType))
PublicClass.SetItemChecked(check_CerebrovascularType, dto.CerebrovascularType, ';');
txt_CerebrovascularTime.Text = dto.CerebrovascularTime;
}
radio_CerebrovascularNew.EditValue = dto.CerebrovascularNew;
if (dto.CerebrovascularNew == "1")
{
txt_AttackCount.Text = dto.AttackCount;
txt_FirstAttacktTime.Text = dto.FirstAttacktTime;
txt_CerebrovascularTime.Text = dto.CerebrovascularTime;
radio_CFirstMechanismLevel.EditValue = dto.CFirstMechanismLevel;
radio_CFirstDiagnose.EditValue = dto.CFirstDiagnose;
radio_CFirstMedicalRecord.EditValue = dto.CFirstMedicalRecord;
radio_CFirstInHospitalRecure.EditValue = dto.CFirstInHospitalRecure;
radio_CFirstOutHospitalRecure.EditValue = dto.CFirstOutHospitalRecure;
txt_SecondAttacktTime.Text = dto.SecondAttacktTime;
radio_CSecondMechanismLevel.EditValue = dto.CSecondMechanismLevel;
radio_CSecondDiagnose.EditValue = dto.CSecondDiagnose;
radio_CSecondInHospitalRecure.EditValue = dto.CSecondInHospitalRecure;
radio_CSecondOutHospitalRecure.EditValue = dto.CSecondOutHospitalRecure;
radio_CSecondMedicalRecord.EditValue = dto.CSecondMedicalRecord;
}
time_EstimateTime.TimeValue = SetTimeValue(dto.EstimateTime);
txt_EstimateName.Text = dto.EstimateName;
txt_EstimateScore.Text = dto.EstimateScore;
radio_EstimateScore.EditValue = dto.EstimateScore;
radio_HeartDiseaseHistory.EditValue = dto.HeartDiseaseHistory;
if (dto.HeartDiseaseHistory == "1")
radio_HeartDiseaseType.EditValue = dto.HeartDiseaseType;
radio_HeartDiseaseNew.EditValue = dto.HeartDiseaseNew;
if (dto.HeartDiseaseNew == "1")
{
if (!string.IsNullOrEmpty(dto.HeartDiseaseNewType))
PublicClass.SetItemChecked(check_HeartDiseaseNewType, dto.HeartDiseaseNewType, ';');
if (dto.HeartDiseaseNewType.Contains("1"))
{
if (!string.IsNullOrEmpty(dto.CoronaryDiseaseDetail))
PublicClass.SetItemChecked(check_CoronaryDiseaseDetail, dto.CoronaryDiseaseDetail, ';');
txt_CoronaryDiseaseTime.Text = dto.CoronaryDiseaseTime;
radio_FirstMechanismLevel.EditValue = dto.FirstMechanismLevel;
}
if (dto.HeartDiseaseNewType.Contains("2"))
{
if (!string.IsNullOrEmpty(dto.CoronaryDiseaseDetail))
radio_AtrialFibrillationDetail.EditValue = dto.AtrialFibrillationDetail;
txt_AtrialFibrillationTime.Text = dto.AtrialFibrillationTime;
}
if (dto.HeartDiseaseNewType.Contains("4"))
txt_HeartDiseaseNewOther.Text = dto.HeartDiseaseNewOther;
radio_AntithromboticDrug.EditValue = dto.AntithromboticDrug;
if (dto.AntithromboticDrug == "1")
{
if (!string.IsNullOrEmpty(dto.AntithromboticType))
PublicClass.SetItemChecked(check_AntithromboticType, dto.AntithromboticType, ';');
txt_AntithromboticMedicalYear.Text = dto.AntithromboticMedicalYear;
radio_AntithromboticMedication.EditValue = dto.AntithromboticMedication;
}
}
radio_DyslipidemiaHistory.EditValue = dto.DyslipidemiaHistory;
if (dto.DyslipidemiaHistory == "1")
txt_DyslipidemiaTime.Text = dto.DyslipidemiaTime;
radio_BloodFatFrequency.EditValue = dto.BloodFatFrequency;
radio_Dyslipidemia.EditValue = dto.Dyslipidemia;
if (dto.Dyslipidemia == "1")
{
txt_DiagnosedBloodFatTime.Text = dto.DiagnosedBloodFatTime;
if (!string.IsNullOrEmpty(dto.DyslipidemiaType))
PublicClass.SetItemChecked(check_DyslipidemiaType, dto.DyslipidemiaType, ';');
radio_LipidDrugs.EditValue = dto.LipidDrugs;
if (!string.IsNullOrEmpty(dto.LipidDrugsType))
PublicClass.SetItemChecked(check_LipidDrugsType, dto.LipidDrugsType, ';');
}
radio_DiabetesHistory.EditValue = dto.DiabetesHistory;
if (dto.DiabetesHistory == "1")
txt_FirstDiabetesTime.Text = dto.FirstDiabetesTime;
radio_DloodSugarFrequency.EditValue = dto.DloodSugarFrequency;
radio_DiabetesNew.EditValue = dto.DiabetesNew;
if (dto.DiabetesNew == "1")
{
txt_DiabetesTime.Text = dto.DiabetesTime;
radio_HypoglycemicDrugs.EditValue = dto.HypoglycemicDrugs;
if (dto.HypoglycemicDrugs == "1" && !string.IsNullOrEmpty(dto.HypoglycemicDrugsType))
PublicClass.SetItemChecked(check_HypoglycemicDrugsType, dto.HypoglycemicDrugsType, ';');
radio_HloodGlucoseControl.EditValue = dto.HloodGlucoseControl;
}
// 高血压
radio_BloodPressure.EditValue = dto.BloodPressure;
if (dto.BloodPressure == "1")
txt_BloodPressureTime.Text = dto.BloodPressureTime;
radio_BloodPressureFrequency.EditValue = dto.BloodPressureFrequency;
radio_SelfTest.EditValue = dto.SelfTest;
if (dto.SelfTest == "2")
txt_TestFrequency.Text = dto.TestFrequency;
radio_BloodPressureNew.EditValue = dto.BloodPressureNew;
if (dto.BloodPressureNew == "1")
{
txt_BloodPressureTimeNew.Text = dto.BloodPressureTimeNew;
radio_BloodPressureControl.EditValue = dto.BloodPressureControl;
radio_Hypotensor.EditValue = dto.Hypotensor;
if (dto.Hypotensor == "1")
{
if (!string.IsNullOrEmpty(dto.HypotensorType))
PublicClass.SetItemChecked(check_HypotensorType, dto.HypotensorType, ';');
radio_HypotensorMedication.EditValue = dto.HypotensorMedication;
txt_HypotensorMedicalYear.Text = dto.HypotensorMedicalYear;
}
}
}
}
/// <summary>
/// 保存既往病史及控制情况
/// </summary>
public void SaveIntervenePastHistory()
{
try
{
string value = "";
string text = "";
IntervenePastHistoryDTO dto = new IntervenePastHistoryDTO();
List<IntervenePastHistoryDTO> list = new List<IntervenePastHistoryDTO>();
dto.Screener = txt_PastHistoryScreener.Text.Trim();
dto.PatientGUID = patientGuid;
dto.CerebrovascularHistory = GetEditValue(radio_CerebrovascularHistory);
if (dto.CerebrovascularHistory == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_CerebrovascularType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CerebrovascularType += ";" + value + ";";
dto.CerebrovascularTime = txt_CerebrovascularTime.Text.Trim();
}
//== 4.1 脑血管病史
dto.CerebrovascularNew = GetEditValue(radio_CerebrovascularNew);
if (dto.CerebrovascularNew == "1")
{
dto.AttackCount = txt_AttackCount.Text.Trim();
dto.FirstAttacktTime = txt_FirstAttacktTime.Text.Trim();
dto.CFirstMechanismLevel = GetEditValue(radio_CFirstMechanismLevel);
dto.CFirstDiagnose = GetEditValue(radio_CFirstDiagnose);
dto.CFirstMedicalRecord = GetEditValue(radio_CFirstMedicalRecord);
dto.CFirstInHospitalRecure = GetEditValue(radio_CFirstInHospitalRecure);
dto.CFirstOutHospitalRecure = GetEditValue(radio_CFirstOutHospitalRecure);
dto.SecondAttacktTime = txt_SecondAttacktTime.Text.Trim();
dto.CSecondMechanismLevel = GetEditValue(radio_CSecondMechanismLevel);
dto.CSecondDiagnose = GetEditValue(radio_CSecondDiagnose);
dto.CSecondMedicalRecord = GetEditValue(radio_CSecondMedicalRecord);
dto.CSecondInHospitalRecure = GetEditValue(radio_CSecondInHospitalRecure);
dto.CSecondOutHospitalRecure = GetEditValue(radio_CSecondOutHospitalRecure);
}
//== MRS评分
dto.EstimateTime = GetTimeValue(time_EstimateTime);
dto.EstimateName = txt_EstimateName.Text.Trim();
dto.EstimateScore = GetEditValue(radio_EstimateScore);
//== 4.2 心脏病史
dto.HeartDiseaseHistory = GetEditValue(radio_HeartDiseaseHistory);
dto.HeartDiseaseType = GetEditValue(radio_HeartDiseaseType);
dto.HeartDiseaseNew = GetEditValue(radio_HeartDiseaseNew);
if (dto.HeartDiseaseNew.Contains("1"))
{
PublicClass.GetCheckedListBoxItemValues(check_HeartDiseaseNewType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.HeartDiseaseNewType += ";" + value + ";";
if (dto.HeartDiseaseNewType.Contains("1"))
{
PublicClass.GetCheckedListBoxItemValues(check_CoronaryDiseaseDetail, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CoronaryDiseaseDetail += ";" + value + ";";
dto.CoronaryDiseaseTime = txt_CoronaryDiseaseTime.Text;
dto.FirstMechanismLevel = GetEditValue(radio_FirstMechanismLevel);
}
if (dto.HeartDiseaseNew.Contains("2"))
{
dto.AtrialFibrillationDetail = GetEditValue(radio_AtrialFibrillationDetail);
}
if (dto.HeartDiseaseNew.Contains("3"))
dto.HeartDiseaseNewOther = txt_HeartDiseaseNewOther.Text;
dto.AntithromboticDrug = GetEditValue(radio_AntithromboticDrug);
if (dto.AntithromboticDrug == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_AntithromboticType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.AntithromboticType += ";" + value + ";";
dto.AntithromboticMedicalYear = txt_AntithromboticMedicalYear.Text;
dto.AntithromboticMedication = GetEditValue(radio_AntithromboticMedication);
}
}
//== 4.3 高血压
dto.BloodPressure = GetEditValue(radio_BloodPressure);
if (dto.BloodPressure == "1")
dto.BloodPressureTime = txt_BloodPressureTime.Text;
dto.BloodPressureFrequency = GetEditValue(radio_BloodPressureFrequency);
dto.SelfTest = GetEditValue(radio_SelfTest);
if (dto.SelfTest == "3")
dto.TestFrequency = txt_TestFrequency.Text;
dto.BloodPressureNew = GetEditValue(radio_BloodPressureNew);
if (dto.BloodPressureNew == "1")
{
dto.BloodPressureTimeNew = txt_BloodPressureTimeNew.Text;
dto.BloodPressureControl = GetEditValue(radio_BloodPressureControl);
dto.HypotensorMedication = GetEditValue(radio_HypotensorMedication);
dto.Hypotensor = GetEditValue(radio_Hypotensor);
if (dto.Hypotensor == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_HypotensorType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.HypotensorType += ";" + value + ";";
dto.HypotensorMedicalYear = txt_HypotensorMedicalYear.Text;
}
}
//=== 4.4 血脂异常
dto.DyslipidemiaHistory = GetEditValue(radio_DyslipidemiaHistory);
if (dto.DyslipidemiaHistory == "1")
dto.DyslipidemiaTime = txt_DyslipidemiaTime.Text;
dto.BloodFatFrequency = GetEditValue(radio_BloodFatFrequency);
dto.Dyslipidemia = GetEditValue(radio_Dyslipidemia);
if (dto.Dyslipidemia == "1")
{
dto.DiagnosedBloodFatTime = txt_DiagnosedBloodFatTime.Text;
PublicClass.GetCheckedListBoxItemValues(check_DyslipidemiaType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.DyslipidemiaType += ";" + value + ";";
dto.LipidDrugs = GetEditValue(radio_LipidDrugs);
if (dto.LipidDrugs == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_LipidDrugsType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.LipidDrugsType += ";" + value + ";";
}
}
//=== 4.5 糖尿病
dto.DiabetesHistory = GetEditValue(radio_DiabetesHistory);
if (dto.DiabetesHistory == "1")
dto.FirstDiabetesTime = txt_FirstDiabetesTime.Text;
dto.DloodSugarFrequency = GetEditValue(radio_DloodSugarFrequency);
dto.DiabetesNew = GetEditValue(radio_DiabetesNew);
if (dto.DiabetesNew == "1")
{
dto.DiabetesTime = txt_DiabetesTime.Text;
dto.HypoglycemicDrugs = GetEditValue(radio_HypoglycemicDrugs);
if (dto.HypoglycemicDrugs == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_HypoglycemicDrugsType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.HypoglycemicDrugsType += ";" + value + ";";
dto.HloodGlucoseControl = GetEditValue(radio_HloodGlucoseControl);
}
}
dto.CreateID = Information.User.ID;
list.Add(dto);
string Url = "api/service/T_Service_ApoplexyScreen/SaveIntervenePastHistory";
//初始化两个工厂
ClientFactory<IntervenePastHistoryDTO> httpClient = new HttpClientFactory<IntervenePastHistoryDTO>();
Client<IntervenePastHistoryDTO> client = httpClient.VisitFactory();
//访问
ListEntity<IntervenePastHistoryDTO> 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;
}
}
/// <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>
/// 设置组件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 && radio.EditValue.ToString() != null)
value = radio.EditValue.ToString();
return value;
}
private void radio_CerebrovascularHistory_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CerebrovascularHistory.SelectedIndex == 1)
{
panel_CerebrovascularHistory.Visible = true;
panel_CerebrovascularNew.Visible = true;
}
else
{
panel_CerebrovascularHistory.Visible = false;
panel_CerebrovascularNew.Visible = false;
panel_CerebrovascularNewDetail.Visible = false;
}
}
private void radio_CerebrovascularNew_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_CerebrovascularNew.SelectedIndex == 1)
panel_CerebrovascularNewDetail.Visible = true;
if (radio_CerebrovascularNew.SelectedIndex != 1)
panel_CerebrovascularNewDetail.Visible = false;
}
private void radio_HeartDiseaseHistory_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_HeartDiseaseHistory.SelectedIndex == 1)
panel_HeartDiseaseType.Visible = true;
if (radio_HeartDiseaseHistory.SelectedIndex != 1)
panel_HeartDiseaseType.Visible = false;
}
private void radio_HeartDiseaseNew_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_HeartDiseaseNew.SelectedIndex == 1)
{
panel_HeartDiseaseNewType.Visible = true;
}
else
{
panel_HeartDiseaseNewType.Visible = false;
panel_HeartDiseaseNewDetail.Visible = false;
panel_AtrialFibrillation.Visible = false;
panel_HeartDiseaseNewOther.Visible = false;
panel_Antithrombosis.Visible = false;
panel_AntithrombosisContent.Visible = false;
for (int i = 0; i < check_HeartDiseaseNewType.Items.Count; i++)
{
if (check_HeartDiseaseNewType.Items[i].CheckState == CheckState.Checked)
check_HeartDiseaseNewType.Items[i].CheckState = CheckState.Unchecked;
}
}
}
private void check_HeartDiseaseNewType_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
string checkState = check_HeartDiseaseNewType.GetItemCheckState(0).ToString();
if (checkState == "Checked")
{ panel_HeartDiseaseNewDetail.Visible = true; }
else { panel_HeartDiseaseNewDetail.Visible = false; }
string checkState1 = check_HeartDiseaseNewType.GetItemCheckState(1).ToString();
if (checkState1 == "Checked")
{ panel_AtrialFibrillation.Visible = true; }
else { panel_AtrialFibrillation.Visible = false; }
string checkState2 = check_HeartDiseaseNewType.GetItemCheckState(3).ToString();
if (checkState2 == "Checked")
{ panel_HeartDiseaseNewOther.Visible = true; }
else { panel_HeartDiseaseNewOther.Visible = false; }
}
private void radio_AntithromboticDrug_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_AntithromboticDrug.SelectedIndex == 1) panel_AntithrombosisContent.Visible = true;
if (radio_AntithromboticDrug.SelectedIndex != 1) panel_AntithrombosisContent.Visible = false;
}
private void radio_BloodPressure_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DyslipidemiaHistory.SelectedIndex == 1)
panel_DyslipidemiaTime.Visible = true;
if (radio_DyslipidemiaHistory.SelectedIndex != 1)
panel_DyslipidemiaTime.Visible = false;
}
private void radio_SelfTest_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_SelfTest.SelectedIndex == 2)
panel_TestFrequency.Visible = true;
if (radio_SelfTest.SelectedIndex != 2)
panel_TestFrequency.Visible = false;
}
private void radio_EstimateScore_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_EstimateScore.SelectedIndex > -1)
txt_EstimateScore.Text = radio_EstimateScore.EditValue.ToString();
}
private void radio_BloodPressureNew_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_BloodPressureNew.SelectedIndex == 1)
{
panel_DiagnosedHypertensionTime.Visible = true;
panel_BloodPressureDetail.Visible = true;
}
else
{
panel_DiagnosedHypertensionTime.Visible = false;
panel_BloodPressureDetail.Visible = false;
}
}
private void radio_Hypotensor_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_Hypotensor.SelectedIndex == 1)
panel_BloodPressureDetail2.Visible = true;
if (radio_Hypotensor.SelectedIndex != 1)
panel_BloodPressureDetail2.Visible = false;
}
private void radio_DyslipidemiaHistory_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DyslipidemiaHistory.SelectedIndex == 1)
panel_DyslipidemiaTime.Visible = true;
if (radio_DyslipidemiaHistory.SelectedIndex != 1)
panel_DyslipidemiaTime.Visible = false;
}
private void radio_Dyslipidemia_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_Dyslipidemia.SelectedIndex == 1)
panel_LipidDrugs.Visible = true;
if (radio_Dyslipidemia.SelectedIndex != 1)
panel_LipidDrugs.Visible = false;
}
private void radio_LipidDrugs_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_LipidDrugs.SelectedIndex == 1)
{
check_LipidDrugsType.Visible = true;
lbl_LipidDrugsType.Visible = true;
}
else
{
check_LipidDrugsType.Visible = false;
lbl_LipidDrugsType.Visible = false;
for (int i = 0; i < check_LipidDrugsType.Items.Count; i++)
{
if (check_LipidDrugsType.Items[i].CheckState == CheckState.Checked)
check_LipidDrugsType.Items[i].CheckState = CheckState.Unchecked;
}
}
}
private void radio_DiabetesHistory_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DyslipidemiaHistory.SelectedIndex == 1)
panel_FirstDiabetesTime.Visible = true;
if (radio_DyslipidemiaHistory.SelectedIndex != 1)
panel_FirstDiabetesTime.Visible = false;
}
private void radio_DiabetesNew_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DiabetesNew.SelectedIndex == 1)
panel_DiabetesNew.Visible = true;
if (radio_DiabetesNew.SelectedIndex != 1)
panel_DiabetesNew.Visible = false;
}
}
}