489 lines
21 KiB
C#
489 lines
21 KiB
C#
using DevExpress.XtraEditors;
|
|
using HL_FristAidPlatform_DTO;
|
|
using HL_FristAidPlatform_Public;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text.RegularExpressions;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_FollowUp
|
|
{
|
|
public partial class Form_FollowUpDetail_FollowUpBasicInformation : XtraForm
|
|
{
|
|
//患者guid
|
|
private string patientguid;
|
|
private string name;
|
|
private string Gender;
|
|
private string age;
|
|
private string idcard;
|
|
private string contractnum;
|
|
|
|
//系统模块id
|
|
private int SysMID = 3;
|
|
|
|
public Form_FollowUpDetail_FollowUpBasicInformation(string Guid, string _name = "", string _Gender = "", string _age = "", string _idcard = "", string _contractnum = "")
|
|
{
|
|
InitializeComponent();
|
|
patientguid = Guid;
|
|
name = _name;
|
|
if (!string.IsNullOrEmpty(_Gender))
|
|
{
|
|
if (_Gender == "男")
|
|
{
|
|
Gender = "1";
|
|
}else if (_Gender == "女")
|
|
{
|
|
Gender = "2";
|
|
}else
|
|
{
|
|
Gender = "";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Gender = "";
|
|
}
|
|
age = _age;
|
|
idcard = _idcard;
|
|
contractnum = _contractnum;
|
|
}
|
|
|
|
//加载页面绑定数据
|
|
private void Form_FollowUpDetail_FollowUpBasicInformation_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
textBox_Name.Text = name;
|
|
radioGroup_Sex.EditValue = Gender;
|
|
textBox_Age.Text = age;
|
|
textBox_IDCard.Text = idcard;
|
|
textBox_PatientPhone.Text = contractnum;
|
|
|
|
BindProvince(SysMID);//省市县
|
|
DataTable dt2 = DBHelpClass.Get(string.Format("api/service/T_Service_Apoplexy_FAHBase/GetProvince?guid={0}", patientguid));
|
|
if (dt2 != null && dt2.Rows.Count > 0)
|
|
{
|
|
//发病省
|
|
lookUp_Province.EditValue = dt2.Rows[0]["Province"].ToString();
|
|
//发病市
|
|
lookUp_City.EditValue = dt2.Rows[0]["City"].ToString();
|
|
//发病县
|
|
lookUp_Area.EditValue = dt2.Rows[0]["Area"].ToString();
|
|
}
|
|
string Url = string.Format("api/service/T_Service_Apoplexy_FAHBase/GetByPatientGuid1?PatientGuid={0}", patientguid);
|
|
DataTable dt = DBHelpClass.Get(Url);
|
|
//DBHelpClass.GetModel(Url);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
textBox_BedNum.Text = dt.Rows[0]["BedNum"].ToString();
|
|
textBox_Name.Text = dt.Rows[0]["Name"].ToString();
|
|
if (!string.IsNullOrEmpty(dt.Rows[0]["Sex"].ToString()))
|
|
{
|
|
radioGroup_Sex.EditValue = int.Parse(dt.Rows[0]["Sex"].ToString());
|
|
}
|
|
textBox_PatientNum.Text = dt.Rows[0]["PatientNum"].ToString();
|
|
textBox_GroupDif.Text = dt.Rows[0]["GroupDif"].ToString();
|
|
textBox_Age.Text = dt.Rows[0]["Age"].ToString();
|
|
textBox_Height.Text = dt.Rows[0]["Height"].ToString();
|
|
textBox_Weight.Text = dt.Rows[0]["Weight"].ToString();
|
|
timeControl_AdmissionDate.TimeValue = dt.Rows[0]["AdmissionDate"].ToString();
|
|
timeControl_DischargeDate.TimeValue = dt.Rows[0]["DischargeDate"].ToString();
|
|
if (!string.IsNullOrEmpty(dt.Rows[0]["MaritalStatus"].ToString()))
|
|
radioGroup_MaritalStatus.EditValue = dt.Rows[0]["MaritalStatus"].ToString();
|
|
comboBox_MaritalStatus.SelectedIndex = dt.Rows[0]["MaritalStatus"].ToString() == "" ? -1 : dt.Rows[0]["MaritalStatus"].ToInt();
|
|
//来院方式
|
|
//comboBox_ComingWay.SelectedIndex = dt.Rows[0]["BCLyType"].ToString() == "" ? -1 : dt.Rows[0]["BCLyType"].ToInt();
|
|
if (!string.IsNullOrEmpty(dt.Rows[0]["ComingWay"].ToString()))
|
|
radioGroup_ComingWay.EditValue = dt.Rows[0]["ComingWay"].ToString();
|
|
|
|
comboBox_MedicalType.SelectedIndex = dt.Rows[0]["MedicalType"].ToString() == "" ? -1 : int.Parse(dt.Rows[0]["MedicalType"].ToString());
|
|
comboBox_InhospitalWay.SelectedIndex = dt.Rows[0]["InhospitalWay"].ToString() == "" ? -1 : int.Parse(dt.Rows[0]["InhospitalWay"].ToString());
|
|
textBox_ChargeDoctor.Text = dt.Rows[0]["ChargeDoctor"].ToString();
|
|
string Treated = dt.Rows[0]["Treated"].ToString();
|
|
string[] getAry = Treated.Split(';');
|
|
for (int i = 1; i < getAry.Length - 1; i++)
|
|
{
|
|
if (Treated.Contains(getAry[i]))
|
|
{
|
|
for (int j = 0; j < checkedListBoxControl1.ItemCount; j++)
|
|
{
|
|
if (getAry[i].Equals(checkedListBoxControl1.Items[j].Value.ToString()))
|
|
{
|
|
checkedListBoxControl1.SetItemChecked(j, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
string arry = dt.Rows[0]["AdmissionDiagnosis"].ToString();
|
|
string[] getAry1 = arry.Split(';');
|
|
for (int i = 1; i < getAry1.Length - 1; i++)
|
|
{
|
|
if (arry.Contains(getAry1[i]))
|
|
{
|
|
for (int j = 0; j < AdmissionDiagnosis.ItemCount; j++)
|
|
{
|
|
if (getAry1[i].Equals(AdmissionDiagnosis.Items[j].Value.ToString()))
|
|
{
|
|
AdmissionDiagnosis.SetItemChecked(j, true);
|
|
}
|
|
}
|
|
}
|
|
if (arry.Contains("06"))
|
|
{
|
|
lbl_IdentityCard.Visible = true;
|
|
textBox1.Visible = true;
|
|
textBox1.Text = dt.Rows[0]["AdmissionDiagnosisOther"].ToString();
|
|
}
|
|
}
|
|
textBox_PatientPhone.Text = dt.Rows[0]["PatientPhone"].ToString();
|
|
textBox_EmergencyContactPhone.Text = dt.Rows[0]["EmergencyContactPhone"].ToString();
|
|
|
|
|
|
textBox_PatientComplaint.Text = dt.Rows[0]["PatientComplaint"].ToString();
|
|
textBox_IDCard.Text = dt.Rows[0]["IDCard"].ToString();
|
|
textBox_Address.Text = dt.Rows[0]["Address"].ToString();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "卒中健康与随访基础信息页面数据绑定:\r\n" + ex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 绑定省
|
|
/// </summary>
|
|
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, "请选择");
|
|
if (SysMID.ToString() == PublicClassForDataBase.Config10001)
|
|
{
|
|
lookUp_Province.EditValue = PublicClassForDataBase.Config110;
|
|
}
|
|
else
|
|
{
|
|
lookUp_Province.EditValue = PublicClassForDataBase.Config119;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "绑定省:\r\n" + ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 选择省联动市
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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, "请选择");
|
|
|
|
if (SysMID.ToString() == PublicClassForDataBase.Config10001)
|
|
{
|
|
lookUp_City.EditValue = PublicClassForDataBase.Config115;
|
|
}
|
|
else
|
|
{
|
|
lookUp_City.EditValue = PublicClassForDataBase.Config120;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "选择省联动市:\r\n" + ex);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 选择市联动县
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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, "请选择");
|
|
|
|
if (SysMID.ToString() == PublicClassForDataBase.Config10001)
|
|
{
|
|
lookUp_Area.EditValue = PublicClassForDataBase.Config116;
|
|
}
|
|
else
|
|
{
|
|
lookUp_Area.EditValue = PublicClassForDataBase.Config121;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "选择市联动县:\r\n" + ex);
|
|
}
|
|
}
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string Url = "api/service/T_Service_Apoplexy_FAHBase/UpdateNotNullColumns";
|
|
List<T_Service_Apoplexy_FAHBaseDTO> list = new List<T_Service_Apoplexy_FAHBaseDTO>();
|
|
T_Service_Apoplexy_FAHBaseDTO af = new T_Service_Apoplexy_FAHBaseDTO();
|
|
#region 保存信息
|
|
af.GUID = patientguid;
|
|
af.BedNum = textBox_BedNum.Text;
|
|
af.Name = textBox_Name.Text;
|
|
if (!(radioGroup_Sex.EditValue == null))
|
|
{
|
|
af.Sex = radioGroup_Sex.EditValue.ToString();
|
|
}
|
|
af.PatientNum = textBox_PatientNum.Text;
|
|
af.GroupDif = textBox_GroupDif.Text;
|
|
af.Age = textBox_Age.Text;
|
|
af.Height = textBox_Height.Text;
|
|
af.Weight = textBox_Weight.Text;
|
|
if (!string.IsNullOrEmpty(timeControl_AdmissionDate.TimeValue + ""))
|
|
{
|
|
af.AdmissionDate = Convert.ToDateTime(timeControl_AdmissionDate.TimeValue);
|
|
}
|
|
if (!string.IsNullOrEmpty(timeControl_DischargeDate.TimeValue + ""))
|
|
{
|
|
af.DischargeDate = Convert.ToDateTime(timeControl_DischargeDate.TimeValue);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(radioGroup_MaritalStatus.EditValue + ""))
|
|
{
|
|
af.MaritalStatus = radioGroup_MaritalStatus.EditValue.ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(radioGroup_ComingWay.EditValue + ""))
|
|
{
|
|
af.ComingWay = radioGroup_ComingWay.EditValue.ToString();
|
|
}
|
|
af.MedicalType = comboBox_MedicalType.SelectedIndex.ToString();
|
|
af.InhospitalWay = comboBox_InhospitalWay.SelectedIndex.ToString();
|
|
af.ChargeDoctor = textBox_ChargeDoctor.Text;
|
|
String Treated = null;
|
|
for (int i = 0; i < checkedListBoxControl1.CheckedItems.Count; i++)
|
|
{
|
|
Treated += ";";
|
|
Treated += checkedListBoxControl1.CheckedItems[i].ToString();
|
|
if (i == checkedListBoxControl1.CheckedItems.Count - 1)
|
|
{
|
|
Treated += ";";
|
|
}
|
|
}
|
|
af.AdmissionDiagnosis = "";
|
|
for (int i = 0; i < AdmissionDiagnosis.ItemCount; i++)
|
|
{
|
|
|
|
if (AdmissionDiagnosis.Items[i].CheckState == CheckState.Checked)
|
|
{
|
|
af.AdmissionDiagnosis += ";" + AdmissionDiagnosis.GetItemValue(i);
|
|
}
|
|
}
|
|
//af.AdmissionDiagnosis = af.AdmissionDiagnosis + ";";
|
|
if (!string.IsNullOrEmpty(af.AdmissionDiagnosis))
|
|
{
|
|
af.AdmissionDiagnosis += ";";
|
|
}
|
|
if (!string.IsNullOrEmpty(af.AdmissionDiagnosis) && af.AdmissionDiagnosis.Contains("06"))
|
|
af.AdmissionDiagnosisOther = textBox1.Text;
|
|
|
|
af.Treated = Treated;
|
|
af.PatientPhone = textBox_PatientPhone.Text;
|
|
af.EmergencyContactPhone = textBox_EmergencyContactPhone.Text;
|
|
|
|
af.PatientComplaint = textBox_PatientComplaint.Text;
|
|
af.IDCard = textBox_IDCard.Text;
|
|
af.Address = textBox_Address.Text;
|
|
af.HospitalGuid = Information.Hospital.GUID;
|
|
af.DeleteFlag = 0;
|
|
af.SystemModuleID = "3";
|
|
af.Province = lookUp_Province.Text;
|
|
af.City = lookUp_City.Text;
|
|
af.Area = lookUp_Area.Text;
|
|
list.Add(af);
|
|
#endregion
|
|
ClientFactory<T_Service_Apoplexy_FAHBaseDTO> httpClient = new HttpClientFactory<T_Service_Apoplexy_FAHBaseDTO>();
|
|
Client<T_Service_Apoplexy_FAHBaseDTO> client = httpClient.VisitFactory();
|
|
ListEntity<T_Service_Apoplexy_FAHBaseDTO> s = client.Post(Url, list);
|
|
if (s.Success)
|
|
{
|
|
MessageBox.Show("保存成功!");
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("保存失败!");
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "卒中健康与随访基本信息页面保存:\r\n" + ex);
|
|
}
|
|
}
|
|
|
|
private void AdmissionDiagnosis_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
|
|
{
|
|
string checkState = AdmissionDiagnosis.GetItemCheckState(5).ToString();
|
|
if (checkState == "Checked")
|
|
{
|
|
for (int i = 0; i < AdmissionDiagnosis.Items.Count; i++)
|
|
{
|
|
if (AdmissionDiagnosis.Items[i].Value.ToString() == "06")
|
|
{
|
|
lbl_IdentityCard.Visible = true;
|
|
textBox1.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < AdmissionDiagnosis.Items.Count; i++)
|
|
{
|
|
if (AdmissionDiagnosis.Items[i].Value.ToString() == "06")
|
|
{
|
|
AdmissionDiagnosis.Items[i].CheckState = CheckState.Unchecked;
|
|
lbl_IdentityCard.Visible = false;
|
|
textBox1.Visible = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void textBox_IDCard_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(textBox_IDCard.Text))
|
|
{
|
|
try
|
|
{
|
|
string resulst = textBox_IDCard.Text.ToString().Trim();
|
|
if (resulst.Length == 18)
|
|
{
|
|
radioGroup_Sex.Enabled = false;
|
|
textBox_Age.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);
|
|
string birthday = year + "-" + month + "-" + day;
|
|
//性别
|
|
int sex = Convert.ToInt32(resulst.Substring(resulst.Length - 2, 1));
|
|
|
|
if (sex % 2 == 0)
|
|
radioGroup_Sex.SelectedIndex = 1;
|
|
else if (sex % 2 == 1)
|
|
radioGroup_Sex.SelectedIndex = 0;
|
|
|
|
int ageUnit = 0;
|
|
int age = PublicClass.GetAge(Convert.ToDateTime(birthday + ""), DateTime.Now, out ageUnit);
|
|
|
|
textBox_Age.Text = age + "";
|
|
|
|
lbl_IdentityCard.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
radioGroup_Sex.Enabled = true;
|
|
textBox_Age.Enabled = true;
|
|
lbl_IdentityCard.Visible = true;
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
radioGroup_Sex.Enabled = true;
|
|
textBox_Age.Enabled = true;
|
|
lbl_IdentityCard.Visible = true;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lbl_IdentityCard.Visible = false;
|
|
radioGroup_Sex.SelectedIndex = -1;
|
|
textBox_Age.Text = "";
|
|
}
|
|
}
|
|
|
|
private void textBox_PatientPhone_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(textBox_PatientPhone.Text))
|
|
{
|
|
if (Regex.IsMatch(textBox_PatientPhone.Text, @"^(0\d{2,3})?(\d{7,8})$") || Regex.IsMatch(textBox_PatientPhone.Text, @"^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$"))
|
|
{
|
|
label1.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
label1.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void textBox_EmergencyContactPhone_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(textBox_EmergencyContactPhone.Text))
|
|
{
|
|
if (Regex.IsMatch(textBox_EmergencyContactPhone.Text, @"^(0\d{2,3})?(\d{7,8})$") || Regex.IsMatch(textBox_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}$"))
|
|
{
|
|
label2.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
label2.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|