删除页

master
hujl 4 years ago
parent ea962f2f36
commit 803a57c57e

@ -10,19 +10,16 @@ import com.emr.annotation.OptionalLog;
import com.emr.entity.*;
import com.emr.service.*;
import com.emr.util.*;
import com.github.pagehelper.util.StringUtil;
import com.itextpdf.text.pdf.PdfReader;
import com.lowagie.text.DocumentException;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.io.FileUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
@ -60,6 +57,9 @@ public class inHospitalController {
@Autowired
private Zd_AssortService zd_assortService;
@Autowired
private Archive_Detail_PictureService archiveDetailPictureService;
@Resource
private LogService logService;
@ -75,6 +75,10 @@ public class inHospitalController {
@Value("${pdfErrorUrl}")
private String pdfErrorUrl;
//@Value("${pdfDelPicUrl}")
//private String pdfDelPicUrl;
@RequestMapping(value = "/inHospitals")
public String inHospitals(Model model) {
return "inHospitalDir/inHositalList";
@ -153,21 +157,32 @@ public class inHospitalController {
if (file2.exists() && file2.isFile()) {
file2.delete();
}
if(detail.getRecoverPdfPath()!=null &&detail.getRecoverPdfPath()!="") {
File file3 = new File(detail.getRecoverPdfPath());
if (file3.exists() && file3.isFile()) {
file3.delete();
}
}
}
}
int bol=archiveDetailService.delById(archiveDetail.getId());
//http://127.0.0.1:8080/emr_medical_record/static/img/login.jpg
// 项目在容器中实际发布运行的根路径
String realPath = request.getSession().getServletContext().getRealPath("/");
// 设置存放图片文件的路径
String pdfDelPicUrl = "static\\img\\delPicImg\\";
int bol = archiveDetailService.delById(archiveDetail.getId());
//备份都删除
if(bol==1){
Archive_Detail archiveDetailV=new Archive_Detail();
archiveDetailV.setMasterid(detail.getMasterid());
archiveDetailV.setFlag("1");
archiveDetailV.setAssortid(detail.getAssortid());
archiveDetailV.setSource(detail.getSource());
String oldPath=detail.getPdfPath();
String newPath=oldPath.substring(0,oldPath.lastIndexOf("\\")+1);
String newName=oldPath.substring(oldPath.lastIndexOf("\\")+1,oldPath.length());
archiveDetailV.setPdfPath(newPath+"%备份_"+newName);
archiveDetailService.delByClo(archiveDetailV);
if (bol == 1) {
Archive_Detail_Picture archiveDetailPicture = new Archive_Detail_Picture();
archiveDetailPicture.setParentId(archiveDetail.getId());
if (archiveDetail.getPdfPath() != null && archiveDetail.getPdfPath() != "") {
archiveDetailPicture.setMaxPicture("static\\img\\delPicImg\\" + archiveDetail.getPdfPath() + "\\" + archiveDetail.getPdfPath() + "_");
}
archiveDetailPictureService.deleteByCol(archiveDetailPicture);
//删除图片
//将之前文件删除
File file = new File(realPath + pdfDelPicUrl + archiveDetail.getPdfPath() + "\\");
PrintToPdfUtil.delete(file);
}
@ -232,7 +247,7 @@ public class inHospitalController {
}
//2021-03-15更新优化
private String GeneratePDFFileByAssortID(String masterId, String assortID, String realPath,String flag) throws Exception {
private String GeneratePDFFileByAssortID(String masterId, String assortID, String realPath, String flag) throws Exception {
List<MergePDFItem> pdfList = new ArrayList();
Archive_Detail archiveDetail = new Archive_Detail();
archiveDetail.setFlag(flag);
@ -243,30 +258,30 @@ public class inHospitalController {
List<Archive_Detail> errorPdfList = new ArrayList<>();
int size = 0;
if (arList == null || arList.size()==0) {
if (arList == null || arList.size() == 0) {
return "";
}
for (int m = 0; m < arList.size(); m++) {
MergePDFItem mergePDFItem = new MergePDFItem();
String str = arList.get(m).getPdfPath();
if (str != "" && str != null) {
if (str.indexOf("..\\static\\img\\pdfFiles\\") != -1) {
str = str.split("pdfFiles")[1];
str = realPath + "pdfFiles" + str;
}
if (!PrintToPdfUtil.checkPdfFile(str)) {
arList.get(m).setPdfPath(str);
errorPdfList.add(arList.get(m));
} else {
mergePDFItem.setPdfPath(str);
mergePDFItem.setdObj(arList.get(m));
pdfList.add(mergePDFItem);
}
for (int m = 0; m < arList.size(); m++) {
MergePDFItem mergePDFItem = new MergePDFItem();
String str = arList.get(m).getPdfPath();
if (str != "" && str != null) {
if (str.indexOf("..\\static\\img\\pdfFiles\\") != -1) {
str = str.split("pdfFiles")[1];
str = realPath + "pdfFiles" + str;
}
if (!PrintToPdfUtil.checkPdfFile(str)) {
arList.get(m).setPdfPath(str);
errorPdfList.add(arList.get(m));
} else {
mergePDFItem.setPdfPath(str);
mergePDFItem.setdObj(arList.get(m));
pdfList.add(mergePDFItem);
}
}
}
String pdfFileName = String.valueOf(System.currentTimeMillis());
String pdfPath = autoPdfUrl.trim() + "/" + pdfFileName + ".pdf";
String pdfPath = autoPdfUrl.trim() + "/" + pdfFileName + ".pdf";
if (pdfList.size() > 0) {
//对所有地址的pdf进行合成
@ -283,7 +298,6 @@ public class inHospitalController {
}
/**
* idPDFpdf
*
@ -296,7 +310,7 @@ public class inHospitalController {
*/
@ResponseBody
@RequestMapping(value = "/getPdfToPdf")
public String getPdfToPdf(HttpServletResponse response, HttpServletRequest request, String imgStr, String masterId,String flag) throws Exception {
public String getPdfToPdf(HttpServletResponse response, HttpServletRequest request, String imgStr, String masterId, String flag) throws Exception {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String result = "";
@ -334,10 +348,9 @@ public class inHospitalController {
}
}
for (int i = zds.size()-1; i >=0 ; i--) {
for (int i = zds.size() - 1; i >= 0; i--) {
String a = zds.get(i).getAssortId();
if(imgList.indexOf(a)==-1)
{
if (imgList.indexOf(a) == -1) {
zds.remove(i);
}
@ -347,19 +360,17 @@ public class inHospitalController {
for (int i = 0; i < zds.size(); i++) {
String asordID = zds.get(i).getAssortId();
String pdfA = GeneratePDFFileByAssortID(masterId, asordID, realPath,flag);
if(pdfA=="" || pdfA.length()==0)
{
String pdfA = GeneratePDFFileByAssortID(masterId, asordID, realPath, flag);
if (pdfA == "" || pdfA.length() == 0) {
continue;
}
fileList.add(pdfA);
}
if(fileList.size()==0)
{
if (fileList.size() == 0) {
return "";
}
String pdfPath = autoPdfUrl.trim() + "/" + String.valueOf(System.currentTimeMillis()) + ".pdf";
String pdfPath = autoPdfUrl.trim() + "/" + String.valueOf(System.currentTimeMillis()) + ".pdf";
PDFHelper.Append(fileList, pdfPath);
//PrintToPdfUtil.mergePdfFiles(fileList, pdfPath);
return pdfPath;
@ -524,11 +535,11 @@ public class inHospitalController {
}
if (pdfList.size() > 0) {
//if (errorPdfList.size() != size) {
//对所有地址的pdf进行合成
PrintToPdfUtil.mergePdfFiles(pdfList, pdfPath);
result = pdfPath;
//对所有地址的pdf进行合成
PrintToPdfUtil.mergePdfFiles(pdfList, pdfPath);
result = pdfPath;
//} else {
// result = "";
// result = "";
//}
if (errorPdfList.size() > 0) {
ExportTxtPaper.exportTxtPaper(pdfErrorUrl, "不存在或损坏PDF文件列表" + pdfFile + ".txt", errorPdfList);
@ -589,36 +600,36 @@ public class inHospitalController {
}
String pdfPath = realPath + entity.getRelationId() + "\\" + entity.getAssortId() + "\\" + entity.getAssortId() + ".pdf";
// if (msg.equals("文件未被操作!")) {
//将之前文件删除
File file = new File(pdfPath);
if (file1.exists() && file1.isFile()) {
file1.delete();
}
//重新生成pdf
//读取指定路径下的文件名和目录名
List arr = new ArrayList();
//arr.add(pathType);
//图片转PDF(病案号文件夹+类别文件夹)
if(arr.size()>0) {
msg = PrintToPdfUtil.toPdf(realPath + path2, pdfPath, arr);
}
//存在删除
bol = emrPictureService.deleteById(emrPicture.getId());
//判断图片是否存在如果不存在则删除类别PDF
Emr_Picture obj=new Emr_Picture();
// if (msg.equals("文件未被操作!")) {
//将之前文件删除
File file = new File(pdfPath);
if (file1.exists() && file1.isFile()) {
file1.delete();
}
//重新生成pdf
//读取指定路径下的文件名和目录名
List arr = new ArrayList();
//arr.add(pathType);
//图片转PDF(病案号文件夹+类别文件夹)
if (arr.size() > 0) {
msg = PrintToPdfUtil.toPdf(realPath + path2, pdfPath, arr);
}
//存在删除
bol = emrPictureService.deleteById(emrPicture.getId());
//判断图片是否存在如果不存在则删除类别PDF
Emr_Picture obj = new Emr_Picture();
obj.setRelationId(entity.getRelationId());
obj.setAssortId(entity.getAssortId());
List<Emr_Picture> picL=emrPictureService.selectByClo(obj);
if(picL.size()==0){
Archive_Detail detailObj=new Archive_Detail();
List<Emr_Picture> picL = emrPictureService.selectByClo(obj);
if (picL.size() == 0) {
Archive_Detail detailObj = new Archive_Detail();
detailObj.setMasterid(entity.getRelationId());
detailObj.setAssortid(entity.getAssortId());
String pdfpaht= pictureUrl + "\\" + entity.getRelationId() + "\\" + entity.getAssortId() + "\\" + entity.getAssortId() + ".pdf";
String pdfpaht = pictureUrl + "\\" + entity.getRelationId() + "\\" + entity.getAssortId() + "\\" + entity.getAssortId() + ".pdf";
detailObj.setPdfPath(pdfpaht);
//该病案的类型无图片则删除该病案类型的PDF及删除PDF记录
List<Archive_Detail> detailsL= archiveDetailService.selectByColm(detailObj);
if(detailsL.size()>0) {
List<Archive_Detail> detailsL = archiveDetailService.selectByColm(detailObj);
if (detailsL.size() > 0) {
archiveDetailService.delById(detailsL.get(0).getId());
// 判断pdf是否存在将之前文件删除
File file2 = new File(pdfpaht);
@ -628,18 +639,18 @@ public class inHospitalController {
}
}
// }
// }
}
}
// if (msg.equals("文件未被操作!")) {
if (bol == 1) {
msg = "删除成功!";
} else {
msg = "删除失败!";
}
// if (msg.equals("文件未被操作!")) {
if (bol == 1) {
msg = "删除成功!";
} else {
msg = "删除失败!";
}
//}else{
// msg="文件正被操作!";
// }
// msg="文件正被操作!";
// }
return msg;
}
@ -934,7 +945,7 @@ public class inHospitalController {
List dirList = new ArrayList();
dirList.add(pathType.replace("\\", ""));
try {
PrintToPdfUtil.image2pdf(realPath + path2,dirList);
PrintToPdfUtil.image2pdf(realPath + path2, dirList);
} catch (DocumentException e) {
e.printStackTrace();
}
@ -1122,7 +1133,6 @@ public class inHospitalController {
String trueFileName = firstFile + fileName;
// 设置存放图片文件的路径
path = realPath + "\\static\\img\\uploads\\" + trueFileName;
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = format1.format(new Date());
//将其路径及文件名类型以及参数保存图片相关信息到分段详细表
@ -1130,7 +1140,6 @@ public class inHospitalController {
entity.setMasterid(masterID);
entity.setAssortid(assortID);
entity.setUploaddatetime(nowTime);
entity.setPdfPath("../static/img/uploads/" + trueFileName);
Archive_Detail detail = new Archive_Detail();
int bol = 0;
@ -1240,36 +1249,36 @@ public class inHospitalController {
Archive_Detail detail = new Archive_Detail();
int bol = 0;
//PDF文件操作
if (!id.equals("")) {
entity.setId(id);
detail = archiveDetailService.selectByid(id);
if (detail != null) {
//判断类型是否变更
if (assortID.equals(detail.getAssortid())) {
//相同
} else {
//判断file是否为空
if (file == null) {
if (detail.getPdfPath() != null) {
String newFileName = (detail.getPdfPath()).substring((detail.getPdfPath()).lastIndexOf("\\") + 1);
entity.setPdfPath(path.replace("\\\\", "\\") + newFileName);
//不同pdf转移在删除
PrintToPdfUtil.copyFile(detail.getPdfPath(), entity.getPdfPath());
}
if (!id.equals("")) {
entity.setId(id);
detail = archiveDetailService.selectByid(id);
if (detail != null) {
//判断类型是否变更
if (assortID.equals(detail.getAssortid())) {
//相同
} else {
//判断file是否为空
if (file == null) {
if (detail.getPdfPath() != null) {
String newFileName = (detail.getPdfPath()).substring((detail.getPdfPath()).lastIndexOf("\\") + 1);
entity.setPdfPath(path.replace("\\\\", "\\") + newFileName);
//不同pdf转移在删除
PrintToPdfUtil.copyFile(detail.getPdfPath(), entity.getPdfPath());
}
}
//根据id修改记录
bol = archiveDetailService.updateCloById(entity);
}
//根据id修改记录
bol = archiveDetailService.updateCloById(entity);
}
} else {
//插入记录
if (file != null) {
bol = archiveDetailService.insertSel(entity);
} else {
//插入记录
if (file != null) {
bol = archiveDetailService.insertSel(entity);
} else {
result = "没有找到相对应的文件!";
}
result = "没有找到相对应的文件!";
}
}
if (file != null) {
type = fileName.indexOf(".") != -1 ? fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()) : null;
@ -1341,7 +1350,7 @@ public class inHospitalController {
@RequestMapping("getImg2")
public void getImg2(HttpServletRequest request, HttpServletResponse response,String path)throws IOException {
public void getImg2(HttpServletRequest request, HttpServletResponse response, String path) throws IOException {
FileInputStream fis = null;
OutputStream os = null;
try {
@ -1366,7 +1375,7 @@ public class inHospitalController {
}
@RequestMapping("insertLog")
public void insertLog(HttpServletRequest request, HttpServletResponse response,Emr_Log logBo)throws IOException {
public void insertLog(HttpServletRequest request, HttpServletResponse response, Emr_Log logBo) throws IOException {
// 从session获取用户名
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
@ -1378,19 +1387,19 @@ public class inHospitalController {
logBo.setCreater(username);
//日志实体对象
logBo.setSysFlag("EMR_Medical_Record");
String idStr=logBo.getLogContent();
String idStr = logBo.getLogContent();
logBo.setIp("10.10.01.1");
if(idStr!=null &&idStr!=""){
if(idStr.indexOf(",")!=-1){
String[] idArr =idStr.split(",");
if (idStr != null && idStr != "") {
if (idStr.indexOf(",") != -1) {
String[] idArr = idStr.split(",");
for (int i = 0; i < idArr.length; i++) {
logBo.setLogTitle(idArr[i]);
logBo.setLogContent("调用手动作废.");
// 添加到数据库
logService.insert(logBo);
}
}else{
} else {
logBo.setLogTitle(idStr);
logBo.setLogContent("调用单手动作废.");
// 添加到数据库
@ -1402,63 +1411,240 @@ public class inHospitalController {
@ResponseBody
@RequestMapping(value = "/delPdfPage")
public int delPdfPage(HttpServletResponse response, HttpServletRequest request,Archive_Detail archiveDetail) throws Exception {
public int delPdfPage(HttpServletResponse response, HttpServletRequest request, Archive_Detail archiveDetail) throws Exception {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
// 从session获取用户名
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
String username = (String) session.getAttribute("userSession");//获取前面登录的用户名
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmss");
String nowTime = format2.format(new Date());
int pageNum=Integer.parseInt(archiveDetail.getTitle());
int bol = 0;
if(pageNum==0){
pageNum=1;
}else if(pageNum==1){
pageNum=0;
int pageNum = Integer.parseInt(archiveDetail.getTitle());
int pageNum2 = 0;
if (archiveDetail.getSys() != null && archiveDetail.getSys() != "") {
pageNum2 = Integer.parseInt(archiveDetail.getSys());
}
File file=new File(archiveDetail.getPdfPath());
int bol = 1;
File file = new File(archiveDetail.getPdfPath());
PdfReader pdfReader = new PdfReader(new FileInputStream(file));
int pages = pdfReader.getNumberOfPages();
// 项目在容器中实际发布运行的根路径
String realPath = request.getSession().getServletContext().getRealPath("/");
// 设置存放图片文件的路径
String pdfDelPicUrl = realPath + "static\\img\\delPicImg\\";
// System.out.println("pdf文件的总页数为:" + pages);
if(pages>=pageNum) {
if (file.exists()) {
//删除之前备份并作废记录
String id=archiveDetail.getId();
//查询记录
Archive_Detail archiveDetailDel=archiveDetailService.selectByid(id);
//插入新作废记录
archiveDetailDel.setTitle(archiveDetailDel.getTitle()+"_备份"+nowTime);
if(archiveDetailDel.getTitle().indexOf("_备份")!=-1){
String oldName=archiveDetailDel.getTitle().split("_备份")[0];
archiveDetailDel.setTitle(oldName+"_备份"+nowTime);
}
archiveDetailDel.setFlag("1");
archiveDetailDel.setUploaddatetime(format1.format(new Date()));
//复制一份原有null的pdf文件
String copyPdfName=nowTime+"备份_"+file.getName();
if(file.getName().indexOf("备份_")!=-1){
String oldName=file.getName().split("备份_")[1];
copyPdfName=nowTime+"备份_"+oldName;
if (pages != 1) {
if ((pages >= pageNum && pageNum2 == 0) || (pages > ((pageNum2 - pageNum) + 1) && (pageNum2 != 0 && pages >= pageNum2))) {
if (file.exists()) {
if (bol == 1) {
//判断是否有备份如果没有则备份pdf文件
Archive_Detail archiveDetail2 = archiveDetailService.selectByid(archiveDetail.getId());
if (archiveDetail2 != null) {
if (archiveDetail2.getRecoverPdfPath() == null|| archiveDetail2.getRecoverPdfPath() == "") {
//备份pdf文件复印并将记录保存
String recoverPdfPath = archiveDetail2.getPdfPath().replace(file.getName(), "") + nowTime + ".pdf";
archiveDetail2.setRecoverPdfPath(recoverPdfPath);
archiveDetailService.updateCloById(archiveDetail2);
//复印pdf备份
PrintToPdfUtil.copyFile2(archiveDetail2.getPdfPath(), recoverPdfPath);
}
}
List arrL = new ArrayList();
// bol = pdfDelPageTest.cutPdf(archiveDetail.getPdfPath(), archiveDetail.getPdfPath(), pageNum);//删除第n页
String pdfPath = archiveDetail.getPdfPath();
List<Map<String, String>> list = PrintToPdfUtil.pdfToImage(archiveDetail.getPdfPath(), pageNum, pageNum2, pdfDelPicUrl);
nowTime = format1.format(new Date());
//删除pdf页码成功保存记录到数据库删除图片表中
Archive_Detail_Picture archiveDetailPicture = new Archive_Detail_Picture();
archiveDetailPicture.setCreater(username);
archiveDetailPicture.setCreateTime(nowTime);
archiveDetailPicture.setUpdateTime(nowTime);
archiveDetailPicture.setUpdater(username);
archiveDetailPicture.setEffective(1);
archiveDetailPicture.setParentId(archiveDetail.getId());
if (list.size() > 0) {
for (Map<String, String> map : list) {
if (map.get("max_picture") != null && map.get("max_picture") != "") {
if (map.get("max_picture").indexOf("static") != -1) {
String[] maxPicArr = map.get("max_picture").trim().split("static");
String maxPic = maxPicArr[1];
archiveDetailPicture.setMaxPicture("static" + maxPic);
}
}
if (arrL.indexOf(archiveDetailPicture.getMaxPicture()) == -1) {
arrL.add(archiveDetailPicture.getMaxPicture());
archiveDetailPicture.setPictureNumber(Integer.parseInt(map.get("picture_number")));
archiveDetailPictureService.insertSelective(archiveDetailPicture);
}
}
} else {
bol = 0;
}
} else {
//备份失败
bol = 4;
}
} else {
//pdf文件不存在
bol = 2;
}
String copyPath=archiveDetail.getPdfPath().substring(0,archiveDetail.getPdfPath().lastIndexOf("\\"));
archiveDetailDel.setPdfPath(copyPath+"\\"+copyPdfName);
bol=archiveDetailService.insertSel(archiveDetailDel);
//保存旧版本文件
PrintToPdfUtil.save(file, copyPdfName, copyPath);
if(bol==1) {
bol = pdfDelPageTest.cutPdf(archiveDetail.getPdfPath(), archiveDetail.getPdfPath(), pageNum);//删除第n页
}else{
//备份失败
bol=4;
} else {
//删除页码大于总页数
bol = 3;
}
} else {
bol = 5;
}
return bol;
}
//@OptionalLog(methods = "查询相关的页码图片列表")
@ResponseBody
@RequestMapping(value = "/selDelPicList")
public List<Archive_Detail_Picture> selDelPicList(HttpServletRequest request, HttpServletResponse response, Archive_Detail_Picture archiveDetailPicture) {
List<Archive_Detail_Picture> list = archiveDetailPictureService.selectByCol(archiveDetailPicture);
return list;
}
//@OptionalLog(methods = "删除所有页码图片")
@ResponseBody
@RequestMapping(value = "/delPageImgAll")
public int delPageImgAll(HttpServletRequest request, HttpServletResponse response, Archive_Detail_Picture archiveDetailPicture) {
int bol = 0;
String fileDirName = archiveDetailPicture.getMaxPicture();
archiveDetailPicture.setMaxPicture(null);
bol = archiveDetailPictureService.deleteByCol(archiveDetailPicture);
if (bol == 1) {
// 项目在容器中实际发布运行的根路径
String realPath = request.getSession().getServletContext().getRealPath("/");
// 设置存放图片文件的路径
String pdfDelPicUrl = "static\\img\\delPicImg\\";
//将之前文件目录下图片删除
File file = new File(realPath + pdfDelPicUrl + fileDirName + "\\");
PrintToPdfUtil.delete(file);
}
return bol;
}
//@OptionalLog(methods = "删除单张页码图片")
@ResponseBody
@RequestMapping(value = "/delPageImg")
public int delPageImg(HttpServletRequest request, HttpServletResponse response, Archive_Detail_Picture archiveDetailPicture) {
int bol = 0;
bol = archiveDetailPictureService.deleteByCol(archiveDetailPicture);
if (bol == 1) {
// 项目在容器中实际发布运行的根路径
String realPath = request.getSession().getServletContext().getRealPath("/");
//将之前图片文件删除
File file = new File(realPath + archiveDetailPicture.getMaxPicture());
if (file.exists() && file.isFile()) {
file.delete();
}
}
return bol;
}
//@OptionalLog(methods = "PDF文件添加页码")
@ResponseBody
@RequestMapping(value = "/addPdfPageBtn")
public int addPdfPageBtn(HttpServletRequest request, HttpServletResponse response, Archive_Detail_Picture archiveDetailPicture) {
String orgPdfPath = archiveDetailPicture.getMaxPicture();
File file = new File(orgPdfPath);
SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmss");
String nowTime = format2.format(new Date());
String filePath = file.getAbsolutePath().replace(file.getName(), "");
String fileName = nowTime + "_" + file.getName();
filePath += fileName;
File file1 = new File(filePath);
file.renameTo(file1);
String result = PrintToPdfUtil.addPageNum(filePath, orgPdfPath);
if (result != "" && result != null) {
file1.deleteOnExit();
}
return 1;
}
//@OptionalLog(methods = "PDF文件还原页码")
@ResponseBody
@RequestMapping(value = "/returnPage")
public String returnPage(HttpServletRequest request, HttpServletResponse response, Archive_Detail_Picture archiveDetailPicture) throws Exception {
String result = "";
int bol = 0;
// 模板文件路径
String templatePath = (archiveDetailPicture.getMinPicture());
// 生成的文件路径
String targetPath = archiveDetailPicture.getMinPicture();
String realPath = request.getSession().getServletContext().getRealPath("/");
// 图片路径
String imagePath = realPath + archiveDetailPicture.getMaxPicture();
// 页数
int pageNum = archiveDetailPicture.getPictureNumber();
File file = new File(templatePath);
PdfReader pdfReader = new PdfReader(new FileInputStream(file));
int pages = pdfReader.getNumberOfPages();
if (pages >= 1) {
if ((pages) >= pageNum) {
if (file.exists() && file.isFile()) {
result = AddImgToPdf.addImgToPdf(templatePath, targetPath, imagePath, pageNum);
if (result != "文件不存在") {
archiveDetailPicture.setMaxPicture(null);
archiveDetailPicture.setMinPicture(null);
archiveDetailPicture.setPictureNumber(null);
//删除记录
bol = archiveDetailPictureService.deleteByCol(archiveDetailPicture);
if (bol == 1) {
file.delete();
}
result = "图片还原到" + pageNum + "页成功!";
} else {
result = "图片还原失败!";
}
}
} else {
//pdf文件不存在
bol = 2;
result = "图片还原" + pageNum + "要小于等于" + pages + "!";
}
} else {
result = "pdf文件无内容!";
}
return result;
}
@ResponseBody
@RequestMapping(value = "/returnPdfFile")
public String returnPdfFile(HttpServletRequest request, HttpServletResponse response, Archive_Detail archiveDetail) throws Exception {
String result="";
//判断是否有备份如果没有则备份pdf文件
archiveDetail = archiveDetailService.selectByid(archiveDetail.getId());
if(archiveDetail!=null){
if(archiveDetail.getPdfPath()!="" && archiveDetail.getPdfPath()!=null && archiveDetail.getRecoverPdfPath()!="" && archiveDetail.getRecoverPdfPath()!=null){
PrintToPdfUtil.copyFile2(archiveDetail.getRecoverPdfPath(), archiveDetail.getPdfPath());
//并删除图片记录
Archive_Detail_Picture archiveDetailPicture=new Archive_Detail_Picture();
archiveDetailPicture.setParentId(archiveDetail.getId());
String fileDirName=archiveDetail.getPdfPath();
fileDirName = fileDirName.substring(fileDirName.lastIndexOf("\\")+1).replace(".pdf","");
int bol = archiveDetailPictureService.deleteByCol(archiveDetailPicture);
if (bol == 1) {
// 项目在容器中实际发布运行的根路径
String realPath = request.getSession().getServletContext().getRealPath("/");
// 设置存放图片文件的路径
String pdfDelPicUrl = "static\\img\\delPicImg\\";
//将之前文件目录下图片删除
File file = new File(realPath + pdfDelPicUrl + fileDirName + "\\");
PrintToPdfUtil.delete(file);
}
}else{
result="暂无备份pdf文件!";
}
}else{
//删除页码大于总页数
bol=3;
}
return bol;
return result;
}
}

@ -0,0 +1,21 @@
package com.emr.dao;
import com.emr.entity.Archive_Detail_Picture;
import java.util.List;
public interface Archive_Detail_PictureMapper {
int deleteByCol(Archive_Detail_Picture record);
int insert(Archive_Detail_Picture record);
int insertSelective(Archive_Detail_Picture record);
Archive_Detail_Picture selectByPrimaryKey(Integer id);
List<Archive_Detail_Picture> selectByCol(Archive_Detail_Picture record);
int updateByPrimaryKeySelective(Archive_Detail_Picture record);
int updateByPrimaryKey(Archive_Detail_Picture record);
}

@ -17,7 +17,7 @@ public class Archive_Detail {
private String flag;
private String sys;
private int pageNumber;
private String delAssortID;
private String recoverPdfPath;
public Archive_Detail() {
}
@ -110,11 +110,11 @@ public class Archive_Detail {
this.pageNumber = pageNumber;
}
public String getDelAssortID() {
return delAssortID;
public String getRecoverPdfPath() {
return recoverPdfPath;
}
public void setDelAssortID(String delAssortID) {
this.delAssortID = delAssortID;
public void setRecoverPdfPath(String recoverPdfPath) {
this.recoverPdfPath = recoverPdfPath;
}
}

@ -0,0 +1,113 @@
package com.emr.entity;
public class Archive_Detail_Picture {
private Integer id;
private String parentId;
private String minPicture;
private String maxPicture;
private Integer pictureNumber;
private Integer effective;
private String creater;
private String createTime;
private String updater;
private String updateTime;
private String remark;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId == null ? null : parentId.trim();
}
public String getMinPicture() {
return minPicture;
}
public void setMinPicture(String minPicture) {
this.minPicture = minPicture == null ? null : minPicture.trim();
}
public String getMaxPicture() {
return maxPicture;
}
public void setMaxPicture(String maxPicture) {
this.maxPicture = maxPicture == null ? null : maxPicture.trim();
}
public Integer getPictureNumber() {
return pictureNumber;
}
public void setPictureNumber(Integer pictureNumber) {
this.pictureNumber = pictureNumber;
}
public Integer getEffective() {
return effective;
}
public void setEffective(Integer effective) {
this.effective = effective;
}
public String getCreater() {
return creater;
}
public void setCreater(String creater) {
this.creater = creater == null ? null : creater.trim();
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime == null ? null : createTime.trim();
}
public String getUpdater() {
return updater;
}
public void setUpdater(String updater) {
this.updater = updater == null ? null : updater.trim();
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime == null ? null : updateTime.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
}

@ -24,7 +24,7 @@ public class Archive_Detail_Vo {
private String patientId;
private String scanPage;
private int pageNum;
private String delAssortID;
private String recoverPdfPath;
private String archivestate;
private String cmtDoctorDate;
private String cmtNurseDate;
@ -177,12 +177,8 @@ public class Archive_Detail_Vo {
this.pageNum = pageNum;
}
public String getDelAssortID() {
return delAssortID;
}
public void setDelAssortID(String delAssortID) {
this.delAssortID = delAssortID;
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public String getArchivestate() {

@ -0,0 +1,21 @@
package com.emr.service;
import com.emr.entity.Archive_Detail_Picture;
import java.util.List;
public interface Archive_Detail_PictureService {
int deleteByCol(Archive_Detail_Picture record);
int insert(Archive_Detail_Picture record);
int insertSelective(Archive_Detail_Picture record);
Archive_Detail_Picture selectByPrimaryKey(Integer id);
List<Archive_Detail_Picture> selectByCol(Archive_Detail_Picture record);
int updateByPrimaryKeySelective(Archive_Detail_Picture record);
int updateByPrimaryKey(Archive_Detail_Picture record);
}

@ -0,0 +1,50 @@
package com.emr.service.ipml;
import com.emr.dao.Archive_Detail_PictureMapper;
import com.emr.entity.Archive_Detail_Picture;
import com.emr.service.Archive_Detail_PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class Archive_Detail_PictureServiceImpl implements Archive_Detail_PictureService {
@Autowired
private Archive_Detail_PictureMapper archiveDetailPictureMapper;
@Override
public int deleteByCol(Archive_Detail_Picture record) {
return archiveDetailPictureMapper.deleteByCol(record);
}
@Override
public int insert(Archive_Detail_Picture record) {
return archiveDetailPictureMapper.insert(record);
}
@Override
public int insertSelective(Archive_Detail_Picture record) {
return archiveDetailPictureMapper.insertSelective(record);
}
@Override
public Archive_Detail_Picture selectByPrimaryKey(Integer id) {
return archiveDetailPictureMapper.selectByPrimaryKey(id);
}
@Override
public List<Archive_Detail_Picture> selectByCol(Archive_Detail_Picture record) {
return archiveDetailPictureMapper.selectByCol(record);
}
@Override
public int updateByPrimaryKeySelective(Archive_Detail_Picture record) {
return archiveDetailPictureMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(Archive_Detail_Picture record) {
return archiveDetailPictureMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,92 @@
package com.emr.util;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
public class AddImgToPdf {
final private static float A4_weight = 595;//标准A4的宽
final private static float A4_height = 842;//标准A4的高
public static String addImgToPdf(String templatePath,String targetPath,String imagePath,int pageNum) {
String result="";
try{
// 读取模板文件
InputStream input = new FileInputStream(new File(templatePath));
PdfReader reader = new PdfReader(input);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(targetPath));
//读图片
Image image = Image.getInstance(imagePath);
// 获取操作的页面
PdfContentByte under =null;
if(pageNum==0) {
stamper.insertPage(1 , reader.getPageSizeWithRotation(1));//新增空白页
// 获取操作的页面
under = stamper.getOverContent(1);
}else{
stamper.insertPage(pageNum + 1, reader.getPageSizeWithRotation(pageNum));//新增空白页
// 获取操作的页面
under = stamper.getOverContent(pageNum+1);
}
/*处理图片缩放比例*/
float w = image.getWidth();
float h = image.getHeight();
float percent = 0;
if ((w > A4_weight) && (h < A4_height)) {
percent = (A4_weight * 100) / w;
} else if ((w < A4_weight) && (h > A4_height)) {
percent = (A4_height * 100) / h;
} else if ((w > A4_weight) && (h > A4_height)) {
percent = (A4_weight * 100) / w;
h = (h * percent) / 100;
if (h > A4_height) {
percent = (A4_height * 100) / h;
}
}
// 读取图片流
image.setAlignment(com.lowagie.text.Image.ALIGN_CENTER);
if (percent != 100) {
image.scaleAbsolute(A4_weight, A4_height);
} else {
image.scalePercent(percent);
} //这里是写死要插入的坐标
float x = 0;
float y = 0;
// 添加图片
image.setAbsolutePosition(x, y);
under.addImage(image);
stamper.close();
reader.close();
//System.out.println("操作完成");
}catch (Exception e){
e.printStackTrace();
}
return result;
}
public static void main(String[] args) throws Exception {
//F:\old\EMR_Medical_Record\target\emr_medical_record-1.0-SNAPSHOT\static\img\delPicImg\202104011839513
// 模板文件路径
String templatePath = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\331.pdf";
// 生成的文件路径
String targetPath = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\332.pdf";
// 图片路径
String imagePath = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\2.jpg";
// 页数
int pageNum=1;
System.out.println(templatePath);
//String result=AddImgToPdf( templatePath, targetPath, imagePath,pageNum);
PrintToPdfUtil.addPageNum(templatePath, targetPath);
}
}

@ -1,35 +1,45 @@
package com.emr.util;
import com.lowagie.text.BadElementException;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.*;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Image;
import com.lowagie.text.pdf.PdfWriter;
import org.apache.http.entity.ContentType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import org.apache.pdfbox.rendering.ImageType;
import org.apache.pdfbox.rendering.PDFRenderer;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
public class Main {
final private static float A4_weight = 595;//标准A4的宽
final private static float A4_height = 842;//标准A4的高
/**
* ,dpi96,100,105,120,150,200,
* 120,150,200,,dpi
*/
public static final float DEFAULT_DPI = 200;
public static final String DEFAULT_FORMAT = "jpg";
/***
* @param picturePath
*
*/
private static void createPic( String picturePath,Document document) {
private static void createPic(String picturePath, Document document) {
try {
File file=new File(picturePath);
File file = new File(picturePath);
File[] files = file.listFiles();
Image img =null;
Image img = null;
if (files.length > 0) {
for (File file1 : files) {
@ -55,18 +65,18 @@ public class Main {
// 读取图片流
img.setAlignment(com.lowagie.text.Image.ALIGN_CENTER);
if(percent != 100){
img.scaleAbsolute(A4_weight,A4_height);
}else{
if (percent != 100) {
img.scaleAbsolute(A4_weight, A4_height);
} else {
img.scalePercent(percent);
}
document.open();
document.add(img);
}else if(file1.isDirectory()){
} else if (file1.isDirectory()) {
//是文件夹迭代
System.out.println(file1.getAbsolutePath());
createPic(file1.getAbsolutePath(),document);
createPic(file1.getAbsolutePath(), document);
}
}
}
@ -75,38 +85,172 @@ public class Main {
}
}
public static void image2pdf(String text,List dirList) throws DocumentException, IOException {
public static void image2pdf(String text, List dirList) throws DocumentException, IOException {
/* Document document = new Document();
OutputStream os = new FileOutputStream(new File(pdf));
PdfWriter.getInstance(document, os);
document.open();*/
//循环类别
if(dirList.size()>0){
for(int i=0;i<dirList.size();i++){
if (dirList.size() > 0) {
for (int i = 0; i < dirList.size(); i++) {
Document document = new Document();
OutputStream os = new FileOutputStream(new File(text+dirList.get(i)+"//"+dirList.get(i)+".pdf"));
OutputStream os = new FileOutputStream(new File(text + dirList.get(i) + "//" + dirList.get(i) + ".pdf"));
PdfWriter.getInstance(document, os);
// document.open();
File file=new File(text+dirList.get(i));
// document.open();
File file = new File(text + dirList.get(i));
File[] files = file.listFiles();
if (files.length > 0) {
// 循环获取图片文件夹内的图片,全部
createPic(text+dirList.get(i),document);
createPic(text + dirList.get(i), document);
}
}
}
}
/**
* PDF
* 使 pdfbox
*
* @param pdfPath PDF
* @param page_end
* @param imgPath
* @return
*/
public static List pdfToImage(String pdfPath, int page_start, int page_end, String imgPath) {
String result = "";
List list = new ArrayList();
Map<String, String> map = null;
File file = new File(pdfPath);
if (file.exists()) {
SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmss");
String nowTime = format2.format(new Date());
String filePath = file.getName().substring(0, file.getName().lastIndexOf("."));
try {
PDDocument doc = PDDocument.load(file);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
String fileName = "";
String oleFileName = file.getName().substring(0, file.getName().lastIndexOf("."));
for (int i = pageCount; i > 0; i--) {
if ((i <= page_end && i >= (page_start)) || (page_end == 0 && i == page_start)) {
map = new HashMap<>();
BufferedImage image = renderer.renderImageWithDPI(i - 1, 296);
// BufferedImage image = renderer.renderImage(i, 2.5f);
File file2 = new File(imgPath + oleFileName + "\\"); //此目录保存缩小后的关键图
if (!file2.exists()) {
//如果要创建的多级目录不存在才需要创建。
file2.mkdirs();
}
fileName = oleFileName + "_" + nowTime + "_" + (i) + "." + DEFAULT_FORMAT;
ImageIO.write(image, DEFAULT_FORMAT, new File(imgPath + oleFileName + "\\" + fileName));
map.put("max_picture", imgPath + oleFileName + "\\" + fileName);
map.put("picture_number", i + "");
list.add(map);
if (i == 1) {
doc.removePage(0);
} else {
doc.removePage(i - 1);
}
}
}
doc.save(pdfPath);
} catch (IOException e) {
e.printStackTrace();
}
} else {
result = "文件不存在!";
}
return list;
}
public static void delete(File file) {
if (!file.exists()) return;
if (file.isFile() || file.list() == null) {
file.delete();
// System.out.println("删除了"+file.getName());
} else {
File[] files = file.listFiles();
for (File a : files) {
delete(a);
}
file.delete();
// System.out.println("删除了"+file.getName());
}
}
/**
*
*
* @param inputPdfPath pdf C:\\Users\\aaa\\Desktop\\20181011114615447qp.pdf
* @param outputPdfPath pdf
* @param imgPath E:\\code\\qrcode.png
* @param pageNum
* @return
*/
public static int insertImgToPdf(String inputPdfPath, String outputPdfPath, String imgPath,int pageNum) {
File file = new File(inputPdfPath);
File file2 = new File(outputPdfPath);
int bol=1;
if (file.exists()) {
try {
PDDocument doc = PDDocument.load(file);
PDDocument doc2 = PDDocument.load(file2);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
doc.save(outputPdfPath);
for (int i = pageCount-1; i >= 0; i--) {
PDPage myPage = doc.getPage(i);
Image image = Image.getInstance(imgPath);
PDImageXObject pdImage = PDImageXObject.createFromFile(imgPath, doc2);
int iw = pdImage.getWidth();
int ih = pdImage.getHeight();
float offset = 20f;
try (PDPageContentStream cont = new PDPageContentStream(doc2, myPage)) {
cont.drawImage(pdImage, offset, offset, iw, ih);
}
if (i==pageNum || i==(pageNum-1)) {
BufferedImage image2 = renderer.renderImageWithDPI(i - 1, 296);
}
}
doc2.save(outputPdfPath);
} catch (Exception e) {
e.printStackTrace();
}
}
return bol;
}
public static void main(String[] args) throws IOException {
//读取指定路径下的文件名和目录名
List dirList = new ArrayList();
/* List dirList = new ArrayList();
dirList.add("3");
dirList.add("17");
/* try {
image2pdf("C:\\Users\\Administrator\\Desktop\\test\\uploadImage\\11111111111133333\\",dirList);
//dirList.add("17");
try {
image2pdf("C:\\Users\\Administrator\\Desktop\\文档\\",dirList);
} catch (DocumentException e) {
e.printStackTrace();
}*/
@ -141,5 +285,33 @@ public class Main {
e.printStackTrace();
}*/
//删除pdf页码保存图片
String pdfPath="C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\331.pdf";
int page_start=1;
int page_end=3;
String imgPath="C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\";
List list=pdfToImage(pdfPath,page_start,page_end,imgPath);
System.out.println(list.toString());
//删除文件夹的和所有文件
//File file = new File("C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\202103311721593");
//delete(file);
// 模板文件路径
String templatePath = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\3.pdf";
// 生成的文件路径
String targetPath = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\target.pdf";
// 图片路径
String fieldName = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\2.jpg";
// 页数
int pageNum=0;
String imagePath = "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\2.jpg";
//insertImgToPdf(templatePath, targetPath, fieldName,pageNum);
}
}

@ -7,8 +7,11 @@
package com.emr.util;
import com.emr.entity.Archive_Detail;
import com.emr.entity.Archive_Detail_Picture;
import com.emr.entity.MergePDFItem;
import com.github.pagehelper.Page;
import com.itextpdf.text.Element;
import com.itextpdf.text.Phrase;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Image;
@ -18,21 +21,24 @@ import com.lowagie.text.rtf.RtfWriter2;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.javafx.css.Size;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.io.FileUtils;
import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.rendering.PDFRenderer;
import javax.imageio.ImageIO;
import javax.xml.namespace.QName;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.Map;
/**
* PDFiTextpdf
@ -42,6 +48,12 @@ import java.util.Map;
public class PrintToPdfUtil {
final private static float A4_weight = 595;//标准A4的宽
final private static float A4_height = 842;//标准A4的高
/**
* ,dpi96,100,105,120,150,200,
* 120,150,200,,dpi
*/
public static final float DEFAULT_DPI = 200;
public static final String DEFAULT_FORMAT = "jpg";
public static boolean forceDelete(File file) {
boolean result = file.delete();
@ -168,25 +180,25 @@ public class PrintToPdfUtil {
}
doc.open();
if(msg.equals("文件未被操作!")){
// OutputStream fos = new FileOutputStream(pdfPath);
// 输入流
OutputStream fos = new FileOutputStream(new File(pdfPath));
if(msg.equals("文件未被操作!")){
// OutputStream fos = new FileOutputStream(pdfPath);
// 输入流
OutputStream fos = new FileOutputStream(new File(pdfPath));
// 获取图片文件夹对象
File file = new File(imageFolderPath);
// 写入PDF文档
PdfWriter.getInstance(doc, fos);
//imageFolderPath = file.getAbsolutePath() + "\\";
imgFun(imageFolderPath, file, dirList, doc);
try {
if(fos!=null) {
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
// 写入PDF文档
PdfWriter.getInstance(doc, fos);
//imageFolderPath = file.getAbsolutePath() + "\\";
imgFun(imageFolderPath, file, dirList, doc);
try {
if(fos!=null) {
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
@ -225,7 +237,7 @@ public class PrintToPdfUtil {
if (file1.isDirectory()) {
if (dirList != null && dirList.size() > 0) {
if (dirList.indexOf(file1.getName()) != -1) {
// System.out.println(file1.getAbsolutePath());
// System.out.println(file1.getAbsolutePath());
imageFolderPath = file1.getAbsolutePath() + "\\";
imgFun(imageFolderPath, file1, dirList, doc);
@ -248,7 +260,7 @@ public class PrintToPdfUtil {
}
}
}else{
// System.out.println("空文件夹");
// System.out.println("空文件夹");
}
@ -260,7 +272,7 @@ public class PrintToPdfUtil {
// 输入流
// FileOutputStream fos = new FileOutputStream(pdfPath);
// // 创建文档
Document doc = new Document(null, 0, 0, 0, 0);
Document doc = new Document(null, 0, 0, 0, 0);
// //doc.open();
// // 写入PDF文档
@ -289,52 +301,52 @@ public class PrintToPdfUtil {
try {
File[] files = file.listFiles();
if(file!=null)
if (files.length > 0) {
// 循环获取图片文件夹内的图片
for (File file1 : files) {
if (file1.getName().endsWith(".pdf")) {
//System.out.println(file1.length());
if (pdfList != null && pdfList.size() > 0) {
//System.out.println("文件名:"+file1.getName());
if (pdfList.indexOf(file1.getName()) != -1) {
if (files.length > 0) {
// 循环获取图片文件夹内的图片
for (File file1 : files) {
if (file1.getName().endsWith(".pdf")) {
//System.out.println(file1.length());
if (pdfList != null && pdfList.size() > 0) {
//System.out.println("文件名:"+file1.getName());
if (pdfList.indexOf(file1.getName()) != -1) {
}else{
if (file1.length() == 0) {
//file.delete();
} else {
pdfFolderPath = file1.getAbsolutePath();
mergePdf.addSource(pdfFolderPath);
}
}
}else{
if (file1.length() == 0) {
//file.delete();
} else {
pdfFolderPath = file1.getAbsolutePath();
mergePdf.addSource(pdfFolderPath);
}
}
}else{
if (file1.length() == 0) {
//file.delete();
} else {
pdfFolderPath = file1.getAbsolutePath();
mergePdf.addSource(pdfFolderPath);
}
}
}
if (file1.isDirectory()) {
if (dirList != null && dirList.size() > 0) {
if (dirList.indexOf(file1.getName()) != -1) {
pdfFolderPath = file1.getAbsolutePath() + "\\";
pdfFun(pdfFolderPath, file1, dirList, pdfList, mergePdf);
if (file1.isDirectory()) {
if (dirList != null && dirList.size() > 0) {
if (dirList.indexOf(file1.getName()) != -1) {
pdfFolderPath = file1.getAbsolutePath() + "\\";
}
} else {
pdfFolderPath = file1.getAbsolutePath() + "\\";
pdfFun(pdfFolderPath, file1, dirList, pdfList, mergePdf);
}
} else {
pdfFolderPath = file1.getAbsolutePath() + "\\";
pdfFun(pdfFolderPath, file1, dirList, pdfList, mergePdf);
}
}
}
} else {
System.out.println("空文件夹");
}
} else {
System.out.println("空文件夹");
}
} catch (Exception e) {
e.printStackTrace();
}
@ -389,7 +401,7 @@ public class PrintToPdfUtil {
* true, false
*/
public static boolean mergePdfFiles2(List<MergePDFItem> files, String newfile) throws Exception {
public static boolean mergePdfFiles2(List<MergePDFItem> files, String newfile) throws Exception {
boolean retValue = false;
List<String> tmpFiles = new ArrayList<>();
@ -507,7 +519,7 @@ public class PrintToPdfUtil {
/**
*
* pdf
*
* @param oldPath String c:/fqf.txt
* @param newPath String f:/fqf.txt
@ -541,61 +553,37 @@ public class PrintToPdfUtil {
file2.delete();
}
}
}
public static void main(String[] args) throws IOException {
String pdfFile = String.valueOf(System.currentTimeMillis());
//读取指定路径下的文件名和目录名
List list = new ArrayList();
list.add("45646546");
//图片转PDF(病案号文件夹+类别文件夹)
// String str=toPdf("C:\\Users\\Administrator\\Desktop\\测试\\uploadImage\\", "C:\\Users\\Administrator\\Desktop\\测试\\" + "123.pdf", list);
// System.out.println(str);
//多个pdf合成一个
//pdtToPdf("D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\1333ad3c4d6448c89372835dbad3c364\\", "D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\typesPdf\\"+ pdfFile+".pdf", list);
//图片移动
//moveTotherFolders("D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\HC3SL2HENH348M8X619PMCA7GC5R3125\\2019071905226021565006922724小程序界面.png","D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\SDV1QEHUPQRQ8GXJE4RQH0FGAS1V7HM0\\");
//moveTotherFolders("D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp/static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\HC3SL2HENH348M8X619PMCA7GC5R3125\\2019071905226021565064554400fw.jpg", "D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\3\\");
List list1 = new ArrayList();
list.add("C:\\Users\\HIPAA\\Desktop\\测试\\ttt.pdf");
list.add("C:\\Users\\HIPAA\\Desktop\\测试\\sss.pdf");
//String[] files = {"C:\\Users\\Administrator\\Desktop\\新建文件夹\\ttt.pdf", "C:\\Users\\Administrator\\Desktop\\新建文件夹\\sss.pdf"};
String savepath = "C:\\Users\\HIPAA\\Desktop\\测试\\temp.pdf";
//mergePdfFiles(list1, savepath);
//mergePdfFiles(list1, savepath);
//PrintToPdfUtil.copyFile("C:\\Users\\Administrator\\Desktop\\新建文件夹\\ttt.pdf", "C:\\Users\\Administrator\\Desktop\\新建文件夹\\123\\ttt.pdf");
List pdfList = new ArrayList();
//pdfList.add("C:\\Users\\Administrator\\Desktop\\测试\\ttt.pdf");
pdfList.add("C:\\Users\\HIPAA\\Desktop\\测试\\sss7.pdf");
pdfList.add("C:\\Users\\HIPAA\\Desktop\\测试\\15511.pdf");
//mergePdfFiles(pdfList, "C:\\Users\\Administrator\\Desktop\\测试\\合成.pdf");
ArrayList<String> pdffiles = new ArrayList<String>();
//pdffiles.add("C:\\Users\\Administrator\\Desktop\\测试\\15511.pdf");
// pdffiles.add("D:\\project\\yingde\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\0f6e6941028c44b8b8ea070f27480416\\HC3SL2HENH348M8X619PMCA7GC5R3125\\HC3SL2HENH348M8X619PMCA7GC5R3125.pdf");
//boolean checkPdf=CheckPdfFiles(pdffiles);
//System.out.println(checkPdf);
//判断文件是否损坏
//boolean bol=checkPdfFile("D:\\project\\yingde\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\0f6e6941028c44b8b8ea070f27480416\\HC3SL2HENH348M8X619PMCA7GC5R3125\\HC3SL2HENH348M8X619PMCA7GC5R3125.pdf");
//System.out.println(bol);
List<File> files = new ArrayList<File>();
pdffiles.add("C:\\Users\\Administrator\\Desktop\\测试\\15511.pdf");
pdffiles.add("C:\\Users\\Administrator\\Desktop\\测试\\153333511.pdf");
//files.add(new File("C:\\Users\\Administrator\\Desktop\\测试\\123.pdf"));
//files.add(new File("C:\\Users\\Administrator\\Desktop\\测试\\sss.pdf"));
//files.add(new File("C:\\Users\\Administrator\\Desktop\\测试\\ttt333.pdf"));
//File f = mulFile2One(files, "C:\\Users\\Administrator\\Desktop\\测试\\mul2one.pdf");
/**
*
*
* @param oldPath String c:/fqf.txt
* @param newPath String f:/fqf.txt
* @return boolean
*/
public static void copyFile2(String oldPath, String newPath) {
try {
// int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) { //文件存在时
InputStream inStream = new FileInputStream(oldPath); //读入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1444];
// int length;
while ((byteread = inStream.read(buffer)) != -1) {
// bytesum += byteread; //字节数 文件大小
// System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
inStream.close();
}
} catch (Exception e) {
System.out.println("复制单个文件操作出错");
e.printStackTrace();
//复制pdf文件
/*File file=new File("C:\\Users\\Administrator\\Desktop\\images\\报表工具v2.4操作手册文档.pdf");
save(file, "cc.pdf", "C:\\Users\\Administrator\\Desktop\\images");*/
}
}
@ -606,7 +594,6 @@ public class PrintToPdfUtil {
//文件不存在
File file2 = new File(file);
if (file2.exists()) {
//文件损坏
PdfReader reader = new PdfReader(file);
Document document = new Document(reader.getPageSize(1));
@ -618,7 +605,7 @@ public class PrintToPdfUtil {
document.close();
//System.out.println("pdf 存在");
} else {
//System.out.println("pdf 不存在");
//System.out.println("pdf 不存在");
}
} catch (IOException e) {
@ -663,9 +650,300 @@ public class PrintToPdfUtil {
}
/**
* PDF
* 使 pdfbox
* @param pdfPath PDF
* @param page_end
* @param imgPath
* @return
*/
public static List pdfToImage2(String pdfPath,int page_start,int page_end,String imgPath) {
String result="";
List list=new ArrayList();
Map<String,String> map=null;
File file = new File(pdfPath);
if(file.exists()) {
SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmss");
String nowTime = format2.format(new Date());
String filePath =file.getName().substring(0,file.getName().lastIndexOf("."));
try {
PDDocument doc = PDDocument.load(file);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
File file2 =new File(imgPath); //此目录保存缩小后的关键图
if(!file2.exists()){
//如果要创建的多级目录不存在才需要创建。
file2.mkdirs();
}
String fileName="";
for (int i = pageCount; i>0; i--) {
if ((i <=page_end && i>=(page_start))||(page_end==0 &&i==page_start)) {
map=new HashMap<>();
BufferedImage image = renderer.renderImageWithDPI(i-1, 296);
// BufferedImage image = renderer.renderImage(i, 2.5f);
fileName=file.getName().substring(0,file.getName().lastIndexOf("."))+"_"+nowTime+"_" + (i)+ "." + DEFAULT_FORMAT;
ImageIO.write(image, DEFAULT_FORMAT, new File(imgPath + fileName));
map.put("max_picture",imgPath + fileName);
map.put("picture_number",i+"");
list.add(map);
if(i == 1) {
doc.removePage(0);
}else{
doc.removePage(i-1);
}
}
}
doc.save(pdfPath);
} catch (IOException e) {
e.printStackTrace();
}
}else{
result="文件不存在!";
}
return list;
}
/**
* PDF
* 使 pdfbox
* @param pdfPath PDF
* @param page_end
* @param imgPath
* @return
*/
public static List pdfToImage(String pdfPath,int page_start,int page_end,String imgPath) {
String result="";
List list=new ArrayList();
Map<String,String> map=null;
File file = new File(pdfPath);
if(file.exists()) {
SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmss");
String nowTime = format2.format(new Date());
String filePath =file.getName().substring(0,file.getName().lastIndexOf("."));
try {
PDDocument doc = PDDocument.load(file);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
String fileName="";
String oleFileName=file.getName().substring(0,file.getName().lastIndexOf("."));
for (int i = pageCount; i>0; i--) {
if ((i <=page_end && i>=(page_start))||(page_end==0 &&i==page_start)) {
map=new HashMap<>();
BufferedImage image = renderer.renderImageWithDPI(i-1, 296);
// BufferedImage image = renderer.renderImage(i, 2.5f);
File file2 =new File(imgPath+oleFileName+"\\"); //此目录保存缩小后的关键图
if(!file2.exists()){
//如果要创建的多级目录不存在才需要创建。
file2.mkdirs();
}
fileName=oleFileName+"_"+nowTime+"_" + (i)+ "." + DEFAULT_FORMAT;
ImageIO.write(image, DEFAULT_FORMAT, new File(imgPath+oleFileName+"\\" + fileName));
map.put("max_picture",imgPath+oleFileName+"\\" + fileName);
map.put("picture_number",i+"");
list.add(map);
if(i == 1) {
doc.removePage(0);
}else {
doc.removePage(i-1);
}
}
}
doc.save(pdfPath);
} catch (IOException e) {
e.printStackTrace();
}
}else{
result="文件不存在!";
}
return list;
}
public static void delete(File file) {
if(!file.exists()) return;
if(file.isFile() || file.list()==null) {
file.delete();
// System.out.println("删除了"+file.getName());
}else {
File[] files = file.listFiles();
for(File a:files) {
delete(a);
}
file.delete();
// System.out.println("删除了"+file.getName());
}
}
/**
* @description
* PDF
* @author TianwYam
* @date 201912288:51:08
*/
public static class PageNumPdfPageEvent extends com.itextpdf.text.pdf.PdfPageEventHelper {
@Override
public void onEndPage(com.itextpdf.text.pdf.PdfWriter writer, com.itextpdf.text.Document document) {
try {
// PDF文档内容
com.itextpdf.text.pdf.PdfContentByte pdfContent = writer.getDirectContent();
pdfContent.saveState();
pdfContent.beginText();
int footerFontSize = 14 ;
// 解决页码中文无法显示 或者 显示为乱码的问题
// 但是必须引入jar包 itext-asian-5.2.0.jar
com.itextpdf.text.pdf.BaseFont baseFont = com.itextpdf.text.pdf.BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
com.itextpdf.text.Font fontDetail = new com.itextpdf.text.Font(baseFont, footerFontSize, com.itextpdf.text.Font.NORMAL);
pdfContent.setFontAndSize(baseFont, footerFontSize);
// 页脚的页码 展示
String footerNum = String.format("第%d页", writer.getPageNumber());
Phrase phrase = new Phrase(footerNum, fontDetail);
// 页码的 横轴 坐标 居中
float x = ( document.left() + document.right() ) / 2 ;
// 页码的 纵轴 坐标
float y = document.bottom(-10) ;
// 添加文本内容,进行展示页码
com.itextpdf.text.pdf.ColumnText.showTextAligned(pdfContent, Element.ALIGN_CENTER, phrase, x, y, 0);
pdfContent.endText();
pdfContent.restoreState();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* @description
* PDF
* @author TianwYam
* @date 201912288:48:55
* @param orgPdfPath PDF
* @param outputPdfPath PDF
* @return PDF
*/
public static String addPageNum (String orgPdfPath, String outputPdfPath) {
try (
// 输出文件 流
FileOutputStream fos = new FileOutputStream(outputPdfPath);){
// 新建文档默认A4大小
com.itextpdf.text.Document document = new com.itextpdf.text.Document(com.itextpdf.text.PageSize.A4);
com.itextpdf.text.pdf.PdfWriter writer = com.itextpdf.text.pdf.PdfWriter.getInstance(document, fos);
// 设置页面监听事件必须在open方法前
writer.setPageEvent(new PageNumPdfPageEvent());
document.open();
// PDF内容体
com.itextpdf.text.pdf.PdfContentByte pdfContent = writer.getDirectContent();
// 读取 源PDF文件进行一页一页复制才能触发 添加页码的 页面监听事件
com.itextpdf.text.pdf.PdfReader reader = new com.itextpdf.text.pdf.PdfReader(orgPdfPath);
// 获取 源文件总页数
int num = reader.getNumberOfPages();
// System.out.println("总页数:" + num);
// 页面数是从1开始的
for (int i = 1; i <= num; i++) {
document.newPage();
// 设置空页码进行展示
writer.setPageEmpty(false);
com.itextpdf.text.pdf.PdfImportedPage page = writer.getImportedPage(reader, i);
// 复制好的页面,添加到内容去,触发事件监听
pdfContent.addTemplate(page, 0, 0);
}
document.close();
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
return outputPdfPath ;
}
public static void main(String[] args) throws IOException {
String pdfFile = String.valueOf(System.currentTimeMillis());
//读取指定路径下的文件名和目录名
List list = new ArrayList();
list.add("45646546");
//图片转PDF(病案号文件夹+类别文件夹)
// String str=toPdf("C:\\Users\\Administrator\\Desktop\\测试\\uploadImage\\", "C:\\Users\\Administrator\\Desktop\\测试\\" + "123.pdf", list);
// System.out.println(str);
//多个pdf合成一个
//pdtToPdf("D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\1333ad3c4d6448c89372835dbad3c364\\", "D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\typesPdf\\"+ pdfFile+".pdf", list);
//图片移动
//moveTotherFolders("D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\HC3SL2HENH348M8X619PMCA7GC5R3125\\2019071905226021565006922724小程序界面.png","D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\SDV1QEHUPQRQ8GXJE4RQH0FGAS1V7HM0\\");
//moveTotherFolders("D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp/static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\HC3SL2HENH348M8X619PMCA7GC5R3125\\2019071905226021565064554400fw.jpg", "D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\1333ad3c4d6448c89372835dbad3c364\\3\\");
List list1 = new ArrayList();
list.add("C:\\Users\\HIPAA\\Desktop\\测试\\ttt.pdf");
list.add("C:\\Users\\HIPAA\\Desktop\\测试\\sss.pdf");
//String[] files = {"C:\\Users\\Administrator\\Desktop\\新建文件夹\\ttt.pdf", "C:\\Users\\Administrator\\Desktop\\新建文件夹\\sss.pdf"};
String savepath = "C:\\Users\\HIPAA\\Desktop\\测试\\temp.pdf";
//mergePdfFiles(list1, savepath);
//mergePdfFiles(list1, savepath);
// PrintToPdfUtil.copyFile2("C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\新建文件夹\\ttt.pdf", "C:\\Users\\Administrator\\Desktop\\test\\delPicImg\\新建文件夹\\3.pdf");
List pdfList = new ArrayList();
//pdfList.add("C:\\Users\\Administrator\\Desktop\\测试\\ttt.pdf");
pdfList.add("C:\\Users\\HIPAA\\Desktop\\测试\\sss7.pdf");
pdfList.add("C:\\Users\\HIPAA\\Desktop\\测试\\15511.pdf");
//mergePdfFiles(pdfList, "C:\\Users\\Administrator\\Desktop\\测试\\合成.pdf");
ArrayList<String> pdffiles = new ArrayList<String>();
//pdffiles.add("C:\\Users\\Administrator\\Desktop\\测试\\15511.pdf");
// pdffiles.add("D:\\project\\yingde\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\0f6e6941028c44b8b8ea070f27480416\\HC3SL2HENH348M8X619PMCA7GC5R3125\\HC3SL2HENH348M8X619PMCA7GC5R3125.pdf");
//boolean checkPdf=CheckPdfFiles(pdffiles);
//System.out.println(checkPdf);
//判断文件是否损坏
//boolean bol=checkPdfFile("D:\\project\\yingde\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\pdfFiles\\0f6e6941028c44b8b8ea070f27480416\\HC3SL2HENH348M8X619PMCA7GC5R3125\\HC3SL2HENH348M8X619PMCA7GC5R3125.pdf");
//System.out.println(bol);
List<File> files = new ArrayList<File>();
pdffiles.add("C:\\Users\\Administrator\\Desktop\\测试\\15511.pdf");
pdffiles.add("C:\\Users\\Administrator\\Desktop\\测试\\153333511.pdf");
//files.add(new File("C:\\Users\\Administrator\\Desktop\\测试\\123.pdf"));
//files.add(new File("C:\\Users\\Administrator\\Desktop\\测试\\sss.pdf"));
//files.add(new File("C:\\Users\\Administrator\\Desktop\\测试\\ttt333.pdf"));
//File f = mulFile2One(files, "C:\\Users\\Administrator\\Desktop\\测试\\mul2one.pdf");
//复制pdf文件
/*File file=new File("C:\\Users\\Administrator\\Desktop\\images\\报表工具v2.4操作手册文档.pdf");
save(file, "cc.pdf", "C:\\Users\\Administrator\\Desktop\\images");*/
String fileName="C:\\Users\\HIPAA\\Desktop\\测试\\sss7.pdf";
fileName = fileName.substring(fileName.lastIndexOf("\\")+1).replace(".pdf","");
System.out.println("方法二fileName = " + fileName);
}
}

@ -119,4 +119,6 @@ public class pdfDelPageTest {
System.out.println("已经转完了哦");
return 1;
}
}

@ -13,7 +13,7 @@
<result column="flag" jdbcType="NVARCHAR" property="flag" />
<result column="Sys" jdbcType="NVARCHAR" property="sys" />
<result column="page_number" jdbcType="INTEGER" property="pageNumber"/>
<result column="del_assortID" jdbcType="INTEGER" property="delAssortID"/>
<result column="recover_pdf_path" jdbcType="INTEGER" property="recoverPdfPath"/>
</resultMap>
<resultMap id="BaseResultMap2" type="com.emr.entity.Archive_Detail_Vo">
<result column="id" jdbcType="NVARCHAR" property="id"/>
@ -34,7 +34,7 @@
<result column="assort_sort" property="assortSort" jdbcType="SMALLINT"/>
<result column="print_flag" property="printFlag" jdbcType="VARCHAR"/>
<result column="pageNum" property="pageNum" jdbcType="INTEGER"/>
<result column="del_assortID" jdbcType="INTEGER" property="delAssortID"/>
<result column="recover_pdf_path" jdbcType="INTEGER" property="recoverPdfPath"/>
<result column="ArchiveState" jdbcType="NVARCHAR" property="archivestate"/>
<result column="cmt_doctor_date" jdbcType="NVARCHAR" property="cmtDoctorDate"/>
<result column="cmt_nurse_date" jdbcType="NVARCHAR" property="cmtNurseDate"/>
@ -43,7 +43,7 @@
</resultMap>
<sql id="Base_Column_List">
id, PDF_PATH, MasterID, UpLoadDateTime, AssortID, Source, SubAssort, Title, flag,
Sys,page_number
Sys,page_number,recover_pdf_path
</sql>
<select id="selectByClo" resultMap="BaseResultMap2" parameterType="com.emr.entity.Archive_Detail_Vo">
SELECT z.assort_id,z.assort_name,z.assort_sort,z.print_flag,s.pageNum
@ -235,7 +235,7 @@
values ((select replace(newid(),'-','')), #{pdfPath,jdbcType=NVARCHAR}, #{masterid,jdbcType=NVARCHAR},
#{uploaddatetime,jdbcType=NVARCHAR}, #{assortid,jdbcType=NVARCHAR}, #{source,jdbcType=NVARCHAR},
#{subassort,jdbcType=NVARCHAR}, #{title,jdbcType=NVARCHAR}, #{flag,jdbcType=NVARCHAR},
#{sys,jdbcType=NVARCHAR},#{pageNumber,jdbcType=INTEGER}, #{delAssortID,jdbcType=NVARCHAR})
#{sys,jdbcType=NVARCHAR},#{pageNumber,jdbcType=INTEGER}, #{recoverPdfPath,jdbcType=NVARCHAR})
</insert>
<insert id="insertSel" parameterType="com.emr.entity.Archive_Detail">
insert into archive_detail
@ -273,10 +273,9 @@
<if test="pageNumber != null">
page_number,
</if>
<if test="delAssortID != null">
del_assortID,
<if test="recoverPdfPath != null">
recover_pdf_path,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<!--<if test="id != null and id!=''">-->
@ -312,8 +311,8 @@
<if test="pageNumber != null">
#{pageNumber,jdbcType=INTEGER},
</if>
<if test="delAssortID != null">
#{delAssortID,jdbcType=NVARCHAR},
<if test="recoverPdfPath != null">
#{recoverPdfPath,jdbcType=NVARCHAR},
</if>
</trim>
</insert>
@ -350,8 +349,8 @@
<if test="pageNumber != null">
page_number=#{pageNumber,jdbcType=INTEGER},
</if>
<if test="delAssortID != null">
del_assortID=#{delAssortID,jdbcType=NVARCHAR},
<if test="recoverPdfPath != null">
recover_pdf_path=#{recoverPdfPath,jdbcType=NVARCHAR},
</if>
</set>
where id = #{id,jdbcType=NVARCHAR}
@ -368,7 +367,7 @@
flag = #{flag,jdbcType=NVARCHAR},
Sys = #{sys,jdbcType=NVARCHAR},
page_number=#{pageNumber,jdbcType=INTEGER},
del_assortID=#{delAssortID,jdbcType=NVARCHAR}
recover_pdf_path=#{recoverPdfPath,jdbcType=NVARCHAR}
where id = #{id,jdbcType=NVARCHAR}
</update>
</mapper>

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.emr.dao.Archive_Detail_PictureMapper" >
<resultMap id="BaseResultMap" type="com.emr.entity.Archive_Detail_Picture" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="parent_id" property="parentId" jdbcType="VARCHAR" />
<result column="min_picture" property="minPicture" jdbcType="VARCHAR" />
<result column="max_picture" property="maxPicture" jdbcType="VARCHAR" />
<result column="picture_number" property="pictureNumber" jdbcType="INTEGER" />
<result column="effective" property="effective" jdbcType="INTEGER" />
<result column="creater" property="creater" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="VARCHAR" />
<result column="updater" property="updater" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="VARCHAR" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, parent_id, min_picture, max_picture, picture_number, effective, creater, create_time,
updater, update_time, remark
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from archive_detail_picture
where id = #{id,jdbcType=INTEGER}
ORDER BY picture_number
</select>
<select id="selectByCol" resultMap="BaseResultMap" parameterType="com.emr.entity.Archive_Detail_Picture" >
select
<include refid="Base_Column_List" />
from archive_detail_picture
where 1=1
<if test="parentId != null" >
and parent_id = #{parentId,jdbcType=VARCHAR}
</if>
<if test="minPicture != null" >
and min_picture = #{minPicture,jdbcType=VARCHAR}
</if>
<if test="maxPicture != null" >
and max_picture = #{maxPicture,jdbcType=VARCHAR}
</if>
<if test="pictureNumber != null" >
and picture_number = #{pictureNumber,jdbcType=INTEGER}
</if>
<if test="effective != null" >
and effective = #{effective,jdbcType=INTEGER}
</if>
<if test="creater != null" >
and creater = #{creater,jdbcType=VARCHAR}
</if>
<if test="createTime != null" >
and create_time = #{createTime,jdbcType=VARCHAR}
</if>
<if test="updater != null" >
and updater = #{updater,jdbcType=VARCHAR}
</if>
<if test="updateTime != null" >
and update_time = #{updateTime,jdbcType=VARCHAR}
</if>
<if test="remark != null" >
and remark = #{remark,jdbcType=VARCHAR}
</if>
ORDER BY picture_number
</select>
<delete id="deleteByCol" parameterType="com.emr.entity.Archive_Detail_Picture" >
delete from archive_detail_picture
where 1=1
<if test="id != null" >
and id=#{id,jdbcType=INTEGER}
</if>
<if test="parentId != null and parentId!= ''" >
and parent_id=#{parentId,jdbcType=VARCHAR}
</if>
<if test="maxPicture != null and maxPicture!= ''" >
and max_picture like #{maxPicture,jdbcType=VARCHAR}+'%'
</if>
</delete>
<insert id="insert" parameterType="com.emr.entity.Archive_Detail_Picture" >
insert into archive_detail_picture (id, parent_id, min_picture,
max_picture, picture_number, effective,
creater, create_time, updater,
update_time, remark)
values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=VARCHAR}, #{minPicture,jdbcType=VARCHAR},
#{maxPicture,jdbcType=VARCHAR}, #{pictureNumber,jdbcType=INTEGER}, #{effective,jdbcType=INTEGER},
#{creater,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{updater,jdbcType=VARCHAR},
#{updateTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.emr.entity.Archive_Detail_Picture" >
insert into archive_detail_picture
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="parentId != null" >
parent_id,
</if>
<if test="minPicture != null" >
min_picture,
</if>
<if test="maxPicture != null" >
max_picture,
</if>
<if test="pictureNumber != null" >
picture_number,
</if>
<if test="effective != null" >
effective,
</if>
<if test="creater != null" >
creater,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updater != null" >
updater,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="remark != null" >
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="parentId != null" >
#{parentId,jdbcType=VARCHAR},
</if>
<if test="minPicture != null" >
#{minPicture,jdbcType=VARCHAR},
</if>
<if test="maxPicture != null" >
#{maxPicture,jdbcType=VARCHAR},
</if>
<if test="pictureNumber != null" >
#{pictureNumber,jdbcType=INTEGER},
</if>
<if test="effective != null" >
#{effective,jdbcType=INTEGER},
</if>
<if test="creater != null" >
#{creater,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=VARCHAR},
</if>
<if test="updater != null" >
#{updater,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.Archive_Detail_Picture" >
update archive_detail_picture
<set >
<if test="parentId != null" >
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="minPicture != null" >
min_picture = #{minPicture,jdbcType=VARCHAR},
</if>
<if test="maxPicture != null" >
max_picture = #{maxPicture,jdbcType=VARCHAR},
</if>
<if test="pictureNumber != null" >
picture_number = #{pictureNumber,jdbcType=INTEGER},
</if>
<if test="effective != null" >
effective = #{effective,jdbcType=INTEGER},
</if>
<if test="creater != null" >
creater = #{creater,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=VARCHAR},
</if>
<if test="updater != null" >
updater = #{updater,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.emr.entity.Archive_Detail_Picture" >
update archive_detail_picture
set parent_id = #{parentId,jdbcType=VARCHAR},
min_picture = #{minPicture,jdbcType=VARCHAR},
max_picture = #{maxPicture,jdbcType=VARCHAR},
picture_number = #{pictureNumber,jdbcType=INTEGER},
effective = #{effective,jdbcType=INTEGER},
creater = #{creater,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=VARCHAR},
updater = #{updater,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<%
@ -19,6 +19,7 @@
<%--<script src="${path}/static/js/bootstrap-table-fixed-columns.js"></script>--%>
<style>
.modal-header2 {
height: 30px;
text-align: center !important;
vertical-align: middle !important;
background-color: #3c8dbc !important;
@ -69,7 +70,8 @@
width: 97.5%;
margin-top: 10px;
margin-bottom: 5px;
}病历清单
}
.labCss {
/*color: gainsboro;*/
color: #c1c3c4;
@ -152,12 +154,16 @@
}
.showImg {
width: 80%;
height: 100%
width: 100%;
}
/* .isImg{
width: 100%;
height: 150%
}*/
.shadeImg {
height: 950px;
height:100%;
}
#returnModal .modal-content {
@ -222,12 +228,77 @@
margin-top: 35%;
width: 100%;
}
#mb{
display: none;
height: 120%;
width: 100%;
/*position: fixed;*/
position: absolute;
z-index: 1200;
/*height: 1380px;*/
background: #FFF;
top:0;
left: 0;
opacity:0.6;
}
#arrow {
color: #fff;
background: #000;
width: 20px;
height: 90px;
line-height: 90px;
font-size: 12px;
font-family: "宋体";
text-align: center;
font-weight: bold;
float: left;
}
/*.panel-primary > .panel-heading{*/
/*background-color: #3c8dbc;*/
/*border-color: #3c8dbc;*/
/*}*/
.showDelDiv{
border: 1px solid #e5e5e5;
width: 90%;
margin-bottom: 5px;
}
.showImg2 {
margin-left: 2%;
margin-bottom: 2px;
width:95%;
height: 200px;
}
.imglist{
margin-left: 15px;
margin-bottom: 5px;
width: 90%;
height: 200px;
}
.returnPageCls{
margin-right: 2px;
}
#addDelDiv{
width: 85%;
background-color: #0b93d5;
text-align: center;
color: red;
}
#delAllImgBtn{
width: 35%;
}
#addPdfPageBtn{
width: 40%;
}
#delImgPageModalCss{
margin-left: 20%;
}
</style>
</head>
<body>
<div id="mb"></div>
<div style="margin-left:30px;margin-right:10px;height:auto">
<!--搜索-->
@ -685,22 +756,22 @@
<%--发大弹窗--%>
<div class="modal fade" id="maxImg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-header2" style="width: 165%">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-body" STYLE="height: 950px">
<div class="shadeImg" onclick="javascript:closeShadeImg()">
<div class="modal-body" style="height: 60%;">
<div class="shadeImg" onclick="javascript:closeShadeImg()" style="height: 80%;">
<div class="">
<img class="showImg" src=""/>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>
</div>
<%-- <div class="modal-footer" style="background-color: #0b93d5;width: 165%">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>--%>
</div>
</div>
<%--确认框--%>
@ -1078,34 +1149,51 @@
</div>
</div>
<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-content " style="width:220%;margin-left:-15%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">PDF页信息</h4>
</div>
<div class="modal-body divCss2">
<form>
<div class="form-group ">
<input id="pdfId" hidden/>
<span style="vertical-align:top;">pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf"></textarea>
<div class="modal-body divCss2" id="delPdfBody">
<div class="row form-inline">
<div style="width: 80%;float:left;" id="pdfDiv">
<iframe id="pdf_page" name="pdf_page" style="width:100%;height:100%;"></iframe>
</div>
<div class="form-group " >
<span style="vertical-align:top;">删除页码:</span>
<input type="number" id="pagePdf"/>
<div id="arrow">&gt;</div>
<div style="width: 18%;height:100%;float:right;overflow-y:scroll;overflow-x: hidden;" id="infoDiv">
<form>
<div class="row " hidden>
<input id="pdfId" hidden/>
<span style="vertical-align:top;" hidden>pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf" hidden></textarea>
</div>
<div class="row" style="margin-left:5px; " >
页码:
<input type="number" id="pagePdf" style="max-width:20%"/>-<input type="number" id="pagePdf2" style="max-width:20%"/>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</form>
<div class="row" style="margin-left:15px; ">
<div class="row" id="addDelDiv">---不可恢复--</div>
<div class="row">
<%--<button type="button" class="btn btn-warning btn-sm" id="addPdfPageBtn" onclick="addPdfPageFun()">PDF添加页码</button>--%>
<button type="button" class="btn btn-warning btn-sm" id="returnPdfBtn" onclick="returnPdfFun()">还原最初PDF</button>
<button type="button" class="btn btn-danger btn-sm" id="delAllImgBtn" >删除全部图片</button>
</div>
</div>
<div class="imglist" id="imglist">
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</div>
</div>
@ -1114,7 +1202,7 @@
<%--删除pdf某页确认框--%>
<div class="modal fade" id="delPdfPageModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content " >
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
@ -1123,7 +1211,7 @@
<div class="modal-body" >
<form>
<div class="form-group">
<label class="control-label">删除页码并备份旧版本为作废,是否删除?</label>
<label class="control-label" >是否删除pdf第<span id="numDel"></span>的页面</label>
</div>
</form>
</div>
@ -1135,6 +1223,32 @@
</div>
</div>
<%--确认框提示清空所有图片--%>
<div class="modal fade" id="delImgPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content delImgPageModalCss" style="width: 70%;margin-left: 30%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label class="control-label">删除所有的图片将不可恢复,是否删除?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delImgPageBtn">确认</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
@ -1364,7 +1478,7 @@
show: true//弹出对话框
});
$(".shadeImg").fadeIn(500);
$(".shadeImg").fadeIn(800);
$(".showImg").attr("src", $(b).attr("src"));
}
@ -1414,28 +1528,26 @@
getAssortFun();
var opts = {
lines: 13, // The number of lines to draw |小长条的数量
length: 20, // The length of each line |小长条的长度
width: 5, // The line thickness |小长条的宽度
//left: "50%",
radius: 15, // The radius of the inner circle |内环的半径长
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset |旋转角度
direction: 1, // 1: clockwise, -1: counterclockwise |1顺时针方向 -1逆时针方向
color: '#000', // #rgb or #rrggbb or array of colors |颜色
speed: 1, // Rounds per second |每秒转多少圈
trail: 60, // Afterglow percentage |余晖效果百分比
shadow: false, // Whether to render a shadow |渲染阴影
hwaccel: false, // Whether to use hardware acceleration |加速
className: 'spinner', // The CSS class to assign to the spinner |类名spinner
zIndex: 2e9, // The z-index (defaults to 2000000000) |显示在最顶层
top: '70%', // Top position relative to parent in px |相对父元素的top
//left: '90' // Left position relative to parent in px |相对父元素的left 默认情况spinner是显示于父元素居中位置
var opts = {
lines: 13, // 花瓣数目
length: 20, // 花瓣长度
width: 10, // 花瓣宽度
radius: 30, // 花瓣距中心半径
corners: 1, // 花瓣圆滑度 (0-1)
rotate: 0, // 花瓣旋转角度
direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针
color: '#000', // 花瓣颜色
speed: 1, // 花瓣旋转速度
trail: 60, // 花瓣旋转时的拖影(百分比)
shadow: false, // 花瓣是否显示阴影
hwaccel: false, //spinner 是否启用硬件加速及高速旋转
className: 'spinner', // spinner css 样式名称
zIndex: 2e9, // spinner的z轴 (默认是2000000000)
top: '50%', // spinner 相对父容器Top定位 单位 px
left: '450%'// spinner 相对父容器Left定位 单位 px
};
var spinner = new Spinner(opts);
var url = "";
function uploadFileAndDate() {
@ -2509,6 +2621,238 @@
});
function returnPdfFun(){
//console.log("======还原PDF=======");
var parentId=$("#pdfId").val();
if(parentId!="" &&parentId!=null ){
$.ajax({
url: "${path}/inHosp/returnPdfFile",
type: "POST",
data: {id:parentId},
success: function (result) {
setTimeout(function () {
if(result=="") {
$("#mb").css("display", "none");
getDelPicPageFun();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
toastr.success("pdf文件还原备份成功!");
}else{
toastr.warning(result);
}
}, 1000);
}
});
}else{
toastr.warning("暂无备份pdf文件!");
}
}
function returnPageFun(maxPicture,btnObj){
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var minPicture=null;
var parentId=$("#pdfId").val();
// var parentId=$("#pdfId").val();
var inpuObj=btnObj.parentNode.firstChild ;
var delPage=inpuObj.value;
if(delPage=="" || delPage==null || delPage<0){
toastr.warning("请输入还原的页码大于等于0!");
return;
}
var delid=btnObj.id;
var id=0;
var pictureNumber=0;
if(delid!="" &&delid!=null && delid!="delId_"){
delid=delid.replace("delId_","");
id=parseInt(delid);
}
if(delPage!="" &&delPage!=null && delPage>=0){
pictureNumber=delPage;
}
if($("#pathPdf").val()!=null && $("#pathPdf").val()!="" && $("#pathPdf").val()!=undefined && $("#pathPdf").val()!="undefined"){
minPicture=$("#pathPdf").val();
}
if(id!=0 && pictureNumber>=0){
var entity={};
entity.id=id;
entity.pictureNumber=pictureNumber;
entity.maxPicture=maxPicture;
entity.minPicture=minPicture;
entity.parentId=parentId;
//console.log(entity);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/returnPage",
type: "POST",
data: entity,
success: function (result) {
setTimeout(function () {
//if(result!=null && result!="") {
if (result.indexOf("成功")!=-1) {
getDelPicPageFun();
// $('#pdf_page').attr('src', result);
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
toastr.success(result);
} else {
toastr.warning(result);
}
// }else{
// toastr.warning("图片还原失败!");
// }
$("#mb").css("display","none");
spinner.spin();
}, 2000);
}
});
}
}
function addPdfPageFun(){
var maxPicture=$("#pathPdf").val();
if(maxPicture!=null && maxPicture!="" && maxPicture!=undefined){
//console.log("=====添加pdf页码成功=========maxPicture:"+maxPicture);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/addPdfPageBtn",
type: "POST",
data: {maxPicture:maxPicture},
success: function (result) {
$("#mb").css("display","none");
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
if (result==1) {
toastr.success("添加pdf页码成功!");
}
}
});
}else{
// toastr.warning("删除所有图片失败!");
}
}
function delAllImgFun(){
var parentId=$("#pdfId").val();
var maxPicture=$("#pathPdf").val();
var picArr=maxPicture.split("\\");
maxPicture=picArr[picArr.length-1].replace(".pdf","");
if(parentId!=null && parentId!="" && parentId!=undefined){
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
//console.log(parentId+":parentId=====删除所有图片=========maxPicture:"+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImgAll",
type: "POST",
data: {parentId: parentId,maxPicture:maxPicture},
success: function (result) {
getDelPicPageFun();
spinner.spin();
if (result==1) {
toastr.success("删除所有图片成功!");
}
}
});
// $('#delImgPageModal').modal('hide'); //手动关闭
}else{
// toastr.warning("删除所有图片失败!");
}
$('#delImgPageModal').modal('hide'); //手动关闭
}
$("#delAllImgBtn").click(function () {
//弹窗提示不可复原
$('#delImgPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: true,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
});
$("#delImgPageBtn").click(function () {
delAllImgFun();
});
function delPageFun(maxPicture,obj){
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var id=0;
if(obj.id!=null && obj.id!="" && obj.id!="delId_"){
id=parseInt(obj.id.replace("delId_",""));
//console.log(id+"==========删除图片:===="+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImg",
type: "POST",
data: {id: id,maxPicture:maxPicture},
success: function (result) {
setTimeout(function () {
if (result==1) {
getDelPicPageFun();
toastr.success("删除图片成功!");
}else{
toastr.warning("删除图片失败!");
}
$("#mb").css("display","none");
spinner.spin();
}, 500);
}
});
}else{
toastr.warning("图片记录不存在!");
}
}
function getDelPicPageFun() {
var parentId=$("#pdfId").val();
//console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
if(parentId!=null && parentId!=""){
//获取相应的pdf被删除的图片列表
$.ajax({
url: "${path}/inHosp/selDelPicList",
type: "POST",
data: {effective: 1, parentId: parentId},
success: function (result) {
$("#imglist").empty();
var img_div = $("#imglist");
if (result != null && result.length>0) {
//console.log(result);
var img_html="";
var delId="delId_";
var delPageV="delPageV_";
var maxPicture="";
for (var i = 0; i < result.length; i++) {
delId="delId_"+result[i].id;
delPageV="delPageV_"+result[i].id;
//console.log("========="+result[i].id+"======delId:"+delId+"===="+result[i].pictureNumber);
maxPicture=result[i].maxPicture.replaceAll("/","\\");
//console.log(result[i].maxPicture);
img_html="${path}\\"+maxPicture;
img_html="<div class='row showDelDiv'><img class='showImg2' src='"+img_html+"' onclick='javascript:lookBigImg(this)'/>";
img_html+="<div clas='row'>"
+"<input type='number' class='returnPageCls' id='"+delPageV+"' value='"+result[i].pictureNumber+"' style='max-width:40%'/>"
+"<button class='btn btn-primary btn-sm' id='"+delId+"' onclick='javascript:returnPageFun(\""+encodeURIComponent(maxPicture, "UTF-8")+"\",this)'>还原</button>"
+'<button onclick="javascript:delPageFun(\''+encodeURIComponent(maxPicture, "UTF-8")+'\',this);" id="'+delId+'" class="btn btn-danger btn-sm">'+'删除'+'</button>'
+ "</div>";
img_html+="</div>";
$("#imglist").append(img_html);
}
}else{
$("#imglist").append("暂无可删除图片!");
//toastr.warning("暂无删除图片!");
}
}
});
}else{
toastr.warning("记录不存在!");
}
}
//处理导出内容,这个方法可以自定义某一行、某一列、甚至某个单元格的内容,也就是将其值设置为自己想要的内容
function DoOnCellHtmlData(cell, row, col, data) {
@ -3751,10 +4095,10 @@
//console.log("===:" + row.pdfPath + "====" + row.source);
//删除
if (row.pdfPath != null && row.pdfPath != "") {
//console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
if (row.pdfPath.indexOf(row.assortId + ".pdf") == -1) {
var pdfName=row.pdfPath.substring(row.pdfPath.lastIndexOf('\\') + 1, row.pdfPath.lastIndexOf('.') );
if (pdfName!=row.assortId) {
if (row.source != null && row.source != "") {
if (row.source.indexOf("后台") != -1) {
if(row.source.indexOf("后台") != -1){
html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
}
}
@ -3854,15 +4198,34 @@
//同步
$("#idPdfT").val(row.id);
}, 'click .delPdfPage': function (e, value, row, index) {
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
var pdfPath=row.pdfPath.replaceAll("\\","/");
//C:/Users/Administrator/Desktop/test/autoPdf/1617156631367.pdf
if(pdfPath!=""){
pdfPath="${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath);
$('#pdf_page').attr('src', pdfPath);
//病案号 45e9b098f9da49ffba1843bfc6930cb8
}else{
toastr.warning("勾选的PDF文件不存在或破损");
}
//删除pdf某一页
$('#delPdfPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
// //同步
$("#pdfId").val(row.id);
$("#pathPdf").val(row.pdfPath);
getDelPicPageFun();
setTimeout(function () {
$("#mb").css("display","none");
spinner.spin();
}, 1500);
}
},
cellStyle: function (value, row, index) {
@ -4305,57 +4668,112 @@
//删除pdf页码
$("#delPageBtn").click(function () {
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
var pagePdfVal=$("#pagePdf").val();
if(pagePdfVal==null ||pagePdfVal=="" ){
toastr.warning("页码必填!");
return;
}
if(pagePdfVal!=null && pagePdfVal!="" ){
if(pagePdfVal<=0){
toastr.warning("起始页码大于0且必填");
return;
}
}
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!="" && pagePdfVal!=null && pagePdfVal!=""){
if($("#pagePdf2").val()<=0){
toastr.warning("结尾页码需大于0!");
return;
}else if($("#pagePdf2").val()<$("#pagePdf").val()){
toastr.warning("结尾页码必须大于起始页码!");
return;
}
}
$("#numDel").empty();
if($("#pagePdf").val()!="" && $("#pagePdf").val()!=null) {
$("#numDel").append($("#pagePdf").val());
if($("#pagePdf2").val()!="" && $("#pagePdf2").val()!=null){
$("#numDel").append("至"+$("#pagePdf2").val());
}
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
}else{
toastr.warning("请输入页码!");
}
});
//确认删除pdf页码
$("#delPageBtn2").click(function () {
var entity={};出院科室:
entity.id= $("#pdfId").val();
$('#delPdfPageModal2').modal('hide'); //手动关闭
var entity={};
entity.id= $("#pdfId").val();
entity.title = ""+$("#pagePdf").val();
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!=null) {
entity.sys = "" + $("#pagePdf2").val();
}else{
entity.sys ="";
}
entity.pdfPath = $("#pathPdf").val();
if(entity.id==null ||entity.id=="" ){
toastr.warning("id不为空");
toastr.warning("id不为空!");
return;
} if(entity.title==null ||entity.title=="" ){
toastr.warning("页码必填!");
}
if(entity.title==null ||entity.title=="" ){
toastr.warning("起始页码必填!");
return;
} if(entity.title!=null && entity.title!="" ){
}
if(entity.title!=null && entity.title!="" ){
if(entity.title<=0){
toastr.warning("页码大于0必填");
toastr.warning("起始页码大于0必填!");
return;
}
} if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在");
}
if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在!");
return;
}
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/delPdfPage",
type: "POST",
data:entity,
success: function (result) {
$("#mb").css("display","none");
spinner.spin();
$("#pagePdf").val("");
$('#delPdfPageModal').modal('hide'); //手动关闭
$('#delPdfPageModal2').modal('hide'); //手动关闭
$("#pagePdf2").val("");
//$('#delPdfPageModal').modal('hide'); //手动关闭
if (result == 1) {
//刷新
var pageNum=$("#pageNumber").val();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
$("#pageNumber").val(pageNum);
getDelPicPageFun();
$('#table2').bootstrapTable('refresh');
initTree($("#idLab").html());
toastr.success("删除pdf页数,第"+entity.title+"页成功!");
if( entity.sys =="") {
toastr.success("删除pdf页数,第" + entity.title + "页成功!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成功!");
}
} else if (result ==0){
toastr.error("删除pdf页数,第"+entity.title+"页失败!");
if( entity.sys =="") {
toastr.warning("删除pdf页数,第"+entity.title+"页失败!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成失败!");
}
}else if (result == 2){
toastr.error("pdf文件不存在");
toastr.warning("pdf文件不存在");
}else if(result==3){
toastr.error("删除页数大于总页数!");
toastr.warning("删除页码或页数不得大于总页数!");
}else if(result==4){
toastr.error("删除页码前备份失败!");
toastr.warning("删除页码前备份失败!");
}else if(result==5){
toastr.warning("只剩一页不可再删!");
}
}, error: function () {
toastr.error("操作失败!");

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
@ -18,6 +18,7 @@
<%@include file="../../jspf/ztreeCommom.jsp" %>
<style>
.modal-header2 {
height: 30px;
text-align: center !important;
vertical-align: middle !important;
background-color: #3c8dbc !important;
@ -145,12 +146,13 @@
}
.showImg {
width: 80%;
height: 100%
width: 100%;
/*height: 100%*/
}
.shadeImg {
height: 950px;
height:100%;
}
#returnModal .modal-content {
@ -189,69 +191,77 @@
margin-top: 35%;
width: 100%;
}
</style>
</head>
<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">PDF页信息</h4>
</div>
<div class="modal-body divCss2">
<form>
<div class="form-group ">
<input id="pdfId" hidden/>
<span style="vertical-align:top;">pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf"></textarea>
</div>
<div class="form-group " >
<span style="vertical-align:top;">删除页码:</span>
<input type="number" id="pagePdf"/>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</div>
</div>
</div>
#mb{
display: none;
height: 120%;
width: 100%;
/*position: fixed;*/
position: absolute;
z-index: 1200;
/*height: 1380px;*/
background: #FFF;
top:0;
left: 0;
opacity:0.6;
}
<%--删除pdf某页确认框--%>
<div class="modal fade" id="delPdfPageModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content " >
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body" >
<form>
<div class="form-group">
<label class="control-label">删除页码并备份旧版本为作废,是否删除?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn2">确认</button>
</div>
</div>
</div>
</div>
#arrow {
color: #fff;
background: #000;
width: 20px;
height: 90px;
line-height: 90px;
font-size: 12px;
font-family: "宋体";
text-align: center;
font-weight: bold;
float: left;
}
/*.panel-primary > .panel-heading{*/
/*background-color: #3c8dbc;*/
/*border-color: #3c8dbc;*/
/*}*/
.showDelDiv{
border: 1px solid #e5e5e5;
width: 90%;
margin-bottom: 5px;
}
.showImg2 {
margin-left: 2%;
margin-bottom: 2px;
width:95%;
height: 200px;
}
.imglist{
margin-left: 15px;
margin-bottom: 5px;
width: 90%;
height: 200px;
}
.returnPageCls{
margin-right: 2px;
}
#addDelDiv{
width: 85%;
background-color: #0b93d5;
text-align: center;
color: red;
}
#delAllImgBtn{
width: 35%;
}
#addPdfPageBtn{
width: 40%;
}
#delImgPageModalCss{
margin-left: 20%;
}
</style>
</head>
<body>
<div id="mb"></div>
<div style="margin-left:30px;margin-right:10px;height:auto">
<!--搜索-->
<form style="margin-top:20px;">
@ -292,7 +302,6 @@
<option value="">全部</option>
</select>
</div>
<div class="form-group divCss">
<label>出院日期:</label>
<div class="input-daterange input-group" id="datepicker">
@ -785,21 +794,21 @@
<%--发大弹窗--%>
<div class="modal fade" id="maxImg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-header2" style="width: 165%">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-body" STYLE="height: 950px">
<div class="modal-body" style="height: 80%;">
<div class="shadeImg" onclick="javascript:closeShadeImg()">
<div class="">
<img class="showImg" src=""/>
</div>
</div>
</div>
<div class="modal-footer">
<%-- <div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>
</div>--%>
</div>
</div>
</div>
@ -1049,7 +1058,103 @@
</div>
</div>
<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content " style="width:220%;margin-left:-15%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">PDF页信息</h4>
</div>
<div class="modal-body divCss2" id="delPdfBody">
<div class="row form-inline">
<div style="width: 80%;float:left;" id="pdfDiv">
<iframe id="pdf_page" name="pdf_page" style="width:100%;height:100%;"></iframe>
</div>
<div id="arrow">&gt;</div>
<div style="width: 18%;height:100%;float:right;overflow-y:scroll;overflow-x: hidden;" id="infoDiv">
<form>
<div class="row " hidden>
<input id="pdfId" hidden/>
<span style="vertical-align:top;" hidden>pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf" hidden></textarea>
</div>
<div class="row" style="margin-left:5px; " >
页码:
<input type="number" id="pagePdf" style="max-width:20%"/>-<input type="number" id="pagePdf2" style="max-width:20%"/>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</form>
<div class="row" style="margin-left:15px; ">
<div class="row" id="addDelDiv">---不可恢复--</div>
<div class="row">
<%--<button type="button" class="btn btn-warning btn-sm" id="addPdfPageBtn" onclick="addPdfPageFun()">PDF添加页码</button>--%>
<button type="button" class="btn btn-warning btn-sm" id="returnPdfBtn" onclick="returnPdfFun()">还原最初PDF</button>
<button type="button" class="btn btn-danger btn-sm" id="delAllImgBtn" >删除全部图片</button>
</div>
</div>
<div class="imglist" id="imglist">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>
</div>
</div>
</div>
<%--删除pdf某页确认框--%>
<div class="modal fade" id="delPdfPageModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body" >
<form>
<div class="form-group">
<label class="control-label" >是否删除pdf第<span id="numDel"></span>的页面?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn2">确认</button>
</div>
</div>
</div>
</div>
<%--确认框提示清空所有图片--%>
<div class="modal fade" id="delImgPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content delImgPageModalCss" style="width: 70%;margin-left: 30%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label class="control-label">删除所有的图片将不可恢复,是否删除?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delImgPageBtn">确认</button>
</div>
</div>
</div>
</div>
</body>
@ -1275,27 +1380,24 @@
getAssortFun();
var opts = {
lines: 13, // The number of lines to draw |小长条的数量
length: 20, // The length of each line |小长条的长度
width: 5, // The line thickness |小长条的宽度
//left: "50%",
radius: 15, // The radius of the inner circle |内环的半径长
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset |旋转角度
direction: 1, // 1: clockwise, -1: counterclockwise |1顺时针方向 -1逆时针方向
color: '#000', // #rgb or #rrggbb or array of colors |颜色
speed: 1, // Rounds per second |每秒转多少圈
trail: 60, // Afterglow percentage |余晖效果百分比
shadow: false, // Whether to render a shadow |渲染阴影
hwaccel: false, // Whether to use hardware acceleration |加速
className: 'spinner', // The CSS class to assign to the spinner |类名spinner
zIndex: 2e9, // The z-index (defaults to 2000000000) |显示在最顶层
top: '70%', // Top position relative to parent in px |相对父元素的top
//left: '90' // Left position relative to parent in px |相对父元素的left 默认情况spinner是显示于父元素居中位置
lines: 13, // 花瓣数目
length: 20, // 花瓣长度
width: 10, // 花瓣宽度
radius: 30, // 花瓣距中心半径
corners: 1, // 花瓣圆滑度 (0-1)
rotate: 0, // 花瓣旋转角度
direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针
color: '#000', // 花瓣颜色
speed: 1, // 花瓣旋转速度
trail: 60, // 花瓣旋转时的拖影(百分比)
shadow: false, // 花瓣是否显示阴影
hwaccel: false, //spinner 是否启用硬件加速及高速旋转
className: 'spinner', // spinner css 样式名称
zIndex: 2e9, // spinner的z轴 (默认是2000000000)
top: '50%', // spinner 相对父容器Top定位 单位 px
left: '450%'// spinner 相对父容器Left定位 单位 px
};
var spinner = new Spinner(opts);
var url = "";
function uploadFileAndDate() {
@ -1958,6 +2060,238 @@
});
function returnPdfFun(){
//console.log("======还原PDF=======");
var parentId=$("#pdfId").val();
if(parentId!="" &&parentId!=null ){
$.ajax({
url: "${path}/inHosp/returnPdfFile",
type: "POST",
data: {id:parentId},
success: function (result) {
setTimeout(function () {
if(result=="") {
$("#mb").css("display", "none");
getDelPicPageFun();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
toastr.success("pdf文件还原备份成功!");
}else{
toastr.warning(result);
}
}, 1000);
}
});
}else{
toastr.warning("暂无备份pdf文件!");
}
}
function returnPageFun(maxPicture,btnObj){
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var minPicture=null;
var parentId=$("#pdfId").val();
// var parentId=$("#pdfId").val();
var inpuObj=btnObj.parentNode.firstChild ;
var delPage=inpuObj.value;
if(delPage=="" || delPage==null || delPage<0){
toastr.warning("请输入还原的页码大于等于0!");
return;
}
var delid=btnObj.id;
var id=0;
var pictureNumber=0;
if(delid!="" &&delid!=null && delid!="delId_"){
delid=delid.replace("delId_","");
id=parseInt(delid);
}
if(delPage!="" &&delPage!=null && delPage>=0){
pictureNumber=delPage;
}
if($("#pathPdf").val()!=null && $("#pathPdf").val()!="" && $("#pathPdf").val()!=undefined && $("#pathPdf").val()!="undefined"){
minPicture=$("#pathPdf").val();
}
if(id!=0 && pictureNumber>=0){
var entity={};
entity.id=id;
entity.pictureNumber=pictureNumber;
entity.maxPicture=maxPicture;
entity.minPicture=minPicture;
entity.parentId=parentId;
//console.log(entity);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/returnPage",
type: "POST",
data: entity,
success: function (result) {
setTimeout(function () {
//if(result!=null && result!="") {
if (result.indexOf("成功")!=-1) {
getDelPicPageFun();
// $('#pdf_page').attr('src', result);
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
toastr.success(result);
} else {
toastr.warning(result);
}
// }else{
// toastr.warning("图片还原失败!");
// }
$("#mb").css("display","none");
spinner.spin();
}, 2000);
}
});
}
}
function addPdfPageFun(){
var maxPicture=$("#pathPdf").val();
if(maxPicture!=null && maxPicture!="" && maxPicture!=undefined){
//console.log("=====添加pdf页码成功=========maxPicture:"+maxPicture);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/addPdfPageBtn",
type: "POST",
data: {maxPicture:maxPicture},
success: function (result) {
$("#mb").css("display","none");
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
if (result==1) {
toastr.success("添加pdf页码成功!");
}
}
});
}else{
// toastr.warning("删除所有图片失败!");
}
}
function delAllImgFun(){
var parentId=$("#pdfId").val();
var maxPicture=$("#pathPdf").val();
var picArr=maxPicture.split("\\");
maxPicture=picArr[picArr.length-1].replace(".pdf","");
if(parentId!=null && parentId!="" && parentId!=undefined){
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
//console.log(parentId+":parentId=====删除所有图片=========maxPicture:"+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImgAll",
type: "POST",
data: {parentId: parentId,maxPicture:maxPicture},
success: function (result) {
getDelPicPageFun();
spinner.spin();
if (result==1) {
toastr.success("删除所有图片成功!");
}
}
});
// $('#delImgPageModal').modal('hide'); //手动关闭
}else{
// toastr.warning("删除所有图片失败!");
}
$('#delImgPageModal').modal('hide'); //手动关闭
}
$("#delAllImgBtn").click(function () {
//弹窗提示不可复原
$('#delImgPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: true,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
});
$("#delImgPageBtn").click(function () {
delAllImgFun();
});
function delPageFun(maxPicture,obj){
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var id=0;
if(obj.id!=null && obj.id!="" && obj.id!="delId_"){
id=parseInt(obj.id.replace("delId_",""));
//console.log(id+"==========删除图片:===="+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImg",
type: "POST",
data: {id: id,maxPicture:maxPicture},
success: function (result) {
setTimeout(function () {
if (result==1) {
getDelPicPageFun();
toastr.success("删除图片成功!");
}else{
toastr.warning("删除图片失败!");
}
$("#mb").css("display","none");
spinner.spin();
}, 500);
}
});
}else{
toastr.warning("图片记录不存在!");
}
}
function getDelPicPageFun() {
var parentId=$("#pdfId").val();
//console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
if(parentId!=null && parentId!=""){
//获取相应的pdf被删除的图片列表
$.ajax({
url: "${path}/inHosp/selDelPicList",
type: "POST",
data: {effective: 1, parentId: parentId},
success: function (result) {
$("#imglist").empty();
var img_div = $("#imglist");
if (result != null && result.length>0) {
//console.log(result);
var img_html="";
var delId="delId_";
var delPageV="delPageV_";
var maxPicture="";
for (var i = 0; i < result.length; i++) {
delId="delId_"+result[i].id;
delPageV="delPageV_"+result[i].id;
//console.log("========="+result[i].id+"======delId:"+delId+"===="+result[i].pictureNumber);
maxPicture=result[i].maxPicture.replaceAll("/","\\");
//console.log(result[i].maxPicture);
img_html="${path}\\"+maxPicture;
img_html="<div class='row showDelDiv'><img class='showImg2' src='"+img_html+"' onclick='javascript:lookBigImg(this)'/>";
img_html+="<div clas='row'>"
+"<input type='number' class='returnPageCls' id='"+delPageV+"' value='"+result[i].pictureNumber+"' style='max-width:40%'/>"
+"<button class='btn btn-primary btn-sm' id='"+delId+"' onclick='javascript:returnPageFun(\""+encodeURIComponent(maxPicture, "UTF-8")+"\",this)'>还原</button>"
+'<button onclick="javascript:delPageFun(\''+encodeURIComponent(maxPicture, "UTF-8")+'\',this);" id="'+delId+'" class="btn btn-danger btn-sm">'+'删除'+'</button>'
+ "</div>";
img_html+="</div>";
$("#imglist").append(img_html);
}
}else{
$("#imglist").append("暂无可删除图片!");
//toastr.warning("暂无删除图片!");
}
}
});
}else{
toastr.warning("记录不存在!");
}
}
//处理导出内容,这个方法可以自定义某一行、某一列、甚至某个单元格的内容,也就是将其值设置为自己想要的内容
function DoOnCellHtmlData(cell, row, col, data) {
@ -2827,10 +3161,10 @@
//console.log("===:" + row.pdfPath + "====" + row.source);
//删除
if (row.pdfPath != null && row.pdfPath != "") {
//console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
if (row.pdfPath.indexOf(row.assortId + ".pdf") == -1) {
var pdfName=row.pdfPath.substring(row.pdfPath.lastIndexOf('\\') + 1, row.pdfPath.lastIndexOf('.') );
if (pdfName!=row.assortId) {
if (row.source != null && row.source != "") {
if (row.source.indexOf("后台") != -1) {
if(row.source.indexOf("后台") != -1){
html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
}
}
@ -2937,15 +3271,34 @@
//同步
$("#idPdfT").val(row.id);
}, 'click .delPdfPage': function (e, value, row, index) {
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
var pdfPath=row.pdfPath.replaceAll("\\","/");
//C:/Users/Administrator/Desktop/test/autoPdf/1617156631367.pdf
if(pdfPath!=""){
pdfPath="${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath);
$('#pdf_page').attr('src', pdfPath);
//病案号 45e9b098f9da49ffba1843bfc6930cb8
}else{
toastr.warning("勾选的PDF文件不存在或破损");
}
//删除pdf某一页
$('#delPdfPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
// //同步
$("#pdfId").val(row.id);
$("#pathPdf").val(row.pdfPath);
getDelPicPageFun();
setTimeout(function () {
$("#mb").css("display","none");
spinner.spin();
}, 1500);
}
},
cellStyle: function (value, row, index) {
@ -3882,58 +4235,112 @@
//删除pdf页码
$("#delPageBtn").click(function () {
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
var pagePdfVal=$("#pagePdf").val();
if(pagePdfVal==null ||pagePdfVal=="" ){
toastr.warning("页码必填!");
return;
}
if(pagePdfVal!=null && pagePdfVal!="" ){
if(pagePdfVal<=0){
toastr.warning("起始页码大于0且必填");
return;
}
}
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!="" && pagePdfVal!=null && pagePdfVal!=""){
if($("#pagePdf2").val()<=0){
toastr.warning("结尾页码需大于0!");
return;
}else if($("#pagePdf2").val()<$("#pagePdf").val()){
toastr.warning("结尾页码必须大于起始页码!");
return;
}
}
$("#numDel").empty();
if($("#pagePdf").val()!="" && $("#pagePdf").val()!=null) {
$("#numDel").append($("#pagePdf").val());
if($("#pagePdf2").val()!="" && $("#pagePdf2").val()!=null){
$("#numDel").append("至"+$("#pagePdf2").val());
}
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
}else{
toastr.warning("请输入页码!");
}
});
//确认删除pdf页码
$("#delPageBtn2").click(function () {
$('#delPdfPageModal2').modal('hide'); //手动关闭
var entity={};
entity.id= $("#pdfId").val();
entity.title = ""+$("#pagePdf").val();
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!=null) {
entity.sys = "" + $("#pagePdf2").val();
}else{
entity.sys ="";
}
entity.pdfPath = $("#pathPdf").val();
if(entity.id==null ||entity.id=="" ){
toastr.warning("id不为空");
toastr.warning("id不为空!");
return;
} if(entity.title==null ||entity.title=="" ){
toastr.warning("页码必填!");
}
if(entity.title==null ||entity.title=="" ){
toastr.warning("起始页码必填!");
return;
} if(entity.title!=null && entity.title!="" ){
}
if(entity.title!=null && entity.title!="" ){
if(entity.title<=0){
toastr.warning("页码大于0必填");
toastr.warning("起始页码大于0必填!");
return;
}
} if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在");
}
if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在!");
return;
}
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/delPdfPage",
type: "POST",
data:entity,
success: function (result) {
$("#mb").css("display","none");
spinner.spin();
$("#pagePdf").val("");
$("#pagePdf2").val("");
//$('#delPdfPageModal').modal('hide'); //手动关闭
if (result == 1) {
//刷新
var pageNum=$("#pageNumber").val();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
$("#pageNumber").val(pageNum);
getDelPicPageFun();
$('#table2').bootstrapTable('refresh');
initTree($("#idLab").html());
$('#delPdfPageModal').modal('hide'); //手动关闭
$('#delPdfPageModal2').modal('hide'); //手动关闭
toastr.success("删除pdf页数,第"+entity.title+"页成功!");
if( entity.sys =="") {
toastr.success("删除pdf页数,第" + entity.title + "页成功!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成功!");
}
} else if (result ==0){
toastr.error("删除pdf页数,第"+entity.title+"页失败!");
if( entity.sys =="") {
toastr.warning("删除pdf页数,第"+entity.title+"页失败!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成失败!");
}
}else if (result == 2){
toastr.error("pdf文件不存在");
toastr.warning("pdf文件不存在");
}else if(result==3){
toastr.error("删除页数大于总页数!");
toastr.warning("删除页码或页数不得大于总页数!");
}else if(result==4){
toastr.error("删除页码前备份失败!");
toastr.warning("删除页码前备份失败!");
}else if(result==5){
toastr.warning("只剩一页不可再删!");
}
}, error: function () {
toastr.error("操作失败!");

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<html>
@ -16,6 +16,7 @@
<%@ include file="../../jspf/ztreeCommom.jsp" %>
<style>
.modal-header2 {
height: 30px;
text-align: center !important;
vertical-align: middle !important;
background-color: #3c8dbc !important;
@ -145,31 +146,94 @@
}
.showImg {
width: 80%;
height: 100%
width: 100%;
/*height: 100%*/
}
.shadeImg {
height: 950px;
height:100%;
}
#delPdfPageModal2 > div > div {
margin-top: 20%;
margin-left: 60%;
width: 400px;
width: 100%;
!important;
}
/*#delPdfPageModal{
width: 120%;
!important;
}*/
#mb{
display: none;
height: 120%;
width: 100%;
/*position: fixed;*/
position: absolute;
z-index: 1200;
/*height: 1380px;*/
background: #FFF;
top:0;
left: 0;
opacity:0.6;
}
#arrow {
color: #fff;
background: #000;
width: 20px;
height: 90px;
line-height: 90px;
font-size: 12px;
font-family: "宋体";
text-align: center;
font-weight: bold;
float: left;
}
/*.panel-primary > .panel-heading{*/
/*background-color: #3c8dbc;*/
/*border-color: #3c8dbc;*/
/*border-color: #3c8dbc;e5e5e5*/
/*}*/
.showDelDiv{
border: 1px solid #e5e5e5;
width: 90%;
margin-bottom: 5px;
}
.showImg2 {
margin-left: 2%;
margin-bottom: 2px;
width:95%;
height: 200px;
}
.imglist{
margin-left: 15px;
margin-bottom: 5px;
width: 90%;
height: 200px;
}
.returnPageCls{
margin-right: 2px;
}
#addDelDiv{
width: 85%;
background-color: #0b93d5;
text-align: center;
color: red;
}
#delAllImgBtn{
width: 35%;
}
#addPdfPageBtn{
width: 40%;
}
#delImgPageModalCss{
margin-left: 20%;
}
</style>
</head>
<body>
<div id="mb"></div>
<%--<div class="panel panel-primary">--%>
<%--<div class="panel-heading">--%>
<%--<h3 class="panel-title">在院浏览</h3>--%>
@ -467,6 +531,11 @@
</div>
</div>
</div>
<%--多图片框--%>
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel">
@ -539,21 +608,21 @@
<%--发大弹窗--%>
<div class="modal fade" id="maxImg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-body" STYLE="height: 950px">
<div class="modal-header2" style="width: 165%" >
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-content " >
<div class="modal-body" style="height:100%;">
<div class="shadeImg" onclick="javascript:closeShadeImg()">
<div class="">
<img class="showImg" src=""/>
</div>
</div>
</div>
<div class="modal-footer">
<%-- <div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>
</div>--%>
</div>
</div>
</div>
@ -595,6 +664,7 @@
<form>
<div class="form-group">
<input type="hidden" id="idPdfT" name="idPdfT" value=""/>
<input type="hidden" id="pdfFileName" name="pdfFileName" value=""/>
<label class="control-label">是否删除该记录?</label>
</div>
</form>
@ -631,35 +701,57 @@
</div>
</div>
<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-content " style="width:220%;margin-left:-15%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">PDF页信息</h4>
</div>
<div class="modal-body divCss2">
<form>
<div class="form-group ">
<input id="pdfId" hidden/>
<span style="vertical-align:top;">pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf"></textarea>
<div class="modal-body divCss2" id="delPdfBody">
<div class="row form-inline">
<div style="width: 80%;float:left;" id="pdfDiv">
<iframe id="pdf_page" name="pdf_page" style="width:100%;height:100%;"></iframe>
</div>
<div class="form-group " >
<span style="vertical-align:top;">删除页码:</span>
<input type="number" id="pagePdf"/>
<div id="arrow">&gt;</div>
<div style="width: 18%;height:100%;float:right;overflow-y:scroll;overflow-x: hidden;" id="infoDiv">
<form>
<div class="row " hidden>
<input id="pdfId" hidden/>
<span style="vertical-align:top;" hidden>pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf" hidden></textarea>
<textarea rows="6" readonly id="pathPdfR" hidden></textarea>
</div>
<div class="row" style="margin-left:5px; " >
页码:
<input type="number" id="pagePdf" style="max-width:20%"/>-<input type="number" id="pagePdf2" style="max-width:20%"/>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</form>
<!--获取所有删除图片的列表-->
<%--<div class="row" id="delPicListdiv" style="margin-left: 15px;">
<img class="showImg2" src="http://192.168.1.106:8080/emr_medical_record/static/img/login.jpg" onclick='javascript:lookBigImg(this)'/>/>
<div row></div>
</div>--%>
<div class="row" style="margin-left:15px; ">
<div class="row" id="addDelDiv">---不可恢复--</div>
<div class="row">
<%--<button type="button" class="btn btn-warning btn-sm" id="addPdfPageBtn" onclick="addPdfPageFun()">PDF添加页码</button>--%>
<button type="button" class="btn btn-warning btn-sm" id="returnPdfBtn" onclick="returnPdfFun()">还原最初PDF</button>
<button type="button" class="btn btn-danger btn-sm" id="delAllImgBtn" >删除全部图片</button>
</div>
</div>
<div class="imglist" id="imglist">
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</div>
</div>
@ -677,7 +769,7 @@
<div class="modal-body" >
<form>
<div class="form-group">
<label class="control-label">删除页码并备份旧版本为作废,是否删除?</label>
<label class="control-label" >是否删除pdf第<span id="numDel"></span>的页面</label>
</div>
</form>
</div>
@ -688,6 +780,32 @@
</div>
</div>
</div>
<%--确认框提示清空所有图片--%>
<div class="modal fade" id="delImgPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content delImgPageModalCss" style="width: 70%;margin-left: 30%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label class="control-label">删除所有的图片将不可恢复,是否删除?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delImgPageBtn">确认</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
@ -702,6 +820,21 @@
var objUrl;
var img_html;
var oMoveBox = $("#arrow"), infoDiv = $("#infoDiv"), maxL =0;
oMoveBox.click(function () {
if(maxL>0){
maxL = 0;
$("#pdfDiv").css("width", '80%');
$("#arrow").html(">");
$("#infoDiv").show();
}else{
maxL = 1;
$("#pdfDiv").css("width", '97%');
$("#arrow").html("<" );
$("#infoDiv").hide();
}
});
$("#myFile").change(function () {
var img_div = $(".img_div");
var filepath = $("input[name='myFile']").val();
@ -912,10 +1045,10 @@
getAssortFun();
var opts = {
/* var opts = {
lines: 13, // The number of lines to draw |小长条的数量
length: 20, // The length of each line |小长条的长度
width: 5, // The line thickness |小长条的宽度
width: 7, // The line thickness |小长条的宽度
// left:"50%",
radius: 15, // The radius of the inner circle |内环的半径长
corners: 1, // Corner roundness (0..1)
@ -928,12 +1061,31 @@
hwaccel: false, // Whether to use hardware acceleration |加速
className: 'spinner', // The CSS class to assign to the spinner |类名spinner
zIndex: 2e9, // The z-index (defaults to 2000000000) |显示在最顶层
top: '70%', // Top position relative to parent in px |相对父元素的top
//left: '90' // Left position relative to parent in px |相对父元素的left 默认情况spinner是显示于父元素居中位置
top: '25%', // spinner 相对父容器Top定位 单位 px
left: '50%'// spinner 相对父容器Left定位 单位 px
};*/
var opts = {
lines: 13, // 花瓣数目
length: 20, // 花瓣长度
width: 10, // 花瓣宽度
radius: 30, // 花瓣距中心半径
corners: 1, // 花瓣圆滑度 (0-1)
rotate: 0, // 花瓣旋转角度
direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针
color: '#000', // 花瓣颜色
speed: 1, // 花瓣旋转速度
trail: 60, // 花瓣旋转时的拖影(百分比)
shadow: false, // 花瓣是否显示阴影
hwaccel: false, //spinner 是否启用硬件加速及高速旋转
className: 'spinner', // spinner css 样式名称
zIndex: 2e9, // spinner的z轴 (默认是2000000000)
top: '50%', // spinner 相对父容器Top定位 单位 px
left: '450%'// spinner 相对父容器Left定位 单位 px
};
var spinner = new Spinner(opts);
var url = "";
function uploadFileAndDate(){
@ -1053,7 +1205,7 @@
//console.log(result[i].maxPicture);
var fileName = result[i].maxPicture.split("\\");
var parentdiv = $("<div class='isImg' id='" + result[i].id + "'></div>");
var imgTig = $("<img onclick='javascript:lookBigImg(this)' style='height: 100%; width: 100%;'/>");
var imgTig = $("<img onclick='javascript:lookBigImg(this)' style='height: 150%; width: 100%;'/>");
//创建一个img
imgTig.attr('id', fileName[fileName.length - 1]);
@ -1287,7 +1439,9 @@
data: {idStr: idStr,flag:flag},
success: function (result) {
if (result != "") {
var pdfPath=result;
console.log(result);
//本机E盘下PDF
//var pdfPath = "C:/Users/Administrator/Desktop/测试/123.pdf";
//encodeURIComponent()处理http请求进行转化
@ -1441,11 +1595,241 @@
}
});
}
getDept();
});
function returnPdfFun(){
//console.log("======还原PDF=======");
var parentId=$("#pdfId").val();
if(parentId!="" &&parentId!=null ){
$.ajax({
url: "${path}/inHosp/returnPdfFile",
type: "POST",
data: {id:parentId},
success: function (result) {
setTimeout(function () {
if(result=="") {
$("#mb").css("display", "none");
getDelPicPageFun();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
toastr.success("pdf文件还原备份成功!");
}else{
toastr.warning(result);
}
}, 1000);
}
});
}else{
toastr.warning("暂无备份pdf文件!");
}
}
function returnPageFun(maxPicture,btnObj){
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var minPicture=null;
var parentId=$("#pdfId").val();
// var parentId=$("#pdfId").val();
var inpuObj=btnObj.parentNode.firstChild ;
var delPage=inpuObj.value;
if(delPage=="" || delPage==null || delPage<0){
toastr.warning("请输入还原的页码大于等于0!");
return;
}
var delid=btnObj.id;
var id=0;
var pictureNumber=0;
if(delid!="" &&delid!=null && delid!="delId_"){
delid=delid.replace("delId_","");
id=parseInt(delid);
}
if(delPage!="" &&delPage!=null && delPage>=0){
pictureNumber=delPage;
}
if($("#pathPdf").val()!=null && $("#pathPdf").val()!="" && $("#pathPdf").val()!=undefined && $("#pathPdf").val()!="undefined"){
minPicture=$("#pathPdf").val();
}
if(id!=0 && pictureNumber>=0){
var entity={};
entity.id=id;
entity.pictureNumber=pictureNumber;
entity.maxPicture=maxPicture;
entity.minPicture=minPicture;
entity.parentId=parentId;
//console.log(entity);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/returnPage",
type: "POST",
data: entity,
success: function (result) {
setTimeout(function () {
//if(result!=null && result!="") {
if (result.indexOf("成功")!=-1) {
getDelPicPageFun();
// $('#pdf_page').attr('src', result);
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
toastr.success(result);
} else {
toastr.warning(result);
}
// }else{
// toastr.warning("图片还原失败!");
// }
$("#mb").css("display","none");
spinner.spin();
}, 2000);
}
});
}
}
function addPdfPageFun(){
var maxPicture=$("#pathPdf").val();
if(maxPicture!=null && maxPicture!="" && maxPicture!=undefined){
//console.log("=====添加pdf页码成功=========maxPicture:"+maxPicture);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/addPdfPageBtn",
type: "POST",
data: {maxPicture:maxPicture},
success: function (result) {
$("#mb").css("display","none");
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
if (result==1) {
toastr.success("添加pdf页码成功!");
}
}
});
}else{
// toastr.warning("删除所有图片失败!");
}
}
function delAllImgFun(){
var parentId=$("#pdfId").val();
var maxPicture=$("#pathPdf").val();
var picArr=maxPicture.split("\\");
maxPicture=picArr[picArr.length-1].replace(".pdf","");
if(parentId!=null && parentId!="" && parentId!=undefined){
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
//console.log(parentId+":parentId=====删除所有图片=========maxPicture:"+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImgAll",
type: "POST",
data: {parentId: parentId,maxPicture:maxPicture},
success: function (result) {
getDelPicPageFun();
spinner.spin();
if (result==1) {
toastr.success("删除所有图片成功!");
}
}
});
// $('#delImgPageModal').modal('hide'); //手动关闭
}else{
// toastr.warning("删除所有图片失败!");
}
$('#delImgPageModal').modal('hide'); //手动关闭
}
$("#delAllImgBtn").click(function () {
//弹窗提示不可复原
$('#delImgPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: true,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
});
$("#delImgPageBtn").click(function () {
delAllImgFun();
});
function delPageFun(maxPicture,obj){
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var id=0;
if(obj.id!=null && obj.id!="" && obj.id!="delId_"){
id=parseInt(obj.id.replace("delId_",""));
//console.log(id+"==========删除图片:===="+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImg",
type: "POST",
data: {id: id,maxPicture:maxPicture},
success: function (result) {
setTimeout(function () {
if (result==1) {
getDelPicPageFun();
toastr.success("删除图片成功!");
}else{
toastr.warning("删除图片失败!");
}
$("#mb").css("display","none");
spinner.spin();
}, 500);
}
});
}else{
toastr.warning("图片记录不存在!");
}
}
function getDelPicPageFun() {
var parentId=$("#pdfId").val();
//console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
if(parentId!=null && parentId!=""){
//获取相应的pdf被删除的图片列表
$.ajax({
url: "${path}/inHosp/selDelPicList",
type: "POST",
data: {effective: 1, parentId: parentId},
success: function (result) {
$("#imglist").empty();
var img_div = $("#imglist");
if (result != null && result.length>0) {
//console.log(result);
var img_html="";
var delId="delId_";
var delPageV="delPageV_";
var maxPicture="";
for (var i = 0; i < result.length; i++) {
delId="delId_"+result[i].id;
delPageV="delPageV_"+result[i].id;
//console.log("========="+result[i].id+"======delId:"+delId+"===="+result[i].pictureNumber);
maxPicture=result[i].maxPicture.replaceAll("/","\\");
//console.log(result[i].maxPicture);
img_html="${path}\\"+maxPicture;
img_html="<div class='row showDelDiv'><img class='showImg2' src='"+img_html+"' onclick='javascript:lookBigImg(this)'/>";
img_html+="<div clas='row'>"
+"<input type='number' class='returnPageCls' id='"+delPageV+"' value='"+result[i].pictureNumber+"' style='max-width:40%'/>"
+"<button class='btn btn-primary btn-sm' id='"+delId+"' onclick='javascript:returnPageFun(\""+encodeURIComponent(maxPicture, "UTF-8")+"\",this)'>还原</button>"
+'<button onclick="javascript:delPageFun(\''+encodeURIComponent(maxPicture, "UTF-8")+'\',this);" id="'+delId+'" class="btn btn-danger btn-sm">'+'删除'+'</button>'
+ "</div>";
img_html+="</div>";
$("#imglist").append(img_html);
}
}else{
$("#imglist").append("暂无可删除图片!");
//toastr.warning("暂无删除图片!");
}
}
});
}else{
toastr.warning("记录不存在!");
}
}
<%--function getDept() {--%>
<%--//获取科室列表--%>
@ -1612,8 +1996,8 @@
deptAdmissionTo = $("#deptAdmissionTo").val();
}
}*/
var temp = {
limit: limit, //页面大小
offset: offset, //页码
@ -1633,7 +2017,7 @@
};
return temp;
},
sortName: 'id', // 要排序的字段
@ -1988,8 +2372,8 @@
//console.log("===:" + row.pdfPath + "====" + row.source);
//删除
if (row.pdfPath != null && row.pdfPath != "") {
//console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
if (row.pdfPath.indexOf(row.assortId + ".pdf") == -1) {
var pdfName=row.pdfPath.substring(row.pdfPath.lastIndexOf('\\') + 1, row.pdfPath.lastIndexOf('.') );
if (pdfName!=row.assortId) {
if (row.source != null && row.source != "") {
if(row.source.indexOf("后台") != -1){
html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
@ -2017,7 +2401,7 @@
return html;
}, events: {
'click .editInfo': function (e, value, row, index) {
if (row.pdfPath != null && row.pdfPath != "") {
//console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
if (row.pdfPath.indexOf(row.assortId + ".pdf") != -1) {
@ -2093,16 +2477,40 @@
});
//同步
$("#idPdfT").val(row.id);
var pdfFileName=row.pdfPath;
if(pdfFileName!=null && pdfFileName!="") {
pdfFileName=pdfFileName.substring(pdfFileName.lastIndexOf('\\') + 1, pdfFileName.lastIndexOf('.'));
$("#pdfFileName").val(pdfFileName);
}
}, 'click .delPdfPage': function (e, value, row, index) {
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
var pdfPath=row.pdfPath.replaceAll("\\","/");
//C:/Users/Administrator/Desktop/test/autoPdf/1617156631367.pdf
if(pdfPath!=""){
pdfPath="${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath);
$('#pdf_page').attr('src', pdfPath);
//病案号 45e9b098f9da49ffba1843bfc6930cb8
}else{
toastr.warning("勾选的PDF文件不存在或破损");
}
//删除pdf某一页
$('#delPdfPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
// //同步
$("#pdfId").val(row.id);
$("#pathPdf").val(row.pdfPath);
getDelPicPageFun();
setTimeout(function () {
$("#mb").css("display","none");
spinner.spin();
}, 1500);
}
},
cellStyle: function (value, row, index) {
@ -2484,7 +2892,7 @@
toastr.warning("请选择记录!");
return;
}
console.log(id);
//console.log(id);
$.ajax({
url: "${path}/inHosp/updateStateAll",
type: "POST",
@ -2561,13 +2969,13 @@
$("#statePdfBtn").click(function () {
$('#delPdfModal').modal('hide'); //手动关闭
var id = $("#idPdfT").val();
//console.log("===作废事件=======" + id);
var pdfPath=$("#pdfFileName").val();
//console.log(id+"===作废事件=======" +pdfPath);
$.ajax({
url: "${path}/inHosp/delPdfInfo",
type: "POST",
data: {"id": id},
data: {"id": id,"pdfPath":pdfPath},
success: function (result) {
if (result == 1) {
//刷新
$('#table2').bootstrapTable('refresh');
@ -2586,57 +2994,112 @@
//删除pdf页码
$("#delPageBtn").click(function () {
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
var pagePdfVal=$("#pagePdf").val();
if(pagePdfVal==null ||pagePdfVal=="" ){
toastr.warning("页码必填!");
return;
}
if(pagePdfVal!=null && pagePdfVal!="" ){
if(pagePdfVal<=0){
toastr.warning("起始页码大于0且必填");
return;
}
}
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!="" && pagePdfVal!=null && pagePdfVal!=""){
if($("#pagePdf2").val()<=0){
toastr.warning("结尾页码需大于0!");
return;
}else if($("#pagePdf2").val()<$("#pagePdf").val()){
toastr.warning("结尾页码必须大于起始页码!");
return;
}
}
$("#numDel").empty();
if($("#pagePdf").val()!="" && $("#pagePdf").val()!=null) {
$("#numDel").append($("#pagePdf").val());
if($("#pagePdf2").val()!="" && $("#pagePdf2").val()!=null){
$("#numDel").append("至"+$("#pagePdf2").val());
}
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
}else{
toastr.warning("请输入页码!");
}
});
//确认删除pdf页码
$("#delPageBtn2").click(function () {
$('#delPdfPageModal2').modal('hide'); //手动关闭
var entity={};
entity.id= $("#pdfId").val();
entity.title = ""+$("#pagePdf").val();
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!=null) {
entity.sys = "" + $("#pagePdf2").val();
}else{
entity.sys ="";
}
entity.pdfPath = $("#pathPdf").val();
if(entity.id==null ||entity.id=="" ){
toastr.warning("id不为空");
toastr.warning("id不为空!");
return;
} if(entity.title==null ||entity.title=="" ){
toastr.warning("页码必填!");
}
if(entity.title==null ||entity.title=="" ){
toastr.warning("起始页码必填!");
return;
} if(entity.title!=null && entity.title!="" ){
}
if(entity.title!=null && entity.title!="" ){
if(entity.title<=0){
toastr.warning("页码大于0必填");
toastr.warning("起始页码大于0必填!");
return;
}
} if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在");
}
if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在!");
return;
}
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/delPdfPage",
type: "POST",
data:entity,
success: function (result) {
$("#mb").css("display","none");
spinner.spin();
$("#pagePdf").val("");
$('#delPdfPageModal').modal('hide'); //手动关闭
$('#delPdfPageModal2').modal('hide'); //手动关闭
$("#pagePdf2").val("");
//$('#delPdfPageModal').modal('hide'); //手动关闭
if (result == 1) {
//刷新
var pageNum=$("#pageNumber").val();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
$("#pageNumber").val(pageNum);
getDelPicPageFun();
$('#table2').bootstrapTable('refresh');
initTree($("#idLab").html());
toastr.success("删除pdf页数,第"+entity.title+"页成功!");
if( entity.sys =="") {
toastr.success("删除pdf页数,第" + entity.title + "页成功!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成功!");
}
} else if (result ==0){
toastr.error("删除pdf页数,第"+entity.title+"页失败!");
if( entity.sys =="") {
toastr.warning("删除pdf页数,第"+entity.title+"页失败!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成失败!");
}
}else if (result == 2){
toastr.error("pdf文件不存在");
toastr.warning("pdf文件不存在");
}else if(result==3){
toastr.error("删除页码大于总页数!");
toastr.warning("删除页码或页数不得大于总页数!");
}else if(result==4){
toastr.error("删除页码前备份失败!");
toastr.warning("删除页码前备份失败!");
}else if(result==5){
toastr.warning("只剩一页不可再删!");
}
}, error: function () {
toastr.error("操作失败!");

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
@ -20,6 +20,7 @@
<link rel="stylesheet" href="${path}/static/bootstrap-3.3.7/bootstrap-table-fixed-columns.css" type="text/css">
<style>
.modal-header2 {
height: 30px;
text-align: center !important;
vertical-align: middle !important;
background-color: #3c8dbc !important;
@ -147,12 +148,12 @@
}
.showImg {
width: 80%;
height: 100%
width: 100%;
/*height: 100%*/
}
.shadeImg {
height: 950px;
height:100%;
}
#returnModal .modal-content {
@ -191,11 +192,76 @@
top: 40px !important;
/*height:226px!important;*/
}
#mb{
display: none;
height: 120%;
width: 100%;
/*position: fixed;*/
position: absolute;
z-index: 1200;
/*height: 1380px;*/
background: #FFF;
top:0;
left: 0;
opacity:0.6;
}
#arrow {
color: #fff;
background: #000;
width: 20px;
height: 90px;
line-height: 90px;
font-size: 12px;
font-family: "宋体";
text-align: center;
font-weight: bold;
float: left;
}
/*.panel-primary > .panel-heading{*/
/*background-color: #3c8dbc;*/
/*border-color: #3c8dbc;*/
/*}*/
.showDelDiv{
border: 1px solid #e5e5e5;
width: 90%;
margin-bottom: 5px;
}
.showImg2 {
margin-left: 2%;
margin-bottom: 2px;
width:95%;
height: 200px;
}
.imglist{
margin-left: 15px;
margin-bottom: 5px;
width: 90%;
height: 200px;
}
.returnPageCls{
margin-right: 2px;
}
#addDelDiv{
width: 85%;
background-color: #0b93d5;
text-align: center;
color: red;
}
#delAllImgBtn{
width: 35%;
}
#addPdfPageBtn{
width: 40%;
}
#delImgPageModalCss{
margin-left: 20%;
}
</style>
</head>
<body>
<div id="mb"></div>
<div style="margin-left:30px;margin-right:10px;height:auto">
<!--搜索-->
<form style="margin-top:20px;">
@ -634,21 +700,21 @@
<%--发大弹窗--%>
<div class="modal fade" id="maxImg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-header2" style="width: 165%">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-body" STYLE="height: 950px">
<div class="modal-body" style="height: 80%;">
<div class="shadeImg" onclick="javascript:closeShadeImg()">
<div class="">
<img class="showImg" src=""/>
</div>
</div>
</div>
<div class="modal-footer">
<%--<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>
</div>--%>
</div>
</div>
</div>
@ -852,45 +918,60 @@
</div>
</div>
</div>
<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-content " style="width:220%;margin-left:-15%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">PDF页信息</h4>
</div>
<div class="modal-body divCss2">
<form>
<div class="form-group ">
<input id="pdfId" hidden/>
<span style="vertical-align:top;">pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf"></textarea>
<div class="modal-body divCss2" id="delPdfBody">
<div class="row form-inline">
<div style="width: 80%;float:left;" id="pdfDiv">
<iframe id="pdf_page" name="pdf_page" style="width:100%;height:100%;"></iframe>
</div>
<div class="form-group " >
<span style="vertical-align:top;">删除页码:</span>
<input type="number" id="pagePdf"/>
<div id="arrow">&gt;</div>
<div style="width: 18%;height:100%;float:right;overflow-y:scroll;overflow-x: hidden;" id="infoDiv">
<form>
<div class="row " hidden>
<input id="pdfId" hidden/>
<span style="vertical-align:top;" hidden>pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf" hidden></textarea>
</div>
<div class="row" style="margin-left:5px; " >
页码:
<input type="number" id="pagePdf" style="max-width:20%"/>-<input type="number" id="pagePdf2" style="max-width:20%"/>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</form>
<div class="row" style="margin-left:15px; ">
<div class="row" id="addDelDiv">---不可恢复--</div>
<div class="row">
<%--<button type="button" class="btn btn-warning btn-sm" id="addPdfPageBtn" onclick="addPdfPageFun()">PDF添加页码</button>--%>
<button type="button" class="btn btn-warning btn-sm" id="returnPdfBtn" onclick="returnPdfFun()">还原最初PDF</button>
<button type="button" class="btn btn-danger btn-sm" id="delAllImgBtn" >删除全部图片</button>
</div>
</div>
<div class="imglist" id="imglist">
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</div>
</div>
</div>
<%--删除pdf某页确认框--%>
<div class="modal fade" id="delPdfPageModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content " >
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
@ -899,7 +980,7 @@
<div class="modal-body" >
<form>
<div class="form-group">
<label class="control-label">删除页码并备份旧版本为作废,是否删除?</label>
<label class="control-label" >是否删除pdf第<span id="numDel"></span>的页面</label>
</div>
</form>
</div>
@ -911,7 +992,29 @@
</div>
</div>
<%--确认框提示清空所有图片--%>
<div class="modal fade" id="delImgPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content delImgPageModalCss" style="width: 70%;margin-left: 30%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label class="control-label">删除所有的图片将不可恢复,是否删除?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delImgPageBtn">确认</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
@ -1134,27 +1237,24 @@
getAssortFun();
var opts = {
lines: 13, // The number of lines to draw |小长条的数量
length: 20, // The length of each line |小长条的长度
width: 5, // The line thickness |小长条的宽度
//left: "50%",
radius: 15, // The radius of the inner circle |内环的半径长
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset |旋转角度
direction: 1, // 1: clockwise, -1: counterclockwise |1顺时针方向 -1逆时针方向
color: '#000', // #rgb or #rrggbb or array of colors |颜色
speed: 1, // Rounds per second |每秒转多少圈
trail: 60, // Afterglow percentage |余晖效果百分比
shadow: false, // Whether to render a shadow |渲染阴影
hwaccel: false, // Whether to use hardware acceleration |加速
className: 'spinner', // The CSS class to assign to the spinner |类名spinner
zIndex: 2e9, // The z-index (defaults to 2000000000) |显示在最顶层
top: '70%', // Top position relative to parent in px |相对父元素的top
//left: '90' // Left position relative to parent in px |相对父元素的left 默认情况spinner是显示于父元素居中位置
lines: 13, // 花瓣数目
length: 20, // 花瓣长度
width: 10, // 花瓣宽度
radius: 30, // 花瓣距中心半径
corners: 1, // 花瓣圆滑度 (0-1)
rotate: 0, // 花瓣旋转角度
direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针
color: '#000', // 花瓣颜色
speed: 1, // 花瓣旋转速度
trail: 60, // 花瓣旋转时的拖影(百分比)
shadow: false, // 花瓣是否显示阴影
hwaccel: false, //spinner 是否启用硬件加速及高速旋转
className: 'spinner', // spinner css 样式名称
zIndex: 2e9, // spinner的z轴 (默认是2000000000)
top: '50%', // spinner 相对父容器Top定位 单位 px
left: '450%'// spinner 相对父容器Left定位 单位 px
};
var spinner = new Spinner(opts);
var url = "";
function uploadFileAndDate() {
@ -1774,6 +1874,239 @@
getFaultType();
function returnPdfFun(){
//console.log("======还原PDF=======");
var parentId=$("#pdfId").val();
if(parentId!="" &&parentId!=null ){
$.ajax({
url: "${path}/inHosp/returnPdfFile",
type: "POST",
data: {id:parentId},
success: function (result) {
setTimeout(function () {
if(result=="") {
$("#mb").css("display", "none");
getDelPicPageFun();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
toastr.success("pdf文件还原备份成功!");
}else{
toastr.warning(result);
}
}, 1000);
}
});
}else{
toastr.warning("暂无备份pdf文件!");
}
}
function returnPageFun(maxPicture,btnObj){
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var minPicture=null;
var parentId=$("#pdfId").val();
// var parentId=$("#pdfId").val();
var inpuObj=btnObj.parentNode.firstChild ;
var delPage=inpuObj.value;
if(delPage=="" || delPage==null || delPage<0){
toastr.warning("请输入还原的页码大于等于0!");
return;
}
var delid=btnObj.id;
var id=0;
var pictureNumber=0;
if(delid!="" &&delid!=null && delid!="delId_"){
delid=delid.replace("delId_","");
id=parseInt(delid);
}
if(delPage!="" &&delPage!=null && delPage>=0){
pictureNumber=delPage;
}
if($("#pathPdf").val()!=null && $("#pathPdf").val()!="" && $("#pathPdf").val()!=undefined && $("#pathPdf").val()!="undefined"){
minPicture=$("#pathPdf").val();
}
if(id!=0 && pictureNumber>=0){
var entity={};
entity.id=id;
entity.pictureNumber=pictureNumber;
entity.maxPicture=maxPicture;
entity.minPicture=minPicture;
entity.parentId=parentId;
//console.log(entity);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/returnPage",
type: "POST",
data: entity,
success: function (result) {
setTimeout(function () {
//if(result!=null && result!="") {
if (result.indexOf("成功")!=-1) {
getDelPicPageFun();
// $('#pdf_page').attr('src', result);
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
toastr.success(result);
} else {
toastr.warning(result);
}
// }else{
// toastr.warning("图片还原失败!");
// }
$("#mb").css("display","none");
spinner.spin();
}, 2000);
}
});
}
}
function addPdfPageFun(){
var maxPicture=$("#pathPdf").val();
if(maxPicture!=null && maxPicture!="" && maxPicture!=undefined){
//console.log("=====添加pdf页码成功=========maxPicture:"+maxPicture);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/addPdfPageBtn",
type: "POST",
data: {maxPicture:maxPicture},
success: function (result) {
$("#mb").css("display","none");
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
if (result==1) {
toastr.success("添加pdf页码成功!");
}
}
});
}else{
// toastr.warning("删除所有图片失败!");
}
}
function delAllImgFun(){
var parentId=$("#pdfId").val();
var maxPicture=$("#pathPdf").val();
var picArr=maxPicture.split("\\");
maxPicture=picArr[picArr.length-1].replace(".pdf","");
if(parentId!=null && parentId!="" && parentId!=undefined){
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
//console.log(parentId+":parentId=====删除所有图片=========maxPicture:"+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImgAll",
type: "POST",
data: {parentId: parentId,maxPicture:maxPicture},
success: function (result) {
getDelPicPageFun();
spinner.spin();
if (result==1) {
toastr.success("删除所有图片成功!");
}
}
});
// $('#delImgPageModal').modal('hide'); //手动关闭
}else{
// toastr.warning("删除所有图片失败!");
}
$('#delImgPageModal').modal('hide'); //手动关闭
}
$("#delAllImgBtn").click(function () {
//弹窗提示不可复原
$('#delImgPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: true,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
});
$("#delImgPageBtn").click(function () {
delAllImgFun();
});
function delPageFun(maxPicture,obj){
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var id=0;
if(obj.id!=null && obj.id!="" && obj.id!="delId_"){
id=parseInt(obj.id.replace("delId_",""));
//console.log(id+"==========删除图片:===="+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImg",
type: "POST",
data: {id: id,maxPicture:maxPicture},
success: function (result) {
setTimeout(function () {
if (result==1) {
getDelPicPageFun();
toastr.success("删除图片成功!");
}else{
toastr.warning("删除图片失败!");
}
$("#mb").css("display","none");
spinner.spin();
}, 500);
}
});
}else{
toastr.warning("图片记录不存在!");
}
}
function getDelPicPageFun() {
var parentId=$("#pdfId").val();
//console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
if(parentId!=null && parentId!=""){
//获取相应的pdf被删除的图片列表
$.ajax({
url: "${path}/inHosp/selDelPicList",
type: "POST",
data: {effective: 1, parentId: parentId},
success: function (result) {
$("#imglist").empty();
var img_div = $("#imglist");
if (result != null && result.length>0) {
//console.log(result);
var img_html="";
var delId="delId_";
var delPageV="delPageV_";
var maxPicture="";
for (var i = 0; i < result.length; i++) {
delId="delId_"+result[i].id;
delPageV="delPageV_"+result[i].id;
//console.log("========="+result[i].id+"======delId:"+delId+"===="+result[i].pictureNumber);
maxPicture=result[i].maxPicture.replaceAll("/","\\");
//console.log(result[i].maxPicture);
img_html="${path}\\"+maxPicture;
img_html="<div class='row showDelDiv'><img class='showImg2' src='"+img_html+"' onclick='javascript:lookBigImg(this)'/>";
img_html+="<div clas='row'>"
+"<input type='number' class='returnPageCls' id='"+delPageV+"' value='"+result[i].pictureNumber+"' style='max-width:40%'/>"
+"<button class='btn btn-primary btn-sm' id='"+delId+"' onclick='javascript:returnPageFun(\""+encodeURIComponent(maxPicture, "UTF-8")+"\",this)'>还原</button>"
+'<button onclick="javascript:delPageFun(\''+encodeURIComponent(maxPicture, "UTF-8")+'\',this);" id="'+delId+'" class="btn btn-danger btn-sm">'+'删除'+'</button>'
+ "</div>";
img_html+="</div>";
$("#imglist").append(img_html);
}
}else{
$("#imglist").append("暂无可删除图片!");
//toastr.warning("暂无删除图片!");
}
}
});
}else{
toastr.warning("记录不存在!");
}
}
//处理导出内容,这个方法可以自定义某一行、某一列、甚至某个单元格的内容,也就是将其值设置为自己想要的内容
function DoOnCellHtmlData(cell, row, col, data) {
if (row == 0) {
@ -2527,10 +2860,10 @@
//console.log("===:" + row.pdfPath + "====" + row.source);
//删除
if (row.pdfPath != null && row.pdfPath != "") {
//console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
if (row.pdfPath.indexOf(row.assortId + ".pdf") == -1) {
var pdfName=row.pdfPath.substring(row.pdfPath.lastIndexOf('\\') + 1, row.pdfPath.lastIndexOf('.') );
if (pdfName!=row.assortId) {
if (row.source != null && row.source != "") {
if (row.source.indexOf("后台") != -1) {
if(row.source.indexOf("后台") != -1){
html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
}
}
@ -2637,15 +2970,34 @@
//同步
$("#idPdfT").val(row.id);
}, 'click .delPdfPage': function (e, value, row, index) {
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
var pdfPath=row.pdfPath.replaceAll("\\","/");
//C:/Users/Administrator/Desktop/test/autoPdf/1617156631367.pdf
if(pdfPath!=""){
pdfPath="${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath);
$('#pdf_page').attr('src', pdfPath);
//病案号 45e9b098f9da49ffba1843bfc6930cb8
}else{
toastr.warning("勾选的PDF文件不存在或破损");
}
//删除pdf某一页
$('#delPdfPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
// //同步
$("#pdfId").val(row.id);
$("#pathPdf").val(row.pdfPath);
getDelPicPageFun();
setTimeout(function () {
$("#mb").css("display","none");
spinner.spin();
}, 1500);
}
},
cellStyle: function (value, row, index) {
@ -3080,67 +3432,120 @@
});
});
//删除pdf页码
$("#delPageBtn").click(function () {
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
var pagePdfVal=$("#pagePdf").val();
if(pagePdfVal==null ||pagePdfVal=="" ){
toastr.warning("页码必填!");
return;
}
if(pagePdfVal!=null && pagePdfVal!="" ){
if(pagePdfVal<=0){
toastr.warning("起始页码大于0且必填");
return;
}
}
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!="" && pagePdfVal!=null && pagePdfVal!=""){
if($("#pagePdf2").val()<=0){
toastr.warning("结尾页码需大于0!");
return;
}else if($("#pagePdf2").val()<$("#pagePdf").val()){
toastr.warning("结尾页码必须大于起始页码!");
return;
}
}
$("#numDel").empty();
if($("#pagePdf").val()!="" && $("#pagePdf").val()!=null) {
$("#numDel").append($("#pagePdf").val());
if($("#pagePdf2").val()!="" && $("#pagePdf2").val()!=null){
$("#numDel").append("至"+$("#pagePdf2").val());
}
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
}else{
toastr.warning("请输入页码!");
}
});
//确认删除pdf页码
$("#delPageBtn2").click(function () {
$('#delPdfPageModal2').modal('hide'); //手动关闭
var entity={};
entity.id= $("#pdfId").val();
entity.title = ""+$("#pagePdf").val();
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!=null) {
entity.sys = "" + $("#pagePdf2").val();
}else{
entity.sys ="";
}
entity.pdfPath = $("#pathPdf").val();
if(entity.id==null ||entity.id=="" ){
toastr.warning("id不为空");
toastr.warning("id不为空!");
return;
} if(entity.title==null ||entity.title=="" ){
toastr.warning("页码必填!");
}
if(entity.title==null ||entity.title=="" ){
toastr.warning("起始页码必填!");
return;
} if(entity.title!=null && entity.title!="" ){
}
if(entity.title!=null && entity.title!="" ){
if(entity.title<=0){
toastr.warning("页码大于0必填");
toastr.warning("起始页码大于0必填!");
return;
}
} if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在");
}
if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在!");
return;
}
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/delPdfPage",
type: "POST",
data:entity,
success: function (result) {
$("#mb").css("display","none");
spinner.spin();
$("#pagePdf").val("");
$('#delPdfPageModal').modal('hide'); //手动关闭
$('#delPdfPageModal2').modal('hide'); //手动关闭
$("#pagePdf2").val("");
//$('#delPdfPageModal').modal('hide'); //手动关闭
if (result == 1) {
//刷新
var pageNum=$("#pageNumber").val();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
$("#pageNumber").val(pageNum);
getDelPicPageFun();
$('#table2').bootstrapTable('refresh');
initTree($("#idLab").html());
toastr.success("删除pdf页数,第"+entity.title+"页成功!");
if( entity.sys =="") {
toastr.success("删除pdf页数,第" + entity.title + "页成功!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成功!");
}
} else if (result ==0){
toastr.error("删除pdf页数,第"+entity.title+"页失败!");
if( entity.sys =="") {
toastr.warning("删除pdf页数,第"+entity.title+"页失败!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成失败!");
}
}else if (result == 2){
toastr.error("pdf文件不存在");
toastr.warning("pdf文件不存在");
}else if(result==3){
toastr.error("删除页数大于总页数!");
toastr.warning("删除页码或页数不得大于总页数!");
}else if(result==4){
toastr.error("删除页码前备份失败!");
toastr.warning("删除页码前备份失败!");
}else if(result==5){
toastr.warning("只剩一页不可再删!");
}
}, error: function () {
toastr.error("操作失败!");
}
});
});
// $("#addBtn").click(function () {
// $("#inpId").val("");
// $("#inpTitle").val("");

@ -747,7 +747,7 @@
<div class="modal-body" STYLE="height: 950px">
<div class="shadeImg" onclick="javascript:closeShadeImg()">
<div class="">
<img class="showImg" src=""/>
<img class="showImg" src="" />
</div>
</div>
</div>

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<%
@ -19,6 +19,7 @@
<link rel="stylesheet" href="${path}/static/bootstrap-3.3.7/bootstrap-table-fixed-columns.css" type="text/css">
<style>
.modal-header2 {
height: 30px;
text-align: center !important;
vertical-align: middle !important;
background-color: #3c8dbc !important;
@ -152,14 +153,14 @@
min-height: 400px !important;
}
.showImg {
width: 80%;
height: 100%
}
.showImg {
width: 100%;
/*height: 100%*/
}
.shadeImg {
height: 950px;
}
.shadeImg {
height:100%;
}
#firstModal .modal-content {
margin-left: 50%;
@ -197,11 +198,12 @@
color: blue;
}
#delPdfPageModal2 > div > div {
margin-top: 20%;
margin-left: 60%;
width: 400px;
!important;
!important;
}
#timeLineModal .modal-content {
@ -216,15 +218,77 @@
/*height:226px!important;*/
}
#mb{
display: none;
height: 120%;
width: 100%;
/*position: fixed;*/
position: absolute;
z-index: 1200;
/*height: 1380px;*/
background: #FFF;
top:0;
left: 0;
opacity:0.6;
}
#arrow {
color: #fff;
background: #000;
width: 20px;
height: 90px;
line-height: 90px;
font-size: 12px;
font-family: "宋体";
text-align: center;
font-weight: bold;
float: left;
}
/*.panel-primary > .panel-heading{*/
/*background-color: #3c8dbc;*/
/*border-color: #3c8dbc;*/
/*}*/
.showDelDiv{
border: 1px solid #e5e5e5;
width: 90%;
margin-bottom: 5px;
}
.showImg2 {
margin-left: 2%;
margin-bottom: 2px;
width:95%;
height: 200px;
}
.imglist{
margin-left: 15px;
margin-bottom: 5px;
width: 90%;
height: 200px;
}
.returnPageCls{
margin-right: 2px;
}
#addDelDiv{
width: 85%;
background-color: #0b93d5;
text-align: center;
color: red;
}
#delAllImgBtn{
width: 35%;
}
#addPdfPageBtn{
width: 40%;
}
#delImgPageModalCss{
margin-left: 20%;
}
</style>
</head>
<body>
<div id="mb"></div>
<div style="margin-left:30px;margin-right:10px;height:auto">
<!--搜索-->
<form style="margin-top:20px;">
<div class="form-inline">
@ -355,7 +419,7 @@
<!-- 模态框3Modal查看档案 -->
<div class="modal fade" id="selModal" tabindex="1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog" style="left:20%;top:5x;">
<div class="modal-dialog" style="left:20%;top:5px;">
<div class="modal-content">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
@ -814,21 +878,21 @@
<%--发大弹窗--%>
<div class="modal fade" id="maxImg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-header2" style="width: 165%">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
</div>
<div class="modal-body" STYLE="height: 950px">
<div class="modal-body" style="height:80%;">
<div class="shadeImg" onclick="javascript:closeShadeImg()">
<div class="">
<img class="showImg" src=""/>
</div>
</div>
</div>
<div class="modal-footer">
<%-- <div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
</div>
</div>--%>
</div>
</div>
</div>
@ -942,44 +1006,60 @@
</div>
</div>
<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content ">
<div class="modal-content " style="width:220%;margin-left:15%;height: 800px;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">PDF页信息</h4>
</div>
<div class="modal-body divCss2">
<form>
<div class="form-group ">
<input id="pdfId" hidden/>
<span style="vertical-align:top;">pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf"></textarea>
<div class="modal-body divCss2" id="delPdfBody" >
<div class="row form-inline">
<div style="width: 80%;float:left;" id="pdfDiv">
<iframe id="pdf_page" name="pdf_page" style="width:100%;height:100%;"></iframe>
</div>
<div class="form-group " >
<span style="vertical-align:top;">删除页码:</span>
<input type="number" id="pagePdf"/>
<div id="arrow">&gt;</div>
<div style="width: 18%;height:100%;float:right;overflow-y:scroll;overflow-x: hidden;" id="infoDiv">
<form>
<div class="row " hidden>
<input id="pdfId" hidden/>
<span style="vertical-align:top;" hidden>pdf路径</span>
<textarea rows="6" style="width:85%;" readonly id="pathPdf" hidden></textarea>
</div>
<div class="row" style="margin-left:5px; " >
页码:
<input type="number" id="pagePdf" style="max-width:20%"/>-<input type="number" id="pagePdf2" style="max-width:20%"/>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</form>
<div class="row" style="margin-left:15px; ">
<div class="row" id="addDelDiv">---不可恢复--</div>
<div class="row">
<%--<button type="button" class="btn btn-warning btn-sm" id="addPdfPageBtn" onclick="addPdfPageFun()">PDF添加页码</button>--%>
<button type="button" class="btn btn-warning btn-sm" id="returnPdfBtn" onclick="returnPdfFun()">还原最初PDF</button>
<button type="button" class="btn btn-danger btn-sm" id="delAllImgBtn" >删除全部图片</button>
</div>
</div>
<div class="imglist" id="imglist">
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
</div>
</div>
</div>
</div>
<%--删除pdf某页确认框--%>
<div class="modal fade" id="delPdfPageModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content " >
<div class="modal-content ">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
@ -988,7 +1068,7 @@
<div class="modal-body" >
<form>
<div class="form-group">
<label class="control-label">删除页码并备份旧版本为作废,是否删除?</label>
<label class="control-label" >是否删除pdf第<span id="numDel"></span>的页面</label>
</div>
</form>
</div>
@ -1000,6 +1080,30 @@
</div>
</div>
<%--确认框提示清空所有图片--%>
<div class="modal fade" id="delImgPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content delImgPageModalCss" style="width: 70%;margin-left: 30%;">
<div class="modal-header2">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label class="control-label">删除所有的图片将不可恢复,是否删除?</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
<button type="button" class="btn btn-primary btn-sm" id="delImgPageBtn">确认</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
@ -1281,27 +1385,24 @@
getAssortFun();
var opts = {
lines: 13, // The number of lines to draw |小长条的数量
length: 20, // The length of each line |小长条的长度
width: 5, // The line thickness |小长条的宽度
// left: "50%",
radius: 15, // The radius of the inner circle |内环的半径长
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset |旋转角度
direction: 1, // 1: clockwise, -1: counterclockwise |1顺时针方向 -1逆时针方向
color: '#000', // #rgb or #rrggbb or array of colors |颜色
speed: 1, // Rounds per second |每秒转多少圈
trail: 60, // Afterglow percentage |余晖效果百分比
shadow: false, // Whether to render a shadow |渲染阴影
hwaccel: false, // Whether to use hardware acceleration |加速
className: 'spinner', // The CSS class to assign to the spinner |类名spinner
zIndex: 2e9, // The z-index (defaults to 2000000000) |显示在最顶层
top: '70%', // Top position relative to parent in px |相对父元素的top
//left: '90' // Left position relative to parent in px |相对父元素的left 默认情况spinner是显示于父元素居中位置
lines: 13, // 花瓣数目
length: 20, // 花瓣长度
width: 10, // 花瓣宽度
radius: 30, // 花瓣距中心半径
corners: 1, // 花瓣圆滑度 (0-1)
rotate: 0, // 花瓣旋转角度
direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针
color: '#000', // 花瓣颜色
speed: 1, // 花瓣旋转速度
trail: 60, // 花瓣旋转时的拖影(百分比)
shadow: false, // 花瓣是否显示阴影
hwaccel: false, //spinner 是否启用硬件加速及高速旋转
className: 'spinner', // spinner css 样式名称
zIndex: 2e9, // spinner的z轴 (默认是2000000000)
top: '50%', // spinner 相对父容器Top定位 单位 px
left: '450%'// spinner 相对父容器Left定位 单位 px
};
var spinner = new Spinner(opts);
var url = "";
function uploadFileAndDate() {
@ -1737,6 +1838,239 @@
getDept();
function returnPdfFun(){
//console.log("======还原PDF=======");
var parentId=$("#pdfId").val();
if(parentId!="" &&parentId!=null ){
$.ajax({
url: "${path}/inHosp/returnPdfFile",
type: "POST",
data: {id:parentId},
success: function (result) {
setTimeout(function () {
if(result=="") {
$("#mb").css("display", "none");
getDelPicPageFun();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
toastr.success("pdf文件还原备份成功!");
}else{
toastr.warning(result);
}
}, 1000);
}
});
}else{
toastr.warning("暂无备份pdf文件!");
}
}
function returnPageFun(maxPicture,btnObj){
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var minPicture=null;
var parentId=$("#pdfId").val();
// var parentId=$("#pdfId").val();
var inpuObj=btnObj.parentNode.firstChild ;
var delPage=inpuObj.value;
if(delPage=="" || delPage==null || delPage<0){
toastr.warning("请输入还原的页码大于等于0!");
return;
}
var delid=btnObj.id;
var id=0;
var pictureNumber=0;
if(delid!="" &&delid!=null && delid!="delId_"){
delid=delid.replace("delId_","");
id=parseInt(delid);
}
if(delPage!="" &&delPage!=null && delPage>=0){
pictureNumber=delPage;
}
if($("#pathPdf").val()!=null && $("#pathPdf").val()!="" && $("#pathPdf").val()!=undefined && $("#pathPdf").val()!="undefined"){
minPicture=$("#pathPdf").val();
}
if(id!=0 && pictureNumber>=0){
var entity={};
entity.id=id;
entity.pictureNumber=pictureNumber;
entity.maxPicture=maxPicture;
entity.minPicture=minPicture;
entity.parentId=parentId;
//console.log(entity);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/returnPage",
type: "POST",
data: entity,
success: function (result) {
setTimeout(function () {
//if(result!=null && result!="") {
if (result.indexOf("成功")!=-1) {
getDelPicPageFun();
// $('#pdf_page').attr('src', result);
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
toastr.success(result);
} else {
toastr.warning(result);
}
// }else{
// toastr.warning("图片还原失败!");
// }
$("#mb").css("display","none");
spinner.spin();
}, 2000);
}
});
}
}
function addPdfPageFun(){
var maxPicture=$("#pathPdf").val();
if(maxPicture!=null && maxPicture!="" && maxPicture!=undefined){
//console.log("=====添加pdf页码成功=========maxPicture:"+maxPicture);
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/addPdfPageBtn",
type: "POST",
data: {maxPicture:maxPicture},
success: function (result) {
$("#mb").css("display","none");
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
spinner.spin();
if (result==1) {
toastr.success("添加pdf页码成功!");
}
}
});
}else{
// toastr.warning("删除所有图片失败!");
}
}
function delAllImgFun(){
var parentId=$("#pdfId").val();
var maxPicture=$("#pathPdf").val();
var picArr=maxPicture.split("\\");
maxPicture=picArr[picArr.length-1].replace(".pdf","");
if(parentId!=null && parentId!="" && parentId!=undefined){
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
//console.log(parentId+":parentId=====删除所有图片=========maxPicture:"+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImgAll",
type: "POST",
data: {parentId: parentId,maxPicture:maxPicture},
success: function (result) {
getDelPicPageFun();
spinner.spin();
if (result==1) {
toastr.success("删除所有图片成功!");
}
}
});
// $('#delImgPageModal').modal('hide'); //手动关闭
}else{
// toastr.warning("删除所有图片失败!");
}
$('#delImgPageModal').modal('hide'); //手动关闭
}
$("#delAllImgBtn").click(function () {
//弹窗提示不可复原
$('#delImgPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: true,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
});
$("#delImgPageBtn").click(function () {
delAllImgFun();
});
function delPageFun(maxPicture,obj){
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
maxPicture=decodeURIComponent(maxPicture, "UTF-8");
var id=0;
if(obj.id!=null && obj.id!="" && obj.id!="delId_"){
id=parseInt(obj.id.replace("delId_",""));
//console.log(id+"==========删除图片:===="+maxPicture);
$.ajax({
url: "${path}/inHosp/delPageImg",
type: "POST",
data: {id: id,maxPicture:maxPicture},
success: function (result) {
setTimeout(function () {
if (result==1) {
getDelPicPageFun();
toastr.success("删除图片成功!");
}else{
toastr.warning("删除图片失败!");
}
$("#mb").css("display","none");
spinner.spin();
}, 500);
}
});
}else{
toastr.warning("图片记录不存在!");
}
}
function getDelPicPageFun() {
var parentId=$("#pdfId").val();
//console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
if(parentId!=null && parentId!=""){
//获取相应的pdf被删除的图片列表
$.ajax({
url: "${path}/inHosp/selDelPicList",
type: "POST",
data: {effective: 1, parentId: parentId},
success: function (result) {
$("#imglist").empty();
var img_div = $("#imglist");
if (result != null && result.length>0) {
//console.log(result);
var img_html="";
var delId="delId_";
var delPageV="delPageV_";
var maxPicture="";
for (var i = 0; i < result.length; i++) {
delId="delId_"+result[i].id;
delPageV="delPageV_"+result[i].id;
//console.log("========="+result[i].id+"======delId:"+delId+"===="+result[i].pictureNumber);
maxPicture=result[i].maxPicture.replaceAll("/","\\");
//console.log(result[i].maxPicture);
img_html="${path}\\"+maxPicture;
img_html="<div class='row showDelDiv'><img class='showImg2' src='"+img_html+"' onclick='javascript:lookBigImg(this)'/>";
img_html+="<div clas='row'>"
+"<input type='number' class='returnPageCls' id='"+delPageV+"' value='"+result[i].pictureNumber+"' style='max-width:40%'/>"
+"<button class='btn btn-primary btn-sm' id='"+delId+"' onclick='javascript:returnPageFun(\""+encodeURIComponent(maxPicture, "UTF-8")+"\",this)'>还原</button>"
+'<button onclick="javascript:delPageFun(\''+encodeURIComponent(maxPicture, "UTF-8")+'\',this);" id="'+delId+'" class="btn btn-danger btn-sm">'+'删除'+'</button>'
+ "</div>";
img_html+="</div>";
$("#imglist").append(img_html);
}
}else{
$("#imglist").append("暂无可删除图片!");
//toastr.warning("暂无删除图片!");
}
}
});
}else{
toastr.warning("记录不存在!");
}
}
//处理导出内容,这个方法可以自定义某一行、某一列、甚至某个单元格的内容,也就是将其值设置为自己想要的内容
function DoOnCellHtmlData(cell, row, col, data) {
if (row == 0) {
@ -2389,10 +2723,10 @@
//console.log("===:" + row.pdfPath + "====" + row.source);
//删除
if (row.pdfPath != null && row.pdfPath != "") {
//console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
if (row.pdfPath.indexOf(row.assortId + ".pdf") == -1) {
var pdfName=row.pdfPath.substring(row.pdfPath.lastIndexOf('\\') + 1, row.pdfPath.lastIndexOf('.') );
if (pdfName!=row.assortId) {
if (row.source != null && row.source != "") {
if (row.source.indexOf("后台") != -1) {
if(row.source.indexOf("后台") != -1){
html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
}
}
@ -2496,15 +2830,34 @@
//同步
$("#idPdfT").val(row.id);
}, 'click .delPdfPage': function (e, value, row, index) {
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
var pdfPath=row.pdfPath.replaceAll("\\","/");
//C:/Users/Administrator/Desktop/test/autoPdf/1617156631367.pdf
if(pdfPath!=""){
pdfPath="${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath);
$('#pdf_page').attr('src', pdfPath);
//病案号 45e9b098f9da49ffba1843bfc6930cb8
}else{
toastr.warning("勾选的PDF文件不存在或破损");
}
//删除pdf某一页
$('#delPdfPageModal').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
// //同步
$("#pdfId").val(row.id);
$("#pathPdf").val(row.pdfPath);
getDelPicPageFun();
setTimeout(function () {
$("#mb").css("display","none");
spinner.spin();
}, 1500);
}
},
cellStyle: function (value, row, index) {
@ -3328,60 +3681,114 @@
});
});
//删除pdf页码
$("#delPageBtn").click(function () {
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
var pagePdfVal=$("#pagePdf").val();
if(pagePdfVal==null ||pagePdfVal=="" ){
toastr.warning("页码必填!");
return;
}
if(pagePdfVal!=null && pagePdfVal!="" ){
if(pagePdfVal<=0){
toastr.warning("起始页码大于0且必填");
return;
}
}
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!="" && pagePdfVal!=null && pagePdfVal!=""){
if($("#pagePdf2").val()<=0){
toastr.warning("结尾页码需大于0!");
return;
}else if($("#pagePdf2").val()<$("#pagePdf").val()){
toastr.warning("结尾页码必须大于起始页码!");
return;
}
}
$("#numDel").empty();
if($("#pagePdf").val()!="" && $("#pagePdf").val()!=null) {
$("#numDel").append($("#pagePdf").val());
if($("#pagePdf2").val()!="" && $("#pagePdf2").val()!=null){
$("#numDel").append("至"+$("#pagePdf2").val());
}
$('#delPdfPageModal2').modal({
backdrop: 'static',//backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
keyboard: false,//keyboard 为 false 时,按下 Esc 键不会关闭 Modal。
show: true//弹出对话框
});
}else{
toastr.warning("请输入页码!");
}
});
//确认删除pdf页码
$("#delPageBtn2").click(function () {
$('#delPdfPageModal2').modal('hide'); //手动关闭
var entity={};
entity.id= $("#pdfId").val();
entity.title = ""+$("#pagePdf").val();
if($("#pagePdf2").val()!=null && $("#pagePdf2").val()!=null) {
entity.sys = "" + $("#pagePdf2").val();
}else{
entity.sys ="";
}
entity.pdfPath = $("#pathPdf").val();
if(entity.id==null ||entity.id=="" ){
toastr.warning("id不为空");
toastr.warning("id不为空!");
return;
} if(entity.title==null ||entity.title=="" ){
toastr.warning("页码必填!");
}
if(entity.title==null ||entity.title=="" ){
toastr.warning("起始页码必填!");
return;
} if(entity.title!=null && entity.title!="" ){
}
if(entity.title!=null && entity.title!="" ){
if(entity.title<=0){
toastr.warning("页码大于0必填");
toastr.warning("起始页码大于0必填!");
return;
}
} if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在");
}
if(entity.pdfPath==null ||entity.pdfPath=="" ){
toastr.warning("PDF不存在!");
return;
}
$("#mb").css("display","block");
var target = document.getElementById('delPdfBody');
spinner.spin(target);//给id为foo的div 中绑上spinner
$.ajax({
url: "${path}/inHosp/delPdfPage",
type: "POST",
data:entity,
success: function (result) {
$("#mb").css("display","none");
spinner.spin();
$("#pagePdf").val("");
$('#delPdfPageModal').modal('hide'); //手动关闭
$('#delPdfPageModal2').modal('hide'); //手动关闭
$("#pagePdf2").val("");
//$('#delPdfPageModal').modal('hide'); //手动关闭
if (result == 1) {
//刷新
var pageNum=$("#pageNumber").val();
$('#pdf_page').attr('src', $('#pdf_page').attr('src'));
$("#pageNumber").val(pageNum);
getDelPicPageFun();
$('#table2').bootstrapTable('refresh');
initTree($("#idLab").html());
toastr.success("删除pdf页数,第"+entity.title+"页成功!");
if( entity.sys =="") {
toastr.success("删除pdf页数,第" + entity.title + "页成功!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成功!");
}
} else if (result ==0){
toastr.error("删除pdf页数,第"+entity.title+"页失败!");
if( entity.sys =="") {
toastr.warning("删除pdf页数,第"+entity.title+"页失败!");
}else{
toastr.success("删除pdf页数,第" + entity.title + "至"+entity.sys+"页成失败!");
}
}else if (result == 2){
toastr.error("pdf文件不存在");
toastr.warning("pdf文件不存在");
}else if(result==3){
toastr.error("删除页数大于总页数!");
toastr.warning("删除页码或页数不得大于总页数!");
}else if(result==4){
toastr.error("删除页码前备份失败!");
toastr.warning("删除页码前备份失败!");
}else if(result==5){
toastr.warning("只剩一页不可再删!");
}
}, error: function () {
toastr.error("操作失败!");

Loading…
Cancel
Save