package com.cirle.scientific.controller.miniapp;/*
 *24901
 *2022/12/22
 *17:14
 */

import com.cirle.scientific.po.QkjQuestionAnswerApp;
import com.cirle.scientific.pojo.BizCodeEnum;
import com.cirle.scientific.pojo.Result;
import com.cirle.scientific.service.QuestionAnswerAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 24901
 */
@Controller
@RequestMapping("/app/QuestionAnswer")
@Api("用户问题回答接口")
public class QuestionAnswerAppController {

    private QuestionAnswerAppService questionAnswerAppService;

    @Autowired
    public void setQuestionAnswerAppService(QuestionAnswerAppService questionAnswerAppService) {
        this.questionAnswerAppService = questionAnswerAppService;
    }


    @GetMapping("/findQuestionScore")
    @ApiOperation(value = "查询用户分数")
    @ResponseBody
    public Result findQuestionScore(@ApiParam(name = "objType", value = "回答表类型") @RequestParam(name = "objType") Integer objType,
                                    @ApiParam(name = "objId", value = "对应的id") @RequestParam(name = "objId") Integer objId,
                                    @ApiParam(name = "patientId", value = "患者信息id") @RequestParam(name = "patientId") Integer patientId,
                                    @ApiParam(name = "memCard", value = "医生或者护士的唯一标识")  @RequestAttribute(name = "memCard", required = false) String memCard){
        return Result.success(questionAnswerAppService.findQuestionScore(objType,objId,patientId,memCard));
    }


    @PostMapping("/addQuestionAnswer")
    @ApiOperation(value = "批量保存用户回答")
    @ResponseBody
    public Result addQuestionAnswer(@ApiParam(name = "memCard", value = "医生或者护士的唯一标识")  @RequestAttribute(name = "memCard", required = false) String memCard,
                                    @RequestBody List<QkjQuestionAnswerApp> questionAnswerApp){
        return Result.success( questionAnswerAppService.addQuestionAnswer(memCard, questionAnswerApp));
    }
}
