|
|
|
|
@ -19,10 +19,7 @@ import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService;
|
|
|
|
|
import com.emr.service.recordType.EmrTypeRelatedService;
|
|
|
|
|
import com.emr.service.recordType.EmrTypeService;
|
|
|
|
|
import com.emr.service.tScanAssort.T_Scan_AssortService;
|
|
|
|
|
import com.emr.util.DateUtils;
|
|
|
|
|
import com.emr.util.ExceptionPrintUtil;
|
|
|
|
|
import com.emr.util.Jpg2PdfUtil;
|
|
|
|
|
import com.emr.util.img2PdfUtil;
|
|
|
|
|
import com.emr.util.*;
|
|
|
|
|
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo;
|
|
|
|
|
import com.emr.vo.FontVo.ScanAssortVo;
|
|
|
|
|
import com.emr.vo.browseRecords;
|
|
|
|
|
@ -30,6 +27,8 @@ import com.emr.vo.commomSearch.*;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
|
|
import org.apache.pdfbox.rendering.PDFRenderer;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.apache.shiro.util.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@ -42,13 +41,21 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import javax.servlet.ServletContext;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.PrintWriter;
|
|
|
|
|
import java.net.InetAddress;
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.Base64;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -349,7 +356,15 @@ public class CommomSearchController {
|
|
|
|
|
model.addAttribute("patientId", patientId);
|
|
|
|
|
model.addAttribute("dataSource", dataSource);
|
|
|
|
|
//加载登陆者
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
Power_User user;
|
|
|
|
|
Object currentUser = request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
if(ObjectUtils.isEmpty(currentUser)){
|
|
|
|
|
ServletContext context = request.getServletContext();
|
|
|
|
|
user = (Power_User)context.getAttribute("CURRENT_USER");
|
|
|
|
|
}else{
|
|
|
|
|
//查询通过审批且未过期的patientId集合
|
|
|
|
|
user = (Power_User) currentUser;
|
|
|
|
|
}
|
|
|
|
|
if (null != user) {
|
|
|
|
|
model.addAttribute("user", user);
|
|
|
|
|
model.addAttribute("roleId", user.getRoleId());
|
|
|
|
|
@ -427,6 +442,129 @@ public class CommomSearchController {
|
|
|
|
|
return "recordManage/commomSearch/showRecord174";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("showMegerPDFView")
|
|
|
|
|
public String showMegerPDFView(String patientId, String dataSource, Model model, HttpServletRequest request) {
|
|
|
|
|
model.addAttribute("patientId", patientId);
|
|
|
|
|
model.addAttribute("dataSource", dataSource);
|
|
|
|
|
//加载登陆者
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
if (null != user) {
|
|
|
|
|
model.addAttribute("user", user);
|
|
|
|
|
model.addAttribute("roleId", user.getRoleId());
|
|
|
|
|
model.addAttribute("hospitalName", hospitalName);
|
|
|
|
|
}
|
|
|
|
|
List<EmrPrintOrDownLoadInfoVo> printCount = null;
|
|
|
|
|
try {
|
|
|
|
|
printCount = printOrDownLoadInfoService.getPrintCount(patientId);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
if (null != printCount && !printCount.isEmpty()) {
|
|
|
|
|
model.addAttribute("printCount", 1);
|
|
|
|
|
}
|
|
|
|
|
Short admissTimes = null;
|
|
|
|
|
String name = null;
|
|
|
|
|
String disDate = null;
|
|
|
|
|
String disDept = null;
|
|
|
|
|
String attending = null;
|
|
|
|
|
String fileSource = null;
|
|
|
|
|
List<CommomVo> commomVos = commomMapper.selectAllAndPatientId(patientId);
|
|
|
|
|
for (CommomVo list : commomVos) {
|
|
|
|
|
admissTimes = list.getAdmissTimes();
|
|
|
|
|
name = list.getName();
|
|
|
|
|
fileSource = list.getFileSource();
|
|
|
|
|
disDate = list.getDisDate();
|
|
|
|
|
disDept = list.getDisDept();
|
|
|
|
|
attending = list.getAttending();
|
|
|
|
|
}
|
|
|
|
|
String userName = user.getUserPosition();
|
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
|
|
|
|
|
Date date = new Date(System.currentTimeMillis());
|
|
|
|
|
String format = formatter.format(date);
|
|
|
|
|
browseRecords browseRecords = new browseRecords();
|
|
|
|
|
browseRecords.setAdmissTimes(admissTimes);
|
|
|
|
|
browseRecords.setPatientName(name);
|
|
|
|
|
browseRecords.setDisDate(disDate);
|
|
|
|
|
browseRecords.setDisDept(disDept);
|
|
|
|
|
browseRecords.setAttending(attending);
|
|
|
|
|
browseRecords.setPatientId(patientId);
|
|
|
|
|
browseRecords.setBrowseTime(format);
|
|
|
|
|
browseRecords.setBrowseName(userName);
|
|
|
|
|
// 获取访问真实IP
|
|
|
|
|
String ipAddress = request.getHeader("x-forwarded-for");
|
|
|
|
|
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
|
|
|
ipAddress = request.getHeader("Proxy-Client-IP");
|
|
|
|
|
}
|
|
|
|
|
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
|
|
|
ipAddress = request.getHeader("WL-Proxy-Client-IP");
|
|
|
|
|
}
|
|
|
|
|
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
|
|
|
ipAddress = request.getRemoteAddr();
|
|
|
|
|
if ("127.0.0.1".equals(ipAddress) || "0:0:0:0:0:0:0:1".equals(ipAddress)) {
|
|
|
|
|
//根据网卡取本机配置的IP
|
|
|
|
|
InetAddress inet = null;
|
|
|
|
|
try {
|
|
|
|
|
inet = InetAddress.getLocalHost();
|
|
|
|
|
} catch (UnknownHostException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
assert inet != null;
|
|
|
|
|
ipAddress = inet.getHostAddress();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
|
|
|
|
|
if (ipAddress != null && ipAddress.length() > 15) { //"***.***.***.***".length() = 15
|
|
|
|
|
if (ipAddress.indexOf(",") > 0) {
|
|
|
|
|
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
browseRecords.setIp(ipAddress);
|
|
|
|
|
|
|
|
|
|
return "recordManage/commomSearch/showMegerPDFView";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("showMegerRecordIframeBlood")
|
|
|
|
|
public String showMegerRecordIframeBlood(String patientId, String flag, Model model, HttpServletRequest request) {
|
|
|
|
|
model.addAttribute("patientId", patientId);
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
//打印分类集合
|
|
|
|
|
List<Emr_Type> emrTypes = null;
|
|
|
|
|
List<Zd_Assort> zdAssorts = null;
|
|
|
|
|
int isDownload = 0;
|
|
|
|
|
try {
|
|
|
|
|
emrTypes = emrTypeService.selectAllByCreater(1, request);
|
|
|
|
|
//病案分段集合
|
|
|
|
|
zdAssorts = assortService.selectAllByPower(user);
|
|
|
|
|
isDownload = apply_approveMapper.selectIsPowerByUser(user.getUserName(), patientId, 3);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
model.addAttribute("emrTypes", emrTypes);
|
|
|
|
|
model.addAttribute("zdAssorts", zdAssorts);
|
|
|
|
|
model.addAttribute("isDownload", isDownload);
|
|
|
|
|
//查询是否有打印权限
|
|
|
|
|
int printFlag = 0;
|
|
|
|
|
int moveFlag = 0;
|
|
|
|
|
Set<String> menus = user.getMenus();
|
|
|
|
|
for (String menu : menus) {
|
|
|
|
|
if (StringUtils.isNotBlank(menu)) {
|
|
|
|
|
if ("/commom/printPdf".equals(menu)) {
|
|
|
|
|
printFlag = 1;
|
|
|
|
|
}
|
|
|
|
|
if ("/commom/movePdf".equals(menu)) {
|
|
|
|
|
moveFlag = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model.addAttribute("moveFlag", moveFlag);
|
|
|
|
|
model.addAttribute("printFlag", printFlag);
|
|
|
|
|
model.addAttribute("flag", flag);
|
|
|
|
|
return "recordManage/commomSearch/showMegerRecordIframeBlood";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("showRecordSouth")
|
|
|
|
|
public String showRecordSouth(String patientId, String userName, String deptName, Model model, HttpServletRequest request) {
|
|
|
|
|
model.addAttribute("patientId", patientId);
|
|
|
|
|
@ -531,7 +669,15 @@ public class CommomSearchController {
|
|
|
|
|
@RequestMapping("showRecordIframeBlood")
|
|
|
|
|
public String showRecordIframeBlood(String patientId, String flag, Model model, HttpServletRequest request) {
|
|
|
|
|
model.addAttribute("patientId", patientId);
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
Power_User user;
|
|
|
|
|
Object currentUser = request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
if(ObjectUtils.isEmpty(currentUser)){
|
|
|
|
|
ServletContext context = request.getServletContext();
|
|
|
|
|
user = (Power_User)context.getAttribute("CURRENT_USER");
|
|
|
|
|
}else{
|
|
|
|
|
//查询通过审批且未过期的patientId集合
|
|
|
|
|
user = (Power_User) currentUser;
|
|
|
|
|
}
|
|
|
|
|
//打印分类集合
|
|
|
|
|
List<Emr_Type> emrTypes = null;
|
|
|
|
|
List<Zd_Assort> zdAssorts = null;
|
|
|
|
|
@ -682,8 +828,16 @@ public class CommomSearchController {
|
|
|
|
|
List<CommomTree> treeList = new ArrayList<>();
|
|
|
|
|
//查询该有的权限分类
|
|
|
|
|
try {
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
List<CommomTree> commomVos = new ArrayList<>();
|
|
|
|
|
Power_User user;
|
|
|
|
|
Object currentUser = request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
if(ObjectUtils.isEmpty(currentUser)){
|
|
|
|
|
ServletContext context = request.getServletContext();
|
|
|
|
|
user = (Power_User)context.getAttribute("CURRENT_USER");
|
|
|
|
|
}else{
|
|
|
|
|
//查询通过审批且未过期的patientId集合
|
|
|
|
|
user = (Power_User) currentUser;
|
|
|
|
|
}
|
|
|
|
|
List<CommomTree> commomVos;
|
|
|
|
|
if (user.getRoleId() == 0 || user.getRoleId() == -100 || user.getRoleId() == -999) {
|
|
|
|
|
commomVos = commomMapper.selectScanImgTreeByPatientId(patientId, sortFlag,null, null);
|
|
|
|
|
} else {
|
|
|
|
|
@ -795,6 +949,100 @@ public class CommomSearchController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (commomVos.size() == 0) {
|
|
|
|
|
List<CommomTree> archiveDetail = archiveDetailMapper.selectPdfPathByPatient2(patientId);
|
|
|
|
|
//第一级:全部影像资料
|
|
|
|
|
CommomTree tree1 = new CommomTree();
|
|
|
|
|
Integer id = 1;
|
|
|
|
|
tree1.setId(id);
|
|
|
|
|
tree1.setNewName("全部影像资料");
|
|
|
|
|
if (null != archiveDetail && !archiveDetail.isEmpty()) {
|
|
|
|
|
//去重,取出不重复的分类集合
|
|
|
|
|
Map<String, CommomTree> assortMap = new LinkedHashMap<>();
|
|
|
|
|
for (CommomTree commomVo1 : archiveDetail) {
|
|
|
|
|
assortMap.put(commomVo1.getAssortId(), commomVo1);
|
|
|
|
|
}
|
|
|
|
|
//判断分类是否全选,全选,父类跟着全选
|
|
|
|
|
if (null != typeRelateds && !typeRelateds.isEmpty()) {
|
|
|
|
|
boolean checkedFlag = true;
|
|
|
|
|
for (Map.Entry<String, CommomTree> map : assortMap.entrySet()) {
|
|
|
|
|
//定义是否存在
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
for (Emr_Type_Related typeRelated : typeRelateds) {
|
|
|
|
|
if (typeRelated.getAssortId().equals(map.getKey())) {
|
|
|
|
|
flag = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!flag) {
|
|
|
|
|
checkedFlag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (checkedFlag) {
|
|
|
|
|
tree1.setChecked("true");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
tree1.setChecked("true");
|
|
|
|
|
}
|
|
|
|
|
treeList.add(tree1);
|
|
|
|
|
int oneId = 0;
|
|
|
|
|
for (Map.Entry<String, CommomTree> map : assortMap.entrySet()) {
|
|
|
|
|
id++;
|
|
|
|
|
oneId = id;
|
|
|
|
|
String assortId = map.getValue().getAssortId();
|
|
|
|
|
CommomTree tree2 = new CommomTree();
|
|
|
|
|
tree2.setId(id);
|
|
|
|
|
tree2.setParentId(1);
|
|
|
|
|
tree2.setAssortId(map.getValue().getAssortId());
|
|
|
|
|
//判断选中
|
|
|
|
|
boolean checkFlag = false;
|
|
|
|
|
if (null != typeRelateds && !typeRelateds.isEmpty()) {
|
|
|
|
|
for (Emr_Type_Related typeRelated : typeRelateds) {
|
|
|
|
|
if (StringUtils.isNotBlank(assortId) && assortId.equals(typeRelated.getAssortId())) {
|
|
|
|
|
tree2.setChecked("true");
|
|
|
|
|
checkFlag = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
checkFlag = true;
|
|
|
|
|
tree2.setChecked("true");
|
|
|
|
|
}
|
|
|
|
|
//定义该类影像图片数量
|
|
|
|
|
int scanPathCount = 0;
|
|
|
|
|
//第二层 图片
|
|
|
|
|
int scanPathCountNum = 0;
|
|
|
|
|
for (CommomTree commomVo : archiveDetail) {
|
|
|
|
|
if (StringUtils.isNotBlank(assortId) && StringUtils.isNotBlank(commomVo.getAssortId()) &&
|
|
|
|
|
assortId.equals(commomVo.getAssortId())) {
|
|
|
|
|
id++;
|
|
|
|
|
CommomTree tree3 = new CommomTree();
|
|
|
|
|
tree3.setId(id);
|
|
|
|
|
tree3.setParentId(oneId);
|
|
|
|
|
tree3.setAssortId(assortId);
|
|
|
|
|
if (checkFlag) {
|
|
|
|
|
tree3.setChecked("true");
|
|
|
|
|
}
|
|
|
|
|
scanPathCount++;
|
|
|
|
|
//图片名称
|
|
|
|
|
String name = commomVo.getScanPage();
|
|
|
|
|
tree3.setAssortName(name);
|
|
|
|
|
//设置树图片节点的名称
|
|
|
|
|
tree3.setNewName(commomVo.getTitle());
|
|
|
|
|
tree3.setSource(commomVo.getSource());
|
|
|
|
|
//存储水印图片
|
|
|
|
|
treeList.add(tree3);
|
|
|
|
|
scanPathCountNum = commomVo.getPageCount();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tree2.setNewName(map.getValue().getAssortName() + "(" + scanPathCountNum + ")");
|
|
|
|
|
treeList.add(tree2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return JSON.toJSONString(treeList);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
|
@ -817,10 +1065,21 @@ public class CommomSearchController {
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultUtil selectPrintPic(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, HttpServletRequest request) throws Exception {
|
|
|
|
|
//生成加载进度mapKey
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
Power_User user;
|
|
|
|
|
Object currentUser = request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
if(ObjectUtils.isEmpty(currentUser)){
|
|
|
|
|
ServletContext context = request.getServletContext();
|
|
|
|
|
user = (Power_User)context.getAttribute("CURRENT_USER");
|
|
|
|
|
}else{
|
|
|
|
|
//查询通过审批且未过期的patientId集合
|
|
|
|
|
user = (Power_User) currentUser;
|
|
|
|
|
}
|
|
|
|
|
String mapKey = user.getUserName() + "_" + patientId;
|
|
|
|
|
List<String> outs = commomService.selectPrintPic(response, patientId, rootPaths, names, sources, mapKey);
|
|
|
|
|
return ResultUtil.ok(outs);
|
|
|
|
|
if(!ObjectUtils.isEmpty(rootPaths) && rootPaths.length() > 3){
|
|
|
|
|
List<String> outs = commomService.selectPrintPic(response, patientId, rootPaths, names, sources, mapKey);
|
|
|
|
|
return ResultUtil.ok(outs);
|
|
|
|
|
}
|
|
|
|
|
return ResultUtil.ok("图像路径为空,请检查数据是否有误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -901,9 +1160,17 @@ public class CommomSearchController {
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void getRecordContentBlood(String patientId, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
List<CommomTree> commomTrees = archiveDetailMapper.selectPdfPathByPatient2(patientId);
|
|
|
|
|
Power_User user;
|
|
|
|
|
Object currentUser = request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
if(ObjectUtils.isEmpty(currentUser)){
|
|
|
|
|
ServletContext context = request.getServletContext();
|
|
|
|
|
user = (Power_User)context.getAttribute("CURRENT_USER");
|
|
|
|
|
}else{
|
|
|
|
|
//查询通过审批且未过期的patientId集合
|
|
|
|
|
user = (Power_User) currentUser;
|
|
|
|
|
}
|
|
|
|
|
if (commomTrees.size() == 0) {
|
|
|
|
|
try {
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
String mapKey = user.getUserName() + "_" + patientId;
|
|
|
|
|
List<String> scanPages = (List<String>) request.getSession().getAttribute(mapKey);
|
|
|
|
|
if (!CollectionUtils.isEmpty(scanPages)) {
|
|
|
|
|
@ -929,22 +1196,24 @@ public class CommomSearchController {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
String pdfWater = "";
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
String mapKey = user.getUserName() + "_" + patientId;
|
|
|
|
|
List<String> filePaths = (List<String>) request.getSession().getAttribute(mapKey);
|
|
|
|
|
if (!CollectionUtils.isEmpty(filePaths)) {
|
|
|
|
|
//根据图片路径转换pdf
|
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
|
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = commomService.getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
|
Jpg2PdfUtil.mulFile2One2(response, filePaths, pdfWater,emrPdfWaterSet);
|
|
|
|
|
//移除缓存
|
|
|
|
|
request.removeAttribute(mapKey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int calculateTotalSegments(int totalPages) {
|
|
|
|
|
// 假设每段包含100页
|
|
|
|
|
return (int) Math.ceil((double) totalPages / 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 南方医院访问
|
|
|
|
|
*
|
|
|
|
|
@ -1320,6 +1589,87 @@ public class CommomSearchController {
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultUtil uploadCost(HttpServletRequest request) {
|
|
|
|
|
return commomService.uploadCost(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "savePdfPage", method = RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultUtil savePdfPage(@RequestBody PdfPageRequest request) {
|
|
|
|
|
String[] base64Datas = request.getBase64Data();
|
|
|
|
|
String[] assortIdDatas = request.getAssortIdData();
|
|
|
|
|
String[] pageDatas = request.getPageData();
|
|
|
|
|
String patientId = request.getPatientId();
|
|
|
|
|
|
|
|
|
|
Map<String,Object> dataMap = new HashMap<>();
|
|
|
|
|
for(int i = 0; i < base64Datas.length; i++){
|
|
|
|
|
String base64Data = base64Datas[i];
|
|
|
|
|
String assortId = assortIdDatas[i];
|
|
|
|
|
int pageNum = Integer.parseInt(pageDatas[i]);
|
|
|
|
|
String fileName = "merger_" + patientId + "_" + pageNum + ".jpg";
|
|
|
|
|
try {
|
|
|
|
|
// 通过patientId查询文件上传路径
|
|
|
|
|
String uploadPath = commomService.getUploadPath(patientId);
|
|
|
|
|
String savePath = uploadPath + "\\" + fileName;
|
|
|
|
|
|
|
|
|
|
// 下载PDF文件
|
|
|
|
|
byte[] pdfBytes = Base64.getDecoder().decode(base64Data.split(",")[1]);
|
|
|
|
|
// 加载PDF文件
|
|
|
|
|
PDDocument document = PDDocument.load(new ByteArrayInputStream(pdfBytes));
|
|
|
|
|
// 提取指定页码的内容
|
|
|
|
|
PDFRenderer pdfRenderer = new PDFRenderer(document);
|
|
|
|
|
BufferedImage image = pdfRenderer.renderImageWithDPI(pageNum - 1, 150); // 使用300 DPI渲染图像
|
|
|
|
|
|
|
|
|
|
// 将图像保存为JPG文件
|
|
|
|
|
File file = new File(savePath);
|
|
|
|
|
ImageIO.write(image, "jpg", file);
|
|
|
|
|
document.close();
|
|
|
|
|
|
|
|
|
|
//判断是否已有改图像,防止重复插入
|
|
|
|
|
Integer isExistflag = commomService.getIsExistFileName(fileName);
|
|
|
|
|
if(isExistflag == 1){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 存入分段数据表
|
|
|
|
|
dataMap.put("patientId", patientId);
|
|
|
|
|
dataMap.put("assortId", assortId);
|
|
|
|
|
dataMap.put("scanPage", fileName);
|
|
|
|
|
commomService.saveAssortData(dataMap);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return ResultUtil.error("上传失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResultUtil.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "saveSubmitAssortLog", method = RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultUtil saveSubmitAssortLog(@RequestBody PdfPageRequest request) {
|
|
|
|
|
String[] assortIdDatas = request.getAssortIdData();
|
|
|
|
|
String[] assortTexteData = request.getAssortTexteData();
|
|
|
|
|
String[] pageDatas = request.getPageData();
|
|
|
|
|
String patientId = request.getPatientId();
|
|
|
|
|
|
|
|
|
|
Map<String,Object> dataMap = new HashMap<>();
|
|
|
|
|
// for(int i = 0; i < assortIdDatas.length; i++){
|
|
|
|
|
// String assortId = assortIdDatas[i];
|
|
|
|
|
// String assortTexte = assortTexteData[i];
|
|
|
|
|
// int pageNum = Integer.parseInt(pageDatas[i]);
|
|
|
|
|
// try {
|
|
|
|
|
// //判断是否已有改图像,防止重复插入
|
|
|
|
|
// Integer isExistflag = commomService.getIsExistFileName(fileName);
|
|
|
|
|
// if(isExistflag == 1){
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// // 存入分段数据表
|
|
|
|
|
// dataMap.put("patientId", patientId);
|
|
|
|
|
// dataMap.put("assortId", assortId);
|
|
|
|
|
// dataMap.put("scanPage", fileName);
|
|
|
|
|
// commomService.saveAssortData(dataMap);
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// return ResultUtil.error("上传失败");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
return ResultUtil.ok();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|