package com.ruoyi.framework.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.system.domain.FollowUpReminders;
import com.ruoyi.framework.system.service.IFollowUpRemindersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 随访提醒Controller
 * 
 * @author ruoyi
 * @date 2024-11-13
 */
@RestController
@RequestMapping("/system/FollowUpReminders")
public class FollowUpRemindersController extends BaseController
{
    @Autowired
    private IFollowUpRemindersService followUpRemindersService;

    /**
     * 查询随访提醒列表
     */
    @PreAuthorize("@ss.hasPermi('system:FollowUpReminders:list')")
    @GetMapping("/list")
    public TableDataInfo list(FollowUpReminders followUpReminders)
    {
        startPage();
        List<FollowUpReminders> list = followUpRemindersService.selectFollowUpRemindersList(followUpReminders);
        return getDataTable(list);
    }

    /**
     * 导出随访提醒列表
     */
    @PreAuthorize("@ss.hasPermi('system:FollowUpReminders:export')")
    @Log(title = "随访提醒", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FollowUpReminders followUpReminders)
    {
        List<FollowUpReminders> list = followUpRemindersService.selectFollowUpRemindersList(followUpReminders);
        ExcelUtil<FollowUpReminders> util = new ExcelUtil<FollowUpReminders>(FollowUpReminders.class);
        util.exportExcel(response, list, "随访提醒数据");
    }

    /**
     * 获取随访提醒详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:FollowUpReminders:query')")
    @GetMapping(value = "/{ReminderID}")
    public AjaxResult getInfo(@PathVariable("ReminderID") Long ReminderID)
    {
        return success(followUpRemindersService.selectFollowUpRemindersByReminderID(ReminderID));
    }

    /**
     * 新增随访提醒
     */
    @PreAuthorize("@ss.hasPermi('system:FollowUpReminders:add')")
    @Log(title = "随访提醒", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FollowUpReminders followUpReminders)
    {
        return toAjax(followUpRemindersService.insertFollowUpReminders(followUpReminders));
    }

    /**
     * 修改随访提醒
     */
    @PreAuthorize("@ss.hasPermi('system:FollowUpReminders:edit')")
    @Log(title = "随访提醒", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FollowUpReminders followUpReminders)
    {
        return toAjax(followUpRemindersService.updateFollowUpReminders(followUpReminders));
    }

    /**
     * 删除随访提醒
     */
    @PreAuthorize("@ss.hasPermi('system:FollowUpReminders:remove')")
    @Log(title = "随访提醒", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ReminderIDs}")
    public AjaxResult remove(@PathVariable Long[] ReminderIDs)
    {
        return toAjax(followUpRemindersService.deleteFollowUpRemindersByReminderIDs(ReminderIDs));
    }
}
