zjh
2025-04-16 e1426706a7b0369f7576fa3e1ea36c6a688d1999
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -1672,12 +1672,17 @@
        if (null != cusIds && !cusIds.isEmpty()) {
            ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size());
            for (String cusId : cusIds) {
                threadPools.execute(new Runnable() {
                    @Override
                    public void run() {
//                threadPools.execute(new Runnable() {
//                    @Override
//                    public void run() {
                try {
                        getAjaxResults(cusId);
                } catch (Exception e) {
                    }
                });
//                    }
//                });
            }
            LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
            wq.in(TjCustomer::getCusIdcard, cusIds);
@@ -1723,72 +1728,17 @@
            }
            // TODO 因为有体检号会查出空数据 先使用死数据  打印导诊单
            if (!tjNumbers.isEmpty()) {
            /*    Map<String, Object> map = null;
                try {
                    map = PDFDocumentUtil.getDocument();
                    Document document = (Document) map.get("document");
//                    for (int i = 0; i < tjNumbers.size(); i++) {
                    int i = 0;
                    for (String tjNumber : tjNumbers) {
                        try {
                            List<Map<String, Object>> djdInfos = tjOrderService.selectDjdInfo(tjNumber);
                            Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumber);
                            if(null !=userInfo && null !=djdInfos && !djdInfos.isEmpty()){
                                LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj");
                                DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
                                String time = null;
                                if (tjsj != null) {
                                    time = dateFormat.format(tjsj);
                                }
                                PDFDocumentUtil.makeUserInfoTable(document, (String) userInfo.get("tjname"), (String) userInfo.get("sex")
                                        , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), time);
                                PDFDocumentUtil.makeTjInfo(document, djdInfos);
                                // 多条则换页
                                if (i + 1 < tjNumbers.size()) {
                                    document.newPage();
                                }
                            }
                        } catch (DocumentException | IOException e) {
                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                            //这里删除的是这个人所有项目包括补录项目
                            TjOrder order = tjOrderService.getOrderByTjNum(tjNumber);
                            tjOrderService.deleteTjOrderByOrderId(order.getOrderId());
                            tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId()));
                            remarkService.deletedOrderRemarkByTjNum(tjNumber);
                            tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId()));
//                transitionService.deletedTbTransitionByTjNum(tjNum);
                            tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId());
                            TjReservation reservation = tjReservationService.getById(order.getReservationId());
                            if(null !=reservation){
                                reservation.setIsExpire(2);
                                tjReservationService.updateById(reservation);
                                transitionService.updateTbTransitionByTjNum(tjNumber);
                            }
                            e.printStackTrace();
                        }
                    }
//                    }
                    document.close();
                    ByteArrayOutputStream outputStream = (ByteArrayOutputStream) map.get("stream");
                    String encodeToString = java.util.Base64.getEncoder().encodeToString(outputStream.toByteArray());
                    return AjaxResult.success().put("file", encodeToString);
                } catch (IOException | DocumentException e) {
                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    e.printStackTrace();
                }*/
                Map<String,Object> map=new HashMap<>();
                map.put("tjh",tjNumbers);
                return AjaxResult.success("操作成功",map);
            }
            if (!errTjh.isEmpty()){
                Map<String,Object> map=new HashMap<>();
                map.put("errtjh",errTjh);
                return AjaxResult.success("以上人员签到失败",map);
            }
            return AjaxResult.success();
            return AjaxResult.error();
        }
//        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
        return AjaxResult.error();
@@ -1867,6 +1817,7 @@
                    tjReservationService.updateById(tjReservation);
//                    return AjaxResult.error("对不起您的预约已超时请重新预约");
                }*/
                try {
                LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>();
                qw.eq(TjCustomer::getCusIdcard, cusIdcard);
                TjCustomer tjCustomer1 = tjCustomerService.getOne(qw);
@@ -1910,8 +1861,15 @@
                    tjCustomer.setTjType(tjReservation.getTjType());
                    tjCustomerService.save(tjCustomer);
                }
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }else {
                throw new RuntimeException();
            }
        }else {
            throw new RuntimeException();
        }
    }