using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Apoplexy
{
public partial class UserControl_PreHospital : UserControl
{
#region 变量
///
/// 编号
///
public string PatientGuid;
///
/// 民族
///
private DataTable NationDT;
///
/// 所属模块ID
///
public int SysMID = 3;
//发病省
public string Province;
//发病市
public string City;
//发病县
public string Area;
//填报状态
public int Status;
public string illnessLevel;
#endregion 变量
///
/// 获取guid
///
///
public UserControl_PreHospital(string guid)
{
InitializeComponent();
PatientGuid = guid;
}
///
/// 窗体加载
///
///
///
private void UserControl_PreHospital_Load(object sender, EventArgs e)
{
GetInfo();
BindProvince(SysMID);//省市县
BindNation();//民族
//职业
PublicClass.SetLookUpList(lookUp_Profession, Enumerate.PublicDictionaryType.职业, true, "请选择");
//文化程度
PublicClass.SetLookUpList(lookUp_Education, Enumerate.PublicDictionaryType.文化程度, true, "请选择");
//婚姻状况
PublicClass.SetLookUpList(lookUp_MaritalStatus, Enumerate.PublicDictionaryType.婚姻状况, true, "请选择");
//T_Service_PatientDTO
string url = string.Format("api/service/T_Service_Patient/GetApoplexyBaseModel?PatientGUID={0}", PatientGuid);
T_Service_PatientApoplexyBaseDTO patientDTO = DBHelpClass.GetDateModel(url);
if (patientDTO != null)
{
txt_Name.Text = patientDTO.Name;
radioGroup_Gender.EditValue = patientDTO.Gender;
illnessLevel = patientDTO.IllnessLevel;
if (illnessLevel == "1")
{
lbl_level1.BackColor = Color.FromArgb(236, 81, 103);
lbl_level1.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
}
if (illnessLevel == "2")
{
lbl_level2.BackColor = Color.FromArgb(237, 111, 132);
lbl_level2.ForeColor = Color.White;
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
}
if (illnessLevel == "3")
{
lbl_level3.BackColor = Color.FromArgb(246, 171, 96);
lbl_level3.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
}
if (illnessLevel == "4")
{
lbl_level4.BackColor = Color.FromArgb(41, 178, 148);
lbl_level4.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
}
if (illnessLevel == "5")
{
lbl_level5.BackColor = Color.FromArgb(166, 165, 165);
lbl_level5.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
}
txt_Age.Text = patientDTO.Age + "";
time_Birthday.TimeValue = patientDTO.Birthday + "";
if (!string.IsNullOrEmpty(patientDTO.IdentityCard + ""))
{
txt_IdentityCard.Text = patientDTO.IdentityCard + "";
time_Birthday.Enabled = false;
txt_Age.Enabled = false;
radioGroup_Gender.Enabled = false;
}
if (!string.IsNullOrEmpty(patientDTO.Nation))
{
lookUp_Nation.EditValue = patientDTO.Nation + "";
}
lookUp_Province.Text = patientDTO.Province + "";
lookUp_City.Text = patientDTO.City + "";
lookUp_Area.Text = patientDTO.Area;
txt_Attack_Address.Text = patientDTO.Attack_Address;
txt_Inpatient_ID.Text = patientDTO.AdmissionNumber + "";
//主要医疗付费方式
if(patientDTO.PaymentMethod=="01")
cmb_PaymentMethod.SelectedIndex = 0;
if (patientDTO.PaymentMethod == "02")
cmb_PaymentMethod.SelectedIndex = 1;
if (patientDTO.PaymentMethod == "03")
cmb_PaymentMethod.SelectedIndex = 2;
if (patientDTO.PaymentMethod == "04")
cmb_PaymentMethod.SelectedIndex = 3;
if (patientDTO.PaymentMethod == "05")
cmb_PaymentMethod.SelectedIndex = 4;
if (patientDTO.PaymentMethod == "06")
cmb_PaymentMethod.SelectedIndex = 5;
if (patientDTO.PaymentMethod == "07")
cmb_PaymentMethod.SelectedIndex = 6;
if (patientDTO.PaymentMethod == "08")
cmb_PaymentMethod.SelectedIndex = 7;
if (patientDTO.PaymentMethod == "99")
cmb_PaymentMethod.SelectedIndex = 8;
timeControl_HospitalizationTime.TimeValue = patientDTO.HospitalizationTime;
textEdit_MobilePhone.Text = patientDTO.MobilePhone + "";
txt_EmergencyContact.Text = patientDTO.EmergencyContact + "";
txt_EmergencyContactPhone.Text = patientDTO.EmergencyContactPhone + "";
txt_Inpatient_ID.Text = patientDTO.AdmissionNumber + "";
//就诊号
txt_VisitNumber.Text = patientDTO.VisitNumber;
//就诊卡号
txt_VisitCardNumber.Text = patientDTO.VisitCardNumber;
//住址
txt_Address.Text = patientDTO.Address + "";
//大病医保
radioGroup_Serious_Disease_Medical_Insurance.EditValue = patientDTO.SeriousIllnessMedical + "";
//医保编号
txt_Medical_Insurance_No.Text = patientDTO.MedicalCardNumber + "";
//职业
lookUp_Profession.EditValue = patientDTO.Profession + "";
//文化程度
lookUp_Education.EditValue = patientDTO.Education + "";
//婚姻状况
lookUp_MaritalStatus.EditValue = patientDTO.MaritalStatus + "";
//标签卡
if (!string.IsNullOrEmpty(patientDTO.WristStrapID+"") &&patientDTO.WristStrapID > 0)
{
lookUp_WristStrap.EditValue = patientDTO.WristStrapID.ToString();
if (!string.IsNullOrEmpty(patientDTO.WristStrapID + "") && patientDTO.WristStrapID + "" != "0")
lookUp_WristStrap.Enabled = false;
}
else
{
BindWristStrap(0);//加载未绑定的标签卡
}
if (!string.IsNullOrEmpty(patientDTO.BCRyType))
{
radioGroup_BCRyType.EditValue = patientDTO.BCRyType + "";
}
if (!string.IsNullOrEmpty(patientDTO.BCLyType))
{
radioGroup_BCLyType.EditValue = patientDTO.BCLyType + "";
}
if (!string.IsNullOrEmpty(patientDTO.BCWyzyType))
{
radioGroup_BCWyzyType.EditValue = patientDTO.BCWyzyType + "";
}
rg_BypassEmergency.EditValue = patientDTO.BypassEmergency + "";
rg_DirectDepartment.EditValue = patientDTO.DirectDepartment + "";
timeControl1.TimeValue = patientDTO.TimeOfOnset + "";
time_CallHelpTime.TimeValue = patientDTO.CallTime + "";
time_SendAmbulanceTime.TimeValue = patientDTO.DepartureTime + "";
time_ArrivalTime.TimeValue = patientDTO.ReachTime + "";
time_LeaveTime.TimeValue = patientDTO.LeaveTime + "";
time_PatientArrivesHospital.TimeValue = patientDTO.ArrivalHospitalTime + "";
}
else
{
lookUp_Province.EditValue = PublicClassForDataBase.Config119;
lookUp_City.EditValue = PublicClassForDataBase.Config120;
lookUp_Area.EditValue = PublicClassForDataBase.Config121;
}
#region 时间节点信息
//string Url = string.Format("api/service/T_Service_Apoplexy_PatientsTimeAxis/GetPatientDetailTime?PatientGuid={0}", PatientGuid);
//DataTable PatientsTimeAxisDT = DBHelpClass.GetJsonText(Url);
//if (PatientsTimeAxisDT != null && PatientsTimeAxisDT.Rows.Count > 0)
//{
// foreach (DataRow item in PatientsTimeAxisDT.Rows)
// {
// //发病时间
// if (item["ID"].ToString() == PublicClassForDataBase.Config6)
// {
// timeControl1.TimeValue = item["RecordingTime"] + "";
// }
// //呼救时间
// if (item["ID"].ToString() == PublicClassForDataBase.Config7)
// {
// time_CallHelpTime.TimeValue = item["RecordingTime"] + "";
// }
// //120出车时间
// if (item["ID"].ToString() == PublicClassForDataBase.Config9)
// {
// time_SendAmbulanceTime.TimeValue = item["RecordingTime"] + "";
// }
// //120到达现场时间
// if (item["ID"].ToString() == PublicClassForDataBase.Config10)
// {
// time_ArrivalTime.TimeValue = item["RecordingTime"] + "";
// }
// //患者到达医院时间
// if (item["ID"].ToString() == PublicClassForDataBase.Config13)
// {
// time_PatientArrivesHospital.TimeValue = item["RecordingTime"] + "";
// }
// }
//}
#endregion 时间节点信息
}
private async Task GetInfo()
{
//lbl_UserName.Text = Information.User.FullName;
BindWristStrap(-1);//所有标签卡
BindOnsetTimeInterval(SysMID);//发病区间
}
#region 提交
public void SavePreHospital()
{
try
{
//验证
if (!DataVerification())
return;
string Url = string.Format("api/service/T_Service_Patient/SaveApoplexyBaseModel");
List list = new List();
T_Service_PatientApoplexyBaseDTO dto = new T_Service_PatientApoplexyBaseDTO();
dto.IllnessLevel = illnessLevel;
//民族
string aNation = PublicClass.ToString(lookUp_Nation.EditValue, "-1");
//发病省
string aProvince = PublicClass.ToString(lookUp_Province.EditValue, "-1");
//发病市
string aCity = PublicClass.ToString(lookUp_City.EditValue, "-1");
//发病县
string aArea = PublicClass.ToString(lookUp_Area.EditValue, "-1");
string aProfession = PublicClass.ToString(lookUp_Profession.EditValue, "-1");
string aMaritalStatus = PublicClass.ToString(lookUp_MaritalStatus.EditValue, "-1");
string aEducation = PublicClass.ToString(lookUp_Education.EditValue, "-1");
dto.EmergencyContact = txt_EmergencyContact.Text;
dto.EmergencyContactPhone = txt_EmergencyContactPhone.Text;
//主要付费方式
if (cmb_PaymentMethod.Text == "城镇职工基本医疗保险")
dto.PaymentMethod = "01";
if (cmb_PaymentMethod.Text == "城镇居民基本医疗保险")
dto.PaymentMethod = "02";
if (cmb_PaymentMethod.Text == "新型农村合作医疗")
dto.PaymentMethod = "03";
if (cmb_PaymentMethod.Text == "贫困救助")
dto.PaymentMethod = "04";
if (cmb_PaymentMethod.Text == "商业医疗保险")
dto.PaymentMethod = "05";
if (cmb_PaymentMethod.Text == "全公费")
dto.PaymentMethod = "06";
if (cmb_PaymentMethod.Text == "全自费")
dto.PaymentMethod = "07";
if (cmb_PaymentMethod.Text == "其他社会保险")
dto.PaymentMethod = "08";
if (cmb_PaymentMethod.Text == "其他")
dto.PaymentMethod = "99";
dto.GUID = PatientGuid;
#region 保存患者信息
dto.IdentityCard = txt_IdentityCard.Text.Trim();
//姓名 aName
dto.Name = txt_Name.Text.Trim();
//性别 aSex
if (radioGroup_Gender.SelectedIndex > -1)
dto.Gender = int.Parse(radioGroup_Gender.EditValue.ToString());
//年龄
dto.Age = txt_Age.Text.ToInt();
//年龄单位
// phi.Age_Unit = comboBox_Age_Unit.Text.ToString();
//民族 aNation
dto.Nation = aNation == "-1" ? "" : aNation;
//出生日期 aBirthdate
dto.Birthday = time_Birthday.TimeValue.ToString();
//住院时间
dto.HospitalizationTime = timeControl_HospitalizationTime.TimeValue + "";
//住院号
dto.AdmissionNumber = txt_Inpatient_ID.Text.ToString();
//地址
dto.Address = txt_Address.Text.ToString();
//联系电话
dto.MobilePhone = textEdit_MobilePhone.Text.ToString();
//发病地址(省)
//phi.Province = aProvince == "-1" ? "" : aProvince;
dto.Province = lookUp_Province.Text.ToString();
//发病地址(市)
//phi.City = aCity == "-1" ? "" : aCity;
dto.City = lookUp_City.Text.ToString();
//发病地址区(县)
//phi.Area = aArea == "-1" ? "" : aArea;
dto.Area = lookUp_Area.Text.ToString();
//发病详细地址
dto.Attack_Address = txt_Attack_Address.Text.ToString();
//职业
dto.Profession = aProfession == "-1" ? "" : aProfession;
//婚姻状况
dto.MaritalStatus = aMaritalStatus == "-1" ? "" : aMaritalStatus;
//文化程度
dto.Education = aEducation == "-1" ? "" : aEducation;
//就诊号//就诊卡号
dto.VisitNumber = txt_VisitNumber.Text;
dto.VisitCardNumber = txt_VisitCardNumber.Text;
//大病医保
dto.SeriousIllnessMedical = radioGroup_Serious_Disease_Medical_Insurance.EditValue + "";
//医保编号
dto.MedicalCardNumber = txt_Medical_Insurance_No.Text;
//标签卡编号
long WristStrapID = PublicClass.ToInt32(lookUp_WristStrap.EditValue, -1);
dto.WristStrapID = WristStrapID == -1 ? 0 : WristStrapID;
if (radioGroup_BCRyType.SelectedIndex > -1)
{
dto.BCRyType = radioGroup_BCRyType.EditValue + "";
}
if (radioGroup_BCLyType.SelectedIndex > -1)
{
dto.BCLyType = radioGroup_BCLyType.EditValue + "";
}
if (radioGroup_BCWyzyType.SelectedIndex > -1)
{
dto.BCWyzyType = radioGroup_BCWyzyType.EditValue + "";
}
if (rg_BypassEmergency.SelectedIndex > -1)
{
dto.BypassEmergency = rg_BypassEmergency.EditValue + "";
}
if (rg_DirectDepartment.SelectedIndex > -1)
{
dto.DirectDepartment = rg_DirectDepartment.EditValue + "";
}
dto.TimeOfOnset = timeControl1.TimeValue + "";
dto.CallTime = time_CallHelpTime.TimeValue + "";
dto.DepartureTime = time_SendAmbulanceTime.TimeValue + "";
dto.ReachTime = time_ArrivalTime.TimeValue + "";
dto.LeaveTime = time_LeaveTime.TimeValue + "";
dto.ArrivalHospitalTime = time_PatientArrivesHospital.TimeValue + "";
list.Add(dto);
#endregion 保存患者信息
ClientFactory httpClient = new HttpClientFactory();
Client client = httpClient.VisitFactory();
//访问
ListEntity t = client.Post(Url, list);
#region 更新时间节点时间
//if (t.Success)
//{
// //初始化两个工厂
// ClientFactory httpClient_Prehospital = new HttpClientFactory();
// Client client_Prehospital = httpClient_Prehospital.VisitFactory();
// //发病时间 timeControl1
// PublicClassForDataBase.UpdateTime(PatientGuid, timeControl1.TimeValue, PublicClassForDataBase.Config6);
// //呼救时间
// PublicClassForDataBase.UpdateTime(PatientGuid, time_CallHelpTime.TimeValue, PublicClassForDataBase.Config7);
// //120出车时间
// PublicClassForDataBase.UpdateTime(PatientGuid, time_SendAmbulanceTime.TimeValue, PublicClassForDataBase.Config9);
// //120到达现场时间
// PublicClassForDataBase.UpdateTime(PatientGuid, time_ArrivalTime.TimeValue, PublicClassForDataBase.Config10);
// //120离开现场时间
// //PublicClassForDataBase.UpdateTime(PatientGuid, time_LeaveTime.TimeValue, PublicClassForDataBase.Config11);
// //患者到达医院时间
// PublicClassForDataBase.UpdateTime(PatientGuid, time_PatientArrivesHospital.TimeValue, PublicClassForDataBase.Config13);
//}
#endregion 更新时间节点时间
//string Url2 = string.Empty;
//List list1 = new List();
//T_Service_Apoplexy_PrehospitalDTO phi1 = new T_Service_Apoplexy_PrehospitalDTO();
//list1.Add(phi1);
//Url2 = "api/service/T_Service_Apoplexy_Prehospital/Update";
//ClientFactory tsap = new HttpClientFactory();
//Client clts = tsap.VisitFactory();
//ListEntity s = clts.Post(Url2, list1);
if (t.Success)
{
MessageBox.Show("保存成功");
}
// 1.判断控件是否有值,进行新增或者修改操作
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存信息:\r\n" + ex);
}
}
#endregion 提交
#region 绑定方法
///
/// 绑定发病区间
///
/// 所属系统模块
private void BindOnsetTimeInterval(long SysMID)
{
try
{
string Url = string.Format("/api/base/T_Base_IncidenceInterval/GetListBySystemModuleID?systemModuleID={0}", SysMID);
DataTable BindDT = DBHelpClass.Get(Url);
//PublicClass.SetLookUpList(lookUp_Attack_Zone, BindDT, "Value", "Content", true);
}
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(lookUp_Ambulance, ResultDT, "GUID", "PlateNumber", true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定当前院区空闲的急救车:\r\n" + ex);
}
}
///
/// 绑定省
///
private void BindProvince(long SysMID)
{
try
{
string Url = string.Format("/api/base/T_Base_Province/GetList?systemModuleId={0}", SysMID);
DataTable BindDT = DBHelpClass.Get(Url);
PublicClass.SetLookUpList(lookUp_Province, BindDT, "ProvinceCode", "ProvinceName", false, "");
}
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, "");
}
}
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, "");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择市联动县:\r\n" + ex);
}
}
///
/// 绑定护士列表
///
/* private void BindNurse()
{
try
{
DataTable dataTableNurse = DBHelpClass.Get("api/admin/T_SYS_User/GetModelByWhere?where=PositionID=3");
}
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(lookUp_Nation, NationDT, "Value", "NationName", 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(lookUp_WristStrap, WristStrapDT, "ID", "Alias", true, "请选择");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "卒中院前与基本信息页面绑定标签卡:\r\n" + ex);
}
}
///
/// 数据有效性验证
///
private bool DataVerification()
{
//时间逻辑判断
if (!string.IsNullOrEmpty(time_CallHelpTime.TimeValue) && !string.IsNullOrEmpty(time_SendAmbulanceTime.TimeValue) && Convert.ToDateTime(time_CallHelpTime.TimeValue) > Convert.ToDateTime(time_SendAmbulanceTime.TimeValue))
{
XtraMessageBox.Show("保存失败!呼救时间不能晚于120出车时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
if (!string.IsNullOrEmpty(time_ArrivalTime.TimeValue) && !string.IsNullOrEmpty(time_SendAmbulanceTime.TimeValue) && Convert.ToDateTime(time_SendAmbulanceTime.TimeValue) > Convert.ToDateTime(time_ArrivalTime.TimeValue))
{
XtraMessageBox.Show("保存失败!120出车时间不能晚于120到达现场时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
if (!string.IsNullOrEmpty(time_ArrivalTime.TimeValue) && !string.IsNullOrEmpty(time_PatientArrivesHospital.TimeValue) && Convert.ToDateTime(time_ArrivalTime.TimeValue) > Convert.ToDateTime(time_PatientArrivesHospital.TimeValue))
{
XtraMessageBox.Show("保存失败!120到达现场时间不能晚于患者送达时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
if (!string.IsNullOrEmpty(time_PatientArrivesHospital.TimeValue) && !string.IsNullOrEmpty(timeControl_HospitalizationTime.TimeValue) && Convert.ToDateTime(time_PatientArrivesHospital.TimeValue) > Convert.ToDateTime(timeControl_HospitalizationTime.TimeValue))
{
XtraMessageBox.Show("保存失败!患者送达不能晚于住院时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
//请选择 身份证 护照 军官证 其他
//判断身份证号是否合理
string IdentityCard = PublicClass.ToString(txt_IdentityCard.Text, "");
if (!string.IsNullOrEmpty(IdentityCard))
{
if (!PublicClass.CheckChinaIDCardNumberFormat(IdentityCard))
{
XtraMessageBox.Show("请输入正确的身份证号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_IdentityCard.Focus();
return false;
}
}
//联系电话
string EmergencyContactPhone = PublicClass.ToString(textEdit_MobilePhone.Text, "");
if (!string.IsNullOrEmpty(EmergencyContactPhone))
{
if (!PublicClass.CheckPhoneIsAble(EmergencyContactPhone))
{
XtraMessageBox.Show("请输入正确的联系电话!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textEdit_MobilePhone.Focus();
return false;
}
}
if (string.IsNullOrEmpty(timeControl1.TimeValue + ""))
{
XtraMessageBox.Show("发病时间不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
timeControl1.Focus();
return false;
}
else
{
try
{
DateTime.Parse(timeControl1.TimeValue + "");
return true;
}
catch (Exception)
{
XtraMessageBox.Show("请输入正确的发病时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
timeControl1.Focus();
return false;
}
}
return true;
}
private void txt_IdentityCard_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_IdentityCard.Text))
{
try
{
string resulst = txt_IdentityCard.Text.ToString().Trim();
if (resulst.Length == 18)
{
radioGroup_Gender.Enabled = false;
txt_Age.Enabled = false;
time_Birthday.Enabled = false;
long n = 0;
if (long.TryParse(resulst.Remove(17), out n) == false
|| n < Math.Pow(10, 16) || long.TryParse(resulst.Replace('x', '0').Replace('X', '0'), out n) == false)
{
lbl_IdentityCard.Visible = true;
}
string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
if (address.IndexOf(resulst.Remove(2)) == -1)
{
lbl_IdentityCard.Visible = true;
}
string birth = resulst.Substring(6, 8).Insert(6, "-").Insert(4, "-");
DateTime time = new DateTime();
if (DateTime.TryParse(birth, out time) == false)
{
lbl_IdentityCard.Visible = true;
}
//string[] arrVarifyCode = ("1,0,x,9,8,7,6,5,4,3,2").Split(',');
//int y = -1;
//if (arrVarifyCode[y] != resulst.Substring(17, 1).ToLower())
//{
// lbl_IdentityCard.Visible = true;
//}
string year = resulst.Substring(6, 4);
string month = resulst.Substring(10, 2);
string day = resulst.Substring(12, 2);
time_Birthday.TimeValue = year + "-" + month + "-" + day;
//性别
int sex = Convert.ToInt32(resulst.Substring(resulst.Length - 2, 1));
if (sex % 2 == 0)
radioGroup_Gender.EditValue = "2";
else if (sex % 2 == 1)
radioGroup_Gender.EditValue = "1";
else
radioGroup_Gender.EditValue = "0";
if (!PublicClass.CheckChinaIDCardNumberFormat(resulst))
{
lbl_IdentityCard.Visible = true;
}
else
{
lbl_IdentityCard.Visible = false;
}
}
else
{
radioGroup_Gender.Enabled = true;
txt_Age.Enabled = true;
time_Birthday.Enabled = true;
lbl_IdentityCard.Visible = true;
}
}
catch (Exception ex)
{
radioGroup_Gender.Enabled = true;
txt_Age.Enabled = true;
time_Birthday.Enabled = true;
lbl_IdentityCard.Visible = true;
return;
}
}
else
{
lbl_IdentityCard.Visible = false;
time_Birthday.TimeValue = "";
radioGroup_Gender.EditValue = -1;
txt_Age.Text = "";
}
}
private void time_Birthday_TimeValueChanged(object sender, EventArgs e)
{
if (PublicClass.ToString(time_Birthday.TimeValue, "") != "")
{
DateTime Birthday = Convert.ToDateTime(time_Birthday.TimeValue);
int ageUnit = 0;
int age = PublicClass.GetAge(Birthday, DateTime.Now, out ageUnit);
txt_Age.Text = age.ToString();
}
}
private void textEdit_MobilePhone_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textEdit_MobilePhone.Text))
{
if (Regex.IsMatch(textEdit_MobilePhone.Text, @"^(0\d{2,3})?(\d{7,8})$") || Regex.IsMatch(textEdit_MobilePhone.Text, @"^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$"))
{
lbl_MobilePhone.Visible = false;
}
else
{
lbl_MobilePhone.Visible = true;
}
}
}
private void lbl_level1_Click(object sender, EventArgs e)
{
lbl_level1.BackColor = Color.FromArgb(236, 81, 103);
lbl_level1.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
illnessLevel = "1";
}
private void lbl_level2_Click(object sender, EventArgs e)
{
lbl_level2.BackColor = Color.FromArgb(237, 111, 132);
lbl_level2.ForeColor = Color.White;
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
illnessLevel = "2";
}
private void lbl_level3_Click(object sender, EventArgs e)
{
lbl_level3.BackColor = Color.FromArgb(246, 171, 96);
lbl_level3.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
illnessLevel = "3";
}
private void lbl_level4_Click(object sender, EventArgs e)
{
lbl_level4.BackColor = Color.FromArgb(41, 178, 148);
lbl_level4.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level5.BackColor = Color.FromArgb(221, 221, 221);
lbl_level5.ForeColor = Color.FromArgb(40, 40, 40);
illnessLevel = "4";
}
private void lbl_level5_Click(object sender, EventArgs e)
{
lbl_level5.BackColor = Color.FromArgb(166, 165, 165);
lbl_level5.ForeColor = Color.White;
lbl_level2.BackColor = Color.FromArgb(221, 221, 221);
lbl_level2.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level3.BackColor = Color.FromArgb(221, 221, 221);
lbl_level3.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level4.BackColor = Color.FromArgb(221, 221, 221);
lbl_level4.ForeColor = Color.FromArgb(40, 40, 40);
lbl_level1.BackColor = Color.FromArgb(221, 221, 221);
lbl_level1.ForeColor = Color.FromArgb(40, 40, 40);
illnessLevel = "5";
}
private void txt_EmergencyContactPhone_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_EmergencyContactPhone.Text))
{
if (Regex.IsMatch(txt_EmergencyContactPhone.Text, @"^(0\d{2,3})?(\d{7,8})$") || Regex.IsMatch(txt_EmergencyContactPhone.Text, @"^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$"))
{
lbl_phone1.Visible = false;
}
else
{
lbl_phone1.Visible = true;
}
}
}
//timeControl1_TimeValueChanged
//timeControl1_TimeValueChanged
private void timeControl1_TimeValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(timeControl1.TimeValue + "") && !string.IsNullOrEmpty(time_PatientArrivesHospital.TimeValue + ""))
{
labelControl13.Visible = true;
labelControl13.Text = "发病到到院(分钟):" + (Convert.ToDateTime(time_PatientArrivesHospital.TimeValue) - Convert.ToDateTime(timeControl1.TimeValue)).TotalMinutes + "";
}
else
{
labelControl13.Visible = false;
}
}
private void radioGroup_Serious_Disease_Medical_Insurance_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioGroup_Serious_Disease_Medical_Insurance.SelectedIndex == 1)
{
lbl_Medical_Insurance_No.Visible = true;
txt_Medical_Insurance_No.Visible = true;
}
else
{
lbl_Medical_Insurance_No.Visible = false;
txt_Medical_Insurance_No.Visible = false;
}
}
private void radioGroup_BCLyType_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioGroup_BCLyType.EditValue + "" == "1" || radioGroup_BCLyType.EditValue + "" == "2")
{
panelControl2.Visible = true;
}
else
{
panelControl2.Visible = false;
}
if (radioGroup_BCLyType.EditValue + "" == "3")
{
radioGroup_BCWyzyType.Visible = true;
}
else
{
radioGroup_BCWyzyType.Visible = false;
}
}
private void rg_BypassEmergency_SelectedIndexChanged(object sender, EventArgs e)
{
if (rg_BypassEmergency.EditValue + "" == "1")
{
labelControl12.Visible = true;
rg_DirectDepartment.Visible = true;
}
else
{
labelControl12.Visible = false;
rg_DirectDepartment.Visible = false;
}
}
}
#endregion 绑定方法
}