513 lines
19 KiB
C#
513 lines
19 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.Drawing.Imaging;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_FollowUp
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public partial class UC_FollowUpInspectionItem : UserControl
|
|
{
|
|
/// <summary>
|
|
/// 患者ID
|
|
/// </summary>
|
|
public string registerId;
|
|
/// <summary>
|
|
/// 月份
|
|
/// </summary>
|
|
public string month;
|
|
|
|
/// <summary>
|
|
/// 心电图文件
|
|
/// </summary>
|
|
public static string imagefile;
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="_registerId"></param>
|
|
/// <param name="_month"></param>
|
|
public UC_FollowUpInspectionItem(string _registerId, string _month)
|
|
{
|
|
InitializeComponent();
|
|
registerId = _registerId;
|
|
month = _month;
|
|
}
|
|
|
|
private void UC_FollowUpInspectionItem_Load(object sender, EventArgs e)
|
|
{
|
|
getInfo(registerId, month);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取信息
|
|
/// </summary>
|
|
public void getInfo(string registerId, string month)
|
|
{
|
|
FollowUpInspectionItemDTO dto = new FollowUpInspectionItemDTO();
|
|
string url = string.Format("api/service/T_Service_ChestPain_FollowUpInfo/GetFollowUpInspectionItem?registerId={0}&month={1}", registerId, month);
|
|
dto = DBHelpClass.GetDateModel<FollowUpInspectionItemDTO>(url);
|
|
if (dto != null)
|
|
{
|
|
isHasEcg.EditValue = dto.isHasEcg;
|
|
if (dto.isHasEcg == "1")
|
|
{
|
|
ecgCheckTime.TimeValue = dto.ecgCheckTime;
|
|
imagefile = dto.ecgFile;
|
|
}
|
|
isCkmb.EditValue = dto.isCkmb;
|
|
ckmbCheckTime.TimeValue = dto.ckmbCheckTime;
|
|
ckmbValue.Text = dto.ckmbValue;
|
|
if (dto.ckmbUnit == "1") ckmbUnit.Text = "ng/mL";
|
|
if (dto.ckmbUnit == "2") ckmbUnit.Text = "ug/L";
|
|
if (dto.ckmbUnit == "3") ckmbUnit.Text = "u/L";
|
|
if (dto.ckmbUnit == "4") ckmbUnit.Text = "IU/L";
|
|
isTroponin.EditValue = dto.isTroponin;
|
|
troponinCheckTime.TimeValue = dto.troponinCheckTime;
|
|
troponinType.EditValue = dto.troponinType;
|
|
troponinValue.Text = dto.troponinValue;
|
|
if (dto.troponinUnit == "1") troponinUnit.Text = "ug/L";
|
|
if (dto.troponinUnit == "2") troponinUnit.Text = "ng/L";
|
|
if (dto.troponinUnit == "3") troponinUnit.Text = "mg/L";
|
|
if (dto.troponinUnit == "4") troponinUnit.Text = "ng/ml";
|
|
if (dto.troponinStatus == "1") troponinStatus.Text = "阳性";
|
|
if (dto.troponinStatus == "2") troponinStatus.Text = "阴性";
|
|
isBnp.EditValue = dto.isBnp;
|
|
bnpCheckTime.TimeValue = dto.bnpCheckTime;
|
|
bnpType.EditValue = dto.bnpType;
|
|
bnpValue.EditValue = dto.bnpValue;
|
|
isUcg.EditValue = dto.isUcg;
|
|
ucgCheckTime.TimeValue = dto.ucgCheckTime;
|
|
ucgLvef.Text = dto.ucgLvef;
|
|
ucgVan.EditValue = dto.ucgVan;
|
|
ucgRwm.EditValue = dto.ucgRwm;
|
|
isCag.EditValue = dto.isCag;
|
|
cagCheckTime.TimeValue = dto.cagCheckTime;
|
|
isCoronaryCta.EditValue = dto.isCoronaryCta;
|
|
coronaryCtaCheckTime.TimeValue = dto.coronaryCtaCheckTime;
|
|
|
|
if (!string.IsNullOrEmpty(imagefile)) ecgFile.Text = "已上传一份心电图";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提交
|
|
/// </summary>
|
|
public void submit(string status)
|
|
{
|
|
List<FollowUpInspectionItemDTO> list = new List<FollowUpInspectionItemDTO>();
|
|
FollowUpInspectionItemDTO dto = new FollowUpInspectionItemDTO();
|
|
dto.registerId = registerId;
|
|
dto.month = month;
|
|
dto.isHasEcg = isHasEcg.EditValue != null ? isHasEcg.EditValue.ToString() : "";
|
|
if (dto.isHasEcg == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(ecgCheckTime.TimeValue)) dto.ecgCheckTime = Convert.ToDateTime(ecgCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
dto.ecgFile = imagefile;
|
|
}
|
|
dto.isCkmb = isCkmb.EditValue != null ? isCkmb.EditValue.ToString() : "";
|
|
if (dto.isCkmb == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(ckmbCheckTime.TimeValue)) dto.ckmbCheckTime = Convert.ToDateTime(ckmbCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
dto.ckmbValue = ckmbValue.Text;
|
|
switch (ckmbUnit.Text)
|
|
{
|
|
case "ng/mL": dto.ckmbUnit = "1"; break;
|
|
case "ug/L": dto.ckmbUnit = "2"; break;
|
|
case "u/L": dto.ckmbUnit = "3"; break;
|
|
case "IU/L": dto.ckmbUnit = "4"; break;
|
|
default: dto.ckmbUnit = ""; break;
|
|
}
|
|
}
|
|
dto.isTroponin = isTroponin.EditValue != null ? isTroponin.EditValue.ToString() : "";
|
|
if (dto.isTroponin == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(troponinCheckTime.TimeValue)) dto.troponinCheckTime = Convert.ToDateTime(troponinCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
dto.troponinType = troponinType.EditValue != null ? troponinType.EditValue.ToString() : "";
|
|
dto.troponinValue = troponinValue.Text;
|
|
switch (troponinUnit.Text)
|
|
{
|
|
case "ug/L": dto.troponinUnit = "1"; break;
|
|
case "ng/L": dto.troponinUnit = "2"; break;
|
|
case "mg/L": dto.troponinUnit = "3"; break;
|
|
case "ng/ml": dto.troponinUnit = "4"; break;
|
|
default: dto.troponinUnit = ""; break;
|
|
}
|
|
switch (troponinStatus.Text)
|
|
{
|
|
case "阳性": dto.troponinStatus = "1"; break;
|
|
case "阴性": dto.troponinStatus = "2"; break;
|
|
default: dto.troponinStatus = ""; break;
|
|
}
|
|
}
|
|
dto.isBnp = isBnp.EditValue != null ? isBnp.EditValue.ToString() : "";
|
|
if (dto.isBnp == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(bnpCheckTime.TimeValue)) dto.bnpCheckTime = Convert.ToDateTime(bnpCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
dto.bnpType = bnpType.EditValue != null ? bnpType.EditValue.ToString() : "";
|
|
dto.bnpValue = bnpValue.Text;
|
|
}
|
|
dto.isUcg = isUcg.EditValue != null ? isUcg.EditValue.ToString() : "";
|
|
if (dto.isUcg == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(ucgCheckTime.TimeValue)) dto.ucgCheckTime = Convert.ToDateTime(ucgCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
dto.ucgLvef = ucgLvef.Text;
|
|
dto.ucgVan = ucgVan.EditValue != null ? ucgVan.EditValue.ToString() : "";
|
|
dto.ucgRwm = ucgRwm.EditValue != null ? ucgRwm.EditValue.ToString() : "";
|
|
}
|
|
dto.isCag = isCag.EditValue != null ? isCag.EditValue.ToString() : "";
|
|
if (dto.isCag == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(cagCheckTime.TimeValue)) dto.cagCheckTime = Convert.ToDateTime(cagCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
dto.isCoronaryCta = isCoronaryCta.EditValue != null ? isCoronaryCta.EditValue.ToString() : "";
|
|
if (dto.isCoronaryCta == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(coronaryCtaCheckTime.TimeValue)) dto.coronaryCtaCheckTime = Convert.ToDateTime(coronaryCtaCheckTime.TimeValue).ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
dto.ecgFile = imagefile;
|
|
dto.status = status;
|
|
list.Add(dto);
|
|
string Url = string.Empty;
|
|
Url = "api/service/T_Service_ChestPain_FollowUpInfo/SaveFollowUpInspectionItem";
|
|
//初始化两个工厂
|
|
ClientFactory<FollowUpInspectionItemDTO> httpClient = new HttpClientFactory<FollowUpInspectionItemDTO>();
|
|
Client<FollowUpInspectionItemDTO> client = httpClient.VisitFactory();
|
|
//访问
|
|
ListEntity<FollowUpInspectionItemDTO> 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("保存失败");
|
|
}
|
|
|
|
}
|
|
|
|
private void isHasEcg_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isHasEcg.EditValue.ToString() == "1")
|
|
{
|
|
panelControl44.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl44.Visible = false;
|
|
imagefile = "";
|
|
}
|
|
}
|
|
|
|
private void isCkmb_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isCkmb.EditValue.ToString() == "1")
|
|
{
|
|
panelControl54.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl54.Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
private void isTroponin_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isTroponin.EditValue.ToString() == "1")
|
|
{
|
|
panelControl57.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl57.Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
private void isBnp_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isBnp.EditValue.ToString() == "1")
|
|
{
|
|
panelControl60.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl60.Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
private void isUcg_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isUcg.EditValue.ToString() == "1")
|
|
{
|
|
panelControl63.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl63.Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
private void isCag_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isCag.EditValue.ToString() == "1")
|
|
{
|
|
panelControl66.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl66.Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
private void isCoronaryCta_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (isCoronaryCta.EditValue.ToString() == "1")
|
|
{
|
|
panelControl68.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
panelControl68.Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void labelControl76_Click(object sender, EventArgs e)
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
ofd.Filter = "Image Files(*.JPG;*.PNG;*.JPEG;;*.BMP)|*.JPG;*.PNG;;*.BMP;*.JPEG";
|
|
ofd.RestoreDirectory = true;
|
|
if (ofd.ShowDialog() == DialogResult.OK)
|
|
{
|
|
int Config109 = PublicClass.ToInt32(PublicClassForDataBase.Config109, 5);
|
|
string FileName = ofd.FileName;
|
|
if (PublicClass.GetFileSize(FileName) <= Config109)
|
|
{
|
|
imagefile = ImageToBase64(FileName);
|
|
ecgFile.Text = "获取到一份心电图";
|
|
ecgFile.ForeColor = System.Drawing.Color.FromArgb(128, 134, 149);
|
|
}
|
|
else
|
|
{
|
|
ecgFile.Text = "";
|
|
XtraMessageBox.Show(string.Format("选择的文件大小超出了限制,请将文件控制在{0}兆以内!", Config109), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 图片转base64
|
|
/// </summary>
|
|
/// <param name="fileFullName"></param>
|
|
/// <returns></returns>
|
|
private static string ImageToBase64(string fileFullName)
|
|
{
|
|
try
|
|
{
|
|
Bitmap bmp = new Bitmap(fileFullName);
|
|
MemoryStream ms = new MemoryStream();
|
|
var suffix = fileFullName.Substring(fileFullName.LastIndexOf('.') + 1,
|
|
fileFullName.Length - fileFullName.LastIndexOf('.') - 1).ToLower();
|
|
var suffixName = suffix == "png"
|
|
? ImageFormat.Png
|
|
: suffix == "jpg" || suffix == "jpeg"
|
|
? ImageFormat.Jpeg
|
|
: suffix == "bmp"
|
|
? ImageFormat.Bmp
|
|
: suffix == "gif"
|
|
? ImageFormat.Gif
|
|
: ImageFormat.Jpeg;
|
|
bmp.Save(ms, suffixName);
|
|
byte[] arr = new byte[ms.Length];
|
|
ms.Position = 0;
|
|
ms.Read(arr, 0, (int)ms.Length);
|
|
ms.Close();
|
|
string base64String = Convert.ToBase64String(arr);
|
|
return base64String;
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
}
|
|
private void ckmbValue_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if(ckmbUnit.Text== "ng/mL")
|
|
{
|
|
if (!string.IsNullOrEmpty(ckmbValue.Text + ""))
|
|
{
|
|
if (double.Parse(ckmbValue.Text.Trim() + "") > 5)
|
|
{
|
|
ckmbValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
ckmbValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ckmbValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void ckmbUnit_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (ckmbUnit.Text == "ng/mL")
|
|
{
|
|
if (!string.IsNullOrEmpty(ckmbValue.Text + ""))
|
|
{
|
|
if (double.Parse(ckmbValue.Text.Trim() + "") > 5)
|
|
{
|
|
ckmbValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
ckmbValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ckmbValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void troponinValue_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (troponinUnit.Text == "ug/L")
|
|
{
|
|
if (!string.IsNullOrEmpty(troponinValue.Text + ""))
|
|
{
|
|
if (double.Parse(troponinValue.Text.Trim() + "") > 0.1)
|
|
{
|
|
troponinValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
troponinValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
troponinValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void troponinUnit_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (troponinUnit.Text == "ug/L")
|
|
{
|
|
if (!string.IsNullOrEmpty(troponinValue.Text + ""))
|
|
{
|
|
if (double.Parse(troponinValue.Text.Trim() + "") > 0.1)
|
|
{
|
|
troponinValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
troponinValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
troponinValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void bnpValue_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (bnpType.SelectedIndex == 0)
|
|
{
|
|
if (!string.IsNullOrEmpty(bnpValue.Text + ""))
|
|
{
|
|
if (double.Parse(bnpValue.Text.Trim() + "") > 100)
|
|
{
|
|
bnpValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
bnpValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
if (bnpType.SelectedIndex == 1)
|
|
{
|
|
if (!string.IsNullOrEmpty(bnpValue.Text + ""))
|
|
{
|
|
if (double.Parse(bnpValue.Text.Trim() + "") > 300)
|
|
{
|
|
bnpValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
bnpValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void bnpType_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (bnpType.SelectedIndex == 0)
|
|
{
|
|
if (!string.IsNullOrEmpty(bnpValue.Text + ""))
|
|
{
|
|
if (double.Parse(bnpValue.Text.Trim() + "") > 100)
|
|
{
|
|
bnpValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
bnpValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
if (bnpType.SelectedIndex == 1)
|
|
{
|
|
if (!string.IsNullOrEmpty(bnpValue.Text + ""))
|
|
{
|
|
if (double.Parse(bnpValue.Text.Trim() + "") > 300)
|
|
{
|
|
bnpValue.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
bnpValue.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|