package com.hxhq.business.controller;

import com.hxhq.business.domain.GyzjJcgj;
import com.hxhq.business.domain.GyzjTz;
import com.hxhq.business.dto.gyzj.ListDto;
import com.hxhq.business.form.gyzj.*;
import com.hxhq.business.service.IGyzjJcgjService;
import com.hxhq.business.service.IGyzjService;
import com.hxhq.business.service.IGyzjTzService;
import com.hxhq.business.utils.pdf.PdfExportUtil;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;
import com.hxhq.common.security.annotation.Logical;
import com.hxhq.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 给药制剂档案Controller
 *
 * @author hxhq
 * @date 2025-12-18
 */
@RestController
@RequestMapping("/business/gyzjArchive")
public class GyzjArchiveController extends BaseController
{
    @Autowired
    private IGyzjService gyzjService;


    /**
     * 列表
     */
    @RequiresPermissions("business:archive:gyzj:list")
    @GetMapping("/list")
    public TableDataInfo list(SearchForm form)
    {
        startPage();
        List<ListDto> list = gyzjService.queryArchiveList(form);
        return getDataTable(list);
    }

    /**
     * 同意归档
     */
    @PostMapping("/tygd")
    @RequiresPermissions("business:archive:gyzj:tygd")
    public AjaxResult tygd(@RequestBody ArchiveForm form)
    {
        gyzjService.tygd(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝归档
     */
    @PostMapping("/jjgd")
    @RequiresPermissions("business:archive:gyzj:jjgd")
    public AjaxResult jjgd(@RequestBody ArchiveForm form)
    {
        gyzjService.jjgd(form);
        return AjaxResult.success("操作成功");
    }

    /**
     * 同意解档
     */
    @PostMapping("/tyjd")
    @RequiresPermissions("business:archive:gyzj:tyjd")
    public AjaxResult tyjd(@RequestBody ArchiveForm form)
    {
        gyzjService.tyjd(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝解档
     */
    @PostMapping("/jjjd")
    @RequiresPermissions("business:archive:gyzj:jjjd")
    public AjaxResult jjjd(@RequestBody ArchiveForm form)
    {
        gyzjService.jjjd(form);
        return AjaxResult.success("操作成功");
    }

    /**
     * 同意借阅
     */
    @PostMapping("/tyjy")
    @RequiresPermissions("business:archive:gyzj:tyjy")
    public AjaxResult tyjy(@RequestBody ArchiveForm form)
    {
        gyzjService.tyjy(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝借阅
     */
    @PostMapping("/jjjy")
    @RequiresPermissions("business:archive:gyzj:jjjy")
    public AjaxResult jjjy(@RequestBody ArchiveForm form)
    {
        gyzjService.jjjy(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 确认归还
     */
    @PostMapping("/qrgh")
    @RequiresPermissions("business:archive:gyzj:qrgh")
    public AjaxResult qrgh(@RequestBody ArchiveForm form)
    {
        gyzjService.qrgh(form);
        return AjaxResult.success("操作成功");
    }

}
