fix: 修复收费失败错误 'element cannot be mapped to a null key'

- 在 PaymentRecServiceImpl.java 中添加过滤,排除 contractNo 为 null 的数据

- 在 IChargeBillServiceImpl.java 中添加过滤,排除 contractNo 为 null 的数据

- 防止 Java Stream groupingBy 操作时出现 null key 异常
This commit is contained in:
2026-04-02 18:22:18 +08:00
parent ced931a280
commit bfb2491842
2 changed files with 18 additions and 6 deletions

View File

@@ -933,7 +933,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// }
// 根据省市医保分组
Map<String, List<PaymentRecDetailAccountResult>> paymentDetailsMapByContract = PaymentRecDetailAccountResultList
.stream().collect(Collectors.groupingBy(PaymentRecDetailAccountResult::getContractNo));
.stream()
.filter(dto -> dto.getContractNo() != null && !dto.getContractNo().isEmpty())
.collect(Collectors.groupingBy(PaymentRecDetailAccountResult::getContractNo));
// 查询所有的收费项
List<String> chargeItemIdStrs = paymentReconciliationList.stream().map(PaymentReconciliation::getChargeItemIds)
@@ -1408,7 +1410,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 医保人次自费人次计算
List<EncounterAccountDto> list = iEncounterService.getEncounterInfoByTime(startDate, endDate);
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract
= list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
= list.stream()
.filter(dto -> dto.getContractNo() != null && !dto.getContractNo().isEmpty())
.collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
for (Map.Entry<String, List<EncounterAccountDto>> stringListEntry : encounterAccountDtoMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -1482,7 +1486,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 根据省市医保分组
Map<String, List<PaymentRecDetailAccountResult>> paymentDetailsMapByContract = PaymentRecDetailAccountResultList
.stream().collect(Collectors.groupingBy(PaymentRecDetailAccountResult::getContractNo));
.stream()
.filter(dto -> dto.getContractNo() != null && !dto.getContractNo().isEmpty())
.collect(Collectors.groupingBy(PaymentRecDetailAccountResult::getContractNo));
BigDecimal cashSum = BigDecimal.ZERO;// 现金总数 = rmbCashSum + vxCashSum + aliCashSum + uniCashSum
BigDecimal rmbCashSum = BigDecimal.ZERO;// 现金总数
@@ -1885,7 +1891,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 医保人次自费人次计算
List<EncounterAccountDto> list = iEncounterService.getEncounterInfoByTime(startDate, endDate);
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract
= list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
= list.stream()
.filter(dto -> dto.getContractNo() != null && !dto.getContractNo().isEmpty())
.collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
for (Map.Entry<String, List<EncounterAccountDto>> stringListEntry : encounterAccountDtoMapByContract
.entrySet()) {
String key = stringListEntry.getKey();

View File

@@ -2331,7 +2331,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
= iChargeItemService.getChargeItemBaseInfoByIds(prePaymentDto.getChargeItemIds());
Map<String, List<ChargeItemBaseInfoDto>> chargeItemKVByContractNo
= chargeItemBaseInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemBaseInfoDto::getContractNo));
= chargeItemBaseInfoByIds.stream()
.filter(dto -> dto.getContractNo() != null && !dto.getContractNo().isEmpty())
.collect(Collectors.groupingBy(ChargeItemBaseInfoDto::getContractNo));
List<InpatientPreSettleDto> yb2303OutputSetInfos = new ArrayList<>();
Yb2303OutputSetInfo yb2303OutputSetInfo;
@@ -2459,7 +2461,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
List<ChargeItemBaseInfoDto> chargeItemBaseInfoByIds
= iChargeItemService.getChargeItemBaseInfoByIds(paymentDto.getChargeItemIds());
Map<String, List<ChargeItemBaseInfoDto>> chargeItemKVByContractNo
= chargeItemBaseInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemBaseInfoDto::getContractNo));
= chargeItemBaseInfoByIds.stream()
.filter(dto -> dto.getContractNo() != null && !dto.getContractNo().isEmpty())
.collect(Collectors.groupingBy(ChargeItemBaseInfoDto::getContractNo));
List<Account> accountList = iAccountService.getAccountListByEncounter(paymentDto.getEncounterId());
if (accountList.isEmpty()) {