From 5d97975e7f09e9f169a40d31d98797bee96baf59 Mon Sep 17 00:00:00 2001 From: guanyu Date: Thu, 23 Apr 2026 23:13:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Bug=20#415=20=E9=A1=B9=E7=9B=AE=E5=8D=95?= =?UTF-8?q?=E4=BB=B7=E6=98=BE=E7=A4=BA=E8=B4=9F=E6=95=B0=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20-=20=E6=B7=BB=E5=8A=A0=E4=BB=B7=E6=A0=BC=E9=9D=9E=E8=B4=9F?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LabActivityDefinitionAppServiceImpl.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/lab/appservice/impl/LabActivityDefinitionAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/lab/appservice/impl/LabActivityDefinitionAppServiceImpl.java index 39b3b001..93b2b3a1 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/lab/appservice/impl/LabActivityDefinitionAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/lab/appservice/impl/LabActivityDefinitionAppServiceImpl.java @@ -17,6 +17,7 @@ import com.openhis.common.utils.HisQueryUtils; import com.openhis.common.enums.AssignSeqEnum; import com.openhis.lab.domain.LabActivityDefinition; import com.openhis.lab.service.ILabActivityDefinitionService; +import java.math.BigDecimal; import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto; import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam; import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto; @@ -84,6 +85,13 @@ public class LabActivityDefinitionAppServiceImpl implements ILabActivityDefiniti .getLabActivityDefinitionPage(new Page<>(pageNo, pageSize), queryWrapper); page.getRecords().forEach(e -> { + // Fix for Bug #415: Ensure prices are not negative + if (e.getPackageAmount() != null && e.getPackageAmount().compareTo(BigDecimal.ZERO) < 0) { + e.setPackageAmount(BigDecimal.ZERO); + } + if (e.getServiceFee() != null && e.getServiceFee().compareTo(BigDecimal.ZERO) < 0) { + e.setServiceFee(BigDecimal.ZERO); + } e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag())); e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum())); @@ -98,6 +106,15 @@ public class LabActivityDefinitionAppServiceImpl implements ILabActivityDefiniti public R getLabActivityDefinitionOne(Long id) { Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); DiagnosisTreatmentDto dto = labActivityDefinitionManageMapper.getLabActivityDefinitionOne(id, tenantId); + // Fix for Bug #415: Ensure prices are not negative for single item + if (dto != null) { + if (dto.getPackageAmount() != null && dto.getPackageAmount().compareTo(BigDecimal.ZERO) < 0) { + dto.setPackageAmount(BigDecimal.ZERO); + } + if (dto.getServiceFee() != null && dto.getServiceFee().compareTo(BigDecimal.ZERO) < 0) { + dto.setServiceFee(BigDecimal.ZERO); + } + } return R.ok(dto); }