调整查询心电数据
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run

This commit is contained in:
Flow 2025-09-05 10:06:09 +08:00
parent 22ef44a772
commit c574d6a774
3 changed files with 7 additions and 37 deletions

View File

@ -108,31 +108,18 @@ public class EcgdataController {
}
@GetMapping("/getByTime")
@Operation(summary = "根据时间戳和用户ID获得心电数据聚合图片URL")
@Operation(summary = "根据时间戳和用户ID获得心电数据")
@Parameter(name = "collecttime", description = "采集时间戳", required = true)
@Parameter(name = "userId", description = "用户编号", required = true)
public CommonResult<EcgdataTimeImageRespVO> getEcgdataByTime(@RequestParam("collecttime") Long collecttime,
@RequestParam("userId") Integer userId) {
List<EcgdataDO> ecgdataList = ecgdataService.getEcgdataListByTime(collecttime, userId);
public CommonResult<EcgdataRespVO> getEcgdataByTime(@RequestParam("collecttime") Long collecttime,
@RequestParam("userId") Integer userId) {
EcgdataDO ecgdata = ecgdataService.getEcgdataByTime(collecttime, userId);
if (ecgdataList == null || ecgdataList.isEmpty()) {
if (ecgdata == null) {
return success(null);
}
// 取第一条记录作为基础数据
EcgdataDO firstEcgdata = ecgdataList.get(0);
EcgdataTimeImageRespVO result = BeanUtils.toBean(firstEcgdata, EcgdataTimeImageRespVO.class);
// 聚合所有的图片URL
List<String> imageUrls = new ArrayList<>();
for (EcgdataDO ecgdata : ecgdataList) {
if (ecgdata.getEcgimageurl() != null && !ecgdata.getEcgimageurl().trim().isEmpty()) {
imageUrls.add(ecgdata.getEcgimageurl());
}
}
result.setEcgimageurls(imageUrls);
return success(result);
return success(BeanUtils.toBean(ecgdata, EcgdataRespVO.class));
}
}

View File

@ -71,16 +71,7 @@ public interface EcgdataService {
EcgdataDO getEcgdataByTime(Long collecttime, Integer userId);
/**
* 根据时间戳和用户ID获得心电数据采集列表聚合图片URL
*
* @param collecttime 采集时间戳
* @param userId 用户编号
* @return 聚合后的心电数据采集
*/
List<EcgdataDO> getEcgdataListByTime(Long collecttime, Integer userId);
/**
* 根据用户ID获得去重的心电采集时间列表
* 根据用户ID获得心电数据采集去重时间列表
*
* @param userId 用户编号
* @return 去重的采集时间列表

View File

@ -88,14 +88,6 @@ public class EcgdataServiceImpl implements EcgdataService {
.orderByDesc(EcgdataDO::getId));
}
@Override
public List<EcgdataDO> getEcgdataListByTime(Long collecttime, Integer userId) {
return ecgdataMapper.selectList(new LambdaQueryWrapperX<EcgdataDO>()
.eq(EcgdataDO::getUserid, userId)
.eq(EcgdataDO::getCollecttime, new Date(collecttime))
.orderByDesc(EcgdataDO::getId));
}
@Override
public List<LocalDateTime> getDistinctCollectTimeByUserId(Integer userId) {
return ecgdataMapper.selectDistinctCollectTimeByUserId(userId);