StableVersion4.3/HL_FristAidPlatform_Trauma/Page/UCBaseInfo.cs

757 lines
31 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HL_FristAidPlatform_Public;
using HL_FristAidPlatform_DTO;
using Newtonsoft.Json.Linq;
using DevExpress.XtraEditors;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using DevExpress.XtraEditors.Controls;
using System.Reflection;
namespace HL_FristAidPlatform_Trauma.Page
{
public partial class UCBaseInfo : UserControl
{
public string illnessLevel = "";
public string patientGuid = "";
/// <summary>
/// 文本框历史记录
/// </summary>
private TextBoxRemind remind = null;
public UCBaseInfo(string _patientGuid)
{
InitializeComponent();
patientGuid = _patientGuid;
remind = new TextBoxRemind();
InitTextBoxRemind();
}
private void UCBaseInfo_Load(object sender, EventArgs e)
{
GetEventList();
BindProvince(long.Parse(PublicClassForDataBase.Config10003 + ""));
GetBaseInfo(patientGuid);
}
#region 界面效果
/// <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", 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 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", true, "");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "选择省联动市:\r\n" + ex);
}
}
private void radio_type1_CheckedChanged(object sender, EventArgs e)
{
if (radio_type1.Checked == true)
{
checkList_MPDS.Visible = true;
string Url = string.Format("/api/base/T_Base_MPDS/GetListOfType?type={0}", 1);
DataTable BindDT = DBHelpClass.Get(Url);
checkList_MPDS.DataSource = BindDT;
checkList_MPDS.Height = 50;
this.checkList_MPDS.DisplayMember = "SymptomName";
this.checkList_MPDS.ValueMember = "ID";
}
}
private void radio_type2_CheckedChanged(object sender, EventArgs e)
{
if (radio_type2.Checked == true)
{
checkList_MPDS.Visible = true;
string Url = string.Format("/api/base/T_Base_MPDS/GetListOfType?type={0}", 2);
DataTable BindDT = DBHelpClass.Get(Url);
checkList_MPDS.DataSource = BindDT;
checkList_MPDS.Height = 30;
this.checkList_MPDS.DisplayMember = "SymptomName";
this.checkList_MPDS.ValueMember = "ID";
}
}
private void radio_type3_CheckedChanged(object sender, EventArgs e)
{
checkList_MPDS.Visible = true;
if (radio_type3.Checked == true)
{
string Url = string.Format("/api/base/T_Base_MPDS/GetListOfType?type={0}", 3);
DataTable BindDT = DBHelpClass.Get(Url);
checkList_MPDS.DataSource = BindDT;
checkList_MPDS.Height = 30;
this.checkList_MPDS.DisplayMember = "SymptomName";
this.checkList_MPDS.ValueMember = "ID";
}
}
private void radio_type4_CheckedChanged(object sender, EventArgs e)
{
if (radio_type4.Checked == true)
{
checkList_MPDS.Visible = true;
string Url = string.Format("/api/base/T_Base_MPDS/GetListOfType?type={0}", 4);
DataTable BindDT = DBHelpClass.Get(Url);
checkList_MPDS.DataSource = BindDT;
checkList_MPDS.Height = 130;
this.checkList_MPDS.DisplayMember = "SymptomName";
this.checkList_MPDS.ValueMember = "ID";
}
}
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);
}
}
private void cmb_ComeHosptialWay_SelectedValueChanged(object sender, EventArgs e)
{
switch (cmb_ComeHosptialWay.Text)
{
case "呼叫救护车":
panel_CallHelp.Visible = true;
panel_WYZZ.Visible = false;
panel_ZXYL.Visible = false;
panel_QT.Visible = false;
panel_EarlyWarning.Visible = true;
break;
case "外院转诊":
panel_CallHelp.Visible = false;
panel_WYZZ.Visible = true;
panel_ZXYL.Visible = false;
panel_QT.Visible = false;
panel_EarlyWarning.Visible = false;
break;
case "自行来院":
panel_CallHelp.Visible = false;
panel_WYZZ.Visible = false;
panel_ZXYL.Visible = true;
panel_QT.Visible = false;
panel_EarlyWarning.Visible = false;
break;
case "院内发病":
panel_CallHelp.Visible = false;
panel_WYZZ.Visible = false;
panel_ZXYL.Visible = false;
panel_QT.Visible = false;
break;
case "其他":
panel_CallHelp.Visible = false;
panel_WYZZ.Visible = false;
panel_ZXYL.Visible = false;
panel_QT.Visible = true;
panel_EarlyWarning.Visible = false;
break;
}
}
#endregion
public void GetEventList()
{
List<AccidentInfoDTO> list = DBHelpClass.GetList<AccidentInfoDTO>("/api/base/T_Base_AccidentInfo/GetAccidentInfoClass");
PublicClass.SetLookUpList(look_AccidentInfo, ListToDataTable(list), "ID", "Name", false, "无");
}
public void GetBaseInfo(string patientGuid)
{
TraumaPatientIBasenfoDTO dto;
string url = string.Format("api/service/T_Service_TraumaPatient/GetTraumaPatientInfo?guid={0}", patientGuid);
dto = DBHelpClass.GetDateModel<TraumaPatientIBasenfoDTO>(url);
if (dto != null)
{
txt_name.Text = dto.Name;
if (dto.Gender == 1)
raido_gender.SelectedIndex = 0;
if (dto.Gender == 2)
raido_gender.SelectedIndex = 2;
comboBox_Credentials_Type.Text = dto.Credentials_Type;
look_AccidentInfo.EditValue = dto.EventID;
txt_EventName.Text = dto.EventName;
txt_IdentityCard.Text = dto.IdentityCard;
text_age.Text = dto.Age.ToString();
text_emergencyContact.Text = dto.EmergencyContact;
text_emergencyContactPhone.Text = dto.EmergencyContactPhone;
lookUp_Province.EditValue = dto.ProvinceCode;
lookUp_City.EditValue = dto.CityCode;
lookUp_Area.EditValue = dto.AreaCode;
txt_Address.Text = dto.Address;
txt_AttackAddress.Text = dto.AttackAddress;
if (dto.MPDSType == "1")
radio_type1.Checked = true;
//if (dto.MPDSType == "2")
// radio_type1.Checked = true;
//if (dto.MPDSType == "3")
// radio_type1.Checked = true;
if (dto.MPDSType == "4")
radio_type4.Checked = true;
if (!string.IsNullOrEmpty(dto.IllnessLevel))
{
IllnessLevelEvent(dto.IllnessLevel);
illnessLevel = dto.IllnessLevel;
}
if (!string.IsNullOrEmpty(dto.MPDSType))
checkList_MPDS.Visible = true;
if (!string.IsNullOrEmpty(dto.MPDS))
{
string[] arryMPDS = dto.MPDS.Split(new char[] { ',' });
for (int i = 0; i < arryMPDS.Length; i++)
{
for (int j = 0; j < checkList_MPDS.ItemCount; j++)
{
if (checkList_MPDS.GetItemValue(j).ToString() == arryMPDS[i])
{
checkList_MPDS.SetItemChecked(j, true);
}
}
}
}
radio_receiveDepartment.EditValue = dto.ReceiveDepartment;
if (dto.ReceiveDepartment == "1" && !string.IsNullOrEmpty(time_arriveTime.TimeValue.ToString()))
time_arriveTime.TimeValue = Convert.ToDateTime(dto.ArriveEmergencyTime).ToString("yyyy-MM-dd HH:mm");
if (dto.ReceiveDepartment == "2" && !string.IsNullOrEmpty(time_arriveTime.TimeValue.ToString()))
time_arriveTime.TimeValue = Convert.ToDateTime(dto.ArriveOutpatientTime).ToString("yyyy-MM-dd HH:mm");
txt_attendingDoctor.Text = dto.AttendingDoctor;
txt_attendingNurse.Text = dto.AttendingNurse;
txt_outpatientID.Text = dto.OutpatientID;
// txt_inpatientID.Text = dto.InpatientID;
if (dto.CardType == "1")
com_cardType.SelectedIndex = 0;
if (dto.CardType == "2")
com_cardType.SelectedIndex = 1;
if (dto.CardType == "3")
com_cardType.SelectedIndex = 2;
if (dto.CardType == "4")
com_cardType.SelectedIndex = 3;
if (dto.CardType == "5")
com_cardType.SelectedIndex = 4;
txt_cardNumber.Text = dto.CardNumber;
if (dto.ComeHosptialWay == "1")
{
cmb_ComeHosptialWay.EditValue = "呼叫救护车";
if (dto.AmbulanceType == "1")
cmb_AmbulanceType.EditValue = "120救护车";
if (dto.AmbulanceType == "2")
cmb_AmbulanceType.EditValue = "本院救护车";
if (dto.AmbulanceType == "3")
cmb_AmbulanceType.EditValue = "外院救护车";
txt_followingDoctor.Text = dto.FollowingDoctor;
txt_followingNurse.Text = dto.FollowingNurse;
check_EarlyWarning.Checked = dto.EarlyWarning == "1" ? true : false;
}
if (dto.ComeHosptialWay == "2")
{
cmb_ComeHosptialWay.EditValue = "外院转诊";
txt_HosptialName.Text = dto.HosptialName;
}
if (dto.ComeHosptialWay == "3")
{
cmb_ComeHosptialWay.EditValue = "自行来院";
if (dto.ZXLYComeHosptialWay == "1")
cmb_ZXLYComeHosptialWay.Text = "打车(出租车或网约车)";
if (dto.ZXLYComeHosptialWay == "2")
cmb_ZXLYComeHosptialWay.Text = "自驾车";
if (dto.ZXLYComeHosptialWay == "3")
cmb_ZXLYComeHosptialWay.Text = "公共交通";
if (dto.ZXLYComeHosptialWay == "4")
cmb_ZXLYComeHosptialWay.Text = "警车";
if (dto.ZXLYComeHosptialWay == "5")
cmb_ZXLYComeHosptialWay.Text = "步行";
}
if (dto.ComeHosptialWay == "4")
cmb_ComeHosptialWay.EditValue = "院内发病";
if (dto.ComeHosptialWay == "5")
{
cmb_ComeHosptialWay.EditValue = "其他";
txt_Other.Text = dto.OtherComeHosptialWay;
}
check_CallTraumaTeam.Checked = dto.CallTraumaTeam == "1" ? true : false;
}
}
public void SaveBaseInfo()
{
try
{
TraumaPatientIBasenfoDTO dto = new TraumaPatientIBasenfoDTO();
List<TraumaPatientIBasenfoDTO> list = new List<TraumaPatientIBasenfoDTO>();
dto.GUID = patientGuid;
dto.Name = txt_name.Text.Trim();
dto.Age = text_age.Text == "" ? 0 : int.Parse(text_age.Text);
if (raido_gender.SelectedIndex != -1)
dto.Gender = int.Parse(raido_gender.EditValue.ToString());
dto.IdentityCard = txt_IdentityCard.Text.Trim();
dto.EmergencyContact = text_emergencyContact.Text.Trim();
dto.EmergencyContactPhone = text_emergencyContactPhone.Text.Trim();
dto.Province = lookUp_Province.Text == "请选择" ? "" : lookUp_Province.Text;
dto.City = lookUp_City.Text == "请选择" ? "" : lookUp_City.Text;
dto.Area = lookUp_Area.Text == "请选择" ? "" : lookUp_Area.Text;
dto.Address = txt_Address.Text.Trim();
dto.AttackAddress = txt_AttackAddress.Text.Trim();
dto.Credentials_Type = comboBox_Credentials_Type.Text;
dto.EventID = look_AccidentInfo.EditValue == null ? "" : look_AccidentInfo.EditValue.ToString();
if (radio_type1.Checked == true)
dto.MPDSType = "1";
//if (radio_type2.Checked == true)
// dto.MPDSType = "2";
//if (radio_type3.Checked == true)
// dto.MPDSType = "3";
if (radio_type4.Checked == true)
dto.MPDSType = "4";
if (!string.IsNullOrEmpty(dto.MPDSType))
{
int count = this.checkList_MPDS.CheckedIndices.Count;
var chkIndex = this.checkList_MPDS.CheckedIndices;//获得所有选中行的集合
for (int i = 0; i < count; i++)
{
var sysusers = this.checkList_MPDS.DataSource as DataTable;
var item = sysusers.Rows[chkIndex[i]];
if (!string.IsNullOrEmpty(dto.MPDS))
{
dto.MPDS += ",";
}
dto.MPDS += item["ID"].ToString();
if (!string.IsNullOrEmpty(dto.MPDSContent))
{
dto.MPDSContent += @"、";
}
dto.MPDSContent += item["SymptomName"].ToString();
}
}
dto.IllnessLevel = illnessLevel;
dto.ReceiveDepartment = radio_receiveDepartment.EditValue != null ? radio_receiveDepartment.EditValue.ToString() : "";
if (!string.IsNullOrEmpty(time_arriveTime.TimeValue))
{
if (dto.ReceiveDepartment == "1")
dto.ArriveEmergencyTime = Convert.ToDateTime(time_arriveTime.TimeValue);
if (dto.ReceiveDepartment == "2")
dto.ArriveOutpatientTime = Convert.ToDateTime(time_arriveTime.TimeValue);
}
dto.AttendingDoctor = txt_attendingDoctor.Text.Trim();
dto.AttendingNurse = txt_attendingNurse.Text.Trim();
dto.OutpatientID = txt_outpatientID.Text.Trim();
//dto.InpatientID = txt_inpatientID.Text.Trim();
if (com_cardType.Text == "无")
dto.CardType = "1";
if (com_cardType.Text == "社保卡")
dto.CardType = "2";
if (com_cardType.Text == "农保卡")
dto.CardType = "3";
if (com_cardType.Text == "通用就诊卡")
dto.CardType = "4";
if (com_cardType.Text == "其他")
dto.CardType = "5";
if (!string.IsNullOrEmpty(com_cardType.Text) && com_cardType.Text != "无")
dto.CardNumber = txt_cardNumber.Text.Trim();
if (cmb_ComeHosptialWay.Text == "呼叫救护车")
{
dto.ComeHosptialWay = "1";
if (cmb_AmbulanceType.Text == "120救护车")
dto.AmbulanceType = "1";
if (cmb_AmbulanceType.Text == "本院救护车")
dto.AmbulanceType = "2";
if (cmb_AmbulanceType.Text == "外院救护车")
dto.AmbulanceType = "3";
dto.FollowingDoctor = txt_followingDoctor.Text.Trim();
dto.FollowingNurse = txt_followingNurse.Text.Trim();
dto.EarlyWarning = check_EarlyWarning.Checked == true ? "1" : "0";
}
else if (cmb_ComeHosptialWay.Text == "外院转诊")
{
dto.ComeHosptialWay = "2";
dto.HosptialName = txt_HosptialName.Text;
}
else if (cmb_ComeHosptialWay.Text == "自行来院")
{
dto.ComeHosptialWay = "3";
if (cmb_ZXLYComeHosptialWay.Text == "打车(出租车或网约车)")
dto.ZXLYComeHosptialWay = "1";
if (cmb_ZXLYComeHosptialWay.Text == "自驾车")
dto.ZXLYComeHosptialWay = "2";
if (cmb_ZXLYComeHosptialWay.Text == "公共交通")
dto.ZXLYComeHosptialWay = "3";
if (cmb_ZXLYComeHosptialWay.Text == "警车")
dto.ZXLYComeHosptialWay = "4";
if (cmb_ZXLYComeHosptialWay.Text == "步行")
dto.ZXLYComeHosptialWay = "5";
}
else if (cmb_ComeHosptialWay.Text == "院内发病")
{
dto.ComeHosptialWay = "4";
}
else if (cmb_ComeHosptialWay.Text == "其他")
{
dto.ComeHosptialWay = "5";
dto.OtherComeHosptialWay = txt_Other.Text;
}
dto.CallTraumaTeam = check_CallTraumaTeam.Checked == true ? "1" : "0";
dto.CreatorID = Information.User.ID;
list.Add(dto);
string Url = "api/service/T_Service_TraumaPatient/SaveTraumaPatientBaseInfo";
//初始化两个工厂
ClientFactory<TraumaPatientIBasenfoDTO> httpClient = new HttpClientFactory<TraumaPatientIBasenfoDTO>();
Client<TraumaPatientIBasenfoDTO> client = httpClient.VisitFactory();
//访问
ListEntity<TraumaPatientIBasenfoDTO> t = client.Post(Url, list);
if (t.Success)
{
if (!string.IsNullOrEmpty(t.DataString))
{
if (t.DataString.Contains("Success"))
{
JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
string msg = jo["Msg"].ToString();
if (!string.IsNullOrEmpty(msg))
{
XtraMessageBox.Show(msg);
}
}
else
{
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
XtraMessageBox.Show(msg1);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
catch (Exception e)
{
PublicClass.WriteLog("SaveBaseInfo" + e.Message);
}
}
private void txt_IdentityCard_EditValueChanged(object sender, EventArgs e)
{
if (comboBox_Credentials_Type.Text == "居民身份证")
{
string resulst = txt_IdentityCard.Text.ToString().Trim();
try
{
#region 18位
if (resulst.Length == 18)
{
string brithdaystr = resulst.Substring(6, 8);
int ageUnit = 0;
brithdaystr = DateTime.Parse(string.Format("{0}-{1}-{2}", string.Format("{0}", brithdaystr.Substring(0, 4)), brithdaystr.Substring(4, 2), brithdaystr.Substring(6, 2))).ToString();
text_age.Text = PublicClass.GetAge(Convert.ToDateTime(brithdaystr), DateTime.Now, out ageUnit).ToString();
//性别
int sex = Convert.ToInt32(resulst.Substring(resulst.Length - 2, 1));
if (sex % 2 == 0)
raido_gender.SelectedIndex = 1;
else if (sex % 2 == 1)
raido_gender.SelectedIndex = 0;
raido_gender.Enabled = false;
text_age.Enabled = false;
}
#endregion
if (Regex.IsMatch(resulst, @"[\u4e00-\u9fa5]"))
{
MessageBox.Show("身份证格式错误,不能包含中午字符");
}
}
catch
{
MessageBox.Show("身份证格式错误,加载失败。");
}
}
}
private void com_cardType_SelectedValueChanged(object sender, EventArgs e)
{
if (com_cardType.Text == "无")
{
lbl_idcar.Visible = false;
txt_cardNumber.Visible = false;
}
else
{
lbl_idcar.Visible = true;
txt_cardNumber.Visible = true;
}
}
/// <summary>
/// list转化为table
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="entitys"></param>
/// <returns></returns>
public static DataTable ListToDataTable<T>(List<T> entitys)
{
if (entitys == null || entitys.Count < 1)
{
return new DataTable();
}
Type entityType = entitys[0].GetType();
PropertyInfo[] entityProperties = entityType.GetProperties();
DataTable dt = new DataTable("dt");
for (int i = 0; i < entityProperties.Length; i++)
{
dt.Columns.Add(entityProperties[i].Name);
}
foreach (object entity in entitys)
{
if (entity.GetType() != entityType)
{
throw new Exception("集合元素类型不一致");
}
object[] entityValues = new object[entityProperties.Length];
for (int i = 0; i < entityProperties.Length; i++)
{
entityValues[i] = entityProperties[i].GetValue(entity, null);
}
dt.Rows.Add(entityValues);
}
return dt;
}
private void text_emergencyContactPhone_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(text_emergencyContactPhone.Text))
{
if (Regex.IsMatch(text_emergencyContactPhone.Text, @"^(0\d{2,3})?(\d{7,8})$") || Regex.IsMatch(text_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;
}
}
}
private void InitTextBoxRemind()
{
txt_followingDoctor.Leave += textBox_TextChanged;
txt_followingNurse.Leave += textBox_TextChanged;
txt_HosptialName.Leave += textBox_TextChanged;
txt_attendingDoctor.Leave += textBox_TextChanged;
txt_attendingNurse.Leave += textBox_TextChanged;
txt_Other.Leave += textBox_TextChanged;
txt_AttackAddress.Leave += textBox_TextChanged;
remind.InitAutoCompleteCustomSource(txt_followingDoctor);
remind.InitAutoCompleteCustomSource(txt_followingNurse);
remind.InitAutoCompleteCustomSource(txt_HosptialName);
remind.InitAutoCompleteCustomSource(txt_attendingDoctor);
remind.InitAutoCompleteCustomSource(txt_attendingNurse);
remind.InitAutoCompleteCustomSource(txt_Other);
remind.InitAutoCompleteCustomSource(txt_AttackAddress);
}
private void textBox_TextChanged(object sender, EventArgs e)
{
string text = ((TextBox)sender).Text.Trim();
if (text != "")
{
remind.Remind(text);
InitTextBoxRemind();
}
}
}
/// <summary>
/// 事故分类
/// </summary>
public class AccidentInfoDTO
{
/// <summary>
/// 事故ID
/// </summary>
public int ID { get; set; }
/// <summary>
/// 事故名称
/// </summary>
public string Name { get; set; }
}
}