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); }