fix(#655): guanyu (文件合入)
This commit is contained in:
@@ -12,6 +12,10 @@ import com.healthlink.his.administration.domain.Account;
|
||||
import com.healthlink.his.administration.domain.ChargeItem;
|
||||
import com.healthlink.his.administration.service.IAccountService;
|
||||
import com.healthlink.his.administration.service.IChargeItemService;
|
||||
import com.healthlink.his.check.domain.CheckMethod;
|
||||
import com.healthlink.his.check.domain.CheckPackage;
|
||||
import com.healthlink.his.check.service.ICheckMethodService;
|
||||
import com.healthlink.his.check.service.ICheckPackageService;
|
||||
import com.healthlink.his.check.domain.ExamApply;
|
||||
import com.healthlink.his.check.domain.ExamApplyItem;
|
||||
import com.healthlink.his.check.service.IExamApplyItemService;
|
||||
@@ -71,6 +75,12 @@ public class ExamApplyController extends BaseController {
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
private ICheckMethodService checkMethodService;
|
||||
|
||||
@Autowired
|
||||
private ICheckPackageService checkPackageService;
|
||||
|
||||
/**
|
||||
* 查询检查申请单列表
|
||||
*/
|
||||
@@ -112,9 +122,9 @@ public class ExamApplyController extends BaseController {
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
|
||||
for (ExamApplyItem item : items) {
|
||||
if (item.getItemFee() != null) {
|
||||
totalAmount = totalAmount.add(item.getItemFee());
|
||||
}
|
||||
BigDecimal itemTotal = item.getItemFee() != null ? item.getItemFee() : BigDecimal.ZERO;
|
||||
BigDecimal methodFee = getMethodAdditionalFee(item.getExamMethodCode());
|
||||
totalAmount = totalAmount.add(itemTotal.add(methodFee));
|
||||
}
|
||||
|
||||
apply.setTotalAmount(totalAmount);
|
||||
@@ -169,6 +179,9 @@ public class ExamApplyController extends BaseController {
|
||||
examApply.setApplyTime(LocalDateTime.now());
|
||||
examApply.setCreateTime(new Date());
|
||||
examApply.setApplyStatus(0); // 0=已开单
|
||||
if (examApply.getIsCharged() == null) examApply.setIsCharged(0);
|
||||
if (examApply.getIsRefunded() == null) examApply.setIsRefunded(0);
|
||||
if (examApply.getIsExecuted() == null) examApply.setIsExecuted(0);
|
||||
|
||||
// 操作员工号取当前登录用户
|
||||
try {
|
||||
@@ -304,10 +317,12 @@ public class ExamApplyController extends BaseController {
|
||||
chargeItem.setProductId(0L); // 产品ID
|
||||
|
||||
// 金额:单价和总价取检查项目费用
|
||||
BigDecimal fee = itemDto.getItemFee() != null ? itemDto.getItemFee() : BigDecimal.ZERO;
|
||||
BigDecimal baseFee = itemDto.getItemFee() != null ? itemDto.getItemFee() : BigDecimal.ZERO;
|
||||
BigDecimal methodFee = getMethodAdditionalFee(itemDto.getExamMethodCode());
|
||||
BigDecimal fee = baseFee.add(methodFee);
|
||||
chargeItem.setQuantityValue(BigDecimal.ONE); // 数量
|
||||
chargeItem.setQuantityUnit("次"); // 单位
|
||||
chargeItem.setUnitPrice(fee); // 单价
|
||||
chargeItem.setUnitPrice(fee); // 单价 = 项目费 + 检查方法附加金额
|
||||
chargeItem.setTotalPrice(fee); // 总价 = 单价 × 1
|
||||
|
||||
// 租户和审计字段
|
||||
@@ -490,7 +505,9 @@ public class ExamApplyController extends BaseController {
|
||||
chargeItem.setProductTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION);
|
||||
chargeItem.setProductId(0L);
|
||||
|
||||
BigDecimal fee = itemDto.getItemFee() != null ? itemDto.getItemFee() : BigDecimal.ZERO;
|
||||
BigDecimal baseFee = itemDto.getItemFee() != null ? itemDto.getItemFee() : BigDecimal.ZERO;
|
||||
BigDecimal methodFee = getMethodAdditionalFee(itemDto.getExamMethodCode());
|
||||
BigDecimal fee = baseFee.add(methodFee);
|
||||
chargeItem.setQuantityValue(BigDecimal.ONE);
|
||||
chargeItem.setQuantityUnit("次");
|
||||
chargeItem.setUnitPrice(fee);
|
||||
@@ -548,4 +565,36 @@ public class ExamApplyController extends BaseController {
|
||||
|
||||
return AjaxResult.success("删除/作废成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug #655: 根据检查方法代码查询附加金额(套餐价格)
|
||||
* 查找链路:examMethodCode → CheckMethod → packageName → CheckPackage → packagePrice
|
||||
*/
|
||||
private BigDecimal getMethodAdditionalFee(String examMethodCode) {
|
||||
if (examMethodCode == null || examMethodCode.isEmpty()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
// 1. 根据 code 查找 CheckMethod
|
||||
CheckMethod method = checkMethodService.getOne(
|
||||
new LambdaQueryWrapper<CheckMethod>()
|
||||
.eq(CheckMethod::getCode, examMethodCode)
|
||||
.last("LIMIT 1"));
|
||||
if (method == null || method.getPackageName() == null || method.getPackageName().isEmpty()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
// 2. 根据 packageName 查找 CheckPackage(未停用的)
|
||||
CheckPackage pkg = checkPackageService.getOne(
|
||||
new LambdaQueryWrapper<CheckPackage>()
|
||||
.eq(CheckPackage::getPackageName, method.getPackageName())
|
||||
.eq(CheckPackage::getIsDisabled, 0)
|
||||
.last("LIMIT 1"));
|
||||
if (pkg == null || pkg.getPackagePrice() == null || pkg.getPackagePrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
// 3. 仅当套餐价格启用时才累加
|
||||
if (pkg.getPackagePriceEnabled() != null && pkg.getPackagePriceEnabled() == 1) {
|
||||
return pkg.getPackagePrice();
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user