|
@@ -15,6 +15,7 @@ import com.imed.costaccount.service.*;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -32,14 +33,12 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
|
|
|
|
|
|
private final AccountingService accountingService;
|
|
private final AccountingService accountingService;
|
|
|
|
|
|
- private final CostIncomeGroupMapper costIncomeGroupMapper;
|
|
|
|
|
|
|
|
- public CostIncomeGroupServiceImpl(DepartmentService departmentService, ResponsibilityService responsibilityService, ProductService productService, AccountingService accountingService, CostIncomeGroupMapper costIncomeGroupMapper) {
|
|
|
|
|
|
+ public CostIncomeGroupServiceImpl(DepartmentService departmentService, ResponsibilityService responsibilityService, ProductService productService, AccountingService accountingService) {
|
|
this.departmentService = departmentService;
|
|
this.departmentService = departmentService;
|
|
this.responsibilityService = responsibilityService;
|
|
this.responsibilityService = responsibilityService;
|
|
this.productService = productService;
|
|
this.productService = productService;
|
|
this.accountingService = accountingService;
|
|
this.accountingService = accountingService;
|
|
- this.costIncomeGroupMapper = costIncomeGroupMapper;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,37 +61,30 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
|
|
wrapper.eq("hosp_id",hospId);
|
|
wrapper.eq("hosp_id",hospId);
|
|
wrapper.eq("date_year",year);
|
|
wrapper.eq("date_year",year);
|
|
wrapper.eq("date_month",month);
|
|
wrapper.eq("date_month",month);
|
|
|
|
+ wrapper.like(!StringUtils.isEmpty(responsibilityCode),"open_responsibility_code",responsibilityCode)
|
|
|
|
+ .or()
|
|
|
|
+ .like(!StringUtils.isEmpty(responsibilityCode),"start_responsibility_code",responsibilityCode);
|
|
|
|
+ wrapper.eq(!StringUtils.isEmpty(accountCode),"account_code",accountCode);
|
|
Page<CostIncomeGroup> pages = this.page(costIncomeGroupPage, wrapper);
|
|
Page<CostIncomeGroup> pages = this.page(costIncomeGroupPage, wrapper);
|
|
List<CostIncomeGroup> records = pages.getRecords();
|
|
List<CostIncomeGroup> records = pages.getRecords();
|
|
List<CostIncomeGroupBeforeVO> costIncomeGroupBeforeVOList = BeanUtil.convertList(records, CostIncomeGroupBeforeVO.class);
|
|
List<CostIncomeGroupBeforeVO> costIncomeGroupBeforeVOList = BeanUtil.convertList(records, CostIncomeGroupBeforeVO.class);
|
|
// 查询所有的责任中心 科室 会计科目 成本项目的数据 处理名字
|
|
// 查询所有的责任中心 科室 会计科目 成本项目的数据 处理名字
|
|
setCodeName(hospId, costIncomeGroupBeforeVOList);
|
|
setCodeName(hospId, costIncomeGroupBeforeVOList);
|
|
// 进行金额合并
|
|
// 进行金额合并
|
|
- List<CostIncomeGroupAllAmountVO> costIncomeGroupAllAmountVoS =costIncomeGroupMapper.countMoney(costIncomeGroupBeforeVOList);
|
|
|
|
- // TODO 对,的金额进行合并
|
|
|
|
|
|
+ List<CostIncomeGroupAllAmountVO> costIncomeGroupAllAmountVoS =baseMapper.countMoney(costIncomeGroupBeforeVOList);
|
|
|
|
+ // 对,的金额进行合并
|
|
costIncomeGroupAllAmountVoS.forEach(i->{
|
|
costIncomeGroupAllAmountVoS.forEach(i->{
|
|
String allMoney = i.getAllMoney();
|
|
String allMoney = i.getAllMoney();
|
|
if (allMoney.contains(StrUtil.COMMA)){
|
|
if (allMoney.contains(StrUtil.COMMA)){
|
|
// 存在,在进行求和
|
|
// 存在,在进行求和
|
|
- Long sum;
|
|
|
|
|
|
+ long sum;
|
|
List<Long> list = Arrays.stream(allMoney.split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
|
|
List<Long> list = Arrays.stream(allMoney.split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
|
|
-
|
|
|
|
|
|
+ sum = list.stream().mapToLong(m -> m).sum();
|
|
|
|
+ i.setAmount(BigDecimal.valueOf(sum));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- List<CostIncomeGroupAllAmountVO> amountVOS = costIncomeGroupAllAmountVoS.stream().map(i -> {
|
|
|
|
- if (!StringUtils.isEmpty(responsibilityCode)) {
|
|
|
|
- boolean equalsBoolean = i.getOpenResponsibilityCode().equals(responsibilityCode);
|
|
|
|
- if (!equalsBoolean) {
|
|
|
|
- i.getStartResponsibilityCode().equals(responsibilityCode);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!StringUtils.isEmpty(accountCode)) {
|
|
|
|
- i.getAccountCode().equals(accountCode);
|
|
|
|
- }
|
|
|
|
- return i;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
PageUtils pageUtils = new PageUtils(pages);
|
|
PageUtils pageUtils = new PageUtils(pages);
|
|
- pageUtils.setList(amountVOS);
|
|
|
|
|
|
+ pageUtils.setList(costIncomeGroupAllAmountVoS);
|
|
return pageUtils;
|
|
return pageUtils;
|
|
}
|
|
}
|
|
|
|
|