StableVersion4.3/HL_FristAidPlatform_FollowUp/Form_FollowUpDetail_FollowU...

407 lines
17 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
namespace HL_FristAidPlatform_FollowUp
{
public partial class Form_FollowUpDetail_FollowUpHighRiskFactor : XtraForm
{
private string patientguid;
private string Guid;
public Form_FollowUpDetail_FollowUpHighRiskFactor(string Guid)
{
patientguid = Guid;
InitializeComponent();
}
private void Form_FollowUpDetail_FollowUpHighRiskFactor_Load(object sender, EventArgs e)
{
try
{
string Url = string.Format("api/service/T_Service_Apoplexy_FollowUpAndHealthInfo/GetByPatientGuid1?PatientGuid={0}", patientguid);
DataTable dt = DBHelpClass.Get(Url);
if (dt != null && dt.Rows.Count > 0)
{
string Treated = dt.Rows[0]["PastMedicalHistory"].ToString();
string[] getAry = Treated.Split(';');
//既往病史
for (int i = 1; i < getAry.Length - 1; i++)
{
if (Treated.Contains(getAry[i]))
{
for (int j = 0; j < checkedListBoxControl1.ItemCount; j++)
{
if (getAry[i].Equals(checkedListBoxControl1.Items[j].Value.ToString()))
{
checkedListBoxControl1.SetItemChecked(j, true);
}
}
}
if (Treated.Contains("08"))
{
label17.Visible = true;
text_PastMedicalHistoryOther.Visible = true;
text_PastMedicalHistoryOther.Text= dt.Rows[0]["PastMedicalHistoryOther"].ToString();
}
}
if (!string.IsNullOrEmpty(dt.Rows[0]["FamilyHistory"].ToString()))
{
radioGroup1.EditValue = int.Parse(dt.Rows[0]["FamilyHistory"].ToString());
}
//入院用药情况
string Treated1 = dt.Rows[0]["Medication"].ToString();
string[] getAry1 = Treated1.Split(';');
for (int i = 1; i < getAry1.Length - 1; i++)
{
if (Treated1.Contains(getAry1[i]))
{
for (int j = 0; j < checkedListBoxControl2.ItemCount; j++)
{
if (getAry1[i].Equals(checkedListBoxControl2.Items[j].Value.ToString()))
{
checkedListBoxControl2.SetItemChecked(j, true);
}
}
}
if (Treated1.Contains("05"))
{
label16.Visible = true;
text_MedicationOther.Visible = true;
text_MedicationOther.Text= dt.Rows[0]["MedicationOther"].ToString();
}
}
//if (!string.IsNullOrEmpty(dt.Rows[0]["MedicationOther"].ToString()))
//{
// radioGroup10.EditValue = dt.Rows[0]["MedicationOther"].ToInt();
//}
if (!string.IsNullOrEmpty(dt.Rows[0]["MedicationCompliance"].ToString()))
{
radioGroup2.EditValue =int.Parse( dt.Rows[0]["MedicationCompliance"].ToString());
}
if (!string.IsNullOrEmpty(dt.Rows[0]["AllergicHistory"].ToString()))
{
radioGroup3.EditValue = int.Parse(dt.Rows[0]["AllergicHistory"].ToString());
}
if (!string.IsNullOrEmpty(dt.Rows[0]["EatingHabits"].ToString()))
{
radioGroup4.EditValue = int.Parse(dt.Rows[0]["EatingHabits"].ToString());
}
if (!string.IsNullOrEmpty(dt.Rows[0]["Movement"].ToString()))
{
radioGroup5.EditValue = int.Parse(dt.Rows[0]["Movement"].ToString());
}
if (!string.IsNullOrEmpty(dt.Rows[0]["SmokingSituation"].ToString()))
{
radioGroup6.EditValue = int.Parse(dt.Rows[0]["SmokingSituation"].ToString());
}
textBox1.Text = dt.Rows[0]["SmokingNum"].ToString();
if (!string.IsNullOrEmpty(dt.Rows[0]["DrinkingSituation"].ToString()))
{
radioGroup7.EditValue = int.Parse(dt.Rows[0]["DrinkingSituation"].ToString());
}
textBox3.Text = dt.Rows[0]["DrinkingSituationDetail"].ToString();
textBox2.Text = dt.Rows[0]["Assessor"].ToString();
timeControl1.TimeValue = dt.Rows[0]["AssessorDate"].ToString();
Guid = dt.Rows[0]["Guid"].ToString();
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "卒中健康与随访高危因素评估页面数据绑定:\r\n" + ex);
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string Url = "api/service/T_Service_Apoplexy_FollowUpAndHealthInfo/UpdateNotNullColumns";
List<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> list = new List<T_Service_Apoplexy_FollowUpAndHealthInfoDTO>();
T_Service_Apoplexy_FollowUpAndHealthInfoDTO af = new T_Service_Apoplexy_FollowUpAndHealthInfoDTO();
#region 保存信息
String Treated = null;
for (int i = 0; i < checkedListBoxControl1.CheckedItems.Count; i++)
{
Treated += ";";
Treated += checkedListBoxControl1.CheckedItems[i].ToString();
if (i == checkedListBoxControl1.CheckedItems.Count - 1)
{
Treated += ";";
}
}
af.PastMedicalHistory = Treated;
if (radioGroup1.EditValue != null)
{
af.FamilyHistory = radioGroup1.EditValue.ToString();
}
String Treated1 = null;
for (int i = 0; i < checkedListBoxControl2.CheckedItems.Count; i++)
{
Treated1 += ";";
Treated1 += checkedListBoxControl2.CheckedItems[i].ToString();
if (i == checkedListBoxControl2.CheckedItems.Count - 1)
{
Treated1 += ";";
}
}
af.Medication = Treated1;
//if (radioGroup10.EditValue != null)
//{
// af.MedicationOther = radioGroup10.EditValue.ToString();
//}
if (radioGroup2.EditValue != null)
{
af.MedicationCompliance = radioGroup2.EditValue.ToString();
}
if (radioGroup3.EditValue != null)
{
af.AllergicHistory = radioGroup3.EditValue.ToString();
}
if (radioGroup4.EditValue != null)
{
af.EatingHabits = radioGroup4.EditValue.ToString();
}
if (radioGroup5.EditValue != null)
{
af.Movement = radioGroup5.EditValue.ToString();
}
if (radioGroup6.EditValue != null)
{
af.SmokingSituation = radioGroup6.EditValue.ToString();
}
if (radioGroup7.EditValue != null)
{
af.DrinkingSituation = radioGroup7.EditValue.ToString();
}
af.SmokingNum = textBox1.Text;
af.DrinkingSituationDetail = textBox3.Text;
af.Assessor = textBox2.Text;
if (!string.IsNullOrEmpty(timeControl1.TimeValue))
{
af.AssessorDate = Convert.ToDateTime(timeControl1.TimeValue);
}
af.PatientGuid = patientguid;
list.Add(af);
#endregion
ClientFactory<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> httpClient = new HttpClientFactory<T_Service_Apoplexy_FollowUpAndHealthInfoDTO>();
Client<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> client = httpClient.VisitFactory();
ListEntity<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> s = client.Post(Url, list);
if (s.Success)
{
MessageBox.Show("保存成功!");
}
else
{
MessageBox.Show("保存失败!");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "卒中健康与随访高危因素评估页面数据保存:\r\n" + ex);
}
}
//吸烟情况显示隐藏
private void radioGroup6_SelectedIndexChanged(object sender, EventArgs e)
{
string Muscle = PublicClass.ToString(radioGroup6.EditValue, "");
if (!string.IsNullOrEmpty(Muscle))
{
if (Muscle == "2")
{
label12.Visible = true;
textBox1.Visible = true;
label13.Visible = true;
}
else
{
label12.Visible = false;
textBox1.Visible = false;
label13.Visible = false;
}
}
}
//喝酒情况显示隐藏
private void radioGroup7_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioGroup7.SelectedIndex == 4)
{
label15.Visible = true;
textBox3.Visible = true;
label14.Visible = true;
}
else
{
label15.Visible = false;
textBox3.Visible = false;
label14.Visible = false;
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
string Url = "api/service/T_Service_Apoplexy_FollowUpAndHealthInfo/UpdateNotNullColumns";
List<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> list = new List<T_Service_Apoplexy_FollowUpAndHealthInfoDTO>();
T_Service_Apoplexy_FollowUpAndHealthInfoDTO af = new T_Service_Apoplexy_FollowUpAndHealthInfoDTO();
#region 保存信息
String Treated = null;
for (int i = 0; i < checkedListBoxControl1.CheckedItems.Count; i++)
{
Treated += ";";
Treated += checkedListBoxControl1.CheckedItems[i].ToString();
if (i == checkedListBoxControl1.CheckedItems.Count - 1)
{
Treated += ";";
}
}
af.PastMedicalHistory = Treated;
if (Treated.Contains("08"))
af.PastMedicalHistoryOther = text_PastMedicalHistoryOther.Text;
if (radioGroup1.EditValue != null)
{
af.FamilyHistory = radioGroup1.EditValue.ToString();
}
String Treated1 = null;
for (int i = 0; i < checkedListBoxControl2.CheckedItems.Count; i++)
{
Treated1 += ";";
Treated1 += checkedListBoxControl2.CheckedItems[i].ToString();
if (i == checkedListBoxControl2.CheckedItems.Count - 1)
{
Treated1 += ";";
}
}
if (!string.IsNullOrEmpty(Treated1)&& Treated1.Contains("05"))
af.MedicationOther = text_MedicationOther.Text;
af.Medication = Treated1;
//if (radioGroup10.EditValue != null)
//{
// af.MedicationOther = radioGroup10.EditValue.ToString();
//}
if (radioGroup2.EditValue != null)
{
af.MedicationCompliance = radioGroup2.EditValue.ToString();
}
if (radioGroup3.EditValue != null)
{
af.AllergicHistory = radioGroup3.EditValue.ToString();
}
if (radioGroup4.EditValue != null)
{
af.EatingHabits = radioGroup4.EditValue.ToString();
}
if (radioGroup5.EditValue != null)
{
af.Movement = radioGroup5.EditValue.ToString();
}
if (radioGroup6.EditValue != null)
{
af.SmokingSituation = radioGroup6.EditValue.ToString();
}
if (radioGroup7.EditValue != null)
{
af.DrinkingSituation = radioGroup7.EditValue.ToString();
}
af.SmokingNum = textBox1.Text;
af.DrinkingSituationDetail = textBox3.Text;
af.Assessor = textBox2.Text;
if (!string.IsNullOrEmpty(timeControl1.TimeValue))
{
af.AssessorDate = Convert.ToDateTime(timeControl1.TimeValue);
}
af.PatientGuid = patientguid;
list.Add(af);
#endregion
ClientFactory<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> httpClient = new HttpClientFactory<T_Service_Apoplexy_FollowUpAndHealthInfoDTO>();
Client<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> client = httpClient.VisitFactory();
ListEntity<T_Service_Apoplexy_FollowUpAndHealthInfoDTO> s = client.Post(Url, list);
if (s.Success)
{
MessageBox.Show("保存成功!");
}
else
{
MessageBox.Show("保存失败!");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "卒中健康与随访高危因素评估页面数据保存:\r\n" + ex);
}
}
private void checkedListBoxControl2_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
string checkState = checkedListBoxControl2.GetItemCheckState(5).ToString();
if (checkState == "Checked")
{
for (int i = 0; i < checkedListBoxControl2.Items.Count; i++)
{
if (checkedListBoxControl2.Items[i].Value.ToString() == "06")
{
}
else
{
checkedListBoxControl2.Items[i].CheckState = CheckState.Unchecked;
}
}
}
else
{
for (int i = 0; i < checkedListBoxControl2.Items.Count; i++)
{
if (checkedListBoxControl2.Items[i].Value.ToString() == "06")
{
checkedListBoxControl2.Items[i].CheckState = CheckState.Unchecked;
}
}
}
string c1 = checkedListBoxControl2.GetItemCheckState(4).ToString();
if (c1 == "Checked")
{
label16.Visible = true;
text_MedicationOther.Visible = true;
}
else
{
label16.Visible = false;
text_MedicationOther.Visible = false;
}
}
private void checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
string c1 = checkedListBoxControl1.GetItemCheckState(7).ToString();
if (c1 == "Checked")
{
label17.Visible = true;
text_PastMedicalHistoryOther.Visible = true;
}
else
{
label17.Visible = false;
text_PastMedicalHistoryOther.Visible = false;
}
}
}
}