package com.fs.watch.controller;

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

@RestController
@RequestMapping("/watch/ecg/data")
public class WatchEcgDataController {
    @Autowired
    private WatchEcgDataService watchEcgDataService;


    @PostMapping("/insert")
    public AjaxResult insertEcgData(@RequestBody WatchEcgData data){
        return AjaxResult.success(watchEcgDataService.insert(data));
    }

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