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

497 lines
23 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_MedicalHistory : UserControl
{
public string patientGuid;
public UC_MedicalHistory(string _patientGuid)
{
InitializeComponent();
patientGuid = _patientGuid;
}
private void UC_MedicalHistory_Load(object sender, EventArgs e)
{
GetScreenPastHistory();
}
/// <summary>
/// 获取既往病史及控制情况
/// </summary>
public void GetScreenPastHistory()
{
ScreenPastHistoryDTO dto = new ScreenPastHistoryDTO();
string url = string.Format("api/service/T_Service_ApoplexyScreen/GetScreenPastHistory?patientGuid={0}", patientGuid);
dto = DBHelpClass.GetDateModel<ScreenPastHistoryDTO>(url);
if (dto != null)
{
txt_PastHistoryScreener.Text = dto.Screener;
radio_Cerebrovascular.EditValue = dto.Cerebrovascular;
if (dto.Cerebrovascular == "1")
{
if (!string.IsNullOrEmpty(dto.CerebrovascularType))
PublicClass.SetItemChecked(check_CerebrovascularType, dto.CerebrovascularType, ';');
txt_AttackCount.Text = dto.AttackCount;
txt_FirstAttackTime.Text = dto.FirstAttackTime;
radio_FirstMechanismLevel.EditValue = dto.FirstMechanismLevel;
radio_FirstDiagnose.EditValue = dto.FirstDiagnose;
radio_FirstInHospitalRecure.EditValue = dto.FirstInHospitalRecure;
radio_FirstOutHospitalRecure.EditValue = dto.FirstOutHospitalRecure;
radio_FirstMedicalRecord.EditValue = dto.FirstMedicalRecord;
txt_LastAttackTime.Text = dto.LastAttackTime;
radio_LastMechanismLevel.EditValue = dto.LastMechanismLevel;
radio_LastDiagnose.EditValue = dto.LastDiagnose;
radio_LastInHospitalRecure.EditValue = dto.LastInHospitalRecure;
radio_LastOutHospitalRecure.EditValue = dto.LastOutHospitalRecure;
radio_LastMedicalRecord.EditValue = dto.LastMedicalRecord;
}
time_EstimateTime.TimeValue = SetTimeValue(dto.EstimateTime);
txt_EstimateName.Text = dto.EstimateName;
txt_EstimateScore.Text = dto.EstimateScore;
radio_EstimateScore.EditValue = dto.EstimateScore;
radio_HeartDisease.EditValue = dto.HeartDisease;
if (dto.HeartDisease == "1")
{
if (!string.IsNullOrEmpty(dto.HeartDiseaseType))
PublicClass.SetItemChecked(check_HeartDiseaseType, dto.HeartDiseaseType, ';');
if (dto.HeartDiseaseType.Contains("1") && !string.IsNullOrEmpty(dto.CoronaryDiseaseDetail))
{
PublicClass.SetItemChecked(check_CoronaryDiseaseDetail, dto.CoronaryDiseaseDetail, ';');
txt_CDAttackCount.Text = dto.CDAttackCount;
txt_FirstCDDiagnosisTime.Text = dto.FirstCDDiagnosisTime;
radio_FirstCDMechanismLevel.EditValue = dto.FirstCDMechanismLevel;
txt_LastCDDiagnosisTime.Text = dto.LastCDDiagnosisTime;
radio_LastCDMechanismLevel.EditValue = dto.LastCDMechanismLevel;
txt_FirstAFDiagnosisTime.Text = dto.FirstAFDiagnosisTime;
}
if (dto.HeartDiseaseType.Contains("2") && !string.IsNullOrEmpty(dto.CoronaryDiseaseDetail))
radio_AtrialFibrillationDetail.EditValue = dto.AtrialFibrillationDetail;
if (dto.HeartDiseaseType.Contains("3"))
txt_HeartDiseaseOther.Text = dto.HeartDiseaseOther;
radio_Antithrombosis.EditValue = dto.Antithrombosis;
if (dto.Antithrombosis == "1")
{
if (!string.IsNullOrEmpty(dto.AntithrombosisType))
PublicClass.SetItemChecked(check_AntithrombosisType, dto.AntithrombosisType, ';');
txt_MedicationYear.Text = dto.MedicationYear;
radio_Medication.EditValue = dto.Medication;
}
radio_BloodPressureFrequency.EditValue = dto.BloodPressureFrequency;
radio_SelfTest.EditValue = dto.SelfTest;
if (dto.SelfTest == "2")
txt_TestFrequency.Text = dto.TestFrequency;
radio_DiagnosedHypertension.EditValue = dto.DiagnosedHypertension;
if (dto.DiagnosedHypertension == "1")
txt_DiagnosedHypertensionTime.Text = dto.DiagnosedHypertensionTime;
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;
radio_BloodPressureControl.EditValue = dto.BloodPressureControl;
}
radio_BloodFatFrequency.EditValue = dto.BloodFatFrequency;
radio_DiagnosedBloodFat.EditValue = dto.DiagnosedBloodFat;
if (dto.DiagnosedBloodFat == "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_BloodSugarFrequency.EditValue = dto.BloodSugarFrequency;
radio_DiagnosesDiabetes.EditValue = dto.DiagnosesDiabetes;
if (dto.DiagnosesDiabetes == "1")
txt_DiagnosesDiabetesTime.Text = dto.DiagnosesDiabetesTime;
radio_HypoglycemicDrugs.EditValue = dto.HypoglycemicDrugs;
if (dto.HypoglycemicDrugs == "1" && !string.IsNullOrEmpty(dto.HypoglycemicDrugsType))
PublicClass.SetItemChecked(check_HypoglycemicDrugsType, dto.HypoglycemicDrugsType, ';');
radio_BloodGlucoseControl.EditValue = dto.BloodGlucoseControl;
}
}
}
/// <summary>
/// 保存既往病史及控制情况
/// </summary>
public void SaveScreenPastHistory()
{
try
{
string value = "";
string text = "";
ScreenPastHistoryDTO dto = new ScreenPastHistoryDTO();
List<ScreenPastHistoryDTO> list = new List<ScreenPastHistoryDTO>();
dto.Screener = txt_PastHistoryScreener.Text.Trim();
dto.PatientGUID = patientGuid;
//== 4.1 脑血管病史
dto.Cerebrovascular = GetEditValue(radio_Cerebrovascular);
if (dto.Cerebrovascular == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_CerebrovascularType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CerebrovascularType += ";" + value + ";";
dto.AttackCount = txt_AttackCount.Text.Trim();
dto.FirstAttackTime = txt_FirstAttackTime.Text.Trim();
dto.FirstMechanismLevel = GetEditValue(radio_FirstMechanismLevel);
dto.FirstDiagnose = GetEditValue(radio_FirstDiagnose);
dto.FirstInHospitalRecure = GetEditValue(radio_FirstInHospitalRecure);
dto.FirstOutHospitalRecure = GetEditValue(radio_FirstOutHospitalRecure);
dto.FirstMedicalRecord = GetEditValue(radio_FirstMedicalRecord);
dto.LastAttackTime = txt_LastAttackTime.Text.Trim();
dto.LastMechanismLevel = GetEditValue(radio_LastMechanismLevel);
dto.LastDiagnose = GetEditValue(radio_LastDiagnose);
dto.LastInHospitalRecure = GetEditValue(radio_LastInHospitalRecure);
dto.LastOutHospitalRecure = GetEditValue(radio_LastOutHospitalRecure);
dto.LastMedicalRecord = GetEditValue(radio_LastMedicalRecord);
}
//== MRS评分
dto.EstimateTime = GetTimeValue(time_EstimateTime);
dto.EstimateName = txt_EstimateName.Text.Trim();
dto.EstimateScore = txt_EstimateScore.Text.Trim();
//== 4.2 心脏病史
dto.HeartDisease = GetEditValue(radio_HeartDisease);
if (dto.HeartDisease == "1")
{
PublicClass.GetCheckedListBoxItemValues(check_HeartDiseaseType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.HeartDiseaseType += ";" + value + ";";
if (dto.HeartDiseaseType.Contains("1"))
{
PublicClass.GetCheckedListBoxItemValues(check_CoronaryDiseaseDetail, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.CoronaryDiseaseDetail += ";" + value + ";";
dto.CDAttackCount = txt_CDAttackCount.Text;
dto.FirstCDDiagnosisTime = txt_FirstCDDiagnosisTime.Text;
dto.FirstCDMechanismLevel = GetEditValue(radio_FirstCDMechanismLevel);
dto.LastCDDiagnosisTime = txt_LastCDDiagnosisTime.Text;
dto.LastCDMechanismLevel = GetEditValue(radio_LastCDMechanismLevel);
}
if (dto.HeartDiseaseType.Contains("2"))
{
dto.AtrialFibrillationDetail = GetEditValue(radio_AtrialFibrillationDetail);
dto.FirstAFDiagnosisTime = txt_FirstAFDiagnosisTime.Text;
}
if (dto.HeartDiseaseType.Contains("3"))
dto.HeartDiseaseOther = txt_HeartDiseaseOther.Text;
dto.Antithrombosis = GetEditValue(radio_Antithrombosis);
{
PublicClass.GetCheckedListBoxItemValues(check_AntithrombosisType, ";", out value, out text);
if (!string.IsNullOrEmpty(value))
dto.AntithrombosisType += ";" + value + ";";
dto.MedicationYear = txt_MedicationYear.Text;
dto.Medication = GetEditValue(radio_Medication);
}
}
//== 4.3 高血压
dto.BloodPressureFrequency = GetEditValue(radio_BloodPressureFrequency);
dto.SelfTest = GetEditValue(radio_SelfTest);
if (dto.SelfTest == "2")
dto.TestFrequency = txt_TestFrequency.Text;
dto.DiagnosedHypertension = GetEditValue(radio_DiagnosedHypertension);
if (dto.DiagnosedHypertension == "1")
dto.DiagnosedHypertensionTime = txt_DiagnosedHypertensionTime.Text;
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;
dto.BloodPressureControl = GetEditValue(radio_BloodPressureControl);
dto.HypotensorMedication = GetEditValue(radio_HypotensorMedication);
}
//== 4.4 血脂异常
dto.BloodFatFrequency = GetEditValue(radio_BloodFatFrequency);
dto.DiagnosedBloodFat = GetEditValue(radio_DiagnosedBloodFat);
if (dto.DiagnosedBloodFat == "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.BloodSugarFrequency = GetEditValue(radio_BloodSugarFrequency);
dto.DiagnosesDiabetes = GetEditValue(radio_DiagnosesDiabetes);
if (dto.DiagnosesDiabetes == "1")
dto.DiagnosesDiabetesTime = txt_DiagnosesDiabetesTime.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.BloodGlucoseControl = GetEditValue(radio_BloodGlucoseControl);
}
dto.CreateID = Information.User.ID;
list.Add(dto);
string Url = "api/service/T_Service_ApoplexyScreen/SaveScreenPastHistory";
//初始化两个工厂
ClientFactory<ScreenPastHistoryDTO> httpClient = new HttpClientFactory<ScreenPastHistoryDTO>();
Client<ScreenPastHistoryDTO> client = httpClient.VisitFactory();
//访问
ListEntity<ScreenPastHistoryDTO> 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);
GetScreenPastHistory();
}
}
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;
}
private void radio_Cerebrovascular_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_Cerebrovascular.SelectedIndex == 1)
{ panel_Cerebrovascular.Visible = true; }
else
{
panel_Cerebrovascular.Visible = false;
}
}
private void radio_HeartDisease_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_HeartDisease.SelectedIndex == 1)
{
check_HeartDiseaseType.Visible = true;
lbl_HeartDiseaseType.Visible = true;
}
else
{
check_HeartDiseaseType.Visible = false;
lbl_HeartDiseaseType.Visible = false;
for (int i = 0; i < check_HeartDiseaseType.Items.Count; i++)
{
if (check_HeartDiseaseType.Items[i].CheckState == CheckState.Checked)
check_HeartDiseaseType.Items[i].CheckState = CheckState.Unchecked;
}
}
}
private void check_HeartDiseaseType_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
string checkState = check_HeartDiseaseType.GetItemCheckState(0).ToString();
if (checkState == "Checked")
{ panel_CoronaryDiseaseContent.Visible = true; }
else { panel_CoronaryDiseaseContent.Visible = false; }
string checkState1 = check_HeartDiseaseType.GetItemCheckState(1).ToString();
if (checkState1 == "Checked")
{
panel_Antithrombosis.Visible = true;
panel_AtrialFibrillation.Visible = true;
panelControl1.Visible = true;
}
else
{
panel_Antithrombosis.Visible = false;
panel_AtrialFibrillation.Visible = false;
panelControl1.Visible = false;
radio_Antithrombosis.SelectedIndex = -1;
radio_AtrialFibrillationDetail.SelectedIndex = -1;
}
string checkState2 = check_HeartDiseaseType.GetItemCheckState(2).ToString();
if (checkState2 == "Checked")
{ panel_HeartDiseaseOther.Visible = true; }
else { panel_HeartDiseaseOther.Visible = false; }
}
private void radio_Antithrombosis_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_Antithrombosis.SelectedIndex == 1)
{
panel_AntithrombosisContent.Visible = true;
}
else
{
panel_AntithrombosisContent.Visible = false;
}
}
private void radio_SelfTest_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_SelfTest.SelectedIndex == 2) { txt_TestFrequency.Enabled = true; } else { txt_TestFrequency.Enabled = false; }
}
private void radio_EstimateScore_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_EstimateScore.SelectedIndex > -1) txt_EstimateScore.Text = radio_EstimateScore.SelectedIndex.ToString();
}
private void radio_DiagnosedBloodFat_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DiagnosedBloodFat.SelectedIndex == 1)
{
panelControl2.Visible = true;
}
else
{
panelControl2.Visible = false;
}
}
private void radio_DiagnosesDiabetes_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DiagnosesDiabetes.SelectedIndex == 1)
{
lbl_DiagnosesDiabetesTime.Visible = true;
txt_DiagnosesDiabetesTime.Visible = true;
lbl_DiagnosesDiabetesTime1.Visible = true;
}
else
{
lbl_DiagnosesDiabetesTime.Visible = false;
txt_DiagnosesDiabetesTime.Visible = false;
lbl_DiagnosesDiabetesTime1.Visible = false;
}
}
private void radio_HypoglycemicDrugs_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_HypoglycemicDrugs.SelectedIndex == 1)
{
check_HypoglycemicDrugsType.Visible = true;
}
else
{
check_HypoglycemicDrugsType.Visible = false;
}
}
private void radio_LipidDrugs_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_LipidDrugs.SelectedIndex == 1)
{
lbl_LipidDrugsType.Visible = true;
check_LipidDrugsType.Visible = true;
}
else
{
lbl_LipidDrugsType.Visible = false;
check_LipidDrugsType.Visible = false;
}
}
private void radio_DiagnosedHypertension_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_DiagnosedHypertension.SelectedIndex == 1)
{
panel_Hypotensor1.Visible = true;
}
else {
panel_Hypotensor1.Visible = false;
radio_Hypotensor.SelectedIndex = -1;
}
}
private void radio_Hypotensor_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_Hypotensor.SelectedIndex == 1) { panel_Hypotensor.Visible = true; } else { panel_Hypotensor.Visible = false;}
}
}
}