package com.fs.his.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.his.domain.FsDoctorExtract;
import com.fs.his.service.IFsDoctorExtractService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 医生提现管理Controller
 *
 * @author fs
 * @date 2023-06-25
 */
@RestController
@RequestMapping("/his/doctorExtract")
public class FsDoctorExtractController extends BaseController
{
    @Autowired
    private IFsDoctorExtractService fsDoctorExtractService;

    /**
     * 查询医生提现管理列表
     */
    @PreAuthorize("@ss.hasPermi('his:doctorExtract:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsDoctorExtract fsDoctorExtract)
    {
        startPage();
        List<FsDoctorExtract> list = fsDoctorExtractService.selectFsDoctorExtractList(fsDoctorExtract);
        return getDataTable(list);
    }

    /**
     * 导出医生提现管理列表
     */
    @PreAuthorize("@ss.hasPermi('his:doctorExtract:export')")
    @Log(title = "医生提现管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsDoctorExtract fsDoctorExtract)
    {
        List<FsDoctorExtract> list = fsDoctorExtractService.selectFsDoctorExtractList(fsDoctorExtract);
        ExcelUtil<FsDoctorExtract> util = new ExcelUtil<FsDoctorExtract>(FsDoctorExtract.class);
        return util.exportExcel(list, "医生提现管理数据");
    }

    /**
     * 获取医生提现管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('his:doctorExtract:query')")
    @GetMapping(value = "/{extractId}")
    public AjaxResult getInfo(@PathVariable("extractId") String extractId)
    {
        return AjaxResult.success(fsDoctorExtractService.selectFsDoctorExtractByExtractId(extractId));
    }

    /**
     * 新增医生提现管理
     */
    @PreAuthorize("@ss.hasPermi('his:doctorExtract:add')")
    @Log(title = "医生提现管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsDoctorExtract fsDoctorExtract)
    {
        return toAjax(fsDoctorExtractService.insertFsDoctorExtract(fsDoctorExtract));
    }

    /**
     * 审核
     */
    @PreAuthorize("@ss.hasPermi('his:doctorExtract:edit')")
    @Log(title = "审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsDoctorExtract fsDoctorExtract)
    {
        return toAjax(fsDoctorExtractService.updateFsDoctorExtract(fsDoctorExtract));
    }

    /**
     * 删除医生提现管理
     */
    @PreAuthorize("@ss.hasPermi('his:doctorExtract:remove')")
    @Log(title = "医生提现管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{extractIds}")
    public AjaxResult remove(@PathVariable String[] extractIds)
    {
        return toAjax(fsDoctorExtractService.deleteFsDoctorExtractByExtractIds(extractIds));
    }
}
