StableVersion4.3/HL_FristAidPlatform_Emergen.../EMRInfo/Form_HealthCheckupInfo.cs

466 lines
24 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.Data;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace HL_FristAidPlatform_EmergencyTriage
{
public partial class Form_HealthCheckupInfo : XtraForm
{
private string _patientGuid;
private string healthGuid;
public Form_HealthCheckupInfo(string patientGuid)
{
InitializeComponent();
_patientGuid = patientGuid;
}
private void Form_HealthCheckupInfo_Load(object sender, EventArgs e)
{
QueryInfo();
}
public void QueryInfo()
{
string url = string.Format("/api/service/T_Service_FirstAid_HealthCheckup/GetHealthCheckupInfo?guid={0}", _patientGuid);
DataTable dt = DBHelpClass.GetDataRow(url);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
cmb_Sonscious.Text = dt.Rows[0]["Conscious"].ToString();
text_HeartRate1.Text = dt.Rows[0]["HeartRate"].ToString();
txt_Pulse.Text = dt.Rows[0]["Pulse"].ToString();
txt_SystolicPressure.Text = dt.Rows[0]["SystolicPressure"].ToString();
txt_DiastolicPressure.Text = dt.Rows[0]["DiastolicPressure"].ToString();
txt_Temperature.Text = dt.Rows[0]["Temperature"].ToString();
txt_Breathing.Text = dt.Rows[0]["Breathing"].ToString();
cmb_SkinColor.Text = dt.Rows[0]["SkinColor"].ToString();
txt_SkinOther.Text = dt.Rows[0]["SkinOther"].ToString();
txt_PupilL.Text = dt.Rows[0]["PupilL"].ToString();
txt_PupilR.Text = dt.Rows[0]["PupilR"].ToString();
cmb_ReflexL.Text = dt.Rows[0]["ReflexL"].ToString();
cmb_ReflexR.Text = dt.Rows[0]["ReflexR"].ToString();
text_HeartRate.Text = dt.Rows[0]["HeartRate"].ToString();
cmb_Waist.Text = dt.Rows[0]["Waist"].ToString();
txt_PainOther.Text = dt.Rows[0]["PainOther"].ToString();
check_IsBackPain.Checked = bool.Parse(dt.Rows[0]["IsBackPain"].ToString());
check_IsWaistPian.Checked = bool.Parse(dt.Rows[0]["IsWaistPian"].ToString());
cmb_Spleen.Text = dt.Rows[0]["Spleen"].ToString();
cmb_BowelSound.Text = dt.Rows[0]["BowelSound"].ToString();
cmb_MRC.Text = dt.Rows[0]["MRC"].ToString();
cmb_MRSLT.Text = dt.Rows[0]["MRSLT"].ToString();
cmb_MRSLD.Text = dt.Rows[0]["MRSLD"].ToString();
check_IsEdema.Checked = bool.Parse(dt.Rows[0]["IsEdema"].ToString());
cmb_MRSRT.Text = dt.Rows[0]["MRSRT"].ToString();
cmb_MRSRD.Text = dt.Rows[0]["MRSRD"].ToString();
txt_MRSOther.Text = dt.Rows[0]["MRSOther"].ToString();
cmb_Liver.Text = dt.Rows[0]["Liver"].ToString();
cmb_Spine.Text = dt.Rows[0]["Spine"].ToString();
check_BreathStop.Checked = bool.Parse(dt.Rows[0]["IsBreathStop"].ToString());
check_IsBreathSoundsL.Checked = bool.Parse(dt.Rows[0]["IsBreathSoundsL"].ToString());
check_IsMoistRalesL.Checked = bool.Parse(dt.Rows[0]["IsMoistRalesL"].ToString());
check_IsDryRalesL.Checked = bool.Parse(dt.Rows[0]["IsDryRalesL"].ToString());
cmb_BreathSoundsL.Text = dt.Rows[0]["BreathSoundsL"].ToString();
check_IsBreathSoundsR.Checked = bool.Parse(dt.Rows[0]["IsBreathSoundsR"].ToString());
check_IsMoistRalesR.Checked = bool.Parse(dt.Rows[0]["IsMoistRalesR"].ToString());
check_IsDryRalesR.Checked = bool.Parse(dt.Rows[0]["IsDryRalesR"].ToString());
cmb_BreathSoundsR.Text = dt.Rows[0]["BreathSoundsR"].ToString();
check_NeckRigidity.Checked = bool.Parse(dt.Rows[0]["IsNeckRigidity"].ToString());
check_JugularFilling.Checked = bool.Parse(dt.Rows[0]["IsJugularFilling"].ToString());
check_CarotidPulsation.Checked = bool.Parse(dt.Rows[0]["IsCarotidPulsation"].ToString());
radioGroup_Babinskisign.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["Babinskisign"], -1);
radioGroup_NervousPosition.SelectedIndex = PublicClass.ToInt32(dt.Rows[0]["NervousPosition"], -1);
cmb_PhysiologicalReflex.Text = dt.Rows[0]["PhysiologicalReflex"].ToString();
txt_HealthCheckUpOther.Text = dt.Rows[0]["HealthCheckUpOther"].ToString();
radio_HeadAbnormal.SelectedIndex = int.Parse(dt.Rows[0]["HeadAbnormal"].ToString());
txt_HeadAbnormalInfo.Text = dt.Rows[0]["HeadAbnormalInfo"].ToString();
radio_ChestAbnormal.SelectedIndex = int.Parse(dt.Rows[0]["ChestAbnormal"].ToString());
txt_ChestAbnormalInfo.Text = dt.Rows[0]["ChestAbnormalInfo"].ToString();
radio_AirwayOpen.SelectedIndex = int.Parse(dt.Rows[0]["AirwayOpen"].ToString());
txt_AirwayAbnormal.Text = dt.Rows[0]["AirwayAbnormal"].ToString();
radio_BreathingState.EditValue = int.Parse(dt.Rows[0]["BreathingState"].ToString());
text_Rhythm.Text = dt.Rows[0]["Rhythm"].ToString();
com_HeartSounds.Text = dt.Rows[0]["HeartSounds"].ToString();
check_IsNoise.Checked = bool.Parse(dt.Rows[0]["IsNoise"].ToString());
text_NoisePosition.Text = dt.Rows[0]["NoisePosition"].ToString();
healthGuid = dt.Rows[0]["GUID"].ToString();
}
}
}
public void SaveHealthCheckup()
{
try
{
HealthCheckupDTO dto = new HealthCheckupDTO();
List<HealthCheckupDTO> list = new List<HealthCheckupDTO>();
dto.PatientGUID = _patientGuid;
dto.HealthCheckup = new HealthCheckup();
dto.HealthCheckup.GUID = healthGuid;
dto.PatientGUID = dto.PatientGUID;
dto.HealthCheckup.Pulse = txt_Pulse.Text;
dto.HealthCheckup.HeartRate = text_HeartRate.Text;
dto.HealthCheckup.SystolicPressure = txt_SystolicPressure.Text;
dto.HealthCheckup.DiastolicPressure = txt_DiastolicPressure.Text;
dto.HealthCheckup.Temperature = txt_Temperature.Text;
dto.HealthCheckup.Breathing = txt_Breathing.Text;
dto.HealthCheckup.Conscious = cmb_Sonscious.Text;
dto.HealthCheckup.SkinColor = cmb_SkinColor.Text.ToString();
dto.HealthCheckup.SkinOther = txt_SkinOther.Text.ToString();
dto.HealthCheckup.PupilL = txt_PupilL.Text.ToString();
dto.HealthCheckup.ReflexR = cmb_ReflexR.Text;
dto.HealthCheckup.PupilR = txt_PupilR.Text.ToString();
dto.HealthCheckup.ReflexL = cmb_ReflexL.Text.ToString();
dto.HealthCheckup.HeadAbnormalInfo = txt_HeadAbnormalInfo.Text.ToString();
dto.HealthCheckup.IsNeckRigidity = check_NeckRigidity.Checked ? true : false;
dto.HealthCheckup.IsJugularFilling = check_JugularFilling.Checked ? true : false;
dto.HealthCheckup.IsCarotidPulsation = check_CarotidPulsation.Checked ? true : false;
dto.HealthCheckup.IsBreathStop = check_BreathStop.Checked ? true : false;
dto.HealthCheckup.IsBreathSoundsL = check_IsBreathSoundsL.Checked ? true : false;
dto.HealthCheckup.BreathSoundsL = cmb_BreathSoundsL.Text.ToString();
dto.HealthCheckup.IsMoistRalesL = check_IsMoistRalesL.Checked ? true : false;
dto.HealthCheckup.IsDryRalesL = check_IsDryRalesL.Checked ? true : false;
dto.HealthCheckup.IsBreathSoundsR = check_IsBreathSoundsR.Checked ? true : false;
dto.HealthCheckup.BreathSoundsR = cmb_BreathSoundsR.Text.ToString();
dto.HealthCheckup.IsMoistRalesR = check_IsMoistRalesR.Checked ? true : false;
dto.HealthCheckup.IsDryRalesR = check_IsDryRalesR.Checked ? true : false;
dto.HealthCheckup.Rhythm = text_HeartRate.Text.ToString();
dto.HealthCheckup.Waist = cmb_Waist.Text.ToString();
dto.HealthCheckup.Liver = cmb_Liver.Text.ToString();
dto.HealthCheckup.IsBackPain = check_IsBackPain.Checked ? true : false;
dto.HealthCheckup.IsWaistPian = check_IsWaistPian.Checked ? true : false;
dto.HealthCheckup.PainOther = txt_PainOther.Text.ToString();
dto.HealthCheckup.Spleen = cmb_Spleen.Text.ToString();
dto.HealthCheckup.BowelSound = cmb_BowelSound.Text.ToString();
dto.HealthCheckup.Spine = cmb_Spine.Text.ToString();
dto.HealthCheckup.MRC = cmb_MRC.Text.ToString();
dto.HealthCheckup.MRSLT = cmb_MRSLT.Text.Trim();
dto.HealthCheckup.MRSLD = cmb_MRSLD.Text.Trim();
dto.HealthCheckup.MRSRT = cmb_MRSRT.Text.ToString();
dto.HealthCheckup.MRSRD = cmb_MRSRD.Text.ToString();
dto.HealthCheckup.IsEdema = check_IsEdema.Checked ? true : false;
dto.HealthCheckup.MRSOther = txt_MRSOther.Text.ToString();
dto.HealthCheckup.PhysiologicalReflex = cmb_PhysiologicalReflex.Text.ToString();
dto.HealthCheckup.Babinskisign = radioGroup_Babinskisign.SelectedIndex;
dto.HealthCheckup.NervousPosition = radioGroup_NervousPosition.SelectedIndex;
dto.HealthCheckup.HealthCheckUpOther = txt_HealthCheckUpOther.Text.ToString();
dto.HealthCheckup.HeadAbnormal = radio_HeadAbnormal.SelectedIndex;
dto.HealthCheckup.HeadAbnormalInfo = txt_HeadAbnormalInfo.Text;
dto.HealthCheckup.ChestAbnormal = radio_ChestAbnormal.SelectedIndex;
dto.HealthCheckup.ChestAbnormalInfo = txt_ChestAbnormalInfo.Text;
dto.HealthCheckup.AirwayOpen = radio_AirwayOpen.SelectedIndex;
dto.HealthCheckup.AirwayAbnormal = txt_AirwayAbnormal.Text;
dto.HealthCheckup.BreathingState = radio_BreathingState.EditValue == null
? -1 : int.Parse(radio_BreathingState.EditValue.ToString());
dto.HealthCheckup.Rhythm = text_Rhythm.Text;
dto.HealthCheckup.HeartSounds = com_HeartSounds.Text;
dto.HealthCheckup.IsNoise = check_IsNoise.Checked == true ? true : false;
dto.HealthCheckup.NoisePosition = text_NoisePosition.Text;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_FirstAid_HealthCheckup/UpdateOrInsert";
//初始化两个工厂
ClientFactory<HealthCheckupDTO> httpClient = new HttpClientFactory<HealthCheckupDTO>();
Client<HealthCheckupDTO> client = httpClient.VisitFactory();
ListEntity<HealthCheckupDTO> 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)
{
throw;
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
try
{
HealthCheckupDTO dto = new HealthCheckupDTO();
List<HealthCheckupDTO> list = new List<HealthCheckupDTO>();
dto.PatientGUID = _patientGuid;
dto.HealthCheckup = new HealthCheckup();
dto.HealthCheckup.GUID = healthGuid;
dto.PatientGUID = dto.PatientGUID;
dto.HealthCheckup.Pulse = txt_Pulse.Text;
dto.HealthCheckup.HeartRate = text_HeartRate.Text;
dto.HealthCheckup.SystolicPressure = txt_SystolicPressure.Text;
dto.HealthCheckup.DiastolicPressure = txt_DiastolicPressure.Text;
dto.HealthCheckup.Temperature = txt_Temperature.Text;
dto.HealthCheckup.Breathing = txt_Breathing.Text;
dto.HealthCheckup.Conscious = cmb_Sonscious.SelectedIndex.ToString();
dto.HealthCheckup.SkinColor = cmb_SkinColor.Text.ToString();
dto.HealthCheckup.SkinOther = txt_SkinOther.Text.ToString();
dto.HealthCheckup.PupilL = txt_PupilL.Text.ToString();
dto.HealthCheckup.PupilR = txt_PupilR.Text.ToString();
dto.HealthCheckup.ReflexL = cmb_ReflexL.Text.ToString();
dto.HealthCheckup.HeadAbnormalInfo = txt_HeadAbnormalInfo.Text.ToString();
dto.HealthCheckup.IsNeckRigidity = check_NeckRigidity.Checked ? true : false;
dto.HealthCheckup.IsJugularFilling = check_JugularFilling.Checked ? true : false;
dto.HealthCheckup.IsCarotidPulsation = check_CarotidPulsation.Checked ? true : false;
dto.HealthCheckup.IsBreathStop = check_BreathStop.Checked ? true : false;
dto.HealthCheckup.IsBreathSoundsL = check_IsBreathSoundsL.Checked ? true : false;
dto.HealthCheckup.BreathSoundsL = cmb_BreathSoundsL.Text.ToString();
dto.HealthCheckup.IsMoistRalesL = check_IsMoistRalesL.Checked ? true : false;
dto.HealthCheckup.IsDryRalesL = check_IsDryRalesL.Checked ? true : false;
dto.HealthCheckup.IsBreathSoundsR = check_IsBreathSoundsR.Checked ? true : false;
dto.HealthCheckup.BreathSoundsR = cmb_BreathSoundsR.Text.ToString();
dto.HealthCheckup.IsMoistRalesR = check_IsMoistRalesR.Checked ? true : false;
dto.HealthCheckup.IsDryRalesR = check_IsDryRalesR.Checked ? true : false;
dto.HealthCheckup.Rhythm = text_HeartRate.Text.ToString();
dto.HealthCheckup.Waist = cmb_Waist.Text.ToString();
dto.HealthCheckup.Liver = cmb_Liver.Text.ToString();
dto.HealthCheckup.IsBackPain = check_IsBackPain.Checked ? true : false;
dto.HealthCheckup.IsWaistPian = check_IsWaistPian.Checked ? true : false;
dto.HealthCheckup.PainOther = txt_PainOther.Text.ToString();
dto.HealthCheckup.Spleen = cmb_Spleen.Text.ToString();
dto.HealthCheckup.BowelSound = cmb_BowelSound.Text.ToString();
dto.HealthCheckup.Spine = cmb_Spine.Text.ToString();
dto.HealthCheckup.MRC = cmb_MRC.Text.ToString();
dto.HealthCheckup.MRSLT = cmb_MRSLT.Text.Trim();
dto.HealthCheckup.MRSLD = cmb_MRSLD.Text.Trim();
dto.HealthCheckup.MRSRT = cmb_MRSRT.Text.ToString();
dto.HealthCheckup.MRSRD = cmb_MRSRD.Text.ToString();
dto.HealthCheckup.IsEdema = check_IsEdema.Checked ? true : false;
dto.HealthCheckup.MRSOther = txt_MRSOther.Text.ToString();
dto.HealthCheckup.PhysiologicalReflex = cmb_PhysiologicalReflex.Text.ToString();
dto.HealthCheckup.Babinskisign = radioGroup_Babinskisign.SelectedIndex;
dto.HealthCheckup.NervousPosition = radioGroup_NervousPosition.SelectedIndex;
dto.HealthCheckup.HealthCheckUpOther = txt_HealthCheckUpOther.Text.ToString();
dto.HealthCheckup.HeadAbnormal = radio_HeadAbnormal.SelectedIndex;
dto.HealthCheckup.HeadAbnormalInfo = txt_HeadAbnormalInfo.Text;
dto.HealthCheckup.ChestAbnormal = radio_ChestAbnormal.SelectedIndex;
dto.HealthCheckup.ChestAbnormalInfo = txt_ChestAbnormalInfo.Text;
dto.HealthCheckup.AirwayOpen = radio_AirwayOpen.SelectedIndex;
dto.HealthCheckup.AirwayAbnormal = txt_AirwayAbnormal.Text;
dto.HealthCheckup.BreathingState = radio_BreathingState.EditValue == null
? -1 : int.Parse(radio_BreathingState.EditValue.ToString());
dto.HealthCheckup.Rhythm = text_Rhythm.Text;
dto.HealthCheckup.HeartSounds = com_HeartSounds.Text;
dto.HealthCheckup.IsNoise = check_IsNoise.Checked == true ? true : false;
dto.HealthCheckup.NoisePosition = text_NoisePosition.Text;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_FirstAid_HealthCheckup/UpdateOrInsert";
//初始化两个工厂
ClientFactory<HealthCheckupDTO> httpClient = new HttpClientFactory<HealthCheckupDTO>();
Client<HealthCheckupDTO> client = httpClient.VisitFactory();
if (client.Post(Url, list).Success)
{
MessageBox.Show("保存成功");
this.Close();
}
}
catch (Exception)
{
throw;
}
}
/// <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);
}
/// <summary>
/// 纯数字
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public bool IsNumber2(string input)
{
Regex regex = new System.Text.RegularExpressions.Regex("^(-?[0-9]*[.]*[0-9]{0,3})$");
return regex.IsMatch(input);
}
private void txt_Pulse_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_Pulse.Text))
{
if (!IsNumber2(txt_Pulse.Text))
{
//XtraMessageBox.Show("脉搏输入不合法");
return;
}
else
{
int value = int.Parse(txt_Pulse.Text.Trim());
if (value < 60 || value > 100) { txt_Pulse.ForeColor = Color.Red; } else { txt_Pulse.ForeColor = Color.Black; }
}
}
}
private void txt_SystolicPressure_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_SystolicPressure.Text))
{
if (!IsNumber2(txt_SystolicPressure.Text))
{
txt_SystolicPressure.Text = "";
//XtraMessageBox.Show("血压输入不合法");
return;
}
else
{
int value = int.Parse(txt_SystolicPressure.Text.Trim());
if (value < 60 || value > 89)
{ txt_SystolicPressure.ForeColor = Color.Red; }
else { txt_SystolicPressure.ForeColor = Color.Black; }
}
}
}
private void txt_DiastolicPressure_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_DiastolicPressure.Text))
{
if (!IsNumber2(txt_DiastolicPressure.Text))
{
txt_DiastolicPressure.Text = "";
//XtraMessageBox.Show("血压输入不合法");
return;
}
else
{
int value = int.Parse(txt_DiastolicPressure.Text.Trim());
if (value < 90 || value > 139)
{ txt_DiastolicPressure.ForeColor = Color.Red; }
else { txt_DiastolicPressure.ForeColor = Color.Black; }
}
}
}
private void txt_Breathing_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_Breathing.Text))
{
if (!IsNumber2(txt_Breathing.Text))
{
//XtraMessageBox.Show("呼吸输入不合法");
return;
}
else
{
int value = int.Parse(txt_Breathing.Text.Trim());
if (value < 18 || value > 20)
{ txt_Breathing.ForeColor = Color.Red; }
else { txt_Breathing.ForeColor = Color.Black; }
}
}
}
private void text_HeartRate_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(text_HeartRate.Text))
{
if (!IsNumber2(text_HeartRate.Text))
{
return;
}
else
{
int value = int.Parse(text_HeartRate.Text.Trim());
if (value < 60 || value > 100)
{ text_HeartRate.ForeColor = Color.Red; }
else { text_HeartRate.ForeColor = Color.Black; }
}
}
}
private void txt_Temperature_EditValueChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_Temperature.Text))
{
if (!IsNumber(txt_Temperature.Text))
{
txt_Temperature.Text = "";
// XtraMessageBox.Show("体温输入不合法");
return;
}
else
{
double value = double.Parse(txt_Temperature.Text.Trim());
if (value < 36 || value > 37)
{ txt_Temperature.ForeColor = Color.Red; }
else { txt_Temperature.ForeColor = Color.Black; }
}
}
}
private void radio_HeadAbnormal_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_HeadAbnormal.SelectedIndex == 0)
txt_HeadAbnormalInfo.Enabled = true;
if (radio_HeadAbnormal.SelectedIndex == 1)
txt_HeadAbnormalInfo.Enabled = false;
}
private void radio_ChestAbnormal_SelectedIndexChanged(object sender, EventArgs e)
{
if (radio_ChestAbnormal.SelectedIndex == 0)
txt_ChestAbnormalInfo.Enabled = true;
if (radio_ChestAbnormal.SelectedIndex == 1)
txt_ChestAbnormalInfo.Enabled = false;
}
}
}