package com.ltkj.web.controller.system; import java.util.Arrays; 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.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.enums.BusinessType; import com.ltkj.hosp.domain.TjAskWorkLog; import com.ltkj.hosp.service.ITjAskWorkLogService; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.common.core.page.TableDataInfo; /** * 问诊职业史记录Controller * * @author ltkj_赵佳豪&李格 * @date 2023-12-06 */ @RestController @RequestMapping("/hosp/askWorkLog") public class TjAskWorkLogController extends BaseController { @Autowired private ITjAskWorkLogService tjAskWorkLogService; /** * 查询问诊职业史记录列表 */ @GetMapping("/list") public TableDataInfo list(TjAskWorkLog tjAskWorkLog) { startPage(); List list = tjAskWorkLogService.list(); return getDataTable(list); } /** * 导出问诊职业史记录列表 */ @Log(title = "问诊职业史记录", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TjAskWorkLog tjAskWorkLog) { List list = tjAskWorkLogService.selectTjAskWorkLogList(tjAskWorkLog); ExcelUtil util = new ExcelUtil(TjAskWorkLog.class); util.exportExcel(response, list, "问诊职业史记录数据"); } /** * 获取问诊职业史记录详细信息 */ @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(tjAskWorkLogService.getById(id)); } /** * 新增问诊职业史记录 */ @Log(title = "问诊职业史记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TjAskWorkLog tjAskWorkLog) { return toAjax(tjAskWorkLogService.save(tjAskWorkLog)); } /** * 修改问诊职业史记录 */ @Log(title = "问诊职业史记录", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TjAskWorkLog tjAskWorkLog) { return toAjax(tjAskWorkLogService.updateById(tjAskWorkLog)); } /** * 删除问诊职业史记录 */ @Log(title = "问诊职业史记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(tjAskWorkLogService.removeByIds(Arrays.asList(ids))); } }