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.FsDoctorOperLog;
import com.fs.his.service.IFsDoctorOperLogService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 医生操作日志记录Controller
 * 
 * @author fs
 * @date 2024-08-16
 */
@RestController
@RequestMapping("/his/doctorOperLog")
public class FsDoctorOperLogController extends BaseController
{
    @Autowired
    private IFsDoctorOperLogService fsDoctorOperLogService;

    /**
     * 查询医生操作日志记录列表
     */
    @PreAuthorize("@ss.hasPermi('his:doctorOperLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsDoctorOperLog fsDoctorOperLog)
    {
        startPage();
        List<FsDoctorOperLog> list = fsDoctorOperLogService.selectFsDoctorOperLogList(fsDoctorOperLog);
        return getDataTable(list);
    }

    /**
     * 导出医生操作日志记录列表
     */
    @PreAuthorize("@ss.hasPermi('his:doctorOperLog:export')")
    @Log(title = "医生操作日志记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsDoctorOperLog fsDoctorOperLog)
    {
        List<FsDoctorOperLog> list = fsDoctorOperLogService.selectFsDoctorOperLogList(fsDoctorOperLog);
        ExcelUtil<FsDoctorOperLog> util = new ExcelUtil<FsDoctorOperLog>(FsDoctorOperLog.class);
        return util.exportExcel(list, "医生操作日志记录数据");
    }

    /**
     * 获取医生操作日志记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('his:doctorOperLog:query')")
    @GetMapping(value = "/{operId}")
    public AjaxResult getInfo(@PathVariable("operId") Long operId)
    {
        return AjaxResult.success(fsDoctorOperLogService.selectFsDoctorOperLogByOperId(operId));
    }

    /**
     * 新增医生操作日志记录
     */
    @PreAuthorize("@ss.hasPermi('his:doctorOperLog:add')")
    @Log(title = "医生操作日志记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsDoctorOperLog fsDoctorOperLog)
    {
        return toAjax(fsDoctorOperLogService.insertFsDoctorOperLog(fsDoctorOperLog));
    }

    /**
     * 修改医生操作日志记录
     */
    @PreAuthorize("@ss.hasPermi('his:doctorOperLog:edit')")
    @Log(title = "医生操作日志记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsDoctorOperLog fsDoctorOperLog)
    {
        return toAjax(fsDoctorOperLogService.updateFsDoctorOperLog(fsDoctorOperLog));
    }

    /**
     * 删除医生操作日志记录
     */
    @PreAuthorize("@ss.hasPermi('his:doctorOperLog:remove')")
    @Log(title = "医生操作日志记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{operIds}")
    public AjaxResult remove(@PathVariable Long[] operIds)
    {
        return toAjax(fsDoctorOperLogService.deleteFsDoctorOperLogByOperIds(operIds));
    }
}
