StableVersion4.3/HL_FristAidPlatform_Trauma/Form_PatientInfo.cs

409 lines
19 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
namespace HL_FristAidPlatform_Trauma
{
public partial class Form_PatientBaceInfo : XtraForm
{
public string Guid { get; set; }
public DataTable dt;
public DataTable othermpdsDT;
public string mpds;
public string otherMpds;
public int gender;
public int attendingDoctorID;
public int attendingNurseID;
public DataTable NationDT;
public int inessLevel;
public Form_PatientBaceInfo(string guid)
{
InitializeComponent();
Guid = guid;
}
private void Form_PatientInfo_Load(object sender, EventArgs e)
{
BindProvince();
BindNation();
AttendingDoctor();
AttendingNurse();
//职业
PublicClass.SetLookUpList(lookUp_Profession, Enumerate.PublicDictionaryType., true, "请选择");
//文化程度
PublicClass.SetLookUpList(lookUp_Education, Enumerate.PublicDictionaryType., true, "请选择");
//婚姻状况
PublicClass.SetLookUpList(lookUp_MaritalStatus, Enumerate.PublicDictionaryType., true, "请选择");
string url = string.Format("/api/service/T_Service_TraumaPatient/GetTraumaPatientInfo?guid={0}", Guid);
//time_Birthday.DatePicker.BottomBarConfirmClick += new WinformControlLibraryExtension.DatePickerExt.BottomBarIiemClickEventHandler(bottomBarConfirmClick);
DataTable dtInfo = DBHelpClass.GetDataRow(url);
if (dtInfo != null)
{
if (dtInfo.Rows.Count > 0)
{
txt_name.Text = dtInfo.Rows[0]["Name"].ToString();
if (dtInfo.Rows[0]["Gender"] != null)
{
radioGroup1.EditValue =dtInfo.Rows[0]["Gender"].ToInt();
}
txt_Age.Text = dtInfo.Rows[0]["Age"].ToString();
txt_MobilePhone.Text = dtInfo.Rows[0]["MobilePhone"].ToString();
txt_IdentityCard.Text = dtInfo.Rows[0]["IdentityCard"].ToString();
txt_EmergencyContact.Text = dtInfo.Rows[0]["EmergencyContact"].ToString();
txt_EmergencyContactPhone.Text = dtInfo.Rows[0]["EmergencyContactPhone"].ToString();
txt_Address.Text = dtInfo.Rows[0]["Address"].ToString();
txt_Attack_Address.Text = dtInfo.Rows[0]["Attack_Address"].ToString();
txt_MPDSContent.Text = dtInfo.Rows[0]["MPDSContent"].ToString();
txt_OtherMPDSContent.Text = dtInfo.Rows[0]["OtherMPDSContent"].ToString();
switch (int.Parse(dtInfo.Rows[0]["IllnessLevel"].ToString()))
{
case 0:
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(25, 190, 107);
lbl_inesslevel1.ForeColor = System.Drawing.Color.White;
break;
case 1:
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 140, 0);
lbl_inesslevel2.ForeColor = System.Drawing.Color.White;
break;
case 2:
panel_inesslevel3.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 99, 71);
lbl_inesslevel3.ForeColor = System.Drawing.Color.White;
break;
}
txt_SystolicPressure.Text = dtInfo.Rows[0]["SystolicPressure"].ToString();
txt_DiastolicPressure.Text = dtInfo.Rows[0]["DiastolicPressure"].ToString();
txt_Breathing.Text = dtInfo.Rows[0]["Breathing"].ToString();
txt_HearRate.Text = dtInfo.Rows[0]["HearRate"].ToString();
txt_Pulse.Text = dtInfo.Rows[0]["Pulse"].ToString();
txt_Temperature.Text = dtInfo.Rows[0]["Temperature"].ToString();
txt_BoolSugar.Text = dtInfo.Rows[0]["BoolSugar"].ToString();
txt_SaO2.Text = dtInfo.Rows[0]["SaO2"].ToString();
txt_OutpatientNumber.Text = dtInfo.Rows[0]["OutpatientNumber"].ToString();
txt_AdmissionNumber.Text = dtInfo.Rows[0]["AdmissionNumber"].ToString();
lookUp_AttendingDoctor.EditValue = dtInfo.Rows[0]["AttendingDoctorID"].ToString();
lookUp_AttendingNurse.EditValue = dtInfo.Rows[0]["AttendingNurseID"].ToString();
lookUpEdit_Nation.EditValue = dtInfo.Rows[0]["Nation"].ToString();
lookUp_MaritalStatus.EditValue = dtInfo.Rows[0]["MaritalStatus"].ToString();
lookUp_Profession.EditValue = dtInfo.Rows[0]["Profession"].ToString();
lookUp_Education.EditValue = dtInfo.Rows[0]["Education"].ToString();
lookUp_Province.EditValue = dtInfo.Rows[0]["Province"].ToString();
lookUp_City.EditValue = dtInfo.Rows[0]["City"].ToString();
lookUp_Area.EditValue = dtInfo.Rows[0]["Area"].ToString();
mpds = dtInfo.Rows[0]["MPDS"].ToString();
otherMpds = dtInfo.Rows[0]["OtherMPDS"].ToString();
timeControl1.TimeValue = dtInfo.Rows[0]["Birthday"].ToString();
txt_Height.Text = dtInfo.Rows[0]["Height"].ToString();
txt_Weight.Text = dtInfo.Rows[0]["Weight"].ToString();
comboBox_Credentials_Type.SelectedIndex = dtInfo.Rows[0]["Credentials_Type"].ToInt();
}
}
}
/// <summary>
/// 计算年龄
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//public void bottomBarConfirmClick(object sender, BottomBarIiemEventArgs e)
//{
// if (PublicClass.ToString(time_Birthday.Text, "") != "")
// {
// DateTime Birthday = Convert.ToDateTime(time_Birthday.Text);
// int ageUnit = 0;
// int age = PublicClass.GetAge(Birthday, DateTime.Now, out ageUnit);
// txt_Age.Text = age.ToString();
// }
//}
/// <summary>
/// 绑定民族
/// </summary>
private void BindNation()
{
try
{
NationDT = DBHelpClass.Get("/api/base/T_Base_Nation/GetList");
PublicClass.SetLookUpList(lookUpEdit_Nation, NationDT, "Value", "NationName", true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定民族:\r\n" + ex);
}
}
/// <summary>
/// 绑定医生
/// </summary>
private void AttendingDoctor()
{
try
{
NationDT = DBHelpClass.Get(string.Format("/api/admin/T_SYS_User/GetMedicalWorkersList?hosptalGuid={0}&type={1}", Information.Hospital.GUID, 2));
PublicClass.SetLookUpList(lookUp_AttendingDoctor, NationDT, "ID", "Name", true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定民族:\r\n" + ex);
}
}
/// <summary>
/// 绑定护士
/// </summary>
private void AttendingNurse()
{
try
{
NationDT = DBHelpClass.Get(string.Format("/api/admin/T_SYS_User/GetMedicalWorkersList?hosptalGuid={0}&type={1}", Information.Hospital.GUID, 3));
PublicClass.SetLookUpList(lookUp_AttendingNurse, NationDT, "ID", "Name", true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定民族:\r\n" + ex);
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
T_Service_Trauma_PatientInfoDTO dto = new T_Service_Trauma_PatientInfoDTO();
List<T_Service_Trauma_PatientInfoDTO> list = new List<T_Service_Trauma_PatientInfoDTO>();
dto.GUID = Guid;
dto.Name = txt_name.Text;
dto.Age = int.Parse(txt_Age.Text);
dto.Gender = gender;
dto.MobilePhone = txt_MobilePhone.Text;
dto.EmergencyContact = txt_EmergencyContact.Text;
dto.EmergencyContactPhone = txt_EmergencyContactPhone.Text;
dto.Birthday = timeControl1.TimeValue;
dto.IdentityCard = txt_IdentityCard.Text;
dto.Address = txt_Address.Text;
dto.Attack_Address = txt_Attack_Address.Text;
dto.OutpatientNumber = txt_OutpatientNumber.Text;
dto.AdmissionNumber = txt_AdmissionNumber.Text;
dto.Nation = lookUpEdit_Nation.EditValue.ToString();
if (radioGroup1.EditValue != null)
{
dto.Gender = radioGroup1.EditValue.ToInt();
}
switch (comboBox_Credentials_Type.Text)
{
case "无":
dto.Credentials_Type = "0";
break;
case "身份证":
dto.Credentials_Type = "1";
break;
case "护照":
dto.Credentials_Type = "2";
break;
case "军官证":
dto.Credentials_Type = "3";
break;
case "社保卡":
dto.Credentials_Type = "4";
break;
case "农保卡":
dto.Credentials_Type = "5";
break;
case "通用就诊卡":
dto.Credentials_Type = "6";
break;
case "其他":
dto.Credentials_Type = "7";
break;
}
dto.Profession = lookUp_Profession.EditValue.ToString();
dto.Education = lookUp_Education.EditValue.ToString();
dto.MaritalStatus = lookUp_MaritalStatus.EditValue.ToString();
dto.Province = lookUp_Province.EditValue.ToString();
dto.City = lookUp_City.EditValue.ToString();
dto.Area = lookUp_Area.EditValue.ToString();
dto.MPDS = mpds.ToString();
dto.OtherMPDS = otherMpds.ToString();
dto.IllnessLevel = inessLevel;
dto.Height = txt_Height.Text;
dto.Weight = txt_Weight.Text;
dto.SystolicPressure = txt_SystolicPressure.Text;
dto.DiastolicPressure = txt_DiastolicPressure.Text;
dto.HearRate = txt_HearRate.Text;
dto.Pulse = txt_Pulse.Text;
dto.Breathing = txt_Breathing.Text;
if (!string.IsNullOrEmpty(txt_Temperature.Text))
{
dto.Temperature = float.Parse(txt_Temperature.Text);
}
if (!string.IsNullOrEmpty(txt_BoolSugar.Text))
{
dto.BoolSugar = float.Parse(txt_BoolSugar.Text);
}
dto.SaO2 = txt_SaO2.Text;
dto.AttendingDoctorID = long.Parse(lookUp_AttendingDoctor.EditValue.ToString());
dto.AttendingNurseID = long.Parse(lookUp_AttendingNurse.EditValue.ToString());
dto.CreateUserID = Information.User.ID;
dto.MPDS = mpds;
dto.OtherMPDS = otherMpds;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_TraumaPatient/UpdateTraumaPatientInfo";
//初始化两个工厂
ClientFactory<T_Service_Trauma_PatientInfoDTO> httpClient = new HttpClientFactory<T_Service_Trauma_PatientInfoDTO>();
Client<T_Service_Trauma_PatientInfoDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_Trauma_PatientInfoDTO> t = client.Post(Url, list);
if (t.Success)
{
XtraMessageBox.Show("保存成功");
Form_PatientList info;
info = (Form_PatientList)this.Owner;
info.PatientList(Information.Hospital.GUID, "", -1, -1, "", "");
this.Close();
}
}
catch (Exception ex)
{
throw ex;
}
}
private void panelControl4_Click(object sender, EventArgs e)
{
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(25, 190, 107);
lbl_inesslevel1.ForeColor = System.Drawing.Color.White;
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel2.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
inessLevel = 0;
}
private void lbl_inesslevel1_Click(object sender, EventArgs e)
{
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(25, 190, 107);
lbl_inesslevel1.ForeColor = System.Drawing.Color.White;
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel2.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
panel_inesslevel3.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel3.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
inessLevel = 0;
}
private void panel_inesslevel2_Click(object sender, EventArgs e)
{
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 140, 0);
lbl_inesslevel2.ForeColor = System.Drawing.Color.White;
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel1.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
panel_inesslevel3.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel3.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
inessLevel = 1;
}
private void lbl_inesslevel2_Click(object sender, EventArgs e)
{
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 140, 0);
lbl_inesslevel2.ForeColor = System.Drawing.Color.White;
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel1.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
inessLevel = 1;
}
private void panel_inesslevel3_Click(object sender, EventArgs e)
{
panel_inesslevel3.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 99, 71);
lbl_inesslevel3.ForeColor = System.Drawing.Color.White;
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel1.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel2.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
inessLevel = 2;
}
private void lbl_inesslevel3_Click(object sender, EventArgs e)
{
panel_inesslevel3.Appearance.BackColor = System.Drawing.Color.FromArgb(255, 99, 71);
lbl_inesslevel3.ForeColor = System.Drawing.Color.White;
panel_inesslevel1.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel1.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
panel_inesslevel2.Appearance.BackColor = System.Drawing.Color.FromArgb(245, 245, 245);
lbl_inesslevel2.ForeColor = System.Drawing.Color.FromArgb(96, 98, 102);
inessLevel = 2;
}
/// <summary>
/// 绑定省
/// </summary>
private void BindProvince()
{
try
{
string Url = string.Format("/api/base/T_Base_Province/GetList?systemModuleId=2");
DataTable BindDT = DBHelpClass.Get(Url);
PublicClass.SetLookUpList(lookUp_Province, BindDT, "ProvinceCode", "ProvinceName", false, "请选择");
lookUp_Province.EditValue = PublicClassForDataBase.Config110;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定省:\r\n" + ex);
}
}
private void lookUp_Province_EditValueChanged(object sender, EventArgs e)
{
try
{
string ProvinceCode = PublicClass.ToString(lookUp_Province.EditValue, "");
if (ProvinceCode != "" && ProvinceCode != "-1")
{
string Url = string.Format("/api/base/T_Base_City/GetList?provinceCode={0}", ProvinceCode);
DataTable BindDT = DBHelpClass.Get(Url);
PublicClass.SetLookUpList(lookUp_City, BindDT, "CityCode", "CityName", false, "请选择");
lookUp_City.EditValue = PublicClassForDataBase.Config115;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择省联动市:\r\n" + ex);
}
}
private void lookUp_City_EditValueChanged(object sender, EventArgs e)
{
try
{
string CityCode = PublicClass.ToString(lookUp_City.EditValue, "");
if (CityCode != "" && CityCode != "-1")
{
string Url = string.Format("/api/base/T_Base_County/GetList?cityCode={0}", CityCode);
DataTable BindDT = DBHelpClass.Get(Url);
PublicClass.SetLookUpList(lookUp_Area, BindDT, "CountyCode", "CountyName", false, "请选择");
lookUp_Area.EditValue = PublicClassForDataBase.Config116;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择市联动县:\r\n" + ex);
}
}
//问题1生日 和 年龄 无法反向计算
//问题2更新后接诊医生、护士、省市县、名族、职业、婚姻状态等【 显示不出来
}
}