package com.fs.app.controller;


import com.fs.app.annotation.Login;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.domain.R;

import com.fs.his.service.IFsDataService;
import com.fs.his.service.IFsInquiryOrderService;
import com.fs.his.vo.ChartDataVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Api("首页接口")
@RestController
@RequestMapping(value="/app/index")
public class IndexController extends AppBaseController {
	@Autowired
	private IFsInquiryOrderService inquiryOrderService;
	@Autowired
	IFsDataService iFsDataService;

	@Login
	@ApiOperation("获取首页数据")
	@GetMapping("/getIndexData")
	public R getIndexData(HttpServletRequest request){
		//获取
		Integer receiveOrderCount=inquiryOrderService.getDoctorDoReceiveOrder(getDoctorId());
		Map<String,Object> maps=new HashMap<>();
		maps.put("receiveOrderCount",receiveOrderCount);
		return R.ok().put("data",maps);
	}

	@Login
	@GetMapping("/inquiryOrderChartData")
	public AjaxResult inquiryOrderChartList() {
		Long doctorId = Long.parseLong(getDoctorId());
		List<ChartDataVO> list = iFsDataService.getDoctorInquiryOrderChartData(doctorId);
		return AjaxResult.success(list);
	}

	@Login
	@ApiOperation("获取首页数据")
	@GetMapping("/todayInquiryCount")
	public R todayInquiryCount(HttpServletRequest request){
		//获取
		Long todayInquiryCount=iFsDataService.todayInquiryCount( Long.parseLong(getDoctorId()));
		return R.ok().put("data",todayInquiryCount);
	}


}
