269 lines
10 KiB
C#
269 lines
10 KiB
C#
using DevExpress.XtraEditors;
|
|
using HL_FristAidPlatform_DTO;
|
|
using HL_FristAidPlatform_Print;
|
|
using HL_FristAidPlatform_Public;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Drawing.Printing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_Apoplexy
|
|
{
|
|
public partial class Form_ApoplexyHighRiskScreening_InformedConsent : Form
|
|
{
|
|
string name;
|
|
string gender;
|
|
string phone;
|
|
string IDCard;
|
|
string guid;
|
|
string imageFile;
|
|
string fileAddress;
|
|
public Form_ApoplexyHighRiskScreening_InformedConsent(string _name, string _gender, string _phone, string _IDCard, string _guid)
|
|
{
|
|
InitializeComponent();
|
|
name = _name;
|
|
gender = _gender;
|
|
phone = _phone;
|
|
IDCard = _IDCard;
|
|
guid = _guid;
|
|
}
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
PrintChart printClass = new PrintChart(layoutControl1);
|
|
printClass.LandScape = false;
|
|
printClass.PaperKind = PaperKind.A4;
|
|
printClass.PrintHeader = "脑卒中高危人群筛查和干预项目知情同意书";
|
|
printClass.LoadPageSetting(60);
|
|
printClass.Preview();
|
|
}
|
|
|
|
private void Form_ApoplexyHighRiskScreening_InformedConsent_Load(object sender, EventArgs e)
|
|
{
|
|
textEdit_Name.Text = name;
|
|
textEdit_Gender.Text = gender;
|
|
textEdit_Phone.Text = phone;
|
|
textEdit_IDCard.Text = IDCard;
|
|
GetData();
|
|
}
|
|
|
|
private void GetData()
|
|
{
|
|
string Url = string.Format("api/service/T_Service_FirstAid_ApoplexyHighRiskScreening/GetByGuid?Guid={0}", guid);
|
|
NotificationDTO patientDT = DBHelpClass.GetDateModel<NotificationDTO>(Url);
|
|
//DataTable patientDT = DBHelpClass.GetDataRow(Url);
|
|
if (patientDT != null)
|
|
{
|
|
textEdit_Name.Text = patientDT.Name;
|
|
if (patientDT.Gender == 1)
|
|
{
|
|
textEdit_Gender.Text = "男";
|
|
}
|
|
if (patientDT.Gender == 2)
|
|
{
|
|
textEdit_Gender.Text = "女";
|
|
}
|
|
textEdit_IDCard.Text = patientDT.IDCard;
|
|
textEdit_Phone.Text = patientDT.ContactNmber;
|
|
textEdit5.Text = patientDT.CAddress;
|
|
fileAddress = patientDT.FileAddress;
|
|
|
|
byte[] pSignature = patientDT.ParticipantSignature;//Convert.FromBase64String(+ "");
|
|
if (patientDT.ParticipantSignatureTime != "1900-01-01 00:00:00")
|
|
{
|
|
timeControl1.Text = patientDT.ParticipantSignatureTime + "";
|
|
}
|
|
byte[] pStaffSign = patientDT.ProjectStaffSign;//Convert.FromBase64String(patientDT.ProjectStaffSign + "");
|
|
if (patientDT.ProjectStaffSignTime != "1900-01-01 00:00:00")
|
|
{
|
|
timeControl2.Text = patientDT.ProjectStaffSignTime + "";
|
|
}
|
|
if (pSignature != null)
|
|
{
|
|
string ReferringDoctorSignature = Convert.ToBase64String(pSignature);
|
|
if (!string.IsNullOrEmpty(ReferringDoctorSignature))
|
|
{
|
|
MemoryStream ms = new MemoryStream(Convert.FromBase64String(ReferringDoctorSignature));
|
|
Image img = Image.FromStream(ms);
|
|
textEdit1.Image = img;
|
|
}
|
|
}
|
|
if (pStaffSign != null)
|
|
{
|
|
string signature = Convert.ToBase64String(pStaffSign);
|
|
if (!string.IsNullOrEmpty(signature))
|
|
{
|
|
MemoryStream ms = new MemoryStream(Convert.FromBase64String(signature));
|
|
Image img = Image.FromStream(ms);
|
|
textEdit2.Image = img;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void simpleButton2_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> list = new List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO>();
|
|
T_Service_FirstAid_ApoplexyHighRiskScreeningDTO dto = new T_Service_FirstAid_ApoplexyHighRiskScreeningDTO();
|
|
dto.InformedConsentImg = Convert.FromBase64String(imageFile);
|
|
if (!string.IsNullOrEmpty(imageFile))
|
|
{
|
|
lbl_imageMessage.Visible = false;
|
|
hyperlinklbl_Image.Visible = true;
|
|
}
|
|
dto.ContactAddress = textEdit5.Text;
|
|
dto.ParticipantSignatureTime = timeControl1.Text;// Convert.ToDateTime(timeControl1.Text).ToString();
|
|
dto.ProjectStaffSignTime = timeControl1.Text;// Convert.ToDateTime(timeControl2.Text).ToString();
|
|
dto.GUID = guid;
|
|
|
|
list.Add(dto);
|
|
string Url = "api/service/T_Service_FirstAid_ApoplexyHighRiskScreening/Update";
|
|
//初始化两个工厂
|
|
ClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> httpClient = new HttpClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO>();
|
|
Client<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> client = httpClient.VisitFactory();
|
|
|
|
//访问
|
|
ListEntity<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> t = client.Post(Url, list);
|
|
|
|
if (t.Success)
|
|
{
|
|
XtraMessageBox.Show("保存成功");
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void pictureBox_Record_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(fileAddress))
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
{
|
|
Process.Start(new ProcessStartInfo("cmd", $"/c start { fileAddress}") { CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden });
|
|
}
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
{
|
|
Process.Start("xdg-open", fileAddress);
|
|
}
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) //Mac环境
|
|
{
|
|
Process.Start("open", fileAddress);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("未上传录音文件");
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void simpleButton3_Click(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
|
|
|
|
if (imageFile != null)
|
|
{
|
|
try
|
|
{
|
|
List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> list = new List<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO>();
|
|
T_Service_FirstAid_ApoplexyHighRiskScreeningDTO dto = new T_Service_FirstAid_ApoplexyHighRiskScreeningDTO();
|
|
dto.InformedConsentImg = Convert.FromBase64String(imageFile);
|
|
if (!string.IsNullOrEmpty(imageFile))
|
|
{
|
|
lbl_imageMessage.Visible = false;
|
|
hyperlinklbl_Image.Visible = true;
|
|
}
|
|
list.Add(dto);
|
|
string Url = "api/service/T_Service_FirstAid_ApoplexyHighRiskScreening/Update";
|
|
//初始化两个工厂
|
|
ClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> httpClient = new HttpClientFactory<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO>();
|
|
Client<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> client = httpClient.VisitFactory();
|
|
|
|
//访问
|
|
ListEntity<T_Service_FirstAid_ApoplexyHighRiskScreeningDTO> t = client.Post(Url, list);
|
|
|
|
if (t.Success)
|
|
{
|
|
XtraMessageBox.Show("保存成功");
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void hyperlinklbl_Image_Click(object sender, EventArgs e)
|
|
{
|
|
byte[] image = Convert.FromBase64String(imageFile);
|
|
HL_FristAidPlatform_MultiSystemPublic.Form_ImageShow frm = new HL_FristAidPlatform_MultiSystemPublic.Form_ImageShow(image);
|
|
frm.ShowDialog();
|
|
}
|
|
}
|
|
}
|