private void DgvBind() { DataTable dt = bPrint.GetList(GetWhere()); if (dt.Rows.Count > 0) { this.dgv_Print.DataSource = dt; this.gb_PromptInfo.Visible = false; this.dgv_Print.Visible = true; } else { this.dgv_Print.Visible = false; this.dgv_Print.DataSource = null; this.gb_PromptInfo.Visible = true; } }
/// <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); } }
private void BindPrintTemplate() { BPrintTemplateDict bpt = new BPrintTemplateDict(); string[] ExamClass = GetConfig.ExamClass.Split(','); string s = ""; foreach (string str in ExamClass) { s += "'" + str + "',"; } string where = ""; if (this.chk_ShowAll.Checked) { where = " EXAM_CLASS in (" + s.TrimEnd(',') + ") order by EXAM_CLASS "; } else { where = " EXAM_CLASS in (" + s.TrimEnd(',') + ") and EXAM_SUB_CLASS='" + this.temp.ExamSubClass + "' order by EXAM_CLASS "; } DataTable dt = bpt.GetList(where); dt.Columns.Add("IS_DEFAULT", typeof(string)); Template[] ts; if (GetConfig.RS_DefPrintTemp == "") { ts = new Template[1]; ts[0] = new Template(); ts[0].ExamClass = ""; ts[0].ExamSubClass = ""; ts[0].TemplateName = ""; } else { string[] temps = GetConfig.RS_DefPrintTemp.Split('|'); ts = new Template[temps.Length]; for (int i = 0; i < temps.Length; i++) { string[] t = temps[i].Split(','); ts[i] = new Template(); ts[i].ExamClass = t[0]; ts[i].ExamSubClass = t[1]; ts[i].TemplateName = t[2]; } } for (int i = 0; i < dt.Rows.Count; i++) { bool isDefault = false; for (int j = 0; j < ts.Length; j++) { if (dt.Rows[i]["EXAM_CLASS"].ToString() == ts[j].ExamClass && dt.Rows[i]["EXAM_SUB_CLASS"].ToString() == ts[j].ExamSubClass && dt.Rows[i]["PRINT_TEMPLATE"].ToString() == ts[j].TemplateName) { dt.Rows[i]["IS_DEFAULT"] = "是"; isDefault = true; break; } } if (!isDefault) { dt.Rows[i]["IS_DEFAULT"] = "否"; } } this.dgv_PrintTemplate.DataSource = dt; }