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() {
                        getAjaxResults(cusId);
                    }
                });
//                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,51 +1817,59 @@
                    tjReservationService.updateById(tjReservation);
//                    return AjaxResult.error("对不起您的预约已超时请重新预约");
                }*/
                LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>();
                qw.eq(TjCustomer::getCusIdcard, cusIdcard);
                TjCustomer tjCustomer1 = tjCustomerService.getOne(qw);
                if (tjCustomer1 != null) {
                    tjCustomer1.setTjType(tjReservation.getTjType());
                    tjCustomer1.setCusName(tjReservation.getName());
                    tjCustomer1.setCusSex(Long.valueOf(tjReservation.getSex()));
                    tjCustomer1.setCusBrithday(tjReservation.getBirthday());
                    tjCustomer1.setCusPhone(tjReservation.getPhoe());
                    tjCustomer1.setCusEmail(tjReservation.getEmail());
                    tjCustomer1.setCusAddr(tjReservation.getAddress());
                    tjCustomer1.setCusMarryStatus(String.valueOf(tjReservation.getMarriage()));
                    tjCustomer1.setCusNational(String.valueOf(tjReservation.getNation()));
                    tjCustomer1.setIdType(tjReservation.getIdType());
                    tjCustomer1.setAge(tjReservation.getAge());
                    tjCustomer1.setAgeUnit(tjReservation.getAgeUnit());
                    tjCustomer1.setCareer(tjReservation.getCareer());
                    tjCustomerService.updateById(tjCustomer1);
                } else {
                    TjCustomer tjCustomer = new TjCustomer();
                    tjCustomer.setCusIdcard(tjReservation.getIdCard());
                    tjCustomer.setCusName(tjReservation.getName());
                    tjCustomer.setCusSex(Long.valueOf(tjReservation.getSex()));
                    tjCustomer.setCusBrithday(tjReservation.getBirthday());
                    tjCustomer.setCusPhone(tjReservation.getPhoe());
                    tjCustomer.setCusEmail(tjReservation.getEmail());
                    tjCustomer.setCusAddr(tjReservation.getAddress());
                    tjCustomer.setCusMarryStatus(String.valueOf(tjReservation.getMarriage()));
                    tjCustomer.setCusNational(String.valueOf(tjReservation.getNation()));
                    tjCustomer.setIdType(tjReservation.getIdType());
                    tjCustomer.setAge(tjReservation.getAge());
                    tjCustomer.setAgeUnit(tjReservation.getAgeUnit());
                    tjCustomer.setCareer(tjReservation.getCareer());
                    tjCustomer.setDwPhone(tjReservation.getDwPhone());
                    tjCustomer.setCardId(tjReservation.getCardId());
                    tjCustomer.setIndexCard(tjReservation.getIndexCard());
                    //截取密码自动生成set进去
                    String substring = cusIdcard.substring(cusIdcard.length() - 6);
                    substring = DigestUtils.md5DigestAsHex(substring.getBytes());
                    tjCustomer.setCusPassword(substring);
                    tjCustomer.setTjType(tjReservation.getTjType());
                    tjCustomerService.save(tjCustomer);
                try {
                    LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>();
                    qw.eq(TjCustomer::getCusIdcard, cusIdcard);
                    TjCustomer tjCustomer1 = tjCustomerService.getOne(qw);
                    if (tjCustomer1 != null) {
                        tjCustomer1.setTjType(tjReservation.getTjType());
                        tjCustomer1.setCusName(tjReservation.getName());
                        tjCustomer1.setCusSex(Long.valueOf(tjReservation.getSex()));
                        tjCustomer1.setCusBrithday(tjReservation.getBirthday());
                        tjCustomer1.setCusPhone(tjReservation.getPhoe());
                        tjCustomer1.setCusEmail(tjReservation.getEmail());
                        tjCustomer1.setCusAddr(tjReservation.getAddress());
                        tjCustomer1.setCusMarryStatus(String.valueOf(tjReservation.getMarriage()));
                        tjCustomer1.setCusNational(String.valueOf(tjReservation.getNation()));
                        tjCustomer1.setIdType(tjReservation.getIdType());
                        tjCustomer1.setAge(tjReservation.getAge());
                        tjCustomer1.setAgeUnit(tjReservation.getAgeUnit());
                        tjCustomer1.setCareer(tjReservation.getCareer());
                        tjCustomerService.updateById(tjCustomer1);
                    } else {
                        TjCustomer tjCustomer = new TjCustomer();
                        tjCustomer.setCusIdcard(tjReservation.getIdCard());
                        tjCustomer.setCusName(tjReservation.getName());
                        tjCustomer.setCusSex(Long.valueOf(tjReservation.getSex()));
                        tjCustomer.setCusBrithday(tjReservation.getBirthday());
                        tjCustomer.setCusPhone(tjReservation.getPhoe());
                        tjCustomer.setCusEmail(tjReservation.getEmail());
                        tjCustomer.setCusAddr(tjReservation.getAddress());
                        tjCustomer.setCusMarryStatus(String.valueOf(tjReservation.getMarriage()));
                        tjCustomer.setCusNational(String.valueOf(tjReservation.getNation()));
                        tjCustomer.setIdType(tjReservation.getIdType());
                        tjCustomer.setAge(tjReservation.getAge());
                        tjCustomer.setAgeUnit(tjReservation.getAgeUnit());
                        tjCustomer.setCareer(tjReservation.getCareer());
                        tjCustomer.setDwPhone(tjReservation.getDwPhone());
                        tjCustomer.setCardId(tjReservation.getCardId());
                        tjCustomer.setIndexCard(tjReservation.getIndexCard());
                        //截取密码自动生成set进去
                        String substring = cusIdcard.substring(cusIdcard.length() - 6);
                        substring = DigestUtils.md5DigestAsHex(substring.getBytes());
                        tjCustomer.setCusPassword(substring);
                        tjCustomer.setTjType(tjReservation.getTjType());
                        tjCustomerService.save(tjCustomer);
                    }
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }else {
                throw new RuntimeException();
            }
        }else {
            throw new RuntimeException();
        }
    }