1842 lines
107 KiB
C#
1842 lines
107 KiB
C#
using CYQ.Data;
|
||
using FastReport;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Diagnostics;
|
||
using System.Drawing;
|
||
using System.Drawing.Imaging;
|
||
using System.IO;
|
||
using System.Net;
|
||
using System.Reflection;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using System.Windows.Forms;
|
||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||
|
||
namespace dccdc.Selfhelp
|
||
{
|
||
public partial class frm_main3 : Form
|
||
{
|
||
//是否刷卡获取信息 1:刷卡;0:手动输入
|
||
int ifInputByCard = 1;
|
||
/// <summary>
|
||
/// 获取体检编号 enableReprint==0表示不允许重打;==1表示允许重打
|
||
/// </summary>
|
||
string url_getPhysicalNumByIDCard = extend.URL + "zzj/getPhysicalNumByIDCard";
|
||
public frm_main3()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
public static FastReport.EnvironmentSettings eSet = new EnvironmentSettings();
|
||
DateTime n = DateTime.Now;
|
||
private void timer1_Tick(object sender, EventArgs e)
|
||
{
|
||
//每2秒清理下 鼠标点击计数
|
||
click_count_left = 0;
|
||
click_count_right = 0;
|
||
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + "开始查询有无身份证!");
|
||
n = DateTime.Now;
|
||
timer1.Enabled = false;
|
||
Status ss = new Selfhelp.Status("正在查询您的信息请稍后……", false);
|
||
ss.Owner = this;
|
||
ss.TopLevel = true;
|
||
try
|
||
{
|
||
do
|
||
{
|
||
IDCardInfo info = new IDCardInfo();
|
||
string errmsg = "";
|
||
int iPort = 1001;
|
||
int iIfOpen = 1;
|
||
byte[] byCHMsg = new byte[256 + 1]; //个人基本信息
|
||
uint uiCHMsgSize = 0; //个人基本信息字节数
|
||
byte[] byPHMsg = new byte[1024 + 1]; //照片信息
|
||
uint uiPHMsgSize = 0; //照片信息字节数
|
||
byte[] byFPMsg = new byte[1024 + 1]; //指纹信息
|
||
uint uiFPMsgSize = 0; //指纹信息字节数
|
||
|
||
int iIsSaveToBmp = 0;
|
||
|
||
byte[] byBgrBuffer = new byte[38556]; //解码后图片BGR编码值
|
||
byte[] byRgbBuffer = new byte[38808]; //解码后图片RGB编码值
|
||
byte[] byBmpBuffer = new byte[38862]; //解码后图片RGB编码值
|
||
|
||
if (ifInputByCard == 0)
|
||
{
|
||
if (this.textBox1.Text.Trim() == "")
|
||
return;
|
||
|
||
info.IDCardNo = this.textBox1.Text.Trim();
|
||
|
||
|
||
string zpf_temp = Application.StartupPath + "\\zp_temp.bmp";
|
||
|
||
FileStream fs = new FileStream(zpf_temp, FileMode.Open);
|
||
byte[] bs = new byte[fs.Length];
|
||
fs.Read(bs, 0, bs.Length);
|
||
fs.Close();
|
||
info.Photo = System.Drawing.Image.FromStream(new MemoryStream(bs));
|
||
//==1表示允许重打
|
||
url_getPhysicalNumByIDCard = extend.URL + "zzj/getPhysicalNumByIDCard?enableReprint=1";
|
||
|
||
this.ifInputByCard = 1;
|
||
this.textBox1.Text = "";
|
||
|
||
Application.DoEvents();
|
||
}
|
||
else
|
||
{
|
||
//==0表示不允许重打
|
||
url_getPhysicalNumByIDCard = extend.URL + "zzj/getPhysicalNumByIDCard?enableReprint=0";
|
||
|
||
|
||
#region 读取身份证信息
|
||
// uint uiDevBaud = 0;``
|
||
//uint uiCurBaud = 0;
|
||
StringBuilder strSAMID = new StringBuilder(64 + 1);
|
||
#region 判断读卡设备连接是否正常
|
||
//获得设备SAM模块ID。
|
||
//PS :SAM模块ID为二代证设备唯一标志ID;
|
||
//PS2:此函通常用来数来区分设备或判断设备是否连接正常;若只读卡信息的话无需添加此函数。
|
||
int iResult = extend.SDT_GetSAMIDToStr(1001, strSAMID, 1);
|
||
if (0x90 != iResult)
|
||
{
|
||
errmsg = String.Format("获取SAMID号失败,错误代码:{0:D}", iResult);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + errmsg);
|
||
//MessageBox.Show(strMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
Status s = new Status(errmsg);
|
||
//测试用,先注释掉下面两行 zyk20231122
|
||
//s.ShowDialog();
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
byte[] byManaID = new byte[8];
|
||
#region 寻卡
|
||
//寻卡
|
||
iResult = extend.SDT_StartFindIDCard(iPort, byManaID, iIfOpen);
|
||
if (0x9F != iResult)
|
||
{
|
||
errmsg = String.Format("寻卡失败,错误代码:{0:D}", iResult);
|
||
//Status s = new Status(errmsg);
|
||
//s.ShowDialog();
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + "没有找到身份证!" + errmsg);
|
||
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
#region 选卡
|
||
//选卡
|
||
byManaID.Initialize();
|
||
iResult = extend.SDT_SelectIDCard(iPort, byManaID, iIfOpen);
|
||
if (0x90 != iResult)
|
||
{
|
||
errmsg = String.Format("选卡失败,错误代码:{0:D}", iResult);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + errmsg);
|
||
|
||
//MessageBox.Show(strMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
Status s = new Status(errmsg);
|
||
s.ShowDialog();
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
#region 读卡
|
||
//读取身份证个人基本信息、照片信息和指纹信息;
|
||
//PS:指纹信息需要专门的指纹比对设备,这里只获取加密的原始数据。
|
||
iResult = extend.SDT_ReadBaseFPMsg(iPort, byCHMsg, ref uiCHMsgSize, byPHMsg, ref uiPHMsgSize, byFPMsg, ref uiFPMsgSize, iIfOpen);
|
||
if (0x21 == iResult)//0501模块(一种老模块)无法读取指纹信息,会返回0x21错误,这里进行兼容处理;这种模块早就不用了,实际可以不做处理。
|
||
{
|
||
iResult = extend.SDT_ReadBaseMsg(iPort, byCHMsg, ref uiCHMsgSize, byPHMsg, ref uiPHMsgSize, iIfOpen);//采用只读卡信息和照片,不读指纹信息的接口
|
||
}
|
||
if (0x90 != iResult)
|
||
{
|
||
errmsg = String.Format("读取身份信息失败,错误代码:{0:D}", iResult);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + errmsg);
|
||
|
||
Status s = new Status(errmsg);
|
||
s.ShowDialog();
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
#region 身份证照片解码
|
||
//解码照片数据,获得BGR格式数据
|
||
//iIsSaveToBmp = 1; //调用解码库unpack函数后,由接口自动生成名为zp.bmp的图片文件,该BMP文件可直接打开,不用B、R转换
|
||
iIsSaveToBmp = 0; //不自动生成zp.bmp图片
|
||
|
||
//PS :解码库需要依赖授权文件(license.dat);要确保“当前工作目录下”license.dat文件存在且正确,否则会返回-22和-12的错误
|
||
//PS2 :若设置iIsSaveToBmp = 1,即由接口自动生成zp.bmp文件,请确认“当前工作目录”具有写权限,否侧接口会崩溃(WIN7以上系统需注意此项)
|
||
iResult = extend.unpack(byPHMsg, byBgrBuffer, iIsSaveToBmp);
|
||
if (1 != iResult)
|
||
{
|
||
errmsg = String.Format("照片解码失败,错误代码:{0:D}", iResult);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + errmsg);
|
||
|
||
Status s = new Status(errmsg);
|
||
s.ShowDialog();
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
#region 身份证照片 转换格式为bmp
|
||
//拼接BMP图片格式头,14字节
|
||
byte[] byBmpHead = new byte[14] { 0x42, 0x4D, 0xCE, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00 };
|
||
Array.Copy(byBmpHead, 0, byBmpBuffer, 0, 14);
|
||
|
||
//拼接BMP图像信息,40字节
|
||
byte[] byBmpInfo = new byte[40]{ 0x28,0x00,0x00,0x00,//结构所占用40字节
|
||
0x66,0x00,0x00,0x00,//位图的宽度102像素
|
||
0x7E,0x00,0x00,0x00,//位图的高度126像素
|
||
0x01,0x00, //目标设备的级别必须为1
|
||
0x18,0x00, //每个像素所需的位数24
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00//......其他信息省略为0
|
||
};
|
||
Array.Copy(byBmpInfo, 0, byBmpBuffer, 14, 40);
|
||
|
||
//将解码后的BGR格式数据进行B、R互换
|
||
iResult = GFunction.bgr2rgb(byBgrBuffer, byBgrBuffer.Length, byRgbBuffer, byRgbBuffer.Length, 102, 126);
|
||
if (iResult <= 0)
|
||
{
|
||
//MessageBox.Show("照片数据B、R互换失败.", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
errmsg = String.Format("照片数据B、R互换失败.", iResult);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + errmsg);
|
||
|
||
Status s = new Status(errmsg);
|
||
s.ShowDialog();
|
||
break;
|
||
}
|
||
Array.Copy(byRgbBuffer, 0, byBmpBuffer, 54, iResult);
|
||
string zpf = Application.StartupPath + "\\zp1.bmp";
|
||
//写入文件
|
||
int iBmpSize = 54 + iResult;
|
||
if (!GFunction.tool_WriteOneFile(zpf, byBmpBuffer, iBmpSize))
|
||
{
|
||
// MessageBox.Show("保存照片数据失败.", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
errmsg = String.Format("保存照片数据失败.", iResult);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + errmsg);
|
||
|
||
Status s = new Status(errmsg);
|
||
s.ShowDialog();
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
#region 解析出个人基本信息
|
||
//截取个人信息数据。信息采用UNICODE存储,具体格式参可见《二代证机读信息说明.doc》
|
||
byte[] byName = new byte[30];
|
||
byte[] bySex = new byte[2];
|
||
byte[] byRace = new byte[4];
|
||
byte[] byBirth = new byte[16];
|
||
byte[] byAddress = new byte[70];
|
||
byte[] byID = new byte[36];
|
||
byte[] byCompany = new byte[30];
|
||
byte[] byBeginDate = new byte[16];
|
||
byte[] byEndDate = new byte[16];
|
||
|
||
Array.Copy(byCHMsg, 0, byName, 0, 30);
|
||
Array.Copy(byCHMsg, 30, bySex, 0, 2);
|
||
Array.Copy(byCHMsg, 32, byRace, 0, 4);
|
||
Array.Copy(byCHMsg, 36, byBirth, 0, 16);
|
||
Array.Copy(byCHMsg, 52, byAddress, 0, 70);
|
||
Array.Copy(byCHMsg, 122, byID, 0, 36);
|
||
Array.Copy(byCHMsg, 158, byCompany, 0, 30);
|
||
Array.Copy(byCHMsg, 188, byBeginDate, 0, 16);
|
||
Array.Copy(byCHMsg, 204, byEndDate, 0, 16);
|
||
|
||
//显示结果
|
||
|
||
/* strIDBase = "读卡成功.\r\n\r\n";
|
||
strIDBase += "姓名: " + Encoding.Unicode.GetString(byName).Trim() + "\r\n\r\n";
|
||
strIDBase += "性别: " + Encoding.Unicode.GetString(bySex).Trim() + "\r\n\r\n";
|
||
strIDBase += "民族: " + Encoding.Unicode.GetString(byRace).Trim() + "\r\n\r\n";
|
||
strIDBase += "出生日期: " + Encoding.Unicode.GetString(byBirth).Trim() + "\r\n\r\n";
|
||
strIDBase += "居住地址: " + Encoding.Unicode.GetString(byAddress).Trim() + "\r\n\r\n";
|
||
strIDBase += "公民身份证号: " + Encoding.Unicode.GetString(byID).Trim() + "\r\n\r\n";
|
||
strIDBase += "签发机关: " + Encoding.Unicode.GetString(byCompany).Trim() + "\r\n\r\n";
|
||
strIDBase += "有效起始日期: " + Encoding.Unicode.GetString(byBeginDate).Trim() + "\r\n\r\n";
|
||
strIDBase += "有效截止日期: " + Encoding.Unicode.GetString(byEndDate).Trim() + "\r\n\r\n";*/
|
||
|
||
info.Name = Encoding.Unicode.GetString(byName).Trim().Replace("\0", "");
|
||
//info.Nation = Encoding.Default.GetString(personInfo.nation).Trim().Replace("\0", "");
|
||
info.IDCardNo = Encoding.Unicode.GetString(byID).Trim().Replace("\0", "");
|
||
//info.GrantDept = CardMsg.GrantDept;
|
||
string csrq = Encoding.Unicode.GetString(byBirth).Trim().Replace("\0", "");
|
||
info.Born = csrq.Substring(0, 4) + "-" + csrq.Substring(4, 2) + "-" + csrq.Substring(6, 2).Replace("\0", "");
|
||
info.Address = Encoding.Unicode.GetString(byAddress).Trim().Replace("\0", "");
|
||
//info.UserLifeEnd = CardMsg.UserLifeEnd;
|
||
//info.UserLifeBegin = CardMsg.UserLifeBegin;
|
||
info.Sex = Encoding.Unicode.GetString(bySex).Trim().Replace("\0", "");
|
||
//info.reserved = CardMsg.reserved;
|
||
info.PhotoFileName = zpf;
|
||
info.FPInfo = zpf;
|
||
info.FPInfo = info.FPInfo.Replace("\0", "");
|
||
if (!string.IsNullOrEmpty(zpf) && System.IO.File.Exists(zpf))
|
||
{
|
||
FileStream fs = new FileStream(zpf, FileMode.Open);
|
||
byte[] bs = new byte[fs.Length];
|
||
fs.Read(bs, 0, bs.Length);
|
||
fs.Close();
|
||
info.Photo = System.Drawing.Image.FromStream(new MemoryStream(bs));
|
||
File.Delete(zpf);
|
||
}
|
||
|
||
#endregion
|
||
|
||
|
||
ss.Show();
|
||
Application.DoEvents();
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + "读取身份证成功!");
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + Newtonsoft.Json.JsonConvert.SerializeObject(info));
|
||
|
||
#endregion
|
||
|
||
}
|
||
|
||
//测试
|
||
//info.IDCardNo = "370104190009080987";
|
||
|
||
#region 健康证打印
|
||
//查询有没有需要打印的健康证
|
||
WebClient wc = new WebClient();
|
||
wc.Encoding = Encoding.UTF8;
|
||
//获取 从业类型体检 最近一年的 登记记录(professionalExam_register)
|
||
string jsonData = wc.DownloadString(extend.URL + "zzj/getBGXX2?id=" + info.IDCardNo);
|
||
try
|
||
{
|
||
List<dccdc.Models.ProfessionalExamRegisterModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<dccdc.Models.ProfessionalExamRegisterModel>>(jsonData);
|
||
if (list != null)
|
||
{
|
||
List<dccdc.Models.ProfessionalExamRegisterModel> hgs = new List<dccdc.Models.ProfessionalExamRegisterModel>();
|
||
foreach (var h in list)
|
||
{
|
||
if (h.result_status == "合格")
|
||
hgs.Add(h);
|
||
}
|
||
if (hgs.Count == 0)
|
||
{
|
||
ss.update("没有您的体检证明,请咨询工作人员!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2);
|
||
}
|
||
else
|
||
{
|
||
List<dccdc.Models.ProfessionalExamRegisterModel> ydys = new List<dccdc.Models.ProfessionalExamRegisterModel>();
|
||
List<dccdc.Models.ProfessionalExamRegisterModel> wdys = new List<dccdc.Models.ProfessionalExamRegisterModel>();
|
||
foreach (var dy in hgs)
|
||
{
|
||
if (dy.procedure_status == "已打印健康证")
|
||
{
|
||
ydys.Add(dy);
|
||
}
|
||
else
|
||
{
|
||
wdys.Add(dy);
|
||
}
|
||
}
|
||
if (wdys.Count == 0)
|
||
{
|
||
ss.update("您的体检证明已经打印不能重复打印!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
}
|
||
else
|
||
{
|
||
ss.update("正在打印您的体检证明请稍后……!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
foreach (var w in wdys)
|
||
{
|
||
var m = w;
|
||
if (m.physical_category == "食品从业")
|
||
{
|
||
try
|
||
{
|
||
// m.id 是登记表 id
|
||
//获取健康证明 数据 datatale
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getjkzm_sp?zzj=1&ids=" + m.id);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
dt.Columns.Add("photo", typeof(byte[]));
|
||
dt.Columns.Add("yzewm", typeof(byte[]));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
|
||
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
|
||
}
|
||
FastReport.Report re = new FastReport.Report();
|
||
//自助机:食品行业体检证明
|
||
re.Load(Application.StartupPath + "\\report\\zzjtjzm_sp.frx");
|
||
re.RegisterData(dt, "table");
|
||
re.PrintSettings.ShowDialog = false;
|
||
|
||
try
|
||
{
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\tjzmdc\\";
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += m.id + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
//导出为bmp图片
|
||
re.Export(ie, bago);
|
||
re.Print();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
else if (m.physical_category == "公共场所")
|
||
{
|
||
try
|
||
{
|
||
//自助机:公共场所 体检证明
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getjkzm_gg?zzj=1&ids=" + m.id);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
dt.Columns.Add("photo", typeof(byte[]));
|
||
dt.Columns.Add("yzewm", typeof(byte[]));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
|
||
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
|
||
}
|
||
FastReport.Report re = new FastReport.Report();
|
||
re.Load(Application.StartupPath + "\\report\\zzjtjzm_gg.frx");
|
||
//re.Load(_reportPath);
|
||
re.RegisterData(dt, "table");
|
||
re.PrintSettings.ShowDialog = false;
|
||
|
||
try
|
||
{
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\tjzmdc\\";
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += m.id + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
re.Export(ie, bago);
|
||
re.Print();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
else if (m.physical_category == "药品从业")
|
||
{
|
||
try
|
||
{
|
||
//自助机:药品行业体检证明
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getjkzm_yp?zzj=1&ids=" + m.id);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
dt.Columns.Add("photo", typeof(byte[]));
|
||
dt.Columns.Add("yzewm", typeof(byte[]));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
|
||
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
|
||
}
|
||
FastReport.Report re = new FastReport.Report();
|
||
//re.Load(_reportPath);
|
||
re.Load(Application.StartupPath + "\\report\\zzjtjzm_yp.frx");
|
||
re.RegisterData(dt, "table");
|
||
re.PrintSettings.ShowDialog = false;
|
||
|
||
try
|
||
{
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\tjzmdc\\";
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += m.id + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
re.Export(ie, bago);
|
||
re.Print();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
}
|
||
ss.update("正在打印您的体检证明,请稍后(10)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(9)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(8)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(7)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(6)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(5)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(4)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(3)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(2)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(1)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.Close();
|
||
printSuccess ps = new printSuccess();
|
||
ps.TopMost = true;
|
||
ps.ShowDialog();
|
||
}
|
||
}
|
||
}
|
||
#region MyRegion
|
||
/*
|
||
//result_status='合格' and procedure_status!='已打印健康证'
|
||
if (list.result_status != "合格")
|
||
{
|
||
ss.update("没有您的体检证明,请到205咨询!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2);
|
||
}
|
||
else
|
||
{
|
||
if (list.procedure_status == "已打印健康证")
|
||
{
|
||
ss.update("您的体检证明已经打印不能重复打印!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
|
||
}
|
||
else
|
||
{
|
||
ss.update("正在打印您的体检证明请稍后……!");
|
||
Thread.Sleep(1000);
|
||
Application.DoEvents();
|
||
var m = list;
|
||
if (m.physical_category == "食品从业")
|
||
{
|
||
try
|
||
{
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getjkzm_sp?zzj=1&ids=" + m.id);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
dt.Columns.Add("photo", typeof(byte[]));
|
||
dt.Columns.Add("yzewm", typeof(byte[]));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
|
||
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
|
||
}
|
||
FastReport.Report re = new FastReport.Report();
|
||
re.Load(Application.StartupPath + "\\report\\zzjtjzm_sp.frx");
|
||
re.RegisterData(dt, "table");
|
||
re.PrintSettings.ShowDialog = false;
|
||
|
||
try
|
||
{
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\tjzmdc\\";
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += m.id + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
re.Export(ie, bago);
|
||
re.Print();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
else if (m.physical_category == "公共场所")
|
||
{
|
||
try
|
||
{
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getjkzm_gg?zzj=1&ids=" + m.id);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
dt.Columns.Add("photo", typeof(byte[]));
|
||
dt.Columns.Add("yzewm", typeof(byte[]));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
|
||
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
|
||
}
|
||
FastReport.Report re = new FastReport.Report();
|
||
re.Load(Application.StartupPath + "\\report\\zzjtjzm_gg.frx");
|
||
//re.Load(_reportPath);
|
||
re.RegisterData(dt, "table");
|
||
re.PrintSettings.ShowDialog = false;
|
||
|
||
try
|
||
{
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\tjzmdc\\";
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += m.id + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
re.Export(ie, bago);
|
||
re.Print();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
else if (m.physical_category == "药品从业")
|
||
{
|
||
try
|
||
{
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getjkzm_yp?zzj=1&ids=" + m.id);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
dt.Columns.Add("photo", typeof(byte[]));
|
||
dt.Columns.Add("yzewm", typeof(byte[]));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
|
||
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
|
||
}
|
||
FastReport.Report re = new FastReport.Report();
|
||
//re.Load(_reportPath);
|
||
re.Load(Application.StartupPath + "\\report\\zzjtjzm_yp.frx");
|
||
re.RegisterData(dt, "table");
|
||
re.PrintSettings.ShowDialog = false;
|
||
|
||
try
|
||
{
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\tjzmdc\\";
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += m.id + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
re.Export(ie, bago);
|
||
re.Print();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
ss.update("正在打印您的体检证明,请稍后(10)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(9)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(8)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(7)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(6)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(5)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(4)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(3)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(2)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.update("正在打印您的体检证明,请稍后(1)!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
ss.Close();
|
||
printSuccess ps = new printSuccess();
|
||
ps.TopMost = true;
|
||
ps.ShowDialog();
|
||
break;
|
||
}
|
||
}*/
|
||
#endregion
|
||
}
|
||
|
||
catch (Exception fex)
|
||
{
|
||
ss.update(fex.Message);
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + fex.Message);
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
break;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 条码单 指引单打印
|
||
//处理预约登记
|
||
ss.update("正在查询有没有您的预约信息请稍后");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
//获取预约信息
|
||
string data = wc.DownloadString(extend.URL + "zzj/getYYXX?id=" + info.IDCardNo);
|
||
List<dccdc.Models.MedicalAppointment> yylist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<dccdc.Models.MedicalAppointment>>(data);
|
||
if (yylist.Count > 0)
|
||
{
|
||
foreach (var ma in yylist)
|
||
{
|
||
MemoryStream ms = new MemoryStream();
|
||
info.Photo.Save(ms, ImageFormat.Jpeg);
|
||
//调用后台进行注册
|
||
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
|
||
byte[] udata = System.Text.Encoding.UTF8.GetBytes("xm=" + info.Name + "&csrq="
|
||
+ info.Born + "&idcard=" + info.IDCardNo + "&img="
|
||
+ System.Web.HttpUtility.UrlEncode(Convert.ToBase64String(ms.ToArray()))
|
||
+ "&jtzz=" + info.Address
|
||
+ "®p=" + System.Configuration.ConfigurationManager.AppSettings["zzjname"]);
|
||
|
||
//从业体检 登记
|
||
byte[] bs = wc.UploadData(extend.URL + "zzj/register?id=" + ma.id, udata);
|
||
data = System.Text.Encoding.UTF8.GetString(bs);
|
||
|
||
var or = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.OperationResult>(data);
|
||
//state=1:表示登记成功
|
||
if (or.State == 1)
|
||
{
|
||
//导引单 配POS置
|
||
string pos_dyj = System.Configuration.ConfigurationManager.AppSettings["pos_dyj"];
|
||
//string jsonDatadj = "";
|
||
DataTable dt;
|
||
//打印指引单
|
||
wc.Encoding = System.Text.Encoding.UTF8;
|
||
try
|
||
{
|
||
//or.Message,是返回的条码physical_num
|
||
//根据条码获取 登记信息
|
||
jsonData = wc.DownloadString(extend.URL + "Registration/GetRegisteModel?tm=" + or.Message);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
|
||
FastReport.Report re = new FastReport.Report();
|
||
//4:卡车司机;5:VCT
|
||
if (dt.Rows[0]["medical_scheme_maintain_id"].ToString() == "4" || dt.Rows[0]["medical_scheme_maintain_id"].ToString() == "5")
|
||
{
|
||
|
||
re.Load(Application.StartupPath + "\\report\\zyzyd.frx");
|
||
re.RegisterData(dt, "professionalExam_register");
|
||
DataTable qxdt = new DataTable();
|
||
qxdt.Columns.Add("qx");
|
||
string jsonqx = "";
|
||
try
|
||
{
|
||
//根据体检项目查询该体检项目的检查科室
|
||
jsonqx = wc.DownloadString(extend.URL + "Registration/GetTjxmRoom/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable qdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonqx);
|
||
if (qdt.Rows.Count != 0)
|
||
{
|
||
DataTable ckrs = qdt.DefaultView.ToTable(true, "check_room");
|
||
foreach (DataRow drr in ckrs.Rows)
|
||
{
|
||
DataRow dr1 = qxdt.NewRow();
|
||
//==================================================//
|
||
//此处被写死‘血检’,经查数据没有此项,后续需要根据客户情况处理
|
||
if (drr["check_room"].ToString().IndexOf("血检", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr1["qx"] += drr["check_room"] + "上午空腹静脉抽血";// + (qdt.Rows[i]["team_name"].ToString().IndexOf("尿", StringComparison.Ordinal) > -1 ? ",留取尿样" : "");
|
||
bool f = false;
|
||
DataRow[] drs = qdt.Select("check_room='" + drr["check_room"] + "'");
|
||
foreach (DataRow drrr in drs)
|
||
{
|
||
if (drrr["team_name"].ToString().Contains("尿"))
|
||
{
|
||
f = true;
|
||
break;
|
||
}
|
||
|
||
}
|
||
if (f)
|
||
{
|
||
dr1["qx"] += ",留取尿样";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
dr1["qx"] += drr["check_room"] + "检查";
|
||
}
|
||
qxdt.Rows.Add(dr1);
|
||
}
|
||
}
|
||
|
||
/*
|
||
for (int i = 0; i < qdt.Rows.Count; i++)
|
||
{
|
||
DataRow dr1 = qxdt.NewRow();
|
||
if (qdt.Rows[i]["check_room"].ToString().IndexOf("血检", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr1["qx"] += qdt.Rows[i]["check_room"] + "上午空腹静脉抽血" + (qdt.Rows[i]["team_name"].ToString().IndexOf("尿", StringComparison.Ordinal) > -1 ? ",留取尿样" : "");
|
||
}
|
||
else
|
||
{
|
||
dr1["qx"] += qdt.Rows[i]["check_room"] + "检查";
|
||
}
|
||
qxdt.Rows.Add(dr1);
|
||
|
||
}*/
|
||
/*
|
||
if (qxdt.Select("qx like'%上午空腹静脉抽血,留取尿样'").Length > 0 && qxdt.Select("qx like'%上午空腹静脉抽血'").Length > 0)
|
||
{
|
||
qxdt.Rows.Remove(qxdt.Select("qx like'%上午空腹静脉抽血'")[0]);
|
||
}*/
|
||
DataView dv = qxdt.DefaultView;
|
||
DataTable distTable = dv.ToTable("Dist", true, "qx");
|
||
re.RegisterData(distTable, "qxdt");
|
||
string jsonBjxm = "";
|
||
try
|
||
{
|
||
//根据体检项目ID查询体检项目列表
|
||
jsonBjxm = wc.DownloadString(extend.URL + "Registration/GettjxmByIDsReport/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable bjxm = new DataTable();
|
||
DataTable tjxmdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonBjxm);
|
||
|
||
|
||
bjxm.Columns.Add("bjxm");
|
||
|
||
foreach (DataRow daraRow in tjxmdt.Rows)
|
||
{
|
||
DataRow dr2 = bjxm.NewRow();
|
||
dr2["bjxm"] = daraRow["exam_group"].ToString();
|
||
bjxm.Rows.Add(dr2);
|
||
}
|
||
DataView dv1 = bjxm.DefaultView;
|
||
DataTable distTable1 = dv1.ToTable("Dist", true, "bjxm");
|
||
string g = "";
|
||
foreach (DataRow daraRow in distTable1.Rows)
|
||
{
|
||
g += daraRow["bjxm"] + ",";
|
||
}
|
||
DataTable dt3 = new DataTable();
|
||
dt3.Columns.Add("bjxm");
|
||
DataRow tt = dt3.NewRow();
|
||
tt["bjxm"] = g;
|
||
dt3.Rows.Add(tt);
|
||
re.RegisterData(dt3, "bjxmdt");
|
||
//说明------
|
||
DataTable smdt = new DataTable();
|
||
smdt.Columns.Add("sm");
|
||
DataRow dr = smdt.NewRow();
|
||
|
||
if (dt.Rows[0]["exam_type"].ToString().IndexOf("特种", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr["sm"] = "体检项目完成后请回到二楼职业卫生科(206)领取《特种作业健康检查表》。";
|
||
}
|
||
else if (dt.Rows[0]["exam_type"].ToString().IndexOf("常规", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr["sm"] = "1、请当天下午4点后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
|
||
"检查表》。\r\n2、请在空腹状态下接受肝功能检查;孕妇接受透视或拍片时请事先告知医生;抽血后用棉签按压穿刺处3-5分钟。";
|
||
}
|
||
else if (dt.Rows[0]["exam_type"].ToString().IndexOf("机动", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr["sm"] = "1、请体检结束后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
|
||
"检查表》。";
|
||
}
|
||
else
|
||
{
|
||
dr["sm"] = "1、请当天下午4点后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
|
||
"检查表》。\r\n2、请在空腹状态下接受肝功能和B超检查;孕妇接受透视或拍片时请事先告知医生;抽血后用棉签按压穿刺处3-5分钟。";
|
||
}
|
||
smdt.Rows.Add(dr);
|
||
re.SetParameterValue("examtype", dt.Rows[0]["exam_type"].ToString());
|
||
re.SetParameterValue("agreement_money", dt.Rows[0]["agreement_money"]);
|
||
re.RegisterData(smdt, "smdt");
|
||
DataTable zydtop = new DataTable();
|
||
zydtop.Columns.Add("zyd");
|
||
DataRow dr6 = zydtop.NewRow();
|
||
dr6["zyd"] = dt.Rows[0]["exam_type"] + "指引单";
|
||
zydtop.Rows.Add(dr6);
|
||
re.RegisterData(zydtop, "zydtop");
|
||
DataTable imagedt = new DataTable();
|
||
imagedt.Columns.Add("image", typeof(byte[]));
|
||
DataRow d = imagedt.NewRow();
|
||
d["image"] = Convert.FromBase64String(dt.Rows[0]["phone_path"].ToString());
|
||
imagedt.Rows.Add(d);
|
||
re.RegisterData(imagedt, "imagedt");
|
||
re.PrintSettings.ShowDialog = false;
|
||
if (!string.IsNullOrEmpty(pos_dyj))
|
||
re.PrintSettings.Printer = pos_dyj;
|
||
re.Print();
|
||
}
|
||
else
|
||
{
|
||
re.Load(Application.StartupPath + "\\report\\zyd.frx");
|
||
re.RegisterData(dt, "professionalExam_register");
|
||
DataTable tjlctop = new DataTable();
|
||
tjlctop.Columns.Add("lc");
|
||
DataTable tjlcbom = new DataTable();
|
||
tjlcbom.Columns.Add("lc");
|
||
DataTable zydtop = new DataTable();
|
||
zydtop.Columns.Add("zyd");
|
||
DataTable imagedt = new DataTable();
|
||
imagedt.Columns.Add("image", typeof(byte[]));
|
||
DataRow d = imagedt.NewRow();
|
||
d["image"] = Convert.FromBase64String(dt.Rows[0]["phone_path"].ToString());
|
||
imagedt.Rows.Add(d);
|
||
|
||
DataRow dr;
|
||
/*switch (dt.Rows[0]["physical_category"].ToString())
|
||
{
|
||
case "公共场所":
|
||
dr = zydtop.NewRow();
|
||
dr["zyd"] = "公共场所从业人员健康检查指引单";
|
||
zydtop.Rows.Add(dr);
|
||
DataRow dr1 = tjlctop.NewRow();
|
||
dr1["lc"] = "3. “内科”检查内科项目;";
|
||
DataRow dr2 = tjlctop.NewRow();
|
||
dr2["lc"] = "4. “内科”检查皮肤;";
|
||
//DataRow dr3 = tjlctop.NewRow();
|
||
//dr3["lc"] = "5. “培训(201)室”卫生知识培训。";
|
||
tjlctop.Rows.Add(dr1); tjlctop.Rows.Add(dr2); //tjlctop.Rows.Add(dr3);
|
||
//DataRow dr10 = tjlcbom.NewRow();
|
||
//dr10["lc"] = "指引单到“办证室”领取健康证。";
|
||
//tjlcbom.Rows.Add(dr10);
|
||
break;
|
||
case "食品从业":
|
||
dr = zydtop.NewRow();
|
||
dr["zyd"] = "食品从业人员健康检查指引单";
|
||
zydtop.Rows.Add(dr);
|
||
DataRow dr4 = tjlctop.NewRow();
|
||
dr4["lc"] = "3. “内科”检查皮肤;";
|
||
//DataRow dr5 = tjlctop.NewRow();
|
||
//dr5["lc"] = "4. “培训(201)室”卫生知识培训。";
|
||
tjlctop.Rows.Add(dr4);// tjlctop.Rows.Add(dr5);
|
||
//DataRow dr9 = tjlcbom.NewRow();
|
||
//dr9["lc"] = "指引单到“办证室”领取健康证。";
|
||
//tjlcbom.Rows.Add(dr9);
|
||
break;
|
||
case "药品从业":
|
||
dr = zydtop.NewRow();
|
||
dr["zyd"] = "药品从业人员健康检查指引单";
|
||
zydtop.Rows.Add(dr);
|
||
DataRow dr6 = tjlctop.NewRow();
|
||
dr6["lc"] = "3. “内科”检查内科项目;";
|
||
DataRow dr7 = tjlctop.NewRow();
|
||
dr7["lc"] = "4. “内科”检查皮肤及辨色力;";
|
||
tjlctop.Rows.Add(dr6); tjlctop.Rows.Add(dr7);
|
||
|
||
DataRow dr8 = tjlctop.NewRow();
|
||
DataRow dr9 = tjlctop.NewRow();
|
||
dr8["lc"] = "5. “一楼院内X光室”检查胸透;";
|
||
// tjlctop.Rows.Add(dr6); tjlctop.Rows.Add(dr7);
|
||
dr9["lc"] = "6. “心电图室”检查心电图;";
|
||
tjlctop.Rows.Add(dr8); tjlctop.Rows.Add(dr9);
|
||
//DataRow dr8 = tjlcbom.NewRow();
|
||
//dr8["lc"] = "指引单到“职业卫生科(206)室”领取检查表。";
|
||
//tjlcbom.Rows.Add(dr8);
|
||
break;
|
||
default:
|
||
dr = zydtop.NewRow();
|
||
dr["zyd"] = "从业人员健康检查指引单";
|
||
zydtop.Rows.Add(dr);
|
||
break;
|
||
}*/
|
||
dr = zydtop.NewRow();
|
||
if (dt.Rows[0]["physical_category"].ToString() == "公共场所")
|
||
{
|
||
dr["zyd"] = dt.Rows[0]["physical_category"].ToString() + "从业人员健康检查指引单";
|
||
}
|
||
else
|
||
{
|
||
string strzyd = dt.Rows[0]["physical_category"].ToString();
|
||
dr["zyd"] = strzyd.Substring(0, strzyd.Length - 2) + "从业人员健康检查指引单";
|
||
}
|
||
|
||
zydtop.Rows.Add(dr);
|
||
string jsonqx = "";
|
||
try
|
||
{
|
||
jsonqx = wc.DownloadString(extend.URL + "/Registration/GetTjxmRoom/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable qdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonqx);
|
||
//“检验科 ” 提示的展示标志
|
||
bool bJYNote = false;
|
||
string strJYRoom = "";
|
||
//大便提示的展示标志
|
||
bool bDBNote = false;
|
||
string strDBRoom = "";
|
||
//留取尿样的展示标志
|
||
bool bNYNote = false;
|
||
string strNYRoom = "";
|
||
if (qdt.Rows.Count != 0)
|
||
{
|
||
DataTable ckrs = qdt.DefaultView.ToTable(true, "check_room");
|
||
foreach (DataRow drr in ckrs.Rows)
|
||
{
|
||
DataRow dr1 = tjlctop.NewRow();
|
||
dr1["lc"] += "\"" + drr["check_room"] + "\"检查:";
|
||
//列举体检小组
|
||
string strTeamNames = "";
|
||
DataRow[] drs = qdt.Select("check_room='" + drr["check_room"] + "'");
|
||
foreach (DataRow drrr in drs)
|
||
{
|
||
if (strTeamNames.IndexOf(drrr["team_name"].ToString()) == -1)
|
||
{
|
||
strTeamNames += drrr["team_name"].ToString() + ",";
|
||
}
|
||
if (drrr["team_name"].ToString().Contains("尿"))
|
||
{
|
||
bNYNote = true;
|
||
strNYRoom = drr["check_room"].ToString();
|
||
}
|
||
if (drrr["team_name"].ToString().Contains("血") ||
|
||
drrr["team_name"].ToString().Contains("生化") ||
|
||
drrr["team_name"].ToString().Contains("肝"))
|
||
{
|
||
bJYNote = true;
|
||
strJYRoom = drr["check_room"].ToString();
|
||
}
|
||
if (drrr["team_name"].ToString().Contains("大便"))
|
||
{
|
||
bDBNote = true;
|
||
strDBRoom = drr["check_room"].ToString();
|
||
}
|
||
}
|
||
dr1["lc"] += strTeamNames.Substring(0, strTeamNames.Length - 1);
|
||
tjlctop.Rows.Add(dr1);
|
||
}
|
||
}
|
||
if (bNYNote)
|
||
{
|
||
re.SetParameterValue("bNYNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bNYNote", "no");
|
||
}
|
||
if (bJYNote)
|
||
{
|
||
re.SetParameterValue("bJYNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bJYNote", "no");
|
||
}
|
||
if (bDBNote)
|
||
{
|
||
re.SetParameterValue("bDBNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bDBNote", "no");
|
||
}
|
||
if (bDBNote || bJYNote || bNYNote)
|
||
{
|
||
re.SetParameterValue("bNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bNote", "no");
|
||
}
|
||
re.SetParameterValue("strNYRoom", strNYRoom);
|
||
re.SetParameterValue("strJYRoom", strJYRoom);
|
||
re.SetParameterValue("strDBRoom", strDBRoom);
|
||
|
||
re.RegisterData(tjlcbom, "tjlcbom");
|
||
re.RegisterData(tjlctop, "tjlctop");
|
||
re.RegisterData(zydtop, "zydtop");
|
||
re.RegisterData(imagedt, "imagedt");
|
||
re.SetParameterValue("agreement_money", dt.Rows[0]["agreement_money"]);
|
||
re.PrintSettings.ShowDialog = false;
|
||
if (!string.IsNullOrEmpty(pos_dyj))
|
||
re.PrintSettings.Printer = pos_dyj;
|
||
|
||
|
||
//---------输出为图片,测试用-------------
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\cyzyd\\";
|
||
Log.WriteLogToTxt("bagopath:" + bago);
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += DateTime.Now.ToString("yyyyMMddHHmmss") + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
//导出为bmp图片
|
||
re.Export(ie, bago);
|
||
//----------------------
|
||
|
||
re.Print();
|
||
var loger = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||
try
|
||
{
|
||
|
||
string msg = "";
|
||
// int mc= extend.open_printer(13, 0, ref msg);
|
||
// loger.Info("打印小票打印机:" + mc + "\t" + msg);
|
||
// mc= extend.get_printerStatus();
|
||
// loger.Info("小票打印机状态:" + mc);
|
||
// mc= extend.close_printer();
|
||
// loger.Info("关闭小票打印机:" + mc);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
loger.Info("小票打印机异常:" + ex.Message);
|
||
}
|
||
}
|
||
//打印条码
|
||
string tmprint = System.Configuration.ConfigurationManager.AppSettings["tmprint"];
|
||
jsonData = "";
|
||
//wc.Encoding = System.Text.Encoding.UTF8;
|
||
|
||
//zyk 20231120 此处未测试……………………………………………………………………
|
||
#region 因性能问题 不再动态查询,直接打印三张条码
|
||
try
|
||
{
|
||
//获取体检条码 列表 or.Message,是返回的条码physical_num
|
||
jsonData = wc.DownloadString(extend.URL + "professional/getTMByphysical_num/" + or.Message);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
|
||
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
if (dt.Rows.Count == 0)
|
||
return;
|
||
string strName = dt.Rows[0]["xm"].ToString();
|
||
|
||
DataTable dtTm = new DataTable();
|
||
dtTm.Columns.Add("xm");
|
||
dtTm.Columns.Add("tm");
|
||
dtTm.Columns.Add("xmtm");
|
||
dtTm.Columns.Add("tz");
|
||
for (int i = 0; i < 3; i++)
|
||
{
|
||
DataRow drBarcode = dtTm.NewRow();
|
||
drBarcode["tm"] = or.Message;
|
||
drBarcode["xm"] = strName;
|
||
dtTm.Rows.Add(drBarcode);
|
||
}
|
||
#endregion
|
||
#region MyRegion
|
||
//try
|
||
//{
|
||
// //获取体检条码 列表 or.Message,是返回的条码physical_num
|
||
// jsonData = wc.DownloadString(extend.URL + "professional/getTMByphysical_num/" + or.Message);
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// MessageBox.Show(ex.Message);
|
||
//}
|
||
|
||
//dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
//if (dt.Rows.Count == 0)
|
||
// return;
|
||
//if (dt.Rows.Count % 2 == 1)
|
||
//{
|
||
// //没看明白…… 可能目的是补一个空行,用于排版效果……
|
||
// var row = dt.NewRow();
|
||
// dt.Rows.Add(row);
|
||
//}
|
||
////是否根据分组打印
|
||
//bool bBarcodeByGroup = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["BarcodeByGroup"]);
|
||
////只打印姓名、体检号physical_num
|
||
//if (!bBarcodeByGroup)
|
||
//{
|
||
// string strName = dt.Rows[0]["xm"].ToString();
|
||
// for (int i = dt.Rows.Count - 1; i >= 0; i--)
|
||
// {
|
||
// dt.Rows.RemoveAt(i);
|
||
// }
|
||
// int count = 2;
|
||
// //根据体检编号获取体检项目中是否包含"生化、血常规、尿常规"检查
|
||
// string strSpecialconf = wc.DownloadString(extend.URL + "professional/getSpecialconf?physical_num=" + or.Message);
|
||
// //若"生化、血常规、尿常规"都存在,则设置count为3,打印三张条码
|
||
// if (Convert.ToInt32(strSpecialconf) == 3)
|
||
// {
|
||
// count = 3;
|
||
// }
|
||
// for (int i = 0; i < count; i++)
|
||
// {
|
||
// DataRow drBarcode = dt.NewRow();
|
||
// drBarcode["tm"] = or.Message;
|
||
// drBarcode["xm"] = strName;
|
||
// dt.Rows.Add(drBarcode);
|
||
// }
|
||
//}
|
||
#endregion
|
||
|
||
//zyk 20231122 临时注释掉打印条码功能,后续需开启
|
||
re = new FastReport.Report();
|
||
re.Load(Application.StartupPath + "\\report\\barcode.frx");
|
||
re.RegisterData(dtTm, "barcode");
|
||
re.PrintSettings.ShowDialog = false;
|
||
if (!string.IsNullOrEmpty(tmprint))
|
||
re.PrintSettings.Printer = tmprint;
|
||
re.Print();
|
||
}
|
||
else
|
||
{
|
||
ss.update(or.Message);
|
||
}
|
||
}
|
||
ss.update("登记成功!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
//ss.Close();
|
||
//this.Close();
|
||
|
||
}
|
||
else
|
||
{
|
||
ss.update("没有找到您的预约信息!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
//ss.Close();
|
||
//this.Close();
|
||
}
|
||
if (ss != null && !ss.IsDisposed)
|
||
{
|
||
//ss.Close();
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 职业----条码单 指引单打印
|
||
//处理登记登记
|
||
ss.update("正在查询有没有您的登记信息请稍后");
|
||
Application.DoEvents();
|
||
Thread.Sleep(1000);
|
||
//获取体检编号 enableReprint
|
||
//获取体检编号
|
||
url_getPhysicalNumByIDCard += "&id=" + info.IDCardNo;
|
||
//string url_getPhysicalNumByIDCard = extend.URL + "zzj/getPhysicalNumByIDCard?id=" + info.IDCardNo;
|
||
|
||
Log.WriteLogToTxt(url_getPhysicalNumByIDCard);
|
||
string physical_num = wc.DownloadString(url_getPhysicalNumByIDCard);
|
||
url_getPhysicalNumByIDCard = "";
|
||
|
||
if (physical_num != "")
|
||
{
|
||
//导引单 配POS置
|
||
string pos_dyj = System.Configuration.ConfigurationManager.AppSettings["pos_dyj"];
|
||
string jsonqx = "";
|
||
string jsonBjxm = "";
|
||
wc.Encoding = System.Text.Encoding.UTF8;
|
||
try
|
||
{
|
||
jsonData = wc.DownloadString(extend.URL + "/Registration/GetRegisteModel/?tm=" + physical_num);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
//zyk 20231111 用户姓名
|
||
string UserName = dt.Rows[0]["person_name"].ToString();
|
||
|
||
FastReport.Report re = new FastReport.Report();
|
||
re.Load(Application.StartupPath + "\\report\\zyzyd.frx");
|
||
re.RegisterData(dt, "professionalExam_register");
|
||
DataTable qxdt = new DataTable();
|
||
qxdt.Columns.Add("qx");
|
||
try
|
||
{
|
||
jsonqx = wc.DownloadString(extend.URL + "/Registration/GetTjxmRoom/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable qdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonqx);
|
||
//“检验科 ” 提示的展示标志
|
||
bool bJYNote = false;
|
||
string strJYRoom = "";
|
||
//大便提示的展示标志
|
||
bool bDBNote = false;
|
||
string strDBRoom = "";
|
||
//留取尿样的展示标志
|
||
bool bNYNote = false;
|
||
string strNYRoom = "";
|
||
if (qdt.Rows.Count != 0)
|
||
{
|
||
/* DataTable ckrs = qdt.DefaultView.ToTable(true, "check_room");
|
||
foreach (DataRow drr in ckrs.Rows)
|
||
{
|
||
DataRow dr1 = qxdt.NewRow();
|
||
if (drr["check_room"].ToString().IndexOf("血检", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr1["qx"] += drr["check_room"] + "上午空腹静脉抽血";// + (qdt.Rows[i]["team_name"].ToString().IndexOf("尿", StringComparison.Ordinal) > -1 ? ",留取尿样" : "");
|
||
bool f = false;
|
||
DataRow[] drs = qdt.Select("check_room='" + drr["check_room"] + "'");
|
||
foreach (DataRow drrr in drs)
|
||
{
|
||
if (drrr["team_name"].ToString().Contains("尿"))
|
||
{
|
||
f = true;
|
||
break;
|
||
}
|
||
}
|
||
if (f)
|
||
{
|
||
dr1["qx"] += ",留取尿样";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
dr1["qx"] += drr["check_room"] + "检查";
|
||
}
|
||
qxdt.Rows.Add(dr1);
|
||
}*/
|
||
DataTable ckrs = qdt.DefaultView.ToTable(true, "check_room");
|
||
foreach (DataRow drr in ckrs.Rows)
|
||
{
|
||
DataRow dr1 = qxdt.NewRow();
|
||
dr1["qx"] += "\"" + drr["check_room"] + "\"检查:";
|
||
//列举体检小组
|
||
string strTeamNames = "";
|
||
DataRow[] drs = qdt.Select("check_room='" + drr["check_room"] + "'");
|
||
foreach (DataRow drrr in drs)
|
||
{
|
||
if (strTeamNames.IndexOf(drrr["team_name"].ToString()) == -1)
|
||
{
|
||
strTeamNames += drrr["team_name"].ToString() + ",";
|
||
}
|
||
if (drrr["team_name"].ToString().Contains("尿"))
|
||
{
|
||
bNYNote = true;
|
||
strNYRoom = drr["check_room"].ToString();
|
||
}
|
||
if (drrr["team_name"].ToString().Contains("血") ||
|
||
drrr["team_name"].ToString().Contains("生化") ||
|
||
drrr["team_name"].ToString().Contains("肝"))
|
||
{
|
||
bJYNote = true;
|
||
strJYRoom = drr["check_room"].ToString();
|
||
}
|
||
if (drrr["team_name"].ToString().Contains("大便"))
|
||
{
|
||
bDBNote = true;
|
||
strDBRoom = drr["check_room"].ToString();
|
||
}
|
||
}
|
||
dr1["qx"] += strTeamNames.Substring(0, strTeamNames.Length - 1);
|
||
qxdt.Rows.Add(dr1);
|
||
}
|
||
}
|
||
if (bNYNote)
|
||
{
|
||
re.SetParameterValue("bNYNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bNYNote", "no");
|
||
}
|
||
if (bJYNote)
|
||
{
|
||
re.SetParameterValue("bJYNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bJYNote", "no");
|
||
}
|
||
if (bDBNote)
|
||
{
|
||
re.SetParameterValue("bDBNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bDBNote", "no");
|
||
}
|
||
if (bDBNote || bJYNote || bNYNote)
|
||
{
|
||
re.SetParameterValue("bNote", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("bNote", "no");
|
||
}
|
||
re.SetParameterValue("strNYRoom", strNYRoom);
|
||
re.SetParameterValue("strJYRoom", strJYRoom);
|
||
re.SetParameterValue("strDBRoom", strDBRoom);
|
||
|
||
DataView dv = qxdt.DefaultView;
|
||
DataTable distTable = dv.ToTable("Dist", true, "qx");
|
||
re.RegisterData(distTable, "qxdt");
|
||
try
|
||
{
|
||
jsonBjxm = wc.DownloadString(extend.URL + "/Registration/GettjxmByIDsReport/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
DataTable bjxm = new DataTable();
|
||
DataTable tjxmdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonBjxm);
|
||
|
||
|
||
bjxm.Columns.Add("bjxm");
|
||
|
||
foreach (DataRow daraRow in tjxmdt.Rows)
|
||
{
|
||
DataRow dr2 = bjxm.NewRow();
|
||
dr2["bjxm"] = daraRow["exam_group"].ToString();
|
||
bjxm.Rows.Add(dr2);
|
||
}
|
||
DataView dv1 = bjxm.DefaultView;
|
||
DataTable distTable1 = dv1.ToTable("Dist", true, "bjxm");
|
||
string g = "";
|
||
foreach (DataRow daraRow in distTable1.Rows)
|
||
{
|
||
g += daraRow["bjxm"] + ",";
|
||
}
|
||
DataTable dt3 = new DataTable();
|
||
dt3.Columns.Add("bjxm");
|
||
DataRow tt = dt3.NewRow();
|
||
tt["bjxm"] = g;
|
||
dt3.Rows.Add(tt);
|
||
re.RegisterData(dt3, "bjxmdt");
|
||
//说明------
|
||
DataTable smdt = new DataTable();
|
||
smdt.Columns.Add("sm");
|
||
DataRow dr = smdt.NewRow();
|
||
|
||
if (dt.Rows[0]["exam_type"].ToString().IndexOf("特种", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr["sm"] = "体检项目完成后请回到二楼职业卫生科(206)领取《特种作业健康检查表》。";
|
||
}
|
||
else if (dt.Rows[0]["exam_type"].ToString().IndexOf("常规", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr["sm"] = "1、请当天下午4点后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
|
||
"检查表》。\r\n2、请在空腹状态下接受肝功能检查;孕妇接受透视或拍片时请事先告知医生;抽血后用棉签按压穿刺处3-5分钟。";
|
||
}
|
||
else if (dt.Rows[0]["exam_type"].ToString().IndexOf("机动", StringComparison.Ordinal) > -1)
|
||
{
|
||
dr["sm"] = "1、请体检结束后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
|
||
"检查表》。";
|
||
}
|
||
else
|
||
{
|
||
dr["sm"] = "1、请当天下午4点后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
|
||
"检查表》。\r\n2、请在空腹状态下接受肝功能和B超检查;孕妇接受透视或拍片时请事先告知医生;抽血后用棉签按压穿刺处3-5分钟。";
|
||
}
|
||
|
||
smdt.Rows.Add(dr);
|
||
re.SetParameterValue("examtype", dt.Rows[0]["exam_type"].ToString());
|
||
re.SetParameterValue("agreement_money", dt.Rows[0]["agreement_money"]);
|
||
re.RegisterData(smdt, "smdt");
|
||
DataTable zydtop = new DataTable();
|
||
zydtop.Columns.Add("zyd");
|
||
DataRow dr6 = zydtop.NewRow();
|
||
dr6["zyd"] = dt.Rows[0]["exam_type"] + "指引单";
|
||
zydtop.Rows.Add(dr6);
|
||
re.RegisterData(zydtop, "zydtop");
|
||
DataTable imagedt = new DataTable();
|
||
imagedt.Columns.Add("image", typeof(byte[]));
|
||
DataRow d = imagedt.NewRow();
|
||
d["image"] = Convert.FromBase64String(dt.Rows[0]["phone_path"].ToString());
|
||
imagedt.Rows.Add(d);
|
||
re.RegisterData(imagedt, "imagedt");
|
||
re.PrintSettings.ShowDialog = false;
|
||
if (!string.IsNullOrEmpty(pos_dyj))
|
||
re.PrintSettings.Printer = pos_dyj;
|
||
|
||
//---------输出为图片,测试用-------------
|
||
FastReport.Export.Image.ImageExport ie = new FastReport.Export.Image.ImageExport();
|
||
ie.ImageFormat = FastReport.Export.Image.ImageExportFormat.Bmp;
|
||
re.Prepare();
|
||
string bago = Application.StartupPath + "\\zyzyd\\";
|
||
Log.WriteLogToTxt("bagopath:" + bago);
|
||
if (!Directory.Exists(bago))
|
||
{
|
||
Directory.CreateDirectory(bago);
|
||
}
|
||
bago += DateTime.Now.ToString("yyyyMMddHHmmss") + ".bmp";
|
||
if (File.Exists(bago))
|
||
File.Delete(bago);
|
||
//导出为bmp图片
|
||
re.Export(ie, bago);
|
||
//----------------------
|
||
|
||
|
||
re.Print();
|
||
|
||
//更新状态为"打印指引单"
|
||
wc.DownloadString(extend.URL + "zzj/updateProcedureStatus?physical_num=" + physical_num);
|
||
|
||
|
||
//打印条码
|
||
string tmprint = System.Configuration.ConfigurationManager.AppSettings["tmprint"];
|
||
wc.Encoding = System.Text.Encoding.UTF8;
|
||
|
||
//zyk 20231111
|
||
#region 因性能问题 不再动态查询,直接打印三张条码
|
||
DataTable dtTm = new DataTable();
|
||
dtTm.Columns.Add("xm");
|
||
dtTm.Columns.Add("tm");
|
||
dtTm.Columns.Add("xmtm");
|
||
dtTm.Columns.Add("tz");
|
||
for (int i = 0; i < 3; i++)
|
||
{
|
||
DataRow drBarcode = dtTm.NewRow();
|
||
drBarcode["tm"] = physical_num;
|
||
drBarcode["xm"] = UserName;
|
||
dtTm.Rows.Add(drBarcode);
|
||
}
|
||
#endregion
|
||
|
||
#region MyRegion
|
||
//try
|
||
//{
|
||
// jsonData = wc.DownloadString(extend.URL + "professional/getTMByphysical_num/" + physical_num);
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// MessageBox.Show(ex.Message);
|
||
// return;
|
||
//}
|
||
|
||
//dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
|
||
//if (dt.Rows.Count == 0)
|
||
// return;
|
||
//if (dt.Rows.Count % 2 == 1)
|
||
//{
|
||
// //没看明白…… 可能目的是补一个空行,用于排版效果……
|
||
// var row = dt.NewRow();
|
||
// dt.Rows.Add(row);
|
||
//}
|
||
////是否根据分组打印
|
||
//bool bBarcodeByGroup = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["BarcodeByGroup"]);
|
||
////只打印姓名、体检号physical_num
|
||
//if (!bBarcodeByGroup)
|
||
//{
|
||
// string strName = dt.Rows[0]["xm"].ToString();
|
||
// for (int i = dt.Rows.Count - 1; i >= 0; i--)
|
||
// {
|
||
// dt.Rows.RemoveAt(i);
|
||
// }
|
||
// int count = 2;
|
||
// //根据体检编号获取体检项目中是否包含"生化、血常规、尿常规"检查
|
||
// string strSpecialconf = wc.DownloadString(extend.URL + "professional/getSpecialconf?physical_num=" + physical_num);
|
||
// //若"生化、血常规、尿常规"都存在,则设置count为3,打印三张条码
|
||
// if (Convert.ToInt32(strSpecialconf) == 3)
|
||
// {
|
||
// count = 3;
|
||
// }
|
||
// for (int i = 0; i < count; i++)
|
||
// {
|
||
// DataRow drBarcode = dt.NewRow();
|
||
// drBarcode["tm"] = physical_num;
|
||
// drBarcode["xm"] = strName;
|
||
// dt.Rows.Add(drBarcode);
|
||
// }
|
||
//}
|
||
#endregion
|
||
|
||
//zyk 20231122 临时注释掉打印条码功能,后续需开启
|
||
re = new FastReport.Report();
|
||
re.Load(Application.StartupPath + "\\report\\barcode.frx");
|
||
//re.RegisterData(dt, "barcode");
|
||
re.RegisterData(dtTm, "barcode");
|
||
re.PrintSettings.ShowDialog = false;
|
||
//MessageBox.Show(_tm_dyj);
|
||
if (!string.IsNullOrEmpty(tmprint))
|
||
re.PrintSettings.Printer = tmprint;
|
||
re.Print();
|
||
|
||
ss.update("打印成功!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
ss.Close();
|
||
}
|
||
else
|
||
{
|
||
ss.update("没有找到您的登记信息!");
|
||
Application.DoEvents();
|
||
Thread.Sleep(2000);
|
||
ss.Close();
|
||
//this.Close();
|
||
}
|
||
if (ss != null && !ss.IsDisposed)
|
||
{
|
||
ss.Close();
|
||
}
|
||
#endregion
|
||
}
|
||
while (false);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Status s = new Status("提示:" + ex.Message);
|
||
CYQ.Data.Log.WriteLogToTxt(ex.StackTrace.ToString() + ex.Message);
|
||
s.ShowDialog();
|
||
}
|
||
finally
|
||
{
|
||
if (ss != null && !ss.IsDisposed)
|
||
{
|
||
ss.Close();
|
||
}
|
||
timer1.Enabled = true;
|
||
}
|
||
|
||
timer1.Enabled = true;
|
||
n = DateTime.Now;
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + "完成一次查询!");
|
||
}
|
||
int dj = 10;
|
||
private void frm_main3_Load(object sender, EventArgs e)
|
||
{
|
||
eSet.ReportSettings.ShowProgress = false;
|
||
foreach (var s in Screen.AllScreens)
|
||
{
|
||
if (!s.Primary)
|
||
{
|
||
var fs = new frm_video();
|
||
Point mf = new Point();
|
||
mf = s.Bounds.Location;
|
||
fs.Location = mf;
|
||
fs.TopLevel = true;
|
||
fs.TopMost = true;
|
||
//fs.ksname = ksname;
|
||
fs.Owner = this;
|
||
fs.WindowState = FormWindowState.Maximized;
|
||
fs.StartPosition = FormStartPosition.Manual;
|
||
fs.Show();
|
||
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
Status ms = new Status();
|
||
private void timer2_Tick(object sender, EventArgs e)
|
||
{
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + ":" + (DateTime.Now - n).TotalMinutes);
|
||
if ((DateTime.Now - n).TotalMinutes > 1)
|
||
{
|
||
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(DateTime.Now.ToString() + ":" + (DateTime.Now - n).TotalMinutes);
|
||
Application.Restart();
|
||
}
|
||
|
||
|
||
}
|
||
|
||
private void frm_main3_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.D1 && e.Modifiers == Keys.Control) //Ctrl+1
|
||
{
|
||
this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
||
}
|
||
else if (e.KeyCode == Keys.D2 && e.Modifiers == Keys.Control) //Ctrl+2
|
||
{
|
||
this.FormBorderStyle = FormBorderStyle.None;
|
||
}
|
||
else if (e.KeyCode == Keys.D3 && e.Modifiers == Keys.Control) //Ctrl+2
|
||
{
|
||
this.ifInputByCard = 0;
|
||
this.textBox1.Visible = true;
|
||
this.textBox1.Text = "";
|
||
}
|
||
else if (e.KeyCode == Keys.D4 && e.Modifiers == Keys.Control) //Ctrl+2
|
||
{
|
||
this.ifInputByCard = 1;
|
||
this.textBox1.Visible = false;
|
||
this.textBox1.Text = "";
|
||
}
|
||
Application.DoEvents();
|
||
}
|
||
|
||
int click_count_left = 0;
|
||
int click_count_right = 0;
|
||
private void frm_main3_MouseClick(object sender, MouseEventArgs e)
|
||
{
|
||
if (e.Button == MouseButtons.Left)
|
||
{
|
||
click_count_left++;
|
||
|
||
}
|
||
if (e.Button == MouseButtons.Right)
|
||
{
|
||
click_count_right++;
|
||
|
||
}
|
||
//如果2s内鼠标右击计数达6次,则退出系统
|
||
if (click_count_right >= 6)//&& click_count_right >=3)
|
||
{
|
||
Application.Exit();
|
||
}
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
if (textBox1.Text.Trim().Length == 18)
|
||
{
|
||
this.ifInputByCard = 0;
|
||
this.button1.Visible = false;
|
||
|
||
//关闭软键盘
|
||
HideOnScreenKeyboard2();
|
||
|
||
}
|
||
}
|
||
|
||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (textBox1.Text.Trim().Length == 18)
|
||
{
|
||
this.button1.Visible = true;
|
||
}
|
||
}
|
||
|
||
//打开软键盘
|
||
public static void ShowOnScreenkeyboard()
|
||
{
|
||
try
|
||
{
|
||
ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe");
|
||
Process.Start(startInfo);
|
||
}
|
||
catch { }
|
||
}
|
||
//关闭软键盘
|
||
public static void HideOnScreenKeyboard()
|
||
{
|
||
try
|
||
{
|
||
Process[] oskProcessArray = Process.GetProcessesByName("TabTip");
|
||
foreach (Process process in oskProcessArray)
|
||
{
|
||
process.Kill();
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
}
|
||
//打开软键盘
|
||
public static void ShowOnScreenkeyboard2()
|
||
{
|
||
try
|
||
{
|
||
//ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Windows\sysnative\osk.exe");
|
||
//Process.Start(startInfo);
|
||
Process.Start(@"osk.exe");
|
||
}
|
||
catch { }
|
||
}
|
||
//关闭软键盘
|
||
public static void HideOnScreenKeyboard2()
|
||
{
|
||
try
|
||
{
|
||
Process[] oskProcessArray = Process.GetProcessesByName("osk");
|
||
foreach (Process process in oskProcessArray)
|
||
{
|
||
process.Kill();
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
}
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
HideOnScreenKeyboard2();
|
||
Thread.Sleep(300);
|
||
ShowOnScreenkeyboard2();
|
||
|
||
this.textBox1.Focus();
|
||
}
|
||
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
HideOnScreenKeyboard2();
|
||
}
|
||
}
|
||
}
|