package com.xinelu.manage.controller.patientnodeparamslog;

import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.patientnodeparamslog.PatientNodeParamsLog;
import com.xinelu.manage.service.patientnodeparamslog.IPatientNodeParamsLogService;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 患者节点参数历史记录Controller
 *
 * @author haown
 * @date 2024-05-20
 */
@RestController
@RequestMapping("/manage/nodeParamsLog")
public class PatientNodeParamsLogController extends BaseController {
    @Resource
    private IPatientNodeParamsLogService patientNodeParamsLogService;

/**
 * 查询患者节点参数历史记录列表
 */
@PreAuthorize("@ss.hasPermi('manage:nodeParamsLog:list')")
@GetMapping("/list")
    public TableDataInfo list(PatientNodeParamsLog patientNodeParamsLog) {
        startPage();
        List<PatientNodeParamsLog> list = patientNodeParamsLogService.selectPatientNodeParamsLogList(patientNodeParamsLog);
        return getDataTable(list);
    }

    /**
     * 导出患者节点参数历史记录列表
     */
    @PreAuthorize("@ss.hasPermi('manage:nodeParamsLog:export')")
    @Log(title = "患者节点参数历史记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PatientNodeParamsLog patientNodeParamsLog) {
        List<PatientNodeParamsLog> list = patientNodeParamsLogService.selectPatientNodeParamsLogList(patientNodeParamsLog);
        ExcelUtil<PatientNodeParamsLog> util = new ExcelUtil<>(PatientNodeParamsLog. class);
        util.exportExcel(response, list, "患者节点参数历史记录数据");
    }

    /**
     * 获取患者节点参数历史记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('manage:nodeParamsLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(patientNodeParamsLogService.selectPatientNodeParamsLogById(id));
    }

    /**
     * 新增患者节点参数历史记录
     */
    @PreAuthorize("@ss.hasPermi('manage:nodeParamsLog:add')")
    @Log(title = "患者节点参数历史记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PatientNodeParamsLog patientNodeParamsLog) {
        return toAjax(patientNodeParamsLogService.insertPatientNodeParamsLog(patientNodeParamsLog));
    }

    /**
     * 修改患者节点参数历史记录
     */
    @PreAuthorize("@ss.hasPermi('manage:nodeParamsLog:edit')")
    @Log(title = "患者节点参数历史记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PatientNodeParamsLog patientNodeParamsLog) {
        return toAjax(patientNodeParamsLogService.updatePatientNodeParamsLog(patientNodeParamsLog));
    }

    /**
     * 删除患者节点参数历史记录
     */
    @PreAuthorize("@ss.hasPermi('manage:nodeParamsLog:remove')")
    @Log(title = "患者节点参数历史记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(patientNodeParamsLogService.deletePatientNodeParamsLogByIds(ids));
    }
}
