| | |
| | | private LtkjHysqdService ltkjHysqdService; |
| | | @Autowired |
| | | private LtkjGetexamreportinfoService ltkjGetexamreportinfoService; |
| | | @Value("${path.filePath}") |
| | | @Value ("${path.filePath}") |
| | | private String value; |
| | | @Value("${path.reportServer}") |
| | | @Value ("${path.reportServer}") |
| | | private String urlValue; |
| | | |
| | | // private static final |
| | | |
| | | /** |
| | | * 通过his API请求获取数据生成PDF |
| | | * |
| | | * @param pdfInfoMap |
| | | * @param params |
| | | * @param tjOrder |
| | |
| | | * @deprecated 有数据同步不在调用接口获取数据直接查数据库拿数据生成 |
| | | */ |
| | | @Deprecated |
| | | public AjaxResult execHisRequest(HashMap<String, Object> pdfInfoMap, Map<String, Object> params,TjOrder tjOrder,TjReportTemplate tjReportTemplate) { |
| | | public AjaxResult execHisRequest(HashMap<String, Object> pdfInfoMap, Map<String, Object> params, TjOrder tjOrder, TjReportTemplate tjReportTemplate) { |
| | | List<Map<String, Object>> list; |
| | | String hisRegistrationId = params.get("his_registration_id").toString(); |
| | | AjaxResult getlabreportinfo = apiGetMethodService.getHISDataNew("Getlabreportinfo", params); |
| | |
| | | putData(obj, getexamreportinfo, "检查报告"); |
| | | jsonArray.put(obj); |
| | | // System.out.println(JSONUtil.toJsonStr(jsonArray)); |
| | | if (makePDF(hisRegistrationId, jsonArray,tjOrder,tjReportTemplate)) { |
| | | if (makePDF(hisRegistrationId, jsonArray, tjOrder, tjReportTemplate)) { |
| | | log.info("已生成报告"); |
| | | return AjaxResult.success("已生成报告!可直接点击预览!"); |
| | | } else return AjaxResult.error(); |
| | |
| | | } |
| | | } |
| | | |
| | | public AjaxResult hisPDF(TjOrder tjOrder,TjCustomer customer,TjReportTemplate tjReportTemplate) throws DocumentException { |
| | | public AjaxResult hisPDF(TjOrder tjOrder, TjCustomer customer, TjReportTemplate tjReportTemplate) throws DocumentException { |
| | | HashMap<String, Object> pdfChangGui = makePDFInfo(tjOrder, customer, tjReportTemplate); |
| | | Document document = (Document) pdfChangGui.get("document"); |
| | | PdfCopy copy = (PdfCopy) pdfChangGui.get("copy"); |
| | |
| | | Document document1 = new Document(PageSize.A4); |
| | | PdfWriter pdfWriter = null; |
| | | try { |
| | | pdfWriter = PdfWriter.getInstance(document1, byteArrayOutputStream1); |
| | | pdfWriter = PdfWriter.getInstance(document1, byteArrayOutputStream1); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error(); |
| | |
| | | document1.open(); |
| | | // 非化验项目报告 |
| | | Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); |
| | | notHuaYanData(tjOrder.getTjNumber(), printReport,tjOrder,customer); |
| | | notHuaYanData(tjOrder.getTjNumber(), printReport, tjOrder, customer); |
| | | try { |
| | | notHuaYanTable(document1, printReport); |
| | | } catch (DocumentException e) { |
| | |
| | | return AjaxResult.error(); |
| | | } |
| | | String outputFileName1 = customer.getCusId() + tjOrder.getTjNumber() + customer.getCusName() + "_报告.pdf"; |
| | | savePDFFile(outputFileName1,tjOrder, customer, finalOutPut); |
| | | savePDFFile(outputFileName1, tjOrder, customer, finalOutPut); |
| | | TjReport tjReport = new TjReport(); |
| | | String tjNumber = tjOrder.getTjNumber(); |
| | | tjReport.setTjNumber(String.valueOf(tjNumber)); |
| | | tjReport.setPath(urlValue + outputFileName1); |
| | | // 文件配置 |
| | | // String outputPath1 = "/Users/chacca/开发相关/代码/"; |
| | | String outputPath1 = value+"\\"; |
| | | String outputPath1 = value + "\\"; |
| | | String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | tjReport.setReport(pdfBinary); |
| | | tjReport.setType("体检报告"); |
| | |
| | | |
| | | /** |
| | | * 生成检查表格 |
| | | * |
| | | * @param tjOrder |
| | | * @return |
| | | */ |
| | | private List<ByteArrayOutputStream> makeHisJianChaTable(TjOrder tjOrder) { |
| | | LambdaQueryWrapper<LtkjGetexamreportinfo> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(LtkjGetexamreportinfo::getHisRegistrationId, tjOrder.getCardId()); |
| | | lambdaQueryWrapper.eq(LtkjGetexamreportinfo::getRequestParamsHisRegistrationId, tjOrder.getCardId()); |
| | | lambdaQueryWrapper.groupBy(LtkjGetexamreportinfo::getJcbgid); |
| | | List<LtkjGetexamreportinfo> list = ltkjGetexamreportinfoService.list(lambdaQueryWrapper); |
| | | // List<LtkjGetexamreportinfo> list = ltkjGetexamreportinfoService.list(); |
| | | List<ByteArrayOutputStream> jianchas = new ArrayList<>(); |
| | |
| | | String sqrxm = getexamreportinfo.getSqrxm(); |
| | | String zyh = ""; |
| | | String ch = ""; |
| | | String footer = "申请人:"+sqrxm + " 审核医师:"+shysqm+" 医师签名:"+bgysqm; |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null,footer); |
| | | String footer = "申请人:" + sqrxm + " 审核医师:" + shysqm + " 医师签名:" + bgysqm; |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null, footer); |
| | | jianchas.add(outputStream); |
| | | } |
| | | return jianchas; |
| | |
| | | |
| | | /** |
| | | * PDF文件存储至本地 |
| | | * |
| | | * @param tjOrder |
| | | * @param customer |
| | | * @param finalOutPut |
| | | */ |
| | | private void savePDFFile(String outputFileName1,TjOrder tjOrder, TjCustomer customer, ByteArrayOutputStream finalOutPut) { |
| | | private void savePDFFile(String outputFileName1, TjOrder tjOrder, TjCustomer customer, ByteArrayOutputStream finalOutPut) { |
| | | // 文件配置 |
| | | // String outputPath1 = "/Users/chacca/开发相关/代码/"; |
| | | String outputPath1 = value+"\\"; |
| | | String outputPath1 = value + "\\"; |
| | | File file = new File(outputPath1 + outputFileName1); |
| | | BufferedOutputStream outputStream = null; |
| | | try { |
| | |
| | | |
| | | /** |
| | | * 填充检验表格数据 |
| | | * |
| | | * @param document1 |
| | | * @param map |
| | | * @throws DocumentException |
| | | */ |
| | | private static void makeHisJianYanTable(Document document1, HashMap<String, Object> map) throws DocumentException { |
| | | if (!map.isEmpty()){ |
| | | if (!map.isEmpty()) { |
| | | String[] titles = new String[]{"体检项目", "体检结果", "单位", "参考范围"}; |
| | | float[] titlesWidth = new float[]{120, 120, 120, 120}; |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) entry.getValue(); |
| | | HashSet<String> jyys = (HashSet<String>) entryValue.get("jyys"); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | addJianYanTable(document1,titleName,titles,titlesWidth,lists); |
| | | addJianYanTable(document1, titleName, titles, titlesWidth, lists); |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | String doctors = ""; |
| | | for (String s : jyys) { |
| | | doctors+=s+"、"; |
| | | doctors += s + "、"; |
| | | } |
| | | String substring = doctors.substring(0, doctors.length() - 1); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, "检验医师:"+substring); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, "检验医师:" + substring); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | //分割线 |
| | |
| | | |
| | | /** |
| | | * 非化验项目表格填充 |
| | | * |
| | | * @param document1 |
| | | * @param printReport |
| | | * @throws DocumentException |
| | | */ |
| | | private void notHuaYanTable(Document document1, Map<TjOrderRemark, List<TjPdfVO>> printReport) throws DocumentException { |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | List<TjPdfVO> value = entry.getValue(); |
| | | LambdaQueryWrapper<TjProject> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjProject::getProId, entry.getKey().getProId()); |
| | | TjProject one11 = projectService.getOne(wqqq); |
| | | //判断该项目是否需要打印报告 |
| | | if (null != one11 && "N".equals(one11.getNeedReport())) { |
| | | continue; |
| | | } |
| | | String titleName = null; |
| | | if (null != one11 && "1".equals(one11.getResultType())) { |
| | | titleName = one11.getProName(); |
| | | // TODO 单位 |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | String[] titles = {"体检项目", "体检结果","单位"}; |
| | | // 获取列表数据 |
| | | //设置表头字体样式 |
| | | Font headFont = PdfUtils.setFont(9); |
| | | // 设置正文字体样式:12号 |
| | | Font textFont = PdfUtils.setFont(9); |
| | | //创建表格 将表头字体和正文字体放进去 |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value); |
| | | document1.add(paragraph); |
| | | document1.add(table); |
| | | //判断备注是否为空 空不能显示null |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | | for (int i = 0; i < remark.length() / 50; i++) { |
| | | String substring = remark.substring(j, j + 50); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | j = j + 50; |
| | | } |
| | | if (remark.length() % 50 != 0) { |
| | | String substring = remark.substring((remark.length() / 50) * 50, remark.length() - 1); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | } |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, remark); |
| | | document1.add(pp); |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | if (null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) { |
| | | //主检医师 |
| | | String doctorName = "主检医师:" + userService.getById(entry.getKey().getDoctorName()).getNickName(); |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } else { |
| | | String doctorName = "主检医师:" + "无"; |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | //分割线 |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | | } else { |
| | | if (null != one11) { |
| | | if (null != one11 && "Y".equals(one11.getNeedReport())) { |
| | | List<TjPdfVO> value = entry.getValue(); |
| | | String titleName = null; |
| | | if (null != one11 && "1".equals(one11.getResultType())) { |
| | | titleName = one11.getProName(); |
| | | } else { |
| | | titleName = entry.getKey().getProName(); |
| | | } |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | String[] titles = {"体检项目", "体检结果", "单位", "参考范围"}; |
| | | // 获取列表数据 |
| | | //设置表头字体样式 |
| | | Font headFont = PdfUtils.setFont(9); |
| | | // 设置正文字体样式:12号 |
| | | Font textFont = PdfUtils.setFont(9); |
| | | //创建表格 将表头字体和正文字体放进去 |
| | | PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value); |
| | | document1.add(paragraph); |
| | | document1.add(table); |
| | | //判断备注是否为空 空不能显示null |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | | for (int i = 0; i < remark.length() / 50; i++) { |
| | | String substring = remark.substring(j, j + 50); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | j = j + 50; |
| | | // TODO 单位 |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | // 获取列表数据 |
| | | //设置表头字体样式 |
| | | Font headFont = PdfUtils.setFont(9); |
| | | // 设置正文字体样式:12号 |
| | | Font textFont = PdfUtils.setFont(9); |
| | | //创建表格 将表头字体和正文字体放进去 |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value); |
| | | document1.add(paragraph); |
| | | document1.add(table); |
| | | //判断备注是否为空 空不能显示null |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | if (remark.length() % 50 != 0) { |
| | | String substring = remark.substring((remark.length() / 50) * 50, remark.length() - 1); |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | | for (int i = 0; i < remark.length() / 50; i++) { |
| | | String substring = remark.substring(j, j + 50); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | j = j + 50; |
| | | } |
| | | if (remark.length() % 50 != 0) { |
| | | String substring = remark.substring((remark.length() / 50) * 50, remark.length() - 1); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | } |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, remark); |
| | | document1.add(pp); |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | if (null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) { |
| | | //主检医师 |
| | | String doctorName = "主检医师:" + userService.getById(entry.getKey().getDoctorName()).getNickName(); |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } else { |
| | | String doctorName = "主检医师:" + "无"; |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | //分割线 |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, remark); |
| | | document1.add(pp); |
| | | if (null != one11) { |
| | | titleName = one11.getProName(); |
| | | } else { |
| | | titleName = entry.getKey().getProName(); |
| | | } |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | // 获取列表数据 |
| | | //设置表头字体样式 |
| | | Font headFont = PdfUtils.setFont(9); |
| | | // 设置正文字体样式:12号 |
| | | Font textFont = PdfUtils.setFont(9); |
| | | //创建表格 将表头字体和正文字体放进去 |
| | | PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value); |
| | | document1.add(paragraph); |
| | | document1.add(table); |
| | | //判断备注是否为空 空不能显示null |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | | for (int i = 0; i < remark.length() / 50; i++) { |
| | | String substring = remark.substring(j, j + 50); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | j = j + 50; |
| | | } |
| | | if (remark.length() % 50 != 0) { |
| | | String substring = remark.substring((remark.length() / 50) * 50, remark.length() - 1); |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | } |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(9); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, remark); |
| | | document1.add(pp); |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | if (null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) { |
| | | //主检医师 |
| | | String doctorName = "主检医师:" + userService.getById(entry.getKey().getDoctorName()).getNickName(); |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } else { |
| | | String doctorName = "主检医师:" + "无"; |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | //分割线 |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | if (null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) { |
| | | //主检医师 |
| | | String doctorName = "主检医师:" + userService.getById(entry.getKey().getDoctorName()).getNickName(); |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } else { |
| | | String doctorName = "主检医师:" + "无"; |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, doctorName); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | | } |
| | | //分割线 |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public HashMap<String, Object> makeHisJianYan(TjOrder tjOrder, TjCustomer customer){ |
| | | public HashMap<String, Object> makeHisJianYan(TjOrder tjOrder, TjCustomer customer) { |
| | | // TODO 这里先使用查全部测试 |
| | | LambdaQueryWrapper<LtkjHysqd> ltkjHysqdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ltkjHysqdLambdaQueryWrapper.eq(LtkjHysqd::getTjh,tjOrder.getCardId()); |
| | | ltkjHysqdLambdaQueryWrapper.eq(LtkjHysqd::getTjh, tjOrder.getCardId()); |
| | | List<LtkjHysqd> list = ltkjHysqdService.list(ltkjHysqdLambdaQueryWrapper); |
| | | // List<LtkjHysqd> list = ltkjHysqdService.list(); |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | for (LtkjHysqd hysqd : list) { |
| | | LambdaQueryWrapper<LtkjHybgd> ltkjHybgdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ltkjHybgdLambdaQueryWrapper.eq(LtkjHybgd::getTmh,hysqd.getTmh()); |
| | | ltkjHybgdLambdaQueryWrapper.eq(LtkjHybgd::getTmh, hysqd.getTmh()); |
| | | List<LtkjHybgd> hybgds = ltkjHybgdService.list(ltkjHybgdLambdaQueryWrapper); |
| | | // 大类项目名称 |
| | | String xmmc = hysqd.getXmmc(); |
| | |
| | | // String jyys = hybgd.getJyys(); |
| | | //审核医生 |
| | | String shysmc = hybgd.getShysmc(); |
| | | if (jyjg != null && StrUtil.isNotBlank(jyjg) && fwz != null && StrUtil.isNotBlank(fwz)){ |
| | | if (jyjg != null && StrUtil.isNotBlank(jyjg) && fwz != null && StrUtil.isNotBlank(fwz)) { |
| | | try { |
| | | String[] fwzs = fwz.split("-"); |
| | | BigDecimal min = new BigDecimal(fwzs[0]); |
| | |
| | | // jyjg 大于范围最大值,添加上箭头 |
| | | jyjg = jyjg + " ↑"; |
| | | } |
| | | } catch (Exception ignored) {} |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | // LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(SysUser::getUserName,jyys); |
| | | // List<SysUser> sysUsers = userService.list(queryWrapper); |
| | | // if (!sysUsers.isEmpty()) |
| | | // hashSet.add(sysUsers.get(0).getNickName()); |
| | | if(null !=shysmc) hashSet.add(shysmc); |
| | | if (null != shysmc) hashSet.add(shysmc); |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | strings.add(jcxm); |
| | | strings.add(jyjg); |
| | |
| | | } |
| | | if (!lists.isEmpty()) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("data",lists); |
| | | map.put("jyys",hashSet); |
| | | map.put("data", lists); |
| | | map.put("jyys", hashSet); |
| | | data.put(xmmc, map); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 生成PDF模版以及用户信息部分 |
| | | * |
| | | * @param tjOrder |
| | | * @param reportTemplate |
| | | */ |
| | | public HashMap<String ,Object> makePDFInfo(TjOrder tjOrder,TjCustomer tjCustomer,TjReportTemplate reportTemplate){ |
| | | public HashMap<String, Object> makePDFInfo(TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate) { |
| | | String tjNumber = tjOrder.getTjNumber(); |
| | | String template = reportTemplate.getTemplate(); |
| | | LambdaQueryWrapper<DictComp> wq111 = new LambdaQueryWrapper<>(); |
| | |
| | | // 添加详情页 |
| | | document.newPage(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("document",document); |
| | | map.put("copy",copy); |
| | | map.put("stream",finalOutPut); |
| | | map.put("document", document); |
| | | map.put("copy", copy); |
| | | map.put("stream", finalOutPut); |
| | | return map; |
| | | } catch (IOException | DocumentException e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | public Boolean makePDF(String cardId, JSONArray jsonArray,TjOrder tjOrder,TjReportTemplate reportTemplate) { |
| | | public Boolean makePDF(String cardId, JSONArray jsonArray, TjOrder tjOrder, TjReportTemplate reportTemplate) { |
| | | String tjNumber = tjOrder.getTjNumber(); |
| | | String template = reportTemplate.getTemplate(); |
| | | LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>(); |
| | |
| | | document1.open(); |
| | | // 非化验项目报告 |
| | | Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); |
| | | notHuaYanData(tjNumber, printReport,tjOrder,tjCustomer); |
| | | notHuaYanData(tjNumber, printReport, tjOrder, tjCustomer); |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | List<TjPdfVO> value = entry.getValue(); |
| | | LambdaQueryWrapper<TjProject> wqqq = new LambdaQueryWrapper<>(); |
| | |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | String[] titles = {"体检项目", "体检结果","单位"}; |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | // 获取列表数据 |
| | | //设置表头字体样式 |
| | | Font headFont = PdfUtils.setFont(9); |
| | |
| | | String shysqm = obj.getStr("SHYSQM"); |
| | | // 申请人 |
| | | String sqrxm = obj.getStr("SQRXM"); |
| | | String footer = "申请人:"+sqrxm + " 审核医师:"+shysqm+" "+bgysqm; |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null,footer); |
| | | String footer = "申请人:" + sqrxm + " 审核医师:" + shysqm + " " + bgysqm; |
| | | ByteArrayOutputStream outputStream = makeJcPDFByteArrayStream(xm, xb, nl, jcks, zyh, ch, sjks, jcsb, jch, jcxm, ms, ts, null, footer); |
| | | jianchas.add(outputStream); |
| | | } |
| | | } |
| | |
| | | String outputFileName1 = userId + tjNumber + tjCustomer.getCusName() + "_报告.pdf"; |
| | | // 文件配置 |
| | | // String outputPath1 = "/Users/chacca/开发相关/代码/"; |
| | | String outputPath1 = value+"\\"; |
| | | String outputPath1 = value + "\\"; |
| | | File file = new File(outputPath1 + outputFileName1); |
| | | BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file)); |
| | | outputStream.write(finalOutPut.toByteArray()); |
| | |
| | | |
| | | /** |
| | | * 组合非化验项目报告数据 |
| | | * |
| | | * @param tjNumber |
| | | * @param printReport |
| | | * @param one |
| | | * @param customer |
| | | */ |
| | | private void notHuaYanData(String tjNumber, Map<TjOrderRemark, List<TjPdfVO>> printReport,TjOrder one,TjCustomer customer) { |
| | | private void notHuaYanData(String tjNumber, Map<TjOrderRemark, List<TjPdfVO>> printReport, TjOrder one, TjCustomer customer) { |
| | | LambdaQueryWrapper<TjOrderRemark> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrderRemark::getTjNumber, tjNumber); |
| | | wqq.ne(TjOrderRemark::getDeptId, "241"); |
| | | wqq.in(TjOrderRemark::getDeptId, "269", "270", "253", "254", "255", "257", "251", "271"); |
| | | wqq.in(TjOrderRemark::getDeptId, "269", "270", "253", "254", "255", "257"); |
| | | wqq.notIn(TjOrderRemark::getProId, projectService.getNneedReprotProId()); |
| | | List<TjOrderRemark> tjOrderRemarks = tjOrderRemarkService.list(wqq); |
| | | for (TjOrderRemark tjOrderRemark : tjOrderRemarks) { |
| | |
| | | List<TjOrderDetail> tjOrderDetails = tjOrderDetailService.getDetailByOrderIdAndParId(one.getOrderId(), entry.getKey().getProId()); |
| | | for (TjOrderDetail tjOrderDetail : tjOrderDetails) { |
| | | TjProject tjProject = projectService.getById(tjOrderDetail.getProId()); |
| | | if (null != tjProject) { |
| | | if (null != tjProject && tjProject.getNeedReport().equals("Y")) { |
| | | tjOrderDetail.setProject(tjProject); |
| | | } |
| | | |
| | | if (tjOrderDetail.getProject().getProParentId().equals(entry.getKey().getProId())) { |
| | | LambdaQueryWrapper<TjStandard> wq6 = new LambdaQueryWrapper<>(); |
| | | wq6.eq(TjStandard::getProId, tjOrderDetail.getProId()); |
| | | List<TjStandard> list2 = tjStandardService.list(wq6); |
| | | if (list2.size() == 0) { |
| | | TjStandard s = new TjStandard(); |
| | | s.setCompany(" "); |
| | | s.setTjStandardLtValue(" "); |
| | | s.setTjStandardGtValue(" "); |
| | | tjOrderDetail.setStandard(s); |
| | | } else if (list2.size() == 1) { |
| | | tjOrderDetail.setStandard(list2.get(0)); |
| | | } else { |
| | | Long cusSex = customer.getCusSex(); |
| | | Date cusBrithday = customer.getCusBrithday(); |
| | | int age = DateUtil.ageOfNow(cusBrithday); |
| | | for (TjStandard tjStandard : list2) { |
| | | LambdaQueryWrapper<TjStandard> wq8 = new LambdaQueryWrapper<>(); |
| | | if (tjStandard.getTjSex() != null) { |
| | | wq8.eq(TjStandard::getTjSex, cusSex); |
| | | } |
| | | if (tjStandard.getTjType() != null) { |
| | | wq8.eq(TjStandard::getTjType, StringUtils.getAgeType(age)); |
| | | } |
| | | TjStandard standard = tjStandardService.getOne(wq8); |
| | | tjOrderDetail.setStandard(standard); |
| | | } |
| | | } |
| | | TjPdfVO tjPdfVO = new TjPdfVO(); |
| | | tjPdfVO.setProName(tjOrderDetail.getProject().getProName()); |
| | | tjPdfVO.setProResult(tjOrderDetail.getProResult()); |
| | | tjPdfVO.setExc(tjOrderDetail.getExceptionDesc()); |
| | | if (tjOrderDetail.getStandard() != null) { |
| | | //单位 |
| | | if (tjOrderDetail.getStandard().getCompany() == null) { |
| | | tjPdfVO.setCompany(" "); |
| | | } else { |
| | | tjPdfVO.setCompany(tjOrderDetail.getStandard().getCompany()); |
| | | } |
| | | // TODO 设置单位 |
| | | //最大值和最小值 |
| | | String tjStandardGtValue = tjOrderDetail.getStandard().getTjStandardGtValue(); |
| | | String tjStandardLtValue = tjOrderDetail.getStandard().getTjStandardLtValue(); |
| | | if (tjStandardGtValue == null) { |
| | | tjStandardGtValue = " "; |
| | | } |
| | | if (tjStandardLtValue == null) { |
| | | tjStandardLtValue = " "; |
| | | } |
| | | tjPdfVO.setStandardValue(tjStandardLtValue + "-" + tjStandardGtValue); |
| | | if(null !=tjProject.getProMetering()){ |
| | | tjPdfVO.setCompany(tjProject.getProMetering()); |
| | | }else { |
| | | tjPdfVO.setCompany("/"); |
| | | } |
| | | tjPdfVOS.add(tjPdfVO); |
| | | } |
| | | } |
| | | } |
| | | printReport.put(entry.getKey(), tjPdfVOS); |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param document |
| | | * @param titleName |
| | | * @param titles |
| | |
| | | document.add(table); |
| | | } |
| | | |
| | | private static void addJianYanTable(Document document, String titleName, String[] titles, float[] titlesWidth, ArrayList<List<String >> lists) throws DocumentException { |
| | | private static void addJianYanTable(Document document, String titleName, String[] titles, float[] titlesWidth, ArrayList<List<String>> lists) throws DocumentException { |
| | | Font titleFont = PdfUtils.setFont(9); |
| | | Paragraph paragraph = new Paragraph(titleName, titleFont); |
| | | // 设置文字居中 |
| | |
| | | |
| | | /** |
| | | * 创建检查pdf |
| | | * |
| | | * @param xm |
| | | * @param xb |
| | | * @param nl |
| | |
| | | * @param footer |
| | | * @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) { |
| | | 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) { |
| | | try { |
| | | Document document = new Document(PageSize.A4); |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | |
| | | float[] columnWidths = {0.8f, 0.8f, 0.8f, 0.8f, 0.1f, 0.1f, 0.8f, 0.8f, 0.8f, 0.8f}; |
| | | table2.setWidths(columnWidths); |
| | | |
| | | if(files != null){ |
| | | if (files != null) { |
| | | int imageIndex = 0; |
| | | while (imageIndex < files.length) { |
| | | // 第一张图片占位符 |