| | |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | LocalDate now = LocalDate.now(); |
| | | for (SysDepartment sysDepartment : list) { |
| | | //获取库存总量 |
| | | Long count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).count(); |
| | | BigDecimal count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).list().stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //获取接收数量 |
| | | Long count2 = collectRecordService.lambdaQuery().ge(MwCollectRecord::getReceiveTime,now.atStartOfDay()).le(MwCollectRecord::getReceiveTime,now.atTime(23,59,59)).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).count(); |
| | | BigDecimal count2 = collectRecordService.lambdaQuery().ge(MwCollectRecord::getReceiveTime,now.atStartOfDay()).le(MwCollectRecord::getReceiveTime,now.atTime(23,59,59)).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).list().stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //获取处置数量 |
| | | Long count3 = collectRecordService.lambdaQuery().ge(MwCollectRecord::getDisposalTime,now.atStartOfDay()).le(MwCollectRecord::getDisposalTime,now.atTime(23,59,59)).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).count(); |
| | | BigDecimal count3 = collectRecordService.lambdaQuery().ge(MwCollectRecord::getDisposalTime,now.atStartOfDay()).le(MwCollectRecord::getDisposalTime,now.atTime(23,59,59)).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).list().stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | sysDepartment.setCont1(count1); |
| | | sysDepartment.setCont2(count2); |
| | | sysDepartment.setCont3(count3); |
| | |
| | | MwStagingRoom one = roomService.lambdaQuery().eq(MwStagingRoom::getDepartmentId, departmentId).one(); |
| | | Long count = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStagingRoomId, one.getId()).eq(MwCollectRecord::getStatus, 1).count(); |
| | | MwCollectRecord one1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStagingRoomId, one.getId()).eq(MwCollectRecord::getStatus, 1).orderByDesc(MwCollectRecord::getBoxTime).last("limit 1").one(); |
| | | if (one1!=null){ |
| | | one.setBoxTime(one1.getBoxTime()); |
| | | } |
| | | one.setCount(count); |
| | | one.setBoxTime(one1.getBoxTime()); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | @ApiOperation(value = "医院转运记录") |
| | | @PostMapping("/trans") |
| | | public R<List<CheckOutDto>> trans(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date, @ApiParam("医院id")@RequestParam Long departmentId) { |
| | | LocalDate now = LocalDate.now().minusDays(7); |
| | | if (date!=null){ |
| | | now = LocalDate.now(); |
| | | } |
| | | List<MwCheckoutRecord> list = mwCheckoutRecordService.lambdaQuery().ge(date ==null,MwCheckoutRecord::getCheckoutTime, now).eq(MwCheckoutRecord::getDepartmentId, departmentId).orderByDesc(MwCheckoutRecord::getCheckoutTime).list(); |
| | | // LocalDate now = LocalDate.now().minusDays(7); |
| | | // if (date!=null){ |
| | | // now = LocalDate.now(); |
| | | // } |
| | | List<MwCheckoutRecord> list = mwCheckoutRecordService.lambdaQuery().ge(MwCheckoutRecord::getCheckoutTime, date.atStartOfDay()).le(MwCheckoutRecord::getCheckoutTime , date.atTime(23,59,59)).eq(MwCheckoutRecord::getDepartmentId, departmentId).orderByDesc(MwCheckoutRecord::getCheckoutTime).list(); |
| | | List<CheckOutDto> backList = new ArrayList<>(); |
| | | for (MwCheckoutRecord mwCheckoutRecord : list) { |
| | | CheckOutDto checkOutDto = new CheckOutDto(); |
| | |
| | | public R<CountTwoDto> outtotal2(@ApiParam("处置机构id")@RequestParam Long departmentId) { |
| | | CountTwoDto countTwoDto = new CountTwoDto(); |
| | | LocalDate now = LocalDate.now(); |
| | | Long count = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).ge(MwCollectRecord::getReceiveTime, now.atStartOfDay()).le(MwCollectRecord::getReceiveTime,now.atTime(23,59,59)).count(); |
| | | Long count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).ge(MwCollectRecord::getDisposalTime, now.atStartOfDay()).le(MwCollectRecord::getDisposalTime,now.atTime(23,59,59)).count(); |
| | | BigDecimal count = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).ge(MwCollectRecord::getReceiveTime, now.atStartOfDay()).le(MwCollectRecord::getReceiveTime,now.atTime(23,59,59)).list().stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).ge(MwCollectRecord::getDisposalTime, now.atStartOfDay()).le(MwCollectRecord::getDisposalTime,now.atTime(23,59,59)).list().stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | countTwoDto.setCount(count); |
| | | countTwoDto.setCount1(count1); |
| | | return R.ok(countTwoDto); |