StableVersion4.3/HL_FristAidPlatform_FollowUp/Form_AddFollowUpPatient.cs

296 lines
12 KiB
C#
Raw Permalink 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;
using System.Threading;
using System.Windows.Forms;
namespace HL_FristAidPlatform_FollowUp
{
public partial class Form_AddFollowUpPatient : XtraForm
{
/// <summary>
/// PatientGUID
/// </summary>
public string PatientGUID;
/// <summary>
/// 所属模块ID
/// </summary>
public int SysMID = 3;
public Form_AddFollowUpPatient()
{
InitializeComponent();
}
public Form_AddFollowUpPatient(string PatientGUID)
{
InitializeComponent();
this.PatientGUID = PatientGUID;
}
//private void button1_Click(object sender, EventArgs e)
//{
// try
// {
// //数据有效性验证
// if (!DataVerification())
// return;
// List<T_Service_Apoplexy_FAHBaseDTO> list = new List<T_Service_Apoplexy_FAHBaseDTO>();
// T_Service_Apoplexy_FAHBaseDTO model = new T_Service_Apoplexy_FAHBaseDTO();
// string Url = "api/service/T_Service_Apoplexy_FAHBase/ADD";
// model.Name = textBox_name.Text;
// if (radioGroup_Gender.EditValue != null)
// {
// model.Sex = radioGroup_Gender.EditValue.ToString();
// }
// model.Age = textBox_age.Text;
// model.Height = textBox_height.Text;
// model.Weight = textBox_weight.Text;
// model.PatientNum = textBox_patientnum.Text;
// model.BedNum = textBox_bednum.Text;
// model.PatientPhone = textBox_patientphone.Text;
// model.EmergencyContactPhone = textBox_emergencycontactphone.Text;
// if (!string.IsNullOrEmpty( timeControl_admissiontime.TimeValue ))
// {
// model.AdmissionDate = Convert.ToDateTime(timeControl_admissiontime.TimeValue);
// }
// if (!string.IsNullOrEmpty(timeControl_dischargetime.TimeValue))
// {
// model.DischargeDate = Convert.ToDateTime(timeControl_dischargetime.TimeValue);
// }
// model.CreationDate = DateTime.Now;
// model.GUID = Guid.NewGuid().ToString();
// model.CreatorID = Information.User.ID;
// model.HospitalGuid = Information.Hospital.GUID;
// model.DeleteFlag = 0;
// model.PatientGUID = PatientGUID;
// //if (!string.IsNullOrEmpty(model.PatientGUID+""))
// //{
// // string Url1 = string.Format("api/service/T_Service_Patient/GetBypatientguid?guid={0}", model.PatientGUID);
// // T_Service_PatientDTO tsp = DBHelpClass.GetDateModel<T_Service_PatientDTO>(Url1);
// // model.PatientPhone = tsp.MobilePhone;
// // model.EmergencyContactPhone = tsp.EmergencyContactPhone;
// // model.IDCard = tsp.IdentityCard;
// // model.Province = tsp.Province;
// // model.City = tsp.City;
// // model.Area = tsp.Area;
// // model.Address = tsp.Address;
// // model.MaritalStatus = tsp.MaritalStatus;
// // model.ComingWay = tsp.ComeHosptialWay;
// // model.MedicalType = tsp.acZLType;
// // string url2 = string.Format("api/service/T_Service_Apoplexy_Prehospital/GetByPatientGuidAndReportType?patientGuid={0}", model.PatientGUID);
// // T_Service_Apoplexy_PrehospitalDTO tsp1 = DBHelpClass.GetDateModel<T_Service_Apoplexy_PrehospitalDTO>(url2);
// // model.PatientComplaint = tsp1.DiseaseRecord;
// //}
// model.SystemModuleID = "3";
// list.Add(model);
// ClientFactory<T_Service_Apoplexy_FAHBaseDTO> tsap = new HttpClientFactory<T_Service_Apoplexy_FAHBaseDTO>();
// Client<T_Service_Apoplexy_FAHBaseDTO> clts = tsap.VisitFactory();
// ListEntity<T_Service_Apoplexy_FAHBaseDTO> s = clts.Post(Url, list);
// if (s.Success)
// {
// MessageBox.Show("创建成功");
// Form_FollowUpMain_Apoplexy ffuma;
// ffuma = (Form_FollowUpMain_Apoplexy)this.Owner;
// ffuma.FillGridListCtrlQuery(1);
// this.Close();
// }
// else
// {
// MessageBox.Show("创建失败");
// }
// }
// catch (Exception ex)
// {
// PublicClass.WriteErrorLog(this.Text, "新增卒中健康随访患者:\r\n" + ex);
// }
//}
/// <summary>
/// 数据有效性验证
/// </summary>
private bool DataVerification()
{
//所填数据值校验
//姓名
if (string.IsNullOrEmpty(textBox_name.Text + ""))
{
XtraMessageBox.Show("姓名不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox_name.Focus();
return false;
}
int age = PublicClass.ToInt32(textBox_age.Text, 0);
if (age < 0 || age > 250)
{
XtraMessageBox.Show("请正确填写年龄取值范围为0-250", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox_age.Focus();
return false;
}
return true;
}
/// <summary>
/// 窗体加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Form_AddFollowUpPatient_Load(object sender, EventArgs e)
{
try
{
bind();
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "新建健康档案页面绑定数据源:\r\n" + ex);
}
}
/// <summary>
/// 绑定数据
/// </summary>
public void bind()
{
//BeginInvoke(new ThreadStart(delegate ()
//{
//界面加载完毕 读取数据并且绑定控件
if (PatientGUID != null)
{
/* DataTable dt2 = DBHelpClass.Get(string.Format("api/service/T_Service_Patient/GetProvince?guid={0}", PatientGUID));
if (dt2 != null && dt2.Rows.Count > 0)
{
//发病省
lookUp_Province.EditValue = dt2.Rows[0]["Province"].ToString();
//发病市
lookUp_City.EditValue = dt2.Rows[0]["City"].ToString();
//发病县
lookUp_Area.EditValue = dt2.Rows[0]["Area"].ToString();
}*/
string Url = string.Format("api/service/T_Service_Patient/GetBypatientguid?guid={0}", PatientGUID);
T_Service_PatientDTO tsp = DBHelpClass.GetDateModel<T_Service_PatientDTO>(Url);
DataTable dataTable = DBHelpClass.Get(string.Format("api/service/T_Service_Apoplexy_Prehospital/GetByPatientGuidAndReportType?patientGuid={0}", PatientGUID));
//DBHelpClass.Get(string.Format("api/service/T_Service_Apoplexy_Prehospital/GetOfPatient?guid={0}", PatientGUID));
if (tsp.Name != null)
{
textBox_name.Text = tsp.Name.ToString();
}
radioGroup_Gender.EditValue = tsp.Gender;
textBox_age.Text = tsp.Age.ToString();
if (tsp.AdmissionNumber != null)
{
textBox_patientnum.Text = tsp.AdmissionNumber.ToString();
}
if (tsp.HospitalizationTime != null)
{
timeControl_admissiontime.TimeValue = tsp.HospitalizationTime.ToString();
}
}
//}));
}
/// <summary>
/// 选择卒中患者新建健康档案
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//private void simpleButton_select_Click(object sender, EventArgs e)
//{
// Form_SelectApoplexy fsa = new Form_SelectApoplexy();
// fsa.Owner = this;
// fsa.Show();
//}
/// <summary>
/// 选择页面获取patientguid
/// </summary>
/// <param name="guid"></param>
public void method(string guid)
{
PatientGUID = guid;
bind();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
//数据有效性验证
if (!DataVerification())
return;
List<T_Service_Apoplexy_FAHBaseDTO> list = new List<T_Service_Apoplexy_FAHBaseDTO>();
T_Service_Apoplexy_FAHBaseDTO model = new T_Service_Apoplexy_FAHBaseDTO();
string Url = "api/service/T_Service_Apoplexy_FAHBase/ADD";
model.Name = textBox_name.Text;
if (radioGroup_Gender.EditValue != null)
{
model.Sex = radioGroup_Gender.EditValue.ToString();
}
model.Age = textBox_age.Text;
model.PatientNum = textBox_patientnum.Text;
model.BedNum = textBox_bednum.Text;
if (!string.IsNullOrEmpty(timeControl_admissiontime.TimeValue))
{
model.AdmissionDate = Convert.ToDateTime(timeControl_admissiontime.TimeValue);
}
model.CreationDate = DateTime.Now;
if (string.IsNullOrEmpty(PatientGUID))
model.GUID = Guid.NewGuid().ToString();
else
model.GUID = PatientGUID;
model.CreatorID = Information.User.ID;
model.HospitalGuid = Information.Hospital.GUID;
model.DeleteFlag = 0;
model.PatientGUID = PatientGUID;
model.SystemModuleID = "3";
list.Add(model);
ClientFactory<T_Service_Apoplexy_FAHBaseDTO> tsap = new HttpClientFactory<T_Service_Apoplexy_FAHBaseDTO>();
Client<T_Service_Apoplexy_FAHBaseDTO> clts = tsap.VisitFactory();
ListEntity<T_Service_Apoplexy_FAHBaseDTO> s = clts.Post(Url, list);
if (s.Success)
{
MessageBox.Show("创建成功");
Form_FollowUpMain_Apoplexy ffuma;
ffuma = (Form_FollowUpMain_Apoplexy)this.Owner;
ffuma.FillGridListCtrlQuery(1);
this.Close();
}
else
{
MessageBox.Show("创建失败");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "新增卒中健康随访患者:\r\n" + ex);
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
Form_SelectApoplexy fsa = new Form_SelectApoplexy();
fsa.Owner = this;
fsa.Show();
}
}
}