package com.xinelu.manage.controller.statistics;

import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.dto.signpatientmanageroutenode.UploadRobotPublishRecordDto;
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
import com.xinelu.manage.dto.statistics.QuestionnaireTaskStatisticsDto;
import com.xinelu.manage.service.statistics.IStatisticsService;
import com.xinelu.manage.vo.signpatientmanageroutenode.UploadRobotPublishRecordVo;
import com.xinelu.manage.vo.statistics.FollowUpDetailVo;
import com.xinelu.manage.vo.statistics.FollowUpRateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 统计模块控制器
 * @author: haown
 * @create: 2024-10-30 13:56
 **/
@Api(tags = "统计模块控制器")
@RestController
@RequestMapping("/system/statistics")
public class StatisticsController extends BaseController {

	@Resource
	private IStatisticsService statisticsService;

	/**
	 * 随访成功率统计
	 */
	@ApiOperation("随访成功率统计")
	@GetMapping("/getFollowUpRate")
	public R<FollowUpRateVo> getFollowUpRate(FollowUpRateDto queryDto) {
		return R.ok(statisticsService.getFollowUpRate(queryDto));
	}

	/**
	 * 随访明细表查询
	 */
	@ApiOperation("随访明细表查询")
	@GetMapping("/getFollowUpDetail")
	public R<List<FollowUpDetailVo>> getFollowUpDetail(FollowUpRateDto queryDto) {
		return R.ok(statisticsService.getFollowUpDetail(queryDto));
	}

	/**
	 * 问卷任务统计
	 */
	@ApiOperation("问卷任务统计")
	@GetMapping("/questionnaireTaskStatistics")
	public AjaxResult questionnaireTaskStatistics(QuestionnaireTaskStatisticsDto questionnaireTaskStatisticsDto){
		return AjaxResult.success(statisticsService.questionnaireTaskStatistics(questionnaireTaskStatisticsDto));
	}

	@ApiOperation("问卷任务选项统计")
	@GetMapping("/questionnaireTaskOptionList")
	public TableDataInfo questionnaireTaskOptionList(UploadRobotPublishRecordDto uploadRobotPublishRecordDto) {
		startPage();
		List<UploadRobotPublishRecordVo> list = statisticsService.questionnaireTaskOptionList(uploadRobotPublishRecordDto);
		return getDataTable(list);
	}
}
