Fix: 修复bug:430 门诊医生站-检查申请:实现套餐金额变更与检查部位的金额/检查申请单开立的项目金额实时同步联动

bug400: 完诊时triage_queue_item.status更新增加回退查询容错
This commit is contained in:
wangjian963
2026-05-09 13:23:58 +08:00
parent cb33f4dbe9
commit b48ca4fb4a
2 changed files with 47 additions and 0 deletions

View File

@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckPackage;
import com.openhis.check.domain.CheckPackageDetail;
import com.openhis.check.domain.CheckPart;
import com.openhis.check.service.ICheckPackageDetailService;
import com.openhis.check.service.ICheckPackageService;
import com.openhis.check.service.ICheckPartService;
import com.openhis.web.check.appservice.ICheckPackageAppService;
import com.openhis.web.check.dto.CheckPackageDetailDto;
import com.openhis.web.check.dto.CheckPackageDto;
@@ -34,6 +36,7 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService {
private final ICheckPackageService checkPackageService;
private final ICheckPackageDetailService checkPackageDetailService;
private final ICheckPartService checkPartService;
/**
* 转换明细 DTO 列表为实体列表
@@ -61,6 +64,25 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService {
return details;
}
/**
* 同步更新引用此套餐的检查部位价格
*/
private void syncCheckPartPrice(String packageName, java.math.BigDecimal newPrice) {
if (packageName == null || newPrice == null) {
return;
}
List<CheckPart> parts = checkPartService.list(
new LambdaQueryWrapper<CheckPart>()
.eq(CheckPart::getPackageName, packageName)
);
if (parts.isEmpty()) {
return;
}
parts.forEach(part -> part.setPrice(newPrice.doubleValue()));
checkPartService.updateBatchById(parts);
log.info("套餐[{}]价格更新为 {},已同步更新 {} 个检查部位的价格", packageName, newPrice, parts.size());
}
@Override
public R<?> getCheckPackageList() {
try {
@@ -134,6 +156,9 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService {
}
}
// 同步更新引用此套餐的检查部位价格
syncCheckPartPrice(checkPackage.getPackageName(), checkPackage.getPackagePrice());
return R.ok(checkPackage.getId(), "保存成功");
} catch (Exception e) {
log.error("新增检查套餐失败", e);
@@ -193,6 +218,9 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService {
checkPackageDetailService.saveBatch(details);
}
// 同步更新引用此套餐的检查部位价格
syncCheckPartPrice(existPackage.getPackageName(), checkPackage.getPackagePrice());
return R.ok("更新成功");
} catch (Exception e) {
log.error("更新检查套餐失败", e);