StableVersion4.3/HL_FristAidPlatform_EMRS/Form_Triage.cs

171 lines
5.9 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
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_EmergencyTriage
{
public partial class Form_Triage : XtraForm
{
string Guid = string.Empty;
public Form_Triage()
{
InitializeComponent();
}
public Form_Triage(string taskGuid)
{
InitializeComponent();
Guid = taskGuid;
}
/// <summary>
/// 绑定所属系统模块
/// </summary>
private void BindSystemModule()
{
try
{
string Url = string.Format("/api/admin/T_SYS_SystemModule/GetRightListByHospitalID?hospitalID={0}&isHaveTimeAxis=0", Information.Hospital.ID);
DataTable ResultDT = DBHelpClass.Get(Url);
if (ResultDT != null && ResultDT.Rows.Count > 0)
{
DataTable BindData = new DataTable();
BindData.Columns.Add("ID", Type.GetType("System.String"));
BindData.Columns.Add("SystemName", Type.GetType("System.String"));
BindData.Columns.Add("IconData", Type.GetType("System.Byte[]"));
foreach (DataRow item in ResultDT.Rows)
{
DataRow newRow = BindData.NewRow();
newRow["ID"] = item["ID"];
newRow["SystemName"] = item["ShortName"] + "患者";
if (!string.IsNullOrEmpty(PublicClass.ToString(item["IconData"], "")))
{
newRow["IconData"] = Convert.FromBase64String(item["IconData"].ToString());
}
else
{
newRow["IconData"] = null;
}
BindData.Rows.Add(newRow);
}
listBox_SystemModule.DataSource = BindData;
listBox_SystemModule.ValueMember = "ID";
listBox_SystemModule.DisplayMember = "SystemName";
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定所属系统模块:\r\n" + ex);
}
}
private void Form_Triage_Load(object sender, EventArgs e)
{
BindSystemModule();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
if(!radioButton_PatientLevel_1.Checked&& !radioButton_PatientLevel_2.Checked && !radioButton_PatientLevel_3.Checked && !radioButton_PatientLevel_4.Checked)
{
XtraMessageBox.Show("病情等级不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (!radioButton_PatientSubarea_1.Checked && !radioButton_PatientSubarea_2.Checked && !radioButton_PatientSubarea_3.Checked)
{
XtraMessageBox.Show("分区不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(checkedListBoxControl_TriageDepartment.Text))
{
XtraMessageBox.Show("分诊科室不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
checkedListBoxControl_TriageDepartment.Focus();
return;
}
if (listBox_SystemModule.SelectedIndex == -1)
{
XtraMessageBox.Show("患者所属分类不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
listBox_SystemModule.Focus();
return;
}
List<TriageDTO> list = new List<TriageDTO>();
TriageDTO dto = new TriageDTO();
if (radioButton_PatientLevel_1.Checked)
{
dto.Killip = "I 级(急危病人)";
}
else if (radioButton_PatientLevel_2.Checked)
{
dto.Killip = "Ⅱ 级(急危病人)";
}
else if (radioButton_PatientLevel_3.Checked)
{
dto.Killip = "Ⅲ 级(急危病人)";
}
else if (radioButton_PatientLevel_4.Checked)
{
dto.Killip = "Ⅳ 级(急危病人)";
}
if (radioButton_PatientSubarea_1.Checked)
{
dto.SignArea = "红区";
}
else if (radioButton_PatientSubarea_2.Checked)
{
dto.SignArea = "黄区";
}
else if (radioButton_PatientSubarea_3.Checked)
{
dto.SignArea = "绿区";
}
dto.TriageDepartment = checkedListBoxControl_TriageDepartment.Text;
dto.SystemModelId = int.Parse(((System.Data.DataRowView)listBox_SystemModule.SelectedItem).Row.ItemArray[0].ToString());
dto.patientGUID = Guid;
dto.CreatorID = Information.User.ID;
list.Add(dto);
string Url = string.Empty;
Url = "api/service/T_Service_Patient/UpdatePatientTriagem";
//初始化两个工厂
ClientFactory<TriageDTO> httpClient = new HttpClientFactory<TriageDTO>();
Client<TriageDTO> client = httpClient.VisitFactory();
ListEntity<TriageDTO> t = client.Post(Url, list);
if (t.Success)
{
XtraMessageBox.Show("分诊成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
}
}
}