zjh
2024-12-17 f20eab3d08011a159e728f5dbfd3197b8ba84d09
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -629,147 +629,19 @@
    @ApiOperation(value = "体检报告页面——体检记录列表")
    public AjaxResult getOrderListOO(@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum,
                                     @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize,
                                     @ApiParam(value = "打印未打印状态 0未打印 1已打印") @RequestParam(defaultValue = "0") Integer dyzt,
                                     @ApiParam(value = "打印未打印状态 0未打印 1已打印") @RequestParam(required = false) Integer dyzt,
                                     @ApiParam(value = "体检号)") @RequestParam(required = false) String tjNum,
                                     @ApiParam(value = "姓名)") @RequestParam(required = false) String name,
                                     @ApiParam(value = "单位") @RequestParam(required = false) String dw,
                                     @ApiParam(value = "报告开始时间") @RequestParam(required = false) String djbeginTime,
                                     @ApiParam(value = "报告结束时间") @RequestParam(required = false) String djendTime) {
        Map<String, Object> map = new HashMap<>();
                                    /*        Map<String, Object> map = new HashMap<>();
        List<Long> cusIds = null;
        if (StringUtil.isNotBlank(name)) {
            LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
            wqq.like(TjCustomer::getCusName, name);
            cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList());
//            if (null != customerList && !customerList.isEmpty()) {
//                List<TjOrder> list = new ArrayList<>();
//                for (TjCustomer customer : customerList) {
//                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
//                    wq.eq(TjOrder::getUserId, customer.getCusId());
//                    if (dyzt == 0) {
//                        wq.isNull(TjOrder::getPrintLastTime);
//                        wq.eq(TjOrder::getHeshouStatus, 1);
//                    } else {
//                        wq.isNotNull(TjOrder::getPrintLastTime);
//                    }
//                    list.addAll(tjOrderService.list(wq));
//                }
//                List<TjOrder> collect = null;
//                if (!list.isEmpty()) {
//
//                    for (int i = 0; i < list.size(); i++) {
//                        TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
//                        if (null == tjCustomer) {
//                            list.remove(list.get(i));
//                            continue;
//                        }
//                        list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
//                        list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
//                        list.get(i).setTjCustomerName(tjCustomer.getCusName());
//                        list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone());
//                        list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard());
//
//                        if (null != tjCustomer.getCompName()) {
//                            list.get(i).setDictCompName(tjCustomer.getCompName());
//                        } else {
//                            String firmId = list.get(i).getFirmId();
//                            if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
//                                list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
//                            }
//                        }
//
//                        if (null != list.get(i).getPacId()) {
//                            if (null != tjPackageService.getById(list.get(i).getPacId())) {
//                                list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName());
//                            }
//                            if (null != dwDeptService.getById(list.get(i).getPacId())) {
//                                list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName());
//                            }
//                        }
//                    }
//                    collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
//                }
//                if (null != collect) {
//                    map.put("total", collect.size());
//                } else {
//                    map.put("total", 0);
//                }
//                if (collect == null) collect = new ArrayList<>();
//                map.put("list", collect);
//                return AjaxResult.success(map);
//            }
        }
//        if (StringUtil.isNotBlank(dw)) {
//            LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
//            wqq.like(TjCustomer::getCompName, dw);
//            List<TjCustomer> customerList = tjCustomerService.list(wqq);
//            List<TjOrder> list = new ArrayList<>();
//            if (null != customerList && !customerList.isEmpty()) {
//                for (TjCustomer customer : customerList) {
//                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
//                    wq.eq(TjOrder::getUserId, customer.getCusId());
//                    if (dyzt == 0) {
//                        wq.isNull(TjOrder::getPrintLastTime);
//                        wq.eq(TjOrder::getHeshouStatus, 1);
//                    } else {
//                        wq.isNotNull(TjOrder::getPrintLastTime);
//                    }
//                    list.addAll(tjOrderService.list(wq));
//                }
//            }
//            List<String> dwIds = iDictCompService.getdwIdByDwName(dw);
//
//            LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
//            wq.in(TjOrder::getFirmId, dwIds);
//            list.addAll(tjOrderService.list(wq));
//            List<TjOrder> collect = null;
//            if (!list.isEmpty()) {
//                List<TjOrder> orders = list.stream().distinct().collect(Collectors.toList());
//                for (int i = 0; i < orders.size(); i++) {
//                    TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
//                    if (null == tjCustomer) {
//                        list.remove(list.get(i));
//                        continue;
//                    }
//                    list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
//                    list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
//                    list.get(i).setTjCustomerName(tjCustomer.getCusName());
//                    list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone());
//                    list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard());
//
//                    if (null != tjCustomer.getCompName()) {
//                        list.get(i).setDictCompName(tjCustomer.getCompName());
//                    } else {
//                        String firmId = list.get(i).getFirmId();
//                        if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
//                            list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
//                        }
//                    }
//
//                    if (null != list.get(i).getPacId()) {
//                        if (null != tjPackageService.getById(list.get(i).getPacId())) {
//                            list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName());
//                        }
//                        if (null != dwDeptService.getById(list.get(i).getPacId())) {
//                            list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName());
//                        }
//                    }
//                }
//                collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
//            }
//            if (null != collect) {
//                map.put("total", collect.size());
//            } else {
//                map.put("total", 0);
//            }
//            map.put("list", collect);
//            return AjaxResult.success(map);
//
//
//        }
        Page<TjOrder> page1 = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
        if (dyzt == 0) {
@@ -837,7 +709,11 @@
            }
        }
        map.put("list", list);
        map.put("total", page2.getTotal());
        map.put("total", page2.getTotal());*/
        if (djbeginTime == null) djbeginTime = "";
        if (djendTime == null) djendTime = "";
        Map<String, Object> map=  tjOrderService.getTjBgdyList(pageNum,pageSize,dyzt,tjNum,name,dw,djbeginTime,djendTime);
        return AjaxResult.success(map);
    }
