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
*/
@DataSource(DataSourceType.CLICKHOUSE)
public interface WatchBloodPressureDataMapper{

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

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

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

    List<WatchBloodPressureData> queryBpByDate(@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);

    Map<String, Integer> countMaxAndMinBpByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceId") String deviceId);

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

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

    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
    );
}
