146 收费工作站-》门诊收费:门诊划价费用在门诊收费点击【确认收费】按钮报错。
This commit is contained in:
@@ -199,13 +199,19 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
// 此次chargeItem的就诊诊断id集合
|
||||
List<Long> diagIdList
|
||||
= chargeItemList.stream().map(ChargeItem::getEncounterDiagnosisId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (diagIdList.isEmpty()) {
|
||||
throw new ServiceException("收费项的就诊诊断查询为空");
|
||||
}
|
||||
// 此次就诊的医疗类型列表
|
||||
List<EncounterDiagnosis> diagList = iEncounterDiagnosisService.getDiagnosisList(diagIdList);
|
||||
List<EncounterDiagnosis> diagList;
|
||||
if (diagIdList.isEmpty()) {
|
||||
// 收费项未关联就诊诊断(如挂号费、自动诊疗费等),则直接从就诊维度查询诊断
|
||||
diagList = iEncounterDiagnosisService.getDiagnosisList(prePaymentDto.getEncounterId());
|
||||
if (diagList.isEmpty()) {
|
||||
throw new ServiceException("就诊诊断查询为空,错误信息:EncounterDiagnosis");
|
||||
throw new ServiceException("当前就诊暂无诊断记录,请先由医生录入诊断后再进行收费");
|
||||
}
|
||||
} else {
|
||||
diagList = iEncounterDiagnosisService.getDiagnosisList(diagIdList);
|
||||
if (diagList.isEmpty()) {
|
||||
throw new ServiceException("就诊诊断查询为空");
|
||||
}
|
||||
}
|
||||
List<String> medTypeList
|
||||
= diagList.stream().map(EncounterDiagnosis::getMedTypeCode).distinct().collect(Collectors.toList());
|
||||
@@ -231,10 +237,20 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
if (distinctAccountIdList.isEmpty()) {
|
||||
throw new ServiceException("未找到有效的账户信息");
|
||||
}
|
||||
// 只按账户ID查询,不再追加 encounter_id 条件
|
||||
// 原因:收费项上的 accountId 已能唯一定位账户,额外的 encounter_id 条件
|
||||
// 在挂号费等场景下可能因数据不一致导致查不到,引发误报
|
||||
List<Account> accountList = iAccountService.list(new LambdaQueryWrapper<Account>()
|
||||
.in(Account::getId, distinctAccountIdList).eq(Account::getEncounterId, prePaymentDto.getEncounterId()));
|
||||
.in(Account::getId, distinctAccountIdList));
|
||||
if (accountList.size() != distinctAccountIdList.size()) {
|
||||
throw new ServiceException("未查询到账户信息");
|
||||
// 部分账户查不到时,记录警告日志,并校验是否每个收费项都能找到对应账户
|
||||
Set<Long> foundAccountIds = accountList.stream().map(Account::getId).collect(Collectors.toSet());
|
||||
List<Long> missingAccountIds = distinctAccountIdList.stream()
|
||||
.filter(id -> !foundAccountIds.contains(id)).collect(Collectors.toList());
|
||||
if (accountList.isEmpty()) {
|
||||
throw new ServiceException("未查询到任何账户信息,encounterId:" + prePaymentDto.getEncounterId()
|
||||
+ ",期望accountId列表:" + distinctAccountIdList);
|
||||
}
|
||||
}
|
||||
|
||||
// 账户id,对应的账单列表
|
||||
@@ -2156,14 +2172,18 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
piModel.setBusNo(chargeItem.getBusNo());
|
||||
|
||||
EncounterDiagnosis encounterDiagnosis;
|
||||
if (chargeItem.getEncounterDiagnosisId() == null) {
|
||||
// 收费项未关联就诊诊断(如挂号费、自动诊疗费等),取诊断列表第一条作为兜底
|
||||
encounterDiagnosis = diagList.get(0);
|
||||
} else {
|
||||
Optional<EncounterDiagnosis> optional
|
||||
= diagList.stream().filter(e -> e.getId().equals(chargeItem.getEncounterDiagnosisId())).findFirst();
|
||||
|
||||
if (optional.isPresent()) {
|
||||
encounterDiagnosis = optional.get();
|
||||
} else {
|
||||
throw new ServiceException(
|
||||
"诊断信息与收费项的诊断信息未对应,错误信息:费用项" + chargeItem.getBusNo() + chargeItem.getEncounterDiagnosisId());
|
||||
// 收费项关联的诊断ID在diagList中找不到,也取第一条兜底
|
||||
encounterDiagnosis = diagList.get(0);
|
||||
}
|
||||
}
|
||||
piModel.setMedType(encounterDiagnosis.getMedTypeCode());
|
||||
piModel.setTotalPrice(chargeItem.getTotalPrice());
|
||||
|
||||
Reference in New Issue
Block a user