StableVersion4.3/HL_FristAidPlatform_EMRS/Form_PatientInfo.cs

277 lines
12 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 System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
namespace HL_FristAidPlatform_EMRS
{
public partial class Form_PatientInfo : XtraForm
{
/// <summary>
/// 民族
/// </summary>
private DataTable NationDT;
private string _guid;
private string fpGuid;
public Form_PatientInfo(string guid)
{
InitializeComponent();
_guid = guid; ;
}
private void Form_PatientInfo_Load(object sender, EventArgs e)
{
BindGender();
BindPathogeny();
BindNation();
QueryInfo(_guid);
//职业
PublicClass.SetLookUpList(lookUpEdit_Profession, Enumerate.PublicDictionaryType., true, "请选择");
}
public void QueryInfo(string guid)
{
string url = string.Format("/api/service/T_Service_Patient/GetPatients?guid={0}", _guid);
DataTable dt = DBHelpClass.GetDataRow(url);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
fpGuid = dt.Rows[0]["FPGUID"].ToString();
txt_Name.Text = dt.Rows[0]["Name"].ToString();
radioGroup_Gender.EditValue = dt.Rows[0]["Gender"].ToString();
txt_Age.Text = dt.Rows[0]["Age"].ToString();
lookUpEdit_Nation.EditValue = dt.Rows[0]["Nation"].ToString();
txt_Phone.Text = dt.Rows[0]["MobilePhone"].ToString();
//PathogenyName
lookUpEdit_Pathogeny.EditValue = dt.Rows[0]["PathogenyGUID"].ToString();
txt_IDNumber.Text = dt.Rows[0]["IdentityCard"].ToString();
txt_Address.Text = dt.Rows[0]["Address"].ToString();
txt_Attack_Address.Text = dt.Rows[0]["Attack_Address"].ToString();
txt_Address.Text = dt.Rows[0]["TransportAddress"].ToString();
dateEdit_Birthday.TimeValue = dt.Rows[0]["Birthday"].ToString();
lookUpEdit_Profession.EditValue = PublicClass.ToString(dt.Rows[0]["Profession"], "-1");
txt_EmergencyContact.Text = dt.Rows[0]["EmergencyContact"].ToString();
txt_EmergencyContactPhone.Text = dt.Rows[0]["EmergencyContactPhone"].ToString();
lookUpEdit_Pathogeny.Text = dt.Rows[0]["PathogenyGUID"].ToString();
//cmb_Identity.Text = dt.Rows[0]["IdentityType"].ToString();
//lbl_Killip.Text = dt.Rows[0]["Killip"].ToString() == "" ? "无" : dt.Rows[0]["Killip"].ToString();
//lbl_SignArea.Text = dt.Rows[0]["SignArea"].ToString() == "" ? "无" : dt.Rows[0]["SignArea"].ToString();
//txt_TransportAddress.Text = dt.Rows[0]["TransportAddress"].ToString();
//lbl_TriageDepartment.Text = dt.Rows[0]["TriageDepartment"].ToString() == "" ? "无" : dt.Rows[0]["TriageDepartment"].ToString();
txt_ChiefComplaint.Text = dt.Rows[0]["ChiefComplaint"].ToString();
txt_DisposalRecord.Text = dt.Rows[0]["DisposalRecord"].ToString();
txt_MedicalHistory.Text = dt.Rows[0]["MedicalHistory"].ToString();
txt_AllergyHistory.Text = dt.Rows[0]["AllergyHistory"].ToString();
dateEdit_Attack_Time.TimeValue = dt.Rows[0]["OnsetTime"].ToString();
//radio_ProvideMedical.SelectedIndex = int.Parse(dt.Rows[0]["ProvideMedical"].ToString());
//radio_Provider.SelectedIndex = int.Parse(dt.Rows[0]["Provider"].ToString());
//radio_AllergicHistory.SelectedIndex = int.Parse(dt.Rows[0]["AllergicHistory"].ToString());
//radio_Fever.SelectedIndex = int.Parse(dt.Rows[0]["Fever"].ToString());
//ck_OwnerAllergyHistory.Checked = dt.Rows[0]["OwnerAllergyHistory"].ToString() == "1" ? true : false;
//ck_HeartDiseaseHistory.Checked = dt.Rows[0]["HeartDiseaseHistory"].ToString() == "1" ? true : false;
//ck_HypertensionHistory.Checked = dt.Rows[0]["HypertensionHistory"].ToString() == "1" ? true : false;
//ck_DiabetesHistory.Checked = dt.Rows[0]["DiabetesHistory"].ToString() == "1" ? true : false;
memo_MedicationRecord.Text = dt.Rows[0]["MedicationRecord"].ToString();
}
}
}
/// <summary>
/// 绑定民族
/// </summary>
private void BindNation()
{
try
{
NationDT = DBHelpClass.Get("/api/base/T_Base_Nation/GetList");
PublicClass.SetLookUpList(ref lookUpEdit_Nation, NationDT, 1, 2, true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定民族:\r\n" + ex);
}
}
/// <summary>
/// 绑定性别
/// </summary>
private void BindGender()
{
try
{
DataTable GenderDT = DBHelpClass.Get("/api/base/T_Base_Gender/GetList");
PublicClass.BindRadioGroupData(radioGroup_Gender, GenderDT, "GenderName", "GenderCode");
radioGroup_Gender.EditValue = "0";
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定性别:\r\n" + ex);
}
}
/// <summary>
/// 绑定病因
/// </summary>
private void BindPathogeny()
{
try
{
DataTable dt = DBHelpClass.Get("/api/base/T_Base_Pathogeny/GetList");
PublicClass.SetLookUpList(ref lookUpEdit_Pathogeny, dt, 1, 2, true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定民族:\r\n" + ex);
}
}
public void SavePatientInfo()
{
try
{
UpdateFirstAidPatientsDTO dto = new UpdateFirstAidPatientsDTO();
List<UpdateFirstAidPatientsDTO> list = new List<UpdateFirstAidPatientsDTO>();
dto.PatientGUID = _guid;
dto.FPGUID = fpGuid;
dto.Name = txt_Name.Text;
dto.Gender = int.Parse(radioGroup_Gender.EditValue.ToString());
dto.Age = int.Parse(txt_Age.Text);
dto.Nation = lookUpEdit_Nation.EditValue.ToString();
dto.IdentityCard = txt_IDNumber.Text;
dto.MobilePhone = txt_Phone.Text;
dto.EmergencyContact = txt_EmergencyContact.Text;
dto.EmergencyContactPhone = txt_EmergencyContactPhone.Text;
dto.Address = txt_Address.Text;
dto.Attack_Address = txt_Attack_Address.Text;
dto.Profession = lookUpEdit_Profession.EditValue.ToString();
dto.Birthday = dateEdit_Birthday.TimeValue.ToString();
//dto.IdentityType = cmb_Identity.Text;
dto.PathogenyGUID = lookUpEdit_Pathogeny.EditValue.ToString();
// dto.TransportAddress = txt_TransportAddress.Text;
dto.ChiefComplaint = txt_ChiefComplaint.Text;
dto.MedicalHistory = txt_MedicalHistory.Text;
dto.AllergyHistory = txt_AllergyHistory.Text;
dto.DisposalRecord = txt_DisposalRecord.Text;
dto.Attack_Time = dateEdit_Attack_Time.TimeValue.ToString();
dto.MedicationRecord = memo_MedicationRecord.Text;
dto.AllergicHistoryInfo = memo_AllergicHistoryInfo.Text;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_Patient/UpdateFirstAidPatientsInfo";
//初始化两个工厂
ClientFactory<UpdateFirstAidPatientsDTO> httpClient = new HttpClientFactory<UpdateFirstAidPatientsDTO>();
Client<UpdateFirstAidPatientsDTO> client = httpClient.VisitFactory();
if (client.Post(Url, list).Success)
{
XtraMessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Form_EMRInfo info;
info = (Form_EMRInfo)this.Owner;
info.ParentInfo(_guid);
this.Close();
}
}
catch (Exception)
{
throw;
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
UpdateFirstAidPatientsDTO dto = new UpdateFirstAidPatientsDTO();
List<UpdateFirstAidPatientsDTO> list = new List<UpdateFirstAidPatientsDTO>();
dto.PatientGUID = _guid;
dto.FPGUID = fpGuid;
dto.Name = txt_Name.Text;
dto.Gender = int.Parse(radioGroup_Gender.EditValue.ToString());
dto.Age = int.Parse(txt_Age.Text);
dto.Nation = lookUpEdit_Nation.EditValue.ToString();
dto.IdentityCard = txt_IDNumber.Text;
dto.MobilePhone = txt_Phone.Text;
dto.EmergencyContact = txt_EmergencyContact.Text;
dto.EmergencyContactPhone = txt_EmergencyContactPhone.Text;
dto.Address = txt_Address.Text;
dto.Attack_Address = txt_Attack_Address.Text;
dto.Profession = lookUpEdit_Profession.EditValue.ToString();
dto.Birthday = dateEdit_Birthday.TimeValue.ToString();
//dto.IdentityType = cmb_Identity.Text;
dto.PathogenyGUID = lookUpEdit_Pathogeny.EditValue.ToString();
// dto.TransportAddress = txt_TransportAddress.Text;
dto.ChiefComplaint = txt_ChiefComplaint.Text;
dto.MedicalHistory = txt_MedicalHistory.Text;
dto.AllergyHistory = txt_AllergyHistory.Text;
dto.DisposalRecord = txt_DisposalRecord.Text;
dto.Attack_Time = dateEdit_Attack_Time.TimeValue.ToString();
dto.MedicationRecord = memo_MedicationRecord.Text;
// dto.AllergicHistory = radio_AllergicHistory.SelectedIndex;
dto.AllergicHistoryInfo = memo_AllergicHistoryInfo.Text;
//dto.ProvideMedical = radio_ProvideMedical.SelectedIndex;
// dto.Provider = radio_Provider.SelectedIndex;
//dto.OwnerAllergyHistory = ck_OwnerAllergyHistory.Checked == true ? 1 : 0;
//dto.HeartDiseaseHistory = ck_HeartDiseaseHistory.Checked == true ? 1 : 0;
//dto.HypertensionHistory = ck_HypertensionHistory.Checked == true ? 1 : 0;
// dto.DiabetesHistory = ck_DiabetesHistory.Checked == true ? 1 : 0;
// dto.Fever = radio_Fever.SelectedIndex;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_Patient/UpdateFirstAidPatientsInfo";
//初始化两个工厂
ClientFactory<UpdateFirstAidPatientsDTO> httpClient = new HttpClientFactory<UpdateFirstAidPatientsDTO>();
Client<UpdateFirstAidPatientsDTO> client = httpClient.VisitFactory();
if (client.Post(Url, list).Success)
{
XtraMessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Form_EMRInfo info;
info = (Form_EMRInfo)this.Owner;
info.ParentInfo(_guid);
this.Close();
}
}
private void dateEdit_Birthday_TimeValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(dateEdit_Birthday.TimeValue))
{
DateTime dateTime = Convert.ToDateTime(dateEdit_Birthday.TimeValue);
int ageUnit = 1;
txt_Age.Text = PublicClass.GetAge(dateTime, DateTime.Now, out ageUnit).ToString();
}
}
private void lookUpEdit_Nation_EditValueChanged(object sender, EventArgs e)
{
}
private void panelControl24_Paint(object sender, PaintEventArgs e)
{
}
private void panel_infoContent_Paint(object sender, PaintEventArgs e)
{
}
}
}