xuhy
2026-01-19 38c1973c9f0f7c53f165c3045d38509205552a51
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysAppUserController.java
@@ -88,7 +88,14 @@
    @PostMapping(value = "/pageList")
    public R<PageInfo<TSysAppUserVO>> pageList(@RequestBody TSysAppUserQuery query) {
        Integer roleType = tokenService.getLoginUser().getUser().getRoleType();
        Long userId = tokenService.getLoginUser().getUserId();
        query.setRoleType(roleType);
        if(roleType == 5){
            TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
                    .eq(TCrmClinic::getUserId, userId)
                    .last("LIMIT 1"));
            query.setClinicId(crmClinic.getId());
        }
        return R.ok(sysAppUserService.pageList(query));
    }
@@ -164,7 +171,7 @@
    @Log(title = "用户管理信息-新增用户管理", businessType = BusinessType.INSERT)
    @ApiOperation(value = "添加用户管理")
    @PostMapping(value = "/add")
    public R<Boolean> add(@Validated @RequestBody TSysAppUser dto) {
    public R<String> add(@Validated @RequestBody TSysAppUser dto) {
        if (sysAppUserService.isExit(dto)) {
            return R.fail("用户管理信息已存在");
        }
@@ -176,8 +183,11 @@
            SysUser sysUser = sysUserService.selectUserById(userId);
            crmClinic = crmClinicService.getById(sysUser.getObjectId());
        }
        String identifierNumber = UUID.randomUUID().toString().replace("-", "");
        dto.setIdentifierNumber(identifierNumber);
        dto.setClinicId(crmClinic.getId());
        return R.ok(sysAppUserService.save(dto));
        sysAppUserService.save(dto);
        return R.ok(dto.getId());
    }
    /**
@@ -210,7 +220,9 @@
            sysAppUserVO.setSysChronicDiseases(sysChronicDiseases);
        }
        // 查询检测信息
        List<TSysInspection> sysInspections = sysInspectionService.list(Wrappers.lambdaQuery(TSysInspection.class).eq(TSysInspection::getAppUserId, id));
        List<TSysInspection> sysInspections = sysInspectionService.list(Wrappers.lambdaQuery(TSysInspection.class)
                .eq(TSysInspection::getAppUserId, id)
                .orderByDesc(TSysInspection::getCreateTime));
        if(!CollectionUtils.isEmpty(sysInspections)){
            List<String> clinicIds = sysInspections.stream().map(TSysInspection::getClinicId).collect(Collectors.toList());
            List<TCrmClinic> clinicList = crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getId, clinicIds));
@@ -232,6 +244,13 @@
        sysAppUserVO.setSysInspections(sysInspections);
        // 订单信息
        List<TSysOrderVO> sysOrders = sysOrderService.queryListByAppUserId(id);
        for (TSysOrderVO sysOrder : sysOrders) {
            List<TSysInspection> tSysInspections = sysInspections.stream().filter(c -> c.getId().equals(sysOrder.getInspectionId())).collect(Collectors.toList());
            if(!CollectionUtils.isEmpty(tSysInspections)){
                TSysInspection sysInspection = tSysInspections.get(0);
                sysOrder.setSysInspection(sysInspection);
            }
        }
        sysAppUserVO.setSysOrders(sysOrders);
        if(sysAppUserVO.getBirthTime() != null){
            long age = ChronoUnit.YEARS.between(sysAppUserVO.getBirthTime(), LocalDateTime.now());
@@ -246,7 +265,7 @@
    @ApiOperation(value = "根据用户id查询检测信息")
    @GetMapping(value = "/getInspectionByAppUserId")
    public R<List<TSysInspection>> getInspectionByAppUserId(@RequestParam String appUserId) {
        // 订单信息
        // 检测信息
        List<TSysInspection> sysInspections = sysInspectionService.list(Wrappers.lambdaQuery(TSysInspection.class).eq(TSysInspection::getAppUserId, appUserId));
        return R.ok(sysInspections);
    }