package com.xinelu.manage.controller.patientquestionsubmitresult;

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.patientquestionsubmitresult.PatientQuestionSubmitResult;
import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitStatistisDto;
import com.xinelu.manage.service.patientquestionsubmitresult.IPatientQuestionSubmitResultService;
import com.xinelu.manage.vo.patientquestionsubmitresult.PatientQuestionSubmitListVo;
import com.xinelu.manage.vo.patientquestionsubmitresult.SatisfactionSurveyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 xinelu
 * @date 2024-03-28
 */
@Api(tags = "患者问卷提交结果信息接口")
@RestController
@RequestMapping("/system/patientQuestionSubmitResult")
public class PatientQuestionSubmitResultController extends BaseController {
    @Resource
    private IPatientQuestionSubmitResultService patientQuestionSubmitResultService;

    /**
     * 查询患者问卷提交结果信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:patientQuestionSubmitResult:list')")
    @GetMapping("/list")
    public TableDataInfo list(PatientQuestionSubmitResult patientQuestionSubmitResult) {
        startPage();
        List<PatientQuestionSubmitResult> list = patientQuestionSubmitResultService.selectPatientQuestionSubmitResultList(patientQuestionSubmitResult);
        return getDataTable(list);
    }

    /**
     * 导出患者问卷提交结果信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:patientQuestionSubmitResult:export')")
    @Log(title = "患者问卷提交结果信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PatientQuestionSubmitResult patientQuestionSubmitResult) {
        List<PatientQuestionSubmitResult> list = patientQuestionSubmitResultService.selectPatientQuestionSubmitResultList(patientQuestionSubmitResult);
        ExcelUtil<PatientQuestionSubmitResult> util = new ExcelUtil<>(PatientQuestionSubmitResult.class);
        util.exportExcel(response, list, "患者问卷提交结果信息数据");
    }

    /**
     * 获取患者问卷提交结果信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:patientQuestionSubmitResult:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(patientQuestionSubmitResultService.selectPatientQuestionSubmitResultById(id));
    }

    /**
     * 新增患者问卷提交结果信息
     */
    @PreAuthorize("@ss.hasPermi('system:patientQuestionSubmitResult:add')")
    @Log(title = "患者问卷提交结果信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PatientQuestionSubmitResult patientQuestionSubmitResult) {
        return toAjax(patientQuestionSubmitResultService.insertPatientQuestionSubmitResult(patientQuestionSubmitResult));
    }

    /**
     * 修改患者问卷提交结果信息
     */
    @PreAuthorize("@ss.hasPermi('system:patientQuestionSubmitResult:edit')")
    @Log(title = "患者问卷提交结果信息", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody PatientQuestionSubmitResult patientQuestionSubmitResult) {
        return toAjax(patientQuestionSubmitResultService.updatePatientQuestionSubmitResult(patientQuestionSubmitResult));
    }

    /**
     * 删除患者问卷提交结果信息
     */
    @PreAuthorize("@ss.hasPermi('system:patientQuestionSubmitResult:remove')")
    @Log(title = "患者问卷提交结果信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(patientQuestionSubmitResultService.deletePatientQuestionSubmitResultByIds(ids));
    }

    /**
     * 满意度调查问卷列表
     */
    @GetMapping("/satisfactionSurvey")
    public TableDataInfo satisfactionSurvey(SatisfactionSurveyVO satisfactionSurvey) {
        startPage();
        List<SatisfactionSurveyVO> list = patientQuestionSubmitResultService.satisfactionSurvey(satisfactionSurvey);
        return getDataTable(list);
    }

    /**
     * 满意度调查问卷
     */
    @GetMapping("/selectQuestionnaireResult")
    public AjaxResult selectQuestionnaireResult(Long patientQuestionSubmitResultId) {
        return patientQuestionSubmitResultService.selectQuestionnaireResult(patientQuestionSubmitResultId);
    }

	/**
	 * @description 科室提交问卷数量
	 * @Param 问卷统计传输对象
	 * @Author haown
	 * @Date 2024-10-30 9:23
	*/
	@ApiOperation("科室提交问卷数量")
	@GetMapping("/departmenQuestionSubmitCount")
	public AjaxResult departmenQuestionSubmitCount(PatientQuestionSubmitStatistisDto queryDto) {
		return patientQuestionSubmitResultService.departmenQuestionSubmitCount(queryDto);
	}

	/**
	 * @description 问卷统计列表
	 * @Param 问卷统计传输对象
	 * @Author haown
	 * @Date 2024-10-30 9:23
	 */
	@ApiOperation("问卷统计列表")
	@GetMapping("/patientQuestionSubmitList")
	public TableDataInfo patientQuestionSubmitList(PatientQuestionSubmitStatistisDto queryDto) {
		startPage();
		List<PatientQuestionSubmitListVo> list = patientQuestionSubmitResultService.patientQuestionSubmitList(queryDto);
		return getDataTable(list);
	}
}
