解决图片超过300多张加载不出来的问题

master
zengwh 5 years ago
parent 05f24abde1
commit 82a75bcab2

@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.emr.annotation.OptionalLog; import com.emr.annotation.OptionalLog;
import com.emr.dao.*; import com.emr.dao.*;
import com.emr.dao.approve.Emr_Apply_ApproveMapper; import com.emr.dao.approve.Emr_Apply_ApproveMapper;
import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper;
import com.emr.dao.tScanAssort.T_Scan_AssortMapper; import com.emr.dao.tScanAssort.T_Scan_AssortMapper;
import com.emr.entity.*; import com.emr.entity.*;
import com.emr.entity.emrLog.Emr_Log; import com.emr.entity.emrLog.Emr_Log;
import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet;
import com.emr.entity.recordType.Emr_Type; import com.emr.entity.recordType.Emr_Type;
import com.emr.entity.recordType.Emr_Type_Related; import com.emr.entity.recordType.Emr_Type_Related;
import com.emr.service.CommomService; import com.emr.service.CommomService;
@ -17,11 +19,13 @@ import com.emr.service.recordType.EmrTypeRelatedService;
import com.emr.service.recordType.EmrTypeService; import com.emr.service.recordType.EmrTypeService;
import com.emr.service.tScanAssort.T_Scan_AssortService; import com.emr.service.tScanAssort.T_Scan_AssortService;
import com.emr.util.ExceptionPrintUtil; import com.emr.util.ExceptionPrintUtil;
import com.emr.util.img2PdfUtil;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo; import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo;
import com.emr.vo.FontVo.ScanAssortVo; import com.emr.vo.FontVo.ScanAssortVo;
import com.emr.vo.commomSearch.*; import com.emr.vo.commomSearch.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -77,6 +81,8 @@ public class CommomSearchController {
private CommomService commomService; private CommomService commomService;
@Autowired @Autowired
private LogService logService; private LogService logService;
@Autowired
private EmrPdfWaterSetMapper pdfWaterSetMapper;
//祈福医院 //祈福医院
@RequiresPermissions("/commom/commomListqf") @RequiresPermissions("/commom/commomListqf")
@ -643,9 +649,32 @@ public class CommomSearchController {
*/ */
@RequestMapping(value = "showRecordContentBlood") @RequestMapping(value = "showRecordContentBlood")
@ResponseBody @ResponseBody
public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response) { public ResultUtil showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response,HttpServletRequest request) {
try {
commomService.showRecordContentBlood(patientId, scanPages, sources, flag, response,request);
return ResultUtil.ok();
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
return ResultUtil.error("showRecordContentBlood查询文件出错了");
}
}
@RequestMapping(value = "getRecordContentBlood")
@ResponseBody
public void getRecordContentBlood(String patientId,HttpServletRequest request,HttpServletResponse response) {
try { try {
commomService.showRecordContentBlood(patientId, scanPages, sources, flag, response); Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
String mapKey = user.getUserName() + "_" + patientId;
List<String> scanPages = (List<String>)request.getSession().getAttribute(mapKey);
if(!CollectionUtils.isEmpty(scanPages)) {
String pdfName = "档案管理PDF";
//根据图片路径转换pdf
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
img2PdfUtil.imageToPdf(response, scanPages, pdfName, emrPdfWaterSet);
//移除缓存
request.removeAttribute(mapKey);
}
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);
e.printStackTrace(); e.printStackTrace();

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.emr.dao.CommomMapper; import com.emr.dao.CommomMapper;
import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper; import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper;
import com.emr.entity.EmrComomSet; import com.emr.entity.EmrComomSet;
import com.emr.entity.Power_User;
import com.emr.entity.ResultUtil; import com.emr.entity.ResultUtil;
import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet; import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet;
import com.emr.entity.tScanAssort.T_Scan_Assort; import com.emr.entity.tScanAssort.T_Scan_Assort;
@ -162,8 +163,7 @@ public class CommomService {
//脐血库显示pdf //脐血库显示pdf
public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response) throws Exception { public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response,HttpServletRequest request) throws Exception {
String pdfName = "档案管理PDF";
if (StringUtils.isNotBlank(patientId)) { if (StringUtils.isNotBlank(patientId)) {
patientId = patientId.replace("\'", ""); patientId = patientId.replace("\'", "");
//查询 //查询
@ -200,9 +200,9 @@ public class CommomService {
} }
} }
if (!filePaths.isEmpty()) { if (!filePaths.isEmpty()) {
//根据图片路径转换pdf Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); String mapKey = user.getUserName() + "_" + patientId;
img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet); request.getSession().setAttribute(mapKey,filePaths);
} }
} }
} }

@ -255,7 +255,7 @@
</div> </div>
</div> </div>
<script type="text/javascript" <script type="text/javascript"
src="${path}/static/js/recordManage/commomSearch/showRecordIframeBlood.js"></script> src="${path}/static/js/recordManage/commomSearch/showRecordIframeBlood.js?t=2021-08-24"></script>
<script type="text/javascript" <script type="text/javascript"
src="${path}/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js"></script> src="${path}/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js"></script>
<script type="text/javascript" src="${path}/static/js/commom.js"></script> <script type="text/javascript" src="${path}/static/js/commom.js"></script>

@ -119,6 +119,36 @@ function onloadPdfMethod() {
//加载pdf按钮功能 //加载pdf按钮功能
function onloadPdf(scanPages, sources) { function onloadPdf(scanPages, sources) {
$("#iframeLoad").val("");
$("#printPicLoaded").val("");
var patientId = $("#patientId").val();
//根目录字段识别名称
var flag = parent.$("#flag").val();
$.ajax({
type: 'post',
url: path + "/commom/showRecordContentBlood",
data: {
patientId: patientId,
scanPages: scanPages,
flag: flag,
sources: sources
},
datType: 'json',
success: function (data) {
if (data.code == 0) {
var str = path + "/commom/getRecordContentBlood?patientId=" + patientId;
$("#iframe1").attr("src", path + "/static/pdfjs/web/viewer1.html?file=" + encodeURIComponent(str));
var rootPaths = parent.$("#rootPaths").val();
//加载的图片
var print = $("#print").val();
if (scanPages != '' && print == 1) {
selectPrintPic(patientId, rootPaths, scanPages, sources);
}
}
}
})
}
/*function onloadPdf(scanPages, sources) {
$("#iframeLoad").val(""); $("#iframeLoad").val("");
$("#printPicLoaded").val(""); $("#printPicLoaded").val("");
var patientId = $("#patientId").val(); var patientId = $("#patientId").val();
@ -132,7 +162,7 @@ function onloadPdf(scanPages, sources) {
if (scanPages != '' && print == 1) { if (scanPages != '' && print == 1) {
selectPrintPic(patientId, rootPaths, scanPages, sources); selectPrintPic(patientId, rootPaths, scanPages, sources);
} }
} }*/
var iframe = document.getElementById("iframe1"); var iframe = document.getElementById("iframe1");

Loading…
Cancel
Save