package org.dromara.web.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.web.domain.bo.*;
import org.dromara.web.domain.vo.*;
import org.dromara.web.service.ReportService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Timestamp;
import java.util.List;

/**
 * @Author: Huanyi
 * @CreateTime: 2025-08-18
 * @Description:
 * @Version: 1.0
 */

@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/report")
public class ReportController {

    private final ReportService reportService;

    @GetMapping("/listProduct")
    @SaCheckPermission("report:product:list")
    public TableDataInfo<ListProductVo> listProduct(ListProductBo bo, PageQuery pageQuery) {
        return reportService.listProduct(bo, pageQuery);
    }

    @GetMapping("/nutritionalQualityControl")
    @SaCheckPermission("report:nutritionQualityControl:list")
    public R<NutritionalQualityControlVo> getNutritionalQualityControl(
        @RequestParam(value = "start", required = false) Timestamp start,
        @RequestParam(value = "end", required = false) Timestamp end) {
        return reportService.getNutritionalQualityControl(start, end);
    }

    @GetMapping("/enteralNutrition")
    @SaCheckPermission("report:enteralNutrition:list")
    public TableDataInfo<PrescriptionVo> getEnteralNutrition(EnteralNutritionPrescriptionBo bo, PageQuery pageQuery) {
        return reportService.getEnteralNutrition(bo, pageQuery);
    }

    @GetMapping("/dietaryPrescription")
    @SaCheckPermission("report:dietaryPrescription:list")
    public TableDataInfo<InHospitalDietaryPrescriptionVo> listPageDietaryPrescription(DietaryPrescriptionBo bo, PageQuery pageQuery) {
        return reportService.listPageDietaryPrescription(bo, pageQuery);
    }

    @GetMapping("/screeningOrAssessment")
    @SaCheckPermission("report:screeningOrAssessment:list")
    public TableDataInfo listPageScreeningOrAssessment(ScreeningOrAssessmentBo bo, PageQuery pageQuery) {
        return reportService.listPageScreeningOrAssessment(bo, pageQuery);
    }

    @GetMapping("/dietaryInventory")
    @SaCheckPermission("report:dietaryInventory:list")
    public TableDataInfo listPageDietaryInventory(DietaryInventoryBo bo, PageQuery pageQuery) {
        return reportService.listPageDietaryInventory(bo, pageQuery);
    }

    @GetMapping("/inventory")
    @SaCheckPermission("report:inventory:list")
    public TableDataInfo listPageInventory(InventoryBo bo, PageQuery pageQuery) {
        return reportService.listPageInventory(bo, pageQuery);
    }

    @GetMapping("/inHospitalBillingReconciliation")
    @SaCheckPermission("report:inHospitalBillingReconciliation:list")
    public TableDataInfo<InHospitalBillingReconciliationVo> listPageInHospitalBillingReconciliation(InHospitalBillingReconciliationBo bo, PageQuery pageQuery) {
        return reportService.listPageInHospitalBillingReconciliation(bo, pageQuery);
    }

    @GetMapping("/cost")
    @SaCheckPermission("report:cost:list")
    public R<List<CostPrescriptionVo>> listCost(CostBo bo) {
        return reportService.listCost(bo);
    }

    @GetMapping("/progressNote")
    @SaCheckPermission("report:progressNote:list")
    public TableDataInfo<ProgressNoteVo> listPageProgressNote(ProgressNoteBo bo, PageQuery pageQuery) {
        return reportService.listPageProgressNote(bo, pageQuery);
    }

    @GetMapping("/intraHospitalData")
    @SaCheckPermission("report:intraHospitalData:list")
    public R getIntraHospitalData(
        @RequestParam(value = "start", required = false) Timestamp start,
        @RequestParam(value = "end", required = false) Timestamp end,
        @RequestParam(value = "id", required = false) Long id) {
        return reportService.getIntraHospitalData(start, end, id);
    }

}
