| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @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("用户管理信息已存在"); |
| | | } |
| | |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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)); |
| | |
| | | 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()); |
| | |
| | | @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); |
| | | } |