zjh
2023-10-12 8cde7ee1143bae70eb68d2b75f572d5b4dbadf98
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjFlowingWaterController.java
@@ -104,7 +104,7 @@
    /**
     * 查询体检流水列表
     */
    @PreAuthorize("@ss.hasPermi('hosp:water:list')")
//    @PreAuthorize("@ss.hasPermi('hosp:water:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询体检流水列表")
    public TableDataInfo list(TjFlowingWater tjFlowingWater) {
@@ -254,127 +254,11 @@
        return AjaxResult.error();
    }
   /* private void extracted(TjFlowingWater tjFlowingWater, TjOrder order, TjCustomer customer) {
        List<TjConsumables> list2 = new ArrayList<>();
        String[] tjProIds = tjFlowingWater.getTjProIds();
        for (String tjProId : tjProIds) {
            LambdaQueryWrapper<TjProject> wq0 = new LambdaQueryWrapper<>();
            wq0.eq(TjProject::getProParentId, tjProId);
            List<Long> proIds = projectService.list(wq0).stream().map(TjProject::getProId).collect(Collectors.toList());
            TjOrderDetail detail = new TjOrderDetail();
            detail.setTjStatus(0L);
            detail.setOrderId(tjFlowingWater.getOrderId());
            detail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber()));
            detail.setProId(Long.valueOf(tjProId));
            detail.setIsAddition("Y");
            detailService.save(detail);
            for (Long proId : proIds) {
                TjOrderDetail detail1 = new TjOrderDetail();
                detail1.setTjStatus(0L);
                detail1.setOrderId(tjFlowingWater.getOrderId());
                detail1.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber()));
                detail1.setProId(proId);
                detail1.setIsAddition("Y");
                detailService.save(detail1);
            }
            LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>();
            wqq.eq(TbTransition::getCusId, customer.getCusIdcard());
            wqq.in(TbTransition::getProId, proIds);
            List<TbTransition> tbTransitionList = transitionService.list(wqq);
            if (null != tbTransitionList && tbTransitionList.size() > 0) {
                for (TbTransition transition : tbTransitionList) {
                    TjProject tjProject = projectService.selectTjProjectByProId(transition.getProId());
                    //子项
                    if (null != tjProject) {
                        TjChargingStandard tjChargingStandard = new TjChargingStandard();
                        tjChargingStandard.setTjNum(order.getTjNumber());
                        tjChargingStandard.setProId(transition.getProId());
                        tjChargingStandard.setPrice(transition.getNowPrice());
                        tjChargingStandard.setProName(tjProject.getProName());
                        chargingStandardService.save(tjChargingStandard);
                    }
                }
                //父项
                TjProject parentProject = projectService.getById(tjProId);
                if (null != parentProject) {
                    LambdaQueryWrapper<TjProConsumables> wqqq = new LambdaQueryWrapper<>();
                    wqqq.eq(TjProConsumables::getProId, parentProject.getProId());
                    List<TjProConsumables> proConsumables = proConsumablesService.list(wqqq);
                    if (null != proConsumables && proConsumables.size() > 0) {
                        for (TjProConsumables tjProConsumables : proConsumables) {
                            TjConsumables tjConsumables = consumablesService.selectTjConsumablesById(tjProConsumables.getConsumablesId());
                            list2.add(tjConsumables);
                        }
                    }
                }
            }
        }
        //父项耗材
        ArrayList<TjConsumables> collect = list2.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TjConsumables::getId))), ArrayList::new));
        for (TjConsumables tjConsumables : collect) {
            TjChargingStandard tjChargingStandard = new TjChargingStandard();
            tjChargingStandard.setTjNum(order.getTjNumber());
            tjChargingStandard.setConsumablesId(tjConsumables.getId());
            tjChargingStandard.setPrice(tjConsumables.getPrice());
            tjChargingStandard.setProName(tjConsumables.getMakings());
            tjChargingStandard.setConsumablesName(tjConsumables.getMakings());
            tjChargingStandard.setCompany(tjConsumables.getSpecifications());
            chargingStandardService.save(tjChargingStandard);
        }
    }*/
    //备用添加收费明细
    /*private void extracted(TjOrder order, List<TjConsumables> list2, List<TbTransition> tbTransitionList) {
        for (TbTransition transition : tbTransitionList) {
            TjProject tjProject = projectService.selectTjProjectByProId(transition.getProId());
            //子项
            if (null != tjProject) {
                TjChargingStandard tjChargingStandard = new TjChargingStandard();
                tjChargingStandard.setTjNum(order.getTjNumber());
                tjChargingStandard.setProId(transition.getProId());
                tjChargingStandard.setPrice(transition.getNowPrice());
                tjChargingStandard.setProName(tjProject.getProName());
                chargingStandardService.save(tjChargingStandard);
            }
        }
        //父项
        ArrayList<TbTransition> collect1 = tbTransitionList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TbTransition::getParentProId))), ArrayList::new));
        List<Long> parentProIds = collect1.stream().map(TbTransition::getParentProId).collect(Collectors.toList());
        if (parentProIds.size() > 0) {
            for (Long parentProId : parentProIds) {
                TjProject parentProject = projectService.selectTjProjectByProId(parentProId);
                if (null != parentProject) {
                    LambdaQueryWrapper<TjProConsumables> wqqq = new LambdaQueryWrapper<>();
                    wqqq.eq(TjProConsumables::getProId, parentProject.getProId());
                    List<TjProConsumables> proConsumables = proConsumablesService.list(wqqq);
                    if (null != proConsumables && proConsumables.size() > 0) {
                        for (TjProConsumables tjProConsumables : proConsumables) {
                            TjConsumables tjConsumables = consumablesService.selectTjConsumablesById(tjProConsumables.getConsumablesId());
                            list2.add(tjConsumables);
                        }
                    }
                }
            }
        }
        ArrayList<TjConsumables> collect = list2.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TjConsumables::getId))), ArrayList::new));
        for (TjConsumables tjConsumables : collect) {
            TjChargingStandard tjChargingStandard = new TjChargingStandard();
            tjChargingStandard.setTjNum(order.getTjNumber());
            tjChargingStandard.setConsumablesId(tjConsumables.getId());
            tjChargingStandard.setPrice(tjConsumables.getPrice());
            tjChargingStandard.setProName(tjConsumables.getMakings());
            tjChargingStandard.setConsumablesName(tjConsumables.getMakings());
            tjChargingStandard.setCompany(tjConsumables.getSpecifications());
            chargingStandardService.save(tjChargingStandard);
        }
    }*/
    /**
     * 删除体检流水
     */
    @PreAuthorize("@ss.hasPermi('hosp:water:remove')")
