2318 lines
96 KiB
C#
2318 lines
96 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Windows.Forms;
|
||
using SOH.Kernel;
|
||
using EAS.Services;
|
||
using SOH.BLL;
|
||
using SOH.Entities;
|
||
using SOH.Data;
|
||
using SOH.Common;
|
||
using System.Text.RegularExpressions;
|
||
using FastReport;
|
||
using FastReport.Data;
|
||
using FastReport.Design;
|
||
using EAS;
|
||
using SOH.Entities.DTO;
|
||
using System.Collections;
|
||
using FastReport.Export.Pdf;
|
||
using System.IO;
|
||
using System.Drawing.Imaging;
|
||
|
||
namespace SOH.KeFu
|
||
{
|
||
public partial class frmShowBaoGao : Form
|
||
{
|
||
string tm = "";
|
||
int mb = 0;
|
||
DataTable dtnew = new DataTable();
|
||
DataTable dtnew2 = new DataTable();
|
||
public bool showview = false;
|
||
public frmShowBaoGao()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
public frmShowBaoGao(string tmh)
|
||
{
|
||
tm = tmh;
|
||
InitializeComponent();
|
||
}
|
||
|
||
public frmShowBaoGao(string tmh, int mbh)
|
||
{
|
||
tm = tmh;
|
||
mb = mbh;
|
||
InitializeComponent();
|
||
}
|
||
|
||
string bj = "";
|
||
string title = "";
|
||
string sjh = "";
|
||
string sfzh = "";
|
||
short cjfw = 0;
|
||
string bmbm = "";
|
||
string xm = "";
|
||
string hfbz = "";
|
||
|
||
DataTable dt = new DataTable();
|
||
|
||
public FastReport.Report re = new FastReport.Report();
|
||
private void frmShowBaoGao_Load(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
public void init(string tms, int mbhs)
|
||
{
|
||
int fddm = Convert.ToInt32(LoginUser.yydm);
|
||
int xb = 0;
|
||
string pahzbj = "0";
|
||
//var gr = db.t_grgzbs.FirstOrDefault(t => t.tm == itm);
|
||
//var tt = db.t_ttgzbs.FirstOrDefault(t => t.tm == itm);
|
||
|
||
this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
|
||
this.WindowState = FormWindowState.Maximized;
|
||
|
||
switch (mbhs)
|
||
{
|
||
case 0:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\tjbg.frx");
|
||
break;
|
||
case 1:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\tjbg1.frx");
|
||
break;
|
||
case 2:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\tjbg2.frx");
|
||
break;
|
||
case 3:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\tjbg3.frx");
|
||
break;
|
||
case 4:
|
||
var vser = ServiceContainer.GetService<IZongJian>();
|
||
var gzb = vser.getGzbByTms(int.Parse(tms));
|
||
if (gzb == null)
|
||
{
|
||
MessageBox.Show(tms + "当前条码无效!");
|
||
return;
|
||
}
|
||
DataTable jydDt = vser.GetJydDtByTmFromKSbm(gzb.tm);
|
||
|
||
if (jydDt.Rows.Count != 0)
|
||
{
|
||
foreach (DataRow dr in jydDt.Rows)
|
||
{
|
||
//DataTable jgDt = vser.GetJyjgByTm(dr["jytm"].ToString());
|
||
//DataTable jgDt = vser.GetJyjgByTmFromZhxm(gzb.tm, dr["zhbm"].ToString());
|
||
DataTable jgDt = vser.GetJyjgByTmFromKSbm2(gzb.tm, dr["ksbm"].ToString(), gzb.xb);
|
||
|
||
if (jgDt.Rows.Count == 0)
|
||
{
|
||
MessageBox.Show(tms + "当前条码号检验结果为空!");
|
||
return;
|
||
}
|
||
|
||
foreach (DataRow dr1 in jgDt.Rows)
|
||
{
|
||
double jg = 0;
|
||
double cksx = 0;
|
||
double ckxx = 0;
|
||
if (double.TryParse(dr1["jg"].ToString(), out jg) && double.TryParse(dr1["cksx"].ToString(), out cksx) && double.TryParse(dr1["ckxx"].ToString(), out ckxx))
|
||
{
|
||
if (jg < ckxx)
|
||
dr1["bz"] = "↓";
|
||
else if (jg > cksx)
|
||
dr1["bz"] = "↑";
|
||
}
|
||
}
|
||
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\hyxmzyd3.frx");
|
||
//re.RegisterData(jgDt, "jy_sqd_jg");
|
||
re.RegisterData(jgDt, "Table");
|
||
re.SetParameterValue("tmh", gzb.tm);
|
||
re.SetParameterValue("xm", gzb.xm);
|
||
re.SetParameterValue("xb", gzb.xb);
|
||
re.SetParameterValue("nl", gzb.nl);
|
||
re.SetParameterValue("hyh", gzb.hyh);
|
||
re.SetParameterValue("dwmc", gzb.dwmc);
|
||
re.SetParameterValue("tjrq", gzb.tjrq);
|
||
|
||
|
||
if (LoginUser.yydm.Equals("1"))
|
||
{
|
||
re.SetParameterValue("name", "德州");
|
||
re.SetParameterValue("dh", "三八东路鑫星国际大厦三楼");
|
||
re.SetParameterValue("dz", "0534-7052967");
|
||
}
|
||
else if (LoginUser.yydm.Equals("2"))
|
||
{
|
||
re.SetParameterValue("name", "淄博");
|
||
re.SetParameterValue("dh", "0533-7997555");
|
||
re.SetParameterValue("dz", "鲁泰大道99号汇金大厦西裙楼三楼");
|
||
|
||
string lsdt = vser.GetZjysXm2(jgDt.Rows[0][0].ToString());
|
||
dtnew = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt, typeof(DataTable)) as DataTable;
|
||
|
||
if (dtnew.Rows.Count == 0)
|
||
{
|
||
lsdt = vser.GetZjysXm(jgDt.Rows[0][0].ToString());
|
||
dtnew = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt, typeof(DataTable)) as DataTable;
|
||
}
|
||
|
||
dtnew.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
foreach (DataRow drnew in dtnew.Rows)
|
||
{
|
||
if (drnew["image1"].ToString() == "")
|
||
{
|
||
string zdys = drnew["xm"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
drnew["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(drnew["image1"].ToString());
|
||
drnew["image"] = bs;
|
||
}
|
||
}
|
||
|
||
|
||
string lsdt2 = vser.GetZjysXm3("trdwj");
|
||
dtnew2 = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt2, typeof(DataTable)) as DataTable;
|
||
|
||
dtnew2.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
foreach (DataRow drnew2 in dtnew2.Rows)
|
||
{
|
||
if (drnew2["image1"].ToString() == "")
|
||
{
|
||
string zdys = drnew2["xm"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
drnew2["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(drnew2["image1"].ToString());
|
||
drnew2["image"] = bs;
|
||
}
|
||
}
|
||
|
||
re.RegisterData(dtnew, "hzfxImage");
|
||
re.RegisterData(dtnew2, "hzfxImage2");
|
||
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("name", "");
|
||
re.SetParameterValue("dh", "");
|
||
re.SetParameterValue("dz", "");
|
||
}
|
||
|
||
|
||
re.SetParameterValue("dyry", LoginUser.xm);
|
||
re.Preview = previewControl1;
|
||
print();
|
||
}
|
||
|
||
}
|
||
break;
|
||
case 5:
|
||
var vser1 = ServiceContainer.GetService<IZongJian>();
|
||
var gzb1 = vser1.getGzbByTms(int.Parse(tms));
|
||
if (gzb1 == null)
|
||
{
|
||
MessageBox.Show(tms + "当前条码无效!");
|
||
return;
|
||
}
|
||
DataTable jydDt1 = vser1.GetJydDtByTmFromKSbm(gzb1.tm);
|
||
|
||
if (jydDt1.Rows.Count != 0)
|
||
{
|
||
foreach (DataRow dr in jydDt1.Rows)
|
||
{
|
||
//DataTable jgDt = vser.GetJyjgByTm(dr["jytm"].ToString());
|
||
//DataTable jgDt = vser.GetJyjgByTmFromZhxm(gzb.tm, dr["zhbm"].ToString());
|
||
DataTable jgDt1 = vser1.GetJyjgByTmFromKSbm2(gzb1.tm, dr["ksbm"].ToString(),gzb1.xb);
|
||
|
||
if (jgDt1.Rows.Count == 0)
|
||
{
|
||
MessageBox.Show(tms + "当前条码号检验结果为空!");
|
||
return;
|
||
}
|
||
|
||
foreach (DataRow dr1 in jgDt1.Rows)
|
||
{
|
||
double jg = 0;
|
||
double cksx = 0;
|
||
double ckxx = 0;
|
||
if (double.TryParse(dr1["jg"].ToString(), out jg) && double.TryParse(dr1["cksx"].ToString(), out cksx) && double.TryParse(dr1["ckxx"].ToString(), out ckxx))
|
||
{
|
||
if (jg < ckxx)
|
||
dr1["bz"] = "↓";
|
||
else if (jg > cksx)
|
||
dr1["bz"] = "↑";
|
||
}
|
||
}
|
||
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\hyxmzyd3.frx");
|
||
//re.RegisterData(jgDt, "jy_sqd_jg");
|
||
re.RegisterData(jgDt1, "Table");
|
||
re.SetParameterValue("tmh", gzb1.tm);
|
||
re.SetParameterValue("xm", gzb1.xm);
|
||
re.SetParameterValue("xb", gzb1.xb);
|
||
re.SetParameterValue("nl", gzb1.nl);
|
||
re.SetParameterValue("hyh", gzb1.hyh);
|
||
re.SetParameterValue("dwmc", gzb1.dwmc);
|
||
re.SetParameterValue("tjrq", gzb1.tjrq);
|
||
|
||
if (LoginUser.yydm.Equals("1"))
|
||
{
|
||
re.SetParameterValue("name", "德州");
|
||
re.SetParameterValue("dh", "三八东路鑫星国际大厦三楼");
|
||
re.SetParameterValue("dz", "0534-7052967");
|
||
}
|
||
else if (LoginUser.yydm.Equals("2"))
|
||
{
|
||
re.SetParameterValue("name", "淄博");
|
||
re.SetParameterValue("dh", "0533-7997555");
|
||
re.SetParameterValue("dz", "鲁泰大道99号汇金大厦西裙楼三楼");
|
||
|
||
string lsdt = vser1.GetZjysXm2(jgDt1.Rows[0][0].ToString());
|
||
dtnew = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt, typeof(DataTable)) as DataTable;
|
||
|
||
if (dtnew.Rows.Count == 0)
|
||
{
|
||
lsdt = vser1.GetZjysXm(jgDt1.Rows[0][0].ToString());
|
||
dtnew = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt, typeof(DataTable)) as DataTable;
|
||
}
|
||
|
||
dtnew.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
foreach (DataRow drnew in dtnew.Rows)
|
||
{
|
||
if (drnew["image1"].ToString() == "")
|
||
{
|
||
string zdys = drnew["xm"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
drnew["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(drnew["image1"].ToString());
|
||
drnew["image"] = bs;
|
||
}
|
||
}
|
||
|
||
|
||
string lsdt2 = vser1.GetZjysXm3("trdwj");
|
||
dtnew2 = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt2, typeof(DataTable)) as DataTable;
|
||
|
||
dtnew2.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
foreach (DataRow drnew2 in dtnew2.Rows)
|
||
{
|
||
if (drnew2["image1"].ToString() == "")
|
||
{
|
||
string zdys = drnew2["xm"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
drnew2["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(drnew2["image1"].ToString());
|
||
drnew2["image"] = bs;
|
||
}
|
||
}
|
||
|
||
re.RegisterData(dtnew, "hzfxImage");
|
||
re.RegisterData(dtnew2, "hzfxImage2");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("name", "");
|
||
re.SetParameterValue("dh", "");
|
||
re.SetParameterValue("dz", "");
|
||
}
|
||
|
||
|
||
re.SetParameterValue("dyry", LoginUser.xm);
|
||
re.Preview = previewControl1;
|
||
//print();
|
||
}
|
||
|
||
}
|
||
break;
|
||
case 6:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\zbcc_tjbg.frx");
|
||
break;
|
||
case 7:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\tjbg.frx");
|
||
pahzbj = "1";
|
||
break;
|
||
default:
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\tjbg.frx");
|
||
break;
|
||
}
|
||
|
||
|
||
DataTable ccdt = new DataTable();
|
||
ccdt.Columns.Add("bt", typeof(string));
|
||
ccdt.Columns.Add("sj", typeof(string));
|
||
ccdt.Columns.Add("jg", typeof(string));
|
||
ccdt.Columns.Add("img", typeof(byte[]));
|
||
ccdt.Columns.Add("ksbm", typeof(string));
|
||
var ccbg = ServiceContainer.GetService<It_tempdjxm>();
|
||
List<t_ccbg> ccbgs = ccbg.getCCBG(0, tms);
|
||
var vkssver = ServiceContainer.GetService<It_ks>();
|
||
List<keshi> ccks = vkssver.getccks();
|
||
string grgzbString = ServiceContainer.GetService<It_grgzb>().GetGrgzbListByTm(int.Parse(tms.Trim()));
|
||
string ttgzbString = ServiceContainer.GetService<It_ttgzb>().GetTtgzbListByTm(int.Parse(tms.Trim()));
|
||
|
||
int hyh = 0;
|
||
//创建个人report或者团体report
|
||
if (grgzbString.Length > 2)
|
||
{
|
||
bj = "个人体检";
|
||
title = "个检";
|
||
DataTable grgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(grgzbString, typeof(DataTable)) as DataTable;
|
||
sjh = grgzbDt.Rows[0]["dh"].ToString();
|
||
sfzh = grgzbDt.Rows[0]["sfzh"].ToString();
|
||
xm = grgzbDt.Rows[0]["xm"].ToString();
|
||
bmbm = "";
|
||
hfbz= grgzbDt.Rows[0]["hfbz"].ToString();
|
||
xb = Convert.ToInt32(grgzbDt.Rows[0]["xb"].ToString());
|
||
re.RegisterData(grgzbDt, "xxTable");
|
||
hyh = Convert.ToInt32(grgzbDt.Rows[0]["hyh"]);
|
||
}
|
||
else
|
||
{
|
||
DataTable ttgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ttgzbString, typeof(DataTable)) as DataTable;
|
||
try
|
||
{
|
||
title = ServiceContainer.GetService<IZongJian>().GetKhmcByHtbm(Convert.ToInt32(ttgzbDt.Rows[0]["htbm"]));
|
||
bj = ServiceContainer.GetService<IZongJian>().GetHtbjByHtbm(Convert.ToInt32(ttgzbDt.Rows[0]["htbm"]));
|
||
cjfw = ServiceContainer.GetService<IZongJian>().GetcjfwByHtbm(Convert.ToInt32(ttgzbDt.Rows[0]["htbm"]));
|
||
if (cjfw != 0)
|
||
{
|
||
bj = "";
|
||
title = "";
|
||
}
|
||
sjh = ttgzbDt.Rows[0]["tel"].ToString();
|
||
sfzh = ttgzbDt.Rows[0]["sfzh"].ToString();
|
||
xm = ttgzbDt.Rows[0]["xm"].ToString();
|
||
hfbz = pahzbj;
|
||
bmbm = ttgzbDt.Rows[0]["ssbm"].ToString();
|
||
xb = Convert.ToInt32(ttgzbDt.Rows[0]["xb"].ToString());
|
||
re.RegisterData(ttgzbDt, "xxTable");
|
||
hyh = Convert.ToInt32(ttgzbDt.Rows[0]["hyh"]);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
throw ex;
|
||
}
|
||
|
||
}
|
||
|
||
re.SetParameterValue("bj", bj);
|
||
re.SetParameterValue("title", title);
|
||
re.SetParameterValue("sjh", sjh);
|
||
re.SetParameterValue("sfzh", sfzh);
|
||
re.SetParameterValue("bmbm", bmbm);
|
||
re.SetParameterValue("sfzhOn", hfbz);
|
||
//创建第一页体检套餐 参数
|
||
string getTcStr = ServiceContainer.GetService<It_ttgzb>().GetTtTcByTm(int.Parse(tms.Trim()));
|
||
DataTable tcDt = Newtonsoft.Json.JsonConvert.DeserializeObject(getTcStr, typeof(DataTable)) as DataTable;
|
||
if (tcDt.Rows.Count != 0)
|
||
{
|
||
re.SetParameterValue("tcmc", tcDt.Rows[0]["tcmc"].ToString().Trim());
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("tcmc", "");
|
||
}
|
||
|
||
if (fddm == 2)
|
||
{
|
||
//创建心电图报告
|
||
DataTable tjjdImageDt = ServiceContainer.GetService<It_tjjd>().getTjjdImage(Convert.ToInt32(tms.Trim()), 21);
|
||
if (tjjdImageDt.Rows.Count != 0&& tjjdImageDt.Rows[0]["image"].ToString().Length > 10)
|
||
{
|
||
re.RegisterData(tjjdImageDt, "xdtbgDt");
|
||
re.SetParameterValue("xdtImageOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("xdtImageOn", "no");
|
||
}
|
||
}
|
||
|
||
|
||
//创建汇总分析表datatable
|
||
string hzfxString = ServiceContainer.GetService<IZongJian>().GetHzfxByTm(int.Parse(tms.Trim()));
|
||
|
||
DataTable hzfxDt = Newtonsoft.Json.JsonConvert.DeserializeObject(hzfxString, typeof(DataTable)) as DataTable;
|
||
|
||
var vserver = ServiceContainer.GetService<IZongJian>();
|
||
|
||
if (hzfxDt.Rows.Count != 0)
|
||
{
|
||
string lsdt = vserver.GetZjysXm(hzfxDt.Rows[0][4].ToString());
|
||
dt = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt, typeof(DataTable)) as DataTable;
|
||
|
||
if(dt.Rows.Count == 0)
|
||
{
|
||
DataTable hzfxImage = new DataTable();
|
||
hzfxImage.Columns.Add("xm");
|
||
hzfxImage.Columns.Add("czym");
|
||
hzfxImage.Columns.Add("image");
|
||
re.RegisterData(hzfxImage, "hzfxImage");
|
||
}else
|
||
{
|
||
dt.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
if (dr["image1"].ToString() == "")
|
||
{
|
||
string zdys = dr["xm"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
dr["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(dr["image1"].ToString());
|
||
dr["image"] = bs;
|
||
}
|
||
}
|
||
|
||
//byte[] bs = Convert.FromBase64String(tjdr["image1"].ToString());
|
||
re.RegisterData(dt, "hzfxImage");
|
||
re.RegisterData(hzfxDt, "hzfxTable");
|
||
re.SetParameterValue("hzfxOn", "yes");
|
||
//查询总检医生中文名称,插入到参数里
|
||
|
||
|
||
re.SetParameterValue("zjys", dt.Rows[0][0].ToString());
|
||
re.SetParameterValue("zjysImage", dt.Rows[0][2].ToString());
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
/*re.RegisterData("", "hzfxImage");
|
||
re.RegisterData("", "hzfxTable");*/
|
||
DataTable hzfxImage = new DataTable();
|
||
hzfxImage.Columns.Add("xm");
|
||
hzfxImage.Columns.Add("czym");
|
||
hzfxImage.Columns.Add("image");
|
||
re.RegisterData(hzfxImage, "hzfxImage");
|
||
re.SetParameterValue("hzfxOn", "no");
|
||
re.SetParameterValue("zjys", "");
|
||
}
|
||
|
||
//创建体检汇总datatable
|
||
string tjhzString = ServiceContainer.GetService<IZongJian>().GetTjhzByTm(int.Parse(tms.Trim()), fddm);
|
||
DataTable tjhzDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjhzString, typeof(DataTable)) as DataTable;
|
||
int a = 1;
|
||
if (tjhzDt.Rows.Count != 0)
|
||
{
|
||
for (int i = 0; i < tjhzDt.Rows.Count; i++)
|
||
{
|
||
|
||
tjhzDt.Rows[i]["ksmc"] = a.ToString() + "、" + tjhzDt.Rows[i]["ksmc"].ToString() + ":";
|
||
a++;
|
||
}
|
||
re.RegisterData(tjhzDt, "tjhzTable");
|
||
re.SetParameterValue("tjhzOn", "yes");
|
||
|
||
string explainStr = ServiceContainer.GetService<IZongJian>().GetExplain(int.Parse(tms.Trim()), fddm);
|
||
if (explainStr.Length > 0)
|
||
{
|
||
re.SetParameterValue("explain", explainStr);
|
||
re.SetParameterValue("explainOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("explainOn", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
DataTable tjhzDt2 = new DataTable();
|
||
tjhzDt2.Columns.Add("ksmc");
|
||
tjhzDt2.Columns.Add("zdjg");
|
||
re.RegisterData(tjhzDt2, "tjhzTable");
|
||
re.SetParameterValue("tjhzOn", "no");
|
||
}
|
||
|
||
|
||
|
||
|
||
//查询健康指导
|
||
List<int> jbtjlist = vserver.GetJbtjListByTm(int.Parse(tms.Trim()));
|
||
if (jbtjlist.Count != 0)
|
||
{
|
||
DataTable jbkDt = new DataTable();
|
||
string jbks = vserver.GetJbkByJbbmToStr(jbtjlist.ToArray());
|
||
|
||
jbkDt = Newtonsoft.Json.JsonConvert.DeserializeObject(jbks, typeof(DataTable)) as DataTable;
|
||
|
||
//for (int i = 0; i < jbkDt.Rows.Count; i++)
|
||
//{
|
||
// if (jbkDt.Rows[i]["txnr"].ToString().Trim() == "")
|
||
// {
|
||
// jbkDt.Rows[i].Delete();
|
||
|
||
// }
|
||
//}
|
||
//jbkDt.AcceptChanges();
|
||
|
||
if (jbkDt.Rows.Count != 0)
|
||
{
|
||
|
||
re.RegisterData(jbkDt, "jbkDt");
|
||
|
||
re.SetParameterValue("notjbk", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("notjbk", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("notjbk", "no");
|
||
}
|
||
|
||
//创建非化验项目的体检诊断datatable
|
||
string tjjdString = ServiceContainer.GetService<IZongJian>().GetTjjdStringByTm(int.Parse(tms.Trim()));
|
||
|
||
DataTable tjjdDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjjdString, typeof(DataTable)) as DataTable;
|
||
tjjdDt.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
//tjjdDt.Columns.Add(new DataColumn("image1", typeof(byte[])));
|
||
foreach (DataRow tjdr in tjjdDt.Rows)
|
||
{
|
||
//if (tjdr["image2"].ToString() == "")
|
||
//{
|
||
// tjdr["image1"] = "";
|
||
//}
|
||
//else
|
||
//{
|
||
// byte[] bs = Convert.FromBase64String(tjdr["image2"].ToString());
|
||
// tjdr["image1"] = bs;
|
||
//}
|
||
|
||
#region 淄博CT二次审核,报告电子签名
|
||
if("王元玺".Equals(tjdr["czy"].ToString()))
|
||
{
|
||
if (tjdr["image2"].ToString() == "")
|
||
{
|
||
string zdys = "王德成/王元玺";
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
tjdr["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(tjdr["image2"].ToString());
|
||
tjdr["image"] = bs;
|
||
}
|
||
|
||
continue;
|
||
}
|
||
#endregion
|
||
|
||
if (tjdr["image1"].ToString() == "")
|
||
{
|
||
string zdys = tjdr["zdys"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
tjdr["image"] = stream.ToArray();
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(tjdr["image1"].ToString());
|
||
tjdr["image"] = bs;
|
||
}
|
||
}
|
||
//DataTable tjjdDt = ServiceContainer.GetService<IZongJian>().GetTjjdStringByTm2(int.Parse(tms.Trim()));
|
||
|
||
if (tjjdDt.Rows.Count != 0)
|
||
{
|
||
DataView dv = tjjdDt.DefaultView;
|
||
dv.Sort = "fxsx Asc";
|
||
DataTable tjjdDts = dv.ToTable();
|
||
|
||
#region
|
||
|
||
foreach (DataRow dr in tjjdDts.Rows)
|
||
{
|
||
int ks = int.Parse(dr["ksbm"].ToString());
|
||
if (ccbgs.Where(t => t.ksbm == ks).Any())
|
||
{
|
||
DataRow ccdr = ccdt.NewRow();
|
||
ccdr["jg"] = dr["zdjg"];
|
||
ccdr["ksbm"] = ks.ToString();
|
||
var k = ccks.Where(t => t.ksbm == ks).FirstOrDefault();
|
||
if (k != null)
|
||
{
|
||
ccdr["bt"] = k.bgbt;
|
||
}
|
||
Bitmap bm = new Bitmap(718, 425);
|
||
Graphics g = Graphics.FromImage(bm);
|
||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
|
||
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||
int w = 718;
|
||
int h = 425;
|
||
g.FillRectangle(Brushes.White, 0, 0, w, h);
|
||
var ccksbg = ccbgs.Where(t => t.ksbm == ks).ToList();
|
||
if (ccksbg.Count == 1)
|
||
{
|
||
MemoryStream ms = new MemoryStream(ccksbg[0].image);
|
||
Image img = Image.FromStream(ms);
|
||
float wb = 1.0f * img.Width / w;
|
||
float hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(0, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
}
|
||
else if (ccksbg.Count == 2)
|
||
{
|
||
MemoryStream ms = new MemoryStream(ccksbg[0].image);
|
||
Image img = Image.FromStream(ms);
|
||
w = w / 2 - 10;
|
||
float wb = 1.0f * img.Width / w;
|
||
float hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
ms = new MemoryStream(ccksbg[1].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5 + w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5 + w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
}
|
||
else if (ccksbg.Count == 3)
|
||
{
|
||
MemoryStream ms = new MemoryStream(ccksbg[0].image);
|
||
Image img = Image.FromStream(ms);
|
||
w = w / 2 - 10;
|
||
h = h / 2 - 10;
|
||
float wb = 1.0f * img.Width / w;
|
||
float hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
ms = new MemoryStream(ccksbg[1].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5 + w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5 + w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[2].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5 + w / 2, (h - vh) / 2 + h, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w / 2, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5 + w / 2, 0 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w / 2, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
}
|
||
else if (ccksbg.Count == 4)
|
||
{
|
||
MemoryStream ms = new MemoryStream(ccksbg[0].image);
|
||
Image img = Image.FromStream(ms);
|
||
w = w / 2 - 10;
|
||
h = h / 2 - 10;
|
||
float wb = 1.0f * img.Width / w;
|
||
float hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
ms = new MemoryStream(ccksbg[1].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(10 + w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 10 + w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[2].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2 + h + 5, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2 + h + 5);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 0 + h + 5, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2 + h + 5);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[3].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2 + h, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 10 + w, 0 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
}
|
||
else if (ccksbg.Count == 5)
|
||
{
|
||
MemoryStream ms = new MemoryStream(ccksbg[0].image);
|
||
Image img = Image.FromStream(ms);
|
||
w = w / 3 - 10;
|
||
h = h / 2 - 10;
|
||
float wb = 1.0f * img.Width / w;
|
||
float hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
ms = new MemoryStream(ccksbg[1].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(10 + w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 10 + w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[2].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(15 + 2 * w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 15 + 2 * w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 15 + 2 * w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 15 + 2 * w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[3].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5 + w / 2, (h - vh) / 2 + 5 + h, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w / 2, (h - img.Height) / 2 + 5 + h, w, h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5 + w / 2, 5 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5 + w / 2, (h - img.Height) / 2, w, h);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[4].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(10 + w + w / 2, (h - vh) / 2 + h + 5, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w + w / 2, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 10 + w + w / 2, 5 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w + w / 2, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
}
|
||
else if (ccksbg.Count == 6)
|
||
{
|
||
MemoryStream ms = new MemoryStream(ccksbg[0].image);
|
||
Image img = Image.FromStream(ms);
|
||
w = w / 3 - 10;
|
||
h = h / 2 - 10;
|
||
float wb = 1.0f * img.Width / w;
|
||
float hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
ms = new MemoryStream(ccksbg[1].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(10 + w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 10 + w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[2].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(15 + 2 * w, (h - vh) / 2, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 15 + 2 * w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 15 + 2 * w, 0, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 15 + 2 * w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[3].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(5, (h - vh) / 2 + 5 + h, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2 + 5 + h, w, h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 5, 5 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 5, (h - img.Height) / 2, w, h);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[4].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(10 + w, (h - vh) / 2 + h + 5, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 10 + w, 5 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 10 + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
ms = new MemoryStream(ccksbg[5].image);
|
||
img = Image.FromStream(ms);
|
||
//w = w / 2 - 10;
|
||
wb = 1.0f * img.Width / w;
|
||
hb = 1.0f * img.Height / h;
|
||
if (wb > hb)
|
||
{
|
||
if (wb > 1)
|
||
{
|
||
float vh = img.Height / wb;
|
||
|
||
g.DrawImage(img, new RectangleF(15 + w + w, (h - vh) / 2 + h + 5, w, vh));
|
||
}
|
||
else
|
||
{
|
||
|
||
g.DrawImage(img, (w - img.Width) / 2 + 15 + w + w, (h - img.Height) / 2 + h);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (hb > 1)
|
||
{
|
||
float vw = img.Width / hb;
|
||
|
||
g.DrawImage(img, new RectangleF((w - vw) / 2 + 15 + w + w, 5 + h, vw, h));
|
||
}
|
||
else
|
||
{
|
||
g.DrawImage(img, (w - img.Width) / 2 + 15 + w + w, (h - img.Height) / 2);
|
||
}
|
||
}
|
||
}
|
||
|
||
MemoryStream mso = new MemoryStream();
|
||
ImageCodecInfo myImageCodecInfo;
|
||
|
||
//获得JPEG格式的编码器
|
||
|
||
myImageCodecInfo = GetEncoderInfo("image/jpeg");
|
||
System.Drawing.Imaging.Encoder myEncoder;
|
||
|
||
EncoderParameter myEncoderParameter;
|
||
|
||
EncoderParameters myEncoderParameters;
|
||
|
||
// for the Quality parameter category.
|
||
|
||
myEncoder = System.Drawing.Imaging.Encoder.Quality;
|
||
|
||
// EncoderParameter object in the array.
|
||
|
||
myEncoderParameters = new EncoderParameters(1);
|
||
|
||
//设置质量 数字越大质量越好,但是到了一定程度质量就不会增加了,MSDN上没有给范围,只说是32为非负整数
|
||
|
||
myEncoderParameter = new EncoderParameter(myEncoder, 100L);
|
||
|
||
myEncoderParameters.Param[0] = myEncoderParameter;
|
||
bm.Save(mso, myImageCodecInfo, myEncoderParameters);
|
||
ccdr["img"] = mso.ToArray();
|
||
ccdt.Rows.Add(ccdr);
|
||
}
|
||
if (dr["djsj"].ToString().Length > 10)
|
||
{
|
||
dr["djsj"] = dr["djsj"].ToString().Substring(0, 10);
|
||
}
|
||
}
|
||
#endregion
|
||
re.RegisterData(tjjdDts, "tjjg");
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
//select '' as tm,'' as ksbm,'' as zdjg,'' as zdys,'' as czy,'' as czys,'' as ksmc,'' as bglk,'' as zdmc,'' as shsj,'' as djsj
|
||
DataTable tjjdDt2 = new DataTable();
|
||
tjjdDt2.Columns.Add("tm");
|
||
tjjdDt2.Columns.Add("ksbm");
|
||
tjjdDt2.Columns.Add("zdjg");
|
||
tjjdDt2.Columns.Add("zdys");
|
||
tjjdDt2.Columns.Add("czy");
|
||
tjjdDt2.Columns.Add("czys");
|
||
tjjdDt2.Columns.Add("ksmc");
|
||
tjjdDt2.Columns.Add("bglk");
|
||
tjjdDt2.Columns.Add("zdmc");
|
||
tjjdDt2.Columns.Add("shsj");
|
||
tjjdDt2.Columns.Add("djsj");
|
||
tjjdDt2.Columns.Add("fxsx");
|
||
tjjdDt2.Columns.Add("image");
|
||
re.RegisterData(tjjdDt2, "tjjg");
|
||
re.SetParameterValue("nothyxmOn", "no");
|
||
}
|
||
|
||
//创建化验项目的体检诊断datatable
|
||
string HytjjdString = ServiceContainer.GetService<IZongJian>().GetHyTjjdStringByTm(int.Parse(tms.Trim()), fddm);
|
||
|
||
DataTable HytjjdDt = Newtonsoft.Json.JsonConvert.DeserializeObject(HytjjdString, typeof(DataTable)) as DataTable;
|
||
|
||
HytjjdDt.Columns.Add(new DataColumn("image", typeof(byte[])));
|
||
HytjjdDt.Columns.Add(new DataColumn("imageZdys", typeof(byte[])));
|
||
foreach (DataRow hytjdr in HytjjdDt.Rows)
|
||
{
|
||
string imagezdys = ServiceContainer.GetService<IZongJian>().GetTjjdZdysStringByXm(hytjdr["zdys"].ToString()).ToString();
|
||
|
||
DataTable HytjjdZdysDt = Newtonsoft.Json.JsonConvert.DeserializeObject(imagezdys, typeof(DataTable)) as DataTable;
|
||
|
||
if (hytjdr["image1"].ToString() == "")
|
||
{
|
||
string zdys = hytjdr["zdys"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
hytjdr["image"] = stream.ToArray();
|
||
//byte[] bs2 = Convert.FromBase64String(ServiceContainer.GetService<IZongJian>().GetTjjdZdysStringByXm(hytjdr["zdys"].ToString()).ToString());
|
||
//hytjdr["image"] = bs2;
|
||
}
|
||
else
|
||
{
|
||
byte[] bs = Convert.FromBase64String(hytjdr["image1"].ToString());
|
||
hytjdr["image"] = bs;
|
||
}
|
||
|
||
|
||
|
||
if (HytjjdZdysDt.Rows.Count > 0)
|
||
{
|
||
if (!string.IsNullOrEmpty(HytjjdZdysDt.Rows[0]["imageZdys"].ToString()))
|
||
{
|
||
byte[] bs1 = Convert.FromBase64String(HytjjdZdysDt.Rows[0]["imageZdys"].ToString());
|
||
hytjdr["imageZdys"] = bs1;
|
||
|
||
}
|
||
else
|
||
{
|
||
string zdys = hytjdr["zdys"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
hytjdr["imageZdys"] = stream.ToArray();
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
string zdys = hytjdr["zdys"].ToString();
|
||
Bitmap b = new Bitmap(80, 20);
|
||
Graphics g = Graphics.FromImage(b);
|
||
g.Clear(Color.White);
|
||
|
||
g.DrawString(zdys, new Font("宋体", 12), new SolidBrush(Color.Black), new Point(2, 2));
|
||
|
||
MemoryStream stream = new MemoryStream();
|
||
b.Save(stream, ImageFormat.Jpeg);
|
||
//输出图片流
|
||
//return File(stream.ToArray(), "image/jpeg");
|
||
hytjdr["imageZdys"] = stream.ToArray();
|
||
}
|
||
|
||
}
|
||
|
||
if (HytjjdDt.Rows.Count != 0)
|
||
{
|
||
DataView dv1 = HytjjdDt.DefaultView;
|
||
dv1.Sort = "fxsx Asc";
|
||
DataTable HytjjdDts = dv1.ToTable();
|
||
|
||
foreach (DataRow dr in HytjjdDts.Rows)
|
||
{
|
||
|
||
if (dr["djsj"].ToString().Length > 10)
|
||
{
|
||
dr["djsj"] = dr["djsj"].ToString().Substring(0, 10);
|
||
}
|
||
}
|
||
re.RegisterData(HytjjdDts, "hytjjg");
|
||
re.SetParameterValue("hyxmOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
//select '' as tm,'' as ksbm,'' as zdjg,'' as zdys,'' as czy,'' as czys,'' as ksmc,'' as bglk,'' as zdmc,'' as djsj
|
||
DataTable HytjjdDt2 = new DataTable();
|
||
HytjjdDt2.Columns.Add("tm");
|
||
HytjjdDt2.Columns.Add("ksbm");
|
||
HytjjdDt2.Columns.Add("zdjg");
|
||
HytjjdDt2.Columns.Add("zdys");
|
||
HytjjdDt2.Columns.Add("czy");
|
||
HytjjdDt2.Columns.Add("czys");
|
||
HytjjdDt2.Columns.Add("ksmc");
|
||
HytjjdDt2.Columns.Add("bglk");
|
||
HytjjdDt2.Columns.Add("zdmc");
|
||
HytjjdDt2.Columns.Add("djsj");
|
||
HytjjdDt2.Columns.Add("fxsx");
|
||
HytjjdDt2.Columns.Add("image");
|
||
HytjjdDt2.Columns.Add("imageZdys");
|
||
re.RegisterData(HytjjdDt2, "hytjjg");
|
||
re.SetParameterValue("hyxmOn", "no");
|
||
}
|
||
|
||
//创建非化验项目的体检结果datatable
|
||
string tjjgString = ServiceContainer.GetService<IZongJian>().GetTjjgStringByTm(int.Parse(tms.Trim()),xb);
|
||
|
||
DataTable tjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjjgString, typeof(DataTable)) as DataTable;
|
||
|
||
if (ccdt.Rows.Count > 0)
|
||
{
|
||
re.SetParameterValue("ccImageOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("ccImageOn", "no");
|
||
}
|
||
|
||
if (tjjgDt.Rows.Count != 0)
|
||
{
|
||
DataView dv2 = tjjgDt.DefaultView;
|
||
|
||
if (mbhs == 1 || mbhs == 3)
|
||
{
|
||
dv2.RowFilter = "ksbm='10'";
|
||
}
|
||
|
||
dv2.Sort = "fxsx,xssx Asc";
|
||
DataTable tjjgDts = dv2.ToTable();
|
||
foreach (DataRow dr in tjjgDts.Rows)
|
||
{
|
||
#region 异常指标颜色修改逻辑
|
||
if (!string.IsNullOrEmpty(dr["jg"].ToString()))
|
||
{
|
||
if (!dr["cksx"].ToString().Trim().Equals("-1") && !dr["cksx"].ToString().Trim().Equals("-2"))
|
||
{
|
||
if (double.TryParse(dr["jg"].ToString().Trim(), out double result))
|
||
{
|
||
if (double.Parse(dr["ckxx"].ToString().Trim()) < double.Parse(dr["jg"].ToString().Trim()) &&
|
||
double.Parse(dr["cksx"].ToString().Trim()) > double.Parse(dr["jg"].ToString().Trim()))
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
dr["jg"] = dr["jg"].ToString() + "@";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (!dr["zcjg"].ToString().Trim().Equals(dr["jg"].ToString().Trim()))
|
||
{
|
||
dr["jg"] = dr["jg"].ToString() + "@";
|
||
}
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
if (!dr["cksx"].ToString().Trim().Equals("-2"))
|
||
{
|
||
if (!dr["zcjg"].ToString().Trim().Equals(dr["jg"].ToString().Trim()))
|
||
{
|
||
dr["jg"] = dr["jg"].ToString() + "@";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
DataRow[] drs = ccdt.Select("ksbm='" + dr["ksbm"].ToString() + "'");
|
||
if (drs.Count() > 0)
|
||
{
|
||
drs[0]["sj"] = drs[0]["sj"] + "\r\n" + dr["jg"].ToString();
|
||
}
|
||
}
|
||
re.RegisterData(tjjgDts, "tjjgmx");
|
||
|
||
if (mbhs != 2)
|
||
{
|
||
if (tjjgDts.Rows.Count != 0)
|
||
{
|
||
re.SetParameterValue("nothyxmOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("nothyxmOn", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("nothyxmOn", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//select '' as jcxmmc,'' as ksbm,'' as cksx,'' as ckxx,'' as dw,'' as jc,'' as dyckfw,'' as jg
|
||
DataTable tjjgDt2 = new DataTable();
|
||
tjjgDt2.Columns.Add("jcxmmc");
|
||
tjjgDt2.Columns.Add("ksbm");
|
||
tjjgDt2.Columns.Add("cksx");
|
||
tjjgDt2.Columns.Add("ckxx");
|
||
tjjgDt2.Columns.Add("dw");
|
||
tjjgDt2.Columns.Add("jc");
|
||
tjjgDt2.Columns.Add("dyckfw");
|
||
tjjgDt2.Columns.Add("jg");
|
||
tjjgDt2.Columns.Add("fxsx");
|
||
tjjgDt2.Columns.Add("xssx");
|
||
re.RegisterData(tjjgDt2, "tjjgmx");
|
||
re.SetParameterValue("nothyxmOn", "no");
|
||
}
|
||
re.RegisterData(ccdt, "ccbg");
|
||
|
||
//创建外送金域的体检结果datatable
|
||
string tjjgWSString = ServiceContainer.GetService<IZongJian>().GetTjjgWSStringByTm(int.Parse(tms.Trim()),xb);
|
||
|
||
DataTable tjjgWSDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjjgWSString, typeof(DataTable)) as DataTable;
|
||
|
||
|
||
if (tjjgWSDt.Rows.Count != 0)
|
||
{
|
||
DataView dvWS = tjjgWSDt.DefaultView;
|
||
|
||
if (mbhs == 1 || mbhs == 3)
|
||
{
|
||
dvWS.RowFilter = "ksbm='10'";
|
||
}
|
||
|
||
dvWS.Sort = "fxsx,xssx Asc";
|
||
DataTable tjjgWSDts = dvWS.ToTable();
|
||
//foreach (DataRow dr in tjjgWSDts.Rows)
|
||
//{
|
||
// DataRow[] drs = ccdt.Select("ksbm='" + dr["ksbm"].ToString() + "'");
|
||
// if (drs.Count() > 0)
|
||
// {
|
||
// drs[0]["sj"] = drs[0]["sj"] + "\r\n" + dr["jg"].ToString();
|
||
// }
|
||
//}
|
||
re.RegisterData(tjjgWSDts, "tjjgWSmx");
|
||
|
||
if (mbhs != 2)
|
||
{
|
||
if (tjjgWSDts.Rows.Count != 0)
|
||
{
|
||
re.SetParameterValue("notwsxmOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("notwsxmOn", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("notwsxmOn", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//select '' as jcxmmc,'' as ksbm,'' as cksx,'' as ckxx,'' as dw,'' as jc,'' as dyckfw,'' as jg
|
||
DataTable tjjgWSDt2 = new DataTable();
|
||
tjjgWSDt2.Columns.Add("jcxmmc");
|
||
tjjgWSDt2.Columns.Add("ksbm");
|
||
tjjgWSDt2.Columns.Add("cksx");
|
||
tjjgWSDt2.Columns.Add("ckxx");
|
||
tjjgWSDt2.Columns.Add("dw");
|
||
tjjgWSDt2.Columns.Add("jc");
|
||
tjjgWSDt2.Columns.Add("dyckfw");
|
||
tjjgWSDt2.Columns.Add("jg");
|
||
tjjgWSDt2.Columns.Add("fxsx");
|
||
tjjgWSDt2.Columns.Add("xssx");
|
||
re.RegisterData(tjjgWSDt2, "tjjgWSmx");
|
||
re.SetParameterValue("notwsxmOn", "no");
|
||
}
|
||
//re.RegisterData(ccdt, "ccbg");
|
||
|
||
//创建化验项目的体检结果datatable
|
||
string HytjjgString = ServiceContainer.GetService<IZongJian>().GetHyTjjgStringByTm(int.Parse(tms.Trim()), fddm,xb);
|
||
|
||
DataTable HytjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject(HytjjgString, typeof(DataTable)) as DataTable;
|
||
|
||
|
||
|
||
if (HytjjgDt.Rows.Count != 0)
|
||
{
|
||
DataView dv3 = HytjjgDt.DefaultView;
|
||
dv3.Sort = "fxsx,xssx Asc";
|
||
DataTable HytjjgDts = dv3.ToTable();
|
||
|
||
foreach (DataRow dr in HytjjgDts.Rows)
|
||
{
|
||
double jg = 0;
|
||
double cksx = 0;
|
||
double ckxx = 0;
|
||
if (double.TryParse(dr["jg"].ToString(), out jg) && double.TryParse(dr["cksx"].ToString(), out cksx) && double.TryParse(dr["ckxx"].ToString(), out ckxx))
|
||
{
|
||
if (jg < ckxx)
|
||
dr["bz"] = "↓";
|
||
else if (jg > cksx)
|
||
dr["bz"] = "↑";
|
||
}
|
||
}
|
||
re.RegisterData(HytjjgDts, "hytjjgmx");
|
||
}
|
||
else
|
||
{
|
||
HytjjgDt = new DataTable();
|
||
//select '' as jcxmmc,'' as ksbm,'' as cksx,'' as ckxx,'' as dw,'' as jc,'' as dyckfw,'' as jg
|
||
HytjjgDt.Columns.Add("jcxmmc");
|
||
HytjjgDt.Columns.Add("ksbm");
|
||
HytjjgDt.Columns.Add("cksx");
|
||
HytjjgDt.Columns.Add("ckxx");
|
||
HytjjgDt.Columns.Add("dw");
|
||
HytjjgDt.Columns.Add("jc");
|
||
HytjjgDt.Columns.Add("dyckfw");
|
||
HytjjgDt.Columns.Add("jg");
|
||
HytjjgDt.Columns.Add("bz");
|
||
HytjjgDt.Columns.Add("fxsx");
|
||
HytjjgDt.Columns.Add("xssx");
|
||
re.RegisterData(HytjjgDt, "hytjjgmx");
|
||
re.SetParameterValue("hyxmOn", "no");
|
||
}
|
||
|
||
//创建放弃表的datatable
|
||
string fqString = ServiceContainer.GetService<IZongJian>().GetFqStringByTm(int.Parse(tms.Trim()));
|
||
|
||
if (fqString.Length > 2)
|
||
{
|
||
DataTable fqDt = Newtonsoft.Json.JsonConvert.DeserializeObject(fqString, typeof(DataTable)) as DataTable;
|
||
re.RegisterData(fqDt, "fqTable");
|
||
re.SetParameterValue("fqOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
//re.RegisterData(fqDt, "fqTable");
|
||
re.SetParameterValue("fqOn", "no");
|
||
}
|
||
|
||
//创建历史结果对比
|
||
DataTable hisDt;
|
||
int[] array = (int[])ServiceContainer.GetService<IZongJian>().GetHisTmList(hyh);
|
||
if (array.Length > 1)
|
||
{
|
||
hisDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ServiceContainer.GetService<IZongJian>().GetHisTable(array), typeof(DataTable)) as DataTable;
|
||
if (hisDt.Rows.Count == 0)
|
||
{
|
||
hisDt = new DataTable();
|
||
hisDt.Columns.Add("ksmc");
|
||
hisDt.Columns.Add("kszd");
|
||
hisDt.Columns.Add("tjrq");
|
||
}
|
||
re.RegisterData(hisDt, "t_lndb");
|
||
if (fddm == 1)
|
||
{
|
||
re.SetParameterValue("hisfxOn", "no");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("hisfxOn", "yes");
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
if (sfzh != "")
|
||
{
|
||
int[] array1 = (int[])ServiceContainer.GetService<IZongJian>().GetHisTmListBySfz(sfzh, xm);
|
||
if (array1.Length > 1)
|
||
{
|
||
hisDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ServiceContainer.GetService<IZongJian>().GetHisTable(array1), typeof(DataTable)) as DataTable;
|
||
re.RegisterData(hisDt, "t_lndb");
|
||
if (fddm == 1)
|
||
{
|
||
re.SetParameterValue("hisfxOn", "no");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("hisfxOn", "yes");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
hisDt = new DataTable();
|
||
hisDt.Columns.Add("ksmc");
|
||
hisDt.Columns.Add("kszd");
|
||
hisDt.Columns.Add("tjrq");
|
||
re.RegisterData(hisDt, "t_lndb");
|
||
re.SetParameterValue("hisfxOn", "no");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
hisDt = new DataTable();
|
||
hisDt.Columns.Add("ksmc");
|
||
hisDt.Columns.Add("kszd");
|
||
hisDt.Columns.Add("tjrq");
|
||
re.RegisterData(hisDt, "t_lndb");
|
||
re.SetParameterValue("hisfxOn", "no");
|
||
}
|
||
|
||
}
|
||
|
||
re.Preview = previewControl1;
|
||
//re.Show();
|
||
}
|
||
ImageCodecInfo GetEncoderInfo(String mimeType)
|
||
|
||
{
|
||
int j;
|
||
ImageCodecInfo[] encoders;
|
||
encoders = ImageCodecInfo.GetImageEncoders();
|
||
for (j = 0; j < encoders.Length; ++j)
|
||
{
|
||
if (encoders[j].MimeType == mimeType)
|
||
return encoders[j];
|
||
}
|
||
return null;
|
||
}
|
||
public void daochu(string name)
|
||
{
|
||
if (previewControl1.Report == null)
|
||
{
|
||
//MessageBox.Show("请先初始化数据!");
|
||
return;
|
||
}
|
||
if (showview)
|
||
{
|
||
if (!this.Visible)
|
||
{
|
||
//this.Show();
|
||
//printpreview.Report.Show();
|
||
}
|
||
return;
|
||
}
|
||
previewControl1.Report.PrintSettings.ShowDialog = false;
|
||
//previewControl1.Report.Print();
|
||
|
||
previewControl1.Report.Prepare();
|
||
PDFExport pdf = new PDFExport();
|
||
//pdf.EmbeddingFonts = true;
|
||
if (Directory.Exists("d:\\pdf"))
|
||
{
|
||
previewControl1.Report.Export(pdf, @"d:\\pdf\" + name + ".pdf");
|
||
}
|
||
else
|
||
{
|
||
Directory.CreateDirectory(@"d:\\pdf");
|
||
previewControl1.Report.Export(pdf, @"d:\\pdf\" + name + ".pdf");
|
||
}
|
||
}
|
||
|
||
public string daochu2(string name)
|
||
{
|
||
if (previewControl1.Report == null)
|
||
{
|
||
//MessageBox.Show("请先初始化数据!");
|
||
return "";
|
||
}
|
||
if (showview)
|
||
{
|
||
if (!this.Visible)
|
||
{
|
||
//this.Show();
|
||
//printpreview.Report.Show();
|
||
}
|
||
return "";
|
||
}
|
||
previewControl1.Report.PrintSettings.ShowDialog = false;
|
||
//previewControl1.Report.Print();
|
||
|
||
var pfile = @"d:\\pdf\" + name + ".pdf";
|
||
|
||
previewControl1.Report.Prepare();
|
||
PDFExport pdf = new PDFExport();
|
||
//pdf.EmbeddingFonts = true;
|
||
if (Directory.Exists("d:\\pdf"))
|
||
{
|
||
previewControl1.Report.Export(pdf, pfile);
|
||
}
|
||
else
|
||
{
|
||
Directory.CreateDirectory(@"d:\\pdf");
|
||
previewControl1.Report.Export(pdf, @"d:\\pdf\" + name + ".pdf");
|
||
}
|
||
|
||
return pfile;
|
||
}
|
||
|
||
public void daochuImagePdf(string name)
|
||
{
|
||
if (previewControl1.Report == null)
|
||
{
|
||
//MessageBox.Show("请先初始化数据!");
|
||
return;
|
||
}
|
||
if (showview)
|
||
{
|
||
if (!this.Visible)
|
||
{
|
||
//this.Show();
|
||
//printpreview.Report.Show();
|
||
}
|
||
return;
|
||
}
|
||
previewControl1.Report.PrintSettings.ShowDialog = false;
|
||
//previewControl1.Report.Print();
|
||
|
||
int i = 1;
|
||
FastReport.Export.Image.ImageExport imgreport = new FastReport.Export.Image.ImageExport();
|
||
//FastReport.Export.Pdf.PDFExport pdfe = new FastReport.Export.Pdf.PDFExport();
|
||
//pdfe.PageRange = FastReport.PageRange.All;
|
||
|
||
imgreport.PageRange = FastReport.PageRange.All;
|
||
imgreport.ImageFormat = FastReport.Export.Image.ImageExportFormat.Jpeg;
|
||
imgreport.MultiFrameTiff = true;
|
||
imgreport.Resolution = 96;
|
||
imgreport.JpegQuality = 100;
|
||
string path = System.IO.Path.GetTempPath();
|
||
path += i + "\\";
|
||
if (!Directory.Exists(path))
|
||
{
|
||
Directory.CreateDirectory(path);
|
||
}
|
||
string dir = path;
|
||
previewControl1.Report.Prepare();
|
||
previewControl1.Report.Export(imgreport, path + "lsb.jpg");
|
||
i++;
|
||
|
||
var mylist = new List<string>();
|
||
int z = 0;
|
||
while (true)
|
||
{
|
||
++z;
|
||
if (z == 1)
|
||
{
|
||
path = dir + "lsb.jpg";
|
||
|
||
}
|
||
else
|
||
{
|
||
path = string.Format(dir + "lsb.{0}.jpg", z);
|
||
}
|
||
|
||
if (System.IO.File.Exists(path))
|
||
{
|
||
int h = 0;
|
||
while (true)
|
||
{
|
||
if (h > 10)
|
||
break;
|
||
h++;
|
||
try
|
||
{
|
||
mylist.Add(path);
|
||
//File.Delete(path);
|
||
break;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Console.WriteLine(ex.Message);
|
||
Console.WriteLine(ex.StackTrace);
|
||
EAS.Loggers.ILogger log1 = new EAS.Loggers.TextLogger();
|
||
log1.Info(ex.Message);
|
||
log1.Info(ex.StackTrace);
|
||
}
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
path = string.Format(dir + "lsb.{0}.jpg", z.ToString("00"));
|
||
if (System.IO.File.Exists(path))
|
||
{
|
||
int h = 0;
|
||
while (true)
|
||
{
|
||
if (h > 10)
|
||
break;
|
||
h++;
|
||
try
|
||
{
|
||
mylist.Add(path);
|
||
//File.Delete(path);
|
||
break;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Console.WriteLine(ex.Message);
|
||
Console.WriteLine(ex.StackTrace);
|
||
EAS.Loggers.ILogger log2 = new EAS.Loggers.TextLogger();
|
||
log2.Info(ex.Message);
|
||
log2.Info(ex.StackTrace);
|
||
}
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
iTextSharp.text.Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4);
|
||
var pfile = @"d:\\pdf\" + name + ".pdf";
|
||
var writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(pfile, FileMode.Create));
|
||
|
||
#region 设置PDF的头信息,一些属性设置,在Document.Open 之前完成
|
||
doc.AddAuthor("天瑞体检");
|
||
doc.AddCreationDate();
|
||
doc.AddCreator("天瑞体检");
|
||
doc.AddSubject(name);
|
||
doc.AddTitle(name);
|
||
//自定义头
|
||
#endregion
|
||
doc.Open();
|
||
|
||
foreach (var j in mylist)
|
||
{
|
||
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(j);
|
||
image.ScalePercent(72 / 96f * 100);
|
||
image.SetAbsolutePosition(0, 0);
|
||
|
||
doc.Add(image);
|
||
doc.NewPage();
|
||
File.Delete(j);
|
||
}
|
||
doc.Close();
|
||
//File(pfile, "application/pdf", bg.TaoCanMingCheng + ".pdf");
|
||
}
|
||
public string daochuImagePdf2(string name)
|
||
{
|
||
if (previewControl1.Report == null)
|
||
{
|
||
//MessageBox.Show("请先初始化数据!");
|
||
return "";
|
||
}
|
||
if (showview)
|
||
{
|
||
if (!this.Visible)
|
||
{
|
||
//this.Show();
|
||
//printpreview.Report.Show();
|
||
}
|
||
return "";
|
||
}
|
||
previewControl1.Report.PrintSettings.ShowDialog = false;
|
||
//previewControl1.Report.Print();
|
||
|
||
int i = 1;
|
||
FastReport.Export.Image.ImageExport imgreport = new FastReport.Export.Image.ImageExport();
|
||
//FastReport.Export.Pdf.PDFExport pdfe = new FastReport.Export.Pdf.PDFExport();
|
||
//pdfe.PageRange = FastReport.PageRange.All;
|
||
|
||
imgreport.PageRange = FastReport.PageRange.All;
|
||
imgreport.ImageFormat = FastReport.Export.Image.ImageExportFormat.Jpeg;
|
||
imgreport.MultiFrameTiff = true;
|
||
imgreport.Resolution = 96;
|
||
imgreport.JpegQuality = 100;
|
||
string path = System.IO.Path.GetTempPath();
|
||
path += i + "\\";
|
||
if (!Directory.Exists(path))
|
||
{
|
||
Directory.CreateDirectory(path);
|
||
}
|
||
string dir = path;
|
||
previewControl1.Report.Prepare();
|
||
previewControl1.Report.Export(imgreport, path + "lsb.jpg");
|
||
i++;
|
||
|
||
var mylist = new List<string>();
|
||
int z = 0;
|
||
while (true)
|
||
{
|
||
++z;
|
||
if (z == 1)
|
||
{
|
||
path = dir + "lsb.jpg";
|
||
|
||
}
|
||
else
|
||
{
|
||
path = string.Format(dir + "lsb.{0}.jpg", z);
|
||
}
|
||
|
||
if (System.IO.File.Exists(path))
|
||
{
|
||
int h = 0;
|
||
while (true)
|
||
{
|
||
if (h > 10)
|
||
break;
|
||
h++;
|
||
try
|
||
{
|
||
mylist.Add(path);
|
||
//File.Delete(path);
|
||
break;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Console.WriteLine(ex.Message);
|
||
Console.WriteLine(ex.StackTrace);
|
||
EAS.Loggers.ILogger log1 = new EAS.Loggers.TextLogger();
|
||
log1.Info(ex.Message);
|
||
log1.Info(ex.StackTrace);
|
||
}
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
path = string.Format(dir + "lsb.{0}.jpg", z.ToString("00"));
|
||
if (System.IO.File.Exists(path))
|
||
{
|
||
int h = 0;
|
||
while (true)
|
||
{
|
||
if (h > 10)
|
||
break;
|
||
h++;
|
||
try
|
||
{
|
||
mylist.Add(path);
|
||
//File.Delete(path);
|
||
break;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Console.WriteLine(ex.Message);
|
||
Console.WriteLine(ex.StackTrace);
|
||
EAS.Loggers.ILogger log2 = new EAS.Loggers.TextLogger();
|
||
log2.Info(ex.Message);
|
||
log2.Info(ex.StackTrace);
|
||
}
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
iTextSharp.text.Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4);
|
||
var pfile = @"d:\pdf\" + name + ".pdf";
|
||
var writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(pfile, FileMode.Create));
|
||
|
||
#region 设置PDF的头信息,一些属性设置,在Document.Open 之前完成
|
||
doc.AddAuthor("天瑞体检");
|
||
doc.AddCreationDate();
|
||
doc.AddCreator("天瑞体检");
|
||
doc.AddSubject(name);
|
||
doc.AddTitle(name);
|
||
//自定义头
|
||
#endregion
|
||
doc.Open();
|
||
|
||
foreach (var j in mylist)
|
||
{
|
||
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(j);
|
||
image.ScalePercent(72 / 96f * 100);
|
||
image.SetAbsolutePosition(0, 0);
|
||
|
||
doc.Add(image);
|
||
doc.NewPage();
|
||
File.Delete(j);
|
||
}
|
||
doc.Close();
|
||
return pfile;
|
||
//File(pfile, "application/pdf", bg.TaoCanMingCheng + ".pdf");
|
||
}
|
||
|
||
public void print()
|
||
{
|
||
if (previewControl1.Report == null)
|
||
{
|
||
MessageBox.Show("请先初始化数据!");
|
||
return;
|
||
}
|
||
if (showview)
|
||
{
|
||
if (!this.Visible)
|
||
{
|
||
this.Show();
|
||
//printpreview.Report.Show();
|
||
}
|
||
return;
|
||
}
|
||
|
||
//string printname = "";
|
||
//System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
|
||
//printname = cm.AppSettings.Settings["bgdyjmc"].Value;
|
||
//if (!string.IsNullOrEmpty(printname))
|
||
//{
|
||
// previewControl1.Report.PrintSettings.Printer = printname;
|
||
// }
|
||
previewControl1.Report.PrintSettings.ShowDialog = false;
|
||
previewControl1.Report.Print();
|
||
}
|
||
}
|
||
}
|