private void btn_Ok_Click(object sender, EventArgs e) { string temps = ""; for (int i = 0; i < this.dgv_PrintTemplate.Rows.Count; i++) { if (this.dgv_PrintTemplate.Rows[i].Cells["IS_DEFAULT"].Value.ToString() == "是") { temps += this.dgv_PrintTemplate.Rows[i].Cells["EXAM_CLASS"].Value.ToString() + "," + this.dgv_PrintTemplate.Rows[i].Cells["EXAM_SUB_CLASS"].Value.ToString() + "," + this.dgv_PrintTemplate.Rows[i].Cells["PRINT_TEMPLATE"].Value.ToString() + "|"; } } GetConfig.SetRS_DefPrintTemp(temps.TrimEnd('|')); if (this.dgv_PrintTemplate.SelectedRows.Count > 0) { //if (this.dgv_PrintTemplate.SelectedRows[0].Cells["EXAM_CLASS"].Value.ToString() == this.temp.ExamClass && // this.dgv_PrintTemplate.SelectedRows[0].Cells["EXAM_SUB_CLASS"].Value.ToString() == this.temp.ExamSubClass && // this.dgv_PrintTemplate.SelectedRows[0].Cells["PRINT_TEMPLATE"].Value.ToString() != this.temp.TemplateName) if (this.dgv_PrintTemplate.SelectedRows[0].Cells["EXAM_CLASS"].Value.ToString() == this.temp.ExamClass && this.dgv_PrintTemplate.SelectedRows[0].Cells["EXAM_SUB_CLASS"].Value.ToString() == this.temp.ExamSubClass) { string filter = "PRINT_TEMPLATE_ID=" + this.dgv_PrintTemplate.SelectedRows[0].Cells["PRINT_TEMPLATE_ID"].Value.ToString(); DataRow dr = ((DataTable)this.dgv_PrintTemplate.DataSource).Select(filter)[0]; BPrintTemplateDict bpt = new BPrintTemplateDict(); this.mpt = (MPrintTemplateDict)bpt.GetModel(dr); } } this.DialogResult = DialogResult.OK; }
private void dgv_Print_DoubleClick(object sender, EventArgs e) { if (this.dgv_Print.SelectedRows.Count <= 0) { return; } cmb_ExamClass.SelectedValue = this.dgv_Print.SelectedRows[0].Cells["EXAM_CLASS"].Value.ToString(); cmb_ExamSubClass.SelectedValue = this.dgv_Print.SelectedRows[0].Cells["EXAM_SUB_CLASS"].Value.ToString(); mPrint = (MPrintTemplateDict)(bPrint.GetModel(this.dgv_Print.SelectedRows[0].Cells["PRINT_TEMPLATE_ID"].Value.ToString())); tx_TempName.Text = mPrint.PRINT_TEMPLATE; this.winWordControl.QuitWord(); FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); fs.Write(mPrint.FILE_NAME, 0, mPrint.FILE_NAME.Length); fs.Close(); if (word.WordOpen(path) == -1) { MessageBox.Show("打开模版失败,请重新打开!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 下载报告 /// </summary> /// <returns></returns> public IModel ReportDownLoad(IModel iWorklist, string saveDir) { string ReportPath = saveDir + "\\report.doc"; try { if (GetConfig.DALAndModel == "SIS") { SIS_Model.MWorkList mWorklist = (SIS_Model.MWorkList)iWorklist; SIS_Model.MReport mReport = (SIS_Model.MReport)bReport.GetModel(mWorklist.EXAM_ACCESSION_NUM); if (mReport == null || mReport.REPORT_NAME == null) { if (mReport == null) { mReport = new SIS_Model.MReport(); } SIS_Model.MPrintTemplateDict mPrint = (SIS_Model.MPrintTemplateDict)bPrint.GetModel(mWorklist.EXAM_CLASS, mWorklist.EXAM_SUB_CLASS); if (mPrint != null) { FileOp.FileSave(mPrint.FILE_NAME, ReportPath); mReport.FIELD_INF = mPrint.FIELD_INF; mReport.PRINT_TEMPLATE = mPrint.PRINT_TEMPLATE; } else//无此检查类别,检查子类的打印模版时,下载此检查类别下的默认打印模版 { DataTable dt = bPrint.GetList("EXAM_CLASS = '" + mWorklist.EXAM_CLASS + "'"); if (dt.Rows.Count > 0) { mPrint = (SIS_Model.MPrintTemplateDict)bPrint.GetModel(dt.Rows[0]); FileOp.FileSave(mPrint.FILE_NAME, ReportPath); mReport.FIELD_INF = mPrint.FIELD_INF; mReport.PRINT_TEMPLATE = mPrint.PRINT_TEMPLATE; } else { return(null); } } } else { FileOp.FileSave(mReport.REPORT_NAME, ReportPath); } return(mReport); } else { PACS_Model.MWorkList mWorklist = (PACS_Model.MWorkList)iWorklist; PACS_Model.MReport mReport = (PACS_Model.MReport)bReport.GetModel(mWorklist.EXAM_ACCESSION_NUM); if (mReport == null || mReport.REPORT_NAME == null) { if (mReport == null) { mReport = new PACS_Model.MReport(); } PACS_Model.MPrintTemplateDict mPrint = (PACS_Model.MPrintTemplateDict)bPrint.GetModel(mWorklist.EXAM_CLASS, mWorklist.EXAM_SUB_CLASS); if (mPrint != null) { FileOp.FileSave(mPrint.FILE_NAME, ReportPath); mReport.FIELD_INF = mPrint.FIELD_INF; mReport.PRINT_TEMPLATE = mPrint.PRINT_TEMPLATE; } else//无此检查类别,检查子类的打印模版时,下载此检查类别下的默认打印模版 { DataTable dt = bPrint.GetList("EXAM_CLASS = '" + mWorklist.EXAM_CLASS + "'"); if (dt.Rows.Count > 0) { mPrint = (PACS_Model.MPrintTemplateDict)bPrint.GetModel(dt.Rows[0]); FileOp.FileSave(mPrint.FILE_NAME, ReportPath); mReport.FIELD_INF = mPrint.FIELD_INF; mReport.PRINT_TEMPLATE = mPrint.PRINT_TEMPLATE; } else { return(null); } } } else { FileOp.FileSave(mReport.REPORT_NAME, ReportPath); } return(mReport); } } catch { return(null); } }