|
@@ -34,6 +34,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.imed.costaccount.common.constants.Constant.LIMIT;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Service("hospProfitAndLossService")
|
|
|
public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossMapper, HospProfitAndLoss> implements HospProfitAndLossService {
|
|
@@ -363,6 +365,30 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
|
|
|
int month = DateUtil.month(parse) + 1;
|
|
|
int startIndex = (current - 1) * pageSize;
|
|
|
List<HospProfitAndLoss> list = baseMapper.getPageList(startIndex, pageSize, year, month, hospId);
|
|
|
+ // 损益的时候计算下
|
|
|
+ list.forEach(i -> {
|
|
|
+ ReportForm one = reportFormService.getOne(
|
|
|
+ new LambdaQueryWrapper<ReportForm>().select(ReportForm::getId)
|
|
|
+ .eq(ReportForm::getNum, i.getReportNum())
|
|
|
+ .eq(ReportForm::getHospId, hospId)
|
|
|
+ .eq(ReportForm::getReportType, 3)
|
|
|
+ .eq(ReportForm::getIsLoss, 1)
|
|
|
+ .last(LIMIT)
|
|
|
+ );
|
|
|
+ if (Objects.nonNull(one)) {
|
|
|
+ List<CostOtherPaymentsData> byMonth = otherPaymentsDataService.getByMonth(year, month, hospId);
|
|
|
+ AtomicReference<BigDecimal> total = new AtomicReference<>();
|
|
|
+ total.set(BigDecimal.ZERO);
|
|
|
+ byMonth.forEach(j -> {
|
|
|
+ if (j.getPaymentsType().equals(1)) {
|
|
|
+ total.set(total.get().add(j.getTotalAmount()));
|
|
|
+ }else {
|
|
|
+ total.set(total.get().subtract(j.getTotalAmount()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ i.setAmount(i.getAmount().add(total.get()));
|
|
|
+ }
|
|
|
+ });
|
|
|
int totalCount = baseMapper.getPageCount(year, month, hospId);
|
|
|
return new PageUtils(list, totalCount, pageSize, current);
|
|
|
}
|