/// <summary> /// 当DateTimeShow相同时 下面的DateTimeShow不显示 /// </summary> /// <param name="printInCommonView"></param> private void ConvertForDateTime(PrintInCommonView printInCommonView) { if (printInCommonView != null || printInCommonView.PrintInCommonTabViewList1 != null) { InCommonNoteBiz.ConvertForDateTime(printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList); } }
/// <summary> /// 打印全部事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void printDocumentPre_PrintPage(object sender, PrintPageEventArgs e) { try { if (m_printInCommonView == null || m_printInCommonView.PrintInCommonTabViewList1 == null) { return; } if (m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList == null) { m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = new List <PrintInCommonItemView>(); } int PageRecordCount = iPrintNurse.PageRecordCount; //每张的行数 var PrintInCommonItemViewList = m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList; int allcount = PrintInCommonItemViewList.Count; int pageCount = (allcount + PageRecordCount - 1) / PageRecordCount; //总页数 if (pageCount == 0) { pageCount = 1; } List <PrintInCommonItemView> printInCommonItemViewEven = new List <PrintInCommonItemView>(); for (int j = printPageNowPer * PageRecordCount; j < ((printPageNowPer + 1) * PageRecordCount); j++) { if (j < allcount) { PrintInCommonItemViewList[j].RowNum = j + 1; InCommonNoteBiz.ConvertForImgRec(PrintInCommonItemViewList[j]); printInCommonItemViewEven.Add(PrintInCommonItemViewList[j]); } } InCommonNoteBiz.ConvertForDateTime(printInCommonItemViewEven); InCommonNoteBiz.SetRowEnd(printInCommonItemViewEven, m_printInCommonView.PrintFileName); RecordPrintView recordPrintView = ConvertPrintView(m_printInCommonView); recordPrintView.PrintInpatientView.ListCount = printInCommonItemViewEven.Count.ToString(); int Addpage = Convert.ToInt32(speNum.Value); recordPrintView.PrintInpatientView.CurrPage = (printPageNowPer + Addpage).ToString(); recordPrintView.PrintInCommonItemViewList = printInCommonItemViewEven; iPrintNurse.GetPreview(recordPrintView, e.Graphics); if (printPageNowPer < pageCount - 1 && printPageNowPer < printEnd - 1) { e.HasMorePages = true; printPreviewControl1.Rows += 1; printPageNowPer++; return; } else { spinEditPage.Properties.MinValue = (int)speNum.Value; spinEditPage.Properties.MaxValue = pageCount + (int)speNum.Value - 1; printPageNowPer = 0; e.HasMorePages = false; } } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.Message + ex.StackTrace); } }
/// <summary> /// 打印指定列事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void printDocumentPrintNow_PrintPage(object sender, PrintPageEventArgs e) { try { if (m_printInCommonView == null || m_printInCommonView.PrintInCommonTabViewList1 == null) { return; } if (m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList == null) { m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = new List <PrintInCommonItemView>(); } var PrintInCommonItemViewList = m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList; int allcount = PrintInCommonItemViewList.Count; int PageRecordCount = iPrintNurse.PageRecordCount; //每张的行数 int pageIndex = (int)spinEditPage.Value - (int)speNum.Value + 1; //实际打印页码需要重新计算 List <PrintInCommonItemView> printInCommonItemViewEven = new List <PrintInCommonItemView>(); for (int j = (pageIndex - 1) * PageRecordCount; j < (pageIndex * PageRecordCount); j++) { if (j < allcount) { PrintInCommonItemViewList[j].RowNum = j + 1; printInCommonItemViewEven.Add(PrintInCommonItemViewList[j]); } } InCommonNoteBiz.ConvertForDateTime(printInCommonItemViewEven); InCommonNoteBiz.SetRowEnd(printInCommonItemViewEven, m_printInCommonView.PrintFileName); RecordPrintView recordPrintView = ConvertPrintView(m_printInCommonView); recordPrintView.PrintInpatientView.ListCount = printInCommonItemViewEven.Count.ToString(); int Addpage = Convert.ToInt32(speNum.Value); recordPrintView.PrintInpatientView.CurrPage = (pageIndex + Addpage - 1).ToString(); recordPrintView.PrintInCommonItemViewList = printInCommonItemViewEven; iPrintNurse.GetPreview(recordPrintView, e.Graphics); e.HasMorePages = false; } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.Message + ex.StackTrace); } }
/// <summary> /// 将数据对象转诊打印对象 用于绑定到控件进行打印预览 /// </summary> /// <returns></returns> private PrintInCommonView ConvertPrintEntity() { //inCommonNoteBiz.GetDetaliInCommonNote(ref m_inCommonNote); PrintInCommonView printInCommonView = new CommonNoteUse.PrintInCommonView(); printInCommonView.PrintFileName = m_inCommonNote.PrinteModelName; printInCommonView.IncommonNoteflow = m_inCommonNote.InCommonNoteFlow; printInCommonView.RecordName = m_commonNoteEntity.CommonNoteName; //病人的基本信息构造 if (inCommonNoteBiz == null) { inCommonNoteBiz = new InCommonNoteBiz(m_app); } DataTable inpatientDt = inCommonNoteBiz.GetInpatient(m_inCommonNote.NoofInpatient); PrintInpatientView printInpatientView = new CommonNoteUse.PrintInpatientView(); printInpatientView.HospitalName = m_app.CurrentHospitalInfo.Name; printInpatientView.SubHospitalName = m_app.CurrentHospitalInfo.Subname; printInpatientView.AdmitDiagnosis = inpatientDt.Rows[0]["DIAGNOSISNAME"].ToString(); printInpatientView.Depart = m_inCommonNote.CurrDepartName; printInpatientView.InBedNo = inpatientDt.Rows[0]["OUTBED"].ToString(); printInpatientView.RecordName = m_inCommonNote.InCommonNoteName; if (inpatientDt.Rows[0]["INWARDDATE"].ToString().Length >= 10) { printInpatientView.InDateTime = inpatientDt.Rows[0]["INWARDDATE"].ToString().Substring(0, 10); } printInpatientView.InNo = inpatientDt.Rows[0]["PATID"].ToString(); printInpatientView.OutNo = inpatientDt.Rows[0]["NOOFCLINIC"].ToString(); printInpatientView.PatId = inpatientDt.Rows[0]["PATNOOFHIS"].ToString(); printInpatientView.InpatientAge = inpatientDt.Rows[0]["AGESTR"].ToString(); printInpatientView.InpatientName = inpatientDt.Rows[0]["NAME"].ToString(); printInpatientView.Sex = inpatientDt.Rows[0]["SEX"].ToString(); printInpatientView.Ward = m_inCommonNote.CurrWardName; printInCommonView.PrintInpatientView = printInpatientView; if (m_inCommonNote.InCommonNoteTabList == null) { return(printInCommonView); } for (int i = 0; i < m_inCommonNote.InCommonNoteTabList.Count; i++) { CommonNote_TabEntity commonNote_TabEntity = null; foreach (var itemTab in m_commonNoteEntity.CommonNote_TabList) { if (itemTab.CommonNote_Tab_Flow == m_inCommonNote.InCommonNoteTabList[i].CommonNote_Tab_Flow) { commonNote_TabEntity = itemTab; break; } } PrintInCommonTabView printInCommonTabView = new CommonNoteUse.PrintInCommonTabView(); //主要目的是给这个对象复制 Dictionary <string, List <InCommonNoteItemEntity> > dicitemList; List <string> strNames = InCommonNoteBiz.ConvertInCommonTabToPrint(m_inCommonNote.InCommonNoteTabList[i], printInCommonTabView, out dicitemList, commonNote_TabEntity, m_app, m_inCommonNote); string proName = "PrintInCommonTabViewList"; proName = proName + (i + 1); PropertyInfo property = printInCommonView.GetType().GetProperty(proName); if (property != null) { property.SetValue(printInCommonView, printInCommonTabView, null); } if (i == 0 && m_inCommonNote.InCommonNoteTabList[i] != null) { ConverToDuoRow(printInCommonView); //ConvertForDuoLie(printInCommonView); IPrintNurse iPrintNurse = AbstractorFactry.GetNurseRecord(printInCommonView.PrintFileName); if (iPrintNurse != null) { iPrintNurse.commonNoteCountEntity = CommonNoteBiz.GetCommonNoteCount(m_commonNoteEntity.CommonNoteFlow); printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = iPrintNurse.JiSuanZongLiang(printInCommonView); } else { if (printInCommonView != null && printInCommonView.PrintInCommonTabViewList1 != null && printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList != null) { InCommonNoteBiz.ConvertForDateTime(printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList); InCommonNoteBiz.SetRowEnd(printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList, printInCommonView.PrintFileName); } } //xll 2013-01-12 处理相同时间数据 //ConvertForDateTime(printInCommonView); } } return(printInCommonView); }