package com.fs.watch.controller;

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

/**
 * 血压
 */
@RestController
@RequestMapping("/watch/blood/pressure")
public class WatchBloodPressureDataController {

    @Autowired
    private WatchBloodPressureDataService watchBloodPressureDataService;

    @Autowired
    private WatchThirdBpDataService watchThirdBpDataService;

    @PostMapping("/insert")
    public AjaxResult insertBloodPressureData(@RequestBody WatchBloodPressureData data){
        return AjaxResult.success(watchBloodPressureDataService.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.watchBloodPressureDataService.queryByDateAndDeviceId(date,deviceId));
        return AjaxResult.success(this.watchThirdBpDataService.queryByDateAndDeviceId(date,deviceId));
    }
}
