|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页码为0的读取pdf文件重置页码
|
|
|
|
|
* @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)) {
|
|
|
|
|
//重新排序
|
|
|
|
|
|