//    @PreAuthorize("@ss.hasPermi('hosp:water:remove')")
    @Log(title = "体检流水", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
@@ -534,7 +418,7 @@
                                tjRefundVo.setTjName(MatchUtils.hideCusName(customer.getCusName()));
                                tjRefundVo.setTjPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                                tjRefundVo.setSex(String.valueOf(customer.getCusSex()));
                                tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                               if(null !=customer.getCusIdcard()) tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                                DictComp dictComp = compService.getById(order.getFirmId());
                                if(null !=dictComp){
                                    tjRefundVo.setTjComp(dictComp.getCnName());
@@ -655,18 +539,28 @@
                if (null != tjProjectList && tjProjectList.size() > 0) {
                    for (TjProject project : tjProjectList) {
                        if (project.getProParentId() == 0) {
                            LambdaQueryWrapper<TbTransition> wqq1 = new LambdaQueryWrapper<>();
                            wqq1.eq(TbTransition::getCusId, customerService.getById(order.getUserId()).getCusIdcard());
                            wqq1.eq(TbTransition::getParentProId, project.getProId());
                            List<TbTransition> tbTransitionList = transitionService.list(wqq1);
                            BigDecimal bigDecimal = new BigDecimal("0.00");
                            BigDecimal bigDecimal1 = new BigDecimal("0.00");
                            for (TbTransition transition : tbTransitionList) {
                                 bigDecimal = bigDecimal.add(transition.getNowPrice());
                                 bigDecimal1=bigDecimal1.add(transition.getOrdPrice());
                            //                            LambdaQueryWrapper<TbTransition> wqq1 = new LambdaQueryWrapper<>();
//                            wqq1.eq(TbTransition::getCusId, customerService.getById(order.getUserId()).getCusIdcard());
//                            wqq1.eq(TbTransition::getParentProId, project.getProId());
//                            List<TbTransition> tbTransitionList = transitionService.list(wqq1);
//                            BigDecimal bigDecimal = new BigDecimal("0.00");
//                            BigDecimal bigDecimal1 = new BigDecimal("0.00");
//                            for (TbTransition transition : tbTransitionList) {
//                                 bigDecimal = bigDecimal.add(transition.getNowPrice());
//                                 bigDecimal1=bigDecimal1.add(transition.getOrdPrice());
//                            }
//                            project.setProPrice(bigDecimal.setScale(0,BigDecimal.ROUND_UP));
//                            project.setProOrdPrice(bigDecimal1);
                            BigDecimal decimal = transitionService.getTbTransitionPriceAndOrdPrice(customerService.getById(order.getUserId()).getCusIdcard(),
                                    project.getProId());
                            String s = tjFlowingWaterService.getDiscount(OrderId);
                            if(null !=decimal){
                                project.setProPrice(decimal.setScale(2));
                                project.setProOrdPrice(decimal.multiply(new BigDecimal(s)).setScale(2));
                            }else {
                                project.setProPrice(new BigDecimal("0.00"));
                                project.setProOrdPrice(new BigDecimal("0.00"));
                            }
                            project.setProPrice(bigDecimal.setScale(0,BigDecimal.ROUND_UP));
                            project.setProOrdPrice(bigDecimal1);
                        }
                    }
                }