bug:修复pdf批量下载问题

master
jian.wang 2 years ago
parent 023cae2fc1
commit 40099c3ac4

@ -871,7 +871,7 @@ public class TemplateSearchController {
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
if (!sortNames.equals("id")){
if (sortNames.equals("disDate")){
orderBys="order by commomtable.inpatient_no"+" "+sortOrder +",commomtable.dis_date"+" "+sortOrder;
orderBys="order by commomtable.dis_date"+" "+sortOrder;
}
if (sortNames.equals("admissDate")){
orderBys="order by commomtable.admiss_date"+" "+sortOrder;
@ -1317,7 +1317,7 @@ public class TemplateSearchController {
//封装下载pdf压缩包方法
private void downloadPdfZip(HttpServletResponse response, String zipName, Set<ScanPathForPatientListVo> list) {
response.reset();
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setContentType("application/zip;charset=UTF-8");
ZipOutputStream zos = null;
BufferedOutputStream bos = null;
ByteArrayOutputStream out = null;
@ -1336,8 +1336,7 @@ public class TemplateSearchController {
}
List<String> scanPathList = vo.getScanPathList();
//每个文件名
String name = java.net.URLEncoder.encode(vo.getName(), "UTF-8");
String fileName = vo.getInpatientNo().trim() + "-" + name.trim() + "-" + disDate.trim() + "_" + fmt.format(new Date());
String fileName = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date());
zos.putNextEntry(new ZipEntry(fileName + ".pdf"));
//合成pdf
out = new ByteArrayOutputStream();
@ -1346,7 +1345,7 @@ public class TemplateSearchController {
bis = new BufferedInputStream(new ByteArrayInputStream(file));
//输出
int len = 0;
byte[] buf = new byte[1024 * 1024];
byte[] buf = new byte[100 * 1024];
while ((len = bis.read(buf, 0, buf.length)) != -1) {
bos.write(buf, 0, len);
}

@ -610,7 +610,7 @@ public class CommomService {
* @param sources
* @return
*/
public List<String> selectPrintPic(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, String mapKey) {
public List<String> selectPrintPic(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, String mapKey) throws IOException {
//获取登录用户信息
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// 从session获取用户名
@ -662,10 +662,12 @@ public class CommomService {
//需要水印
//组织加水印后图片存放目录
String waterPicRoot = WATERPICPATH + patientId + File.separator + sourceList[i] + File.separator;//D:/jiashi/reload/patientId/1/
//目录不存在则创建
if (!new File(waterPicRoot).isDirectory()) {
new File(waterPicRoot).mkdirs();
}else{
FileUtils.deleteDirectory(new File(WATERPICPATH));
new File(waterPicRoot).mkdirs();
}
//组织加水印后图片存放地址
String waterPicPath = waterPicRoot + nameList[i];
@ -681,7 +683,6 @@ public class CommomService {
//组织输出地址
String root = selectRootByNotWater(WATERPICPATH);
outSrc = EMRRECORDJSP + File.separator + root + "/jiashi/reload/" + patientId + File.separator + sourceList[i] + File.separator + nameList[i];
//http://192.168.199.124:8080/emr_record/reloadD\/jiashi/reload/patientId/1/
}
} else {
//不需要水印
@ -693,6 +694,9 @@ public class CommomService {
//保存目录不存在新增
if (!new File(WATERTIFTOJPGPATH).isDirectory()) {
new File(WATERTIFTOJPGPATH).mkdirs();
}else{
FileUtils.deleteDirectory(new File(WATERPICPATH));
new File(WATERTIFTOJPGPATH).mkdirs();
}
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
@ -707,14 +711,18 @@ public class CommomService {
root = selectRootByNotWater(WATERTIFTOJPGPATH);
outSrc = EMRRECORDJSP + File.separator + root + "/jiashi/tifToJpgLoad/" + format1 + ".jpg";
} else {
srcPath = srcPath.replaceAll("\\\\","/");
//截取字符串为磁盘路径
int thirdBackslashIndex = srcPath.indexOf('/', srcPath.indexOf('/', srcPath.indexOf('/') + 1) + 1);
if (thirdBackslashIndex != -1) {
srcPath = srcPath.substring(thirdBackslashIndex+1);
}
//将原图片地址转换成映射地址
//获取盘符并转换映射地址的头部地址
//root = selectRootByNotWater(srcPath);
root = selectRootByNotWater(srcPath);
//获取盘符后面的地址
// String str1 = srcPath.substring(0, srcPath.indexOf(File.separator));
//picPath = srcPath.substring(str1.length() + 1, srcPath.length());
//outSrc = EMRRECORDJSP + File.separator + root + picPath;
outSrc = "\\"+ picPath;
picPath = srcPath.substring(srcPath.indexOf('/'));
outSrc = EMRRECORDJSP + File.separator + root + File.separator + picPath;
}
}
outs.add(outSrc);

@ -51,6 +51,7 @@ var menu = {
}else{
if(data[1] != undefined ){
scanPages = data[1].assortName;
sources = '1';
$("#sources").val('1');
}
}

Loading…
Cancel
Save