393 lines
15 KiB
C#
393 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.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_FollowUp
|
|
{
|
|
public partial class UC_FollowUpRiskReason : UserControl
|
|
{
|
|
public string registerId;
|
|
public string month;
|
|
public UC_FollowUpRiskReason(string _registerId, string _month)
|
|
{
|
|
InitializeComponent();
|
|
registerId = _registerId;
|
|
month = _month;
|
|
}
|
|
|
|
|
|
private void UC_FollowUpRiskReason_Load(object sender, EventArgs e)
|
|
{
|
|
GetInfo(registerId, month);
|
|
}
|
|
private void radio_isHypertension_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (radio_isHypertension.SelectedIndex == 0)
|
|
{
|
|
panel_hypertensionValue.Visible = true;
|
|
panel_isHypertensionUptopar.Visible = false;
|
|
}
|
|
else if (radio_isHypertension.SelectedIndex == 2)
|
|
{
|
|
panel_hypertensionValue.Visible = false;
|
|
panel_isHypertensionUptopar.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panel_hypertensionValue.Visible = false;
|
|
panel_isHypertensionUptopar.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void radio_isHyperLipidemia_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (radio_isHyperLipidemia.SelectedIndex == 0)
|
|
{
|
|
panel_isHyperLipidemia.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panel_isHyperLipidemia.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void radio_isLpa_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (radio_isLpa.SelectedIndex == 0)
|
|
{
|
|
panel_isLpa.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panel_isLpa.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void radio_isDiabetes_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (radio_isDiabetes.SelectedIndex == 0)
|
|
{
|
|
panel_isDiabetes.Visible = true;
|
|
panel_isDiabeesNormal.Visible = false;
|
|
}
|
|
else if (radio_isDiabetes.SelectedIndex == 2)
|
|
{
|
|
panel_isDiabetes.Visible = false;
|
|
panel_isDiabeesNormal.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panel_isDiabetes.Visible = false;
|
|
panel_isDiabeesNormal.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void radio_isGhb_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (radio_isGhb.SelectedIndex == 0)
|
|
{
|
|
panel_isGhb.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panel_isGhb.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void radio_isSmoke_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (radio_isSmoke.SelectedIndex == 1)
|
|
{
|
|
panel_smokeStatus.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panel_smokeStatus.Visible = false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取数据
|
|
/// </summary>
|
|
/// <param name="registerId"></param>
|
|
/// <param name="month"></param>
|
|
public void GetInfo(string registerId, string month)
|
|
{
|
|
FollowUpRiskReasonDTO dto = new FollowUpRiskReasonDTO();
|
|
string url = string.Format("api/service/T_Service_ChestPain_FollowUpInfo/GetFollowUpRiskReason?registerId={0}&month={1}", registerId, month);
|
|
dto = DBHelpClass.GetDateModel<FollowUpRiskReasonDTO>(url);
|
|
if (dto != null)
|
|
{
|
|
radio_isHypertension.EditValue = dto.isHypertension;
|
|
if (dto.isHypertension == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(dto.hypertensionValue))
|
|
{
|
|
txt_hypertensionValue1.Text = dto.hypertensionValue.Substring(0, dto.hypertensionValue.IndexOf("/"));
|
|
int i = dto.hypertensionValue.LastIndexOf('/');
|
|
txt_hypertensionValue2.Text = dto.hypertensionValue.Substring(i + 1);
|
|
}
|
|
}
|
|
if (dto.isHypertension == "2")
|
|
{
|
|
radio_isHypertensionUptopar.EditValue = dto.isHypertensionUptopar;
|
|
}
|
|
radio_isHyperLipidemia.EditValue = dto.isHyperLipidemia;
|
|
if (dto.isHyperLipidemia == "1")
|
|
{
|
|
txt_bloodfatTcValue.Text = dto.bloodfatTcValue;
|
|
txt_bloodfatTgValue.Text = dto.bloodfatTgValue;
|
|
txt_bloodfatLdlcValue.Text = dto.bloodfatLdlcValue;
|
|
txt_bloodfatHdlcValue.Text = dto.bloodfatHdlcValue;
|
|
if (!string.IsNullOrEmpty(dto.bloodfatCheckTime)) time_bloodfatCheckTime.TimeValue = dto.bloodfatCheckTime;
|
|
}
|
|
radio_isLpa.EditValue = dto.isLpa;
|
|
if (dto.isLpa == "1")
|
|
{
|
|
txt_bloodfatLpaValue.Text = dto.bloodfatLpaValue;
|
|
if (dto.bloodfatLpaUnit=="1")
|
|
{
|
|
com_bloodfatLpaUnit.Text = "mg/L";
|
|
|
|
}if (dto.bloodfatLpaUnit == "2")
|
|
{
|
|
com_bloodfatLpaUnit.Text = "mg/dl";
|
|
}
|
|
}
|
|
radio_isDiabetes.EditValue = dto.isDiabetes;
|
|
if (dto.isDiabetes == "1")
|
|
{
|
|
txt_fbgValue.Text = dto.fbgValue;
|
|
if (!string.IsNullOrEmpty(dto.fbgCheckTime)) time_fbgCheckTime.TimeValue = dto.fbgCheckTime;
|
|
}
|
|
if (dto.isDiabetes == "2") radio_isDiabeesNormal.EditValue = dto.isDiabeesNormal;
|
|
radio_isGhb.EditValue = dto.isGhb;
|
|
if (dto.isGhb == "1")
|
|
{
|
|
txt_ghbValue.Text = dto.ghbValue;
|
|
if (!string.IsNullOrEmpty(dto.ghbCheckTime)) time_ghbCheckTime.TimeValue = dto.ghbCheckTime;
|
|
}
|
|
radio_isSmoke.EditValue = dto.isSmoke;
|
|
if (dto.isSmoke == "1") radio_smokeStatus.EditValue = dto.smokeStatus;
|
|
radio_isDrink.EditValue = dto.isDrink;
|
|
txt_height.Text = dto.height;
|
|
txt_weight.Text = dto.weight;
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public void SaveFollowUpRiskReason(string status)
|
|
{
|
|
try
|
|
{
|
|
List<FollowUpRiskReasonDTO> list = new List<FollowUpRiskReasonDTO>();
|
|
FollowUpRiskReasonDTO dto = new FollowUpRiskReasonDTO();
|
|
dto.registerId = registerId;
|
|
dto.month = month;
|
|
dto.status = status;
|
|
|
|
dto.isHypertension = radio_isHypertension.EditValue != null ? radio_isHypertension.EditValue.ToString() : "";
|
|
if (dto.isHypertension == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(txt_hypertensionValue1.Text))
|
|
dto.hypertensionValue = txt_hypertensionValue1.Text;
|
|
dto.hypertensionValue += "/";
|
|
if (!string.IsNullOrEmpty(txt_hypertensionValue2.Text))
|
|
dto.hypertensionValue += txt_hypertensionValue2.Text;
|
|
}
|
|
if (dto.isHypertension == "2")
|
|
dto.isHypertensionUptopar = radio_isHypertensionUptopar.EditValue != null ? radio_isHypertensionUptopar.EditValue.ToString() : "";
|
|
|
|
dto.isHyperLipidemia = radio_isHyperLipidemia.EditValue != null ? radio_isHyperLipidemia.EditValue.ToString() : "";
|
|
|
|
if (dto.isHyperLipidemia == "1")
|
|
{
|
|
dto.bloodfatTcValue = txt_bloodfatTcValue.Text;
|
|
dto.bloodfatTgValue = txt_bloodfatTgValue.Text;
|
|
dto.bloodfatLdlcValue = txt_bloodfatLdlcValue.Text;
|
|
dto.bloodfatHdlcValue = txt_bloodfatHdlcValue.Text;
|
|
if (!string.IsNullOrEmpty(time_bloodfatCheckTime.TimeValue.ToString()))
|
|
dto.bloodfatCheckTime =Convert.ToDateTime(time_bloodfatCheckTime.TimeValue).ToString("yyyy-MM-dd");
|
|
}
|
|
dto.isLpa = radio_isLpa.EditValue != null ? radio_isLpa.EditValue.ToString() : "";
|
|
if (dto.isLpa == "1")
|
|
{
|
|
dto.bloodfatLpaValue = txt_bloodfatLpaValue.Text;
|
|
if (com_bloodfatLpaUnit.Text != "请选择" && !string.IsNullOrEmpty(com_bloodfatLpaUnit.Text))
|
|
dto.bloodfatLpaUnit = com_bloodfatLpaUnit.Text == "mg/L" ? "1" : "2";
|
|
}
|
|
dto.isDiabetes = radio_isDiabetes.EditValue != null ? radio_isDiabetes.EditValue.ToString() : "";
|
|
if (dto.isDiabetes == "1")
|
|
{
|
|
dto.fbgValue = txt_fbgValue.Text;
|
|
if (!string.IsNullOrEmpty(time_fbgCheckTime.TimeValue.ToString()))
|
|
dto.fbgCheckTime =Convert.ToDateTime(time_fbgCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
if (dto.isDiabetes == "2") dto.isDiabeesNormal = radio_isDiabeesNormal.EditValue != null ? radio_isDiabeesNormal.EditValue.ToString() : "";
|
|
dto.isGhb = radio_isGhb.EditValue != null ? radio_isGhb.EditValue.ToString() : "";
|
|
if (dto.isGhb == "1")
|
|
{
|
|
dto.ghbValue = txt_ghbValue.Text;
|
|
if (!string.IsNullOrEmpty(time_ghbCheckTime.TimeValue.ToString()))
|
|
dto.ghbCheckTime = Convert.ToDateTime(time_ghbCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
dto.isSmoke = radio_isSmoke.EditValue != null ? radio_isSmoke.EditValue.ToString() : "";
|
|
if (dto.isSmoke == "1") dto.smokeStatus = radio_smokeStatus != null ? radio_smokeStatus.EditValue.ToString() : "";
|
|
dto.isDrink = radio_isDrink.EditValue != null ? radio_isDrink.EditValue.ToString() : "";
|
|
dto.weight = txt_weight.Text;
|
|
dto.height = txt_height.Text;
|
|
list.Add(dto);
|
|
string Url = string.Empty;
|
|
Url = "api/service/T_Service_ChestPain_FollowUpInfo/SaveFollowUpRiskReason";
|
|
//初始化两个工厂
|
|
ClientFactory<FollowUpRiskReasonDTO> httpClient = new HttpClientFactory<FollowUpRiskReasonDTO>();
|
|
Client<FollowUpRiskReasonDTO> client = httpClient.VisitFactory();
|
|
//访问
|
|
ListEntity<FollowUpRiskReasonDTO> t = client.Post(Url, list);
|
|
|
|
if (t.Success)
|
|
{
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
|
|
string msg = jo["Msg"].ToString();
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
XtraMessageBox.Show(msg);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// MessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
throw;
|
|
}
|
|
}
|
|
|
|
private void txt_height_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (IsNumber(txt_height.Text))
|
|
{
|
|
lbl_hmsg.Visible = false;
|
|
if (!string.IsNullOrEmpty(txt_height.Text) && !string.IsNullOrEmpty(txt_weight.Text))
|
|
{
|
|
double bmi = double.Parse(txt_height.Text) / (double.Parse(txt_weight.Text) * double.Parse(txt_weight.Text));
|
|
lbl_BMI.Text = bmi.ToString();
|
|
}
|
|
}
|
|
else {
|
|
|
|
lbl_hmsg.Visible = true;
|
|
}
|
|
}
|
|
|
|
private void txt_weight_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (IsNumber(txt_weight.Text))
|
|
{
|
|
lbl_wmsg.Visible = false;
|
|
if (!string.IsNullOrEmpty(txt_height.Text) && !string.IsNullOrEmpty(txt_weight.Text))
|
|
{
|
|
double height = double.Parse(txt_height.Text) / 100;
|
|
double weight = double.Parse(txt_weight.Text);
|
|
double bmi = weight / (height * height);
|
|
lbl_BMI.Text = bmi.ToString("#0.0");
|
|
}
|
|
}
|
|
else {
|
|
|
|
lbl_wmsg.Visible = true;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 数字带小数点
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
public static bool IsNumber(string input)
|
|
{
|
|
string pattern = "^-?\\d+$|^(-?\\d+)(\\.\\d+)?$";
|
|
Regex regex = new Regex(pattern);
|
|
return regex.IsMatch(input);
|
|
}
|
|
|
|
private void txt_fbgValue_Properties_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txt_fbgValue.Text + ""))
|
|
{
|
|
if (double.Parse(txt_fbgValue.Text.Trim() + "") > 6.1|| double.Parse(txt_fbgValue.Text.Trim() + "") < 3.9)
|
|
{
|
|
txt_fbgValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
txt_fbgValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void txt_hypertensionValue1_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txt_hypertensionValue1.Text + ""))
|
|
{
|
|
if (int.Parse(txt_hypertensionValue1.Text.ToString()) > 139 || int.Parse(txt_hypertensionValue1.Text.ToString()) < 90)
|
|
{
|
|
txt_hypertensionValue1.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
txt_hypertensionValue1.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void txt_hypertensionValue2_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txt_hypertensionValue2.Text + ""))
|
|
{
|
|
if (int.Parse(txt_hypertensionValue2.Text.ToString()) > 89 || int.Parse(txt_hypertensionValue2.Text.ToString()) < 60)
|
|
{
|
|
txt_hypertensionValue2.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
txt_hypertensionValue2.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void txt_fbgValue_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txt_fbgValue.Text + ""))
|
|
{
|
|
if (double.Parse(txt_fbgValue.Text.ToString()) > 6.1 || double.Parse(txt_fbgValue.Text.ToString()) < 3.9)
|
|
{
|
|
txt_fbgValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
txt_fbgValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|