629 lines
25 KiB
C#
629 lines
25 KiB
C#
using DevExpress.XtraEditors;
|
||
using DevExpress.XtraEditors.Controls;
|
||
using DevExpress.XtraEditors.Repository;
|
||
using DevExpress.XtraTreeList;
|
||
using DevExpress.XtraTreeList.Nodes;
|
||
using HL_FristAidPlatform_DTO;
|
||
using HL_FristAidPlatform_Public;
|
||
using Microsoft.AspNetCore.SignalR.Client;
|
||
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Configuration;
|
||
using System.Data;
|
||
using System.Media;
|
||
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
|
||
namespace HL_FristAidPlatform_PreHospitalEmergency
|
||
{
|
||
|
||
public partial class Form_Call : XtraForm
|
||
{
|
||
|
||
public string guid = "";
|
||
public string GUID = " ";
|
||
public string uid = "";
|
||
public string nodeuid = "";
|
||
public string accidentName = "";
|
||
public string leveName = "";
|
||
private string ambulance_GUID;
|
||
private string DispatchNo;
|
||
|
||
//定义一个连接对象
|
||
private HubConnection connection;
|
||
private static string path = AppDomain.CurrentDomain.BaseDirectory + "救护车.wav"; //.wav音频文件路径
|
||
SoundPlayer player = new SoundPlayer(path);
|
||
|
||
|
||
public Form_Call()
|
||
{
|
||
InitializeComponent();
|
||
SignalRConnection();
|
||
}
|
||
|
||
public async void SignalRConnection()
|
||
{
|
||
connection = new HubConnectionBuilder()
|
||
.WithUrl(ConfigurationManager.AppSettings["WebApiUrl"] + "signalr/chatHub")
|
||
.Build();
|
||
await connection.StartAsync();
|
||
connection.Closed += async (error) =>
|
||
{
|
||
await Task.Delay(new Random().Next(0, 5) * 1000);
|
||
await connection.StartAsync();
|
||
};
|
||
}
|
||
|
||
private async void Form_Call_Load(object sender, EventArgs e)
|
||
{
|
||
lbl_hosptialName.Text = Information.Hospital.Name + "急救任务单";
|
||
#region
|
||
connection.On<object>("ReceiveUpdate", (message) =>
|
||
{
|
||
Invoke(new Action(() =>
|
||
{
|
||
|
||
}));
|
||
});
|
||
#endregion
|
||
textBox_CallTime.TimeValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
BindDate();
|
||
TreeList();
|
||
BindGender();
|
||
BindHospital();
|
||
textBox_PoliceReceiver.Text = Information.User.FullName;
|
||
lookUpEdit_HospitalName.Text = Information.Hospital.Name;
|
||
lookUpEdit_HospitalName.EditValue = Information.Hospital.GUID;
|
||
}
|
||
|
||
|
||
private void simpleButton_Location_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
||
{
|
||
Form_Map form_Map = new Form_Map(textBox_WaitingAddress.Text == "" ? textBox_CallAddress.Text : textBox_WaitingAddress.Text);
|
||
form_Map.Show();
|
||
}
|
||
|
||
private/* async*/ void simpleButton_SendSingle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
||
{
|
||
//try
|
||
//{
|
||
// GUID = Guid.NewGuid().ToString();
|
||
// if (string.IsNullOrEmpty(textBox_CallAddress.Text))
|
||
// {
|
||
// XtraMessageBox.Show("呼救地址不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
// textBox_CallAddress.Focus();
|
||
// GUID = "";
|
||
// return;
|
||
// }
|
||
// if (string.IsNullOrEmpty(lookUpEdit_HospitalName.Text))
|
||
// {
|
||
// XtraMessageBox.Show("医院不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
// lookUpEdit_HospitalName.Focus();
|
||
// GUID = "";
|
||
// return;
|
||
// }
|
||
// if (string.IsNullOrEmpty(textBox_ContactsPhone.Text) && string.IsNullOrEmpty(textBox_PoliceCall.Text))
|
||
// {
|
||
// XtraMessageBox.Show("报警电话和联系人电话必须有一个不为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
// textBox_ContactsPhone.Focus();
|
||
// GUID = "";
|
||
// return;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(textBox_Age.Text.ToString()) && !Regex.IsMatch(textBox_Age.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
|
||
// {
|
||
// XtraMessageBox.Show("年龄只能是数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
// textBox_Age.Focus();
|
||
// return;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(textBox_PoliceCall.Text) && !Regex.IsMatch(textBox_PoliceCall.Text.ToString(), @"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$"))
|
||
// {
|
||
// XtraMessageBox.Show("报警电话号码不合法", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
// textBox_PoliceCall.Focus();
|
||
// return;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(textBox_ContactsPhone.Text) && !Regex.IsMatch(textBox_ContactsPhone.Text.ToString(), @"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$"))
|
||
// {
|
||
// XtraMessageBox.Show("联系人电话号码不合法", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
// textBox_ContactsPhone.Focus();
|
||
// return;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(GUID))
|
||
// {
|
||
// //从客户端调用集线器方法 使用指定的方法名称和参数在服务器上调用中心方法
|
||
// await connection.InvokeAsync("SendMessageToGroupAsync", "出车", "你有新的急救任务,请打印派车单出车。PatientGUID:" + GUID + "");
|
||
// }
|
||
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// this.textBox_WaitingAddress.Text = ex.Message;
|
||
// PublicClass.WriteErrorLog(this.Text, "无法连接到服务器:请在连接客户端之前启动服务器.");
|
||
//}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定性别
|
||
/// </summary>
|
||
private void BindGender()
|
||
{
|
||
try
|
||
{
|
||
DataTable GenderDT = DBHelpClass.Get("/api/base/T_Base_Gender/GetList");
|
||
PublicClass.BindRadioGroupData(textBox_Gender, GenderDT, "GenderName", "GenderCode");
|
||
textBox_Gender.EditValue = "0";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定性别:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定医院
|
||
/// </summary>
|
||
private void BindHospital()
|
||
{
|
||
try
|
||
{
|
||
DataTable GenderDT = DBHelpClass.Get("/api/base/T_Base_Hospital/GetHospitalOfParentGUID?parentGUID=" + Information.Hospital.ParentGUID + "");
|
||
|
||
lookUpEdit_HospitalName.Properties.DataSource = GenderDT;
|
||
if (GenderDT != null && GenderDT.Rows.Count > 0)
|
||
{
|
||
lookUpEdit_HospitalName.EditValue = GenderDT.Rows[0];
|
||
}
|
||
lookUpEdit_HospitalName.Properties.DisplayMember = "Name";
|
||
lookUpEdit_HospitalName.Properties.ValueMember = "GUID";
|
||
GenderDT.Columns["GUID"].ColumnMapping = MappingType.Hidden;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定医院:rn" + ex);
|
||
}
|
||
}
|
||
public void TreeList()
|
||
{
|
||
try
|
||
{
|
||
string res = DBHelpClass.GetDateOfStr("/api/base/T_Base_AccidentInfo/GetListAccidentInfo");
|
||
List<AccidentInfoModelDTO> accidents = JsonConvert.DeserializeObject<List<AccidentInfoModelDTO>>(res);
|
||
this.treeList1.Nodes.Clear();
|
||
this.treeList1.BeginUpdate();
|
||
DataTable dt = new DataTable();
|
||
dt.Columns.Add("uid");
|
||
dt.Columns.Add("nodeuid");
|
||
dt.Columns.Add("index");
|
||
dt.Columns.Add("parentUid");
|
||
dt.Columns.Add("parentIndex");
|
||
dt.Columns.Add("名称");
|
||
dt.Columns.Add("描述");
|
||
dt.Columns.Add("nodeName");
|
||
dt.Columns.Add("parentName");
|
||
int index = 0;
|
||
if (accidents != null)
|
||
{
|
||
foreach (var a in accidents)
|
||
{
|
||
ParseDataTable(dt, a, null, ref index, 0);
|
||
}
|
||
//TreeList绑定数据
|
||
this.treeList1.DataSource = dt;
|
||
|
||
this.treeList1.KeyFieldName = "index";
|
||
this.treeList1.ParentFieldName = "parentIndex";
|
||
this.treeList1.Columns.ColumnByFieldName("uid").Visible = false;
|
||
this.treeList1.Columns.ColumnByFieldName("parentUid").Visible = false;
|
||
this.treeList1.Columns.ColumnByFieldName("nodeuid").Visible = false;
|
||
this.treeList1.Columns.ColumnByFieldName("parentName").Visible = false;
|
||
this.treeList1.Columns.ColumnByFieldName("nodeName").Visible = false;
|
||
this.treeList1.EndUpdate();
|
||
this.treeList1.ExpandAll();
|
||
|
||
treeList1.OptionsView.ShowCheckBoxes = true;
|
||
treeList1.CustomDrawNodeCheckBox += treeList1_CustomDrawNodeCheckBox; //进行显隐实现
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "TreeList绑定数据:\r\n" + ex);
|
||
}
|
||
|
||
}
|
||
//private async void Form_Call_FormClosing(object sender, FormClosingEventArgs e)
|
||
//{
|
||
// try
|
||
// {
|
||
// await connection.InvokeAsync("RemoveFromGroup", "出车");
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// PublicClass.WriteErrorLog(this.Text, "关闭SignalRClient:\r\n" + ex);
|
||
// }
|
||
//}
|
||
|
||
private void ParseDataTable(DataTable dt, AccidentInfoModelDTO childVo, AccidentInfoModelDTO parentVo, ref int childIndex, int parentIndex)
|
||
{
|
||
DataRow dataRow = dt.NewRow();
|
||
dataRow["uid"] = childVo.GUID;
|
||
dataRow["nodeuid"] = childVo.NodeGUID;
|
||
int index = ++childIndex;
|
||
dataRow["index"] = index;
|
||
dataRow["名称"] = childVo.Name;
|
||
dataRow["描述"] = childVo.Describe;
|
||
dataRow["nodeName"] = childVo.NodeName;
|
||
dataRow["parentName"] = childVo.ParentName;
|
||
if (null != parentVo)
|
||
{
|
||
dataRow["parentUid"] = parentVo.GUID;
|
||
dataRow["parentIndex"] = parentIndex;
|
||
}
|
||
else
|
||
{
|
||
dataRow["parentUid"] = null;
|
||
dataRow["parentIndex"] = null;
|
||
}
|
||
dt.Rows.Add(dataRow);
|
||
if (null != childVo.childrenModel && childVo.childrenModel.Count > 0)
|
||
{
|
||
foreach (AccidentInfoModelDTO itemVo in childVo.childrenModel)
|
||
{
|
||
ParseDataTable(dt, itemVo, childVo, ref childIndex, index);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
private void treeList1_CustomDrawNodeCheckBox(object sender, CustomDrawNodeCheckBoxEventArgs e)
|
||
{
|
||
HideCheckBox(n => n.Nodes.ParentNode.HasChildren, e);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 隐藏父节点的复选框
|
||
/// </summary>
|
||
/// <param name="tree"></param>
|
||
/// <param name="conditionHanlder"></param>
|
||
/// <param name="e"></param>
|
||
private void HideCheckBox(Predicate<TreeListNode> conditionHanlder, CustomDrawNodeCheckBoxEventArgs e)
|
||
{
|
||
if (conditionHanlder(e.Node))
|
||
{
|
||
e.Handled = true;
|
||
}
|
||
}
|
||
|
||
private void Form_Call_FormClosed(object sender, FormClosedEventArgs e)
|
||
{
|
||
this.Dispose();
|
||
|
||
}
|
||
|
||
|
||
private void BindDate()
|
||
{
|
||
#region 车辆
|
||
string url = string.Format("/api/base/T_Base_Ambulance/GetListForState?state={0}&hospitalGuid={1}", 1, Information.Hospital.GUID);
|
||
DataTable dt = DBHelpClass.Get(url);
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
//CheckedListBoxItem[] items = null;
|
||
for (int i = 0; i < dt.Rows.Count; i++)
|
||
{
|
||
CheckedListBoxItem item = new CheckedListBoxItem();
|
||
item.Value = dt.Rows[i]["GUID"];
|
||
item.Description = dt.Rows[i]["PlateNumber"].ToString();
|
||
checkedComboBoxEdit1.Properties.Items.Add(item);
|
||
}
|
||
}
|
||
checkedComboBoxEdit1.Properties.ItemAutoHeight = true;
|
||
//GridColumn gridColumn_PlateNumberGUID = new GridColumn();
|
||
//gridColumn_PlateNumberGUID.Caption = "GUID";
|
||
//gridColumn_PlateNumberGUID.FieldName = "GUID";
|
||
//gridColumn_PlateNumberGUID.VisibleIndex = 0;
|
||
//GridColumn gridColumn_PlateNumber = new GridColumn();
|
||
//gridColumn_PlateNumber.Caption = "车牌号";
|
||
//gridColumn_PlateNumber.FieldName = "PlateNumber";
|
||
//gridColumn_PlateNumber.VisibleIndex = 1;
|
||
//gridLookUpEdit2.Properties.View.Columns.AddRange(new GridColumn[] { gridColumn_PlateNumberGUID, gridColumn_PlateNumber });
|
||
//gridLookUpEdit2.Properties.DataSource = dt; //数据源
|
||
//gridLookUpEdit2.Properties.View.Columns[0].Visible = false;
|
||
//gridLookUpEdit2View.BestFitColumns();
|
||
//gridLookUpEdit2.CustomDisplayText += new CustomDisplayTextEventHandler(gridLookUpAmbulance_CustomDisplayText);
|
||
//GridCheckMarksSelection gridCheckMarksAmbulance;
|
||
//gridCheckMarksAmbulance = new GridCheckMarksSelection(gridLookUpEdit2.Properties);
|
||
//gridCheckMarksAmbulance.SelectionChanged += new GridCheckMarksSelection.SelectionChangedEventHandler(gridCheckMarksAmbulance_SelectionChanged);
|
||
//gridLookUpEdit2.Properties.Tag = gridCheckMarksAmbulance;
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
#region 事件号
|
||
DispatchNo = DBHelpClass.GetDateOfStr("/api/service/T_Service_FirstAid_Call/GetMaxDispatchNo");
|
||
if (DispatchNo != "null")
|
||
{
|
||
DispatchNo = DispatchNo + 1;
|
||
}
|
||
else
|
||
{
|
||
DispatchNo = DateTime.Now.ToString("yyyy-MM-dd").Replace("-", "") + DateTime.Now.Hour.ToString("00") + DateTime.Now.Minute.ToString("00") + "0001";
|
||
}
|
||
textEdit_DispatchNo.Text = DispatchNo;
|
||
#endregion
|
||
|
||
}
|
||
|
||
object m_sender;
|
||
|
||
// 选中时更新显示的文本 车辆控件
|
||
private void gridLookUpAmbulance_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
GridCheckMarksSelection gridCheckMark = sender is GridLookUpEdit ? (sender as GridLookUpEdit).Properties.Tag as GridCheckMarksSelection : (sender as RepositoryItemGridLookUpEdit).Tag as GridCheckMarksSelection;
|
||
if (gridCheckMark == null) return;
|
||
|
||
foreach (DataRowView rv in gridCheckMark.Selection)
|
||
{
|
||
{
|
||
if (sb.ToString().Length > 0)
|
||
{
|
||
sb.Append(", ");
|
||
}
|
||
sb.Append(rv["PlateNumber"].ToString());
|
||
}
|
||
e.DisplayText = sb.ToString();
|
||
|
||
m_sender = sender;
|
||
}
|
||
|
||
e.DisplayText = e.DisplayText == "System.Data.DataRowView" ? "" : e.DisplayText;
|
||
}
|
||
|
||
private void gridCheckMarksAmbulance_SelectionChanged(object sender, EventArgs e)
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
//ambulance_GUID = new StringBuilder();
|
||
if (ActiveControl is GridLookUpEdit)
|
||
{
|
||
foreach (DataRowView rv in (sender as GridCheckMarksSelection).Selection)
|
||
{
|
||
if (sb.ToString().Length > 0)
|
||
{
|
||
sb.Append(", ");
|
||
//ambulance_GUID.Append(",");
|
||
}
|
||
sb.Append(rv["PlateNumber"].ToString());
|
||
// ambulance_GUID.Append(rv["GUID"].ToString());
|
||
}
|
||
(ActiveControl as GridLookUpEdit).Text = sb.ToString();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 单选
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void treeList1_AfterCheckNode(object sender, NodeEventArgs e)
|
||
{
|
||
DataRowView drv = treeList1.GetDataRecordByNode(e.Node) as DataRowView;
|
||
foreach (TreeListNode item in treeList1.Nodes)
|
||
{
|
||
accidentName = (string)drv["parentName"];
|
||
leveName = (string)drv["nodeName"];
|
||
uid = (string)drv["uid"];
|
||
nodeuid = (string)drv["nodeuid"];
|
||
foreach (TreeListNode s in item.Nodes)
|
||
{
|
||
if (s.Id == e.Node.Id)
|
||
{
|
||
s.Checked = true;
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
s.Checked = false;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
private void checkBox_MajorEvents_Click(object sender, EventArgs e)
|
||
{
|
||
if (checkBox_MajorEvents.Checked == true)
|
||
{
|
||
treeList1.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
treeList1.Enabled = false;
|
||
}
|
||
}
|
||
|
||
private void simpleButton1_Click(object sender, EventArgs e)
|
||
{
|
||
SaveAlarmInfo();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存接警信息
|
||
/// </summary>
|
||
public async void SaveAlarmInfo()
|
||
{
|
||
try
|
||
{
|
||
List<AlarmInfoDTO> list = new List<AlarmInfoDTO>();
|
||
AlarmInfoDTO dto = new AlarmInfoDTO();
|
||
|
||
#region 验证
|
||
if (string.IsNullOrEmpty(lookUpEdit_HospitalName.EditValue.ToString()))
|
||
{
|
||
XtraMessageBox.Show("医院不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
lookUpEdit_HospitalName.Focus();
|
||
return;
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(textBox_CallAddress.Text.ToString()))
|
||
{
|
||
|
||
XtraMessageBox.Show("呼救地址不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
textBox_CallAddress.Focus();
|
||
return;
|
||
}
|
||
|
||
|
||
if (string.IsNullOrEmpty(textBox_WaitingAddress.Text.ToString()))
|
||
{
|
||
|
||
XtraMessageBox.Show("候车地址不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
textBox_WaitingAddress.Focus();
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(textBox_PoliceCall.Text))
|
||
{
|
||
XtraMessageBox.Show("报警电话不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
textBox_PoliceCall.Focus();
|
||
return;
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(textEdit2.Text))
|
||
{
|
||
textEdit2.Text = "1";
|
||
}
|
||
if (!string.IsNullOrEmpty(textEdit2.Text) && !Regex.IsMatch(textEdit2.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
|
||
{
|
||
XtraMessageBox.Show("患者人数只能是数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
textEdit2.Focus();
|
||
return;
|
||
}
|
||
|
||
|
||
if (string.IsNullOrEmpty(textBox_CallTime.TimeValue.ToString()))
|
||
{
|
||
XtraMessageBox.Show("报警时间不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
textBox_CallTime.Focus();
|
||
return;
|
||
}
|
||
|
||
|
||
List<object> ambulance = checkedComboBoxEdit1.Properties.Items.GetCheckedValues();
|
||
if (ambulance != null && ambulance.Count > 0)
|
||
{
|
||
foreach (var item in ambulance)
|
||
{
|
||
ambulance_GUID += item.ToString() + ",";
|
||
}
|
||
if (!string.IsNullOrEmpty(ambulance_GUID))
|
||
ambulance_GUID = ambulance_GUID.TrimEnd(',');
|
||
}
|
||
else
|
||
{
|
||
XtraMessageBox.Show("出动车辆不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
checkedComboBoxEdit1.Focus();
|
||
return;
|
||
}
|
||
if (!string.IsNullOrEmpty(textBox_Age.Text))
|
||
{
|
||
if (!string.IsNullOrEmpty(textBox_Age.Text) && !Regex.IsMatch(textBox_Age.Text.ToString(), @"^-?[1-9]\d*$|^0$"))
|
||
{
|
||
XtraMessageBox.Show("年龄只能是数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
textBox_Age.Focus();
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 赋值
|
||
dto.CallHospitalGuid = Information.Hospital.GUID;
|
||
dto.HospitalGuid = lookUpEdit_HospitalName.EditValue.ToString();
|
||
dto.WaitingAddress = textBox_WaitingAddress.Text.ToString();
|
||
dto.CallAddress = textBox_CallAddress.Text.ToString();
|
||
dto.CallType = textBox_CallType.Text.ToString();
|
||
dto.CallTime = Convert.ToDateTime(textBox_CallTime.TimeValue);
|
||
dto.PoliceReceiver = Information.User.ID;
|
||
dto.DispatchNo = textEdit_DispatchNo.Text.ToString();
|
||
dto.PoliceCall = textBox_PoliceCall.Text.ToString();
|
||
dto.ChiefComplaint = textBox_ChiefComplaint.Text.ToString();
|
||
|
||
dto.Pathogeny = textBox_Pathogeny.Text.ToString() == "请选择" ? "" : textBox_Pathogeny.Text.ToString();
|
||
dto.PatientsNumber = int.Parse(textEdit2.Text);
|
||
dto.AmbulanceGUID = ambulance_GUID.ToString();
|
||
dto.AccidentGUID = uid;
|
||
dto.AccidentLeveGUID = nodeuid;
|
||
dto.Name = textBox_Name.Text.ToString();
|
||
dto.Gender = int.Parse(textBox_Gender.EditValue.ToString());
|
||
dto.Address = text_Address.Text.ToString();
|
||
dto.Phone = textBox_Phone.Text.ToString();
|
||
if (string.IsNullOrEmpty(textBox_Age.Text))
|
||
{
|
||
dto.Age = 0;
|
||
}
|
||
else
|
||
{
|
||
dto.Age = int.Parse(textBox_Age.Text);
|
||
}
|
||
|
||
if (ck_Consciousness.Checked == true) { dto.IsConsciousness = true; } else { dto.IsConsciousness = false; }
|
||
list.Add(dto);
|
||
#endregion
|
||
|
||
string Url = string.Empty;
|
||
Url = "api/service/FristAidTran/SaveAlarmInfoTran";
|
||
//初始化两个工厂
|
||
ClientFactory<AlarmInfoDTO> httpClient = new HttpClientFactory<AlarmInfoDTO>();
|
||
Client<AlarmInfoDTO> client = httpClient.VisitFactory();
|
||
|
||
//访问
|
||
ListEntity<AlarmInfoDTO> t = client.Post(Url, list);
|
||
if (t.Success)
|
||
{
|
||
MessageBox.Show("派车成功");
|
||
Form_CurrentTaskInfo taskInfo = new Form_CurrentTaskInfo();
|
||
taskInfo.GetTotalDrvingCensus(Information.Hospital.GUID);
|
||
taskInfo.QueryTaskInfo(Information.Hospital.GUID);
|
||
taskInfo.QueryHosptialAmbulanceInfo(Information.Hospital.GUID);
|
||
|
||
DataTable dt = DBHelpClass.Get(string.Format("api/admin/T_SYS_User/GetUserIdOfVehicle?guid=" + ambulance_GUID.ToString()));
|
||
|
||
if (dt != null)
|
||
{
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < dt.Rows.Count; i++)
|
||
{
|
||
await connection.InvokeAsync("SendMessageToGroupAsync", dt.Rows[i]["ID"].ToString(), "您有一个出警任务待处理");
|
||
}
|
||
}
|
||
}
|
||
await connection.InvokeAsync("SendMessageToGroupAsync", Information.Hospital.GUID.ToString(), "TaskList");
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("派车失败");
|
||
}
|
||
Close();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Close();
|
||
throw ex;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
private void textBox_CallAddress_EditValueChanged(object sender, EventArgs e)
|
||
{
|
||
textBox_WaitingAddress.Text = textBox_CallAddress.Text;
|
||
}
|
||
|
||
}
|
||
}
|
||
|