package com.fs.watch.controller;

import com.fs.common.core.domain.AjaxResult;
import com.fs.watch.domain.WatchRriData;
import com.fs.watch.service.WatchRriDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 房颤
 */
@RestController
@RequestMapping("/watch/rri/data")
public class WatchRriDataController {
    @Autowired
    private WatchRriDataService watchRriDataService;

    @PostMapping("/insert")
    public AjaxResult insertRriData(@RequestBody WatchRriData data){
        return AjaxResult.success(watchRriDataService.insert(data));
    }

    /**
     * 查询某天的数据,及分析结论
     * @param  date 日期
     * @param  deviceId 主键
     * @return 单条数据
     */
    @GetMapping("/queryByDateAndDeviceId")
    public AjaxResult queryByDateAndDeviceId(@RequestParam(value = "date",required = false) String date,
                                   @RequestParam(value = "deviceId") String deviceId) {
        return AjaxResult.success(this.watchRriDataService.queryByDateAndDeviceId(date,deviceId));
    }
}
