private void fillListByReportDr(DataRow dr, LisReportResult temp) { temp.ReportDate = dr["checkdate"].ToString(); temp.SerialNo = dr["serialno"].ToString(); temp.SectionNo = dr["sectionno"].ToString(); temp.PrintName = dr["paritemname"].ToString(); temp.SickType = dr["sicktypeno"].ToString(); }
private void fillListByPDFDr(DataRow dr, LisReportResult temp, int status) { temp.FileName = dr["FileName"].ToString() + dr["FileType"].ToString(); temp.FilePath = dr["FilePath"].ToString(); temp.ReportDate = dr["ReportDate"].ToString(); temp.SerialNo = dr["SerialNo"].ToString(); temp.SectionNo = dr["SectionNo"].ToString(); temp.PrintName = dr["ReportName"].ToString(); temp.SickType = dr["SickType"].ToString(); temp.ReportStatus = status; }
protected virtual List <IResult> CheckPDFResult(DataTable dt) { LOG.Info("开始:以数据库记录为基准,查询记录对应PDF文件是否存在"); LisReportResult temp; string checkPath, fileName; List <IResult> lisResult = new List <IResult>(); foreach (DataRow dr in dt.Rows) { temp = new LisReportResult(); //根据数据路记录填充一些基本信息 fillListByReportDr(dr, temp); checkPath = getCheckPath(dr); if (checkPath != null) { //填充路径 temp.FilePath = checkPath; LOG.Info("数据库记录对应路径存在-->" + checkPath); fileName = getFileName(dr); if (fileName != null && fileName != "") { //填充文件名 temp.FileName = fileName; string fullPath = Path.Combine(checkPath, fileName); if (!SuperFile.fileExist(fullPath)) { LOG.Error("文件名为-->" + fileName + ",文件全路径为-->" + fullPath + ",的文件不存在!!!"); //文件路径存在,文件不存在 temp.ReportStatus = 1; temp.FileQuality = 2; } else { //路径存在,文件存在 temp.ReportStatus = 0; temp.FileQuality = 0; } } else { LOG.Warn("数据库中对应的文件名字段为空!!!"); LOG.Info("进入文件名模糊匹配流程"); fileName = getFileNameLike(dr); LOG.Info("获得的模糊文件名为-->" + fileName); List <string> fileNames = getPDFFromFS(checkPath, fileName); if (fileNames.Count == 0) { temp.ReportStatus = 1; temp.FileQuality = 2; LOG.Error("未找到匹配的PDF文件!!!"); } else { //路径存在,文件存在(文件质量差) temp.ReportStatus = 0; temp.FileQuality = 1; temp.FileName = fileNames[0]; LOG.Warn("查找到匹配文件,请核实正确性!请查实数据库中对应的文件名字段为空原因!!"); } LOG.Info("退出文件名模糊匹配流程"); } } //文件路径不存在 else { temp.ReportStatus = 2; temp.FileQuality = 2; } lisResult.Add(temp); } LOG.Info("结束:以数据库记录为基准,查询记录对应PDF文件是否存在"); return(lisResult); }