| | |
| | | package com.sinata.web.controller.applet; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.core.domain.entity.SysDictData; |
| | | import com.sinata.common.core.domain.entity.SysUser; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.utils.DateUtils; |
| | | import com.sinata.common.utils.SecurityUtils; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.*; |
| | | import com.sinata.system.domain.dto.*; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.service.*; |
| | | import com.sinata.system.domain.MwBox; |
| | | import com.sinata.system.domain.MwCheckoutRecord; |
| | | import com.sinata.system.domain.MwCheckoutRecordItem; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.MwDisposalHandleRecord; |
| | | import com.sinata.system.domain.MwDisposalHandleRecordItem; |
| | | import com.sinata.system.domain.MwDisposalRecord; |
| | | import com.sinata.system.domain.MwDisposalRecordItem; |
| | | import com.sinata.system.domain.MwStagingRoom; |
| | | import com.sinata.system.domain.MwTransitCar; |
| | | import com.sinata.system.domain.MwTransitCarCollectPoint; |
| | | import com.sinata.system.domain.MwTransitRoute; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.BoxListDto; |
| | | import com.sinata.system.domain.dto.CarDto; |
| | | import com.sinata.system.domain.dto.CollectCarTotalUpDto; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.HospitalCollectTotalUp1Dto; |
| | | import com.sinata.system.domain.dto.HospitalCollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.SignCollectDto; |
| | | import com.sinata.system.service.ISysDictDataService; |
| | | import com.sinata.system.service.ISysUserService; |
| | | import com.sinata.system.service.MwBoxService; |
| | | import com.sinata.system.service.MwCheckoutRecordItemService; |
| | | import com.sinata.system.service.MwCheckoutRecordService; |
| | | import com.sinata.system.service.MwCollectRecordService; |
| | | import com.sinata.system.service.MwDisposalHandleRecordItemService; |
| | | import com.sinata.system.service.MwDisposalHandleRecordService; |
| | | import com.sinata.system.service.MwDisposalRecordItemService; |
| | | import com.sinata.system.service.MwDisposalRecordService; |
| | | import com.sinata.system.service.MwStagingRoomService; |
| | | import com.sinata.system.service.MwTransitCarCollectPointService; |
| | | import com.sinata.system.service.MwTransitCarService; |
| | | import com.sinata.system.service.MwTransitRouteService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Random; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.stream.Collectors; |
| | | 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.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @ApiOperation(value = "装车",tags = "运输人员") |
| | | @PostMapping("/box/collect") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<List<CollectDto>> collect(@RequestBody SignCollectDto signCollectDto) { |
| | | SysUser sysUser1 = SecurityUtils.getLoginUser().getUser(); |
| | | SysUser sysUser = userService.getById(sysUser1.getUserId()); |
| | |
| | | |
| | | @ApiOperation(value = "运输统计上(医院数量)",tags = "运输人员") |
| | | @PostMapping("/trans/collect/hospital/count") |
| | | public R<Long> tanscollecttotal12(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) { |
| | | public R<Integer> tanscollecttotal12(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long count = collectRecordService.lambdaQuery().eq(date!=null,MwCollectRecord::getCheckoutTime,date).eq(MwCollectRecord::getCheckoutUserId, sysUser.getUserId()).groupBy(MwCollectRecord::getDepartmentId).count(); |
| | | return R.ok(count); |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().ge(date != null, MwCollectRecord::getCheckoutTime, date.atStartOfDay()).le(date != null, MwCollectRecord::getCheckoutTime, date.atTime(23, 59, 59)).eq(MwCollectRecord::getCheckoutUserId, sysUser.getUserId()).groupBy(MwCollectRecord::getDepartmentId).list(); |
| | | return R.ok(list.size()); |
| | | } |
| | | |
| | | @ApiOperation(value = "运输统计下",tags = "运输人员") |
| | |
| | | public R<List<HospitalCollectTotalUpDto>> tanscollecttotal2(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | //先获取医院ids |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().eq(date!=null,MwCollectRecord::getCheckoutTime,date).eq(MwCollectRecord::getCheckoutUserId, sysUser.getUserId()).groupBy(MwCollectRecord::getDepartmentId).list(); |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().ge(MwCollectRecord::getCheckoutTime, date.atStartOfDay()) |
| | | .le(MwCollectRecord::getCheckoutTime, date.atTime(23,59,59)) |
| | | .eq(MwCollectRecord::getCheckoutUserId, sysUser.getUserId()).groupBy(MwCollectRecord::getDepartmentId).list(); |
| | | //循环医院,然后放入 |
| | | List<HospitalCollectTotalUpDto> list1 = new ArrayList<>(); |
| | | for (MwCollectRecord mwCollectRecord : list) { |
| | |
| | | @ApiOperation(value = "扫码接收列表",tags = "处置人员") |
| | | @PostMapping("/end/down/collect/total") |
| | | public R<List<HospitalCollectTotalUp1Dto>> tanscollecttotal3(String boxNum) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | MwCollectRecord one = collectRecordService.lambdaQuery().eq(MwCollectRecord::getBoxNumber, boxNum).eq(MwCollectRecord::getStatus, 2).last("limit 1").one(); |
| | | if (one==null){ |
| | | return R.ok(); |
| | |
| | | @ApiOperation(value = "获取车辆",tags = "处置人员") |
| | | @PostMapping("/end/down/collect/car") |
| | | public R<CarDto> tanscollecttotal7(String boxNum) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | MwCollectRecord one = collectRecordService.lambdaQuery().eq(MwCollectRecord::getBoxNumber, boxNum).eq(MwCollectRecord::getStatus, 2).last("limit 1").one(); |
| | | if (one == null) { |
| | | return R.ok(); |
| | | } |
| | | MwTransitCar byId = carService.getById(one.getCarId()); |
| | | SysUser one1 = userService.lambdaQuery().eq(SysUser::getCarId, byId.getId()).one(); |
| | | SysUser one1 = userService.lambdaQuery().eq(SysUser::getCarId, byId.getId()).last("limit 1").one(); |
| | | CarDto carDto = new CarDto(); |
| | | carDto.setLicensePlateNumber(byId.getLicensePlateNumber()); |
| | | carDto.setUserName(one1.getUserName()); |
| | | carDto.setUserName(one1.getNickName()); |
| | | return R.ok(carDto); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "扫码接收列表上获取医院",tags = "处置人员") |
| | | @PostMapping("/end/down/collect/up") |
| | | public R<SysDepartment> tanscollecttotal4(String boxNum) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | MwCollectRecord one = collectRecordService.lambdaQuery().eq(MwCollectRecord::getBoxNumber, boxNum).eq(MwCollectRecord::getStatus, 2).last("limit 1").one(); |
| | | if (one == null) { |
| | | return R.ok(); |
| | |
| | | |
| | | @ApiOperation(value = "确认接受",tags = "处置人员") |
| | | @PostMapping("/end/down/collect/confirm") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R tanscollecttotal4(@RequestBody BoxListDto boxListDto) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.getById(userId); |
| | | SysDepartment byId = departmentService.getById(sysUser.getDepartmentId()); |
| | | //将record变为已接受 |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStatus,2).in(MwCollectRecord::getBoxNumber, boxListDto.getBoxNum()).list(); |
| | |
| | | List<CollectDto> collectDtos = collectRecordService.getGroupWithStatus(boxNumber,byId.getDepartmentId(),3); |
| | | return R.ok(collectDtos); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "处置操作",tags = "处置人员") |
| | | @PostMapping("/wait/out") |
| | | public R<List<CollectDto>> list2(@RequestBody BoxListDto boxListDto) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.getById(userId); |
| | | SysDepartment byId = departmentService.getById(sysUser.getDepartmentId()); |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStatus, 3).in(MwCollectRecord::getBoxNumber, boxListDto.getBoxNum()).list(); |
| | | if (list.isEmpty()){ |
| | |
| | | //通过车辆id查询列表 |
| | | List<CollectCarTotalUpDto> list = collectRecordService.carGroup(byId.getCarId(),name); |
| | | return R.ok(list); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "已装车列表详情",tags = "运输人员") |
| | |
| | | @ApiOperation("库存信息") |
| | | @PostMapping("/list") |
| | | public R<List<CollectDto>> list(String boxNumber) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.getById(userId); |
| | | List<CollectDto> collectDtos = collectRecordService.getGroup(boxNumber,sysUser.getDepartmentId()); |
| | | return R.ok(collectDtos); |
| | | } |
| | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation("库存详情") |
| | | @PostMapping("/record1") |
| | | public R<List<MwCollectRecord>> record1(@RequestParam String boxNumber) { |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().isNull(MwCollectRecord::getCheckoutTime).eq(MwCollectRecord::getStatus ,1).eq(MwCollectRecord::getBoxNumber, boxNumber).orderByDesc(MwCollectRecord::getCollectTime).list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("收集统计上") |
| | | @PostMapping("/collect/total") |
| | | public R<List<CollectTotalUpDto>> collecttotal1(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | SysUser byId = userService.getById(sysUser.getUserId()); |
| | | if (date==null){ |
| | | date = LocalDate.now(); |
| | | } |
| | | return R.ok(collectRecordService.collectTotal(date,byId.getDepartmentId())); |
| | | } |
| | | @ApiOperation("收集统计下") |
| | |
| | | public R<Page<MwCollectRecord>> collecttotal2(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date,@RequestParam Integer pageNum, @RequestParam Integer pageSize) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | SysUser byId = userService.getById(sysUser.getUserId()); |
| | | |
| | | Page<MwCollectRecord> page = collectRecordService.lambdaQuery().eq(date!=null,MwCollectRecord::getCollectTime,date).eq(MwCollectRecord::getDepartmentId, byId.getDepartmentId()).orderByDesc(MwCollectRecord::getCollectTime).page(Page.of(pageNum, pageSize)); |
| | | Page<MwCollectRecord> page = collectRecordService.lambdaQuery() |
| | | .ge(MwCollectRecord::getCollectTime, date.atStartOfDay()) |
| | | .le(MwCollectRecord::getCollectTime, date.atTime(23,59,59)) |
| | | .eq(MwCollectRecord::getDepartmentId, byId.getDepartmentId()) |
| | | .orderByDesc(MwCollectRecord::getCollectTime) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |