public SaveReportCls(SIS_Model.MWorkList worklist, SIS_Model.MReport mReport, List <ImgObj> arrayImg) { this.mWorkList = worklist; this.mReport = mReport; //this.xFramerControl1 = xFramerControl1; ServerPath = GetConfig.ServerImgDir + "/" + Convert.ToDateTime(worklist.REQ_DATE_TIME).ToString("yyyyMMdd") + "/" + worklist.EXAM_ACCESSION_NUM; //SaveReport(); //SaveImage(arrayImg,worklist); }
/// <summary> /// 上传图片到服务器并更新数据库 /// </summary> /// <param name="sFilePath"></param> /// <param name="localpath"></param> /// <returns>0:上传失败,1:上传成功,-1:其它错误</returns> public int FileUpLoad(MImage model, string localpath, bool isMarkImg) { try { int i = -2; if (isMarkImg) { i = fileTranfer.FileUpLoad(model.MARK_IMAGE_PATH, localpath); } else { i = fileTranfer.FileUpLoad(model.IMAGE_PATH, localpath); } if (i < 0) { return(0); } int imageId = -1; if (model.IMAGE_ID == null) { i = Bimage.Add(model, ref imageId); model.IMAGE_ID = imageId; } else { i = Bimage.Update(model, "where IMAGE_ID=" + model.IMAGE_ID); } if (i < 0) { return(0); } if (!isMarkImg) { SIS_Model.MWorkList mWorkList = (SIS_Model.MWorkList)bWorkList.GetModel(model.EXAM_ACCESSION_NUM); if (mWorkList.IMAGE_COUNTS == null) { mWorkList.IMAGE_COUNTS = 1; } else { mWorkList.IMAGE_COUNTS += 1; } bWorkList.Update(mWorkList, " where EXAM_ACCESSION_NUM = '" + mWorkList.EXAM_ACCESSION_NUM + "'"); } return(1);// } catch { return(-1); } }
/// <summary> /// 保存图片并记录入图片表(注意是否打勾) /// </summary> /// <param name="arrayImg"></param> public bool SaveImage(List <ImgObj> arrayImg, SIS_Model.MWorkList worklist) { bool isSuccess = true; int j = 0; for (int i = 0; i < arrayImg.Count; i++) { ImgObj obj = (ImgObj)arrayImg[i]; MImage model = (MImage)obj.MImage; if (model == null) { model = new MImage(); model.IMAGE_PATH = CreateServerPath(obj.ImagePath); model.EXAM_ACCESSION_NUM = worklist.EXAM_ACCESSION_NUM; } else { model.IMAGE_PATH = CreateServerPath(obj.ImagePath); } model.IS_PRINT = (obj.IsCheck == true ? 1 : 0); model.IMAGE_DATE = System.DateTime.Now; if (obj.IsDeleted) { imgCopy.DeleteImg(model); } else { if (imgCopy.FileUpLoad(model, obj.ImagePath, false) != 1) { // MessageBox.Show("图片" + obj.ImagePath + "保存失败,请检查网络连接情况", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); isSuccess = false; } else { j++; } } } worklist.IMAGE_COUNTS = j; return(isSuccess); }
/// <summary> /// 删除图片 /// </summary> /// <param name="model"></param> /// <returns></returns> public int DeleteImg(MImage model) { if (Bimage.Delete(" where IMAGE_ID=" + model.IMAGE_ID.ToString()) >= 0) { SIS_Model.MWorkList mWorkList = (SIS_Model.MWorkList)bWorkList.GetModel(model.EXAM_ACCESSION_NUM); if (mWorkList.IMAGE_COUNTS == null) { mWorkList.IMAGE_COUNTS = 0; } else { mWorkList.IMAGE_COUNTS -= 1; } if (mWorkList.IMAGE_COUNTS < 0) { mWorkList.IMAGE_COUNTS = 0; } bWorkList.Update(mWorkList, " where EXAM_ACCESSION_NUM = '" + mWorkList.EXAM_ACCESSION_NUM + "'"); } return(0); }
/// <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); } }