| | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.ltkj.common.core.domain.entity.SysDictData; |
| | | import com.ltkj.common.core.domain.entity.SysUser; |
| | | import com.ltkj.common.utils.DateUtils; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.mapper.DictUserInfoMapper; |
| | |
| | | import com.ltkj.system.service.ISysDictDataService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.config.pdfutils.PdfUtils; |
| | | import com.ltkj.web.controller.system.SysDeptController; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private TjOrderRemarkMapper tjOrderRemarkMapper; |
| | | @Autowired |
| | | private TjOrderDetailMapper tjOrderDetailMapper; |
| | | @Autowired |
| | | private SysDeptController sysDeptController; |
| | | @Autowired |
| | | private ITjProAdvicerulesService tjProAdvicerulesService; |
| | | @Autowired |
| | | private TjOrderYcxmService ycxmService; |
| | | |
| | | private Integer pdfPage = 0; |
| | | |
| | | private static final int DEFAULT_FONT_SIZE = 10; |
| | | private static final int DEFAULT_LITTLE_TITLE_FONT_SIZE = 11; |
| | | private static final int DEFAULT_TITLE_FONT_SIZE = 12; |
| | | private static final int DEFAULT_ZONGJIAN_FONT_SIZE = 15; |
| | | private static int DEFAULT_FONT_SIZE = 10; |
| | | private static int DEFAULT_LITTLE_TITLE_FONT_SIZE = 11; |
| | | private static int DEFAULT_TITLE_FONT_SIZE = 12; |
| | | private static int DEFAULT_ZONGJIAN_FONT_SIZE = 15; |
| | | private static String HOSP_NAME; |
| | | |
| | | private List<Map<String, Object>> makePDFInfo(HashMap<String, Object> map, AjaxResult ajaxResult, String key) { |
| | | List<Map<String, Object>> data = null; |
| | |
| | | // list.get(0).getHospName().equals("澄合矿务局中心医院") |
| | | List<SysDictData> sysUserSex = sysDictDataService.list(new LambdaQueryWrapper<SysDictData>().eq(SysDictData::getDictType, "sys_user_sex")); |
| | | HashMap<String, Object> map = makeHisJianYan(tjOrder, customer); |
| | | HashMap<String, Object> pdfChangGui = makePDFInfo(tjOrder, customer, tjReportTemplate,dictHosp,map); |
| | | HashMap<String, Object> pdfChangGui = makePDFInfo(tjOrder, customer, tjReportTemplate, dictHosp, map); |
| | | if (pdfChangGui == null) |
| | | return AjaxResult.error(); |
| | | Document document = (Document) pdfChangGui.get("document"); |
| | |
| | | int pageSize = 0; |
| | | try { |
| | | pdfWriter = PdfWriter.getInstance(document1, byteArrayOutputStream1); |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (true) { |
| | | String sex = ""; |
| | | if (customer.getCusSex() != null) { |
| | | for (SysDictData userSex : sysUserSex) { |
| | |
| | | } |
| | | } |
| | | if (StrUtil.isBlank(sex)) sex = "未知"; |
| | | pdfWriter.setPageEvent(new FooterHeaderPageEvent("澄合矿务局中心医院",customer.getCusName(),tjOrder.getTjNumber(),sex,String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); |
| | | // pdfWriter.setPageEvent(new FooterHeaderPageEvent("澄合矿务局中心医院",customer.getCusName(),tjOrder.getTjNumber(),sex,String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); |
| | | pdfWriter.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())), null)); |
| | | pageSize = pdfWriter.getPageNumber(); |
| | | } |
| | | } catch (DocumentException e) { |
| | |
| | | document1.setMargins(70, 70, 40, 40); |
| | | document1.open(); |
| | | |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (true) { |
| | | // 组装体检检查项目报告 |
| | | Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); |
| | | notHuaYanData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document1, printReport,dictHosp,color,false); |
| | | notHuaYanTable(document1, printReport, dictHosp, color, false); |
| | | } catch (DocumentException e) { |
| | | log.error("非化验项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | // 组装检验数据 |
| | | makeHisJianYanTable(document1, map,dictHosp,color); |
| | | makeHisJianYanTable(document1, map, dictHosp, color); |
| | | |
| | | // 组装pacs检查数据 |
| | | printReport = new HashMap<>(); |
| | | pacsJianChaData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document1, printReport,dictHosp,color,true); |
| | | notHuaYanTable(document1, printReport, dictHosp, color, true); |
| | | } catch (DocumentException e) { |
| | | log.error("pacs项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | }else { |
| | | } else { |
| | | // 非化验项目报告 |
| | | Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); |
| | | notHuaYanData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document1, printReport,dictHosp,color,true); |
| | | notHuaYanTable(document1, printReport, dictHosp, color, true); |
| | | } catch (DocumentException e) { |
| | | log.error("非化验项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | // 组装检验数据 |
| | | makeHisJianYanTable(document1, map,dictHosp,color); |
| | | makeHisJianYanTable(document1, map, dictHosp, color); |
| | | } |
| | | document1.close(); |
| | | |
| | |
| | | copy.addPage(page); |
| | | } |
| | | |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | List<ByteArrayOutputStream> jianchas = makeHisJianChaTable(tjOrder); |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (!true) { |
| | | List<ByteArrayOutputStream> jianchas = makeHisJianChaTable(tjOrder); |
| | | // List<ByteArrayOutputStream> jianchas = makeCcgcHisJianChaTable(tjOrder); |
| | | try { |
| | | for (ByteArrayOutputStream jiancha : jianchas) { |
| | |
| | | int pages = pdfReader.getNumberOfPages(); |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | PdfStamper pdfStamper = new PdfStamper(pdfReader, outputStream); |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (!true) { |
| | | PdfContentByte contentByte; |
| | | BaseFont baseFont = PdfUtils.createBaseFont(null); |
| | | for (int i = 2; i <= pages; i++) { |
| | |
| | | if (StrUtil.isBlank(sex)) sex = "未知"; |
| | | |
| | | |
| | | |
| | | // 生成 document2 并将其内容保存到 byteArrayOutputStream2 中 |
| | | ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream(); |
| | | Document document2 = new Document(PageSize.A4); |
| | | PdfWriter writer2 = PdfWriter.getInstance(document2, byteArrayOutputStream2); |
| | | |
| | | writer2.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),0)); |
| | | writer2.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())), 0)); |
| | | |
| | | document2.setMargins(50, 70, 40, 50); |
| | | document2.open(); |
| | |
| | | String[] titles = {"科室", "体检项目", "检查状态", "检查时间"}; |
| | | |
| | | for (String head : titles) { |
| | | table.addCell(PdfUtils.createCell(head, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(head, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | } |
| | | Map<String, List<CsProVo>> listMap = list.stream().collect(Collectors.groupingBy(CsProVo::getDeptName)); |
| | | for (Map.Entry<String, List<CsProVo>> entry : listMap.entrySet()) { |
| | |
| | | deptCell.setRowspan(proVos.size()); |
| | | table.addCell(deptCell); |
| | | proVos.forEach(proVo -> { |
| | | table.addCell(PdfUtils.createCell(proVo.getProName(), defaultFont,Rectangle.BOX,Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(proVo.getProName(), defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | String tjType = ""; |
| | | switch (proVo.getType()) { |
| | | case 0: |
| | |
| | | tjType = "延期"; |
| | | break; |
| | | } |
| | | table.addCell(PdfUtils.createCell(tjType, defaultFont,Rectangle.BOX,Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(tjType, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | String tjTime = ""; |
| | | if (proVo.getQdcreateTime() != null) { |
| | | tjTime = new SimpleDateFormat("yyyy-MM-dd").format(proVo.getQdcreateTime()); |
| | | } |
| | | table.addCell(PdfUtils.createCell(tjTime, defaultFont,Rectangle.BOX,Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(tjTime, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | }); |
| | | } |
| | | document2.add(table); |
| | |
| | | |
| | | |
| | | // List<TjOrderRemark> remarks = tjOrderRemarkMapper.getzongjianyishengchakanyichangxiangmu3( tjOrder.getTjNumber()); |
| | | List<TjOrderDetail> orderDetails = tjOrderDetailMapper.getzongjianyishengchakanyichangxiangmu4( tjOrder.getTjNumber()); |
| | | List<TjOrderDetail> orderDetails = tjOrderDetailMapper.getzongjianyishengchakanyichangxiangmu4(tjOrder.getTjNumber()); |
| | | // List<Map<String, Object>> jiancha = new ArrayList<>(); |
| | | |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "检查综述:"); |
| | |
| | | boolean isXmWrite = false; |
| | | for (TjOrderDetail detail : details) { |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh+". "+xmmc, defaultFont); |
| | | paragraph = new Paragraph(xmXh + ". " + xmmc, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | int index = 1; |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查",""); |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | String[] split = result.split("\n"); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | if (StrUtil.isBlank(s.replaceAll("\n","").trim())) continue; |
| | | if (StrUtil.isBlank(s.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index).append(")").append(s).append("\n"); |
| | | index++; |
| | | } |
| | |
| | | for (List<String> i : lists) { |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh+". "+xmmc,defaultFont); |
| | | 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); |
| | | 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++; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(10f); |
| | | paragraph.setSpacingAfter(10f); |
| | | document2.add(paragraph); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "医生建议:"); |
| | |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【"+xmXh+"."+xmmc+"】",defaultFont); |
| | | 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); |
| | | 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 |
| | |
| | | // |
| | | // } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(i.get(5),"",i.get(2),tjOrder.getTjNumber()); |
| | | if (!maps.isEmpty()){ |
| | | for (Map<String, Object> objectMap : maps) { |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(i.get(5), "", i.get(2), tjOrder.getTjNumber(), i.get(5), ""); |
| | | 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("nr").toString(),defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | String content1 = str + objectMap.get("bt").toString().trim() + objectMap.get("nr").toString().trim(); |
| | | if (StrUtil.isBlank(content1)) |
| | | content1 = " 本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"; |
| | | |
| | | paragraph = new Paragraph(str+objectMap.get("bt").toString().trim()+objectMap.get("nr").toString().trim(),defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(2f); |
| | | paragraph.setSpacingAfter(5f); |
| | | 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++; |
| | | } |
| | |
| | | for (TjOrderDetail detail : details) { |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【"+xmXh+"."+xmmc+"】", defaultFont); |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | |
| | | boolean contains = result.contains("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | if (StrUtil.isBlank(s.replaceAll("\n","").trim())) continue; |
| | | 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("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | else builder.substring(0,builder.length() - 1); |
| | | if (!contains) |
| | | builder.append(" (").append(index1).append(")").append("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | else builder.substring(0, builder.length() - 1); |
| | | result = builder.toString(); |
| | | } |
| | | // String content = " (" + index + ") " + detail.getProName() + ":" + result; |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(entry.getKey().toString(),"","",tjOrder.getTjNumber()); |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(entry.getKey().toString(), "", "", tjOrder.getTjNumber(), detail.getProName(), ""); |
| | | for (Map<String, Object> objectMap : maps) { |
| | | paragraph = new Paragraph(str+objectMap.get("bt").toString()+objectMap.get("nr").toString(),defaultFont); |
| | | String content1 = str + objectMap.get("bt").toString() + objectMap.get("nr").toString(); |
| | | if (StrUtil.isBlank(content1)) |
| | | content1 = " 本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"; |
| | | |
| | | paragraph = new Paragraph(content1, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | for (int i = 0; i < 1; i++) { |
| | |
| | | document2.add(paragraphNone); |
| | | |
| | | |
| | | PdfPTable tableQz = new PdfPTable(new float[]{100f,100f,50f}); |
| | | PdfPTable tableQz = new PdfPTable(new float[]{100f, 100f, 50f}); |
| | | tableQz.setTotalWidth(PageSize.A4.getWidth() - 100); |
| | | tableQz.setLockedWidth(true); |
| | | tableQz.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | |
| | | document2.close(); |
| | | |
| | | |
| | | |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | Document document = new Document(PageSize.A4); |
| | | PdfWriter pdfWriter = null; |
| | | // int pageSize = 0; |
| | | // try { |
| | | pdfWriter = PdfWriter.getInstance(document, byteArrayOutputStream); |
| | | pdfWriter.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); |
| | | pdfWriter = PdfWriter.getInstance(document, byteArrayOutputStream); |
| | | pdfWriter.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())), null)); |
| | | // pageSize = pdfWriter.getPageNumber(); |
| | | // } catch (DocumentException e) { |
| | | // log.error(String.valueOf(e)); |
| | |
| | | Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); |
| | | notHuaYanData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document, printReport, dictHosp, color,false); |
| | | notHuaYanTable(document, printReport, dictHosp, color, false); |
| | | } catch (DocumentException e) { |
| | | log.error("非化验项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | |
| | | printReport = new HashMap<>(); |
| | | pacsJianChaData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document, printReport, dictHosp, color,true); |
| | | notHuaYanTable(document, printReport, dictHosp, color, true); |
| | | } catch (DocumentException e) { |
| | | log.error("pacs项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | document.close(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 首页表单 |
| | |
| | | byte[] bytes = byteArrayOutputStream4.toByteArray(); |
| | | |
| | | |
| | | |
| | | ByteArrayOutputStream finalOutput = new ByteArrayOutputStream(); |
| | | Document mergedDocument = new Document(PageSize.A4); |
| | | PdfCopy copy = new PdfCopy(mergedDocument, finalOutput); |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | public AjaxResult hisPDFNew2(TjOrder tjOrder, TjCustomer customer, TjReportTemplate tjReportTemplate,TjReportTemplate zongJianYiShiQianMing) throws Exception { |
| | | public AjaxResult hisPDFNew2(TjOrder tjOrder, TjCustomer customer, TjReportTemplate tjReportTemplate, TjReportTemplate zongJianYiShiQianMing) throws Exception { |
| | | String s1 = sysConfigService.selectConfigByKey("tjreport_font_size_second_page_info"); |
| | | String s2 = sysConfigService.selectConfigByKey("tjreport_font_size_second_page_title"); |
| | | String s3 = sysConfigService.selectConfigByKey("tjreport_font_size_result_title"); |
| | | String s4 = sysConfigService.selectConfigByKey("tjreport_font_size_zongjian"); |
| | | // String hospName = sysDeptController.getdangqiandengluyuanqu().get("msg").toString(); |
| | | if (StrUtil.isNotBlank(s1) && Integer.parseInt(s1) > 10) DEFAULT_FONT_SIZE = Integer.parseInt(s1); |
| | | else DEFAULT_FONT_SIZE = 10; |
| | | if (StrUtil.isNotBlank(s2) && Integer.parseInt(s2) > 10) DEFAULT_LITTLE_TITLE_FONT_SIZE = Integer.parseInt(s2); |
| | | else DEFAULT_LITTLE_TITLE_FONT_SIZE = 10; |
| | | if (StrUtil.isNotBlank(s3) && Integer.parseInt(s3) > 10) DEFAULT_TITLE_FONT_SIZE = Integer.parseInt(s3); |
| | | else DEFAULT_TITLE_FONT_SIZE = 10; |
| | | if (StrUtil.isNotBlank(s4) && Integer.parseInt(s4) > 10) DEFAULT_ZONGJIAN_FONT_SIZE = Integer.parseInt(s4); |
| | | else DEFAULT_ZONGJIAN_FONT_SIZE = 10; |
| | | pdfPage = 0; |
| | | DictHosp dictHosp = dictHospService.list().get(0); |
| | | HOSP_NAME = dictHosp.getHospName(); |
| | | String color = sysConfigService.selectConfigByKey("report_title_color"); |
| | | List<SysDictData> sysUserSex = sysDictDataService.list(new LambdaQueryWrapper<SysDictData>().eq(SysDictData::getDictType, "sys_user_sex")); |
| | | // 检验数据 |
| | |
| | | if (StrUtil.isBlank(sex)) sex = "未知"; |
| | | |
| | | |
| | | |
| | | // 生成 document2 并将其内容保存到 byteArrayOutputStream2 中 |
| | | ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream(); |
| | | Document document2 = new Document(PageSize.A4); |
| | | PdfWriter writer2 = PdfWriter.getInstance(document2, byteArrayOutputStream2); |
| | | |
| | | writer2.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),0)); |
| | | writer2.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())), 0)); |
| | | |
| | | document2.setMargins(50, 70, 40, 50); |
| | | document2.open(); |
| | |
| | | String[] titles = {"科室", "体检项目", "检查状态", "检查时间"}; |
| | | |
| | | for (String head : titles) { |
| | | table.addCell(PdfUtils.createCell(head, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(head, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | } |
| | | Map<String, List<CsProVo>> listMap = list.stream().collect(Collectors.groupingBy(i -> i.getDeptId()+"_"+i.getDeptName())); |
| | | Map<String, List<CsProVo>> listMap = list.stream().collect(Collectors.groupingBy(i -> i.getDeptId() + "_" + i.getDeptName())); |
| | | // List<CsProVo> sortedList = list.stream() |
| | | // .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | // .collect(Collectors.toList()); |
| | |
| | | deptCell.setPhrase(new Phrase(dept, defaultFont)); |
| | | deptCell.setPaddingTop(5f); |
| | | deptCell.setPaddingBottom(5f); |
| | | if (proVos.size()>1) |
| | | if (proVos.size() > 1) |
| | | deptCell.setRowspan(proVos.size()); |
| | | table.addCell(deptCell); |
| | | proVos.forEach(proVo -> { |
| | | table.addCell(PdfUtils.createCell(proVo.getProName(), defaultFont,Rectangle.BOX,Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(proVo.getProName(), defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | String tjType = ""; |
| | | switch (proVo.getType()) { |
| | | case 0: |
| | |
| | | tjType = "延期"; |
| | | break; |
| | | } |
| | | table.addCell(PdfUtils.createCell(tjType, defaultFont,Rectangle.BOX,Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(tjType, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | String tjTime = ""; |
| | | if (proVo.getQdcreateTime() != null) { |
| | | tjTime = new SimpleDateFormat("yyyy-MM-dd").format(proVo.getQdcreateTime()); |
| | | } |
| | | table.addCell(PdfUtils.createCell(tjTime, defaultFont,Rectangle.BOX,Element.ALIGN_CENTER,5f,5f)); |
| | | table.addCell(PdfUtils.createCell(tjTime, defaultFont, Rectangle.BOX, Element.ALIGN_CENTER, 5f, 5f)); |
| | | }); |
| | | } |
| | | document2.add(table); |
| | |
| | | |
| | | |
| | | // List<TjOrderRemark> remarks = tjOrderRemarkMapper.getzongjianyishengchakanyichangxiangmu3( tjOrder.getTjNumber()); |
| | | List<TjOrderDetail> orderDetails = tjOrderDetailMapper.getzongjianyishengchakanyichangxiangmu4( tjOrder.getTjNumber()); |
| | | List<TjOrderDetail> orderDetails = tjOrderDetailMapper.getzongjianyishengchakanyichangxiangmu4(tjOrder.getTjNumber()); |
| | | // List<Map<String, Object>> jiancha = new ArrayList<>(); |
| | | |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "检查综述:"); |
| | |
| | | Map<Long, List<TjOrderDetail>> collect = orderDetails.stream().collect(Collectors.groupingBy(TjOrderDetail::getProId)); |
| | | for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size()>1){ |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | .collect(Collectors.toList()); |
| | |
| | | if (StrUtil.isNotBlank(result)) { |
| | | int index = 1; |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | // result = result.replaceAll("", ""); |
| | | String[] split = result.split("\n"); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | |
| | | index++; |
| | | } |
| | | } |
| | | if(isXmWrite) { |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(10f); |
| | | paragraph.setSpacingAfter(10f); |
| | | document2.add(paragraph); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "医生建议:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | xmXh = 0; |
| | | |
| | | 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 "); |
| | | LambdaQueryWrapper<TjOrderYcxm> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderYcxm::getTjh, tjOrder.getTjNumber()); |
| | | List<TjOrderYcxm> ycxms = ycxmService.list(wq); |
| | | if (null != ycxms && !ycxms.isEmpty()) { |
| | | 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()){ |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | int index1 = 1; |
| | | String[] split = result.split("\n"); |
| | | 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++; |
| | | for (TjOrderDetail detail : details) { |
| | | 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)) { |
| | | String[] split = result.split("\n"); |
| | | 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++; |
| | | } |
| | | 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,xmmc); |
| | | 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); |
| | | } |
| | | 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); |
| | | } |
| | | // 检验 |
| | | 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); |
| | | } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(entry.getKey().toString(),"","",tjOrder.getTjNumber()); |
| | | for (Map<String, Object> objectMap : maps) { |
| | | paragraph = new Paragraph(str+objectMap.get("bt").toString()+objectMap.get("nr").toString(),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)); |
| | | } |
| | | } else { |
| | | 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 = 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); |
| | | 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); |
| | | // 第六位是lis项目id |
| | | } |
| | | } |
| | | // 检验 |
| | | 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 (!rules.isEmpty()){ |
| | | // |
| | | // } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(i.get(5),"",i.get(2),tjOrder.getTjNumber()); |
| | | if (!maps.isEmpty()){ |
| | | for (Map<String, Object> objectMap : maps) { |
| | | 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("nr").toString(),defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | |
| | | paragraph = new Paragraph(str+objectMap.get("bt").toString().trim()+objectMap.get("nr").toString().trim(),defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | 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); |
| | | } |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(2f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | // } |
| | | index++; |
| | | index++; |
| | | } |
| | | } |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | 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, ""); |
| | | document2.add(paragraph); |
| | | } |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "总检医生建议:"); |
| | | document2.add(paragraph); |
| | | if (tjOrder.getCheckAdvice() == null) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, "无"); |
| | | document2.add(paragraph); |
| | | } else { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, tjOrder.getCheckAdvice()); |
| | | document2.add(paragraph); |
| | | Paragraph paragraphs = new Paragraph(tjOrder.getCheckAdvice(), defaultFont); |
| | | //设置文字居中 |
| | | paragraphs.setAlignment(Element.ALIGN_LEFT); |
| | | //行间距 |
| | | // paragraphs.setLeading(5f); |
| | | //设置段落上空白 |
| | | paragraphs.setSpacingBefore(10f); |
| | | //设置段落下空白 |
| | | paragraphs.setSpacingAfter(10f); |
| | | // paragraph = PdfUtils.setParagraph(defaultFont, tjOrder.getCheckAdvice()); |
| | | document2.add(paragraphs); |
| | | } |
| | | |
| | | |
| | |
| | | document2.add(paragraphNone); |
| | | |
| | | |
| | | PdfPTable tableQz = new PdfPTable(new float[]{100f,100f,50f}); |
| | | PdfPTable tableQz = new PdfPTable(new float[]{100f, 100f, 50f}); |
| | | tableQz.setTotalWidth(PageSize.A4.getWidth() - 100); |
| | | tableQz.setLockedWidth(true); |
| | | tableQz.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | |
| | | |
| | | tableQz.addCell(cell); |
| | | |
| | | File file = new File(value + File.separator + "yinzhang.png"); |
| | | cell = new PdfPCell(); |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_RIGHT); |
| | | cell.setPaddingTop(10); |
| | | cell.setPaddingBottom(10); |
| | | cell.setPhrase(new Phrase("", zongJianFont)); |
| | | if (!file.exists()) { |
| | | cell.setPhrase(new Phrase("", zongJianFont)); |
| | | }else { |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | | byte[] fileBytes = new byte[(int) file.length()]; |
| | | fileInputStream.read(fileBytes); |
| | | fileInputStream.close(); |
| | | Image image = Image.getInstance(Base64.getDecoder().decode(Base64.getEncoder().encodeToString(fileBytes))); |
| | | image.scaleToFit(90, 90); |
| | | cell.addElement(image); |
| | | } |
| | | tableQz.addCell(cell); |
| | | |
| | | |
| | | cell = new PdfPCell(); |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | |
| | | cell.setHorizontalAlignment(Element.ALIGN_CENTER); |
| | | cell.setPaddingTop(10); |
| | | cell.setPaddingBottom(10); |
| | | if (zongJianYiShiQianMing == null) { |
| | | cell.setPhrase(new Phrase(sysConfigService.selectConfigByKey("pdf_report_zongjianysname"), zongJianFont)); |
| | | String zongjianysname = sysConfigService.selectConfigByKey("pdf_report_zongjianysname"); |
| | | if (zongJianYiShiQianMing == null && StrUtil.isNotBlank(zongjianysname) && !zongjianysname.equals("无")) { |
| | | cell.setPhrase(new Phrase(zongjianysname, zongJianFont)); |
| | | tableQz.addCell(cell); |
| | | }else { |
| | | } else if (zongJianYiShiQianMing == null && zongjianysname.equals("无")) { |
| | | String nickName = SecurityUtils.getLoginUser().getUser().getNickName(); |
| | | cell.setPhrase(new Phrase(nickName, zongJianFont)); |
| | | tableQz.addCell(cell); |
| | | } else { |
| | | byte[] bytes = Base64.getDecoder().decode(zongJianYiShiQianMing.getTemplate()); |
| | | Image image = Image.getInstance(bytes); |
| | | image.scaleToFit(100, 100); |
| | |
| | | document2.close(); |
| | | |
| | | |
| | | |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | Document document = new Document(PageSize.A4); |
| | | PdfWriter pdfWriter = null; |
| | | // int pageSize = 0; |
| | | // try { |
| | | pdfWriter = PdfWriter.getInstance(document, byteArrayOutputStream); |
| | | pdfWriter.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); |
| | | pdfWriter.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(), customer.getCusName(), tjOrder.getTjNumber(), sex, String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())), null)); |
| | | // pageSize = pdfWriter.getPageNumber(); |
| | | // } catch (DocumentException e) { |
| | | // log.error(String.valueOf(e)); |
| | |
| | | Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); |
| | | notHuaYanData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document, printReport, dictHosp, color,false); |
| | | notHuaYanTable(document, printReport, dictHosp, color, false); |
| | | } catch (DocumentException e) { |
| | | log.error("非化验项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | |
| | | printReport = new HashMap<>(); |
| | | pacsJianChaData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document, printReport, dictHosp, color,true); |
| | | notHuaYanTable(document, printReport, dictHosp, color, true); |
| | | } catch (DocumentException e) { |
| | | log.error("pacs项目填充表格异常"); |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | document.close(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 首页表单 |
| | |
| | | tjtype = "个人"; |
| | | hashMap.put("tjtype", tjtype); |
| | | } |
| | | if (StrUtil.isNotBlank(customer.getCompName())){ |
| | | hashMap.put("work", customer.getCompName()); |
| | | }else { |
| | | LambdaQueryWrapper<DictComp> wq111 = new LambdaQueryWrapper<>(); |
| | | wq111.eq(DictComp::getDrugManufacturerId, tjOrder.getFirmId()); |
| | | DictComp dictComp = dictCompService.getOne(wq111); |
| | | if (StrUtil.isNotBlank(tjOrder.getFirmName())) { |
| | | hashMap.put("work", tjOrder.getFirmName()); |
| | | } else { |
| | | // LambdaQueryWrapper<DictComp> wq111 = new LambdaQueryWrapper<>(); |
| | | // wq111.eq(DictComp::getDrugManufacturerId, tjOrder.getFirmId()); |
| | | // DictComp dictComp = dictCompService.getOne(wq111); |
| | | |
| | | if (dictComp == null) { |
| | | if (StrUtil.isBlank(tjOrder.getFirmName())) { |
| | | hashMap.put("work", "无"); |
| | | } else { |
| | | hashMap.put("work", dictComp.getCnName()); |
| | | hashMap.put("work", tjOrder.getFirmName()); |
| | | } |
| | | } |
| | | if (StrUtil.isBlank(tjOrder.getFirmDeptName())) { |
| | | hashMap.put("bumen", "无"); |
| | | } else { |
| | | hashMap.put("bumen", tjOrder.getFirmDeptName()); |
| | | } |
| | | hashMap.put("sex", sex); |
| | | hashMap.put("tjnumber", tjNumber); |
| | |
| | | reader4.close(); |
| | | // 将修改后的PDF内容写入 |
| | | byte[] bytes = byteArrayOutputStream4.toByteArray(); |
| | | |
| | | |
| | | |
| | | ByteArrayOutputStream finalOutput = new ByteArrayOutputStream(); |
| | |
| | | // makeYiShiInfoLine(phrase, doctorFonts, bgysqm, bgysbh," 报告医师:"); |
| | | // } |
| | | // }else { |
| | | builder = new StringBuilder(); |
| | | if (null != sqrxm && StrUtil.isNotBlank(sqrxm)){ |
| | | builder.append("申请人:").append(sqrxm); |
| | | } |
| | | if (null != jcysqm && StrUtil.isNotBlank(jcysqm)){ |
| | | builder.append(" 检查医师:").append(jcysqm); |
| | | } |
| | | if (null != shysqm && StrUtil.isNotBlank(shysqm)){ |
| | | builder.append(" 审核医师:").append(shysqm); |
| | | } |
| | | if (null != bgysqm && StrUtil.isNotBlank(bgysqm)){ |
| | | builder.append(" 报告医师:").append(bgysqm); |
| | | } |
| | | footer = builder.toString().trim(); |
| | | builder = new StringBuilder(); |
| | | if (null != sqrxm && StrUtil.isNotBlank(sqrxm)) { |
| | | builder.append("申请人:").append(sqrxm); |
| | | } |
| | | if (null != jcysqm && StrUtil.isNotBlank(jcysqm)) { |
| | | builder.append(" 检查医师:").append(jcysqm); |
| | | } |
| | | if (null != shysqm && StrUtil.isNotBlank(shysqm)) { |
| | | builder.append(" 审核医师:").append(shysqm); |
| | | } |
| | | if (null != bgysqm && StrUtil.isNotBlank(bgysqm)) { |
| | | builder.append(" 报告医师:").append(bgysqm); |
| | | } |
| | | footer = builder.toString().trim(); |
| | | // } |
| | | // elements.add(phrase); |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null, footer,elements); |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null, footer, elements); |
| | | if (outputStream == null) |
| | | throw new Exception(); |
| | | jianchas.add(outputStream); |
| | |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(tjOrder.getUserId()); |
| | | |
| | | List<LtkjExamJcbgd> list=jcbgdService.getJianJcBaoGaoDanByTjh(tjOrder.getCardId()); |
| | | List<LtkjExamJcbgd> list = jcbgdService.getJianJcBaoGaoDanByTjh(tjOrder.getCardId()); |
| | | |
| | | List<ByteArrayOutputStream> jianchas = new ArrayList<>(); |
| | | Paragraph elements = new Paragraph(); |
| | |
| | | |
| | | for (LtkjExamJcbgd getexamreportinfo : list) { |
| | | String xm = customer.getCusName(); |
| | | String xb = customer.getCusSex()==2 ? "女" : "男"; |
| | | String xb = customer.getCusSex() == 2 ? "女" : "男"; |
| | | String nl = customer.getAge(); |
| | | String jcks = "体检中心"; |
| | | String sjks = ""; |
| | |
| | | StringBuilder builder; |
| | | String footer; |
| | | builder = new StringBuilder(); |
| | | if (null != sqrxm && StrUtil.isNotBlank(sqrxm)){ |
| | | if (null != sqrxm && StrUtil.isNotBlank(sqrxm)) { |
| | | builder.append("申请人:").append(sqrxm); |
| | | } |
| | | if (null != jcysqm && StrUtil.isNotBlank(jcysqm)){ |
| | | if (null != jcysqm && StrUtil.isNotBlank(jcysqm)) { |
| | | builder.append(" 检查医师:").append(jcysqm); |
| | | } |
| | | if (null != shysqm && StrUtil.isNotBlank(shysqm)){ |
| | | if (null != shysqm && StrUtil.isNotBlank(shysqm)) { |
| | | builder.append(" 审核医师:").append(shysqm); |
| | | } |
| | | if (null != bgysqm && StrUtil.isNotBlank(bgysqm)){ |
| | | if (null != bgysqm && StrUtil.isNotBlank(bgysqm)) { |
| | | builder.append(" 报告医师:").append(bgysqm); |
| | | } |
| | | footer = builder.toString().trim(); |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null, footer,elements); |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null, footer, elements); |
| | | if (outputStream == null) |
| | | throw new Exception(); |
| | | jianchas.add(outputStream); |
| | |
| | | |
| | | /** |
| | | * 医师信息行 |
| | | * |
| | | * @param phrase |
| | | * @param doctorFonts |
| | | * @param sqrxm |
| | | * @param sqrbh |
| | | * @throws BadElementException |
| | | */ |
| | | private void makeYiShiInfoLine(Phrase phrase, Font doctorFonts, String sqrxm, String sqrbh,String title) throws BadElementException { |
| | | private void makeYiShiInfoLine(Phrase phrase, Font doctorFonts, String sqrxm, String sqrbh, String title) throws BadElementException { |
| | | String qmImg = dictUserInfoMapper.selectQmImgInnerJoinUserByHisDictCode(sqrbh); |
| | | // String qmImg = dictUserInfoMapper.selectQmImgInnerJoinUserByUserId(sqrbh); |
| | | if (null != qmImg && StrUtil.isNotBlank(qmImg)) { |
| | |
| | | try { |
| | | image = Image.getInstance(decode); |
| | | image.scaleToFit(60, 25); |
| | | phrase.add(new Chunk(title,doctorFonts)); |
| | | phrase.add(new Chunk(image,0,-10,true)); |
| | | phrase.add(new Chunk(title, doctorFonts)); |
| | | phrase.add(new Chunk(image, 0, -10, true)); |
| | | } catch (IOException e) { |
| | | phrase.add(new Chunk(title+sqrxm, doctorFonts)); |
| | | phrase.add(new Chunk(title + sqrxm, doctorFonts)); |
| | | } |
| | | }else { |
| | | phrase.add(new Chunk(title+sqrxm, doctorFonts)); |
| | | } else { |
| | | phrase.add(new Chunk(title + sqrxm, doctorFonts)); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 填充检验表格数据 |
| | | * |
| | |
| | | * @param map |
| | | * @throws DocumentException |
| | | */ |
| | | private void makeHisJianYanTable(Document document1, HashMap<String, Object> map,DictHosp dictHosp,String colorStr) throws DocumentException { |
| | | private void makeHisJianYanTable(Document document1, HashMap<String, Object> map, DictHosp dictHosp, String colorStr) throws DocumentException { |
| | | if (!map.isEmpty()) { |
| | | String[] titles = new String[]{"体检项目", "体检结果","提示", "单位", "参考范围"}; |
| | | String[] titles = new String[]{"体检项目", "体检结果", "提示", "单位", "参考范围"}; |
| | | float[] titlesWidth = new float[]{280, 100, 40, 100, 120}; |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String titleName = entry.getKey().trim(); |
| | |
| | | HashSet<String> jyys = (HashSet<String>) entryValue.get("jyys"); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | String shsj = entryValue.get("shsj").toString(); |
| | | addJianYanTable(document1, titleName, titles, titlesWidth, lists,dictHosp,colorStr); |
| | | addJianYanTable(document1, titleName, titles, titlesWidth, lists, dictHosp, colorStr); |
| | | if (!jyys.isEmpty()) { |
| | | Font doctorFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | String doctors = ""; |
| | |
| | | elements.setSpacingAfter(10f); |
| | | elements.setAlignment(Element.ALIGN_RIGHT); |
| | | Phrase phrase = new Phrase(); |
| | | phrase.add(new Chunk("检查日期:"+shsj+" 审核医师:",doctorFonts)); |
| | | phrase.add(new Chunk("检查日期:" + shsj + " 审核医师:", doctorFonts)); |
| | | boolean flag = false; |
| | | for (String s : jyys) { |
| | | if (s.contains("|")) { |
| | |
| | | try { |
| | | image = Image.getInstance(decode); |
| | | image.scaleToFit(60, 25); |
| | | phrase.add(new Chunk(image,0,-10,true)); |
| | | phrase.add(new Chunk(image, 0, -10, true)); |
| | | } catch (IOException e) { |
| | | phrase.add(new Chunk(split[0].trim(),doctorFonts)); |
| | | phrase.add(new Chunk(split[0].trim(), doctorFonts)); |
| | | } |
| | | } else { |
| | | phrase.add(new Chunk(split[0].trim(),doctorFonts)); |
| | | phrase.add(new Chunk(split[0].trim(), doctorFonts)); |
| | | } |
| | | } else { |
| | | doctors += s.trim() + "、"; |
| | |
| | | } |
| | | if (!flag) { |
| | | String substring = doctors.substring(0, doctors.length() - 1).trim(); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, "检查日期:"+shsj+" 审核医师:" + substring); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, "检查日期:" + shsj + " 审核医师:" + substring); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | //分割线 |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (!true) { |
| | | LineSeparator objectName = new LineSeparator(); |
| | | objectName.setOffset(-5); |
| | | document1.add(objectName); |
| | |
| | | * @param printReport |
| | | * @throws DocumentException |
| | | */ |
| | | private void notHuaYanTable(Document document1, Map<TjOrderRemark, List<TjPdfVO>> printReport,DictHosp dictHosp,String colorStr,boolean isPacs) throws DocumentException { |
| | | private void notHuaYanTable(Document document1, Map<TjOrderRemark, List<TjPdfVO>> printReport, DictHosp dictHosp, String colorStr, boolean isPacs) throws DocumentException { |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | LambdaQueryWrapper<TjProject> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjProject::getProId, entry.getKey().getProId()); |
| | |
| | | if (null != one11 && "Y".equals(one11.getNeedReport())) { |
| | | TjOrderRemark orderRemark = entry.getKey(); |
| | | List<TjPdfVO> value = entry.getValue(); |
| | | if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs()) && StrUtil.isBlank(value.get(0).getSj()))){ |
| | | if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs()) && StrUtil.isBlank(value.get(0).getSj()))) { |
| | | continue; |
| | | } |
| | | String titleName = null; |
| | |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (true) { |
| | | Font titleFont = PdfUtils.setFont(DEFAULT_TITLE_FONT_SIZE); |
| | | titleFont.setStyle(Font.BOLD); |
| | | PdfPCell cellTitle = new PdfPCell(PdfUtils.setParagraph(titleFont, titleName)); |
| | |
| | | tableTitle.addCell(cellTitle); |
| | | // 将表格添加到文档中 |
| | | document1.add(tableTitle); |
| | | }else { |
| | | } else { |
| | | document1.add(paragraph); |
| | | } |
| | | |
| | |
| | | // PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,dictHosp.getHospName().equals("澄合矿务局中心医院")); |
| | | // document1.add(table); |
| | | |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院") && !value.isEmpty()){ |
| | | if (value.size()>1){ |
| | | if (value.get(0).getPid().equals("1862852701533012001")){ |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院") && !value.isEmpty()){ |
| | | if (true && !value.isEmpty()) { |
| | | if (value.size() > 1) { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB="+value.get(0).getProResult(), remarkFonts); |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("结论:"+entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | }else { |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,isPacs,new float[]{240, 240,240}); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, isPacs, new float[]{240, 240, 240}); |
| | | document1.add(table); |
| | | } |
| | | }else { |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | |
| | | if (isPacs){ |
| | | if (isPacs) { |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | document1.add(pp); |
| | | Paragraph ppp = new Paragraph(value.get(0).getSj(), remarkFonts); |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | }else { |
| | | if (value.get(0).getPid().equals("1862852701533012001")){ |
| | | } else { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB="+value.get(0).getProResult(), remarkFonts); |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("结论:"+entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | }else { |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,false,new float[]{240, 300}); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, false, new float[]{240, 300}); |
| | | document1.add(table); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,isPacs,new float[]{240, 240,240}); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, isPacs, new float[]{240, 240, 240}); |
| | | document1.add(table); |
| | | } |
| | | //判断备注是否为空 空不能显示null |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (!true) { |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | |
| | | } |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | zhuJianYiShi(document1, entry,orderRemark.getCreateTime(),dictHosp); |
| | | zhuJianYiShi(document1, entry, orderRemark.getCreateTime(), dictHosp); |
| | | //分割线 |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (!true) { |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | | } |
| | | } else { |
| | | if (null != one11) { |
| | | titleName = one11.getProName(); |
| | | if (entry.getValue().get(0).getProName().contains(";")) |
| | | titleName = entry.getValue().get(0).getProName(); |
| | | else titleName = one11.getProName(); |
| | | } else { |
| | | titleName = entry.getKey().getProName(); |
| | | } |
| | |
| | | Font titleFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs()) && StrUtil.isBlank(value.get(0).getSj()))){ |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (true) { |
| | | if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs()) && StrUtil.isBlank(value.get(0).getSj()))) { |
| | | continue; |
| | | } |
| | | Font titleFont = PdfUtils.setFont(DEFAULT_TITLE_FONT_SIZE); |
| | |
| | | tableTitle.addCell(cellTitle); |
| | | // 将表格添加到文档中 |
| | | document1.add(tableTitle); |
| | | }else { |
| | | } else { |
| | | document1.add(paragraph); |
| | | } |
| | | |
| | |
| | | // PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value,dictHosp.getHospName().equals("澄合矿务局中心医院")); |
| | | // document1.add(table); |
| | | |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院") && !value.isEmpty()){ |
| | | if (value.size()>1){ |
| | | if (value.get(0).getPid().equals("1862852701533012001")){ |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院") && !value.isEmpty()){ |
| | | if (true && !value.isEmpty()) { |
| | | if (value.size() > 1) { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB="+value.get(0).getProResult(), remarkFonts); |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("结论:"+entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | }else { |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,isPacs,new float[]{240, 240,240}); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, isPacs, new float[]{240, 240, 240}); |
| | | document1.add(table); |
| | | } |
| | | |
| | | }else { |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | |
| | | if (isPacs){ |
| | | if (isPacs) { |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | document1.add(pp); |
| | | Paragraph ppp = new Paragraph(value.get(0).getSj() != null ? value.get(0).getSj() : value.get(0).getProResult(), remarkFonts); |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | }else { |
| | | if (value.get(0).getPid().equals("1862852701533012001")){ |
| | | } else { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB="+value.get(0).getProResult(), remarkFonts); |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("结论:"+entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | }else { |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,false,new float[]{240, 300}); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, false, new float[]{240, 300}); |
| | | document1.add(table); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }else { |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value,isPacs); |
| | | PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value, isPacs); |
| | | document1.add(table); |
| | | } |
| | | |
| | |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (!true) { |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | |
| | | } |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | zhuJianYiShi(document1, entry,orderRemark.getCreateTime(),dictHosp); |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | zhuJianYiShi(document1, entry, orderRemark.getCreateTime(), dictHosp); |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (!true) { |
| | | //分割线 |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | |
| | | |
| | | /** |
| | | * 主见医师行显示设置 |
| | | * |
| | | * @param document1 |
| | | * @param entry |
| | | * @throws DocumentException |
| | | */ |
| | | private void zhuJianYiShi(Document document1, Map.Entry<TjOrderRemark, List<TjPdfVO>> entry,Date createTime,DictHosp dictHosp) throws DocumentException { |
| | | if ((null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) || dictHosp.getHospName().equals("澄合矿务局中心医院") ) { |
| | | private void zhuJianYiShi(Document document1, Map.Entry<TjOrderRemark, List<TjPdfVO>> entry, Date createTime, DictHosp dictHosp) throws DocumentException { |
| | | // if ((null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) || dictHosp.getHospName().equals("澄合矿务局中心医院") ) { |
| | | if ((null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) || true) { |
| | | //主检医师 |
| | | String key = sysConfigService.selectConfigByKey("is_report_pdf_use_ysqm"); |
| | | SysUser sysUser = userService.getById(entry.getKey().getDoctorName()); |
| | | String doctorNameDefault = "无"; |
| | | if (sysUser != null)doctorNameDefault = sysUser.getNickName(); |
| | | if (!entry.getValue().isEmpty() && StrUtil.isNotBlank(entry.getValue().get(0).getShys()) && dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (sysUser != null) doctorNameDefault = sysUser.getNickName(); |
| | | // if (!entry.getValue().isEmpty() && StrUtil.isNotBlank(entry.getValue().get(0).getShys()) && dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (!entry.getValue().isEmpty() && StrUtil.isNotBlank(entry.getValue().get(0).getShys()) && true) { |
| | | doctorNameDefault = entry.getValue().get(0).getShys(); |
| | | } |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | if (key.equals("Y")){ |
| | | if (key.equals("Y")) { |
| | | String qmImg = dictUserInfoMapper.selectQmImgInnerJoinUserByUserId(String.valueOf(sysUser.getUserId())); |
| | | if (null != qmImg && StrUtil.isNotBlank(qmImg)) { |
| | | Paragraph elements = new Paragraph(); |
| | |
| | | elements.setAlignment(Element.ALIGN_RIGHT); |
| | | Phrase phrase = new Phrase(); |
| | | if (createTime != null) { |
| | | phrase.add(new Chunk("检查时间:"+new SimpleDateFormat("yyyy-MM-dd").format(createTime)+" 主检医师:", doctorFonts)); |
| | | }else { |
| | | phrase.add(new Chunk("检查时间:" + new SimpleDateFormat("yyyy-MM-dd").format(createTime) + " 主检医师:", doctorFonts)); |
| | | } else { |
| | | phrase.add(new Chunk("主检医师:", doctorFonts)); |
| | | } |
| | | byte[] decode = Base64.getDecoder().decode(qmImg); |
| | |
| | | try { |
| | | image = Image.getInstance(decode); |
| | | image.scaleToFit(60, 25); |
| | | phrase.add(new Chunk(image,0,-10,true)); |
| | | phrase.add(new Chunk(image, 0, -10, true)); |
| | | elements.add(phrase); |
| | | document1.add(elements); |
| | | } catch (IOException e) { |
| | | String doctorName = "主检医师:" + doctorNameDefault; |
| | | if (createTime != null) doctorName = "检查时间:"+new SimpleDateFormat("yyyy-MM-dd").format(createTime)+" 主检医师:" + doctorNameDefault; |
| | | if (createTime != null) |
| | | doctorName = "检查时间:" + new SimpleDateFormat("yyyy-MM-dd").format(createTime) + " 主检医师:" + doctorNameDefault; |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | }else { |
| | | } else { |
| | | String doctorName = "主检医师:" + doctorNameDefault; |
| | | if (createTime != null) doctorName = "检查时间:"+new SimpleDateFormat("yyyy-MM-dd").format(createTime)+" 主检医师:" + doctorNameDefault; |
| | | if (createTime != null) |
| | | doctorName = "检查时间:" + new SimpleDateFormat("yyyy-MM-dd").format(createTime) + " 主检医师:" + doctorNameDefault; |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | }else { |
| | | } else { |
| | | String doctorName = "主检医师:" + doctorNameDefault; |
| | | if (createTime != null) doctorName = "检查时间:"+new SimpleDateFormat("yyyy-MM-dd").format(createTime)+" 主检医师:" + doctorNameDefault; |
| | | if (createTime != null) |
| | | doctorName = "检查时间:" + new SimpleDateFormat("yyyy-MM-dd").format(createTime) + " 主检医师:" + doctorNameDefault; |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | } else { |
| | | String doctorName = "主检医师:" + "无"; |
| | | if (createTime != null) doctorName = "检查时间:"+new SimpleDateFormat("yyyy-MM-dd").format(createTime)+" 主检医师:" + "无"; |
| | | if (createTime != null) |
| | | doctorName = "检查时间:" + new SimpleDateFormat("yyyy-MM-dd").format(createTime) + " 主检医师:" + "无"; |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("data", lists); |
| | | map.put("jyys", hashSet); |
| | | if (StrUtil.isNotBlank(shsj)){ |
| | | if (StrUtil.isNotBlank(shsj)) { |
| | | shsj = shsj.split(" ")[0]; |
| | | } |
| | | map.put("shsj",shsj); |
| | | map.put("shsj", shsj); |
| | | data.put(xmmc, map); |
| | | } |
| | | } |
| | |
| | | * @param tjOrder |
| | | * @param reportTemplate |
| | | */ |
| | | public HashMap<String, Object> makePDFInfo(TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate,DictHosp dictHosp,HashMap<String, Object> jianYanMap) { |
| | | public HashMap<String, Object> makePDFInfo(TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate, DictHosp dictHosp, HashMap<String, Object> jianYanMap) { |
| | | String tjNumber = tjOrder.getTjNumber(); |
| | | String template = reportTemplate.getTemplate(); |
| | | LambdaQueryWrapper<DictComp> wq111 = new LambdaQueryWrapper<>(); |
| | |
| | | } |
| | | //拼接重大阳性结果 |
| | | StringBuffer str = new StringBuffer(); |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (!true) { |
| | | str.append("【重大阳性项目】\n"); |
| | | LambdaQueryWrapper<TjBigPositive> bigPositiveLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | bigPositiveLambdaQueryWrapper.eq(TjBigPositive::getTjNumber, tjNumber); |
| | |
| | | } |
| | | //拼接异常项目 |
| | | str.append("【异常情况项目】\n"); |
| | | if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (!true) { |
| | | if (list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).getExceptionDesc() == 1) { |
| | |
| | | } else { |
| | | str.append(" 无;\n"); |
| | | } |
| | | }else { |
| | | } else { |
| | | int maxProjectLength = 0; |
| | | for (Map.Entry<String, Object> item : jianYanMap.entrySet()) { |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | |
| | | } |
| | | //异常项目 |
| | | data.put("yichang", str.toString()); |
| | | data.put("zjrq",new SimpleDateFormat("yyyy-MM-dd").format(tjOrder.getCheckTime())); |
| | | data.put("zjrq", new SimpleDateFormat("yyyy-MM-dd").format(tjOrder.getCheckTime())); |
| | | // 遍历data 给pdf表单表格赋值 |
| | | for (String key : data.keySet()) { |
| | | acroFields.setField(key, data.get(key).toString()); |
| | |
| | | map.put("document", document); |
| | | map.put("copy", copy); |
| | | map.put("stream", finalOutPut); |
| | | map.put("form",pdfStamper); |
| | | map.put("form", pdfStamper); |
| | | return map; |
| | | } catch (IOException | DocumentException e) { |
| | | e.printStackTrace(); |
| | |
| | | if (null != tjProject && tjProject.getNeedReport().equals("Y")) { |
| | | tjOrderDetail.setProject(tjProject); |
| | | |
| | | if (tjOrderDetail.getProject().getProParentId().equals(entry.getKey().getProId())) { |
| | | if (tjOrderDetail.getProject().getProParentId().equals(entry.getKey().getProId()) && entry.getKey().getType() == 1) { |
| | | TjPdfVO tjPdfVO = new TjPdfVO(); |
| | | tjPdfVO.setProName(tjOrderDetail.getProject().getProName()); |
| | | tjPdfVO.setProResult(tjOrderDetail.getProResult()); |
| | |
| | | tjPdfVO.setProId(String.valueOf(tjOrderDetail.getProject().getProId())); |
| | | tjPdfVO.setPid(String.valueOf(tjProject.getProParentId())); |
| | | LambdaQueryWrapper<LtkjExamJcbgd> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LtkjExamJcbgd::getTjh,tjNumber); |
| | | wrapper.eq(LtkjExamJcbgd::getXmdm,String.valueOf(tjOrderDetail.getProject().getProParentId())); |
| | | wrapper.eq(LtkjExamJcbgd::getTjh, tjNumber); |
| | | wrapper.eq(LtkjExamJcbgd::getXmdm, String.valueOf(tjOrderDetail.getProject().getProParentId())); |
| | | // LtkjExamJcbgd jcbgd = jcbgdService.getOne(wrapper); |
| | | // if (jcbgd != null){ |
| | | // tjPdfVO.setTs(jcbgd.getYxbx()); |
| | |
| | | printReport.put(entry.getKey(), tjPdfVOS); |
| | | } |
| | | } |
| | | |
| | | private void pacsJianChaData(String tjNumber, Map<TjOrderRemark, List<TjPdfVO>> printReport, TjOrder one, TjCustomer customer) { |
| | | // LambdaQueryWrapper<TjOrderRemark> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.eq(TjOrderRemark::getTjNumber, tjNumber); |
| | |
| | | for (TjOrderRemark tjOrderRemark : tjOrderRemarks) { |
| | | printReport.put(tjOrderRemark, null); |
| | | } |
| | | String ids = ""; |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | List<TjPdfVO> tjPdfVOS = new ArrayList<>(); |
| | | List<TjOrderDetail> tjOrderDetails = tjOrderDetailService.getDetailByOrderIdAndParId(one.getOrderId(), entry.getKey().getProId()); |
| | |
| | | if (null != tjProject && tjProject.getNeedReport().equals("Y")) { |
| | | tjOrderDetail.setProject(tjProject); |
| | | |
| | | if (tjOrderDetail.getProject().getProParentId().equals(entry.getKey().getProId())) { |
| | | if (tjOrderDetail.getProject().getProParentId().equals(entry.getKey().getProId()) |
| | | && entry.getKey().getType() == 1 |
| | | && !ids.contains(String.valueOf(tjOrderDetail.getProject().getProParentId()))) { |
| | | TjPdfVO tjPdfVO = new TjPdfVO(); |
| | | tjPdfVO.setProName(tjOrderDetail.getProject().getProName()); |
| | | tjPdfVO.setProResult(tjOrderDetail.getProResult()); |
| | |
| | | } |
| | | tjPdfVO.setProId(String.valueOf(tjOrderDetail.getProject().getProId())); |
| | | LambdaQueryWrapper<LtkjExamJcbgd> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LtkjExamJcbgd::getTjh,tjNumber); |
| | | wrapper.eq(LtkjExamJcbgd::getXmdm,String.valueOf(tjOrderDetail.getProject().getProParentId())); |
| | | LtkjExamJcbgd jcbgd = jcbgdService.getOne(wrapper); |
| | | if (jcbgd != null){ |
| | | tjPdfVO.setTs(jcbgd.getYxbx()); |
| | | tjPdfVO.setSj(jcbgd.getBgNr()); |
| | | tjPdfVO.setShys(jcbgd.getShysxm()); |
| | | wrapper.eq(LtkjExamJcbgd::getTjh, tjNumber); |
| | | wrapper.like(LtkjExamJcbgd::getXmdm, String.valueOf(tjOrderDetail.getProject().getProParentId())); |
| | | wrapper.orderByDesc(LtkjExamJcbgd::getZdsj); |
| | | List<LtkjExamJcbgd> list = jcbgdService.list(wrapper); |
| | | if (null != list && !list.isEmpty()) { |
| | | LtkjExamJcbgd jcbgd = list.get(0); |
| | | if (jcbgd != null) { |
| | | tjPdfVO.setTs(jcbgd.getYxbx()); |
| | | tjPdfVO.setSj(jcbgd.getBgNr()); |
| | | tjPdfVO.setShys(jcbgd.getShysxm()); |
| | | tjPdfVO.setProName(jcbgd.getXmmc()); |
| | | ids += "|" + jcbgd.getXmdm(); |
| | | } |
| | | } |
| | | tjPdfVOS.add(tjPdfVO); |
| | | } |
| | |
| | | document.add(table); |
| | | } |
| | | |
| | | private static void addJianYanTable(Document document, String titleName, String[] titles, float[] titlesWidth, ArrayList<List<String>> lists,DictHosp dictHosp,String colorStr) throws DocumentException { |
| | | private static void addJianYanTable(Document document, String titleName, String[] titles, float[] titlesWidth, ArrayList<List<String>> lists, DictHosp dictHosp, String colorStr) throws DocumentException { |
| | | // 大项标题 |
| | | Font titleFont = PdfUtils.setFont(DEFAULT_TITLE_FONT_SIZE); |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (true) { |
| | | titleFont.setSize(DEFAULT_TITLE_FONT_SIZE); |
| | | titleFont.setStyle(Font.BOLD); |
| | | } |
| | |
| | | paragraph.setSpacingBefore(10f); |
| | | // 设置段落下空白 |
| | | paragraph.setSpacingAfter(10f); |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (true) { |
| | | // 行间距 |
| | | paragraph.setLeading(7f); |
| | | // 设置段落上空白 |
| | |
| | | |
| | | // 将表格添加到文档中 |
| | | document.add(tableTitle); |
| | | }else { |
| | | } else { |
| | | document.add(paragraph); |
| | | } |
| | | // 创建一个表格并添加到文档 |
| | |
| | | for (List<String> list : lists) { |
| | | boolean isYc = false; |
| | | textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | if (dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (list.contains("↓") || list.contains("↑")){ |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (true) { |
| | | if (list.contains("↓") || list.contains("↑")) { |
| | | isYc = true; |
| | | } |
| | | } |
| | |
| | | nameCell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | |
| | | nameCell.setBorder(Rectangle.NO_BORDER); // 移除单元格边框 |
| | | if (isYc){ |
| | | if (isYc) { |
| | | textFont.setStyle(Font.BOLD); |
| | | nameCell.setPhrase(new Paragraph(s, textFont)); |
| | | nameCell.setBorder(Rectangle.NO_BORDER); |
| | | // Color color = Color.decode("#0033cc"); |
| | | // nameCell.setBackgroundColor(new BaseColor(color.getRed(), color.getGreen(), color.getBlue())); // 设置背景颜色(十六进制 RGB) |
| | | }else { |
| | | } else { |
| | | nameCell.setPhrase(new Paragraph(s, textFont)); |
| | | } |
| | | table.addCell(nameCell); |
| | |
| | | * @return bytearrayoutputstream |
| | | */ |
| | | public static ByteArrayOutputStream makeJcPDFByteArrayStream(String xm, String xb, String nl, String jcks, String zyh, String ch, String sjks, String jcsb, String jch |
| | | , String jcxm, String ms, String ts, File[] files, String footer,Paragraph elements) { |
| | | , String jcxm, String ms, String ts, File[] files, String footer, Paragraph elements) { |
| | | try { |
| | | Document document = new Document(PageSize.A4); |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | |
| | | table1.setSpacingAfter(10f); |
| | | |
| | | Font titleFont = PdfUtils.setFont(12); |
| | | PdfPCell mergedCell = new PdfPCell(new Phrase("陕健医澄合矿务局中心医院", titleFont)); |
| | | // PdfPCell mergedCell = new PdfPCell(new Phrase("陕健医澄合矿务局中心医院", titleFont)); |
| | | PdfPCell mergedCell = new PdfPCell(new Phrase(HOSP_NAME, titleFont)); |
| | | mergedCell.setBorder(Rectangle.NO_BORDER); |
| | | mergedCell.setColspan(10); |
| | | mergedCell.setHorizontalAlignment(Element.ALIGN_CENTER); |
| | |
| | | this.footerText = footerText; |
| | | } |
| | | |
| | | public Footer(Paragraph paragraph){ |
| | | public Footer(Paragraph paragraph) { |
| | | this.paragraph = paragraph; |
| | | } |
| | | |
| | |
| | | private String age; |
| | | private Integer page; |
| | | |
| | | public FooterHeaderPageEvent(String name,String tjName,String tjNumber,String sex,String age,Integer page) { |
| | | public FooterHeaderPageEvent(String name, String tjName, String tjNumber, String sex, String age, Integer page) { |
| | | this.name = name; |
| | | this.tjNumber = tjNumber; |
| | | this.tjName = tjName; |
| | |
| | | footerTable.setSpacingBefore(0); // 去除表格顶部的间距 |
| | | footerTable.setSpacingAfter(0); // 去除表格底部的间距 |
| | | footerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); // 去除所有单元格的边框 |
| | | float[] columnWidths = { 2.5f, 2f }; // 第一列占 1,第二列占 2 |
| | | float[] columnWidths = {2.5f, 2f}; // 第一列占 1,第二列占 2 |
| | | footerTable.setWidths(columnWidths); // 设置列宽比例 |
| | | |
| | | // 第一行:医院名和页码 |