StableVersion4.3/HL_FristAidPlatform_Trauma/Page/UCTransfer.cs

208 lines
8.3 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.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma.Page
{
public partial class UCTransfer : UserControl
{
public string guid;
/// <summary>
/// 患者知情同意签字
/// </summary>
public byte[] name1=null;
/// <summary>
/// 转诊医生签字
/// </summary>
public byte[] name2 = null;
public UCTransfer(string _guid)
{
InitializeComponent();
guid = _guid;
}
private void UCTransfer_Load(object sender, EventArgs e)
{
GetPatientReferral();
}
public void GetPatientReferral()
{
string URL = string.Format("api/service/T_Service_DownwardReferral/GetPatientReferralOfTrauma?patientGuid={0}&hospitalGuid={1}", guid, Information.Hospital.GUID);
TraumaPatientReferralDTO model = new TraumaPatientReferralDTO();
model = DBHelpClass.GetDateModel<TraumaPatientReferralDTO>(URL);
if (model != null)
{
lbl_name.Text = model.Name;
if (model.Gender == 0)
lbl_gender.Text = "未知";
if (model.Gender == 1)
lbl_gender.Text = "男";
if (model.Gender == 2)
lbl_gender.Text = "女";
lbl_age.Text = model.Age.ToString();
if (model.MPDSType == "1")
lbl_mpds.Text = "创伤";
if (model.MPDSType == "2")
lbl_mpds.Text = "胸痛";
if (model.MPDSType == "3")
lbl_mpds.Text = "卒中";
if (model.MPDSType == "4")
lbl_mpds.Text = "其他";
lbl_phone.Text = model.Phone;
lbl_mpdsContent.Text = model.MPDSContent;
lbl_inpatient_ID.Text = model.OutpatientID;
if (!string.IsNullOrEmpty(model.LeaveTime))
timeControl1.TimeValue = model.LeaveTime.ToString();
memo_IllnessExplain.Text = model.IllnessExplain;
memo_HospitalSummary.Text = model.HospitalSummary;
memo_TreatmentPlan.Text = model.TreatmentPlan;
txt_LeaveHospital.Text = model.LeaveHospital;
txt_SendHospital.Text = model.SendHospital;
txt_DesignatedHospital.Text = model.DesignatedHospital;
if (model.PatientSignature != null)
{
name1 = model.PatientSignature;
string patientSignature = Convert.ToBase64String(model.PatientSignature);
if (!string.IsNullOrEmpty(patientSignature))
{
MemoryStream ms = new MemoryStream(Convert.FromBase64String(patientSignature));
Image img = Image.FromStream(ms);
pic_PatientSignature.Image = img;
}
}
if (model.ReferringDoctorSignature != null)
{
name2 = model.ReferringDoctorSignature;
string referringDoctorSignature = Convert.ToBase64String(model.ReferringDoctorSignature);
if (!string.IsNullOrEmpty(referringDoctorSignature))
{
MemoryStream ms = new MemoryStream(Convert.FromBase64String(referringDoctorSignature));
Image img = Image.FromStream(ms);
pic_ReferringDoctorSignature.Image = img;
}
}
}
}
/// <summary>
/// 保存转院信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void simpleButton2_Click(object sender, EventArgs e)
{
if (SavePatientReferralInfo())
XtraMessageBox.Show("保存成功");
}
/// <summary>
/// 保存转院申请信息
/// </summary>
public bool SavePatientReferralInfo()
{
bool res = false;
try
{
List<TraumaPatientReferralDTO> lst = new List<TraumaPatientReferralDTO>();
TraumaPatientReferralDTO dto = new TraumaPatientReferralDTO();
dto.PatientGuid = guid;
if (!string.IsNullOrEmpty(timeControl1.TimeValue))
dto.LeaveTime = Convert.ToDateTime(timeControl1.TimeValue).ToString("yyyy-MM-dd HH:mm");
dto.IllnessExplain = memo_IllnessExplain.Text.Trim();
dto.HospitalSummary = memo_HospitalSummary.Text;
dto.TreatmentPlan = memo_TreatmentPlan.Text;
dto.LeaveHospital = txt_LeaveHospital.Text;
dto.SendHospital = txt_SendHospital.Text;
dto.DesignatedHospital = txt_DesignatedHospital.Text;
dto.PatientSignature = name1;
dto.ReferringDoctorSignature = name2;
lst.Add(dto);
string Url = "api/service/T_Service_DownwardReferral/SavePatientReferralInfo";
//初始化两个工厂
ClientFactory<TraumaPatientReferralDTO> httpClient = new HttpClientFactory<TraumaPatientReferralDTO>();
Client<TraumaPatientReferralDTO> client = httpClient.VisitFactory();
//访问
ListEntity<TraumaPatientReferralDTO> t = client.Post(Url, lst);
if (t.Success)
{
if (!string.IsNullOrEmpty(t.DataString))
{
if (t.DataString.Contains("Success"))
{
res = true;
}
else
{
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
XtraMessageBox.Show(msg1);
res = false;
}
}
else
{
XtraMessageBox.Show("保存失败");
res = false;
}
}
else
{
XtraMessageBox.Show("保存失败");
res = false;
}
return res;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog("保存创伤转院申请信息", "\r\n" + ex);
return false;
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
if (SavePatientReferralInfo())
{
TraumaPatientReferralDTO dto = new TraumaPatientReferralDTO();
dto.Name = lbl_name.Text;
if (lbl_gender.Text == "未知")
dto.Gender = 0;
if (lbl_gender.Text == "男")
dto.Gender = 1;
if (lbl_gender.Text == "女")
dto.Gender = 2;
dto.Age = int.Parse(lbl_age.Text);
dto.MPDSType = lbl_mpds.Text;
dto.MPDSContent = lbl_mpdsContent.Text;
dto.OutpatientID = lbl_inpatient_ID.Text;
dto.LeaveTime = Convert.ToDateTime(timeControl1.TimeValue).ToString("yyyy-MM-dd HH:mm");
dto.IllnessExplain = memo_IllnessExplain.Text.Trim();
dto.HospitalSummary = memo_HospitalSummary.Text;
dto.TreatmentPlan = memo_TreatmentPlan.Text;
dto.LeaveHospital = txt_LeaveHospital.Text;
dto.SendHospital = txt_SendHospital.Text;
dto.DesignatedHospital = txt_DesignatedHospital.Text;
dto.PatientSignature = name1;
dto.ReferringDoctorSignature = name2;
Print.PrintTraumaFransfer(dto, true);
}
}
}
}