StableVersion4.3/HL_FristAidPlatform_Apoplexy/Form_PatientTransferOthers.cs

191 lines
6.6 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Data;
namespace HL_FristAidPlatform_Apoplexy
{
public partial class Form_PatientTransferOthers : XtraForm
{
private string _guid = "";
public Form_PatientTransferOthers()
{
InitializeComponent();
}
public Form_PatientTransferOthers(string patientguid)
{
InitializeComponent();
_guid = patientguid;
}
private void Form_PatientTransferOthers_Load(object sender, System.EventArgs e)
{
DataTable dt = DBHelpClass.Get(string.Format("api/service/T_Service_Patient/GetModelByIdOrGuid?guid={0}", _guid));
if (dt != null && dt.Rows.Count > 0)
{
//姓名
textBox1.Text = dt.Rows[0]["Name"].ToString().Trim();
//性别
switch (dt.Rows[0]["Gender"].ToString())
{
case "1":
radioGroup1.SelectedIndex = 0;
break;
case "2":
radioGroup1.SelectedIndex = 1;
break;
}
//年龄
textBox2.Text = dt.Rows[0]["Age"].ToString();
timeControl1.TimeValue= dt.Rows[0]["ArrivalHospitalTime"].ToString();
//checkedListBoxControl_acZLType 治疗类型
string ACLZLType = dt.Rows[0]["acZLType"].ToString();
string[] getAry2 = ACLZLType.Split(';');
for (int i = 1; i < getAry2.Length - 1; i++)
{
//cbcYWBType.Items[i].Value.ToString().Trim()
if (ACLZLType.Contains(getAry2[i]))
{
//cbcYWBRSide.SetItemChecked(i, true);
for (int j = 0; j < checkedListBoxControl_acZLType.ItemCount; j++)
{
if (getAry2[i].Equals(checkedListBoxControl_acZLType.Items[j].Value.ToString()))
{
checkedListBoxControl_acZLType.SetItemChecked(j, true);
}
}
}
}
}
string url = string.Format("/api/service/T_Service_Apoplexy_Transfer/GetByPatientGuid?PatientGuid={0}", _guid);
DataTable dtInfo = DBHelpClass.GetDataRow(url);
if (dtInfo != null)
{
if (dtInfo.Rows.Count > 0)
{
//接受医院名称
textBox3.Text = dtInfo.Rows[0]["nameOuthospital"] + "";
//转出本院时间
if (!string.IsNullOrEmpty(dtInfo.Rows[0]["timeOuthospital"] + ""))
{
timeControl2.TimeValue = dtInfo.Rows[0]["timeOuthospital"] + "";
}
//出院诊断
textBox4.Text = dtInfo.Rows[0]["diagnosis"] + "";
//转院原因
textBox5.Text = dtInfo.Rows[0]["reasonOuthospital"] + "";
}
}
}
private void simpleButton1_Click(object sender, System.EventArgs e)
{
//1.获得所需值
List<T_Service_Apoplexy_TransferDTO> list = new List<T_Service_Apoplexy_TransferDTO>();
T_Service_Apoplexy_TransferDTO dto = new T_Service_Apoplexy_TransferDTO();
//接受医院名称
dto.nameOuthospital = textBox3.Text + "";
//转出本院时间
dto.timeOuthospital = timeControl2.TimeValue + "";
//出院诊断
dto.diagnosis = textBox4.Text + "";
//转院原因
dto.reasonOuthospital = textBox5.Text + "";
dto.createId = Information.User.ID + "";
dto.PatientGuid = _guid;
list.Add(dto);
string Url = "api/service/T_Service_Apoplexy_Transfer/Add";
//初始化两个工厂
ClientFactory<T_Service_Apoplexy_TransferDTO> httpClient = new HttpClientFactory<T_Service_Apoplexy_TransferDTO>();
Client<T_Service_Apoplexy_TransferDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_Apoplexy_TransferDTO> t = client.Post(Url, list);
if (t.Success)
{
JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
string msg = jo["Msg"].ToString();
if (!string.IsNullOrEmpty(msg))
{
XtraMessageBox.Show(msg);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
public void Savedate()
{
//1.获得所需值
List<T_Service_Apoplexy_TransferDTO> list = new List<T_Service_Apoplexy_TransferDTO>();
T_Service_Apoplexy_TransferDTO dto = new T_Service_Apoplexy_TransferDTO();
//接受医院名称
dto.nameOuthospital = textBox3.Text + "";
//转出本院时间
dto.timeOuthospital = timeControl2.TimeValue + "";
//出院诊断
dto.diagnosis = textBox4.Text + "";
//转院原因
dto.reasonOuthospital = textBox5.Text + "";
dto.createId = Information.User.ID + "";
dto.PatientGuid = _guid;
list.Add(dto);
string Url = "api/service/T_Service_Apoplexy_Transfer/Add";
//初始化两个工厂
ClientFactory<T_Service_Apoplexy_TransferDTO> httpClient = new HttpClientFactory<T_Service_Apoplexy_TransferDTO>();
Client<T_Service_Apoplexy_TransferDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_Apoplexy_TransferDTO> t = client.Post(Url, list);
if (t.Success)
{
JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
string msg = jo["Msg"].ToString();
if (!string.IsNullOrEmpty(msg))
{
XtraMessageBox.Show(msg);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
private void textBox3_TextChanged(object sender, System.EventArgs e)
{
}
private void timeControl2_Load(object sender, System.EventArgs e)
{
}
}
}