/// <summary> /// /// </summary> private void fillBack() { ClinicarItem entity = null; //项目管理实体类 if (this.dgrdView.CurrentRow != null && this.dgrdView.CurrentRow.Index >= 0 && f_CheckId != 0) { entity = ((BindingList <ClinicarItem>) this.dgrdView.DataSource)[this.dgrdView.CurrentRow.Index]; SResult rst = new SResult(); ClinicarCheckItem clinicarCheckItem = new ClinicarCheckItem(); clinicarCheckItem.ItemCode = entity.Id; clinicarCheckItem.ItemName = entity.Name; clinicarCheckItem.DptCode = entity.DptCode; clinicarCheckItem.DptName = entity.DptName; clinicarCheckItem.CheckId = f_CheckId; rst = clinicarCheckItemBiz.Insert(clinicarCheckItem); if (rst.success) { UcMessageBox.Information("添加成功!", "提示"); } else { UcMessageBox.Error(rst.message, "提示"); } //刷新登记界面中的检查项目表 SPagintion <ClinicarCheckItem> page = clinicarCheckItemBiz.FindByPagination(1, 999, f_CheckId); IList <ClinicarCheckItem> list = page != null ? page.Data : new List <ClinicarCheckItem>(); SGridViewUtil.BindingData <ClinicarCheckItem>(list, this.dataGridViewTranmit, displayPropertiesTranmit); } else { UcMessageBox.Warning("请先选择一行数据", "提示"); } }
/// <summary> /// 取消按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_cancel_Click(object sender, EventArgs e) { SResult rst = new SResult(); ClinicarCheckItem entity = this.GetCurrentRowData(); if (entity == null || Convert.IsDBNull(entity)) { return; } entity.Completed = false; rst = clinicarCheckItemBiz.Update(entity); if (rst.success) { UcMessageBox.Information("取消成功.", "提示"); } else { UcMessageBox.Information("取消失败.", "提示"); } //重新查询科室表 DataEntity = new ClinicarCheck(); DataEntity = clinicarCheckBiz.FindByCheckNum(uTxt_checkNumber.Text.Trim()); fillByCheckNum(); }
/// <summary> /// 判断科室项目列表 /// </summary> /// <returns></returns> private ClinicarCheckItem GetCurrentRowData() { ClinicarCheckItem entity = null; if (this.dgrdViewLeft.CurrentRow != null && this.dgrdViewLeft.CurrentRow.Index >= 0) { entity = ((BindingList <ClinicarCheckItem>) this.dgrdViewLeft.DataSource)[this.dgrdViewLeft.CurrentRow.Index]; } return(entity); }
public SResult Update(ClinicarCheckItem clinicarCheckItem) { SResult rst = new SResult(); ClinicarCheckItemDao.Update(clinicarCheckItem); rst.success = true; rst.data = clinicarCheckItem; rst.message = "修改成功!"; return(rst); }
/// <summary> /// 按日期对检查号查询 /// </summary> /// <param name="sn"></param> /// <returns></returns> public ClinicarCheckItem FindByCheckNumber(string checkDate) { IList <ClinicarCheckItem> list = ClinicarCheckItemDao.FindByHql(" and check_date >= ?", new Object[] { checkDate }, "check_date,check_number desc limit 1"); ClinicarCheckItem clinicarCheck = null; if (list.Count() > 0) { clinicarCheck = list[0]; } return(clinicarCheck); }
/// <summary> /// 保存前的校验方法 /// </summary> /// <returns></returns> private bool CheckBeforeSave() { //获取检查项目聚焦行数据 ClinicarCheckItem entity = this.GetCurrentRowData(); if (entity == null || Convert.IsDBNull(entity)) { return(false); } return(true); }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_history_Click(object sender, EventArgs e) { //获取检查项目聚焦行数据 ClinicarCheckItem entityItem = this.GetCurrentRowData(); if (entityItem == null || Convert.IsDBNull(entityItem)) { return; } FrmClinicarSortCheckHistory history = new FrmClinicarSortCheckHistory(); history.StartPosition = FormStartPosition.CenterScreen; //检查项目(科室)实体类 history.entityTransmit = entityItem; //登记表实体类 history.entityCheckTransmit = DataEntity; //结果表控件 history.F_dgViewTransmit = dataGridView_Result; //回填类型(图片/pdf/表格) if (Util.showType(entityItem.DptName).Equals(Util.image)) { history.type = Util.image; } else if (Util.showType(entityItem.DptName).Equals(Util.pdf)) { history.type = Util.pdf; } else { history.type = Util.data; } history.ShowDialog(); if (history.DialogResult == DialogResult.OK) { imageOrPdfPath = history.F_strAttachmentPath; if (!string.IsNullOrEmpty(imageOrPdfPath)) { if (imageOrPdfPath.ToLower().EndsWith(".pdf")) { axAcroPDF1.LoadFile(Util.basePath + imageOrPdfPath); this.label10.Visible = false; } else { pictureBox1.Image = Image.FromFile(Util.basePath + imageOrPdfPath); } } } }
/// <summary> /// </summary> /// <returns></returns> private ClinicarCheckItem GetCenterCurrentRowData() { ClinicarCheckItem entity = null; if (this.dgrdViewCenter.CurrentRow != null && this.dgrdViewCenter.CurrentRow.Index >= 0) { entity = ((BindingList <ClinicarCheckItem>) this.dgrdViewCenter.DataSource)[this.dgrdViewCenter.CurrentRow.Index]; } else { //UcMessageBox.Warning("请先选择行数据", "提示"); } return(entity); }
public SResult Insert(ClinicarCheckItem clinicarCheckItem) { SResult rst = new SResult(); if (CheckIsExist(clinicarCheckItem.CheckId, clinicarCheckItem.ItemCode)) { rst.success = false; rst.message = "[" + clinicarCheckItem.ItemName + "]已存在!"; } else { ClinicarCheckItemDao.Insert(clinicarCheckItem); rst.success = true; rst.data = clinicarCheckItem; rst.message = "新增成功!"; } return(rst); }
/// <summary> /// 行改变监听事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DgrdViewLeft_SelectionChanged(object sender, EventArgs e) { //移除所有标签页,根据不同科室选择添加不同标签页 removeTabpages(); ClinicarCheckItem entity = this.GetCurrentRowData(); if (entity == null || Convert.IsDBNull(entity)) { //当前科室 lb_choseDpt.Text = string.Empty; this.dataGridView_Result.DataSource = null; return; } //根据科室不同,展示不同的结果 showResult(entity); //结论和建议 uRic_summary.Text = entity.Summary; //当前科室 lb_choseDpt.Text = "当前科室:" + entity.DptName; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DgrdViewRight_SelectionChanged(object sender, EventArgs e) { //获取检查项目聚焦行数据 ClinicarCheckItem entityLeft = this.GetCurrentRowData(); if (entityLeft == null || Convert.IsDBNull(entityLeft)) { return; } ////获取检查结果聚焦行数据 //ClinicarCheckResult entityRight = this.GetRightCurrentRowData(); //if (entityRight == null || Convert.IsDBNull(entityRight)) //{ // clean(); // return; //} //uTxt_itemName.Text = entityRight.Name; //uTxt_itemResult.Text = entityRight.Result; //uTxt_itemUtil.Text = entityRight.Unit; //uTxt_itemConlusion.Text = entityRight.Conclusion; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_del_Click_1(object sender, EventArgs e) { ClinicarCheckItem entity = this.GetCurrentRowData(); if (entity != null && UcMessageBox.Confirm("确定删除?", "提示")) { //int[] index = this.dgrdView.SelectedRows // .OfType<DataGridViewRow>() // .Select(x => x.Index) // .OrderBy(x => x) // .ToArray(); //foreach (int i in index) //{ // entity = ((BindingList<ClinicarCheckItem>)this.dgrdView.DataSource)[i]; // clinicarCheckItemBiz.FakeDelete(entity.Id); //} entity = ((BindingList <ClinicarCheckItem>) this.dgrdView.DataSource)[this.dgrdView.CurrentRow.Index]; clinicarCheckItemBiz.FakeDelete(entity.Id); this.ucDgv_list.Search(1); } }
/// <summary> /// 行改变监听事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgrdViewCenter_SelectionChanged(object sender, EventArgs e) { //移除所有标签页,根据不同科室选择添加不同标签页 removeTabpages(); //check表 ClinicarCheck entityCheck = this.GetCurrentRowData(); if (entityCheck == null || Convert.IsDBNull(entityCheck)) { dgrdViewCenter.DataSource = null; dgrdViewRight.DataSource = null; return; } //项目表 ClinicarCheckItem entity = this.GetCenterCurrentRowData(); if (entity == null || Convert.IsDBNull(entity)) { dgrdViewRight.DataSource = null; return; } //展示结果 showResult(entityCheck, entity); }
/// <summary> /// 保存相关方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_save_Click(object sender, EventArgs e) { if (this.CheckBeforeSave())//保存前的校验 { //获取检查项目聚焦行数据 ClinicarCheckItem entity = this.GetCurrentRowData(); if (entity == null || Convert.IsDBNull(entity)) { return; } //图片类或pdf if (Util.showType(entity.DptName).Equals(Util.image) || Util.showType(entity.DptName).Equals(Util.pdf)) { SResult rst = new SResult(); this.DataEntityClinicarCheckResult = new ClinicarCheckResult(); this.DataEntityClinicarCheckResult.Deleted = false; this.DataEntityClinicarCheckResult.CheckNumber = uTxt_checkNumber.Text.Trim(); this.DataEntityClinicarCheckResult.AttachmentPath = this.imageOrPdfPath; this.DataEntityClinicarCheckResult.ItemCode = entity.ItemCode; this.DataEntityClinicarCheckResult.ItemName = entity.ItemName; //检查结果表格绑定数据 SPagintion <ClinicarCheckResult> page = clinicarCheckResultBiz.FindByPagination(1, 100, uTxt_checkNumber.Text.Trim(), entity.ItemCode); IList <ClinicarCheckResult> list = page != null ? page.Data : new List <ClinicarCheckResult>(); if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { this.DataEntityClinicarCheckResult.Id = list[0].Id; rst = clinicarCheckResultBiz.Update(DataEntityClinicarCheckResult); } else { rst = clinicarCheckResultBiz.Insert(DataEntityClinicarCheckResult); } if (rst.success) { UcMessageBox.Information("保存成功.", "提示"); entity.Summary = uRic_summary.Text; entity.Completed = true; rst = clinicarCheckItemBiz.Update(entity); } else { UcMessageBox.Error("保存失败.", "提示"); } } //数据类 else if (Util.showType(entity.DptName).Equals(Util.data)) { SResult rst = new SResult(); if (dataGridView_Result != null && !Convert.IsDBNull(dataGridView_Result) && dataGridView_Result.RowCount > 0) { try { for (int i = 0; i < dataGridView_Result.RowCount; i++) { this.DataEntityClinicarCheckResult = new ClinicarCheckResult(); this.DataEntityClinicarCheckResult.DetailName = dataGridView_Result.Rows[i].Cells[0].Value == null ? "" : dataGridView_Result.Rows[i].Cells[0].Value.ToString(); this.DataEntityClinicarCheckResult.Result = dataGridView_Result.Rows[i].Cells[1].Value == null ? "" : dataGridView_Result.Rows[i].Cells[1].Value.ToString(); this.DataEntityClinicarCheckResult.Unit = dataGridView_Result.Rows[i].Cells[3].Value == null ? "" : dataGridView_Result.Rows[i].Cells[3].Value.ToString(); this.DataEntityClinicarCheckResult.Conclusion = dataGridView_Result.Rows[i].Cells[4].Value == null ? "" : dataGridView_Result.Rows[i].Cells[4].Value.ToString(); this.DataEntityClinicarCheckResult.Deleted = false; this.DataEntityClinicarCheckResult.CheckNumber = uTxt_checkNumber.Text.Trim(); this.DataEntityClinicarCheckResult.AttachmentPath = ""; this.DataEntityClinicarCheckResult.ItemCode = entity.ItemCode; this.DataEntityClinicarCheckResult.ItemName = entity.ItemName; if (!f_blEdit) //新增 { this.DataEntityClinicarCheckResult.DetailCode = dataGridView_Result.Rows[i].Cells[5].Value == null ? "" : dataGridView_Result.Rows[i].Cells[5].Value.ToString(); rst = clinicarCheckResultBiz.Insert(DataEntityClinicarCheckResult); } else if (f_blEdit) //修改 { this.DataEntityClinicarCheckResult.DetailCode = dataGridView_Result.Rows[i].Cells[6].Value == null ? "" : dataGridView_Result.Rows[i].Cells[6].Value.ToString(); this.DataEntityClinicarCheckResult.Id = dataGridView_Result.Rows[i].Cells[5].Value == null ? 0 : Convert.ToInt32(dataGridView_Result.Rows[i].Cells[5].Value); rst = clinicarCheckResultBiz.Update(DataEntityClinicarCheckResult); } } } catch { } finally { if (rst.success) { UcMessageBox.Information("保存成功.", "提示"); entity.Summary = uRic_summary.Text; entity.Completed = true; rst = clinicarCheckItemBiz.Update(entity); } else { UcMessageBox.Error("保存失败.", "提示"); } } } } //重新查询科室表 DataEntity = new ClinicarCheck(); DataEntity = clinicarCheckBiz.FindByCheckNum(uTxt_checkNumber.Text.Trim()); fillByCheckNum(); } }
/// <summary> /// 历史数据回填 /// </summary> private void dataFillBack() { //check表 ClinicarCheck entityCheck = this.GetCurrentRowData(); if (entityCheck == null || Convert.IsDBNull(entityCheck)) { return; } //项目表 ClinicarCheckItem entityItem = this.GetCenterCurrentRowData(); if (entityItem == null || Convert.IsDBNull(entityItem)) { return; } //表格 if (Util.showType(entityItem.DptName).Equals(Util.data)) { //结果表 ClinicarCheckResult entity = this.GetRightCurrentRowData(); if (entity == null || Convert.IsDBNull(entity)) { return; } if (!this.type.Equals(Util.data)) { return; } for (int i = 0; i < this.F_dgViewTransmit.RowCount; i++) { //如果项目名称一致则回填 string itemName = this.F_dgViewTransmit.Rows[i].Cells[0].Value == null ? "" : this.F_dgViewTransmit.Rows[i].Cells[0].Value.ToString(); if (itemName == entity.DetailName) { f_strAttachmentPath = string.Empty; this.F_dgViewTransmit.Rows[i].Cells[1].Value = entity.Result; this.F_dgViewTransmit.Rows[i].Cells[4].Value = entity.Conclusion; UcMessageBox.Information("【" + entity.DetailName + "】项目结果、结论回填成功.", "历史数据回填"); } } } //图片 else if (Util.showType(entityItem.DptName).Equals(Util.image)) { //检查科室表格绑定数据 SPagintion <ClinicarCheckResult> page = clinicarCheckResultBiz.FindByPagination(1, 100, entityCheck.CheckNumber, entityItem.ItemCode); IList <ClinicarCheckResult> list = page != null ? page.Data : new List <ClinicarCheckResult>(); if (list == null || Convert.IsDBNull(list) || list.Count <= 0) { return; } if (!this.type.Equals(Util.image)) { return; } f_strAttachmentPath = list[0].AttachmentPath; DialogResult = DialogResult.OK; this.Close(); } //pdf else if (Util.showType(entityItem.DptName).Equals(Util.pdf)) { //检查科室表格绑定数据 SPagintion <ClinicarCheckResult> page = clinicarCheckResultBiz.FindByPagination(1, 100, entityCheck.CheckNumber, entityItem.ItemCode); IList <ClinicarCheckResult> list = page != null ? page.Data : new List <ClinicarCheckResult>(); if (list == null || Convert.IsDBNull(list) || list.Count <= 0) { return; } if (!this.type.Equals(Util.pdf)) { return; } f_strAttachmentPath = list[0].AttachmentPath; DialogResult = DialogResult.OK; this.Close(); } }
/// <summary> /// /// </summary> private void showResult(ClinicarCheckItem entity) { //检查结果表格绑定数据 SPagintion <ClinicarCheckResult> page = clinicarCheckResultBiz.FindByPagination(1, 100, uTxt_checkNumber.Text.Trim(), entity.ItemCode); IList <ClinicarCheckResult> list = page != null ? page.Data : new List <ClinicarCheckResult>(); this.imageOrPdfPath = string.Empty; //数据类展示(表格) if (Util.showType(entity.DptName).Equals(Util.data)) { //添加数据标签页 tabControl1.TabPages.Insert(0, tabPage1); //结果表有数据则查询结果表,没有数据则查询项目表 if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { //不自动生成列 this.dataGridView_Result.AutoGenerateColumns = false; this.dataGridView_Result.DataSource = list; this.f_blEdit = true; } else { SPagintion <ClinicarItemDetail> pageItem = clinicarItemDetailBiz.FindByPagination(1, 100, entity.ItemCode); IList <ClinicarItemDetail> listItem = pageItem != null ? pageItem.Data : new List <ClinicarItemDetail>(); //不自动生成列 this.dataGridView_Result.AutoGenerateColumns = false; this.dataGridView_Result.DataSource = listItem; this.f_blEdit = false; } } //图片类展示 else if (Util.showType(entity.DptName).Equals(Util.image)) { //添加图片类标签页 tabControl1.TabPages.Insert(0, tabPage2); //加载图片 if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { if (list[0].AttachmentPath != null && !list[0].AttachmentPath.Equals("")) { this.label9.Visible = false; try { pictureBox1.Image = Image.FromFile(Util.basePath + list[0].AttachmentPath); this.imageOrPdfPath = list[0].AttachmentPath; } catch { pictureBox1.Image = null; this.label9.Visible = true; } } else { pictureBox1.Image = null; this.label9.Visible = true; } } else { pictureBox1.Image = null; this.label9.Visible = true; } } //pdf类展示 else if (Util.showType(entity.DptName).Equals(Util.pdf)) { //添加pdf类标签页 tabControl1.TabPages.Insert(0, tabPage3); //加载pdf if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { if (list[0].AttachmentPath != null && !list[0].AttachmentPath.Equals("")) { this.label10.Visible = false; try { if (list[0].AttachmentPath.ToString().ToLower().EndsWith(".pdf")) { axAcroPDF1.LoadFile(Util.basePath + list[0].AttachmentPath); this.imageOrPdfPath = list[0].AttachmentPath; } else { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } catch { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } else { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } else { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } }
/// <summary> /// /// </summary> private void showResult(ClinicarCheck entityCheck, ClinicarCheckItem entity) { //检查科室表格绑定数据 SPagintion <ClinicarCheckResult> page = clinicarCheckResultBiz.FindByPagination(1, 100, entityCheck.CheckNumber, entity.ItemCode); IList <ClinicarCheckResult> list = page != null ? page.Data : new List <ClinicarCheckResult>(); //数据类展示(表格) if (Util.showType(entity.DptName).Equals(Util.data)) { //添加数据标签页 tabControl1.TabPages.Insert(0, tabPage1); //结果表有数据则查询结果表,没有数据则查询项目表 if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { SGridViewUtil.BindingData <ClinicarCheckResult>(list, this.dataGridView_result.UcDataGridViewControl, displayPropertiesRight); } } //图片类展示 else if (Util.showType(entity.DptName).Equals(Util.image)) { //添加图片类标签页 tabControl1.TabPages.Insert(0, tabPage2); //加载图片 if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { if (list[0].AttachmentPath != null && !list[0].AttachmentPath.Equals("")) { this.label9.Visible = false; try { pictureBox1.Image = Image.FromFile(Util.basePath + list[0].AttachmentPath); } catch { pictureBox1.Image = null; this.label9.Visible = true; } } else { pictureBox1.Image = null; this.label9.Visible = true; } } else { pictureBox1.Image = null; this.label9.Visible = true; } } //pdf类展示 else if (Util.showType(entity.DptName).Equals(Util.pdf)) { //添加pdf类标签页 tabControl1.TabPages.Insert(0, tabPage3); //加载pdf if (list != null && Convert.IsDBNull(list) == false && list.Count > 0) { if (list[0].AttachmentPath != null && !list[0].AttachmentPath.Equals("")) { this.label10.Visible = false; try { if (list[0].AttachmentPath.ToString().ToLower().EndsWith(".pdf")) { axAcroPDF1.LoadFile(Util.basePath + list[0].AttachmentPath); } else { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } catch { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } else { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } else { axAcroPDF1.LoadFile(""); this.label10.Visible = true; } } }