更新版本20201016补充

master
zengwh 5 years ago
parent b30a8eb567
commit 2d9f048312

@ -315,7 +315,7 @@ public class FontController {
String assortid = detail.getAssortid();
if(StringUtils.isNotBlank(assortid) && assortid.equals(assortId)){
//是病程记录
if(!flag){
if(!flag && StringUtils.isNotBlank(detailTemp.getTitle())){
AssortTypeTree tree2 = new AssortTypeTree();
//第三层,资料名称
count++;
@ -331,7 +331,7 @@ public class FontController {
}
if(StringUtils.isNotBlank(assortid) && assortid.equals(nurseAssortId)){
//是护理记录
if(!nurseflag){
if(!nurseflag && StringUtils.isNotBlank(nurseDetailVoTemp.getTitle())){
AssortTypeTree tree2 = new AssortTypeTree();
//第三层,资料名称
count++;

@ -33,6 +33,8 @@ public class Archive_Detail_Vo extends Archive_Detail{
private String ids;
private String pageCounts;
private String pdfPaths;
}

@ -13,6 +13,7 @@ import com.emr.service.Archive_DetailService;
import com.emr.util.Jpg2PdfUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lowagie.text.pdf.PdfReader;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
@ -32,7 +35,50 @@ public class Archive_DetailServiceImpl implements Archive_DetailService {
@Override
public List<Archive_Detail_Vo> selectByClo(Archive_Detail_Vo record) {
return archiveDetailMapper.selectByClo(record);
List<Archive_Detail_Vo> list = archiveDetailMapper.selectByClo(record);
//页码为0的计算页码
if(!CollectionUtils.isEmpty(list)){
for(Archive_Detail_Vo vo : list){
//页码为0的读取pdf文件重置页码
setPdfPages(vo);
}
}
return list;
}
/**
* 0pdf
* @param vo
*/
private void setPdfPages(Archive_Detail_Vo vo) {
//获取页码
String pageCounts = vo.getPageCounts();
//获取路径
String pdfPaths = vo.getPdfPaths();
//遍历是否存在页码为0的
String[] pageCountArr = pageCounts.split(",");
String[] pdfPathArr = pdfPaths.split(",");
//定义临时页码集合
StringBuilder newPageCount = new StringBuilder();
for (int i = 0; i < pageCountArr.length; i++) {
String pageCountStr = pageCountArr[i];
if("0".equals(pageCountStr)){
String pathPath = pdfPathArr[i];
File file = new File(pathPath);
try{
PdfReader pdfReader = new PdfReader(new FileInputStream(file));
pageCountStr = pdfReader.getNumberOfPages() + "";
}catch (Exception e){
e.printStackTrace();
}
}
if(StringUtils.isNotBlank(newPageCount)){
newPageCount.append(",");
}
newPageCount.append(pageCountStr);
}
//重置页码
vo.setPageCounts(newPageCount.toString());
}
@Override
@ -51,13 +97,15 @@ public class Archive_DetailServiceImpl implements Archive_DetailService {
//定义接收首次病程记录的对象
Archive_Detail_Vo detailVoTemp = new Archive_Detail_Vo();
Archive_Detail_Vo nurseDetailVoTemp = new Archive_Detail_Vo();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getAssortId().equals(assortId) && list.get(i).getTitle().contains(strTemp)) {
detailVoTemp = list.get(i);
for (Archive_Detail_Vo detailVo1 : list) {
if (detailVo1.getAssortId().equals(assortId) && detailVo1.getTitle().contains(strTemp)) {
detailVoTemp = detailVo1;
}
if (list.get(i).getAssortId().equals(nurseAssortId) && list.get(i).getTitle().contains(nurseTemp)) {
nurseDetailVoTemp = list.get(i);
if (detailVo1.getAssortId().equals(nurseAssortId) && detailVo1.getTitle().contains(nurseTemp)) {
nurseDetailVoTemp = detailVo1;
}
//页码为0的读取pdf文件重置页码
setPdfPages(detailVo1);
}
if (!CollectionUtils.isEmpty(list)) {
//重新排序

@ -35,6 +35,14 @@
id, PDF_PATH, MasterID, UpLoadDateTime, AssortID, Source, SubAssort, Title, flag,
Sys
</sql>
<sql id="selectMasterAndAssortIds">
<if test="patientId != null and patientId != ''">
and MasterID=#{patientId,jdbcType=VARCHAR}
</if>
<if test="assortid != null and assortid != ''">
and AssortID in (${assortid})
</if>
</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,(
@ -47,9 +55,7 @@
archive_detail
where
AssortID = z.assort_id
<if test="patientId != null and patientId != ''">
and MasterID=#{patientId,jdbcType=VARCHAR}
</if>
<include refid="selectMasterAndAssortIds"></include>
FOR XML path ( '' )
),
1,
@ -66,25 +72,36 @@
archive_detail
where
AssortID = z.assort_id
<if test="patientId != null and patientId != ''">
and MasterID=#{patientId,jdbcType=VARCHAR}
</if>
<include refid="selectMasterAndAssortIds"></include>
FOR XML path ( '' )
),
1,
1,
''
)
) pageCounts,(
SELECT
STUFF (
(
SELECT
',' + PDF_PATH
FROM
archive_detail
where
AssortID = z.assort_id
<include refid="selectMasterAndAssortIds"></include>
FOR XML path ( '' )
),
1,
1,
''
)
) pageCounts from(select AssortID,count(*) pageNum from
) pdfPaths
from(select AssortID,count(*) pageNum from
archive_detail
-- MasterID='a72163dd10e6443b90fb82384a1debf4'
where 1=1
<if test="patientId != null and patientId != ''">
and MasterID=#{patientId,jdbcType=VARCHAR}
</if>
<if test="assortid != null and assortid != ''">
and AssortID in (${assortid})
</if>
<include refid="selectMasterAndAssortIds"></include>
GROUP BY AssortID) s
RIGHT JOIN zd_assort z
on s.AssortID=z.assort_id
@ -94,7 +111,7 @@
<!--分段详情文件列表-->
<select id="detailByClo" resultMap="BaseResultMap2" parameterType="com.emr.entity.Archive_Detail_Vo">
select
t.MasterID,t.id,t.PDF_PATH,t.Source,t.UpLoadDateTime,t.SubAssort,t.Title,t.flag,z.assort_id,z.assort_name,z.assort_sort,z.print_flag,t.PageCount pageCounts,t.id ids
t.MasterID,t.id,t.PDF_PATH,t.Source,t.UpLoadDateTime,t.SubAssort,t.Title,t.flag,z.assort_id,z.assort_name,z.assort_sort,z.print_flag,isnull(t.PageCount,0) pageCounts,t.id ids,t.PDF_PATH pdfPaths
from zd_assort z
left join archive_detail t
on z.assort_id=t.AssortID

@ -41,7 +41,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<script src="debugger.js"></script>
<script src="viewer.js?time=2020-10-16"></script>
<script src="viewer.js?time=2020-10-16_1"></script>
<style>
.loading {
@ -536,38 +536,40 @@ http://sourceforge.net/adobe/cmap/wiki/License/
var currentPageNum = document.getElementById('pageNumber').value;
if (pageNum != currentPageNum) {
pageNum = currentPageNum;
//获取用户id
var userId = window.opener.$("#userId").val();
//获取分类key
var key = getQueryVariable("key");
//设置页码缓存
var localStorageKey = 'page_'+userId + '_' + key;
//获取页面上
var list = window.opener.table2List;
var page = 0;
for (var i = 0; i < list.length; i++) {
//跳过根节点
if(list[i].id != 0) {
//获取detailsIds集合
var ids = list[i].ids;
//获取页码集合
var pageCounts = list[i].pageCounts;
//遍历ids
var idArr = ids.split(",");
var pageCountArr = pageCounts.split(",");
for (var j = 0; j < idArr.length; j++) {
//计算页码
var pageCount = Number(pageCountArr[j]);
for (var l = 0; l < pageCount; l++) {
//累加页码
page += 1;
if(page == Number(pageNum)){
//设置缓存
var localStorageValue = idArr[j] + "_" + (l+1) + "_" + new Date().getTime();
localStorage.setItem(localStorageKey, localStorageValue);
breakFlag = true;
//退出循环
return ;
if(key) {
//获取用户id
var userId = window.opener.$("#userId").val();
//设置页码缓存
var localStorageKey = 'page_' + userId + '_' + key;
//获取页面上
var list = window.opener.table2List;
var page = 0;
for (var i = 0; i < list.length; i++) {
//跳过根节点
if (list[i].id != 0) {
//获取detailsIds集合
var ids = list[i].ids;
//获取页码集合
var pageCounts = list[i].pageCounts;
//遍历ids
var idArr = ids.split(",");
var pageCountArr = pageCounts.split(",");
for (var j = 0; j < idArr.length; j++) {
//计算页码
var pageCount = Number(pageCountArr[j]);
for (var l = 0; l < pageCount; l++) {
//累加页码
page += 1;
if (page == Number(pageNum)) {
//设置缓存
var localStorageValue = idArr[j] + "_" + (l + 1) + "_" + new Date().getTime();
localStorage.setItem(localStorageKey, localStorageValue);
breakFlag = true;
//退出循环
return;
}
}
}
}

@ -6515,8 +6515,11 @@ var PDFViewerApplication = {
// if 'currentPageNumber' is larger than the number of pages in the file.
//获取url中的page,跳转页数
var page = getQueryVariable("page");
if(!page){
page = 1;
}
document.getElementById('pageNumber').value =
this.pdfViewer.currentPageNumber = page==null?1:page;
this.pdfViewer.currentPageNumber = page;
if (PDFHistory.initialDestination) {
this.navigateTo(PDFHistory.initialDestination);
PDFHistory.initialDestination = null;

Loading…
Cancel
Save