217 lines
8.9 KiB
C#
217 lines
8.9 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.Drawing;
|
|||
|
using System.IO;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace HL_FristAidPlatform_Apoplexy
|
|||
|
{
|
|||
|
public partial class UserControl_CarotidAngioplastyInformedConsent : UserControl
|
|||
|
{
|
|||
|
public string guid;
|
|||
|
public string fileAddress;
|
|||
|
public byte[] patientSignature;
|
|||
|
public byte[] doctorSignature;
|
|||
|
public string name;
|
|||
|
public string gender;
|
|||
|
public int age;
|
|||
|
public string number;
|
|||
|
public string patientGuid;
|
|||
|
public string diagnose;
|
|||
|
public string imageFile;
|
|||
|
|
|||
|
public UserControl_CarotidAngioplastyInformedConsent(string _patientGuid, string _name, string _gender, int _age, string _number, string _diagnose,string _fileAddress)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
patientGuid = _patientGuid;
|
|||
|
name = _name;
|
|||
|
gender = _gender;
|
|||
|
age = _age;
|
|||
|
number = _number;
|
|||
|
diagnose = _diagnose;
|
|||
|
fileAddress = _fileAddress;
|
|||
|
}
|
|||
|
|
|||
|
private void UserControl_CarotidAngioplastyInformedConsent_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
lbl_name.Text = name;
|
|||
|
if (gender == "0")
|
|||
|
lbl_gender.Text = "未知";
|
|||
|
if (gender == "1")
|
|||
|
lbl_gender.Text = "男";
|
|||
|
if (gender == "2")
|
|||
|
lbl_gender.Text = "女";
|
|||
|
lbl_age.Text = age.ToString();
|
|||
|
lbl_number.Text = number;
|
|||
|
labelControl12.Text = diagnose;
|
|||
|
GetnformedConsentByPatientGuid();
|
|||
|
}
|
|||
|
|
|||
|
public void GetnformedConsentByPatientGuid()
|
|||
|
{
|
|||
|
T_Service_InformedConsentDTO dto = DBHelpClass.GetDateModel<T_Service_InformedConsentDTO>(string.Format("api/service/T_Service_InformedConsent/GetnformedConsentByPatientGuid?patientGuid={0}&flag={1}", patientGuid, 7));
|
|||
|
if (dto != null)
|
|||
|
{
|
|||
|
fileAddress = dto.FileAddress;
|
|||
|
time_PatientSigningTime.TimeValue = dto.PatientSignatureTime;
|
|||
|
//text_PatientPhone.Text = dto.PatientPhone;
|
|||
|
text_Relationship.Text = dto.Relationship;
|
|||
|
if (!string.IsNullOrEmpty(time_PatientSigningTime.TimeValue))
|
|||
|
{
|
|||
|
time_PatientSigningTime.TimeValue = dto.PatientSignatureTime;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(time_DoctorSignatureTime.TimeValue))
|
|||
|
{
|
|||
|
time_DoctorSignatureTime.TimeValue = dto.DoctorSignatureTime;
|
|||
|
}
|
|||
|
comboBox_Agree.Text = dto.Agree;
|
|||
|
if (dto.PatientSignature != null)
|
|||
|
{
|
|||
|
string ReferringDoctorSignature = Convert.ToBase64String(dto.PatientSignature);
|
|||
|
if (!string.IsNullOrEmpty(ReferringDoctorSignature))
|
|||
|
{
|
|||
|
MemoryStream ms = new MemoryStream(Convert.FromBase64String(ReferringDoctorSignature));
|
|||
|
Image img = Image.FromStream(ms);
|
|||
|
pic_PatientSignature.Image = img;
|
|||
|
}
|
|||
|
}
|
|||
|
if (dto.DoctorSignature != null)
|
|||
|
{
|
|||
|
string signature = Convert.ToBase64String(dto.DoctorSignature);
|
|||
|
if (!string.IsNullOrEmpty(signature))
|
|||
|
{
|
|||
|
MemoryStream ms = new MemoryStream(Convert.FromBase64String(signature));
|
|||
|
Image img = Image.FromStream(ms);
|
|||
|
pic_DoctorSignature.Image = img;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void SaveInformedConsent(int type)
|
|||
|
{
|
|||
|
T_Service_InformedConsentDTO dto = new T_Service_InformedConsentDTO();
|
|||
|
List<T_Service_InformedConsentDTO> list = new List<T_Service_InformedConsentDTO>();
|
|||
|
dto.FileAddress = fileAddress;
|
|||
|
dto.DoctorSignature = doctorSignature;
|
|||
|
dto.PatientSignature = patientSignature;
|
|||
|
dto.PatientGuid = patientGuid;
|
|||
|
dto.PatientSignatureTime = time_PatientSigningTime.TimeValue != null ? Convert.ToDateTime(time_PatientSigningTime.TimeValue).ToString("yyyy-MM-dd HH:mm") : "";
|
|||
|
dto.DoctorSignatureTime = time_DoctorSignatureTime.TimeValue != null ? Convert.ToDateTime(time_DoctorSignatureTime.TimeValue).ToString("yyyy-MM-dd HH:mm") : "";
|
|||
|
dto.Relationship = text_Relationship.Text;
|
|||
|
dto.Agree = comboBox_Agree.Text;
|
|||
|
dto.Flag = 7;
|
|||
|
if (!string.IsNullOrEmpty(imageFile))
|
|||
|
{
|
|||
|
dto.InformedConsentImg = Convert.FromBase64String(imageFile);
|
|||
|
lbl_imageMessage.Visible = false;
|
|||
|
hyperlinklbl_Image.Visible = true;
|
|||
|
}
|
|||
|
//dto.PatientPhone = text_PatientPhone.Text;
|
|||
|
list.Add(dto);
|
|||
|
string Url = "api/service/T_Service_InformedConsent/SaveInformedConsent";
|
|||
|
//初始化两个工厂
|
|||
|
ClientFactory<T_Service_InformedConsentDTO> httpClient = new HttpClientFactory<T_Service_InformedConsentDTO>();
|
|||
|
Client<T_Service_InformedConsentDTO> client = httpClient.VisitFactory();
|
|||
|
//访问
|
|||
|
ListEntity<T_Service_InformedConsentDTO> t = client.Post(Url, list);
|
|||
|
if (t.Success)
|
|||
|
{
|
|||
|
if (type == 0)
|
|||
|
{
|
|||
|
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("保存失败");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(t.DataString))
|
|||
|
{
|
|||
|
if (t.DataString.Contains("Success"))
|
|||
|
{
|
|||
|
XtraMessageBox.Show("保存成功");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
|
|||
|
XtraMessageBox.Show(msg1);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
XtraMessageBox.Show("保存失败");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void simpleButton1_Click_1(object sender, EventArgs e)
|
|||
|
{
|
|||
|
#region
|
|||
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|||
|
openFileDialog.Filter = "Image Files(*.JPG;*.PNG;*.JPEG;;*.BMP)|*.JPG;*.PNG;;*.BMP;*.JPEG";
|
|||
|
openFileDialog.RestoreDirectory = true;
|
|||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|||
|
{
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
int Config109 = PublicClass.ToInt32(PublicClassForDataBase.Config109, 5);
|
|||
|
string FileName = openFileDialog.FileName;
|
|||
|
if (PublicClass.GetFileSize(FileName) <= Config109)
|
|||
|
{
|
|||
|
FileInfo file = new FileInfo(FileName);
|
|||
|
Bitmap bitmap = new Bitmap(FileName);
|
|||
|
imageFile = file.Extension;
|
|||
|
if (imageFile.ToLower() == ".png")
|
|||
|
{
|
|||
|
imageFile = PublicClass.Png2String(bitmap);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
imageFile = PublicClass.Jpeg2String(bitmap);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
PublicClass.WriteErrorLog(this.Text, "上传知情同意书:\r\n" + ex);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
private void hyperlinklbl_Image_Click_1(object sender, EventArgs e)
|
|||
|
{
|
|||
|
byte[] image = Convert.FromBase64String(imageFile);
|
|||
|
HL_FristAidPlatform_MultiSystemPublic.Form_ImageShow frm = new HL_FristAidPlatform_MultiSystemPublic.Form_ImageShow(image);
|
|||
|
frm.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|