private void btnQuery_Click(object sender, EventArgs e) { if (this.btnQuery.Text == "重置条件") { this.groupBox1.Enabled = true; this.btnQuery.Text = "查询"; txtIdNum.Text = ""; tbAddr.Text = ""; dtpSt.Text = ""; dtpEd.Text = ""; dtpCreatedDateSt.Text = ""; dtpCreatedDateEd.Text = ""; } else if (this.ckCheckDate.Checked && (this.dtpSt.Value.Date > this.dtpEd.Value.Date)) { MessageBox.Show(" 体检日期:开始日期大于结束日期!", "日期错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (this.ckxCreatedDate.Checked && (this.dtpCreatedDateSt.Value.Date > this.dtpCreatedDateEd.Value.Date)) { MessageBox.Show(" 建档日期:开始日期大于结束日期!", "日期错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { this.btnQuery.Enabled = false; string where = this.GetWhere(); this.lbTotalCount.Text = ""; if (string.IsNullOrEmpty(where)) { MessageBox.Show("请选择查询条件!", "查询条件", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.btnQuery.Enabled = true; } else { RecordsEcgBLL archive_baseinfo = new RecordsEcgBLL(); this.totalCount = archive_baseinfo.GetRecordCount(where); this.totalPages = (this.totalCount <= this.pageCount) ? 1 : ((this.totalCount / this.pageCount) + (((this.totalCount % this.pageCount) > 0) ? 1 : 0)); this.currentPage = 0; this.lbTotalCount.Text = string.Format("共计{0}条", this.totalCount.ToString()); DataSet ds = archive_baseinfo.GetListByPage(where, "", 0, this.pageCount); this.lbPages.Text = string.Format("{0}/{1}页", this.currentPage + 1, this.totalPages); if (ds.Tables.Count > 0) { this.TransDs(ds); this.bds.DataSource = ds.Tables[0]; this.dgvData.DataSource = this.bds; } else { this.dgvData.DataSource = null; } this.groupBox1.Enabled = false; this.btnQuery.Enabled = true; this.btnQuery.Text = "重置条件"; } } }
private void btnNext_Click(object sender, EventArgs e) { if (this.currentPage < (this.totalPages - 1)) { this.lbPages.Text = string.Format("{0}/{1}页", ++this.currentPage + 1, this.totalPages); DataSet ds = new RecordsEcgBLL().GetListByPage(this.GetWhere(), "", this.currentPage * this.pageCount, this.pageCount); if (ds.Tables.Count > 0) { this.TransDs(ds); this.bds.DataSource = ds.Tables[0]; this.dgvData.DataSource = this.bds; } } }
private void TransDs(DataSet ds) { ds.Tables[0].Columns.Add("MIDName"); RecordsEcgBLL recordsEcgBll = new RecordsEcgBLL(); foreach (DataRow row in ds.Tables[0].Rows) { row["CustomerName"] = row["CustomerName"].ToString().Trim(); row["Sex"] = !(row["Sex"].ToString() == "1") ? "女" : "男"; row["Nation"] = !(row["Nation"].ToString() == "1") ? row["MINORITY"] : "汉"; if (recordsEcgBll.GetMIDCount(row["IDCardNo"].ToString()) > 0) { row["MIDName"] = "心电图"; } } }
public FixedDocumentSequence getReport() { if (!string.IsNullOrEmpty(this.CardID)) { if (File.Exists("printtemp\\ecg.png")) { File.Delete("printtemp\\ecg.png"); } string xdWhere = string.Format(" IDCardNo='{0}' AND LEFT(CreateTime,4)='{1}' ORDER BY CreateTime DESC,ID DESC LIMIT 0,1 ", this.CardID, DateTime.Now.Year.ToString()); RecordsEcgModel ecgModel = new RecordsEcgBLL().GetModelByWhere(xdWhere); if (ecgModel == null) { ecgModel = new RecordsEcgModel(); } List <ListValue> list = new List <ListValue>(); string path = ECGReport + "\\" + ecgModel.MID + ".png"; if (!File.Exists(path)) { list.Add(new ListValue { strMark = "&ecg", strVal = "" }); } else { //读取文件流 FileStream fs = new System.IO.FileStream(path, FileMode.Open, FileAccess.Read); int byteLength = (int)fs.Length; byte[] fileBytes = new byte[byteLength]; fs.Read(fileBytes, 0, byteLength); //文件流关閉,文件解除锁定 fs.Close(); Image image = Image.FromStream(new MemoryStream(fileBytes)); //if (community.Equals("聊城东昌府区")) //{ Graphics g = Graphics.FromImage(image); #region 禹城 检查医生取文字版,审核医生取手写版,检查日期取心电createTime if (area.Equals("禹城")) { RecordsSignatureModel signModel = new RecordsSignatureBLL().GetModelByOutKey(0, "签字维护"); if (signModel == null) { signModel = new RecordsSignatureModel(); } // 加载检查医生签名 string signPath = SignPath + "_Doctor16.png"; if (File.Exists(signPath)) { //加载检查日期 string imgJianChaKong = SignPath + "_JianChaKongBai.png"; string imgJianChaZi = SignPath + "Date//" + CardID + "_imgJianChaZi.png"; if (!File.Exists(imgJianChaKong)) { //创建一个200*40的空白图 Bitmap b1 = new Bitmap(200, 80); //新建位图zdb1 Graphics g1 = Graphics.FromImage(b1); //创建版b1的Graphics g1.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 80)); //把b1涂成红色 b1.Save(imgJianChaKong); b1.Dispose(); } if (!File.Exists(SignPath + "Date")) { Directory.CreateDirectory(SignPath + "Date"); } if (File.Exists(imgJianChaZi)) { File.Delete(imgJianChaZi); } Bitmap bitmap = new Bitmap(imgJianChaKong); Graphics gp = Graphics.FromImage(bitmap); Font font = new Font("KaiTi", 40, FontStyle.Bold); SolidBrush sbrush = new SolidBrush(Color.Black); gp.DrawString(signModel.AECGSn, font, sbrush, 10, 2); bitmap.Save(imgJianChaZi); bitmap.Dispose(); Image imgrq = Image.FromFile(imgJianChaZi); g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(imgrq, 300, 1950, imgrq.Width, imgrq.Height); } //加载检查日期 string imgKong = SignPath + "_KongBai.png"; string imgZi = SignPath + "Date//" + CardID + "_imgZi.png"; //绑定检查日期 DateTime checkDate; if (DateTime.TryParse(ecgModel.CreateTime.ToString(), out checkDate)) { // 加载心电检查医生签名 string examinePath = SignPath + "_Doctor16.png"; if (File.Exists(SignPath + checkDate.ToString("yyyy-MM-dd") + "//_Doctor16.png")) { Image img = Image.FromFile(SignPath + checkDate.ToString("yyyy-MM-dd") + "//_Doctor16.png"); // 将医生签名拼接到检查医生的位置 g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(img, 1300, 1950, img.Width, img.Height); } else { if (File.Exists(examinePath)) { Image img = Image.FromFile(examinePath); // 将医生签名拼接到检查医生的位置 g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(img, 1300, 1950, img.Width, img.Height); } } if (!File.Exists(imgKong)) { //创建一个200*40的空白图 Bitmap b1 = new Bitmap(200, 40); //新建位图zdb1 Graphics g1 = Graphics.FromImage(b1); //创建版b1的Graphics g1.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 40)); //把b1涂成红色 b1.Save(imgKong); b1.Dispose(); } if (!File.Exists(SignPath + "Date")) { Directory.CreateDirectory(SignPath + "Date"); } if (File.Exists(imgZi)) { File.Delete(imgZi); } Bitmap bitmap = new Bitmap(imgKong); Graphics gp = Graphics.FromImage(bitmap); string label = checkDate.ToString("yyyy-MM-dd"); Font font = new Font("KaiTi", bitmap.Width / 10, FontStyle.Bold); SolidBrush sbrush = new SolidBrush(Color.Black); gp.DrawString(label, font, sbrush, 10, 2); bitmap.Save(imgZi); bitmap.Dispose(); Image imgrq = Image.FromFile(imgZi); g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(imgrq, 1830, 1950, imgrq.Width, imgrq.Height); } else { // 加载心电检查医生签名 string examinePath = SignPath + "_Doctor16.png"; if (File.Exists(examinePath)) { Image img = Image.FromFile(examinePath); // 将医生签名拼接到检查医生的位置 g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(img, 1300, 1950, img.Width, img.Height); } } } #endregion #region 乐陵 else if (area.Equals("乐陵")) { // 加载心电医生签名 string signPath = SignPath + "_Doctor16.png"; if (File.Exists(signPath)) { Image img = Image.FromFile(signPath); // 将医生签名拼接到检查医生的位置 g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(img, 300, 1950, img.Width, img.Height); } // 加载心电检查医生签名 string examinePath = SignPath + "_Doctor23.png"; if (File.Exists(examinePath)) { Image img = Image.FromFile(examinePath); // 将医生签名拼接到检查医生的位置 g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(img, 1300, 1950, img.Width, img.Height); } //加载检查日期 RecordsCustomerBaseInfoModel model2 = new RecordsCustomerBaseInfoModel(); string strYear = DateTime.Now.Year.ToString(); string strWhere = string.Format(" IDCardNo='{0}'AND LEFT(CheckDate,4)='{1}' ORDER BY CheckDate DESC LIMIT 0,1 ", this.CardID, DateTime.Now.Year); string imgKong = SignPath + "_KongBai.png"; string imgZi = SignPath + "Date//" + CardID + "_imgZi.png"; //获取本年度最新一笔数据 model2 = new RecordsCustomerBaseInfoBLL().GetModelByWhere(strWhere); if (model2 != null) { DateTime checkDate; if (DateTime.TryParse(model2.CheckDate.ToString(), out checkDate)) { if (!File.Exists(imgKong)) { //创建一个200*40的空白图 Bitmap b1 = new Bitmap(200, 40); //新建位图zdb1 Graphics g1 = Graphics.FromImage(b1); //创建版b1的Graphics g1.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 40)); //把b1涂成红色 b1.Save(imgKong); b1.Dispose(); } if (!File.Exists(SignPath + "Date")) { Directory.CreateDirectory(SignPath + "Date"); } if (File.Exists(imgZi)) { File.Delete(imgZi); } Bitmap bitmap = new Bitmap(imgKong); Graphics gp = Graphics.FromImage(bitmap); string label = checkDate.ToString("yyyy-MM-dd"); Font font = new Font("KaiTi", bitmap.Width / 10, FontStyle.Bold); SolidBrush sbrush = new SolidBrush(Color.Black); gp.DrawString(label, font, sbrush, 10, 2); bitmap.Save(imgZi); bitmap.Dispose(); Image imgrq = Image.FromFile(imgZi); g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(imgrq, 1770, 1960, imgrq.Width, imgrq.Height); } } } #endregion else { // 加载心电医生签名 string signPath = SignPath + "_Doctor16.png"; if (File.Exists(signPath)) { Image img = Image.FromFile(signPath); // 将医生签名拼接到检查医生的位置 g.DrawImage(image, 0, 0, image.Width, image.Height); g.DrawImage(img, 300, 1950, img.Width, img.Height); } } // 旋转图片 image.RotateFlip(RotateFlipType.Rotate270FlipNone); fs.Close(); image.Save("printtemp\\ecg.png"); list.Add(new ListValue { strMark = "&ecg", strVal = "printtemp\\ecg.png" }); image.Dispose(); } return(DrawItems.setPage("printXps\\38心电图.xps", list)); } return(null); }