| | |
| | | package com.sinata.system.service.impl; |
| | | |
| | | import com.alibaba.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.MedicalWasteStaticsVO; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.CollectCarTotalUpDto; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.MwCollectRecordDTO; |
| | | import com.sinata.system.domain.query.DisposalReportQuery; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.DepartmentTagInfoVO; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordWarningVO; |
| | | import com.sinata.system.mapper.MwCollectRecordMapper; |
| | | import com.sinata.system.service.MwCollectRecordService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public PageDTO<MwCollectRecordVO> pageList(MwCollectRecordQuery query) { |
| | | String treeCode = ""; |
| | | if (Objects.isNull(query.getDepartmentId())) { |
| | | SysDepartment myDepartment = sysDepartmentService.getMyDepartment(); |
| | | if (Objects.isNull(myDepartment)) { |
| | | return PageDTO.empty(0L, 0L); |
| | | } |
| | | treeCode = myDepartment.getTreeCode(); |
| | | } else { |
| | | treeCode = sysDepartmentService.getById(query.getDepartmentId()).getTreeCode(); |
| | | String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); |
| | | if (StringUtils.isBlank(treeCode)) { |
| | | return PageDTO.empty(0L, 0L); |
| | | } |
| | | Page<MwCollectRecordVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); |
| | | return PageDTO.of(page); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectDto> getGroup(String boxNumber,Long departmentId) { |
| | | return this.baseMapper.getGroup(boxNumber,departmentId); |
| | | } |
| | | @Override |
| | | public List<CollectDto> getGroupWithStatus(String boxNumber,Long departmentId,Integer status) { |
| | | return this.baseMapper.getGroupWithStatus(boxNumber,departmentId,status); |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectDto> getGroup1(String boxNumber,Long departmentId) { |
| | | return this.baseMapper.getGroup1(boxNumber,departmentId); |
| | | } |
| | | @Override |
| | | public List<CollectDto> getGroup2(String boxNumber,Long departmentId) { |
| | | return this.baseMapper.getGroup2(boxNumber,departmentId); |
| | | } |
| | | @Override |
| | | public List<CollectDto> getGroup3(String boxNumber,Long departmentId,Long carId) { |
| | | return this.baseMapper.getGroup3(boxNumber,departmentId,carId); |
| | | } |
| | | /** |
| | | * 流转过程 |
| | | * |
| | |
| | | |
| | | @Override |
| | | public void export(MwCollectRecordQuery query, HttpServletResponse response) throws IOException { |
| | | String treeCode = ""; |
| | | if (Objects.isNull(query.getDepartmentId())) { |
| | | SysDepartment myDepartment = sysDepartmentService.getMyDepartment(); |
| | | if (Objects.isNull(myDepartment)) { |
| | | return; |
| | | } |
| | | treeCode = myDepartment.getTreeCode(); |
| | | } else { |
| | | treeCode = sysDepartmentService.getById(query.getDepartmentId()).getTreeCode(); |
| | | String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); |
| | | if (StringUtils.isBlank(treeCode)) { |
| | | return; |
| | | } |
| | | List<MwCollectRecordVO> vo = baseMapper.getExportList(query, treeCode); |
| | | // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman |
| | |
| | | // 这里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(), MwCollectRecordVO.class).sheet("医废收集记录").doWrite(vo); |
| | | FastExcel.write(response.getOutputStream(), MwCollectRecordVO.class).sheet("医废收集记录").doWrite(vo); |
| | | } |
| | | |
| | | /** |
| | | * 监管报表医疗废物产生列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwCollectRecordVO> getRegulationReportList(DisposalReportQuery query) { |
| | | String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); |
| | | return baseMapper.getRegulationReportList(query, treeCode); |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectTotalUpDto> collectTotal(LocalDate date,Long departmentId) { |
| | | return baseMapper.collectTotal(date,departmentId); |
| | | } |
| | | @Override |
| | | public List<CollectTotalUpDto> collectTotal3(Long departmentId) { |
| | | return baseMapper.collectTotal3(departmentId); |
| | | } |
| | | @Override |
| | | public List<CollectTotalUpDto> collectTotal1(LocalDate date,Long checkOutUserId,Long id ) { |
| | | return baseMapper.collectTotal1(date,checkOutUserId,id); |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectCarTotalUpDto> carGroup(Long carId,String name) { |
| | | return this.baseMapper.carGroup(carId,name); |
| | | } |
| | | |
| | | /** |
| | | * 查询日产废记录 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwCollectRecordWarningVO> queryListByDay() { |
| | | return baseMapper.queryListTimeType(1); |
| | | } |
| | | |
| | | /** |
| | | * 查询月产废记录 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwCollectRecordWarningVO> queryListByMonth() { |
| | | return baseMapper.queryListTimeType(2); |
| | | } |
| | | |
| | | /** |
| | | * 医疗机构存储量预警 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwCollectRecordWarningVO> queryListGroupByDepartment() { |
| | | return baseMapper.queryListGroupByDepartment(); |
| | | } |
| | | |
| | | /** |
| | | * 预警数据统计 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MedicalWasteStaticsVO queryMedicalWasteStatics(String treeCode) { |
| | | return baseMapper.queryMedicalWasteStatics(treeCode); |
| | | } |
| | | |
| | | /** |
| | | * 获取大屏医疗机构标签信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DepartmentTagInfoVO getTagInfo(Long id) { |
| | | return baseMapper.getTagInfo(id); |
| | | } |
| | | } |