@@ -3346,42 +3222,85 @@
    }
    @GetMapping("/zongjanyemianshjianzhou")
    @PostMapping("/zongjanyemianshjianzhou")
    @ApiOperation(value = "总检获取时间轴接口")
    @Transactional
    public AjaxResult zongjanyemianshjianzhou(@RequestParam String tjNUm) {
        TjOrder order = tjOrderService.getOrderByTjNum(tjNUm);
        if (null != order) {
            int czwj = remarkService.panduaniscunzaiweijian(tjNUm);
            int sfwc = remarkService.panduaniswancheng(tjNUm);
            Date checkTime = order.getCheckTime();
            Date reportTime = order.getReportTime();
            Integer heshouStatus = order.getHeshouStatus();
            Date lastTime = order.getPrintLastTime();
            int a=0;
            if (czwj == 0) {
                //未检
                a=0;
            } else if (czwj > 0) {
                //在检
                a=1;
            } else if (sfwc == 0) {
                //已完成
                a=2;
            } else if (null != checkTime) {
                //已审核
                a=3;
            } else if (null != reportTime) {
                //生成报告
                a=4;
            } else if (null != heshouStatus) {
                //报告核收
                a=5;
            } else if (null != lastTime) {
                //已出报告
                a=6;
    public AjaxResult zongjanyemianshjianzhou(@RequestBody List<String> tjNUms) {
        if(null !=tjNUms && !tjNUms.isEmpty()){
            List<Map<String,Object>> list=new ArrayList<>();
            for (String tjNUm : tjNUms) {
                Map<String,Object> map=new HashMap<>();
                TjOrder order = tjOrderService.getOrderByTjNum(tjNUm);
                if (null != order) {
                    int czwj = remarkService.panduaniscunzaiweijian(tjNUm);
                    int sfwc = remarkService.panduaniswancheng(tjNUm);
                    Date checkTime = order.getCheckTime();
                    Date reportTime = order.getReportTime();
                    Integer heshouStatus = order.getHeshouStatus();
                    Date lastTime = order.getPrintLastTime();
                    int a=0;
                    if (czwj == 0) {
                        //未检
                        a=0;
                    }
                    if (czwj > 0) {
                        //在检
                        a=1;
                    }
                    if (sfwc == 0) {
                        //已完成
                        a=2;
                    }
                    if (null != checkTime) {
                        //已审核
                        a=3;
                    }
                    if (null != reportTime) {
                        //生成报告
                        a=4;
                    }
                    if (null != heshouStatus) {
                        //报告核收
                        a=5;
                    }
                    if (null != lastTime) {
                        //已出报告
                        a=6;
                    }
                    map.put("tjNUm",tjNUm);
                    map.put("sjz",a);
                    list.add(map);
            }
            return AjaxResult.success(a);
        }
            return AjaxResult.success(list);
        }
        return AjaxResult.error();
    }
    @PostMapping("/heshouchexiao")
    @ApiOperation(value = "核收撤销接口")
    @Transactional
    public AjaxResult heshouchexiao(@RequestBody List<String> tjNUms) {
        if(null !=tjNUms && !tjNUms.isEmpty()){
            for (String tjNUm : tjNUms) {
                TjOrder order = tjOrderService.getOrderByTjNum(tjNUm);
                if(null !=order){
                    order.setHeshouStatus(0);
                    order.setHeshouTime(null);
                    order.setHeshouDoctor(null);
                    order.setPrintLastTime(null);
                    order.setStatus(TjConstants.TJ_WAIT);
                    if (!tjOrderService.updateById(order)) {
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                        return AjaxResult.error("操作失败");
                    }
                }
            }
            return AjaxResult.success("操作成功");
        }
        return AjaxResult.error();
    }