138 lines
4.7 KiB
C#
138 lines
4.7 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.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_Trauma
|
|
{
|
|
public partial class Form_AddGroupInjury : XtraForm
|
|
{
|
|
public Form_AddGroupInjury()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form_AddGroupInjury_Load(object sender, EventArgs e)
|
|
{
|
|
BindGender();
|
|
}
|
|
|
|
private void BindGender()
|
|
{
|
|
try
|
|
{
|
|
DataTable GenderDT = DBHelpClass.Get("/api/base/T_Base_AccidentInfo/GetListAccident");
|
|
|
|
PublicClass.BindRadioGroupData(radioGroup_EventID, GenderDT, "ParentName", "ID");
|
|
radioGroup_EventID.EditValue = "0";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "绑定性别:\r\n" + ex);
|
|
}
|
|
}
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(textEdit1.Text))
|
|
{
|
|
XtraMessageBox.Show("事件名称不能为空");
|
|
textEdit1.Focus();
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(textEdit2.Text + ""))
|
|
{
|
|
XtraMessageBox.Show("人数不能为空");
|
|
textEdit2.Focus();
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(textEdit3.Text + ""))
|
|
{
|
|
XtraMessageBox.Show("发病地址不能为空");
|
|
textEdit3.Focus();
|
|
return;
|
|
}
|
|
if (radioGroup_EventID.SelectedIndex == -1)
|
|
{
|
|
XtraMessageBox.Show("群伤事件不能为空");
|
|
radioGroup_EventID.Focus();
|
|
return;
|
|
}
|
|
string Url = "";
|
|
GroupInjuryDTO dto = new GroupInjuryDTO();
|
|
List<GroupInjuryDTO> list = new List<GroupInjuryDTO>();
|
|
|
|
dto.EventName = textEdit1.Text.Trim();
|
|
dto.count = int.Parse(textEdit2.Text.Trim());
|
|
dto.AttackAddress = textEdit3.Text.Trim();
|
|
dto.EventID = radioGroup_EventID.EditValue + "";
|
|
dto.CreatorID = Information.User.ID;
|
|
dto.HospitalGuid = Information.Hospital.GUID;
|
|
|
|
Url = "api/service/T_Service_TraumaPatient/SaveGroupInjury";
|
|
|
|
list.Add(dto);
|
|
//初始化两个工厂
|
|
ClientFactory<GroupInjuryDTO> httpClient = new HttpClientFactory<GroupInjuryDTO>();
|
|
Client<GroupInjuryDTO> client = httpClient.VisitFactory();
|
|
//访问
|
|
ListEntity<GroupInjuryDTO> 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("保存失败");
|
|
}
|
|
Form_PatientList department = new Form_PatientList();
|
|
department = (Form_PatientList)this.Owner;
|
|
department.refreshlist();
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
|
|
//Form_PatientList department = new Form_PatientList();
|
|
//department = (Form_PatientList)this.Owner;
|
|
//department.refreshlist();
|
|
this.Close();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|