package com.fs.app.controller;

import com.fs.app.annotation.Login;
import com.fs.common.annotation.RepeatSubmit;
import com.fs.common.core.domain.R;
import com.fs.patient.param.BindPatientParam;
import com.fs.patient.param.FsProjectSendRewardUParam;
import com.fs.patient.param.FsProjectVideoFinishUParam;
import com.fs.patient.service.IFsPatientBaseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api("患者基本信息接口")
@RestController
@RequestMapping(value="/app/patientBase")
public class PatientBaseInfoController extends  AppBaseController {

    @Autowired
    private IFsPatientBaseInfoService fsPatientBaseInfoService;


    @Login
    @ApiOperation("患者信息")
    @GetMapping("/detail")
    public R detail(@RequestParam Long patientId){
        Long userId = Long.parseLong(getUserId());
        return fsPatientBaseInfoService.getPatientBaseInfoDetail(patientId,userId);
    }

    @Login
    @ApiOperation("绑定患者信息")
    @PostMapping("/bind")
    public R bind(@RequestBody BindPatientParam param){
        param.setUserId(Long.parseLong(getUserId()));
        return fsPatientBaseInfoService.patientBindUser(param);
    }

    @Login
    @ApiOperation("发放理疗奖励")
    @PostMapping("/sendProjectReward")
    @RepeatSubmit
    public R sendProjectReward(@RequestBody FsProjectSendRewardUParam param){
        param.setUserId(Long.parseLong(getUserId()));
        return fsPatientBaseInfoService.sendProjectReward(param);
    }

    @Login
    @ApiOperation("获取缓冲流量")
    @PostMapping("/getInternetTraffic")
    public R getInternetTraffic(@RequestBody FsProjectVideoFinishUParam param){
        param.setUserId(Long.parseLong(getUserId()));
        return fsPatientBaseInfoService.getInternetTraffic(param);
    }
}
