StableVersion4.3/HL_FristAidPlatform_Critica.../Form_BasicInformation.cs

985 lines
42 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 Microsoft.AspNetCore.SignalR.Client;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HL_FristAidPlatform_CriticalPregnant
{
public partial class Form_BasicInformation : Form
{
public string patintGuid;
public string guidreturned;
public string illnessLevel;
public string msg;
/// <summary>
/// 文本框历史记录
/// </summary>
private TextBoxRemind remind = null;
public HubConnection connection;
public Form_BasicInformation(string guid)
{
InitializeComponent();
SignalRConnection();
remind = new TextBoxRemind();
InitTextBoxRemind();
patintGuid = guid;
}
public async void SignalRConnection()
{
connection = new HubConnectionBuilder().WithUrl(ConfigurationManager.AppSettings["WebApiUrl"] + "signalr/chatHub")
.Build();
await connection.StartAsync();
connection.Closed += async (error) =>
{
await Task.Delay(new Random().Next(0, 5) * 1000);
await connection.StartAsync();
};
}
private void Form_BasicInformation_Load(object sender, EventArgs e)
{
SignalRConnection();
BindProvince(2);
BindNation();
BindGender();
BindWristStrap(-1);
BindHospitalMode(2);
//职业
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/base/T_Base_Network_Hospital/GetListBySystemModuleID?hospitalGuid={0}&systemModuleID={1}", Information.Hospital.GUID, PublicClassForDataBase.Config10001);
//DataTable ResultDT = DBHelpClass.Get(Url);
//PublicClass.SetLookUpList(lookUp_CW_ZY_Trans_Hospital_Name, ResultDT, "GUID", "HospitalName", true, "请选择");
if (!string.IsNullOrEmpty(patintGuid))
{
BindInfo();
}
else
{
lookUp_Province.EditValue = PublicClassForDataBase.Config119;
lookUp_City.EditValue = PublicClassForDataBase.Config120;
lookUp_Area.EditValue = PublicClassForDataBase.Config121;
}
}
#region 界面数据初始花
private void btn_HalfHourAgo_Click(object sender, EventArgs e)
{
time_Attack_Time.TimeValue = DateTime.Now.AddMinutes(-30).ToString();
}
private void btn_AnHourAgo_Click(object sender, EventArgs e)
{
time_Attack_Time.TimeValue = DateTime.Now.AddHours(-1).ToString();
}
private void btn_ThreeHoursAgo_Click(object sender, EventArgs e)
{
time_Attack_Time.TimeValue = DateTime.Now.AddHours(-3).ToString();
}
private void btn_SixHoursAgo_Click(object sender, EventArgs e)
{
time_Attack_Time.TimeValue = DateTime.Now.AddHours(-6).ToString();
}
/// <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 = "2";
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定性别:\r\n" + ex);
}
}
/// <summary>
/// 绑定民族
/// </summary>
private void BindNation()
{
try
{
DataTable 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);
}
}
/// <summary>
/// 绑定省
/// </summary>
private void BindProvince(long systemModuleID)
{
try
{
string Url = string.Format("/api/base/T_Base_Province/GetList?systemModuleId={0}", systemModuleID);
DataTable BindDT = DBHelpClass.Get(Url);
PublicClass.SetLookUpList(lookUp_Province, BindDT, "ProvinceCode", "ProvinceName", true, "");
PublicClass.SetLookUpList(lookUpEdit_NativePlaceProvince, BindDT, "ProvinceCode", "ProvinceName", true, "");
}
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 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 ckb_Category_CheckedChanged(object sender, EventArgs e)
{
try
{
if (ckb_Category.Checked)
{
txt_Name.ReadOnly = true;
txt_Age.ReadOnly = true;
radioGroup_Gender.ReadOnly = true;
txt_Name.Text = PublicClassForDataBase.CreateCategoryName();
txt_Age.Text = "0";
}
else
{
txt_Name.ReadOnly = false;
txt_Age.ReadOnly = false;
radioGroup_Gender.ReadOnly = false;
txt_Name.Text = "";
txt_Age.Text = "";
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "是否三无人员:\r\n" + ex);
}
}
/// <summary>
/// 绑定标签卡
/// </summary>
/// <param name="state">状态-1:全部0:空闲1:使用中2:维护中</param>
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);
}
}
/// <summary>
/// 绑定来院方式
/// </summary>
/// <param name="systemModuleID">所属系统模块</param>
private void BindHospitalMode(long systemModuleID)
{
try
{
DataTable BindDT = DBHelpClass.Get(string.Format("/api/base/T_Base_HospitalMode/GetListBySystemModuleID?systemModuleID={0}&type={1}", systemModuleID, "0"));
PublicClass.BindRadioGroupData(radioGroup_ComeHosptialWay, BindDT, "Content", "Value");
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定来院方式:\r\n" + ex);
}
}
private void radioGroup_HospitalMode_SelectedIndexChanged(object sender, EventArgs e)
{
string hospitalMode = PublicClass.ToString(radioGroup_ComeHosptialWay.EditValue, "");
if (!string.IsNullOrEmpty(hospitalMode))
{
#region 高危孕产妇
//1:呼救120或其它出车 2:转院包含任何医疗机构3:自行来院 4:院内发病
switch (hospitalMode)
{
case "1":
panel_LYFS_Public_HJSJ.Visible = true;
panel_LYFS_ChestPain_ZY.Visible = false;
break;
case "2":
panel_LYFS_Public_HJSJ.Visible = false;
panel_LYFS_ChestPain_ZY.Visible = true;
break;
}
#endregion
}
}
private void txt_Age_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Regex regex = new System.Text.RegularExpressions.Regex("^(-?[0-9]*[.]*[0-9]{0,3})$");
bool b = regex.IsMatch(txt_Age.Text);
if (b == false)
{
XtraMessageBox.Show("年龄只能是数字");
}
else
{
int age = PublicClass.ToInt32(txt_Age.Text, 0);
this.time_Birthday.TimeValue = PublicClass.GetBirthday(age, 0);
}
}
else
{
e.Handled = true;
}
}
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();
}
}
#endregion 界面数据初始花
/// <summary>
/// 获取绑定数据
/// </summary>
public void BindInfo()
{
try
{
Patient_CriticalPregnantDTO model = new Patient_CriticalPregnantDTO();
string url = string.Format("api/service/T_Service_CriticalPregnant_BasicInfo/GetByPatientGUID?patientGuid={0}", patintGuid);
model = DBHelpClass.GetDateModel<Patient_CriticalPregnantDTO>(url);
if (model != null)
{
#region 患者信息表
txt_Name.Text = model.Name;
txt_Age.Text = model.Age.ToString();
ckb_Category.Checked = model.Category == 1 ? true : false;
radioGroup_Gender.EditValue = model.Gender.ToString();
time_Birthday.TimeValue = model.Birthday;
comboBox_Credentials_Type.EditValue = model.Credentials_Type;
if (model.Credentials_Type == "0")
{
comboBox_Credentials_Type.EditValue = "未知";
}
if (model.Credentials_Type == "1")
{
comboBox_Credentials_Type.EditValue = "身份证";
}
if (model.Credentials_Type == "2")
{
comboBox_Credentials_Type.EditValue = "护照";
}
if (model.Credentials_Type == "3")
{
comboBox_Credentials_Type.EditValue = "军官证";
}
txt_IdentityCard.Text = model.IdentityCard;
textEdit_MobilePhone.Text = model.MobilePhone;
lookUp_WristStrap.EditValue = model.WristStrapID.ToString();
if (!string.IsNullOrEmpty(lookUp_WristStrap.Text))
lookUp_WristStrap.Enabled = false;
lookUp_MaritalStatus.EditValue = model.MaritalStatus;
lookUp_Profession.EditValue = model.Profession;
string IllnessLeveltemp = model.IllnessLevel + "";
if (!string.IsNullOrEmpty(IllnessLeveltemp))
{
IllnessLevelEvent(IllnessLeveltemp);
illnessLevel = IllnessLeveltemp;
}
textEdit_Height.Text = model.Height;
textEdit_Weight.Text = model.Weight;
textEdit_OutpatientNumber.Text = model.OutpatientNumber;
textEdit_AdmissionNumber.Text = model.AdmissionNumber;
lookUp_Nation.EditValue = model.Nation;
lookUp_Education.EditValue = model.Education;
txt_EmergencyContactPhone.Text = model.EmergencyContactPhone;
textEdit_EmergencyContact.Text = model.EmergencyContact;
lookUp_Province.Text = model.Province;
lookUp_City.Text = model.City;
lookUp_Area.Text = model.Area;
txt_Attack_Address.Text = model.Attack_Address;
#endregion
#region 孕产妇基本信息表
lookUpEdit_NativePlaceProvince.Text = model.NativePlaceProvince;
lookUpEdit_NativePlaceCity.Text = model.NativePlaceCity;
lookUpEdit_NativePlaceArea.Text = model.NativePlaceArea;
comboBoxEdit_ABOBloodType.EditValue = model.ABOBloodType;
comboBoxEdit_RhBloodType.EditValue = model.RhBloodType;
radioGroup_ComeHosptialWay.EditValue = model.ComeHospitalWay;
time_Attack_Time.TimeValue = model.Attack_Time;
textEdit_GestationalWeeks.Text = model.GestationalWeeks;
timeControl_ExpectedDateOfConfinement.TimeValue = PublicClass.ToDateTime(model.ExpectedDateOfConfinement);
textEdit_BedNumber.Text = model.BedNumber;
textEdit_HusbandName.Text = model.HusbandName;
textEdit_Pathography.Text = model.Pathography;
timeControl_NonsecondaryMenstruation.TimeValue = PublicClass.ToDateTime(model.NonsecondaryMenstruation);
#endregion
#region 孕产妇时间节点信息
string hospitalMode = PublicClass.ToString(radioGroup_ComeHosptialWay.EditValue, "");
if (!string.IsNullOrEmpty(hospitalMode))
{
//1:呼救120或其它出车 2:转院包含任何医疗机构3:自行来院 4:院内发病
switch (hospitalMode)
{
case "1":
radioGroup_Vehicleout_Unit.EditValue = model.Departure;
textBox_OutPatient.Text = model.OutPatient;
time_Help_Time.TimeValue = model.VisitTime;
timeControl_ArriveTime.TimeValue = model.ArriveTime;
timeControl_LeaveTime.TimeValue = model.LeaveTime;
break;
case "2":
radioGroup_Vehicleout_Unit_Transfers.EditValue = model.Departure;
time_Transfer_Time.TimeValue = model.TransferTime;
textBox_OutPatient_Transfers.Text = model.OutPatient;
textBox_Reason.Text = model.TransferReason;
textBox_OutPatient.Text = model.OutPatient;
txt_CW_ZY_office.Text = model.TransferDepartment;
time_Help_Time_Transfers.TimeValue = model.VisitTime;
timeControl_ArriveTime_Transfers.TimeValue = model.ArriveTime;
timeControl_LeaveTime_Transfers.TimeValue = model.LeaveTime;
break;
default:
break;
}
}
textBox_AttendingDoctor.Text = model.AttendingDoctor;
timeControl_AttendingTime.TimeValue = model.AttendingTime;
timeControl_InRescueRoomTime.TimeValue = model.InRescueRoomTime;
timeControl_OutRescueRoomTime.TimeValue = model.OutRescueRoomTime;
#endregion
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(ex.Message);
}
}
public void Save()
{
try
{
#region 验证
if (string.IsNullOrEmpty(time_Attack_Time.TimeValue))
{
time_Attack_Time.Focus();
//return false;
}
if (string.IsNullOrEmpty(txt_Name.Text))
{
lbl_name.Visible = true;
txt_Name.Focus();
//return false;
}
if (!string.IsNullOrEmpty(txt_Age.Text))
{
Regex regex = new System.Text.RegularExpressions.Regex("^(-?[0-9]*[.]*[0-9]{0,3})$");
bool b = regex.IsMatch(txt_Age.Text);
if (b == false)
{
lbl_age.Visible = true;
txt_Age.Focus();
//return false;
}
else
{
lbl_age.Visible = false;
}
}
if (!string.IsNullOrEmpty(txt_EmergencyContactPhone.Text))
{
if (Regex.IsMatch(txt_EmergencyContactPhone.Text, @"^(1)\d{10}$"))
{
lbl_MobilePhone.Visible = false;
}
else
{
lbl_MobilePhone.Visible = true;
}
}
if (!string.IsNullOrEmpty(txt_IdentityCard.Text))
{
try
{
string resulst = txt_IdentityCard.Text.ToString().Trim();
#region 18位
if (resulst.Length == 18)
{
string brithdaystr = resulst.Substring(6, 8);
time_Birthday.TimeValue = DateTime.Parse(string.Format("{0}-{1}-{2}", string.Format("{0}", brithdaystr.Substring(0, 4)), brithdaystr.Substring(4, 2), brithdaystr.Substring(6, 2))).ToString();
//性别
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";
}
#endregion 18位
lbl_IdentityCard.Visible = false;
}
catch
{
lbl_IdentityCard.Visible = true;
//return false;
}
}
#endregion
Patient_CriticalPregnantDTO dto = new Patient_CriticalPregnantDTO();
List<Patient_CriticalPregnantDTO> list = new List<Patient_CriticalPregnantDTO>();
dto.HospitalGuid = Information.Hospital.GUID;
dto.GUID = patintGuid;
if (!string.IsNullOrEmpty(dto.GUID))
{
dto.Editor = Information.User.FullName;
dto.EditorID = Information.User.ID;
}
else
{
dto.CreatorID = Information.User.ID;
dto.Creator = Information.User.FullName;
}
dto.SystemModuleID = Information.SystemModuleInfo.ID;
dto.HospitalGuid = Information.Hospital.GUID;
#region 患者信息表
dto.Name = txt_Name.Text.Trim();
dto.Age = txt_Age.Text != "" ? int.Parse(txt_Age.Text) : 0;
dto.Category = ckb_Category.Checked == true ? 1 : 0;
dto.Gender = int.Parse(radioGroup_Gender.EditValue + "");
dto.Birthday = time_Birthday.TimeValue + "";
//Credentials_Type0:未知 1:身份证 2:护照 3:军官证
switch (comboBox_Credentials_Type.EditValue + "")
{
case "未知":
dto.Credentials_Type = "0";
break;
case "身份证":
dto.Credentials_Type = "1";
break;
case "护照":
dto.Credentials_Type = "2";
break;
case "军官证":
dto.Credentials_Type = "3";
break;
}
dto.IdentityCard = txt_IdentityCard.Text + "";
dto.MobilePhone = textEdit_MobilePhone.Text + "";
dto.WristStrapID = lookUp_WristStrap.EditValue.ToString() == "-1" ? 0 : long.Parse(lookUp_WristStrap.EditValue + "");
dto.MaritalStatus = lookUp_MaritalStatus.EditValue + "";
dto.Profession = lookUp_Profession.EditValue + "";
dto.IllnessLevel = illnessLevel;
dto.Height = textEdit_Height.Text;
dto.Weight = textEdit_Weight.Text;
dto.OutpatientNumber = textEdit_OutpatientNumber.Text;
dto.AdmissionNumber = textEdit_AdmissionNumber.Text;
if (lookUp_Nation.EditValue != null
&& lookUp_Nation.EditValue.ToString() != "-1" && !string.IsNullOrEmpty(lookUp_Nation.EditValue.ToString()))
dto.Nation = lookUp_Nation.EditValue.ToString();
dto.Education = lookUp_Education.EditValue + "";
dto.EmergencyContactPhone = txt_EmergencyContactPhone.Text;
dto.EmergencyContact = textEdit_EmergencyContact.Text;
dto.Province = lookUp_Province.Text + "";
dto.City = lookUp_City.Text + "";
dto.Area = lookUp_Area.Text + "";
dto.Attack_Address = txt_Attack_Address.Text + "";
#endregion
#region 孕产妇基本信息表
dto.NativePlaceProvince = lookUpEdit_NativePlaceProvince.Text;
dto.NativePlaceCity = lookUpEdit_NativePlaceCity.Text;
dto.NativePlaceArea = lookUpEdit_NativePlaceArea.Text;
dto.ABOBloodType = comboBoxEdit_ABOBloodType.EditValue + "";
dto.RhBloodType = comboBoxEdit_RhBloodType.EditValue + "";
dto.ComeHospitalWay = radioGroup_ComeHosptialWay.EditValue + "";
dto.Attack_Time = time_Attack_Time.TimeValue;
dto.GestationalWeeks = textEdit_GestationalWeeks.Text;
dto.ExpectedDateOfConfinement = timeControl_ExpectedDateOfConfinement.TimeValue;
dto.BedNumber = textEdit_BedNumber.Text;
dto.HusbandName = textEdit_HusbandName.Text;
dto.Pathography = textEdit_Pathography.Text;
dto.NonsecondaryMenstruation = timeControl_NonsecondaryMenstruation.TimeValue;
#endregion
#region 孕产妇时间节点信息
string hospitalMode = PublicClass.ToString(radioGroup_ComeHosptialWay.EditValue, "");
if (!string.IsNullOrEmpty(hospitalMode))
{
//1:呼救120或其它出车 2:转院包含任何医疗机构3:自行来院 4:院内发病
switch (hospitalMode)
{
case "1":
dto.Departure = radioGroup_Vehicleout_Unit.EditValue != null ? radioGroup_Vehicleout_Unit.EditValue.ToString() : "";
dto.OutPatient = textBox_OutPatient.Text;
if (!string.IsNullOrEmpty(time_Help_Time.TimeValue))
dto.VisitTime = time_Help_Time.TimeValue + "";
if (!string.IsNullOrEmpty(timeControl_ArriveTime.TimeValue))
dto.ArriveTime = timeControl_ArriveTime.TimeValue + "";
if (!string.IsNullOrEmpty(timeControl_LeaveTime.TimeValue))
dto.LeaveTime = timeControl_LeaveTime.TimeValue + "";
break;
case "2":
dto.Departure = radioGroup_Vehicleout_Unit_Transfers.EditValue != null ? radioGroup_Vehicleout_Unit_Transfers.EditValue.ToString() : "";
if (!string.IsNullOrEmpty(time_Transfer_Time.TimeValue))
dto.TransferTime = time_Transfer_Time.TimeValue + "";
dto.OutPatient = textBox_OutPatient_Transfers.Text;
dto.TransferReason = textBox_Reason.Text;
dto.TransferDepartment = txt_CW_ZY_office.Text;
if (!string.IsNullOrEmpty(time_Help_Time_Transfers.TimeValue))
dto.VisitTime = time_Help_Time_Transfers.TimeValue + "";
if (!string.IsNullOrEmpty(timeControl_ArriveTime_Transfers.TimeValue))
dto.ArriveTime = timeControl_ArriveTime_Transfers.TimeValue + "";
if (!string.IsNullOrEmpty(timeControl_LeaveTime_Transfers.TimeValue))
dto.LeaveTime = timeControl_LeaveTime_Transfers.TimeValue + "";
break;
default:
break;
}
}
dto.AttendingDoctor = textBox_AttendingDoctor.Text;
dto.AttendingTime = timeControl_AttendingTime.TimeValue;
dto.InRescueRoomTime = timeControl_InRescueRoomTime.TimeValue;
dto.OutRescueRoomTime = timeControl_OutRescueRoomTime.TimeValue;
#endregion
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_CriticalPregnant_BasicInfo/AddORUpdateBasicInfo";
//初始化两个工厂
ClientFactory<Patient_CriticalPregnantDTO> httpClient = new HttpClientFactory<Patient_CriticalPregnantDTO>();
Client<Patient_CriticalPregnantDTO> client = httpClient.VisitFactory();
//访问
ListEntity<Patient_CriticalPregnantDTO> t = client.Post(Url, list);
if (t.Success)
{
MessageBox.Show("保存成功");
//JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
//string msg = jo["Msg"].ToString();
//guidreturned = msg.Substring(4);
//if (!string.IsNullOrEmpty(guidreturned + ""))
//{
// if (!string.IsNullOrEmpty(time_Attack_Time.TimeValue))
// PublicClassForDataBase.UpdateTime_ChestPain(guidreturned, time_Attack_Time.TimeValue, PublicClassForDataBase.Config38);
// string comeway = PublicClass.ToString(radioGroup_ComeHosptialWay.EditValue, "");
// foreach (Form frm in Application.OpenForms) //遍历所有打开的窗体!
// {
// if ((Control)frm.ActiveControl != null)
// {
// if (((ControlAccessibleObject)frm.ActiveControl.AccessibilityObject).Name == "胸痛在院患者管理")
// SendMessage("胸痛患者列表刷新");
// }
// break;
// }
//}
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(ex.Message);
}
}
private async void SendMessage(string msg)
{
await connection.InvokeAsync("SendMessageToGroupAsync", Information.Hospital.GUID.ToString(), msg);
}
private void txt_Age_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_Age.Text))
{
Regex regex = new System.Text.RegularExpressions.Regex("^(-?[0-9]*[.]*[0-9]{0,3})$");
bool b = regex.IsMatch(txt_Age.Text);
if (b == false)
{
lbl_age.Visible = true;
}
else
{
lbl_age.Visible = false;
}
}
}
private void txt_Name_EditValueChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txt_Name.Text))
{
lbl_name.Visible = true;
}
else
{
lbl_name.Visible = false;
}
}
private void txt_IdentityCard_EditValueChanged(object sender, EventArgs e)
{
string resulst = txt_IdentityCard.Text.ToString().Trim();
try
{
#region 18位
if (resulst.Length == 18)
{
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 brithdaystr = resulst.Substring(6, 8);
time_Birthday.TimeValue = DateTime.Parse(string.Format("{0}-{1}-{2}", string.Format("{0}", brithdaystr.Substring(0, 4)), brithdaystr.Substring(4, 2), brithdaystr.Substring(6, 2))).ToString();
//性别
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";
radioGroup_Gender.Enabled = false;
txt_Age.Enabled = false;
time_Birthday.Enabled = false;
lbl_IdentityCard.Visible = false;
}
else
{
radioGroup_Gender.Enabled = true;
txt_Age.Enabled = true;
time_Birthday.Enabled = true;
lbl_IdentityCard.Visible = true;
}
#endregion 18位
if (Regex.IsMatch(resulst, @"[\u4e00-\u9fa5]"))
{
radioGroup_Gender.Enabled = true;
txt_Age.Enabled = true;
time_Birthday.Enabled = true;
lbl_IdentityCard.Visible = true;
MessageBox.Show("身份证格式错误,不能包含中文字符");
}
}
catch
{
radioGroup_Gender.Enabled = true;
txt_Age.Enabled = true;
time_Birthday.Enabled = true;
lbl_IdentityCard.Visible = true;
MessageBox.Show("身份证格式错误,加载失败。");
}
}
private void txt_MobilePhone_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_MobilePhone.Visible = false;
}
else
{
lbl_MobilePhone.Visible = true;
}
}
}
#region
/// <summary>
/// 联想输入
/// </summary>
private void InitTextBoxRemind()
{
//txt_CW_ZY_First_Doctor_Name.Leave += textBox_TextChanged;
//txt_CW_ZXLY_First_Doctor_Name.Leave += textBox_TextChanged;
//txt_CW_YNFB_Attack_Department.Leave += textBox_TextChanged;
//txt_CW_YNFB_First_Doctor_Name.Leave += textBox_TextChanged;
//remind.InitAutoCompleteCustomSource(txt_CW_ZY_First_Doctor_Name);
//remind.InitAutoCompleteCustomSource(txt_CW_ZXLY_First_Doctor_Name);
//remind.InitAutoCompleteCustomSource(txt_CW_YNFB_Attack_Department);
//remind.InitAutoCompleteCustomSource(txt_CW_YNFB_First_Doctor_Name);
}
private void textBox_TextChanged(object sender, EventArgs e)
{
string text = ((TextBox)sender).Text.Trim();
if (text != "")
{
remind.Remind(text);
InitTextBoxRemind();
}
}
private void lbl_level1_Click(object sender, EventArgs e)
{
illnessLevel = "1";
IllnessLevelEvent(illnessLevel);
}
private void lbl_level2_Click(object sender, EventArgs e)
{
illnessLevel = "2";
IllnessLevelEvent(illnessLevel);
}
private void lbl_level3_Click(object sender, EventArgs e)
{
illnessLevel = "3";
IllnessLevelEvent(illnessLevel);
}
private void lbl_level4_Click(object sender, EventArgs e)
{
illnessLevel = "4";
IllnessLevelEvent(illnessLevel);
}
private void lbl_level5_Click(object sender, EventArgs e)
{
illnessLevel = "5";
IllnessLevelEvent(illnessLevel);
}
public void IllnessLevelEvent(string value)
{
if (value == "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 (value == "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 (value == "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 (value == "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 (value == "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);
}
}
#endregion
private void lookUpEdit_NativePlaceProvince_EditValueChanged(object sender, EventArgs e)
{
try
{
string ProvinceCode = PublicClass.ToString(lookUpEdit_NativePlaceProvince.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(lookUpEdit_NativePlaceCity, BindDT, "CityCode", "CityName", false, "");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择省联动市:\r\n" + ex);
}
}
private void lookUpEdit_NativePlaceCity_EditValueChanged(object sender, EventArgs e)
{
try
{
string CityCode = PublicClass.ToString(lookUpEdit_NativePlaceCity.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(lookUpEdit_NativePlaceArea, BindDT, "CountyCode", "CountyName", false, "");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择市联动县:\r\n" + ex);
}
}
}
}