using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using HL_FristAidPlatform_ReadCard;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace HL_FristAidPlatform_EmergencyTriage
{
public partial class Form_EditPatient : XtraForm
{
#region 变量
///
/// 当前患者编号
///
public string Cur_Guid = string.Empty;
///
/// 保存信息后患者所属系统模块编号(修改和新增)
///
public long Cur_PatientSystemModuleID = 0;
///
/// 操作标记 1:新增 2:修改
///
//private int Flag = 1;
///
/// 胸痛院前信息
///
private DataTable Cur_PrehospitalDT = new DataTable();
///
/// 卒中院前信息
///
private DataTable Cur_EMR_PrehospitalDT = new DataTable();
///
/// 当前网络医院
///
private DataTable netWorkHospital = new DataTable();
///
/// 民族
///
private DataTable NationDT;
///
/// 等待窗体
///
private Loading loading = new Loading();
public int Falg = 0;
public string GUID;
#endregion
public Form_EditPatient()
{
InitializeComponent();
}
public Form_EditPatient(string _Cur_PatientGuid, string name, string age, string gender, string phone, string address, string callTime, string chiefComplaint, string medicalHistory, string allergyHistoryme, string note, string toAddress, string callAdress, int flag)
{
InitializeComponent();
Falg = flag;
if (flag == 0)
{
//查询
Cur_Guid = _Cur_PatientGuid;
string Url = string.Format("api/service/T_Service_Patient/GetPatientsInfo?callGuid={0}", Cur_Guid);
DataTable dt = DBHelpClass.GetDataRow(Url);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
GUID= dt.Rows[0]["GUID"].ToString();
txt_Name.Text = dt.Rows[0]["Name"].ToString();
txt_MobilePhone.Text = dt.Rows[0]["Phone"].ToString();
radioGroup_Gender.EditValue = dt.Rows[0]["Gender"].ToString();
txt_Age.Text = dt.Rows[0]["Age"].ToString();
txt_Note.Text = dt.Rows[0]["Note"].ToString();
dateEdit_CallHelpTime.TimeValue = dt.Rows[0]["CallTime"].ToString();
txt_ChiefComplaint.Text = dt.Rows[0]["ChiefComplaint"].ToString();
textEdit_MedicalHistory.Text = dt.Rows[0]["MedicalHistory"].ToString();
textEdit_AllergyHistory.Text = dt.Rows[0]["AllergyHistoryme"].ToString();
txt_ToAddress.Text = dt.Rows[0]["ToAddress"].ToString();
txt_Attack_Address.Text = dt.Rows[0]["CallAddress"].ToString();
txt_Breathe.Text= dt.Rows[0]["Breathing"].ToString();
txt_Pulse.Text = dt.Rows[0]["Pulse"].ToString();
txt_Heart_Rate.Text = dt.Rows[0]["HeartRate"].ToString();
textEdit_Temperature.Text = dt.Rows[0]["Temperature"].ToString();
txt_Blood_Pressure1.Text = dt.Rows[0]["SystolicPressure"].ToString();
txt_Blood_Pressure2.Text = dt.Rows[0]["DiastolicPressure"].ToString();
memo_DiseaseRecord.Text= dt.Rows[0]["DisposalRecord"].ToString();
}
}
}
else
{
GUID = "";
Cur_Guid = _Cur_PatientGuid;
txt_Name.Text = name;
txt_MobilePhone.Text = phone;
radioGroup_Gender.EditValue = gender;
txt_Age.Text = age;
txt_Note.Text = note;
dateEdit_CallHelpTime.TimeValue = callTime;
//textEdit_MedicalHistory.Text = medicalHistory;
//textEdit_AllergyHistory.Text = allergyHistoryme;
txt_ChiefComplaint.Text = chiefComplaint;
txt_ToAddress.Text = toAddress;
txt_Attack_Address.Text = callAdress;
}
}
///
/// 窗体加载
///
///
///
private void Form_EditPatient_Load(object sender, EventArgs e)
{
date_RegisterTime.Text = DateTime.Now.ToString();
BindData();
#region 控件初始化
comboBox_AgeUnit.SelectedIndex = 0;
radioGroup_NHourAgo.SelectedIndex = -1;
#endregion
}
#region 绑定数据
///
/// 绑定数据
///
private void BindData()
{
BindSystemModule();
BindGender();
BindNation();
BindDiseaseTemplate();
//BindDetail();
}
///
/// 绑定性别
///
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);
}
}
///
/// 绑定民族
///
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);
}
}
///
/// 绑定标签卡
///
/// 状态-1:全部0:空闲1:使用中2:维护中
private void BindWristStrap(int state)
{
//try
//{
// string Url = string.Format("/api/base/T_Base_WristStrap?status={0}&deleteFlag=0", state);
// DataTable WristStrapDT = DBHelpClass.Get(Url);
// PublicClass.SetLookUpList(LUEdit_WristStrap, WristStrapDT,"id", "Alias", true, "请选择");
//}
//catch (Exception ex)
//{
// PublicClass.WriteErrorLog(this.Text, "绑定标签卡:\r\n" + ex);
//}
}
///
/// 绑定所属系统模块
///
private void BindSystemModule()
{
try
{
string Url = string.Format("/api/admin/T_SYS_SystemModule/GetRightListByHospitalID?hospitalID={0}&isHaveTimeAxis=0", Information.Hospital.ID);
DataTable ResultDT = DBHelpClass.Get(Url);
if (ResultDT != null && ResultDT.Rows.Count > 0)
{
DataTable BindData = new DataTable();
BindData.Columns.Add("ID", Type.GetType("System.String"));
BindData.Columns.Add("SystemName", Type.GetType("System.String"));
BindData.Columns.Add("IconData", Type.GetType("System.Byte[]"));
foreach (DataRow item in ResultDT.Rows)
{
DataRow newRow = BindData.NewRow();
newRow["ID"] = item["ID"];
newRow["SystemName"] = item["ShortName"] + "患者";
if (!string.IsNullOrEmpty(PublicClass.ToString(item["IconData"], "")))
{
newRow["IconData"] = Convert.FromBase64String(item["IconData"].ToString());
}
else
{
newRow["IconData"] = null;
}
BindData.Rows.Add(newRow);
}
listBox_SystemModule.DataSource = BindData;
listBox_SystemModule.ValueMember = "ID";
listBox_SystemModule.DisplayMember = "SystemName";
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定所属系统模块:\r\n" + ex);
}
}
///
/// 绑定当前院区空闲的急救车
///
/// 急救车状态-1、全部,1、空闲,2、出车中,3、维修中,4、已报废
private void BindAmbulance(int state)
{
//try
//{
// string Url = string.Format("/api/base/T_Base_Ambulance/GetListForState?state={0}&hospitalGuid={1}", state, Information.Hospital.GUID);
// DataTable ResultDT = DBHelpClass.Get(Url);
// PublicClass.SetLookUpList(ref lookUpEdit_Ambulance, ResultDT, 5, 9, true, "请选择");
//}
//catch (Exception ex)
//{
// PublicClass.WriteErrorLog(this.Text, "绑定当前院区空闲的急救车:\r\n" + ex);
//}
}
///
/// 绑定病情评估
///
private void BindDiseaseTemplate()
{
try
{
string keyWord = search_DiseaseTemplateKey.Text;
DataTable BindDT = DBHelpClass.Get(string.Format("/api/base/T_Base_DiseaseTemplate?type=0&keyWord={0}", keyWord));
PublicClass.BindCheckedListBoxControlDataSource(checkedListBox_DiseaseTemplate, BindDT, "Content", "ID");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定病情评估:\r\n" + ex);
}
}
#endregion
///
/// 出生日期填写
///
///
///
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();
comboBox_AgeUnit.SelectedIndex = ageUnit;
}
}
///
/// 输入年龄
///
///
///
private void txt_Age_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
DateOfBirth();
}
}
///
/// 年龄单位
///
///
///
private void comboBox_AgeUnit_SelectedIndexChanged(object sender, EventArgs e)
{
DateOfBirth();
}
///
/// 计算出生日期
///
private void DateOfBirth()
{
int age = PublicClass.ToInt32(txt_Age.Text, 0);
if (age > 0 && age < 200)
{
dateEdit_Birthday.TimeValue = PublicClass.GetBirthday(age, comboBox_AgeUnit.SelectedIndex);
}
}
///
/// 暂存档案
///
///
///
private void btn_SavePatient_Click(object sender, EventArgs e)
{
try
{
#region 保存信息
//验证
if (!DataVerification())
return;
string Url = string.Empty;
#region
List list = new List();
T_Service_FirstAid_CallDTO model = new T_Service_FirstAid_CallDTO();
if (!string.IsNullOrEmpty(Cur_Guid))
{
Url = "api/service/T_Service_FirstAid_Call/Update";
model.GUID = Cur_Guid;
}
else
{
Url = "api/service/T_Service_FirstAid_Call";
model.GUID = Guid.NewGuid().ToString();
}
model.Attack_Address = txt_Attack_Address.Text;
model.Name = txt_Name.Text;
model.Gender = int.Parse(radioGroup_Gender.EditValue + "");
model.Age = int.Parse(txt_Age.Text);
model.CallTime = dateEdit_CallHelpTime.TimeValue;
model.Breathe = txt_Breathe.Text;
model.ContactsPhone = txt_MobilePhone.Text;
model.Contacts = "";
model.Identitycard = txt_IDNumber.Text;
model.DiseaseTime = dateEdit_DiseaseTime.TimeValue + "";
model.Conscious = comboBox_Conscious.Text;
model.Note = txt_Note.Text;
model.MedicalHistory = textEdit_MedicalHistory.Text;
model.AllergyHistory = textEdit_AllergyHistory.Text;
model.DeleteFlag = 0;
model.Birthday = dateEdit_Birthday.TimeValue;
model.ChiefComplaint = txt_ChiefComplaint.Text;
model.Nation = lookUpEdit_Nation.EditValue + "";
if (radioButton_PatientLevel_1.Checked)
{
model.Killip = radioButton_PatientLevel_1.Text;
}
if (radioButton_PatientLevel_2.Checked)
{
model.Killip = radioButton_PatientLevel_2.Text;
}
if (radioButton_PatientLevel_3.Checked)
{
model.Killip = radioButton_PatientLevel_3.Text;
}
if (radioButton_PatientLevel_4.Checked)
{
model.Killip = radioButton_PatientLevel_4.Text;
}
if (radioButton_PatientSubarea_1.Checked)
{
model.SignArea = radioButton_PatientSubarea_1.Text;
}
if (radioButton_PatientSubarea_2.Checked)
{
model.SignArea = radioButton_PatientSubarea_2.Text;
}
if (radioButton_PatientSubarea_3.Checked)
{
model.SignArea = radioButton_PatientSubarea_3.Text;
}
string TriageDepartmentText;
string TriageDepartmentValue;
PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl_TriageDepartment, "#", out TriageDepartmentValue, out TriageDepartmentText);
model.TriageDepartment = TriageDepartmentText;
model.SystemModule = int.Parse(listBox_SystemModule.SelectedValue.ToString());
list.Add(model);
//初始化两个工厂
ClientFactory httpClient = new HttpClientFactory();
Client client = httpClient.VisitFactory();
#endregion
if (client.Post(Url, list).Success)
{
XtraMessageBox.Show("保存信息成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
else
{
XtraMessageBox.Show("保存失败,请稍后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endregion
#region
model.Pulse = txt_Pulse.Text;
model.HeartRate = txt_Heart_Rate.Text;
model.SystolicPressure = txt_Blood_Pressure1.Text;
model.DiastolicPressure = txt_Blood_Pressure2.Text;
model.Temperature = textEdit_Temperature.Text;
#endregion
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存信息:\r\n" + ex);
}
}
///
/// 数据有效性验证
///
private bool DataVerification()
{
if (string.IsNullOrEmpty(txt_Name.Text.ToString().Trim()))
{
XtraMessageBox.Show("请填写患者姓名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Name.Focus();
return false;
}
if (PublicClass.ToString(radioGroup_Gender.EditValue, "") == "")
{
XtraMessageBox.Show("请选择患者性别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
radioGroup_Gender.Focus();
return false;
}
if (PublicClass.ToInt32(txt_Age.Text, -1) == -1)
{
XtraMessageBox.Show("请正确填写患者年龄!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Age.Focus();
return false;
}
if (string.IsNullOrEmpty(dateEdit_DiseaseTime.TimeValue))
{
XtraMessageBox.Show("请填写发病时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dateEdit_DiseaseTime.Focus();
return false;
}
if (string.IsNullOrEmpty(dateEdit_CallHelpTime.TimeValue.Trim()))
{
XtraMessageBox.Show("请填写呼救时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dateEdit_CallHelpTime.Focus();
return false;
}
//来院方式
//if (PublicClass.ToInt32(radioGroup_HospitalMode.SelectedIndex, -1) == -1)
//{
// XtraMessageBox.Show("请选择来院方式!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// radioGroup_HospitalMode.Focus();
// return false;
//}
return true;
}
///
/// 读身份证
///
///
///
private void btn_ReadCard_Click(object sender, EventArgs e)
{
try
{
#region 读取身份证
IDCardData cardData = new IDCardData();
var status = IdCardReader.Read(ref cardData);
//PictureBox_Image.Image = null;
switch (status)
{
case 0:
txt_Name.Text = cardData.Name;
radioGroup_Gender.EditValue = cardData.Sex;
DateTime dateTime = Convert.ToDateTime(cardData.Born.Substring(0, 4) + "-" + cardData.Born.Substring(4, 2) + "-" + cardData.Born.Substring(6, 2));
int ageUnit = 1;
txt_Age.Text = PublicClass.GetAge(dateTime, DateTime.Now, out ageUnit).ToString();
comboBox_AgeUnit.SelectedIndex = ageUnit;
lookUpEdit_Nation.Text = NationDT.Select("OrderBy=" + Convert.ToInt32(cardData.Nation))[0]["NationName"] + "";
//table.Rows.Add(dataRow.ItemArray);
//PublicClass.SetLookUpList(ref lookUpEdit_Nation, table, 1, 2, true);
txt_IDNumber.Text = cardData.IDCardNo;
//txt_Address.Text = cardData.Address;
//Bitmap bit = new Bitmap(IdCardReader.GetImgPath(cardData.IDCardNo));
//var newBit = CopyBitmap(bit);
//bit.Dispose();
//PictureBox_Image.Image = Image.FromHbitmap(newBit.GetHbitmap());
break;
default:
//Rt_P.Text = IdCardReader.GetStatusMsg(status);
break;
}
#endregion
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "读取身份证:\r\n" + ex);
}
}
///
/// 确认分诊
///
///
///
private void btn_Save_Click(object sender, EventArgs e)
{
//try
//{
// if (!Verification()) return;
// List list = new List();
// EmergencyTriageDTO emergency = new EmergencyTriageDTO();
// emergency.PatientGUID = GUID;
// emergency.GUID = Cur_Guid;
// emergency.Name = txt_Name.Text;
// emergency.Gender = int.Parse(radioGroup_Gender.EditValue.ToString());
// emergency.Age = int.Parse(txt_Age.Text);
// //登记时间是当前时间
// emergency.RegisterTime = date_RegisterTime.Text;
// switch (comboBox_Credentials_Type.Text.ToString())
// {
// case "无":
// emergency.Credentials_Type = 0;
// break;
// case "身份证":
// emergency.Credentials_Type = 1;
// break;
// case "军官证":
// emergency.Credentials_Type = 2;
// break;
// case "护照":
// emergency.Credentials_Type = 3;
// break;
// }
// emergency.IdentityCard = txt_IDNumber.Text;
// emergency.ContactsPhone = txt_MobilePhone.Text;
// emergency.Nation = lookUpEdit_Nation.Text == "请选择" ? "" : lookUpEdit_Nation.Text;
// emergency.Attack_Address = txt_Attack_Address.Text;
// emergency.Note = txt_Note.Text;
// emergency.Attack_Time = dateEdit_DiseaseTime.TimeValue;
// emergency.CallTime = dateEdit_CallHelpTime.TimeValue;
// emergency.Birthday = dateEdit_Birthday.Text;
// emergency.TransportAddress = txt_ToAddress.Text;
// emergency.Mind = comboBox_Conscious.Text;
// emergency.Breathing = txt_Breathe.Text;
// emergency.Pulse = txt_Pulse.Text;
// emergency.HeartRate = txt_Heart_Rate.Text;
// emergency.Temperature = textEdit_Temperature.Text;
// emergency.SystolicPressure = txt_Blood_Pressure1.Text;
// emergency.DiastolicPressure = txt_Blood_Pressure2.Text;
// emergency.MedicalHistory = textEdit_MedicalHistory.Text;
// emergency.AllergyHistory = textEdit_AllergyHistory.Text;
// emergency.ChiefComplaint = txt_ChiefComplaint.Text;
// if (radioButton_PatientLevel_1.Checked)
// {
// emergency.Killip = "I 级(急危病人)";
// }
// if (radioButton_PatientLevel_2.Checked)
// {
// emergency.Killip = "Ⅱ 级(急危病人)";
// }
// if (radioButton_PatientLevel_3.Checked)
// {
// emergency.Killip = "Ⅲ 级(急危病人)";
// }
// if (radioButton_PatientLevel_4.Checked)
// {
// emergency.Killip = "Ⅳ 级(急危病人)";
// }
// if (radioButton_PatientSubarea_1.Checked)
// {
// emergency.SignArea = "红区";
// }
// if (radioButton_PatientSubarea_2.Checked)
// {
// emergency.SignArea = "黄区";
// }
// if (radioButton_PatientSubarea_3.Checked)
// {
// emergency.SignArea = "绿区";
// }
// emergency.TriageDepartment = checkedListBoxControl_TriageDepartment.GetItemValue(checkedListBoxControl_TriageDepartment.SelectedIndex).ToString();
// emergency.ParentGUID = Guid.NewGuid().ToString();
// emergency.SystemModelId = int.Parse(listBox_SystemModule.SelectedValue.ToString());
// emergency.CreatorID = Information.User.ID;
// emergency.Creator = Information.User.FullName;
// emergency.Attack_Zone = radioGroup1.SelectedIndex.ToString();
// list.Add(emergency);
// string Url = string.Empty;
// Url = "api/service/FristAidTran/EmergencyTriageTran";
// //初始化两个工厂
// ClientFactory httpClient = new HttpClientFactory();
// Client client = httpClient.VisitFactory();
// if (client.Post(Url, list).Success)
// {
// XtraMessageBox.Show("分诊成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// Form_EmergencyMain f1;
// f1 = (Form_EmergencyMain)this.Owner;
// f1.Refresh_Method();
// this.Close();
// }
// #region
// //#region 更改出车人员状态
// //string pgeronnel = PatientDT.Rows[0]["AccompanyinPgersonnel"] + "";
// //if (pgeronnel.Length > 0)
// //{
// // string[] pList = pgeronnel.Split(',');
// // foreach (var itme in pList)
// // {
// // string str_GUID = itme;
// // //初始化两个工厂
// // ClientFactory httpClientPersonnel = new HttpClientFactory();
// // Client clientPersonnel = httpClientPersonnel.VisitFactory();
// // //访问
// // clientPersonnel.BatchPost(str_GUID, "api/service/T_Service_FistAid_Personnel/UpdateState");
// // }
// //}
// //#endregion
// //#region 更改车辆状态
// //List listAmbulance = new List();
// //T_Base_AmbulanceDTO modelAmbulance = new T_Base_AmbulanceDTO();
// //modelAmbulance.GUID = PatientDT.Rows[0]["VehicleNumber"] + "";
// //modelAmbulance.State = 1;
// //modelAmbulance.CreationDate = PublicClass.DateTimeNow();
// //listAmbulance.Add(modelAmbulance);
// ////初始化两个工厂
// //ClientFactory httpClientAmbulance = new HttpClientFactory();
// //Client clientAmbulance = httpClientAmbulance.VisitFactory();
// ////访问
// //clientAmbulance.Post("api/base/T_Base_Ambulance/UpdateState", listAmbulance);
// //#endregion
// //#region 保存各模块病人相关信息
// ////胸痛中心系统
// //if (Cur_PatientSystemModuleID.ToString() == PublicClassForDataBase.Config10001)
// //{
// // //SaveChestPainInfo(Cur_PatientSystemModuleID);
// //}
// ////卒中中心系统
// //else if (Cur_PatientSystemModuleID.ToString() == PublicClassForDataBase.Config10002)
// //{
// // //SaveApoplexyInfo(Cur_PatientSystemModuleID);
// //}
// ////创伤救治中心系统
// //else if (Cur_PatientSystemModuleID.ToString() == PublicClassForDataBase.Config10003)
// //{
// //}
// ////危重孕产妇救治中心系统
// //else if (Cur_PatientSystemModuleID.ToString() == PublicClassForDataBase.Config10004)
// //{
// //}
// ////危重新生儿救治中心系统
// //else if (Cur_PatientSystemModuleID.ToString() == PublicClassForDataBase.Config10005)
// //{
// //}
// //#endregion
// #endregion
// //XtraMessageBox.Show("分诊成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
//}
//catch (Exception ex)
//{
// PublicClass.WriteErrorLog(this.Text, "保存信息:\r\n" + ex);
//}
}
///
/// 验证
///
///
public bool Verification()
{
if (!string.IsNullOrEmpty(txt_MobilePhone.Text) && !Regex.IsMatch(txt_MobilePhone.Text.ToString(), @"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$"))
{
XtraMessageBox.Show("联系人电话不合法", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_MobilePhone.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Age.Text) && !Regex.IsMatch(txt_Age.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("年龄不能为空且必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Age.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_IDNumber.Text) && !Regex.IsMatch(txt_IDNumber.Text.ToString(), @"^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$"))
{
XtraMessageBox.Show("身份证不合法", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_IDNumber.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Pulse.Text) && !Regex.IsMatch(txt_Pulse.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("脉搏值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Pulse.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Breathe.Text) && !Regex.IsMatch(txt_Breathe.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("呼吸值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Breathe.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Pulse.Text) && !Regex.IsMatch(txt_Pulse.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("脉搏值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Breathe.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Heart_Rate.Text) && !Regex.IsMatch(txt_Heart_Rate.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("心率值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Heart_Rate.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Blood_Pressure1.Text) && !Regex.IsMatch(txt_Blood_Pressure1.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("收缩压值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Blood_Pressure1.Focus();
return false;
}
if (!string.IsNullOrEmpty(txt_Blood_Pressure2.Text) && !Regex.IsMatch(txt_Blood_Pressure2.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("舒张压值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_Blood_Pressure2.Focus();
return false;
}
if (!string.IsNullOrEmpty(textEdit_Temperature.Text) && !Regex.IsMatch(textEdit_Temperature.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
{
XtraMessageBox.Show("体温值必须是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textEdit_Temperature.Focus();
return false;
}
return true;
}
///
/// 启动绿色通道
///
///
///
private void btn_PulseOn_Click(object sender, EventArgs e)
{
}
///
/// 无法精确
///
///
///
private void checkEdit_TimeOfOnset_CheckedChanged(object sender, EventArgs e)
{
label_DiseaseTime.Text = "发病日期:";
//只显示日期
dateEdit_DiseaseTime.FormatString_Date = TimeControl.DateFormat.yyyyMMdd;
dateEdit_Birthday.defaultBoolean = DevExpress.Utils.DefaultBoolean.False;
string TimeValue = dateEdit_DiseaseTime.TimeValue;
if (!string.IsNullOrEmpty(TimeValue))
{
dateEdit_DiseaseTime.TimeValue = Convert.ToDateTime(TimeValue).ToShortDateString();
}
label_DiseaseTime.Text = "发病时间:";
dateEdit_DiseaseTime.FormatString_Date = TimeControl.DateFormat.yyyyMMddHHmm;
dateEdit_DiseaseTime.FormatString_Time = TimeControl.TimeFormat.HHmm;
dateEdit_Birthday.defaultBoolean = DevExpress.Utils.DefaultBoolean.True;
radioGroup_NHourAgo_SelectedIndexChanged(null, null);
}
///
/// N小时前
///
///
///
private void radioGroup_NHourAgo_SelectedIndexChanged(object sender, EventArgs e)
{
//0.5H
if (radioGroup_NHourAgo.SelectedIndex == 0)
{
dateEdit_DiseaseTime.TimeValue = DateTime.Now.AddMinutes(-30).ToString();
}
//1H
else if (radioGroup_NHourAgo.SelectedIndex == 1)
{
string AddHours = DateTime.Now.AddHours(-1).ToString();
dateEdit_DiseaseTime.TimeValue = DateTime.Now.AddHours(-1).ToString();
}
//3H
else if (radioGroup_NHourAgo.SelectedIndex == 2)
{
dateEdit_DiseaseTime.TimeValue = DateTime.Now.AddHours(-3).ToString();
}
//6H
else if (radioGroup_NHourAgo.SelectedIndex == 3)
{
dateEdit_DiseaseTime.TimeValue = DateTime.Now.AddHours(-6).ToString();
}
else
{
dateEdit_DiseaseTime.TimeValue = DateTime.Now.ToString();
}
}
///
/// I 级(急危病人)
///
///
///
private void radioButton_PatientLevel_1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_PatientLevel_1.Checked)
{
radioButton_PatientSubarea_1.Checked = true;
}
}
///
/// Ⅱ 级(急重病人)
///
///
///
private void radioButton_PatientLevel_2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_PatientLevel_2.Checked)
{
radioButton_PatientSubarea_1.Checked = true;
}
}
///
/// Ⅲ 级(急症病人)
///
///
///
private void radioButton_PatientLevel_3_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_PatientLevel_3.Checked)
{
radioButton_PatientSubarea_2.Checked = true;
}
}
///
/// Ⅳ 级(非急症病人)
///
///
///
private void radioButton_PatientLevel_4_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_PatientLevel_4.Checked)
{
radioButton_PatientSubarea_3.Checked = true;
}
}
///
/// 模板关键词
///
///
///
private void search_DiseaseTemplateKey_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
BindDiseaseTemplate();
}
}
///
/// 选择模板
///
///
///
private void checkedListBox_DiseaseTemplate_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
{
//病情模板选项值#分割 多选
string DiseaseTemplate = "";
string DiseaseTemplateText = "";
PublicClass.GetCheckedListBoxItemValues(checkedListBox_DiseaseTemplate, "#", out DiseaseTemplate, out DiseaseTemplateText);
txt_ChiefComplaint.Tag = DiseaseTemplate;
txt_ChiefComplaint.Text = DiseaseTemplateText;
}
private void Form_EditPatient_FormClosed(object sender, FormClosedEventArgs e)
{
this.Dispose();
}
//private void listBox_SystemModule_SelectedValueChanged(object sender, EventArgs e)
//{
// DataRowView row = (DataRowView)listBox_SystemModule.SelectedItem;
// string selectDisplayName = row.Row[0].ToString();
//}
}
}