| | |
| | | package com.sinata.web.controller.backend; |
| | | |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.dto.MwStagingRoomDTO; |
| | | import com.sinata.system.domain.query.CheckoutRecordQuery; |
| | | import com.sinata.system.domain.query.MwStagingRoomQuery; |
| | | import com.sinata.system.domain.query.StorageRecordQuery; |
| | | import com.sinata.system.domain.vo.MwCheckoutRecordVO; |
| | | import com.sinata.system.domain.vo.MwStagingRoomVO; |
| | | import com.sinata.system.domain.vo.MwStorageRecordVO; |
| | | import com.sinata.system.service.MwStagingRoomService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author mitao |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Api(tags = {"暂存间管理相关接口"}) |
| | | @Validated |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/backend/mwStagingRoom") |
| | | public class MwStagingRoomController { |
| | | private final MwStagingRoomService mwStagingRoomService; |
| | | |
| | | /** |
| | | * 暂存间分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/page") |
| | | @ApiOperation("暂存间分页列表") |
| | | public R<PageDTO<MwStagingRoomVO>> pageList(@Valid @RequestBody MwStagingRoomQuery query) { |
| | | return R.ok(mwStagingRoomService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 新增暂存间 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("新增暂存间") |
| | | public R<?> add(@Valid @RequestBody MwStagingRoomDTO dto) { |
| | | mwStagingRoomService.add(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑暂存间 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @PostMapping("/edit") |
| | | @ApiOperation("编辑暂存间") |
| | | public R<?> edit(@Valid @RequestBody MwStagingRoomDTO dto) { |
| | | mwStagingRoomService.edit(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除暂存间 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation("删除暂存间") |
| | | public R<?> delete(@ApiParam(name = "id", value = "暂存间id", required = true) @PathVariable("id") Long id) { |
| | | mwStagingRoomService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 根据医院id查询暂存间 |
| | | * |
| | | * @param departmentId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getByHospitalId/{departmentId}") |
| | | @ApiOperation(value = "根据医院id查询暂存间", notes = "入库、出库记录暂存间筛选级联数据") |
| | | public R<MwStagingRoomVO> getByHospitalId(@ApiParam(name = "departmentId", value = "医院id", required = true) @PathVariable("departmentId") Long departmentId) { |
| | | return R.ok(mwStagingRoomService.getByHospitalId(departmentId)); |
| | | } |
| | | |
| | | /** |
| | | * 暂存间入库记录 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/storageRecord") |
| | | @ApiOperation("暂存间入库记录") |
| | | public R<PageDTO<MwStorageRecordVO>> storageRecord(@Valid @RequestBody StorageRecordQuery query) { |
| | | return R.ok(mwStagingRoomService.storageRecord(query)); |
| | | } |
| | | |
| | | /** |
| | | * 暂存间入库记录导出 |
| | | * |
| | | * @param query |
| | | * @param response |
| | | */ |
| | | @PostMapping("/storageRecord/export") |
| | | @ApiOperation("暂存间入库记录导出") |
| | | public void storageRecordExport(@RequestBody StorageRecordQuery query, HttpServletResponse response) { |
| | | try { |
| | | mwStagingRoomService.storageRecordExport(query, response); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 暂存间出库记录 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/checkoutRecord") |
| | | @ApiOperation("暂存间出库记录") |
| | | public R<PageDTO<MwCheckoutRecordVO>> checkoutRecord(@Valid @RequestBody CheckoutRecordQuery query) { |
| | | return R.ok(mwStagingRoomService.checkoutRecord(query)); |
| | | } |
| | | |
| | | /** |
| | | * 暂存间出库记录导出 |
| | | * |
| | | * @param query |
| | | * @param response |
| | | */ |
| | | @PostMapping("/checkoutRecord/export") |
| | | @ApiOperation("暂存间出库记录导出") |
| | | public void checkoutRecordExport(@RequestBody CheckoutRecordQuery query, HttpServletResponse response) { |
| | | try { |
| | | mwStagingRoomService.checkoutRecordExport(query, response); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |