package com.fs.watch.mapper;

import com.fs.common.annotation.DataSource;
import com.fs.common.enums.DataSourceType;
import com.fs.watch.domain.WatchBloodPressureData;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
* @author Administrator
* @description 针对表【watch_blood_pressure_data(设备血压数据)】的数据库操作Mapper
* @createDate 2024-10-15 11:06:50
* @Entity watch.domain.WatchBloodPressureData
*/
public interface WatchBloodPressureDataMapper{

    @DataSource(DataSourceType.CLICKHOUSE)
    void insert(@Param("data") WatchBloodPressureData data);

    @DataSource(DataSourceType.CLICKHOUSE)
    Integer queryByCreateTime(@Param("createTime") String createTime);

    @DataSource(DataSourceType.CLICKHOUSE)
    List<?> queryByDateAndDeviceId(@Param("date") String date, @Param("deviceId") String deviceId);

    @DataSource(DataSourceType.CLICKHOUSE)
    List<WatchBloodPressureData> queryBpByDate(@Param("startTime") String startTime, @Param("endTime") String endTime,
                                               @Param("deviceId") String deviceId, @Param("status") Integer status);

    @DataSource(DataSourceType.CLICKHOUSE)
    List<Map<String, Object>> countBpByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceId") String deviceId);

    @DataSource(DataSourceType.CLICKHOUSE)
    WatchBloodPressureData getLatest(@Param("deviceId") String deviceId);

    @DataSource(DataSourceType.CLICKHOUSE)
    int countBpPageByDate(@Param("startTime") String startTime,
                          @Param("endTime") String endTime,
                          @Param("deviceId") String deviceId,
                          @Param("status") Integer status);

    @DataSource(DataSourceType.CLICKHOUSE)
    List<WatchBloodPressureData> queryBgPageByDate(@Param("startTime") String startTime,
                                                   @Param("endTime") String endTime,
                                                   @Param("deviceId") String deviceId,
                                                   @Param("status") Integer status,
                                                   @Param("num") Integer num,
                                                   @Param("size") Integer size
    );
}
