package com.ltkj.web.controller.system; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.TjHzLog; import com.ltkj.hosp.service.ITjHzLogService; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.common.core.page.TableDataInfo; /** * 会诊申请记录 * Controller * * @author ltkj_赵佳豪&李格 * @date 2023-11-22 */ @RestController @RequestMapping("/hosp/hzlog") public class TjHzLogController extends BaseController { @Autowired private ITjHzLogService tjHzLogService; /** * 查询会诊申请记录列表 */ @GetMapping("/list") public TableDataInfo list(TjHzLog tjHzLog) { startPage(); LambdaQueryWrapper wq=new LambdaQueryWrapper<>(); if (tjHzLog.getTjNumber()!=null){ wq.eq(TjHzLog::getTjNumber,tjHzLog.getTjNumber()); } if (tjHzLog.getUserName()!=null){ wq.like(TjHzLog::getUserName,tjHzLog.getUserName()); } if (tjHzLog.getHzType()!=null){ wq.eq(TjHzLog::getHzType,tjHzLog.getHzType()); } List list = tjHzLogService.list(wq); return getDataTable(list); } /** * 导出会诊申请记录列表 */ @Log(title = "会诊申请记录", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TjHzLog tjHzLog) { List list = tjHzLogService.selectTjHzLogList(tjHzLog); ExcelUtil util = new ExcelUtil(TjHzLog.class); util.exportExcel(response, list, "会诊申请记录数据"); } /** * 获取会诊申请记录 * 详细信息 */ @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(tjHzLogService.selectTjHzLogById(id)); } /** * 新增会诊申请记录 */ @Log(title = "会诊申请记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TjHzLog tjHzLog){ return toAjax(tjHzLogService.save(tjHzLog)); } /** * 修改会诊申请记录 */ @Log(title = "会诊申请记录 ", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TjHzLog tjHzLog){ return toAjax(tjHzLogService.saveOrUpdate(tjHzLog)); } /** * 删除会诊申请记录 */ @Log(title = "会诊申请记录 ", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[]ids) { return toAjax(tjHzLogService.removeByIds(Arrays.asList(ids))); } }