From d33e007779b3e4d4b5f23591440bd435ffd76f57 Mon Sep 17 00:00:00 2001 From: linjj <850658129@qq.com> Date: Thu, 6 Jul 2023 15:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=84=BF=E7=AB=A5=E5=8C=BB=E9=99=A2=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E8=B7=B3=E8=BD=AC=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FontShowRecordController.java | 318 ++++++++- src/main/java/com/emr/dao/CommomMapper.java | 8 + .../java/com/emr/service/CommomService.java | 52 ++ src/main/resources/mapper/CommomMapper.xml | 8 + .../showRecordIframeBloodFont.jsp | 263 ++++++++ .../webapp/static/js/font/showRecordFont.js | 2 +- .../commomSearch/showRecordIframeBloodFont.js | 606 ++++++++++++++++++ 7 files changed, 1253 insertions(+), 4 deletions(-) create mode 100644 src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBloodFont.jsp create mode 100644 src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodFont.js diff --git a/src/main/java/com/emr/controller/FontShowRecordController.java b/src/main/java/com/emr/controller/FontShowRecordController.java index 4c2e24a..37554f4 100644 --- a/src/main/java/com/emr/controller/FontShowRecordController.java +++ b/src/main/java/com/emr/controller/FontShowRecordController.java @@ -3,21 +3,28 @@ package com.emr.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.emr.annotation.OptionalLog; +import com.emr.dao.Archive_DetailMapper; import com.emr.dao.CommomMapper; import com.emr.dao.Emr_DictionaryMapper; import com.emr.dao.approve.Emr_Apply_ApproveMapper; +import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper; import com.emr.entity.Emr_Dictionary; import com.emr.entity.Power_User; import com.emr.entity.ResultUtil; +import com.emr.entity.Zd_Assort; import com.emr.entity.approve.Emr_Apply_Approve; import com.emr.entity.emrLog.Emr_Log; +import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet; +import com.emr.entity.recordType.Emr_Type; +import com.emr.entity.recordType.Emr_Type_Related; import com.emr.service.CommomService; +import com.emr.service.Zd_AssortServiceImpl; import com.emr.service.approve.ApplyApproveService; import com.emr.service.emrLog.LogService; import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService; -import com.emr.util.DateUtils; -import com.emr.util.ExceptionPrintUtil; -import com.emr.util.HttpClientUtils; +import com.emr.service.recordType.EmrTypeRelatedService; +import com.emr.service.recordType.EmrTypeService; +import com.emr.util.*; import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo; import com.emr.vo.User; import com.emr.vo.commomSearch.CommomTree; @@ -40,6 +47,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.File; import java.text.SimpleDateFormat; import java.util.*; @@ -47,10 +55,16 @@ import java.util.*; @Controller @RequestMapping("font/") public class FontShowRecordController { + @Autowired + private Archive_DetailMapper archiveDetailMapper; + @Autowired + private EmrPdfWaterSetMapper pdfWaterSetMapper; @Value("${waterPicPath}") private String WATERPICPATH; @Value("${EMR_RECORD_JSP}") private String EMRRECORDJSP; + @Autowired + private EmrTypeRelatedService typeRelatedService; @Value("${POWER_URLHEAD}") private String POWER_URLHEAD; @Autowired @@ -386,6 +400,304 @@ public class FontShowRecordController { return "font/showRecordFontSouth"; } + + @RequestMapping(value = "getBloodRecordTree", produces = {"text/json;charset=UTF-8"}) + @ResponseBody + public String getBloodRecordTree(String patientId, Integer typeId, HttpServletRequest request) { + List treeList = new ArrayList<>(); + //查询该有的权限分类 + try { + List commomVos = commomMapper.selectScanPathByPatientId(patientId, null, null); + //按打印分类id查询归属分类集合 + List typeRelateds = new ArrayList<>(); + if (typeId != null) { + typeRelateds = typeRelatedService.selectAssortIdsByTypeId(typeId); + } + if (commomVos.size() > 0) { + //第一级:全部影像资料 + CommomTree tree1 = new CommomTree(); + Integer id = 1; + tree1.setId(id); + tree1.setNewName("全部影像资料"); + if (null != commomVos && !commomVos.isEmpty()) { + //去重,取出不重复的分类集合 + Map assortMap = new LinkedHashMap<>(); + for (CommomTree commomVo1 : commomVos) { + assortMap.put(commomVo1.getAssortId(), commomVo1); + } + //判断分类是否全选,全选,父类跟着全选 + if (null != typeRelateds && !typeRelateds.isEmpty()) { + boolean checkedFlag = true; + for (Map.Entry 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 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; + //第二层 图片 + for (CommomTree commomVo : commomVos) { + 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("(第" + scanPathCount + "页)" + name); + tree3.setSource(commomVo.getSource()); + //存储水印图片 + treeList.add(tree3); + + } + } + tree2.setNewName(map.getValue().getAssortName() + "(" + scanPathCount + ")"); + treeList.add(tree2); + } + } + } + if (commomVos.size() == 0) { + List archiveDetail = archiveDetailMapper.selectPdfPathByPatient2(patientId); + //第一级:全部影像资料 + CommomTree tree1 = new CommomTree(); + Integer id = 1; + tree1.setId(id); + tree1.setNewName("全部影像资料"); + if (null != archiveDetail && !archiveDetail.isEmpty()) { + //去重,取出不重复的分类集合 + Map assortMap = new LinkedHashMap<>(); + for (CommomTree commomVo1 : archiveDetail) { + assortMap.put(commomVo1.getAssortId(), commomVo1); + } + //判断分类是否全选,全选,父类跟着全选 + if (null != typeRelateds && !typeRelateds.isEmpty()) { + boolean checkedFlag = true; + for (Map.Entry 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 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); + e.printStackTrace(); + return null; + } + } + + + @RequestMapping(value = "showRecordContentBlood") + @ResponseBody + public ResultUtil showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) { + try { + commomService.showRecordContentBloodFont(patientId, scanPages, sources, flag, response, request); + return ResultUtil.ok(); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return ResultUtil.error("showRecordContentBlood查询文件出错了"); + } + } + + + @RequestMapping("getPrintPicLoading") + @ResponseBody + public ResultUtil getPrintPicLoading(String patientId, HttpServletRequest request) throws Exception { + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + String mapKey = "admin" + "_" + patientId; + Integer loadingInteger = commomService.getPrintPicLoading(mapKey); + return ResultUtil.ok(loadingInteger); + } + + + + @RequestMapping(value = "selectPrintPic", method = RequestMethod.POST) + @ResponseBody + public ResultUtil selectPrintPic(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, HttpServletRequest request) throws Exception { + //生成加载进度mapKey + String mapKey = "admin" + "_" + patientId; + List outs = commomService.selectPrintPic(response, patientId, rootPaths, names, sources, mapKey); + return ResultUtil.ok(outs); + } + + @RequestMapping(value = "getRecordContentBlood") + @ResponseBody + public void getRecordContentBlood(String patientId, HttpServletRequest request, HttpServletResponse response) { + List commomTrees = archiveDetailMapper.selectPdfPathByPatient2(patientId); + if (commomTrees.size() == 0) { + try { + List scanPages = commomMapper.selectPathLIst(patientId); + if (!CollectionUtils.isEmpty(scanPages)) { + String pdfName = "档案管理PDF"; + //根据图片路径转换pdf + EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); + //UserEffective为1是开启用户信息水印 + Short userEffective = emrPdfWaterSet.getUserEffective(); + if (userEffective==1) { + img2PdfUtil.imageToPdfUserEffective(response, scanPages, pdfName, emrPdfWaterSet); + } + } + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + } else { + String pdfWater = ""; + String mapKey = "admin" + "_" + patientId; + List filePaths = (List) 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); + } + + } + } + + + @RequestMapping("showRecordIframeBloodNewFont") + public String showRecordIframeBlood(String patientId, String flag, Model model, HttpServletRequest request) { + model.addAttribute("patientId", patientId); + //打印分类集合 + List emrTypes = null; + List zdAssorts = null; + int isDownload = 0; + model.addAttribute("emrTypes", emrTypes); + model.addAttribute("zdAssorts", zdAssorts); + model.addAttribute("isDownload", isDownload); + //查询是否有打印权限 + int printFlag = 0; + int moveFlag = 0; + model.addAttribute("moveFlag", moveFlag); + model.addAttribute("printFlag", printFlag); + model.addAttribute("flag", flag); + return "recordManage/commomSearch/showRecordIframeBloodFont"; + } + /** * 跳转查看pdfiframe页 * @param patientId diff --git a/src/main/java/com/emr/dao/CommomMapper.java b/src/main/java/com/emr/dao/CommomMapper.java index 1c7bb5a..22e7466 100644 --- a/src/main/java/com/emr/dao/CommomMapper.java +++ b/src/main/java/com/emr/dao/CommomMapper.java @@ -124,4 +124,12 @@ public interface CommomMapper { * 查询所有集合 * */ List selectAllAndPatientId(@Param("patientId")String patientId); + + /** + * @description: 根据病案主键查文件路径 + * @params: patientId + * @author linjj + * @date: 2023/7/5 17:42 + */ + List selectPathLIst(@Param("patientId")String patientId); } \ No newline at end of file diff --git a/src/main/java/com/emr/service/CommomService.java b/src/main/java/com/emr/service/CommomService.java index 14af5fd..b7dc684 100644 --- a/src/main/java/com/emr/service/CommomService.java +++ b/src/main/java/com/emr/service/CommomService.java @@ -208,6 +208,58 @@ public class CommomService { return ipAddress; } + + //脐血库显示pdf + public void showRecordContentBloodFont(String patientId, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) throws Exception { + if (StringUtils.isNotBlank(patientId)) { + patientId = patientId.replace("\'", ""); + //查询 + if (StringUtils.isNotBlank(flag)) { + CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); + if (StringUtils.isNotBlank(commomVo.getFilePath())) { + //flag = home_addr取home_addr字段,path_file取home_addr字段 + String root1 = ""; + if ("home_addr".equals(flag)) { + root1 = commomVo.getHomeAddr(); + } else if ("file_path".equals(flag)) { + root1 = commomVo.getFilePath(); + } + String root2 = commomVo.getNewPath(); + //组织src + List src = new LinkedList<>(); + String[] scanPageArr = scanPages.split(","); + String[] sourceArr = sources.split(","); + for (int i = 0; i < scanPageArr.length; i++) { + String srcStr = ""; + if (StringUtils.isNotBlank(scanPageArr[i])) { + srcStr = root1 + File.separator + scanPageArr[i]; + } + src.add(srcStr); + } + List filePaths = new LinkedList<>(); + for (String srcs : src) { + File file = new File(srcs); + if (file.isFile()) { + filePaths.add(srcs); + } + } + if (!filePaths.isEmpty()) { + String mapKey = "admin" + "_" + patientId; + request.getSession().setAttribute(mapKey, filePaths); + } + } else { + List commomTrees = archiveDetailMapper.selectPDFRATH(patientId); + if (!commomTrees.isEmpty()) { + String mapKey = "admin" + "_" + patientId; + request.getSession().setAttribute(mapKey, commomTrees); + } + } + + } + } + } + + //脐血库显示pdf public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) throws Exception { if (StringUtils.isNotBlank(patientId)) { diff --git a/src/main/resources/mapper/CommomMapper.xml b/src/main/resources/mapper/CommomMapper.xml index ff28668..47d0e53 100644 --- a/src/main/resources/mapper/CommomMapper.xml +++ b/src/main/resources/mapper/CommomMapper.xml @@ -1316,6 +1316,14 @@ parameterType="java.lang.String"> SELECT * from commomtable where patient_id=#{patientId} + update commomtable diff --git a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBloodFont.jsp b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBloodFont.jsp new file mode 100644 index 0000000..98659b7 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBloodFont.jsp @@ -0,0 +1,263 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + +<%@ include file="/WEB-INF/jspf/common.jspf" %> +<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + + + + 预览pdfIframe页面 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
    +
    +
    +
    +
    + + + + +
    + + + +
    +
    + +
    + + + + + + + + + + diff --git a/src/main/webapp/static/js/font/showRecordFont.js b/src/main/webapp/static/js/font/showRecordFont.js index d3389ff..8f824d3 100644 --- a/src/main/webapp/static/js/font/showRecordFont.js +++ b/src/main/webapp/static/js/font/showRecordFont.js @@ -13,7 +13,7 @@ $(function(){ $("#iframe").prop("src",path+"/font/showRecordIframeBloodFont?patientId="+$("#patientId").val()+"&flag=file_path"); }else{ //谷歌 - $("#iframe").prop("src",path+"/commom/showRecordIframeBlood?patientId="+$("#patientId").val()+"&flag=file_path"+"&rootPaths="+$("#rootPaths").val()); + $("#iframe").prop("src",path+"/font/showRecordIframeBloodNewFont?patientId="+$("#patientId").val()+"&flag=file_path"+"&rootPaths="+$("#rootPaths").val()); } //加载其他诊断名称鼠标滑过显示全部文本 //loadQtip('.otherDiagName'); diff --git a/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodFont.js b/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodFont.js new file mode 100644 index 0000000..9c60a53 --- /dev/null +++ b/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodFont.js @@ -0,0 +1,606 @@ +//树操作 +var menu = { + setting: { + view: { + fontCss: {"font-family": "微软雅黑", "color": "blue"} + }, + data: { + key: { + name: "newName" + }, + simpleData: { + chkStyle: "checkbox", + enable: true, + idKey: "id", + pIdKey: "parentId", + }, + }, + check: { + enable: true + }, + callback: { //回调函数 + onCheck: onCheck, + onClick: onClick + } + }, + loadMenuTree: function () { + $.ajax({ + type: "post", + url: path + "/font/getBloodRecordTree", + data: {patientId: $("#patientId").val(), typeId: $("#typeId").val()}, + dataType: "json", + success: function (data) { + $("#assortIds").val(""); + if (data != null) { + //图片相对路径集合 + var scanPages = ''; + //图片来源集合 + var sources = ''; + for (var i = 0; i < data.length; i++) { + if (data[i].parentId != null && data[i].parentId != 1 && data[i].checked == 'true') { + scanPages += data[i].assortName + ","; + sources += data[i].source + ","; + } + } + //去掉后面逗号 + if (scanPages != '') { + scanPages = scanPages.substring(0, scanPages.length - 1); + $("#assortIds").val(scanPages); + sources = sources.substring(0, sources.length - 1); + $("#sources").val(sources); + } + $.fn.zTree.init($("#ztree"), menu.setting, data); + zTree = $.fn.zTree.getZTreeObj("ztree"); + var nodes = zTree.getNodes(); + for (var i = 0; i < nodes.length; i++) { //设置节点展开 + zTree.expandNode(nodes[i], true, false, true); + } + //加载pdf + onloadPdf(scanPages, sources); + } + } + }) + } +}; +//加载树 +$().ready(function (data) { + menu.loadMenuTree(); +}); + +//树选中事件 +function onCheck(e, treeId, treeNode) { + var treeObj = $.fn.zTree.getZTreeObj("ztree"); + nodes = treeObj.getCheckedNodes(true); + var assortIds = ''; + var sources = ''; + for (var i = 0; i < nodes.length; i++) { + if (nodes[i].level == 2) { + if (i != (nodes.length - 1)) { + assortIds += nodes[i].assortName + ","; + sources += +nodes[i].source + ","; + } else { + assortIds += nodes[i].assortName + ""; + sources += nodes[i].source; + } + } + } + $("#assortIds").val(assortIds); + $("#sources").val(sources); +}; + +//树点击事件 +function onClick(e, treeId, treeNode) { + var treeLevel = treeNode.level; + //选中图片节点时 + if (treeLevel == 2) { + //图片集合 + var scanPages = treeNode.assortName; + //来源集合 + var sources = treeNode.source; + $("#assortIdByClick").val(scanPages); + $("#sourceByClick").val(sources); + onloadPdf(scanPages, sources); + } +}; +//打印分类变更事件 +$("#typeId").change(function () { + menu.loadMenuTree(); +}) + +//树复选框选中后加载pdf按钮 +function onloadPdfMethod() { + var scanPages = $("#assortIds").val(); + //来源集合 + var sources = $("#sources").val(); + $("#assortIdByClick").val(""); + $("#sourceByClick").val(""); + onloadPdf(scanPages, sources); +} + +//加载pdf按钮功能 +function onloadPdf(scanPages, sources) { + $("#iframeLoad").val(""); + $("#printPicLoaded").val(""); + var patientId = $("#patientId").val(); + //根目录字段识别名称 + var flag = parent.$("#flag").val(); + $.ajax({ + type: 'post', + url: path + "/font/showRecordContentBlood", + data: { + patientId: patientId, + scanPages: scanPages, + flag: flag, + sources: sources + }, + datType: 'json', + success: function (data) { + if (data.code == 0) { + var str = path + "/font/getRecordContentBlood?patientId=" + patientId; + $("#iframe1").attr("src", path + "/static/pdfjs/web/viewer.html?file=" + encodeURIComponent(str)) + } + } + }) +} + +/*function onloadPdf(scanPages, sources) { + $("#iframeLoad").val(""); + $("#printPicLoaded").val(""); + var patientId = $("#patientId").val(); + //根目录字段识别名称 + var flag = parent.$("#flag").val(); + var str = path + "/commom/showRecordContentBlood?patientId=" + patientId + "&scanPages=" + scanPages + "&sources=" + sources + "&flag=" + flag; + $("#iframe1").attr("src", path + "/static/pdfjs/web/viewer1.html?file=" + encodeURIComponent(str)); + var rootPaths = parent.$("#rootPaths").val(); + //加载的图片 + var print = $("#print").val(); + if (scanPages != '' && print == 1) { + selectPrintPic(patientId, rootPaths, scanPages, sources); + } +}*/ + +var iframe = document.getElementById("iframe1"); + +/** + * 加载打印预览所需图片 + */ +//定义打印预览加载图片进度 +function selectPrintPic(patientId, rootPaths, scanPages, sources) { + $.ajax({ + type: 'post', + url: path + "/font/selectPrintPic", + data: { + patientId: patientId, + rootPaths: rootPaths, + names: scanPages, + sources: sources + }, + datType: 'json', + success: function (data) { + if (data.code == 0) { + var resultList = data.data; + if (null != resultList) { + var img = ''; + for (var i = 0; i < resultList.length; i++) { + img += ""; + } + var interval = setInterval(function () { + if ($("#iframeLoad").val() == 1) { + iframe.contentDocument.getElementById("printContainer1").innerHTML = img; + $("#printPicLoaded").val(1); + iframe.contentDocument.getElementById("printLoading").style.display = 'none'; + iframe.contentDocument.getElementById("print").style.display = 'block'; + clearInterval(interval); + } + }, 200); + } + } else { + toastr.error(data.msg); + } + } + }) + //查询进度定时器 + var interval1 = setInterval(function () { + $.ajax({ + type: 'get', + url: path + "/commom/getPrintPicLoading", + data: {patientId: $("#patientId").val()}, + dataType: 'json', + success: function (data) { + if (data.code == 0) { + var value = data.data; + $("#loading").val(value + "%"); + if (value == 100) { + //杀死进度定时器 + clearInterval(interval1); + } + } else { + toastr.error(data.msg); + } + } + }) + }, 100000); +} + +function selectPrintPic2(patientId, scanPages, sources) { + $.ajax({ + type: 'post', + url: path + "/commom/selectPrintPic2", + data: { + patientId: patientId, + names: scanPages, + sources: sources + }, + datType: 'json', + success: function (data) { + if (data.code == 0) { + var resultList = data.data; + if (null != resultList) { + var img = ''; + for (var i = 0; i < resultList.length; i++) { + img += ""; + } + var interval = setInterval(function () { + if ($("#iframeLoad").val() == 1) { + iframe.contentDocument.getElementById("printContainer1").innerHTML = img; + $("#printPicLoaded").val(1); + iframe.contentDocument.getElementById("printLoading").style.display = 'none'; + iframe.contentDocument.getElementById("print").style.display = 'block'; + clearInterval(interval); + } + }, 200); + } + } else { + toastr.error(data.msg); + } + } + }) + //查询进度定时器 + var interval1 = setInterval(function () { + $.ajax({ + type: 'get', + url: path + "/font/getPrintPicLoading", + data: {patientId: $("#patientId").val()}, + dataType: 'json', + success: function (data) { + if (data.code == 0) { + var value = data.data; + $("#loading").val(value + "%"); + if (value == 100) { + //杀死进度定时器 + clearInterval(interval1); + } + } else { + toastr.error(data.msg); + } + } + }) + }, 1000000); +} + +if (iframe.attachEvent) { + iframe.attachEvent("onreadystatechange", function () { + //此事件在内容没有被载入时候也会被触发,所以我们要判断状态 + //有时候会比较怪异 readyState状态会跳过 complete 所以我们loaded状态也要判断 + if (iframe.readyState === "complete" || iframe.readyState == "loaded") { + //代码能执行到这里说明已经载入成功完毕了 + //要清除掉事件 + iframe.detachEvent("onreadystatechange", arguments.callee); + //这里是回调函数 + } + }); +} else { + iframe.addEventListener("load", function () { + $("#iframeLoad").val(1); + //代码能执行到这里说明已经载入成功完毕了 + this.removeEventListener("load", arguments.call, false); + }, false); +} + +//下载pdf按钮功能 +function onloadJpgForPdf() { + var typeId = $("#typeId").val(); + if (typeId == undefined) { + typeId = ''; + } + Common.confirm({ + title: "提示", + message: "确认将左侧树选中的图片下载pdf?", + operate: function (reselt) { + if (reselt) { + var patientId = $("#patientId").val(); + var assortIds = $("#assortIds").val(); + var flag = parent.$("#flag").val(); + post(path + '/template/downloadPdfBlood', { + "patientIds": patientId, + "assortIds": assortIds, + "typeId": typeId, + "flag": flag + }); + } + } + }) +} + +//重新归页确定按钮功能 +function sure() { + Common.confirm({ + title: "提示", + message: "确认将左侧树选中的图片是否重新归页?", + operate: function (reselt) { + if (reselt) { + //pdf页数 + var newAssortId = $("#newAssortId").val(); + if (newAssortId != '') { + var patientId = $("#patientId").val(); + var assortIds = $("#assortIds").val(); + if (assortIds != '') { + $.ajax({ + type: 'post', + url: path + '/commom/updateScanAssortByBlood', + data: { + patientId: patientId, + name: parent.$("#name").val(), + assortIds: assortIds, + newAssortId: newAssortId + }, + dataType: 'json', + success: function (data) { + if (data.code == 0) { + toastr.success("重新归页成功!"); + } + //重新加载 + menu.loadMenuTree(); + } + }) + } else { + toastr.warning("左侧树至少选中一张图片!") + } + } else { + toastr.warning("要重新分页,需选中其中下拉框其中一项!") + } + } + } + }) +} + +//删除图片 +function delPic() { + Common.confirm({ + title: "提示", + message: "确认将左侧树选中的图片删除?", + operate: function (reselt) { + if (reselt) { + var patientId = $("#patientId").val(); + var assortIds = $("#assortIds").val(); + if (assortIds != '') { + $.ajax({ + type: 'post', + url: path + '/commom/delScanAssortByBlood', + data: {patientId: patientId, name: parent.$("#name").val(), assortIds: assortIds}, + dataType: 'json', + success: function (data) { + if (data.code == 0) { + toastr.success("删除成功!"); + } + //重新加载 + menu.loadMenuTree(); + } + }) + } + } + } + }) +} + +//记录打印记录 +function printInfoBlood() { + var patientId = "'" + $("#patientId").val() + "'"; + var typeId = $("#typeId").val(); + if (typeId == undefined) { + typeId = ''; + } + var assortIds = ''; + //判断树点击选中赋值的框是否有值,有则属于取点击选中的值,否则去加载pdf的值 + var assortIdByClick = $("#assortIdByClick").val(); + if (assortIdByClick != '') { + assortIds = $("#assortIdByClick").val(); + } else { + assortIds = $("#assortIds").val(); + } + var flag = $("#flag").val(); + $.ajax({ + type: 'post', + url: path + '/template/printInfoBlood', + data: {"patientIds": patientId, "assortIds": assortIds, "typeId": typeId, "flag": flag}, + dataType: 'json', + success: function (data) { + if (data.code == 0) { + toastr.success("打印成功") + } else { + toastr.success(data.msg) + } + } + }) +} + +/** + * 病案查询 + */ +function search() { + var inpatientNo = $("#inpatientNo").val(); + var admissTimes = $("#admissTimes").val(); + var name = $("#name").val(); + if (inpatientNo == "" && admissTimes == "" && name == "") { + toastr.warning("请输入搜索信息在进行查询"); + } else { + var sql = "select patient_id,inpatient_no,name,admiss_times,admiss_date,dis_date,dis_dept from commomtable where 1 = 1"; + if (null != inpatientNo && "" != inpatientNo) { + sql += " and inpatient_no like '%" + inpatientNo + "%'"; + } + if (null != admissTimes && "" != admissTimes) { + sql += " and admiss_times like '%" + admissTimes + "%'"; + } + if (null != name && "" != name) { + 4 + sql += " and name like '%" + name + "%'"; + } + $("#mytab").bootstrapTable('destroy'); + //生成用户数据 + $('#mytab').bootstrapTable({ + method: 'post', + contentType: 'application/x-www-form-urlencoded; charset=UTF-8', + toolbar: '#toolbar', //工具按钮用哪个容器 + striped: true, //是否显示行间隔色 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) + pagination: true, //是否显示分页(*) + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*) + paginationPreText: '上一页', + paginationNextText: '下一页', + paginationFirstText: '<', + paginationLastText: '>', + detailView: flag, + pageNumber: 1, //初始化加载第一页,默认第一页 + pageSize: 5, //每页的记录行数(*) + pageList: [5, 10, 20, 50, 100],//可供选择的每页的行数(*) + height: 400,//高度调整 //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度 + buttonsAlign: "left",//按钮对齐方式 + columns: [ + { + title: '病案号', + field: 'inpatientNo', + }, + { + title: '姓名', + field: 'name', + }, + { + title: '住院次数', + field: 'admissTimes', + }, + { + title: '入院日期', + field: 'admissDate', + }, + { + title: '出院时间', + field: 'disDate', + }, + { + title: '出院科室', + field: 'disDept', + }, + { + title: '操作', + formatter: function (value, row, index) { + var patientId = row.patientId; + var inpatientNo = row.inpatientNo.replace(/\s+/g, ""); + var name = row.name; + var admissTimes = row.admissTimes; + var info = "'" + patientId + "," + inpatientNo + "," + name + "," + admissTimes + "'"; + var editanddrop = ''; + return editanddrop; + } + } + ], + locale: 'zh-CN',//中文支持, + url: path + '/template/cutomSearchTable',//排序方式 + queryParams: function (params) { + return { + sql: sql, + limit: params.limit, // 每页显示数量 + offset: params.offset, // SQL语句起始索引 + page: (params.offset / params.limit) + 1 //当前页码 + } + }, + responseHandler: function (res) { + //在ajax获取到数据,渲染表格之前,修改数据源 + var nres = []; + nres.push({total: res.total, rows: res.list}); + return nres[0]; + }, + onLoadSuccess: function (res) { + $(".clearfix").height(0); + $(".page-list").show(); + $(".fixed-table-body").css("overflow", "auto"); + //赋值总数 + $("#rows").val(res.total); + //全选 + $('.fixed-table-container').on('click', 'input[name="btSelectAll"]', function () { + if ($(this).is(':checked')) { + $('input[name="btSelectItem"]').prop('checked', true); + } else { + $('input[name="btSelectItem"]').prop('checked', false); + } + }) + //逐个选择 + $('.fixed-table-container').on('click', 'input[name="btSelectItem"]', function () { + var inputs = $(this).parents('.fixed-table-body-columns').find('input[name="btSelectItem"]') + var num = 0; + inputs.each(function () { + if ($(this).is(':checked')) { + num++; + } + }); + if (num == inputs.length) { + $('input[name="btSelectAll"]').prop('checked', true); + } else { + $('input[name="btSelectAll"]').prop('checked', false); + } + var index = $(this).parents('tr').index(); + $('#Table1').find('input[name="btSelectItem"]').eq(index).click(); + }); + } + }) + } +} + +/** + * 显示需要移动的病案信息 + * @param patientId + */ +function showInfo(info) { + var infoList = info.split(","); + $("#patientIdInfo").val(infoList[0]); + $("#inpatientNoInfo").val(infoList[1]); + $("#nameInfo").val(infoList[2]); + $("#admissTimesInfo").val(infoList[3]); +} + +/** + * 修改PDF存放地址 + */ +function movePdf() { + //需要移动PDF的病案id + var oldPatientId = $("#patientId").val(); + //目标病案id + var newPatientId = $("#patientIdInfo").val(); + //选中图片名称 + var assortIds = $("#assortIds").val(); + //选中分段 + var newAssortId = $("#moveAssortId").val(); + if (oldPatientId == '' || newPatientId == '' || assortIds == '' || newAssortId == '') { + toastr.warning("程序出现错误,请联系管理员!"); + } else { + $.ajax({ + type: 'post', + url: path + '/template/movePdfBlood', + data: { + oldPatientId: oldPatientId, + newPatientId: newPatientId, + assortIds: assortIds, + newAssortId: newAssortId, + flag: parent.$("#flag").val() + }, + dataType: 'json', + success: function (data) { + if (data.code == 0) { + window.location.reload(); + toastr.success("转移成功!"); + } + } + }) + } + + +}