StableVersion4.3/HL_FristAidPlatform_FollowUp/Form_FollowUpDetail_FollowU...

363 lines
16 KiB
C#

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_FollowUpInHospitalManage : DevExpress.XtraEditors.XtraForm
{
private string patientguid;
private string Guid;
public Form_FollowUpDetail_FollowUpInHospitalManage(string Guid)
{
patientguid = Guid;
InitializeComponent();
}
//窗体加载事件
private void Form_FollowUpDetail_FollowUpInHospitalManage_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)
{
Guid = dt.Rows[0]["Guid"].ToString();
string DrugUseIn = dt.Rows[0]["DrugUseIn"].ToString();
string[] getAry = DrugUseIn.Split(';');
//院中用药情况
for (int i = 1; i < getAry.Length - 1; i++)
{
if (DrugUseIn.Contains(getAry[i]))
{
for (int j = 0; j < checkedListBoxControl1.ItemCount; j++)
{
if (getAry[i].Equals(checkedListBoxControl1.Items[j].Value.ToString()))
{
checkedListBoxControl1.SetItemChecked(j, true);
}
}
}
}
//院中用药其他情况
textBox1.Text = dt.Rows[0]["DrugUseInOther"].ToString();
if (!string.IsNullOrEmpty(dt.Rows[0]["AdverseReactions"].ToString()))
{
radioGroup1.EditValue = int.Parse(dt.Rows[0]["AdverseReactions"].ToString());
}
textBox2.Text = dt.Rows[0]["AdverseReactionsDescription"].ToString();
textBox3.Text = dt.Rows[0]["BloodTest"].ToString();
textBox4.Text = dt.Rows[0]["OtherTest"].ToString();
//生活方式指导
string LifestyleGuidance = dt.Rows[0]["LifestyleGuidance"].ToString();
string[] getAry1 = LifestyleGuidance.Split(';');
for (int i = 1; i < getAry1.Length - 1; i++)
{
if (LifestyleGuidance.Contains(getAry1[i]))
{
for (int j = 0; j < checkedListBoxControl2.ItemCount; j++)
{
if (getAry1[i].Equals(checkedListBoxControl2.Items[j].Value.ToString()))
{
checkedListBoxControl2.SetItemChecked(j, true);
}
}
}
}
//基础疾病及危险因素干预指导
string Intervention = dt.Rows[0]["Intervention"].ToString();
string[] getAry2 = Intervention.Split(';');
for (int i = 1; i < getAry2.Length - 1; i++)
{
if (Intervention.Contains(getAry2[i]))
{
for (int j = 0; j < checkedListBoxControl3.ItemCount; j++)
{
if (getAry2[i].Equals(checkedListBoxControl3.Items[j].Value.ToString()))
{
checkedListBoxControl3.SetItemChecked(j, true);
}
}
}
}
//特殊治疗方式指导
string SpecialIntervention = dt.Rows[0]["SpecialIntervention"].ToString();
string[] getAry3 = SpecialIntervention.Split(';');
for (int i = 1; i < getAry3.Length - 1; i++)
{
if (SpecialIntervention.Contains(getAry3[i]))
{
for (int j = 0; j < checkedListBoxControl4.ItemCount; j++)
{
if (getAry3[i].Equals(checkedListBoxControl4.Items[j].Value.ToString()))
{
checkedListBoxControl4.SetItemChecked(j, true);
}
}
}
}
//其他指导
string OtherIntervention = dt.Rows[0]["OtherIntervention"].ToString();
string[] getAry4 = OtherIntervention.Split(';');
for (int i = 1; i < getAry4.Length - 1; i++)
{
if (OtherIntervention.Contains(getAry4[i]))
{
for (int j = 0; j < checkedListBoxControl5.ItemCount; j++)
{
if (getAry4[i].Equals(checkedListBoxControl5.Items[j].Value.ToString()))
{
checkedListBoxControl5.SetItemChecked(j, true);
}
}
}
}
}
}
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 DrugUseIn = null;
for (int i = 0; i < checkedListBoxControl1.CheckedItems.Count; i++)
{
DrugUseIn += ";";
DrugUseIn += checkedListBoxControl1.CheckedItems[i].ToString();
if (i == checkedListBoxControl1.CheckedItems.Count - 1)
{
DrugUseIn += ";";
}
}
af.DrugUseIn = DrugUseIn;
af.DrugUseInOther=textBox1.Text;
if (!(radioGroup1.EditValue==null))
{
af.AdverseReactions = radioGroup1.EditValue.ToString();
}
af.AdverseReactionsDescription = textBox2.Text;
af.BloodTest = textBox3.Text;
af.OtherTest = textBox4.Text;
af.PatientGuid = patientguid;
af.GUID = Guid;
//生活方式指导
String LifestyleGuidance = null;
for (int i = 0; i < checkedListBoxControl2.CheckedItems.Count; i++)
{
LifestyleGuidance += ";";
LifestyleGuidance += checkedListBoxControl2.CheckedItems[i].ToString();
if (i == checkedListBoxControl2.CheckedItems.Count - 1)
{
LifestyleGuidance += ";";
}
}
af.LifestyleGuidance = LifestyleGuidance;
//基础疾病及危险因素干预指导
String Intervention = null;
for (int i = 0; i < checkedListBoxControl3.CheckedItems.Count; i++)
{
Intervention += ";";
Intervention += checkedListBoxControl3.CheckedItems[i].ToString();
if (i == checkedListBoxControl3.CheckedItems.Count - 1)
{
Intervention += ";";
}
}
af.Intervention = Intervention;
//特殊治疗方式指导
String SpecialIntervention = null;
for (int i = 0; i < checkedListBoxControl4.CheckedItems.Count; i++)
{
SpecialIntervention += ";";
SpecialIntervention += checkedListBoxControl4.CheckedItems[i].ToString();
if (i == checkedListBoxControl4.CheckedItems.Count - 1)
{
SpecialIntervention += ";";
}
}
af.SpecialIntervention = SpecialIntervention;
//其他指导
String OtherIntervention = null;
for (int i = 0; i < checkedListBoxControl5.CheckedItems.Count; i++)
{
OtherIntervention += ";";
OtherIntervention += checkedListBoxControl5.CheckedItems[i].ToString();
if (i == checkedListBoxControl5.CheckedItems.Count - 1)
{
OtherIntervention += ";";
}
}
af.OtherIntervention = OtherIntervention;
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 radioGroup1_SelectedIndexChanged(object sender, EventArgs e)
{
string sml = PublicClass.ToString(radioGroup1.EditValue,"");
if(!string.IsNullOrEmpty(sml))
{
if(sml=="1")
{
textBox2.Visible = true;
}
else
{
textBox2.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 DrugUseIn = null;
for (int i = 0; i < checkedListBoxControl1.CheckedItems.Count; i++)
{
DrugUseIn += ";";
DrugUseIn += checkedListBoxControl1.CheckedItems[i].ToString();
if (i == checkedListBoxControl1.CheckedItems.Count - 1)
{
DrugUseIn += ";";
}
}
af.DrugUseIn = DrugUseIn;
af.DrugUseInOther = textBox1.Text;
if (!(radioGroup1.EditValue == null))
{
af.AdverseReactions = radioGroup1.EditValue.ToString();
}
af.AdverseReactionsDescription = textBox2.Text;
af.BloodTest = textBox3.Text;
af.OtherTest = textBox4.Text;
af.PatientGuid = patientguid;
af.GUID = Guid;
//生活方式指导
String LifestyleGuidance = null;
for (int i = 0; i < checkedListBoxControl2.CheckedItems.Count; i++)
{
LifestyleGuidance += ";";
LifestyleGuidance += checkedListBoxControl2.CheckedItems[i].ToString();
if (i == checkedListBoxControl2.CheckedItems.Count - 1)
{
LifestyleGuidance += ";";
}
}
af.LifestyleGuidance = LifestyleGuidance;
//基础疾病及危险因素干预指导
String Intervention = null;
for (int i = 0; i < checkedListBoxControl3.CheckedItems.Count; i++)
{
Intervention += ";";
Intervention += checkedListBoxControl3.CheckedItems[i].ToString();
if (i == checkedListBoxControl3.CheckedItems.Count - 1)
{
Intervention += ";";
}
}
af.Intervention = Intervention;
//特殊治疗方式指导
String SpecialIntervention = null;
for (int i = 0; i < checkedListBoxControl4.CheckedItems.Count; i++)
{
SpecialIntervention += ";";
SpecialIntervention += checkedListBoxControl4.CheckedItems[i].ToString();
if (i == checkedListBoxControl4.CheckedItems.Count - 1)
{
SpecialIntervention += ";";
}
}
af.SpecialIntervention = SpecialIntervention;
//其他指导
String OtherIntervention = null;
for (int i = 0; i < checkedListBoxControl5.CheckedItems.Count; i++)
{
OtherIntervention += ";";
OtherIntervention += checkedListBoxControl5.CheckedItems[i].ToString();
if (i == checkedListBoxControl5.CheckedItems.Count - 1)
{
OtherIntervention += ";";
}
}
af.OtherIntervention = OtherIntervention;
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 checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
if (checkedListBoxControl1.Text == "其他")
{
if (e.State == CheckState.Checked)
{
label2.Visible = true;
textBox1.Visible = true;
}
else
{
label2.Visible = false;
textBox1.Visible = false;
textBox1.Text = "";
}
}
}
}
}