591 lines
20 KiB
C#
591 lines
20 KiB
C#
using DevExpress.XtraEditors;
|
|
using HL_FristAidPlatform_DTO;
|
|
using HL_FristAidPlatform_Public;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace HL_FristAidPlatform_Apoplexy
|
|
{
|
|
public partial class Form_AddApoplexyHighRiskScreening : XtraForm
|
|
{
|
|
string guid = "";
|
|
public double height = 0;
|
|
public double weight = 0;
|
|
|
|
public int Count = 0;
|
|
|
|
public int sumCount = 0;
|
|
public int sum = 0;
|
|
public int num1 = 0;
|
|
public int num2 = 0;
|
|
public int num3 = 0;
|
|
public int num4 = 0;
|
|
public int num5 = 0;
|
|
public int num6 = 0;
|
|
public int num7 = 0;
|
|
public int num8 = 0;
|
|
|
|
public Form_AddApoplexyHighRiskScreening()
|
|
{
|
|
InitializeComponent();
|
|
labelControl20.Text = Information.User.DepartmentsName;
|
|
}
|
|
|
|
public void RgChanged()
|
|
{
|
|
lblRisk.Visible = true;
|
|
sumCount = 0;
|
|
Count = 0;
|
|
sum = 0;
|
|
num1 = 0;
|
|
num2 = 0;
|
|
num3 = 0;
|
|
num4 = 0;
|
|
num5 = 0;
|
|
num6 = 0;
|
|
num7 = 0;
|
|
num8 = 0;
|
|
|
|
if (rgHypertension.SelectedIndex > -1)
|
|
{
|
|
if (rgHypertension.EditValue + "" == "1")
|
|
{
|
|
num1 = 1;
|
|
Count = 2;
|
|
}
|
|
if (rgHypertension.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgDiabetes.SelectedIndex > -1)
|
|
{
|
|
if (rgDiabetes.EditValue + "" == "1")
|
|
{
|
|
num3 = 1;
|
|
Count = 2;
|
|
}
|
|
if (rgDiabetes.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgHeartDisease.SelectedIndex > -1)
|
|
{
|
|
if (rgHeartDisease.EditValue + "" == "1")
|
|
{
|
|
num4 = 1;
|
|
Count = 2;
|
|
}
|
|
if (rgHeartDisease.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgBoolFat.SelectedIndex > -1)
|
|
{
|
|
if (rgBoolFat.EditValue + "" == "1")
|
|
{
|
|
num2 = 1;
|
|
}
|
|
if (rgBoolFat.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgSmoke.SelectedIndex > -1)
|
|
{
|
|
if (rgSmoke.EditValue + "" == "1")
|
|
{
|
|
num5 = 1;
|
|
}
|
|
if (rgSmoke.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgAmountOfExercise.SelectedIndex > -1)
|
|
{
|
|
if (rgAmountOfExercise.EditValue + "" == "1")
|
|
{
|
|
num6 = 1;
|
|
}
|
|
if (rgAmountOfExercise.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgRelativeHistory.SelectedIndex > -1)
|
|
{
|
|
if (rgRelativeHistory.EditValue + "" == "1")
|
|
{
|
|
num7 = 1;
|
|
}
|
|
if (rgRelativeHistory.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(labelControl22.Text))
|
|
{
|
|
if (labelControl22.Text == "是")
|
|
{
|
|
num8 = 1;
|
|
}
|
|
if (labelControl22.Text == "否")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
sum = num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8;
|
|
|
|
if (sum >= 3)
|
|
{
|
|
Count = 1;
|
|
}
|
|
|
|
if (rgTIA.SelectedIndex > -1)
|
|
{
|
|
if (rgTIA.EditValue + "" == "1")
|
|
{
|
|
Count = 1;
|
|
}
|
|
if (rgTIA.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (rgApoplexy.SelectedIndex > -1)
|
|
{
|
|
if (rgApoplexy.EditValue + "" == "1")
|
|
{
|
|
Count = 1;
|
|
}
|
|
if (rgApoplexy.EditValue + "" == "0")
|
|
{
|
|
sumCount += 0;
|
|
}
|
|
else
|
|
{
|
|
sumCount += 1;
|
|
}
|
|
}
|
|
if (sumCount == 0)
|
|
{
|
|
Count = 3;
|
|
}
|
|
|
|
if (Count == 0)
|
|
{
|
|
lblRisk.Text = "低危人群";
|
|
lblRisk.ForeColor = Color.FromArgb(100, 25, 190, 107);
|
|
}
|
|
if (Count == 1)
|
|
{
|
|
lblRisk.Text = "高危人群";
|
|
lblRisk.ForeColor = Color.FromArgb(100, 250, 53, 52);
|
|
}
|
|
if (Count == 2)
|
|
{
|
|
lblRisk.Text = "中危人群";
|
|
lblRisk.ForeColor = Color.FromArgb(100, 255, 153, 0);
|
|
}
|
|
if (Count == 3)
|
|
{
|
|
lblRisk.Text = "正常";
|
|
lblRisk.ForeColor = Color.FromArgb(100, 25, 190, 107);
|
|
}
|
|
}
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
#region 判空
|
|
|
|
if (rgHypertension.SelectedIndex == -1 || rg_Source.SelectedIndex == -1 || rgBoolFat.SelectedIndex == -1 || rgDiabetes.SelectedIndex == -1 || rgHeartDisease.SelectedIndex == -1 || rgSmoke.SelectedIndex == -1 || rgAmountOfExercise.SelectedIndex == -1 || rgRelativeHistory.SelectedIndex == -1 || rgApoplexy.SelectedIndex == -1 || rgTIA.SelectedIndex == -1)
|
|
{
|
|
XtraMessageBox.Show("请检查完善筛查必填项信息!!");
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(txtHeight.Text + "") || string.IsNullOrEmpty(txtWeight.Text + "") || string.IsNullOrEmpty(txtName.Text + "") || string.IsNullOrEmpty(txtAge.Text + ""))
|
|
{
|
|
XtraMessageBox.Show("请检查完善筛查必填项信息!!");
|
|
return;
|
|
}
|
|
if (rgGender.SelectedIndex == -1)
|
|
{
|
|
XtraMessageBox.Show("请检查完善性别信息!!");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txtPhone.Text + "") && string.IsNullOrEmpty(txtIDCard.Text + ""))
|
|
{
|
|
XtraMessageBox.Show("请检查完善手机号或身份证号信息!!");
|
|
return;
|
|
}
|
|
|
|
#endregion 判空
|
|
|
|
List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> list = new List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO>();
|
|
T_Service_FirstAid_ApoplexyHighRiskScreeningDTO dto = new T_Service_FirstAid_ApoplexyHighRiskScreeningDTO();
|
|
|
|
dto.Hypertension = int.Parse(rgHypertension.EditValue.ToString());
|
|
dto.BoolFat = int.Parse(rgBoolFat.EditValue.ToString());
|
|
dto.Diabetes = int.Parse(rgDiabetes.EditValue.ToString());
|
|
dto.HeartDisease = int.Parse(rgHeartDisease.EditValue.ToString());
|
|
dto.Smoke = int.Parse(rgSmoke.EditValue.ToString());
|
|
dto.AmountOfExercise = int.Parse(rgAmountOfExercise.EditValue.ToString());
|
|
dto.RelativeHistory = int.Parse(rgRelativeHistory.EditValue.ToString());
|
|
dto.Apoplexy = int.Parse(rgApoplexy.EditValue.ToString());
|
|
dto.TIA = int.Parse(rgTIA.EditValue.ToString());
|
|
|
|
dto.Height = txtHeight.Text + "";
|
|
dto.Weight = txtWeight.Text + "";
|
|
double height = double.Parse(txtHeight.Text + ""); ;// 身高变量,单位:米
|
|
height = height / 100;
|
|
int weight = int.Parse(txtWeight.Text + ""); ;// 体重变量,单位:千克
|
|
double exponent = weight / (height * height);// BMI计算公式
|
|
dto.BMI = exponent.ToString("#0.00");
|
|
|
|
dto.Source = int.Parse(rg_Source.EditValue.ToString());
|
|
|
|
dto.Category = 0;
|
|
|
|
dto.Name = txtName.Text + "";
|
|
dto.Age = int.Parse(txtAge.Text + "");
|
|
//dto.Phone = txtPhone.Text + "";
|
|
dto.IDCard = txtIDCard.Text + "";
|
|
dto.Remarks = memoEditRemarks.Text + "";
|
|
dto.ContactNmber = txtPhone.Text;
|
|
dto.HospitalGUID = Information.Hospital.GUID;
|
|
dto.ShareUserID = Information.User.ID;
|
|
dto.ShareUserName = Information.User.FullName;
|
|
dto.ShareUserDepartment = Information.User.DepartmentsName;
|
|
dto.Gender = rgGender.SelectedIndex > -1 ? int.Parse(rgGender.EditValue.ToString()) : 0;
|
|
guid = dto.GUID;
|
|
list.Add(dto);
|
|
|
|
string Url = "api/service/T_Service_ApoplexyScreen/SaveScreenPatient";
|
|
//初始化两个工厂
|
|
ClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> httpClient = new HttpClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO>();
|
|
Client<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> client = httpClient.VisitFactory();
|
|
|
|
//访问
|
|
ListEntity<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> 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["ResultMsg"].ToString();
|
|
string msg1 = jo["Msg"].ToString();
|
|
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
if (msg == "0")
|
|
{
|
|
XtraMessageBox.Show("新增成功!该筛查人员为低危人群");
|
|
}
|
|
if (msg == "1")
|
|
{
|
|
XtraMessageBox.Show("新增成功!该筛查人员为高危人群");
|
|
}
|
|
if (msg == "2")
|
|
{
|
|
XtraMessageBox.Show("新增成功!该筛查人员为中危人群");
|
|
}
|
|
Form_ApoplexyHighRiskScreening ScorePrint;
|
|
ScorePrint = (Form_ApoplexyHighRiskScreening)this.Owner;
|
|
ScorePrint.FillGridListCtrlQuery();
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show(msg1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
|
|
XtraMessageBox.Show(msg1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void txtIDCard_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txtIDCard.Text))
|
|
{
|
|
try
|
|
{
|
|
string resulst = txtIDCard.Text.ToString().Trim();
|
|
if (resulst.Length == 18)
|
|
{
|
|
rgGender.Enabled = false;
|
|
txtAge.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)
|
|
rgGender.EditValue = "2";
|
|
else if (sex % 2 == 1)
|
|
rgGender.EditValue = "1";
|
|
|
|
int ageUnit = 0;
|
|
int age = PublicClass.GetAge(Convert.ToDateTime(birthday + ""), DateTime.Now, out ageUnit);
|
|
|
|
txtAge.Text = age + "";
|
|
|
|
lbl_IdentityCard.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
rgGender.Enabled = true;
|
|
txtAge.Enabled = true;
|
|
lbl_IdentityCard.Visible = true;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
rgGender.Enabled = true;
|
|
txtAge.Enabled = true;
|
|
lbl_IdentityCard.Visible = true;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lbl_IdentityCard.Visible = false;
|
|
rgGender.EditValue = -1;
|
|
txtAge.Text = "";
|
|
}
|
|
}
|
|
|
|
private void simpleButton3_Click(object sender, EventArgs e)
|
|
{
|
|
string gender = rgGender.Properties.Items[rgGender.SelectedIndex].Description;
|
|
Form_ApoplexyHighRiskScreening_InformedConsent form_ApoplexyHighRisk = new Form_ApoplexyHighRiskScreening_InformedConsent(txtName.Text, gender, txtPhone.Text, txtIDCard.Text, guid);
|
|
form_ApoplexyHighRisk.Show();
|
|
}
|
|
|
|
private void txtPhone_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txtPhone.Text))
|
|
{
|
|
if (Regex.IsMatch(txtPhone.Text, @"^(0\d{2,3})?(\d{7,8})$") || Regex.IsMatch(txtPhone.Text, @"^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$"))
|
|
{
|
|
labelControl21.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
labelControl21.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void txtHeight_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
double bmi = BMIcom();
|
|
if (bmi == 0)
|
|
{
|
|
textEdit_HEBMI.Text = "";
|
|
}
|
|
else
|
|
{
|
|
textEdit_HEBMI.Text = bmi.ToString("0.00") + "";
|
|
if (bmi > 28)
|
|
{
|
|
labelControl22.Text = "是";
|
|
}
|
|
else
|
|
{
|
|
labelControl22.Text = "否";
|
|
}
|
|
}
|
|
RgChanged();
|
|
}
|
|
|
|
private void txtWeight_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
double bmi = BMIcom();
|
|
if (bmi == 0)
|
|
{
|
|
textEdit_HEBMI.Text = "";
|
|
}
|
|
else
|
|
{
|
|
textEdit_HEBMI.Text = bmi.ToString("0.00") + "";
|
|
if (bmi > 28)
|
|
{
|
|
labelControl22.Text = "是";
|
|
}
|
|
else
|
|
{
|
|
labelControl22.Text = "否";
|
|
}
|
|
}
|
|
RgChanged();
|
|
}
|
|
|
|
public double BMIcom()
|
|
{
|
|
double bmi = 0;
|
|
|
|
double height = 0;
|
|
double weight = 0;
|
|
|
|
if (!string.IsNullOrEmpty(txtHeight.Text.Trim() + ""))
|
|
{
|
|
if (double.Parse(txtHeight.Text.Trim()) > 0)
|
|
{
|
|
height = double.Parse(txtHeight.Text.Trim()) / 100;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(txtWeight.Text.Trim() + ""))
|
|
{
|
|
if (double.Parse(txtWeight.Text.Trim()) > 0)
|
|
{
|
|
weight = double.Parse(txtWeight.Text.Trim());
|
|
}
|
|
}
|
|
if (height > 0 && weight > 0)
|
|
{
|
|
bmi = weight / (height * height);
|
|
}
|
|
|
|
return bmi;
|
|
}
|
|
|
|
private void rgHypertension_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgBoolFat_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgDiabetes_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgHeartDisease_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgSmoke_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgApoplexy_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgAmountOfExercise_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgRelativeHistory_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
|
|
private void rgTIA_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RgChanged();
|
|
}
|
|
}
|
|
} |