463 lines
15 KiB
C#
463 lines
15 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.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace HL_FristAidPlatform_Apoplexy
|
|||
|
{
|
|||
|
public partial class Form_InitialScreening : XtraForm
|
|||
|
{
|
|||
|
string _patientGuid = "";
|
|||
|
string _name = "";
|
|||
|
string _gender = "";
|
|||
|
string _age = "";
|
|||
|
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_InitialScreening(string patientGuid = "", string name = "", string gender = "", string age = "")
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
_patientGuid = patientGuid;
|
|||
|
_name = name;
|
|||
|
_gender = gender;
|
|||
|
_age = age;
|
|||
|
}
|
|||
|
|
|||
|
private void Form_InitialScreening_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
labelControl2.Text = _name + "";
|
|||
|
labelControl4.Text = _gender + "" == "1" ? "男" : "女";
|
|||
|
labelControl6.Text = _age + "";
|
|||
|
labelControl24.Text = "";
|
|||
|
|
|||
|
string url = string.Format("api/service/T_Service_FirstAid_ApoplexyHighRiskScreening/GetApoplexyInitialScreeningByPatientGuid?patientGuid={0}", _patientGuid);
|
|||
|
T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2 temp = DBHelpClass.GetDateModel<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2>(url);
|
|||
|
|
|||
|
if (temp != null)
|
|||
|
{
|
|||
|
rg_Source.EditValue = temp.Source + "";
|
|||
|
|
|||
|
rgHypertension.EditValue = temp.Hypertension + "";
|
|||
|
rgBoolFat.EditValue = temp.BoolFat + "";
|
|||
|
rgDiabetes.EditValue = temp.Diabetes + "";
|
|||
|
rgHeartDisease.EditValue = temp.HeartDisease + "";
|
|||
|
rgSmoke.EditValue = temp.Smoke + "";
|
|||
|
rgAmountOfExercise.EditValue = temp.AmountOfExercise + "";
|
|||
|
rgRelativeHistory.EditValue = temp.RelativeHistory + "";
|
|||
|
rgApoplexy.EditValue = temp.Apoplexy + "";
|
|||
|
rgTIA.EditValue = temp.TIA + "";
|
|||
|
|
|||
|
txtHeight.Text = temp.Height + "";
|
|||
|
txtWeight.Text = temp.Weight + "";
|
|||
|
memoEditRemarks.Text = temp.Remarks + "";
|
|||
|
|
|||
|
labelControl24.Text = temp.InitialScreenNum + "";
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
public void RgChanged()
|
|||
|
{
|
|||
|
lblRisk.Visible = true;
|
|||
|
sumCount = 0;
|
|||
|
sum = 0;
|
|||
|
num1 = 0;
|
|||
|
num2 = 0;
|
|||
|
num3 = 0;
|
|||
|
num4 = 0;
|
|||
|
num5 = 0;
|
|||
|
num6 = 0;
|
|||
|
num7 = 0;
|
|||
|
num8 = 0;
|
|||
|
Count = 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);
|
|||
|
}
|
|||
|
}
|
|||
|
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 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();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
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 + ""))
|
|||
|
{
|
|||
|
XtraMessageBox.Show("请检查完善筛查必填项信息!!");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
#endregion 判空
|
|||
|
|
|||
|
List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2> list = new List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2>();
|
|||
|
T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2 dto = new T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2();
|
|||
|
|
|||
|
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");
|
|||
|
|
|||
|
if(labelControl22.Text == "是")
|
|||
|
{
|
|||
|
dto.Obese = 1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
dto.Obese = 0;
|
|||
|
}
|
|||
|
|
|||
|
dto.Source = int.Parse(rg_Source.EditValue.ToString());
|
|||
|
|
|||
|
dto.Category = 0;
|
|||
|
dto.Remarks = memoEditRemarks.Text + "";
|
|||
|
dto.ShareUserID = Information.User.ID;
|
|||
|
dto.ShareUserName = Information.User.FullName;
|
|||
|
dto.ShareUserDepartment = Information.User.DepartmentsName;
|
|||
|
|
|||
|
dto.PatientGUID = _patientGuid;
|
|||
|
list.Add(dto);
|
|||
|
|
|||
|
string Url = "api/service/T_Service_FirstAid_ApoplexyHighRiskScreening/SaveHighRiskScreen";
|
|||
|
//初始化两个工厂
|
|||
|
ClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2> httpClient = new HttpClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2>();
|
|||
|
Client<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2> client = httpClient.VisitFactory();
|
|||
|
|
|||
|
//访问
|
|||
|
ListEntity<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO2> 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();
|
|||
|
XtraMessageBox.Show(msg);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
|
|||
|
XtraMessageBox.Show(msg1);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
XtraMessageBox.Show("保存失败");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
XtraMessageBox.Show("保存失败");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void rgHypertension_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RgChanged();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|