StableVersion4.3/HL_FristAidPlatform_Critica.../Form_Pregnant_Pastmedicalhi...

268 lines
11 KiB
C#
Raw Permalink Normal View History

2024-03-11 09:47:34 +08:00
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.Windows.Forms;
namespace HL_FristAidPlatform_CriticalPregnant
{
public partial class Form_Pregnant_Pastmedicalhistory : XtraForm
{
string patientGUID;
public Form_Pregnant_Pastmedicalhistory(string _patientGUID = "")
{
InitializeComponent();
patientGUID = _patientGUID;
}
private void Form_Pregnant_Pastmedicalhistory_Load(object sender, EventArgs e)
{
try
{
string url = string.Format("api/service/T_Service_CriticalPregnant_Pasthistory/GetByPatientGUID?PatientGuid={0}", patientGUID);
T_Service_CriticalPregnant_PasthistoryDTO PasthistoryDTO = DBHelpClass.GetDateModel<T_Service_CriticalPregnant_PasthistoryDTO>(url);
if (PasthistoryDTO != null)
{
memoEdit2.Text = PasthistoryDTO.Pastmedicalhistory + "";
textEdit2.Text = PasthistoryDTO.Pregnancies + "";
textEdit3.Text = PasthistoryDTO.Parity + "";
memoEdit1.Text = PasthistoryDTO.Gynecologicsurgery + "";
textEdit7.Text = PasthistoryDTO.Spontaneousabortion + "";
textEdit6.Text = PasthistoryDTO.Artificialabortion + "";
textEdit8.Text = PasthistoryDTO.Stillbirth + "";
textEdit5.Text = PasthistoryDTO.Neonataldeath + "";
textEdit9.Text = PasthistoryDTO.Birthdefect + "";
if (!string.IsNullOrEmpty(PasthistoryDTO.Familyhistorycategory + ""))
{
PublicClass.SetItemChecked(checkedListBoxControl1, PublicClass.ToString(PasthistoryDTO.Familyhistorycategory, ""), '|');
if (PasthistoryDTO.Familyhistorycategory.Contains("17"))
{
labelControl10.Visible = true;
memoEdit3.Visible = true;
}
}
memoEdit3.Text = PasthistoryDTO.FamilyhistorycategoryOther + "";
if (!string.IsNullOrEmpty(PasthistoryDTO.Exposureharmfulfactors + ""))
{
PublicClass.SetItemChecked(checkedListBoxControl2, PublicClass.ToString(PasthistoryDTO.Exposureharmfulfactors, ""), '|');
if (PasthistoryDTO.Exposureharmfulfactors.Contains("7"))
{
labelControl11.Visible = true;
memoEdit4.Visible = true;
}
}
memoEdit4.Text = PasthistoryDTO.ExposureharmfulfactorsOther + "";
if (!string.IsNullOrEmpty(PasthistoryDTO.Pregnancycomplications + ""))
{
PublicClass.SetItemChecked(checkedListBoxControl3, PublicClass.ToString(PasthistoryDTO.Pregnancycomplications, ""), '|');
if (PasthistoryDTO.Pregnancycomplications.Contains("11"))
{
labelControl13.Visible = true;
memoEdit5.Visible = true;
}
}
memoEdit5.Text = PasthistoryDTO.PregnancycomplicationsOther + "";
if (!string.IsNullOrEmpty(PasthistoryDTO.Complications + ""))
{
PublicClass.SetItemChecked(checkedListBoxControl4, PublicClass.ToString(PasthistoryDTO.Complications, ""), '|');
if (PasthistoryDTO.Complications.Contains("11"))
{
labelControl16.Visible = true;
memoEdit6.Visible = true;
}
}
memoEdit6.Text = PasthistoryDTO.ComplicationsOther + "";
}
}
catch (Exception ex)
{
throw ex;
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
SavePastmedicalhistory();
}
public void SavePastmedicalhistory()
{
try
{
T_Service_CriticalPregnant_PasthistoryDTO pasthistoryDTO = new T_Service_CriticalPregnant_PasthistoryDTO();
List<T_Service_CriticalPregnant_PasthistoryDTO> list = new List<T_Service_CriticalPregnant_PasthistoryDTO>();
pasthistoryDTO.Pastmedicalhistory = memoEdit2.Text + "";
pasthistoryDTO.Pregnancies = textEdit2.Text + "";
pasthistoryDTO.Parity = textEdit3.Text + "";
pasthistoryDTO.Gynecologicsurgery = memoEdit1.Text + "";
pasthistoryDTO.Spontaneousabortion = textEdit7.Text + "";
pasthistoryDTO.Artificialabortion = textEdit6.Text + "";
pasthistoryDTO.Stillbirth = textEdit8.Text + "";
pasthistoryDTO.Neonataldeath = textEdit5.Text + "";
pasthistoryDTO.Birthdefect = textEdit9.Text + "";
{
string SyndromeNumber;
string Syndrome;
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl1, "|", out SyndromeNumber, out Syndrome);
pasthistoryDTO.Familyhistorycategory = "" + SyndromeNumber + "";
}
pasthistoryDTO.FamilyhistorycategoryOther = memoEdit3.Text + "";
{
string SyndromeNumber;
string Syndrome;
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl2, "|", out SyndromeNumber, out Syndrome);
pasthistoryDTO.Exposureharmfulfactors = "" + SyndromeNumber + "";
}
pasthistoryDTO.ExposureharmfulfactorsOther = memoEdit4.Text + "";
{
string SyndromeNumber;
string Syndrome;
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl3, "|", out SyndromeNumber, out Syndrome);
pasthistoryDTO.Pregnancycomplications = "" + SyndromeNumber + "";
}
pasthistoryDTO.PregnancycomplicationsOther = memoEdit5.Text + "";
{
string SyndromeNumber;
string Syndrome;
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl4, "|", out SyndromeNumber, out Syndrome);
pasthistoryDTO.Complications = "" + SyndromeNumber + "";
}
pasthistoryDTO.ComplicationsOther = memoEdit6.Text + "";
pasthistoryDTO.PatientGUID = patientGUID;
pasthistoryDTO.CreatorID = Information.User.ID;
list.Add(pasthistoryDTO);
string Url = "api/service/T_Service_CriticalPregnant_Pasthistory/AddORUpdatePasthistory";
//初始化两个工厂
ClientFactory<T_Service_CriticalPregnant_PasthistoryDTO> httpClient = new HttpClientFactory<T_Service_CriticalPregnant_PasthistoryDTO>();
Client<T_Service_CriticalPregnant_PasthistoryDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_CriticalPregnant_PasthistoryDTO> 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("保存失败");
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
catch (Exception ex)
{
throw ex;
}
}
private void checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
if (checkedListBoxControl1.Text == "其他")
{
if (e.State == CheckState.Checked)
{
labelControl10.Visible = true;
memoEdit3.Visible = true;
}
else
{
labelControl10.Visible = false;
memoEdit3.Visible = false;
memoEdit3.Text = "";
}
}
}
private void checkedListBoxControl2_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
if (checkedListBoxControl2.Text == "其他")
{
if (e.State == CheckState.Checked)
{
labelControl11.Visible = true;
memoEdit4.Visible = true;
}
else
{
labelControl11.Visible = false;
memoEdit4.Visible = false;
memoEdit4.Text = "";
}
}
}
private void checkedListBoxControl3_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
if (checkedListBoxControl3.Text == "其他")
{
if (e.State == CheckState.Checked)
{
labelControl13.Visible = true;
memoEdit5.Visible = true;
}
else
{
labelControl13.Visible = false;
memoEdit5.Visible = false;
memoEdit5.Text = "";
}
}
}
private void checkedListBoxControl4_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
if (checkedListBoxControl4.Text == "其他")
{
if (e.State == CheckState.Checked)
{
labelControl16.Visible = true;
memoEdit6.Visible = true;
}
else
{
labelControl16.Visible = false;
memoEdit6.Visible = false;
memoEdit6.Text = "";
}
}
}
}
}