package com.sinata.web.controller.applet;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.google.common.collect.Lists;
|
import java.util.Date;
|
|
import com.sinata.common.core.domain.R;
|
import com.sinata.common.core.domain.entity.SysUser;
|
import com.sinata.common.entity.PageDTO;
|
import com.sinata.common.utils.SecurityUtils;
|
import com.sinata.system.domain.*;
|
import com.sinata.system.domain.dto.CheckOutDto;
|
import com.sinata.system.domain.dto.CollectTotalUpDto;
|
import com.sinata.system.domain.query.CheckoutRecordQuery;
|
import com.sinata.system.domain.query.MwCheckoutRecordItemQuery;
|
import com.sinata.system.domain.query.MwTransitRecordQuery;
|
import com.sinata.system.domain.vo.MwCheckoutRecordVO;
|
import com.sinata.system.domain.vo.MwMedicalWasteBoxVO;
|
import com.sinata.system.domain.vo.MwTransitRecordVO;
|
import com.sinata.system.service.*;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.naming.ldap.PagedResultsControl;
|
import javax.servlet.http.HttpServletResponse;
|
import javax.validation.Valid;
|
import java.io.IOException;
|
import java.time.LocalDate;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* <p>
|
* 暂存间出库记录 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-12-02
|
*/
|
@Api(tags = {"医院工作人员"})
|
@Validated
|
@RequiredArgsConstructor
|
@RestController
|
@RequestMapping("/applet/mwCheckoutRecord")
|
public class AppMwCheckoutRecordController {
|
private final MwCheckoutRecordService mwCheckoutRecordService;
|
private final ISysUserService userService;
|
private final MwTransitCarService carService;
|
private final MwDisposalRecordService disposalRecordService;
|
private final MwDisposalHandleRecordService handleRecordService;
|
private final SysDepartmentService departmentService;
|
|
|
@ApiOperation(value = "出库统计上")
|
@PostMapping("/total")
|
public R<List<CollectTotalUpDto>> total(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) {
|
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
SysUser byId = userService.getById(sysUser.getUserId());
|
return R.ok(mwCheckoutRecordService.totalUp(date,byId.getDepartmentId()));
|
}
|
|
@ApiOperation(value = "接收统计上",tags = "处置人员")
|
@PostMapping("/out/total")
|
public R<List<CollectTotalUpDto>> outtotal(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) {
|
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
return R.ok(mwCheckoutRecordService.totalUp2(date,sysUser.getUserId()));
|
}
|
@ApiOperation(value = "接收统计下",tags = "处置人员")
|
@PostMapping("/out/record")
|
public R<List<CheckOutDto>> record1(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date) {
|
SysUser sysUser1 = SecurityUtils.getLoginUser().getUser();
|
SysUser sysUser = userService.getById(sysUser1.getUserId());
|
LocalDate now = LocalDate.now();
|
List<MwDisposalRecord> list = disposalRecordService.lambdaQuery().ge(date!=null,MwDisposalRecord::getReceiveTime, date.atStartOfDay()).le(date!=null,MwDisposalRecord::getReceiveTime,date.atTime(23,59,59)).eq(MwDisposalRecord::getDepartmentId, sysUser.getDepartmentId()).orderByDesc(MwDisposalRecord::getReceiveTime).list();
|
List<CheckOutDto> backList = new ArrayList<>();
|
for (MwDisposalRecord mwCheckoutRecord : list) {
|
CheckOutDto checkOutDto = new CheckOutDto();
|
SysUser byId = userService.getById(mwCheckoutRecord.getDriverId());
|
checkOutDto.setDriverName(byId.getNickName());
|
MwTransitCar byId1 = carService.getById(mwCheckoutRecord.getCarId());
|
checkOutDto.setLicensePlateNumber(byId1.getLicensePlateNumber());
|
checkOutDto.setCheckoutTime(mwCheckoutRecord.getReceiveTime());
|
List<CollectTotalUpDto> records = mwCheckoutRecordService.totalUp6(mwCheckoutRecord.getId());
|
checkOutDto.setRecords(records);
|
backList.add(checkOutDto);
|
}
|
return R.ok(backList);
|
}
|
|
@ApiOperation(value = "处置统计上",tags = "处置人员")
|
@PostMapping("/end/total")
|
public R<List<CollectTotalUpDto>> outtotal1(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) {
|
SysDepartment myDepartment = departmentService.getMyDepartment();
|
List<CollectTotalUpDto> collectTotalUpDtos = mwCheckoutRecordService.totalUp2(date, myDepartment.getId());
|
return R.ok(collectTotalUpDtos);
|
}
|
|
@ApiOperation(value = "处置统下",tags = "处置人员")
|
@PostMapping("/end/record")
|
public R<List<CheckOutDto>> record2(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date) {
|
SysDepartment myDepartment = departmentService.getMyDepartment();
|
LocalDate now = LocalDate.now();
|
List<MwDisposalHandleRecord> list = handleRecordService.lambdaQuery().ge(date!=null,MwDisposalHandleRecord::getDisposalTime, date.atStartOfDay()).le(date!=null,MwDisposalHandleRecord::getDisposalTime,date.atTime(23,59,59)).eq(MwDisposalHandleRecord::getDepartmentId, myDepartment.getId()).orderByDesc(MwDisposalHandleRecord::getDisposalTime).list();
|
List<CheckOutDto> backList = new ArrayList<>();
|
for (MwDisposalHandleRecord mwCheckoutRecord : list) {
|
CheckOutDto checkOutDto = new CheckOutDto();
|
SysUser byId = userService.getById(mwCheckoutRecord.getDriverId());
|
checkOutDto.setDriverName(byId.getNickName());
|
MwTransitCar byId1 = carService.getById(mwCheckoutRecord.getCarId());
|
if (byId1!=null){
|
checkOutDto.setLicensePlateNumber(byId1.getLicensePlateNumber());
|
}
|
checkOutDto.setCheckoutTime(mwCheckoutRecord.getDisposalTime());
|
List<CollectTotalUpDto> records = mwCheckoutRecordService.totalUp1(mwCheckoutRecord.getId());
|
checkOutDto.setRecords(records);
|
backList.add(checkOutDto);
|
}
|
return R.ok(backList);
|
}
|
|
|
|
|
@ApiOperation(value = "出库统计下")
|
@PostMapping("/record")
|
public R<List<CheckOutDto>> record(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date) {
|
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
SysUser byId2 = userService.getById(sysUser.getUserId());
|
LocalDate now = LocalDate.now();
|
List<MwCheckoutRecord> list = mwCheckoutRecordService.lambdaQuery().ge(MwCheckoutRecord::getCreateTime, date.atStartOfDay())
|
.le(MwCheckoutRecord::getCreateTime, date.atTime(23,59,59)).eq(MwCheckoutRecord::getDepartmentId, byId2.getDepartmentId()).orderByDesc(MwCheckoutRecord::getCheckoutTime).list();
|
List<CheckOutDto> backList = new ArrayList<>();
|
for (MwCheckoutRecord mwCheckoutRecord : list) {
|
CheckOutDto checkOutDto = new CheckOutDto();
|
SysUser byId = userService.getById(mwCheckoutRecord.getDriverId());
|
checkOutDto.setDriverName(byId.getNickName());
|
MwTransitCar byId1 = carService.getById(mwCheckoutRecord.getCarId());
|
checkOutDto.setLicensePlateNumber(byId1.getLicensePlateNumber());
|
checkOutDto.setCheckoutTime(mwCheckoutRecord.getCheckoutTime());
|
List<CollectTotalUpDto> records = mwCheckoutRecordService.totalUp1(mwCheckoutRecord.getId());
|
checkOutDto.setRecords(records);
|
backList.add(checkOutDto);
|
}
|
return R.ok(backList);
|
}
|
|
|
}
|