| | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.math.BigDecimal; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.text.Collator; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | private ITjProAdvicerulesService tjProAdvicerulesService; |
| | | @Autowired |
| | | private TjOrderYcxmService ycxmService; |
| | | @Resource |
| | | private TjXdtgmdjgService xdtgmdjgService; |
| | | |
| | | private Integer pdfPage = 0; |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | /*else { |
| | | if (!collect.isEmpty() || !map.isEmpty()){ |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "检查综述:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | isBr = true; |
| | | } |
| | | |
| | | for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | // 已经遍历过的 |
| | | ArrayList<String> jianYanYiDa = new ArrayList<>(); |
| | | for (CsProVo proVo : proVos) { |
| | | |
| | | // 检查 |
| | | for (Map.Entry<Long, List<TjOrderDetail>> entry : collect.entrySet()) { |
| | | if (!entry.getKey().equals(proVo.getProId())) continue; |
| | | List<TjOrderDetail> details = entry.getValue(); |
| | | String xmmc = proVo.getProName(); |
| | | // String xmmc = details.get(0).getProName(); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (TjOrderDetail detail : details) { |
| | | // if (!entry.getKey().equals(detail.getProId())) continue; |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh + ". " + xmmc, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (StrUtil.isBlank(result.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index).append(")").append(detail.getProName()).append(": ").append(result).append("\n"); |
| | | index++; |
| | | |
| | | result = builder.toString(); |
| | | } |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | xmXh++; |
| | | } |
| | | } |
| | | |
| | | // 检验 |
| | | for (Map.Entry<String, Object> item : map.entrySet()) { |
| | | String xmmc = item.getKey(); |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (List<String> i : lists) { |
| | | if (!i.get(6).contains(String.valueOf(proVo.getProId()))) continue; |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (jianYanYiDa.contains(i.get(5))) continue; |
| | | jianYanYiDa.add(i.get(5)); |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh + ". " + xmmc, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String content = " (" + index + ") " + i.get(0) + ":" + i.get(1) + " " + i.get(3) + " " + i.get(4) + " " + i.get(2); |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | index++; |
| | | } |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | xmXh++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | if(isBr) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | |
| | | } |
| | | } |
| | | |
| | | /*for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | ArrayList<String> jianYanYiDa = new ArrayList<>(); |
| | | for (CsProVo proVo : proVos) { |
| | | // 检查 |
| | | for (Map.Entry<Long, List<TjOrderDetail>> entry : collect.entrySet()) { |
| | | if (!entry.getKey().equals(proVo.getProId())) continue; |
| | | List<TjOrderDetail> details = entry.getValue(); |
| | | if(null !=details && !details.isEmpty()){ |
| | | details= details.stream() |
| | | .sorted(Comparator.comparing(TjOrderDetail::getProName)) |
| | | .collect(Collectors.toList()); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | int index1 = 1; |
| | | for (TjOrderDetail detail : details) { |
| | | String xmmc = proVo.getProName(); |
| | | // String xmmc = detail.getProName(); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | StringBuilder builder = new StringBuilder(); |
| | | // String[] split = result.split("\n"); |
| | | // for (String s : split) { |
| | | // if (StrUtil.isBlank(s.replaceAll("\n", "").trim())) continue; |
| | | // builder.append(" (").append(index1).append(")").append(s).append("\n"); |
| | | // index1++; |
| | | // } |
| | | |
| | | if (StrUtil.isBlank(result.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index1).append(")").append(detail.getProName()).append(": ").append(result).append("\n"); |
| | | index1++; |
| | | |
| | | result = builder.toString(); |
| | | } |
| | | if (StrUtil.isNotBlank(result)) { |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } else { |
| | | paragraph = new Paragraph("建议定期复查", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | |
| | | LambdaQueryWrapper<TjOrderYcxm> ycwq=new LambdaQueryWrapper<>(); |
| | | ycwq.eq(TjOrderYcxm::getTjh,tjOrder.getTjNumber()); |
| | | ycwq.eq(TjOrderYcxm::getJcxm,detail.getProName()); |
| | | TjOrderYcxm ycxm = ycxmService.getOne(ycwq); |
| | | if(null !=ycxm){ |
| | | String jynr = ycxm.getJynr(); |
| | | JSONArray array = JSONUtil.parseArray(jynr); |
| | | for (Object object : array) { |
| | | Map<String,Object> objectMap=new HashMap<>(); |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String bt = jsonObject.getStr("bt"); |
| | | String nr = jsonObject.getStr("nr"); |
| | | objectMap.put("bt",bt); |
| | | objectMap.put("nr",nr); |
| | | if(null !=bt || null !=nr) maps.add(objectMap); |
| | | } |
| | | List<Map<String, Object>> collect1 = maps.stream().distinct().collect(Collectors.toList()); |
| | | for (Map<String, Object> objectMap : collect1) { |
| | | String content = str + objectMap.get("bt").toString() + objectMap.get("nr").toString(); |
| | | if (StrUtil.isBlank(content)) content = " "; |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | index++; |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | } |
| | | // 检验 |
| | | for (Map.Entry<String, Object> item : map.entrySet()) { |
| | | String xmmc = item.getKey(); |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (List<String> i : lists) { |
| | | if (!i.get(6).contains(String.valueOf(proVo.getProId()))) continue; |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (jianYanYiDa.contains(i.get(5))) continue; |
| | | jianYanYiDa.add(i.get(5)); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String content = " (" + index + ")" + i.get(0) + ":" + i.get(1) + " " + i.get(3) + " " + i.get(4) + " " + i.get(2); |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | String str = " "; |
| | | |
| | | LambdaQueryWrapper<TjOrderYcxm> ycwq=new LambdaQueryWrapper<>(); |
| | | ycwq.eq(TjOrderYcxm::getTjh,tjOrder.getTjNumber()); |
| | | ycwq.eq(TjOrderYcxm::getJcxm,i.get(0)); |
| | | TjOrderYcxm ycxm = ycxmService.getOne(ycwq); |
| | | if(null !=ycxm){ |
| | | String jynr = ycxm.getJynr(); |
| | | JSONArray array = JSONUtil.parseArray(jynr); |
| | | for (Object object : array) { |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String bt = jsonObject.getStr("bt"); |
| | | String nr = jsonObject.getStr("nr"); |
| | | if(null !=bt || null !=nr) { |
| | | String content1 = str + bt + nr; |
| | | if (StrUtil.isBlank(content)) content1 = " "; |
| | | paragraph = new Paragraph(content1, defaultFont); |
| | | } |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(2f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | index++; |
| | | } |
| | | } |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | /** else { |
| | | |
| | | if (!collect.isEmpty() || !map.isEmpty()){ |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "医生建议:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | } |
| | | |
| | | for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | ArrayList<String> jianYanYiDa = new ArrayList<>(); |
| | | for (CsProVo proVo : proVos) { |
| | | // 检查 |
| | | for (Map.Entry<Long, List<TjOrderDetail>> entry : collect.entrySet()) { |
| | | if (!entry.getKey().equals(proVo.getProId())) continue; |
| | | List<TjOrderDetail> details = entry.getValue(); |
| | | String xmmc = details.get(0).getProName(); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (TjOrderDetail detail : details) { |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | // result = result.replaceAll(" ","").replaceAll("\t",""); |
| | | // result = result.replaceAll("\n本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | // result = "\n " + result.replaceAll("\n", "\n "); |
| | | int index1 = 1; |
| | | String[] split = result.split("\n"); |
| | | // boolean contains = result.contains("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | boolean contains = result.contains(" "); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | if (StrUtil.isBlank(s.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index1).append(")").append(s).append("\n"); |
| | | index1++; |
| | | } |
| | | // if (!contains) builder.append(" (").append(index1).append(")").append("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | // if (!contains) builder.append(" (").append(index1).append(")").append(" "); |
| | | // else builder.substring(0,builder.length() - 1); |
| | | result = builder.toString(); |
| | | } |
| | | // String content = " (" + index + ") " + detail.getProName() + ":" + result; |
| | | // content = content.replaceAll("[\\n\\r]+$", ""); |
| | | // content = content.replaceAll("\\s+$", ""); |
| | | // paragraph = new Paragraph(content, defaultFont); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } else { |
| | | paragraph = new Paragraph("建议定期复查", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | String str = " "; |
| | | // List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(entry.getKey().toString(),"", |
| | | // detail.getYcbz(),tjOrder.getTjNumber(),detail.getProName().replaceAll("[((][^))]*[))]", "") |
| | | // .replaceAll("[ 测定检测]",""),detail.getProResult()); |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | if (detail.getDeptId().equals("2")) { |
| | | String[] split = result.split("。|,|,"); |
| | | for (String s : split) { |
| | | s = s.replaceAll("\n", "").replaceAll("[((][^))]*[))]", ""); |
| | | // Map<String,Object> mapss= tjRulesService.getyichangxiangmujianyiguizeJianCha(s); |
| | | Map<String, Object> mapss = tjProAdvicerulesService.getyichangxiangmujianyiguizeJianCha(detail.getKs(), s, "0"); |
| | | if (null != mapss) { |
| | | Object bt = mapss.get("bt"); |
| | | Object nr = mapss.get("nr"); |
| | | if (null != bt && null != nr) maps.add(mapss); |
| | | } |
| | | } |
| | | } |
| | | List<Map<String, Object>> collect1 = maps.stream().distinct().collect(Collectors.toList()); |
| | | |
| | | for (Map<String, Object> objectMap : collect1) { |
| | | String content = str + objectMap.get("bt").toString() + objectMap.get("nr").toString(); |
| | | // if (StrUtil.isBlank(content)) content = " 本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"; |
| | | if (StrUtil.isBlank(content)) content = " "; |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | index++; |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | // 检验 |
| | | for (Map.Entry<String, Object> item : map.entrySet()) { |
| | | String xmmc = item.getKey(); |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (List<String> i : lists) { |
| | | if (!i.get(6).contains(String.valueOf(proVo.getProId()))) continue; |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (jianYanYiDa.contains(i.get(5))) continue; |
| | | jianYanYiDa.add(i.get(5)); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String content = " (" + index + ")" + i.get(0) + ":" + i.get(1) + " " + i.get(3) + " " + i.get(4) + " " + i.get(2); |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | // 第六位是lis项目id |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getLisXmbm,i.get(5)); |
| | | // TjProject project = projectService.getOne(wrapper); |
| | | // if (project != null) { |
| | | // LambdaQueryWrapper<TjRules> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(TjRules::getProId,project.getProId()); |
| | | // List<TjRules> rules = tjRulesService.list(queryWrapper); |
| | | // if (!rules.isEmpty()){ |
| | | // |
| | | // } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(i.get(5), "", |
| | | i.get(2), tjOrder.getTjNumber(), i.get(0).replaceAll("[((][^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", ""), i.get(1)); |
| | | if (!maps.isEmpty()) { |
| | | for (Map<String, Object> objectMap : maps) { |
| | | // paragraph = new Paragraph(str+"建议标题",defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | // |
| | | // paragraph = new Paragraph(str+objectMap.get("bt").toString(),defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | // |
| | | // paragraph = new Paragraph(str+"建议内容",defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | // |
| | | // paragraph = new Paragraph(str+objectMap.get("nr").toString(),defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | Object bt = objectMap.get("bt"); |
| | | Object nr = objectMap.get("nr"); |
| | | if (null != bt && null != nr) { |
| | | String content1 = str + bt.toString() + nr.toString().trim(); |
| | | if (StrUtil.isBlank(content)) content1 = " "; |
| | | paragraph = new Paragraph(content1, defaultFont); |
| | | } |
| | | // if (StrUtil.isBlank(content)) content1 = " 本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"; |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(2f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | // } |
| | | index++; |
| | | } |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | |
| | | for (int i = 0; i < 1; i++) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | LambdaQueryWrapper<TjXdtgmdjg> wqq=new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjXdtgmdjg::getTjh,tjOrder.getTjNumber()); |
| | | wqq.isNotNull(TjXdtgmdjg::getUrl); |
| | | List<TjXdtgmdjg> xdtgmdjgList = xdtgmdjgService.list(wqq); |
| | | |
| | | int index=1; |
| | | for (TjXdtgmdjg xdtgmdjg : xdtgmdjgList) { |
| | | document.newPage(); |
| | | cell = new PdfPCell(); |
| | | PdfPTable tablefj = new PdfPTable(new float[]{100f}); |
| | | tablefj.setTotalWidth(PageSize.A4.getWidth() - 100); |
| | | tablefj.setLockedWidth(true); |
| | | tablefj.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | tablefj.getDefaultCell().setBorder(0); |
| | | tablefj.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); |
| | | |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_CENTER); |
| | | cell.setPaddingTop(10); |
| | | cell.setPaddingBottom(10); |
| | | cell.setPhrase(new Phrase("附件"+index+": "+ xdtgmdjg.getProName(), zongJianFont)); |
| | | Path path = Paths.get(xdtgmdjg.getUrl()); |
| | | byte[] bytesfj = null; |
| | | try { |
| | | bytesfj = Files.readAllBytes(path); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | Image image = Image.getInstance(bytesfj); |
| | | image.scaleToFit(500, 2500); |
| | | tablefj.addCell(cell); |
| | | cell = new PdfPCell(); |
| | | cell.addElement(image); |
| | | tablefj.addCell(cell); |
| | | document.add(tablefj); |
| | | index++; |
| | | } |
| | | |
| | | document.close(); |
| | | |
| | | |