Bug #384: 检查方法联动功能完善,增加套餐价格查询和项目卡片展开选择

Bug #386: 检验申请删除时同步删除关联收费项目
  Bug #382: 选择项目后保持当前页签状态
  Bug #380,381: 临床诊断获取主诊断字段名修正
  Bug #387: 套餐项目回充默认展开并自动加载明细
This commit is contained in:
wangjian963
2026-04-21 10:18:26 +08:00
parent 5ab4650c4e
commit 994ffcb8b8
6 changed files with 513 additions and 184 deletions

View File

@@ -4,8 +4,11 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckMethod;
import com.openhis.check.domain.CheckPackage;
import com.openhis.check.service.ICheckMethodService;
import com.openhis.check.service.ICheckPackageService;
import com.openhis.web.check.appservice.ICheckMethodAppService;
import com.openhis.web.check.dto.CheckMethodDto;
import com.openhis.web.reportmanage.utils.ExcelFillerUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -16,6 +19,7 @@ import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@Slf4j
@@ -24,10 +28,15 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
@Resource
private ICheckMethodService checkMethodService;
@Resource
private ICheckPackageService checkPackageService; // Bug #384修复注入套餐服务
@Override
public R<?> getCheckMethodList() {
List<CheckMethod> list = checkMethodService.list();
return R.ok(list);
// Bug #384修复转换为DTO并关联套餐价格
List<CheckMethodDto> dtoList = convertToDtoWithPackagePrice(list);
return R.ok(dtoList);
}
@Override
@@ -43,7 +52,67 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
wrapper.eq(CheckMethod::getPackageName, packageName);
}
List<CheckMethod> list = checkMethodService.list(wrapper);
return R.ok(list);
// Bug #384修复转换为DTO并关联套餐价格
List<CheckMethodDto> dtoList = convertToDtoWithPackagePrice(list);
return R.ok(dtoList);
}
/**
* Bug #384修复转换CheckMethod为DTO并通过packageName关联查询套餐价格
* @param methods 检查方法列表
* @return 包含套餐价格的DTO列表
*/
private List<CheckMethodDto> convertToDtoWithPackagePrice(List<CheckMethod> methods) {
if (methods == null || methods.isEmpty()) {
return List.of();
}
// 获取所有packageName批量查询套餐
List<String> packageNames = methods.stream()
.map(CheckMethod::getPackageName)
.filter(ObjectUtil::isNotEmpty)
.distinct()
.collect(Collectors.toList());
// Bug #384修复: 批量查询套餐信息使用final变量
final Map<String, CheckPackage> packageMap;
if (!packageNames.isEmpty()) {
List<CheckPackage> packages = checkPackageService.list(
new LambdaQueryWrapper<CheckPackage>()
.in(CheckPackage::getPackageName, packageNames)
.eq(CheckPackage::getIsDisabled, 0) // 只查未停用的套餐
);
packageMap = packages.stream()
.collect(Collectors.toMap(CheckPackage::getPackageName, p -> p, (p1, p2) -> p1));
} else {
packageMap = Map.of();
}
// 转换为DTO并填充价格
return methods.stream().map(m -> {
CheckMethodDto dto = new CheckMethodDto();
dto.setId(m.getId() != null ? m.getId().longValue() : null);
dto.setCheckType(m.getCheckType());
dto.setCode(m.getCode());
dto.setName(m.getName());
dto.setPackageName(m.getPackageName());
dto.setExposureNum(m.getExposureNum());
dto.setOrderNum(m.getOrderNum());
dto.setRemark(m.getRemark());
dto.setCreateTime(m.getCreateTime());
dto.setUpdateTime(m.getUpdateTime());
// 通过packageName匹配套餐价格
if (ObjectUtil.isNotEmpty(m.getPackageName())) {
CheckPackage pkg = packageMap.get(m.getPackageName());
if (pkg != null) {
dto.setPackagePrice(pkg.getPackagePrice());
dto.setServiceFee(pkg.getServiceFee());
}
}
return dto;
}).collect(Collectors.toList());
}
@Override

View File

@@ -1,12 +1,15 @@
package com.openhis.web.check.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 检查方法DTO - Bug #384修复增加套餐价格字段
* 用于API返回数据传输不含数据库注解
*/
@Data
@Accessors(chain = true)
public class CheckMethodDto {
@@ -14,7 +17,6 @@ public class CheckMethodDto {
/**
* 检查方法ID
*/
@TableId(type = IdType.AUTO)
private Long id;
/* 检查类型 */
@@ -29,6 +31,12 @@ public class CheckMethodDto {
/* 套餐名称 */
private String packageName;
/* 套餐价格 - Bug #384修复通过packageName匹配CheckPackage获取 */
private BigDecimal packagePrice;
/* 服务费 - Bug #384修复通过packageName匹配CheckPackage获取 */
private BigDecimal serviceFee;
/* 曝光次数 */
private Integer exposureNum;

View File

@@ -7,6 +7,7 @@ import com.core.common.utils.SecurityUtils;
import com.openhis.common.enums.DbOpType;
import com.openhis.administration.service.IAccountService;
import com.openhis.administration.domain.Account;
import com.openhis.administration.service.IChargeItemService; // Bug #386修复: 添加 ChargeItemService
import com.openhis.lab.domain.InspectionLabApply;
import com.openhis.lab.domain.InspectionLabApplyItem;
import com.openhis.lab.domain.BarCode;
@@ -97,6 +98,10 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
@Autowired
private ILabActivityDefinitionService labActivityDefinitionService;
// Bug #386修复: ChargeItemService 用于删除收费项目
@Autowired
private IChargeItemService chargeItemService;
/**
* 保存检验申请单信息
* @param doctorStationLabApplyDto
@@ -598,8 +603,14 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
);
if (updateResult) {
log.debug("成功将申请单号 [{}] 关联的 {} 条门诊医嘱的删除状态更新为1更新人{},更新时间:{}",
log.debug("成功将申请单号 [{}] 关联的 {} 条门诊医嘱的删除状态更新为1更新人{},更新时间:{}",
applyNo, requestIds.size(), currentUsername, currentTime);
// Bug #386修复: 同步删除关联的收费项目
for (Long requestId : requestIds) {
chargeItemService.deleteByServiceTableAndId("wor_service_request", requestId);
}
log.debug("成功删除申请单号 [{}] 关联的 {} 条收费项目", applyNo, requestIds.size());
} else {
log.warn("更新申请单号 [{}] 关联的门诊医嘱删除状态失败", applyNo);
}