StableVersion4.3/HL_FristAidPlatform_Apoplexy/Form_PatientUpload.cs

250 lines
7.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using Newtonsoft.Json;
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_PatientUpload : XtraForm
{
public Form_PatientUpload()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
string month = timeControl1.TimeValue + "";
if (!string.IsNullOrEmpty(month))
month = PublicClass.InitMonth(month);
List<string> list = new List<string>();
int[] rownumber = gridView_Patient.GetSelectedRows();//获取选中行号;
foreach (int i in rownumber)
{
//根据行号获取相应行的数据
string PatientGuid = gridView_Patient.GetRowCellValue(i, "GUID").ToString();
list.Add(PatientGuid);
}
if (list.Count > 500)
{
XtraMessageBox.Show("选择要导出的患者超过500条请分两次导出", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
if (list != null && list.Count > 0)
{
string patientList = JsonConvert.SerializeObject(list);
ExcelHelper.OutputApoplexyData(Information.Hospital.GUID,month, patientList);
}
else
{
XtraMessageBox.Show("未选择患者数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
catch (Exception ex)
{
throw;
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
try
{
LoadPatientList();
}
catch (Exception ex)
{
throw;
}
}
private void Form_PatientUpload_Load(object sender, EventArgs e)
{
timeControl1.TimeValue = DateTime.Now.ToString();
LoadPatientList();
}
private void LoadPatientList()
{
try
{
string month = timeControl1.TimeValue + "";
if (!string.IsNullOrEmpty(month))
month = PublicClass.InitMonth(month);
int reportsStatus = -1;
if(comboBoxEdit1.Text == "已导出")
{
reportsStatus = 1;
}
if(comboBoxEdit1.Text == "未导出")
{
reportsStatus = 0;
}
string name = textEdit1.Text + "";
string idCard = textEdit3.Text + "";
string zyNumber = textEdit2.Text + "";
List<ApoplexyOutputPatientListDTO> dt = DBHelpClass.GetList<ApoplexyOutputPatientListDTO>(string.Format("api/service/T_Service_Apoplexy_UploadInfo/GetApoplexyOutputPatientList?hospitalGUID={0}&month={1}&name={2}&zyNumber={3}&idCard={4}&reportsStatus={5}", Information.Hospital.GUID, month, name, zyNumber, idCard, reportsStatus));
gridControl_Patient.DataSource = dt;
gridView_Patient.BestFitColumns();//列宽自适应
}
catch (Exception ex)
{
throw;
}
}
private void gridView_Patient_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
if (e.Column.FieldName == "acZLType")
{
string value = e.Value+"";
string str = "";
if (!string.IsNullOrEmpty(value))
{
if (value.Contains("01"))
{
if (!string.IsNullOrEmpty(str))
{
str += ";静脉溶栓";
}
else
{
str += "静脉溶栓";
}
}
if (value.Contains("02"))
{
if (!string.IsNullOrEmpty(str))
{
str += ";血管内介入治疗";
}
else
{
str += "血管内介入治疗";
}
}
if (value.Contains("03"))
{
if (!string.IsNullOrEmpty(str))
{
str += ";脑出血";
}
else
{
str += "脑出血";
}
}
if (value.Contains("04"))
{
if (!string.IsNullOrEmpty(str))
{
str += ";颅内动脉瘤";
}
else
{
str += "颅内动脉瘤";
}
}
if (value.Contains("05"))
{
if (!string.IsNullOrEmpty(str))
{
str += ";CEA/CAS";
}
else
{
str += "CEA/CAS";
}
}
if (value.Contains("98"))
{
if (!string.IsNullOrEmpty(str))
{
str += ";保守治疗";
}
else
{
str += "保守治疗";
}
}
}
e.DisplayText = str;
}
if (e.Column.FieldName == "Gender")
{
string value = e.Value.ToString();
if (value == "0")
{
e.DisplayText = "未知";
}
if (value == "1")
{
e.DisplayText = "男";
}
if (value == "2")
{
e.DisplayText = "女";
}
}
if (e.Column.FieldName == "ReportsStatus")
{
string value = e.Value.ToString();
if (value == "0")
{
e.DisplayText = "未导出EXCEL";
}
if (value == "1")
{
e.DisplayText = "已导出EXCEL";
}
}
}
private void gridView_Patient_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
if (e.Column.FieldName == "ReportsStatus")
{
string cellValue = PublicClass.ToString(e.CellValue, "");
if (!string.IsNullOrEmpty(cellValue))
{
if (cellValue == "1")
{
e.Appearance.ForeColor = Color.Green;//字体颜色
}
}
}
}
}
}