package com.fs.watch.mapper;

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

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

/**
* @author Administrator
* @description 针对表【watch_blood_glucose_data(血糖数据)】的数据库操作Mapper
* @createDate 2024-10-15 11:06:50
* @Entity watch.domain.WatchBloodGlucoseData
*/
@DataSource(DataSourceType.CLICKHOUSE)
public interface WatchBloodGlucoseDataMapper{

    void insert(@Param("data")WatchBloodGlucoseData data);

    Integer queryByCreateTime(@Param("createTime") String createTime);

    List<WatchBloodGlucoseData> queryByDateAndDeviceId(@Param("date")String date, @Param("deviceId") String deviceId);

    List<WatchBloodGlucoseData> queryBgByDate(@Param("startTime")String startTime,@Param("endTime") String endTime,
                                              @Param("deviceId")String deviceId, @Param("status")Integer status);

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

    WatchBloodGlucoseData getLatest(@Param("deviceId")String deviceId);

    int countBgPageByDate(@Param("startTime")String startTime,
                          @Param("endTime") String endTime,
                          @Param("deviceId") String deviceId,
                          @Param("status")  Integer status);

    List<WatchBloodGlucoseData> 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
    );

    List<WatchBloodGlucoseData> queryByMonth(@Param("deviceId")String deviceId, @Param("monthStr")String monthStr);
}
