StableVersion4.3/HL_FristAidPlatform_Trauma/Page/UCOutCome.cs

922 lines
42 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using HL_FristAidPlatform_Trauma.Properties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma.Page
{
public partial class UCOutCome : UserControl
{
public string patientguid;
public string guid;
private int count = 1;
TraumaReceptionInformationModelDTO dto;
string receiveDepartment;
public UCOutCome(string _guid)
{
InitializeComponent();
patientguid = _guid;
}
private void UCRecovery_Load(object sender, EventArgs e)
{
try
{
LoadRecovery();
GetICU();
LoadInpatientDepartment();
}
catch (Exception ex)
{
throw ex;
}
}
private void LoadInpatientDepartment()
{
//var dataTable = DBHelpClass.GetModel("/api/base/T_Base_InpatientDepartment/GetListBySystemModuleID?systemId=4");
//JArray des = (JArray)JsonConvert.DeserializeObject(dataTable);
//JToken[] array = des.ToArray();
//if (array.Length > 0)
//{
// for (int i = 0; i < array.Length; i++)
// {
// var DataObj1 = array[i];
// string dataJson1 = Regex.Replace(DataObj1.ToString(), @"\s", " ");
// JObject dataobj1 = JObject.Parse(dataJson1);
// foreach (var item in dataobj1)
// {
// if (item.Key == "Name")
// {
// comboBoxEdit_DepartmentID.Properties.Items.Add(item.Value);
// }
// }
// }
//}
List<InpatientDepartmentDTO> list = DBHelpClass.GetList<InpatientDepartmentDTO>(string.Format("api/base/T_Base_InpatientDepartment/GetListBySystemModuleID?systemId={0}", long.Parse(PublicClassForDataBase.Config10003)));
DataTable dt = ListToDataTable(list);
PublicClass.SetLookUpList(ref comboBoxEdit_DepartmentID, dt, 0, 1, false);
}
private void LoadRecovery()
{
try
{
//ReceiveInfoDT = DBHelpClass.GetDataRow(string.Format("api/service/T_Service_Trauma_ReceptionInformation/GetByPatientGuid?patientGuid={0}", Cur_PatientGuid));
string url = string.Format("api/service/T_Service_Trauma_ReceptionInformation/GetByPatientGuid?patientGuid={0}", patientguid);
dto = DBHelpClass.GetDateModel<TraumaReceptionInformationModelDTO>(url);
if (dto != null)
{
receiveDepartment = dto.ReceiveDepartment;
if (!string.IsNullOrEmpty(dto.Whereabouts + ""))
{
comboBoxEdit_Whereabouts.SelectedIndex = int.Parse(dto.Whereabouts + "");//患者去向 1离院 2.住院 3.转院4.死亡5.留观6.其他
}
if (comboBoxEdit_Whereabouts.SelectedIndex == 1)
{
timeControl_EmergencyLeaveTime.TimeValue = dto.EmergencyLeaveTime + "";//急诊离院时间
textEdit_ResidenceTime.EditValue = dto.ResidenceTime + "";//急诊停留时间
radioGroup_TreatmentOutcome.EditValue = dto.TreatmentOutcome + "";//治疗结果1 治愈2 好转3 脑死亡4 其他原因离院
if (radioGroup_TreatmentOutcome.EditValue + "" == "4")
{
memoEdit_TreatmentOtherContent.Text = dto.TreatmentOtherContent + "";//其他离院原因
}
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 2)
{
comboBoxEdit_DepartmentID.EditValue = dto.DepartmentID + "";//科室ID
textEdit_InpatientID.EditValue = dto.InpatientID + "";//住院ID
textEdit_ResidenceTime6.EditValue = dto.ResidenceTime + "";//急诊停留时间
timeControl_HospitalizationStartTime.TimeValue = dto.HospitalizationStartTime + "";//办理住院时间
timeControl_HospitalizationEndTime.TimeValue = dto.HospitalizationEndTime + "";//结束住院时间
textEdit_HospitalizationDays.Text = dto.HospitalizationDays + "";//住院天数
radioGroup_Death.EditValue = dto.Death + "";//住院后是否死亡 1是0否
if (radioGroup_Death.EditValue + "" == "1")
{
timeControl_DeathTime2.TimeValue = dto.DeathTime + "";//死亡时间
}
radioGroup_ArriveICU.EditValue = dto.ArriveICU + "";//患者到达ICU 1是0否
if (radioGroup_ArriveICU.EditValue + "" == "1")
{
//ICU List
}
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 3)
{
timeControl_HandoverTime.TimeValue = dto.HandoverTime + "";//交接时间
textEdit_ReceivingHospital.EditValue = dto.ReceivingHospital + "";//接受医院
textEdit_ResidenceTime1.EditValue = dto.ResidenceTime + "";//急诊停留时间
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 4)
{
timeControl_DeathTime1.TimeValue = dto.DeathTime + "";//死亡时间
textEdit_ResidenceTime2.EditValue = dto.ResidenceTime + "";//急诊停留时间
memoEdit_DeathDesc.EditValue = dto.DeathDesc + "";//死亡原因描述
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 5)
{
timeControl_ObservationTime.TimeValue = dto.ObservationTime + "";//急诊留观时间
textEdit_ResidenceTime3.EditValue = dto.ResidenceTime + "";//急诊停留时间
radioGroup_ObservationDead.EditValue = dto.ObservationDead + "";//急诊留观后是否死亡 1是0否
if (radioGroup_ObservationDead.EditValue + "" == "1")
{
timeControl_DeathTime4.TimeValue = dto.DeathTime + "";//死亡时间
memoEdit_KeepInDesc.Text = dto.KeepInDesc + "";//留观原因描述
}
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 6)
{
timeControl_OutComeTime.TimeValue = dto.OutComeTime + "";//转归时间
textEdit_ExactWereabouts.Text = dto.ExactWereabouts + "";//具体去向
textEdit_ResidenceTime5.EditValue = dto.ResidenceTime + "";//急诊停留时间
}
memoEdit_SituationRemarks.Text = dto.SituationRemarks + "";//病人去向情况备注
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "加载创伤接诊信息:\r\n" + ex);
}
}
private void GetICU()
{
DataTable ICUList = DBHelpClass.Get(string.Format("api/service/T_Service_Trauma_ICUList/GetICUListModel?patientGuid={0}", patientguid));
foreach (DataRow item in ICUList.Rows)
{
if (ICUList.Rows.Count >= 1)
{
timeControl_ArriveICUTime.TimeValue = item["ArriveICUTime"] + "";
timeControl_LeaveICUTime.TimeValue = item["LeaveICUTime"] + "";
textEdit_ICUDays.Text = item["ICUDays"] + "";
count = 1;
}
if (ICUList.Rows.Count >= 2)
{
timeControl_ArriveICUTime1.TimeValue = item["ArriveICUTime"] + "";
timeControl_LeaveICUTime1.TimeValue = item["LeaveICUTime"] + "";
textEdit_ICUDays1.Text = item["ICUDays"] + "";
count = 2;
}
if (ICUList.Rows.Count >= 3)
{
timeControl_ArriveICUTime2.TimeValue = item["ArriveICUTime"] + "";
timeControl_LeaveICUTime2.TimeValue = item["LeaveICUTime"] + "";
textEdit_ICUDays2.Text = item["ICUDays"] + "";
count = 3;
}
if (ICUList.Rows.Count >= 4)
{
timeControl_ArriveICUTime3.TimeValue = item["ArriveICUTime"] + "";
timeControl_LeaveICUTime3.TimeValue = item["LeaveICUTime"] + "";
textEdit_ICUDays3.Text = item["ICUDays"] + "";
count = 4;
}
if (ICUList.Rows.Count >= 5)
{
timeControl_ArriveICUTime4.TimeValue = item["ArriveICUTime"] + "";
timeControl_LeaveICUTime4.TimeValue = item["LeaveICUTime"] + "";
textEdit_ICUDays4.Text = item["ICUDays"] + "";
count = 5;
}
if (ICUList.Rows.Count >= 6)
{
timeControl_ArriveICUTime5.TimeValue = item["ArriveICUTime"] + "";
timeControl_LeaveICUTime5.TimeValue = item["LeaveICUTime"] + "";
textEdit_ICUDays5.Text = item["ICUDays"] + "";
count = 6;
}
showICU();
}
}
private void simpleButton5_Click(object sender, EventArgs e)
{
count -= 1;
showICU();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
count += 1;
showICU();
}
private void showICU()
{
if (count >= 2)
{
panelControl28.Visible = true;
}
else
{
panelControl28.Visible = false;
}
if (count >= 3)
{
panelControl29.Visible = true;
}
else
{
panelControl29.Visible = false;
}
if (count >= 4)
{
panelControl30.Visible = true;
}
else
{
panelControl30.Visible = false;
}
if (count >= 5)
{
panelControl31.Visible = true;
}
else
{
panelControl31.Visible = false;
}
if (count >= 6)
{
panelControl32.Visible = true;
}
else
{
panelControl32.Visible = false;
}
}
private void ModifICU()
{
if (radioGroup_ArriveICU.EditValue + "" == "1")
{
string url = "api/service/T_Service_Trauma_ICUList/SaveICUListInfo";
ICUListJsonModelDTO iCUListJsonModelDTO = new ICUListJsonModelDTO();
iCUListJsonModelDTO.PatientGUID = patientguid;
List<T_Service_Trauma_ICUListDTO> _ICUListDTOs = new List<T_Service_Trauma_ICUListDTO>();
if (count >= 1)
{
T_Service_Trauma_ICUListDTO t_Service_Trauma_ICUList = new T_Service_Trauma_ICUListDTO();
DateTime ArriveICUTime = Convert.ToDateTime(timeControl_ArriveICUTime.TimeValue);
DateTime LeaveICUTime = Convert.ToDateTime(timeControl_LeaveICUTime.TimeValue + "");
t_Service_Trauma_ICUList.ArriveICUTime = ArriveICUTime;
t_Service_Trauma_ICUList.LeaveICUTime = LeaveICUTime;
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = PublicClass.DiffMinutes(ArriveICUTime, LeaveICUTime);
t_Service_Trauma_ICUList.ICUDays = TimeSpan.Days + "";
//t_Service_Trauma_ICUList.PatientGuid = Cur_PatientGuid;
_ICUListDTOs.Add(t_Service_Trauma_ICUList);
}
if (count >= 2)
{
T_Service_Trauma_ICUListDTO t_Service_Trauma_ICUList = new T_Service_Trauma_ICUListDTO();
DateTime ArriveICUTime = Convert.ToDateTime(timeControl_ArriveICUTime1.TimeValue);
DateTime LeaveICUTime = Convert.ToDateTime(timeControl_LeaveICUTime1.TimeValue + "");
t_Service_Trauma_ICUList.ArriveICUTime = ArriveICUTime;
t_Service_Trauma_ICUList.LeaveICUTime = LeaveICUTime;
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = PublicClass.DiffMinutes(ArriveICUTime, LeaveICUTime);
t_Service_Trauma_ICUList.ICUDays = TimeSpan.Days + "";
//t_Service_Trauma_ICUList.PatientGuid = Cur_PatientGuid;
_ICUListDTOs.Add(t_Service_Trauma_ICUList);
}
if (count >= 3)
{
T_Service_Trauma_ICUListDTO t_Service_Trauma_ICUList = new T_Service_Trauma_ICUListDTO();
DateTime ArriveICUTime = Convert.ToDateTime(timeControl_ArriveICUTime2.TimeValue);
DateTime LeaveICUTime = Convert.ToDateTime(timeControl_LeaveICUTime2.TimeValue + "");
t_Service_Trauma_ICUList.ArriveICUTime = ArriveICUTime;
t_Service_Trauma_ICUList.LeaveICUTime = LeaveICUTime;
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = PublicClass.DiffMinutes(ArriveICUTime, LeaveICUTime);
t_Service_Trauma_ICUList.ICUDays = TimeSpan.Days + "";
//t_Service_Trauma_ICUList.PatientGuid = Cur_PatientGuid;
_ICUListDTOs.Add(t_Service_Trauma_ICUList);
}
if (count >= 4)
{
T_Service_Trauma_ICUListDTO t_Service_Trauma_ICUList = new T_Service_Trauma_ICUListDTO();
DateTime ArriveICUTime = Convert.ToDateTime(timeControl_ArriveICUTime3.TimeValue);
DateTime LeaveICUTime = Convert.ToDateTime(timeControl_LeaveICUTime3.TimeValue + "");
t_Service_Trauma_ICUList.ArriveICUTime = ArriveICUTime;
t_Service_Trauma_ICUList.LeaveICUTime = LeaveICUTime;
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = PublicClass.DiffMinutes(ArriveICUTime, LeaveICUTime);
t_Service_Trauma_ICUList.ICUDays = TimeSpan.Days + "";
//t_Service_Trauma_ICUList.PatientGuid = Cur_PatientGuid;
_ICUListDTOs.Add(t_Service_Trauma_ICUList);
}
if (count >= 5)
{
T_Service_Trauma_ICUListDTO t_Service_Trauma_ICUList = new T_Service_Trauma_ICUListDTO();
DateTime ArriveICUTime = Convert.ToDateTime(timeControl_ArriveICUTime4.TimeValue);
DateTime LeaveICUTime = Convert.ToDateTime(timeControl_LeaveICUTime4.TimeValue + "");
t_Service_Trauma_ICUList.ArriveICUTime = ArriveICUTime;
t_Service_Trauma_ICUList.LeaveICUTime = LeaveICUTime;
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = PublicClass.DiffMinutes(ArriveICUTime, LeaveICUTime);
t_Service_Trauma_ICUList.ICUDays = TimeSpan.Days + "";
//t_Service_Trauma_ICUList.PatientGuid = Cur_PatientGuid;
_ICUListDTOs.Add(t_Service_Trauma_ICUList);
}
if (count >= 6)
{
T_Service_Trauma_ICUListDTO t_Service_Trauma_ICUList = new T_Service_Trauma_ICUListDTO();
DateTime ArriveICUTime = Convert.ToDateTime(timeControl_ArriveICUTime5.TimeValue);
DateTime LeaveICUTime = Convert.ToDateTime(timeControl_LeaveICUTime5.TimeValue + "");
t_Service_Trauma_ICUList.ArriveICUTime = ArriveICUTime;
t_Service_Trauma_ICUList.LeaveICUTime = LeaveICUTime;
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = PublicClass.DiffMinutes(ArriveICUTime, LeaveICUTime);
t_Service_Trauma_ICUList.ICUDays = TimeSpan.Days + "";
//t_Service_Trauma_ICUList.PatientGuid = Cur_PatientGuid;
_ICUListDTOs.Add(t_Service_Trauma_ICUList);
}
//初始化两个工厂
ClientFactory<ICUListJsonModelDTO> httpClient = new HttpClientFactory<ICUListJsonModelDTO>();
Client<ICUListJsonModelDTO> client = httpClient.VisitFactory();
var sendData = JsonConvert.SerializeObject(_ICUListDTOs);
iCUListJsonModelDTO.ICUListJson = sendData;
var a = JsonConvert.SerializeObject(iCUListJsonModelDTO);
//访问
var result = client.JsonPost(a, url);
}
}
/// <summary>
/// 保存创伤病人去向信息
/// </summary>
public void SaveOutCome()
{
try
{
string Url = string.Empty;
#region 保存创伤病人去向信息
List<TraumaReceptionInformationModelDTO> list_Model = new List<TraumaReceptionInformationModelDTO>();
Url = "api/service/T_Service_Trauma_ReceptionInformation/SaveReceptionInfo";
if (!string.IsNullOrEmpty(dto.CreatorID + ""))
{
dto.CreatorID = Information.User.ID;
}
if (!string.IsNullOrEmpty(dto.CreationDate + ""))
{
dto.CreationDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
dto.PatientGuid = patientguid;
if (comboBoxEdit_Whereabouts.SelectedIndex == 0)
{
dto.Whereabouts = "";
}
else
{
dto.Whereabouts = comboBoxEdit_Whereabouts.SelectedIndex + "";
if (comboBoxEdit_Whereabouts.SelectedIndex == 1)
{
if (!string.IsNullOrEmpty(timeControl_EmergencyLeaveTime.TimeValue + ""))
{
dto.EmergencyLeaveTime = Convert.ToDateTime(timeControl_EmergencyLeaveTime.TimeValue + "");
}
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_EmergencyLeaveTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_EmergencyLeaveTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
dto.TreatmentOutcome = radioGroup_TreatmentOutcome.EditValue + "";
dto.TreatmentOtherContent = memoEdit_TreatmentOtherContent.Text + "";
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 2)
{
dto.DepartmentID = comboBoxEdit_DepartmentID.EditValue + "";
dto.InpatientID = textEdit_InpatientID.EditValue + "";
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_HospitalizationStartTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_HospitalizationStartTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
if (!string.IsNullOrEmpty(timeControl_HospitalizationStartTime.TimeValue + ""))
{
dto.HospitalizationStartTime = Convert.ToDateTime(timeControl_HospitalizationStartTime.TimeValue + "");
}
if (!string.IsNullOrEmpty(timeControl_HospitalizationEndTime.TimeValue + ""))
{
dto.HospitalizationEndTime = Convert.ToDateTime(timeControl_HospitalizationEndTime.TimeValue + "");
}
if (!string.IsNullOrEmpty(timeControl_HospitalizationStartTime.TimeValue + "") && !string.IsNullOrEmpty(timeControl_HospitalizationEndTime.TimeValue + ""))
{
TimeSpan TimeSpan = new TimeSpan();
DateTime ArriveOutpatientTime = Convert.ToDateTime(timeControl_HospitalizationStartTime.TimeValue);
DateTime HospitalizationStartTime = Convert.ToDateTime(timeControl_HospitalizationEndTime.TimeValue + "");
TimeSpan = PublicClass.DiffMinutes(ArriveOutpatientTime, HospitalizationStartTime);
dto.HospitalizationDays = TimeSpan.Days + ""; ;
}
dto.Death = radioGroup_Death.EditValue + "";
if (!string.IsNullOrEmpty(timeControl_DeathTime2.TimeValue + ""))
{
dto.DeathTime = Convert.ToDateTime(timeControl_DeathTime2.TimeValue + "");
}
dto.ArriveICU = radioGroup_ArriveICU.EditValue + "";
if (radioGroup_ArriveICU.EditValue + "" == "1")
{
ModifICU();
}
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 3)
{
if (!string.IsNullOrEmpty(timeControl_HandoverTime.TimeValue + ""))
{
dto.HandoverTime = Convert.ToDateTime(Convert.ToDateTime(timeControl_HandoverTime.TimeValue + "").ToString("yyyy-MM-dd HH:mm:ss"));
}
dto.ReceivingHospital = textEdit_ReceivingHospital.EditValue + "";
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_HandoverTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_HandoverTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 4)
{
if (!string.IsNullOrEmpty(timeControl_DeathTime1.TimeValue + ""))
{
dto.DeathTime = Convert.ToDateTime(timeControl_DeathTime1.TimeValue + "");
}
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_DeathTime1.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_DeathTime1.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
dto.DeathDesc = memoEdit_DeathDesc.EditValue + "";
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 5)
{
if (!string.IsNullOrEmpty(timeControl_ObservationTime.TimeValue + ""))
{
dto.ObservationTime = Convert.ToDateTime(timeControl_ObservationTime.TimeValue + "");
}
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_ObservationTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_ObservationTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
dto.ObservationDead = radioGroup_ObservationDead.EditValue + "";
if (!string.IsNullOrEmpty(timeControl_DeathTime4.TimeValue + ""))
{
dto.DeathTime = Convert.ToDateTime(timeControl_DeathTime4.TimeValue + "");
}
dto.KeepInDesc = memoEdit_KeepInDesc.Text + "";
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 6)
{
if (!string.IsNullOrEmpty(timeControl_OutComeTime.TimeValue + ""))
{
dto.OutComeTime = Convert.ToDateTime(timeControl_OutComeTime.TimeValue + "");
}
dto.ExactWereabouts = textEdit_ExactWereabouts.Text + "";
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_OutComeTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_OutComeTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
dto.ResidenceTime = temp + "";
}
}
}
}
dto.SituationRemarks = memoEdit_SituationRemarks.Text + "";
list_Model.Add(dto);
//初始化两个工厂
ClientFactory<TraumaReceptionInformationModelDTO> httpClient = new HttpClientFactory<TraumaReceptionInformationModelDTO>();
Client<TraumaReceptionInformationModelDTO> client = httpClient.VisitFactory();
#endregion
var result = client.Post(Url, list_Model);
if (result.Success)
{
MessageBox.Show("保存成功!");
//Form_PatientList ScorePrint;
//ScorePrint = (Form_PatientList)this.Owner;
//ScorePrint.PatientList(Information.Hospital.GUID, "", -1, -1, "", "");
}
else
{
MessageBox.Show("保存失败!");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存创伤接诊信息:\r\n" + ex);
}
}
#region 方法
public void Minutesvalue()
{
if (comboBoxEdit_Whereabouts.SelectedIndex == 1)
{
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_EmergencyLeaveTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime.Text = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_EmergencyLeaveTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime.Text = temp + "";
}
}
}
if (comboBoxEdit_Whereabouts.SelectedIndex == 2)
{
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_HospitalizationStartTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime6.Text = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_HospitalizationStartTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime6.Text = temp + "";
}
}
}
if (comboBoxEdit_Whereabouts.SelectedIndex == 3)
{
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_HandoverTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime1.Text = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_HandoverTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime1.Text = temp + "";
}
}
}
if (comboBoxEdit_Whereabouts.SelectedIndex == 4)
{
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_DeathTime1.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime2.Text = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_DeathTime1.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime2.Text = temp + "";
}
}
}
if (comboBoxEdit_Whereabouts.SelectedIndex == 5)
{
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_ObservationTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime3.Text = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_ObservationTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime3.Text = temp + "";
}
}
}
if (comboBoxEdit_Whereabouts.SelectedIndex == 6)
{
if (receiveDepartment + "" == "1")
{
string temp = CompareDatetime(dto.ArriveEmergencyTime + "", timeControl_OutComeTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime5.Text = temp + "";
}
}
else
{
string temp = CompareDatetime(dto.ArriveOutpatientTime + "", timeControl_OutComeTime.TimeValue + "");
if (!string.IsNullOrEmpty(temp))
{
textEdit_ResidenceTime5.Text = temp + "";
}
}
}
}
public static DataTable ListToDataTable(IList list)
{
DataTable result = new DataTable();
if (list.Count > 0)
{
PropertyInfo[] propertys = list[0].GetType().GetProperties();
foreach (PropertyInfo pi in propertys)
{
//获取类型
Type colType = pi.PropertyType;
//当类型为Nullable<>时
if ((colType.IsGenericType) && (colType.GetGenericTypeDefinition() == typeof(Nullable<>)))
{
colType = colType.GetGenericArguments()[0];
}
result.Columns.Add(pi.Name, colType);
}
for (int i = 0; i < list.Count; i++)
{
ArrayList tempList = new ArrayList();
foreach (PropertyInfo pi in propertys)
{
object obj = pi.GetValue(list[i], null);
tempList.Add(obj);
}
object[] array = tempList.ToArray();
result.LoadDataRow(array, true);
}
}
return result;
}
public string CompareDatetime(string firstTime,string secondTime)
{
if (!string.IsNullOrEmpty(firstTime) && !string.IsNullOrEmpty(secondTime))
{
TimeSpan TimeSpan = new TimeSpan();
DateTime FirstTime = Convert.ToDateTime(firstTime);
DateTime SecondTime = Convert.ToDateTime(secondTime);
TimeSpan = PublicClass.DiffMinutes(FirstTime, SecondTime);
return TimeSpan.Minutes + "";
}
else
{
return "";
}
}
private void comboBoxEdit_Whereabouts_SelectedValueChanged(object sender, EventArgs e)
{
//患者去向 1急诊离院 2.住院 3.转院4.死亡5.急诊留观6.其他
if (comboBoxEdit_Whereabouts.SelectedIndex == 1)
{
panelControl20.Visible = true;
panelControl8.Visible = true;
panelControl25.Visible = false;
panelControl21.Visible = false;
panelControl22.Visible = false;
panelControl23.Visible = false;
panelControl24.Visible = false;
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 2)
{
panelControl25.Visible = true;
panelControl20.Visible = false;
panelControl8.Visible = false;
panelControl21.Visible = false;
panelControl22.Visible = false;
panelControl23.Visible = false;
panelControl24.Visible = false;
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 3)
{
panelControl21.Visible = true;
panelControl25.Visible = false;
panelControl20.Visible = false;
panelControl8.Visible = false;
panelControl22.Visible = false;
panelControl23.Visible = false;
panelControl24.Visible = false;
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 4)
{
panelControl22.Visible = true;
panelControl21.Visible = false;
panelControl25.Visible = false;
panelControl20.Visible = false;
panelControl8.Visible = false;
panelControl23.Visible = false;
panelControl24.Visible = false;
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 5)
{
panelControl23.Visible = true;
panelControl22.Visible = false;
panelControl21.Visible = false;
panelControl25.Visible = false;
panelControl20.Visible = false;
panelControl8.Visible = false;
panelControl24.Visible = false;
}
else if (comboBoxEdit_Whereabouts.SelectedIndex == 6)
{
panelControl24.Visible = true;
panelControl23.Visible = false;
panelControl22.Visible = false;
panelControl21.Visible = false;
panelControl25.Visible = false;
panelControl20.Visible = false;
panelControl8.Visible = false;
}
}
private void radioGroup_ObservationDead_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioGroup_ObservationDead.SelectedIndex == 0)
{
panelControl41.Visible = true;
}
else
{
timeControl_DeathTime4.TimeValue = "";
panelControl41.Visible = false;
}
}
private void radioGroup_Death_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioGroup_Death.SelectedIndex == 0)
{
panelControl26.Visible = true;
}
else
{
timeControl_DeathTime2.TimeValue = "";
panelControl26.Visible = false;
}
}
private void radioGroup_ArriveICU_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioGroup_ArriveICU.EditValue + "" == "1")
{
flowLayoutPanel1.Visible = true;
panelControl27.Visible = true;
}
else
{
flowLayoutPanel1.Visible = false;
}
}
public void Dayvalue()
{
if (!string.IsNullOrEmpty(timeControl_HospitalizationStartTime.TimeValue + "") && !string.IsNullOrEmpty(timeControl_HospitalizationEndTime.TimeValue + ""))
{
TimeSpan TimeSpan = new TimeSpan();
DateTime ArriveOutpatientTime = Convert.ToDateTime(timeControl_HospitalizationStartTime.TimeValue);
DateTime HospitalizationStartTime = Convert.ToDateTime(timeControl_HospitalizationEndTime.TimeValue + "");
TimeSpan = PublicClass.DiffMinutes(ArriveOutpatientTime, HospitalizationStartTime);
textEdit_HospitalizationDays.Text = TimeSpan.Days + "";
}
}
private void timeControl_EmergencyLeaveTime_TimeValueChanged(object sender, EventArgs e)
{
Minutesvalue();
}
private void timeControl_HandoverTime_TimeValueChanged(object sender, EventArgs e)
{
Minutesvalue();
}
private void timeControl_DeathTime1_TimeValueChanged(object sender, EventArgs e)
{
Minutesvalue();
}
private void timeControl_ObservationTime_TimeValueChanged(object sender, EventArgs e)
{
Minutesvalue();
}
private void timeControl_OutComeTime_TimeValueChanged(object sender, EventArgs e)
{
Minutesvalue();
}
private void timeControl_HospitalizationStartTime_TimeValueChanged(object sender, EventArgs e)
{
Dayvalue();
Minutesvalue();
}
private void timeControl_HospitalizationEndTime_TimeValueChanged(object sender, EventArgs e)
{
Dayvalue();
}
#endregion
}
}