lige
2024-01-25 6edab72ee16e3c173a813cec6cefa5af03147f97
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
@@ -122,7 +122,6 @@
            return AjaxResult.error("请输入科室id");
        }
        //根据当前登陆的人的科室id,获取该科室下的所有项目
        // TODO: 2023/3/24  给超级管理员赋医生检查权限
        List<Long> postIds = sysUser.getPostIds();
        List<Long> ksproList = null;
        if (postIds != null) {
@@ -417,7 +416,7 @@
     * 化验检查页面列表
     */
    @GetMapping("/huaYangetProList")
    @ApiOperation("影像/化验检查页面列表")
    @ApiOperation("化验检查页面列表")
    public AjaxResult huaYangetProList(@ApiParam(value = "体检单号") @RequestParam(required = false) String tjNumber,
                                 @ApiParam(value = "0未检,1已检") @RequestParam(defaultValue = "0") Integer type,
                                 @ApiParam(value = "姓名)") @RequestParam(required = false) String name,
@@ -436,7 +435,6 @@
            return AjaxResult.error("请输入科室id");
        }
        //根据当前登陆的人的科室id,获取该科室下的所有项目
        // TODO: 2023/3/24  给超级管理员赋医生检查权限
        List<Long> postIds = sysUser.getPostIds();
        List<Long> ksproList = null;
        if (postIds != null) {
@@ -454,10 +452,14 @@
        } else {
            ksproList = projectService.getKsTjProjectIdList();
        }
        if (ksproList == null || ksproList.size() == 0) {
            return AjaxResult.error("请完善科室项目信息");
        }
        //筛选化验的项目。
        ksproList = ksproList.stream()
                .filter(element -> element ==1633660948860522629L)
                .collect(Collectors.toList());
        List<TjCustomer> customerLis = new ArrayList<>();
        //根据体检号查
@@ -596,26 +598,238 @@
                return AjaxResult.success("暂无数据");
            }
        }
        List<TjCustomer> customerLists = new ArrayList<>();
        List<TjCustomer> customerLists = null;
        if (type == 0) {
            customerLists = redisCache.getCacheMapValue(ksId + "ks", "wj");
//            customerLists = redisCache.getCacheMapValue(ksId + "ks", "wj");
        }
        if (type == 1) {
            customerLists = redisCache.getCacheMapValue(ksId + "ks", "yj");
//            customerLists = redisCache.getCacheMapValue(ksId + "ks", "yj");
        }
        asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId));
        if (customerLists != null && customerLists.size() > 0) {
            Collections.reverse(customerLists);
            List<TjCustomer> customerList = customerLists.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
            Map<String, Object> map = new HashMap<>();
            map.put("date", customerList);
            map.put("total", customerLists.size());
            return AjaxResult.success(map);
        AjaxResult map = getAjaxResult(type, page, pageSize, ksproList, customerLis);
        if (map != null) return map;
        return AjaxResult.success("暂时没有数据");
    }
    /**
     * 影像检查页面列表
     */
    @GetMapping("/yingXiangGetProList")
    @ApiOperation("影像检查页面列表")
    public AjaxResult yingXiangGetProList(@ApiParam(value = "体检单号") @RequestParam(required = false) String tjNumber,
                                       @ApiParam(value = "0未检,1已检") @RequestParam(defaultValue = "0") Integer type,
                                       @ApiParam(value = "姓名)") @RequestParam(required = false) String name,
                                       @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page,
                                       @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) {
        String userId = SecurityUtils.getLoginUser().getUserId();
        Integer ksId = null;
        SysUser sysUser = null;
        if (null != userId) {
            sysUser = userService.getById(Long.valueOf(userId));
            if (null != sysUser) {
                ksId = Math.toIntExact(sysUser.getDeptId());
            }
        }
        if (ksId == null) {
            return AjaxResult.error("请输入科室id");
        }
        //根据当前登陆的人的科室id,获取该科室下的所有项目
        List<Long> postIds = sysUser.getPostIds();
        List<Long> ksproList = null;
        if (postIds != null) {
            for (Long postId : postIds) {
                LambdaQueryWrapper<SysUserPost> wq111 = new LambdaQueryWrapper<>();
                wq111.eq(SysUserPost::getPostId, postId);
                SysUserPost one = userPostService.getOne(wq111);
                if (one != null) {
                    SysPost byId = postService.getById(one.getPostId());
                    if (byId.getPostName().equals("录入员")) {
                        ksproList = projectService.getKsTjProjectIdListBydeptId(String.valueOf(ksId));
                    }
                }
            }
        } else {
            ksproList = projectService.getKsTjProjectIdList();
        }
        //筛选影像的项目。
        if (ksproList.size() == 0) {
            return AjaxResult.error("请完善科室项目信息");
        }
        ksproList = ksproList.stream()
                .filter(element -> element ==1633660948860522589L
//                        ||  element ==1633660948860522504L
//                        ||
//                        element ==1633660948860522507L||  element ==1633660948860522508L
//                        ||
//                        element ==1633660948860522515L||  element ==1633660948860522516L
//                        ||
//                        element ==1633660948860522517L||  element ==1633660948860522519L
//                        ||
//                        element ==1633660948860522524L||  element ==1633660948860522530L
//                        ||
//                        element ==1633660948860522531L||  element ==1633660948860522533L
                )
                .collect(Collectors.toList());
        List<TjCustomer> customerLis = new ArrayList<>();
        //根据体检号查
        if (null != tjNumber) {
            List<TjOrder> orderList = orderService.getOrderListByLikeTjNum(tjNumber);
            if (null == orderList) {
                return AjaxResult.success("暂时没有数据");
            }
            for (TjOrder order : orderList) {
                List<TjOrderDetail> list = Optional.ofNullable(detailService.getTjOrderDetailListByOrderId(String.valueOf(order.getOrderId()))).get();
                if (list.size() == 0) {
                    continue;
                }
                LambdaQueryWrapper<TjOrderRemark> wqs = new LambdaQueryWrapper<>();
                wqs.eq(TjOrderRemark::getTjNumber, order.getTjNumber());
                wqs.in(TjOrderRemark::getType, 0,3);
                List<TjOrderRemark> lists = remarkService.list(wqs);
                TjCustomer customer = customerService.getById(order.getUserId());
                //遍历项目 判断是否有重大阳性  标记
                for (TjOrderDetail tjOrderDetail11 : list) {
                    customer.setIsPositive(tjOrderDetail11.getIsPositive());
                    if (tjOrderDetail11.getIsPositive()==1){
                        break;
                    }
                }
                customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
                customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                if (null != lists && lists.size() > 0) {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (TjOrderRemark remark : lists) {
                        TjProject byId = projectService.selectTjProjectByProId(remark.getProId());
                        TjOrderDetail one = detailService.getTjOrderDetailByOrderId(String.valueOf(order.getOrderId()), String.valueOf(byId.getProId()));
                        if (one.getFlowingWaterId() != null) {
                            stringBuilder.append(byId.getProName()).append(";");
                        }
                    }
                    customer.setNotCheckeds(String.valueOf(stringBuilder));
                    customer.setTjStatus(0L);
                } else {
                    customer.setTjStatus(1L);
                    customer.setNotCheckeds("无");
                }
                if (order.getTjType().equals("1")) {
                    customer.setTjType("团体");
                }
                if (order.getTjType().equals("2")) {
                    customer.setTjType("个人");
                }
                customer.setTjTime(order.getCreateTime());
                customer.setTjNumber(order.getTjNumber());
                customer.setOrderId(order.getOrderId());
                customer.setIsHz(order.getIsHz());
                customerLis.add(customer);
            }
            if (customerLis.size() > 0) {
                List<TjCustomer> customerList = customerLis.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
                Collections.reverse(customerList);
                Map<String, Object> map = new HashMap<>();
                map.put("date", customerList);
                map.put("total", customerLis.size());
                return AjaxResult.success(map);
            } else {
                return AjaxResult.success("暂无数据");
            }
        }
        //根据姓名查询
        if (null != name && !"".equals(name)) {
            LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
            wq.like(TjCustomer::getCusName, name);
            List<TjCustomer> list = customerService.list(wq);
            List<TjCustomer> list11111 = new ArrayList<>();
            if (null != list && list.size() > 0) {
                for (TjCustomer customer : list) {
                    customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
                    customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                    customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                    List<TjOrder> orderList = orderService.getOrderListByCusId(String.valueOf(customer.getCusId()));
                    if (null != orderList && orderList.size() > 0) {
                        for (TjOrder order : orderList) {
                            List<TjOrderDetail> list111 = Optional.ofNullable(detailService.getTjOrderDetailListByOrderId(String.valueOf(order.getOrderId()))).get();
                            if (list111.size() == 0) {
                                continue;
                            }
                            //遍历项目 判断是否有重大阳性  标记
                            for (TjOrderDetail tjOrderDetail11 : list111) {
                                customer.setIsPositive(tjOrderDetail11.getIsPositive());
                                if (tjOrderDetail11.getIsPositive()==1){
                                    break;
                                }
                            }
                            List<TjOrderRemark> lists = remarkService.getTjOrderRemarkListByYjNum(order.getTjNumber());
                            if (null != lists && lists.size() > 0) {
                                StringBuilder stringBuilder = new StringBuilder();
                                for (TjOrderRemark remark : lists) {
                                    TjProject byId = projectService.selectTjProjectByProId(remark.getProId());
                                    TjOrderDetail one = detailService.getTjOrderDetailByOrderId(String.valueOf(order.getOrderId()), String.valueOf(byId.getProId()));
                                    if (one.getFlowingWaterId() != null) {
                                        stringBuilder.append(byId.getProName()).append(";");
                                    }
                                }
                                customer.setNotCheckeds(String.valueOf(stringBuilder));
                                if (null == customer.getNotCheckeds()) customer.setNotCheckeds("全部已检");
                                customer.setTjStatus(0L);
                            } else {
                                customer.setNotCheckeds("无");
                                customer.setTjStatus(1L);
                            }
                            if (order.getTjType().equals("1")) {
                                customer.setTjType("团体");
                            }
                            if (order.getTjType().equals("2")) {
                                customer.setTjType("个人");
                            }
                            customer.setTjTime(order.getCreateTime());
                            customer.setTjNumber(order.getTjNumber());
                            customer.setOrderId(order.getOrderId());
                            customer.setIsHz(order.getIsHz());
                            list11111.add(customer);
                        }
                    }
                }
                if (list11111.size() == 0) {
                    return AjaxResult.success("暂无数据");
                }
                Map<String, Object> map = new HashMap<>();
                List<TjCustomer> customers = list11111.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
                Collections.reverse(customers);
                map.put("customers", customers);
                map.put("total", list11111.size());
                return AjaxResult.success(map);
            } else {
                return AjaxResult.success("暂无数据");
            }
        }
        List<TjCustomer> customerLists = null;
        if (type == 0) {
//            customerLists = redisCache.getCacheMapValue(ksId + "ks", "wj");
        }
        if (type == 1) {
//            customerLists = redisCache.getCacheMapValue(ksId + "ks", "yj");
        }
//        asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId));
//        if (customerLists.size() > 0) {
//            Collections.reverse(customerLists);
//            List<TjCustomer> customerList = customerLists.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
//            Map<String, Object> map = new HashMap<>();
//            map.put("date", customerList);
//            map.put("total", customerLists.size());
//            return AjaxResult.success(map);
//        } else {
            AjaxResult map = getAjaxResult(type, page, pageSize, ksproList, customerLis);
            if (map != null) return map;
            return AjaxResult.success("暂时没有数据");
        }
//        }
    }
@@ -837,7 +1051,6 @@
            final TjCustomer byId1 = customerService.getById(order.getUserId());
            if (null != tjOrderDetailList && tjOrderDetailList.size() > 0) {
                // TODO: 2023/8/31 存入每一小项的结果和结论
                //----------------------------------start
                for (TjOrderDetail tjOrderDetail : tjOrderDetailList) {
                    final TjProject byId = projectService.getById(tjOrderDetail.getProId());