| | |
| | | package com.sinata.system.service.impl; |
| | | |
| | | import cn.idev.excel.EasyExcel; |
| | | import cn.idev.excel.FastExcel; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sinata.common.entity.PageDTO; |
| | |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.MwStagingRoom; |
| | | import com.sinata.system.domain.dto.MwStagingRoomDTO; |
| | | import com.sinata.system.domain.excel.MwCheckoutRecordExcel; |
| | | import com.sinata.system.domain.query.CheckoutRecordQuery; |
| | | import com.sinata.system.domain.query.MwStagingRoomQuery; |
| | | import com.sinata.system.domain.query.StorageRecordQuery; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | if (Objects.isNull(dto.getId())) { |
| | | throw new ServiceException("暂存间id不能为空"); |
| | | } |
| | | MwStagingRoom mwStagingRoom = BeanUtils.copyBean(dto, MwStagingRoom.class); |
| | | updateById(mwStagingRoom); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | String fileName = URLEncoder.encode("暂存间入库记录", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), MwStorageRecordVO.class).sheet("暂存间入库记录").doWrite(list); |
| | | FastExcel.write(response.getOutputStream(), MwStorageRecordVO.class).sheet("暂存间入库记录").doWrite(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | return; |
| | | } |
| | | List<MwCheckoutRecordVO> list = baseMapper.checkoutRecordList(query, treeCode); |
| | | // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman |
| | | List<MwCheckoutRecordExcel> mwCheckoutRecordExcels = BeanUtils.copyToList(list, MwCheckoutRecordExcel.class); |
| | | for (MwCheckoutRecordExcel mwCheckoutRecordExcel : mwCheckoutRecordExcels) { |
| | | for (MwCheckoutRecordVO mwCheckoutRecordVO : list) { |
| | | if (mwCheckoutRecordVO.getId().equals(mwCheckoutRecordExcel.getId())) { |
| | | mwCheckoutRecordExcel.setHospitalSignature(new URL(mwCheckoutRecordVO.getHospitalSignature())); |
| | | } |
| | | } |
| | | } |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | String fileName = URLEncoder.encode("暂存间出库记录", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), MwCheckoutRecordVO.class).sheet("暂存间出库记录").doWrite(list); |
| | | FastExcel.write(response.getOutputStream(), MwCheckoutRecordExcel.class).sheet("暂存间出库记录").doWrite(mwCheckoutRecordExcels); |
| | | } |
| | | |
| | | @Override |
| | | public List<MwStagingRoomVO> queryStagingRoomList() { |
| | | return baseMapper.queryStagingRoomList(); |
| | | } |
| | | |
| | | /** |
| | | * 暂存间待处理医废分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageDTO<MwStorageRecordVO> temporarilyStoredMedicalWaste(StorageRecordQuery query) { |
| | | return PageDTO.of(baseMapper.temporarilyStoredMedicalWaste(new Page<MwStorageRecordVO>(query.getPageCurr(), query.getPageSize()), query)); |
| | | } |
| | | |
| | | /** |
| | | * 根据医废查询使用列表 |
| | | * |
| | | * @param id 微波设备id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwStorageRecordVO> queryMedicalWasteList(Long id) { |
| | | return baseMapper.queryMedicalWasteList(id); |
| | | } |
| | | } |