1787 lines
90 KiB
C#
1787 lines
90 KiB
C#
using EAS.Services;
|
||
using SOH.BLL;
|
||
using SOH.Entities;
|
||
using SOH.Kernel;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Windows.Forms;
|
||
|
||
using EAS.Data;
|
||
using SOH.Data;
|
||
using SOH.Entities.DTO;
|
||
using System.Configuration;
|
||
using SOH.Configuration;
|
||
using System.Reflection;
|
||
using System.Drawing.Imaging;
|
||
using System.Text.RegularExpressions;
|
||
|
||
namespace SOH.KeFu
|
||
{
|
||
[ModuleAttribute(ModuleID = "5906A5E0-8B4E-48E2-8A6D-544CA51B8C19", ModuleName = "报告上传")]
|
||
public partial class ReportUpload : SOH.Window.baseChildForm
|
||
{
|
||
private short fddm; //分店代码
|
||
private List<t_ttgzb> ttlist; //tab3中的团检会员信息
|
||
public ReportUpload()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
public void btn_upload_Click(object sender, EventArgs e)
|
||
{
|
||
if (gvHYXX.Rows.Count > 0)
|
||
{
|
||
for (int uu = 0; uu < gvHYXX.Rows.Count; uu++)
|
||
{
|
||
//this.gvHYXX.Rows[index].Cells[0].Value = dtcx.Rows[0]["tm"].ToString();
|
||
//this.gvHYXX.Rows[index].Cells[1].Value = dtcx.Rows[0]["xm"].ToString();
|
||
//this.gvHYXX.Rows[index].Cells[2].Value = dtcx.Rows[0]["sfzh"].ToString();
|
||
//this.gvHYXX.Rows[index].Cells[3].Value = dtcx.Rows[0]["nl"].ToString();
|
||
//this.gvHYXX.Rows[index].Cells[4].Value = dtcx.Rows[0]["tel"].ToString();
|
||
|
||
txt_tmh.Text = gvHYXX.Rows[uu].Cells["tm"].Value.ToString();
|
||
|
||
txt_log.Text = "开始处理条码:" + txt_tmh.Text;
|
||
Application.DoEvents();
|
||
EAS.Loggers.ILogger log = new EAS.Loggers.TextLogger();
|
||
try
|
||
{
|
||
var vkssver = ServiceContainer.GetService<It_ks>();
|
||
List<keshi> ccks = vkssver.getccks();
|
||
//程序代码
|
||
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));
|
||
FastReport.Report re = new FastReport.Report();
|
||
re.Load(AppDomain.CurrentDomain.BaseDirectory + "Report\\tjbg.frx");
|
||
var itm = 0;
|
||
int.TryParse(txt_tmh.Text, out itm);
|
||
|
||
int fddm = 0;
|
||
string xm = "";
|
||
int xb = 0;
|
||
DateTime tjrq;
|
||
string sjh = "";
|
||
string sfz = "";
|
||
string bj = "";
|
||
string title = "";
|
||
string tcmc = "";
|
||
DataTable dt = new DataTable();
|
||
var zjbll = ServiceContainer.GetService<IZongJian>();
|
||
var grbll = ServiceContainer.GetService<It_grgzb>();
|
||
var ttbll = ServiceContainer.GetService<It_ttgzb>();
|
||
var tjbll = ServiceContainer.GetService<It_tjjd>();
|
||
string grgzbString = grbll.GetGrgzbListByTm(itm);
|
||
string ttgzbString = ttbll.GetTtgzbListByTm(itm);
|
||
|
||
int hyh = 0;
|
||
//创建个人report或者团体report
|
||
if (grgzbString.Length > 2)
|
||
{
|
||
bj = "个人体检";
|
||
title = "个检";
|
||
DataTable grgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(grgzbString, typeof(DataTable)) as DataTable;
|
||
re.RegisterData(grgzbDt, "xxTable");
|
||
hyh = Convert.ToInt32(grgzbDt.Rows[0]["hyh"]);
|
||
fddm = Convert.ToInt32(grgzbDt.Rows[0]["fddm"].ToString());
|
||
xm = grgzbDt.Rows[0]["xm"].ToString();
|
||
sjh = grgzbDt.Rows[0]["dh"].ToString();
|
||
sfz = grgzbDt.Rows[0]["sfzh"].ToString();
|
||
xb = Convert.ToInt32(grgzbDt.Rows[0]["xb"].ToString());
|
||
tjrq = Convert.ToDateTime(grgzbDt.Rows[0]["tjrq"].ToString());
|
||
tcmc = zjbll.GetTcByTcbm(1, grgzbDt.Rows[0]["tcbm"].ToString());
|
||
}
|
||
else
|
||
{
|
||
DataTable ttgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ttgzbString, typeof(DataTable)) as DataTable;
|
||
try
|
||
{
|
||
title = zjbll.GetKhmcByHtbm(Convert.ToInt32(ttgzbDt.Rows[0]["htbm"]));
|
||
bj = zjbll.GetHtbjByHtbm(Convert.ToInt32(ttgzbDt.Rows[0]["htbm"]));
|
||
re.RegisterData(ttgzbDt, "xxTable");
|
||
hyh = Convert.ToInt32(ttgzbDt.Rows[0]["hyh"]);
|
||
fddm = Convert.ToInt32(ttgzbDt.Rows[0]["fddm"].ToString());
|
||
xm = ttgzbDt.Rows[0]["xm"].ToString();
|
||
sjh = ttgzbDt.Rows[0]["tel"].ToString();
|
||
sfz = ttgzbDt.Rows[0]["sfzh"].ToString();
|
||
xb = Convert.ToInt32(ttgzbDt.Rows[0]["xb"].ToString());
|
||
tjrq = Convert.ToDateTime(ttgzbDt.Rows[0]["tjrq"].ToString());
|
||
tcmc = zjbll.GetTcByTcbm(2, ttgzbDt.Rows[0]["htfzbm"].ToString());
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
throw ex;
|
||
}
|
||
|
||
}
|
||
|
||
re.SetParameterValue("bj", bj);
|
||
re.SetParameterValue("title", title);
|
||
re.SetParameterValue("sjh", sjh);
|
||
|
||
#region 创建报告
|
||
|
||
//创建第一页体检套餐 参数
|
||
string getTcStr = ttbll.GetTtTcByTm(itm);
|
||
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 = tjbll.getTjjdImage(itm, 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 = zjbll.GetHzfxByTm(itm);
|
||
|
||
DataTable hzfxDt = Newtonsoft.Json.JsonConvert.DeserializeObject(hzfxString, typeof(DataTable)) as DataTable;
|
||
|
||
|
||
|
||
if (hzfxDt.Rows.Count != 0)
|
||
{
|
||
re.RegisterData(hzfxDt, "hzfxTable");
|
||
re.SetParameterValue("hzfxOn", "yes");
|
||
//查询总检医生中文名称,插入到参数里
|
||
|
||
string lsdt = zjbll.GetZjysXm(hzfxDt.Rows[0][4].ToString());
|
||
dt = Newtonsoft.Json.JsonConvert.DeserializeObject(lsdt, typeof(DataTable)) as DataTable;
|
||
re.SetParameterValue("zjys", dt.Rows[0][0].ToString());
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("hzfxOn", "no");
|
||
re.SetParameterValue("zjys", "");
|
||
}*/
|
||
string hzfxString = zjbll.GetHzfxByTm(itm);
|
||
|
||
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 = zjbll.GetTjhzByTm(itm, 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 = zjbll.GetExplain(itm, 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 = zjbll.GetJbtjListByTm(itm);
|
||
if (jbtjlist.Count != 0)
|
||
{
|
||
DataTable jbkDt = new DataTable();
|
||
string jbks = zjbll.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 = zjbll.GetTjjdStringByTm(itm);
|
||
|
||
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;
|
||
}
|
||
}
|
||
|
||
var ccbg = ServiceContainer.GetService<It_tempdjxm>();
|
||
List<t_ccbg> ccbgs = ccbg.getCCBG(0, itm.ToString());
|
||
|
||
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);
|
||
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();
|
||
bm.Save(mso, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||
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");
|
||
re.SetParameterValue("nothyxmOn", "yes");
|
||
}
|
||
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");
|
||
re.RegisterData(tjjdDt2, "tjjg");
|
||
re.SetParameterValue("nothyxmOn", "no");
|
||
}
|
||
|
||
//创建化验项目的体检诊断datatable
|
||
string HytjjdString = zjbll.GetHyTjjdStringByTm(itm, 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 = zjbll.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 = zjbll.GetTjjgStringByTm(itm,xb);
|
||
|
||
DataTable tjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjjgString, typeof(DataTable)) as DataTable;
|
||
|
||
|
||
|
||
if (tjjgDt.Rows.Count != 0)
|
||
{
|
||
DataView dv2 = tjjgDt.DefaultView;
|
||
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");
|
||
}
|
||
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");
|
||
}
|
||
|
||
//创建外送金域的体检结果datatable
|
||
string tjjgWSString = ServiceContainer.GetService<IZongJian>().GetTjjgWSStringByTm(itm,xb);
|
||
|
||
DataTable tjjgWSDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjjgWSString, typeof(DataTable)) as DataTable;
|
||
|
||
|
||
if (tjjgWSDt.Rows.Count != 0)
|
||
{
|
||
DataView dvWS = tjjgWSDt.DefaultView;
|
||
|
||
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");
|
||
re.SetParameterValue("notwsxmOn", "yes");
|
||
}
|
||
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 = zjbll.GetHyTjjgStringByTm(itm, 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 = zjbll.GetFqStringByTm(itm);
|
||
|
||
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[])zjbll.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 (sfz != "")
|
||
{
|
||
int[] array1 = (int[])ServiceContainer.GetService<IZongJian>().GetHisTmListBySfz(sfz, 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");
|
||
}
|
||
}
|
||
if (ccdt.Rows.Count > 0)
|
||
{
|
||
re.SetParameterValue("ccImageOn", "yes");
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("ccImageOn", "no");
|
||
}
|
||
#endregion
|
||
|
||
re.RegisterData(ccdt, "ccbg");
|
||
txt_log.Text = "获取报告数据成功!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
//re.Preview = previewControl1;
|
||
//re.Show();
|
||
TianRui.FuWuSoapClient fw = new TianRui.FuWuSoapClient();
|
||
if (string.IsNullOrEmpty(sjh) || sjh.Length != 11)
|
||
{
|
||
//return;
|
||
continue;
|
||
}
|
||
txt_log.Text = "连接服务成功!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
var hyjg = fw.CreateHuiYuan(xm, sjh, sfz, xb);
|
||
if (hyjg.State == 0)
|
||
//return;
|
||
continue;
|
||
txt_log.Text = "创建会员成功!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
string newhy = hyjg.Message;
|
||
log.Info(hyjg.Tag);
|
||
var hy = Newtonsoft.Json.JsonConvert.DeserializeObject<SOH.TJX.Model.HuiYuan>(hyjg.Tag);
|
||
var bg = fw.CreateBaoGao(hy.id, tcmc, tjrq, fddm, txt_tmh.Text.ToString());
|
||
FastReport.Export.Pdf.PDFExport imgreport = new FastReport.Export.Pdf.PDFExport();
|
||
//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 += bg.Message + "\\";
|
||
|
||
if (!Directory.Exists(path))
|
||
{
|
||
Directory.CreateDirectory(path);
|
||
}
|
||
string dir = path;
|
||
re.Prepare();
|
||
string fn = Guid.NewGuid().ToString("N");
|
||
re.Export(imgreport, path + fn+".pdf");
|
||
|
||
//re.Export(pdfe, "");
|
||
txt_log.Text = "导出报告成功!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
int z = 0;
|
||
path = path + fn + ".pdf";
|
||
Console.WriteLine(path);
|
||
|
||
|
||
if (System.IO.File.Exists(path))
|
||
{
|
||
txt_log.Text = "开始上传报告" + path + "!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
int h = 0;
|
||
while (true)
|
||
{
|
||
if (h > 10)
|
||
break;
|
||
h++;
|
||
try
|
||
{
|
||
FileStream fs = new FileInfo(path).OpenRead();
|
||
byte[] bts = new byte[fs.Length];
|
||
fs.Read(bts, 0, (int)fs.Length);
|
||
fs.Close();
|
||
fw.TianJiaBaoGaoMingXi(int.Parse(bg.Message), z, bts);
|
||
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);
|
||
txt_log.Text = ex.Message + "!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
try
|
||
{
|
||
Directory.Delete(dir);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Console.WriteLine(dir);
|
||
|
||
Console.WriteLine(ex.Message);
|
||
txt_log.Text = ex.Message + "!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
}
|
||
txt_log.Text = "上传报告完成!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
/*
|
||
string xx = "尊敬的会员" + hy.XingMing + "您好,您" + tjrq.ToString("yyyy-MM-dd") + "体检报告已生成,个检请在3个工作日后到店领取,团检请等待单位统一派发,也可登录网站或天瑞体检微信小程序查看。http://t.cn/RtJhnGK";
|
||
if (newhy == "1")
|
||
{
|
||
xx += "你的登录名:" + hy.ShouJiHao + ",密码为手机号的后8位。";
|
||
}
|
||
else
|
||
{
|
||
|
||
}
|
||
|
||
log.Info(hy.ShouJiHao);
|
||
log.Info(xx);
|
||
xx += "【天瑞体检】";
|
||
fw.SendMsg(hy.ShouJiHao, xx, fddm);
|
||
fw.Close();
|
||
txt_log.Text = "发送短信成功!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
*/
|
||
gvHYXX.Rows.RemoveAt(uu);
|
||
uu--;
|
||
}
|
||
catch (Exception sbex)
|
||
{
|
||
Console.WriteLine(sbex.Message);
|
||
Console.WriteLine(sbex.StackTrace);
|
||
|
||
log.Info(sbex.Message);
|
||
log.Info(sbex.StackTrace);
|
||
txt_log.Text = sbex.Message + "!\r\n" + txt_log.Text;
|
||
Application.DoEvents();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
private void btMH3_Click(object sender, EventArgs e)
|
||
{
|
||
string tjdw = this.tb3_TJDW.Text.Trim();
|
||
GetTJDW(tjdw);
|
||
}
|
||
/// <summary>
|
||
/// 根据团检单位的拼音码查询团检单位
|
||
/// </summary>
|
||
/// <param name="tjdw"></param>
|
||
private void GetTJDW(string tjdw)
|
||
{
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
List<dto_tjxx> ldt = vs.GetTJXX(fddm, tjdw);
|
||
this.gvTJDW.DataSource = ldt;
|
||
}
|
||
|
||
private void ReportUpload_Load(object sender, EventArgs e)
|
||
{
|
||
// 获取分店代码
|
||
string fddmstr = LoginUser.yydm;
|
||
short fd = 0;
|
||
short.TryParse(fddmstr, out fd);
|
||
this.gvHYXX.AutoGenerateColumns = false;
|
||
this.gvTJDW.AutoGenerateColumns = false;
|
||
fddm = fd;
|
||
}
|
||
|
||
private void btnQB3_Click(object sender, EventArgs e)
|
||
{
|
||
this.tb3_TJDW.Text = "";
|
||
GetTJDW("");
|
||
}
|
||
|
||
private void gvTJDW_SelectionChanged(object sender, EventArgs e)
|
||
{
|
||
if (this.gvTJDW.SelectedRows.Count > 0)
|
||
{
|
||
this.gvHYXX.DataSource = null;
|
||
|
||
int rowindex = this.gvTJDW.SelectedRows[0].Index;
|
||
dto_tjxx tjxx = this.gvTJDW.Rows[rowindex].DataBoundItem as dto_tjxx;
|
||
int htbm = tjxx.htbm;
|
||
|
||
var vservice = ServiceContainer.GetService<IZongJian>();
|
||
String data = vservice.GetCxDybgByHtbms(htbm);
|
||
|
||
DataTable dtcx;
|
||
dtcx = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
|
||
if (dtcx.Rows.Count != 0)
|
||
{
|
||
this.gvHYXX.DataSource = dtcx;
|
||
}
|
||
}
|
||
}
|
||
|
||
private void txt_tmh_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
var vservice = ServiceContainer.GetService<IZongJian>();
|
||
String data = vservice.GetCxDybgByTxttmh(this.txt_tmh.Text.Trim());
|
||
if (data.Equals("1"))
|
||
{
|
||
MessageBox.Show("在团检记录和个检记录里都找不到当前条码。");
|
||
this.txt_tmh.SelectAll();
|
||
this.txt_tmh.Focus();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
DataTable dtcx;
|
||
dtcx = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
|
||
if (dtcx.Rows.Count != 0)
|
||
{
|
||
for (int i = 0; i < gvHYXX.Rows.Count; i++)
|
||
{
|
||
if (gvHYXX.Rows[i].Cells[0].Value.ToString() == this.txt_tmh.Text.Trim())
|
||
{
|
||
this.txt_tmh.SelectAll();
|
||
this.txt_tmh.Focus();
|
||
return;
|
||
}
|
||
}
|
||
int index = this.gvHYXX.Rows.Add();
|
||
this.gvHYXX.Rows[index].Cells["tm"].Value = dtcx.Rows[0]["tm"].ToString();
|
||
this.gvHYXX.Rows[index].Cells["xm"].Value = dtcx.Rows[0]["xm"].ToString();
|
||
this.gvHYXX.Rows[index].Cells["sfzh"].Value = dtcx.Rows[0]["sfzh"].ToString();
|
||
this.gvHYXX.Rows[index].Cells["nl"].Value = dtcx.Rows[0]["nl"].ToString();
|
||
this.gvHYXX.Rows[index].Cells["tel"].Value = dtcx.Rows[0]["tel"].ToString();
|
||
this.txt_tmh.SelectAll();
|
||
this.txt_tmh.Focus();
|
||
//this.gvHYXX.DataSource = dtcx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
this.gvHYXX.DataSource = null;
|
||
for (int i = 0; i < gvHYXX.Rows.Count; i++)
|
||
{
|
||
gvHYXX.Rows.RemoveAt(i);
|
||
i--;
|
||
}
|
||
}
|
||
}
|
||
}
|