| | |
| | | |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.text.NumberFormat; |
| | |
| | | import com.itextpdf.text.*; |
| | | import com.itextpdf.text.pdf.*; |
| | | import com.itextpdf.text.pdf.draw.LineSeparator; |
| | | import com.ltkj.common.annotation.Log; |
| | | import com.ltkj.common.core.domain.entity.SysDictData; |
| | | import com.ltkj.common.utils.DateUtils; |
| | | import com.ltkj.common.utils.PDFDocumentUtil; |
| | |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.vodomain.UpdateOrderRemarkVo; |
| | | import com.ltkj.mall.mallOrderUtils.TjConstants; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDictDataService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.config.pdfutils.MergePdf; |
| | | import com.ltkj.web.config.pdfutils.MyHeaderFooter; |
| | | import com.ltkj.web.config.pdfutils.PDFBinaryUtil; |
| | | import com.ltkj.web.config.pdfutils.PdfUtils; |
| | | import com.ltkj.web.controller.his.HisPDFUtil; |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | params.put("jsrq", jsrq); |
| | | params.put("pagecount", 100); |
| | | params.put("page", 1); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjCustomer::getCusId, tjOrder.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq1); |
| | | // return hisPDFUtil.execHisRequest(map, params, tjOrder, reportTemplate); |
| | | try { |
| | | return hisPDFUtil.hisPDF(tjOrder,tjCustomer,reportTemplate); |
| | | } catch (DocumentException e) { |
| | | logger.error("生成报告异常"); |
| | | AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate); |
| | | if (!ajaxResult.get("code").toString().equals("200")) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } else { |
| | | Long userId = tjCustomer.getCusId(); |
| | | String outputFileName1 = userId + tjNumber + tjCustomer.getCusName() + "_报告.pdf"; |
| | | TjReport tjReport = new TjReport(); |
| | | tjReport.setTjNumber(String.valueOf(tjNumber)); |
| | | tjReport.setPath(urlValue + outputFileName1); |
| | | String outputPath1 = value + "\\"; |
| | | String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | tjReport.setReport(pdfBinary); |
| | | tjReport.setType("体检报告"); |
| | | tjReport.setPrint("pdf"); |
| | | tjReportService.save(tjReport); |
| | | LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(TjOrder::getTjNumber, tjNumber); |
| | | updateWrapper.set(TjOrder::getReportTime, new Date()); |
| | | updateWrapper.set(TjOrder::getPrintLastTime, new Date()); |
| | | updateWrapper.set(TjOrder::getDownloadLastTime, new Date()); |
| | | updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END); |
| | | tjOrderService.update(updateWrapper); |
| | | } |
| | | return ajaxResult; |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("生成报告异常"); |
| | | // 调用撤销 |
| | | // tjReportController.backOnlyCheckType(tjNumber); |
| | | logger.error("生成报告异常"); |
| | | return AjaxResult.error("生成报告失败"); |
| | | } |
| | | } else { |
| | | return AjaxResult.error("请先总检"); |
| | | } |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Autowired |
| | | private TjReportController tjReportController; |
| | | |
| | | /** |
| | | * 撤销 |
| | | * @param tjNumber |
| | | */ |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public void backOnlyCheckType(String tjNumber) { |
| | | QueryWrapper<TjOrder> wq2 = new QueryWrapper<>(); |
| | | wq2.eq("tj_number", tjNumber); |
| | | TjOrder one = tjOrderService.getOne(wq2); |
| | | one.setCheckStatus(0); |
| | | String config = configService.selectConfigByKey("tj_confirm"); |
| | | if ("Y".equals(config)) { |
| | | one.setStatus(TjConstants.TJ_CHECK); |
| | | } else { |
| | | one.setStatus(TjConstants.TJ_CONFIRM); |
| | | } |
| | | //将状态改为未审核 |
| | | tjOrderService.updateById(one); |
| | | } |
| | | |
| | | private AjaxResult newFun(String tjNumber) { |
| | |
| | | |
| | | /** |
| | | * 通过sql 重整数据模板 全部重新生成 |
| | | * |
| | | * @param tjNumbers |
| | | * @return |
| | | */ |