From b4ed4fc41525e55a85424cab104a5a8a71668605 Mon Sep 17 00:00:00 2001
From: chen <2710907404@qq.com>
Date: Wed, 2 Apr 2025 17:55:33 +0800
Subject: [PATCH] =?UTF-8?q?20250402=20=E6=9B=B4=E6=96=B0=201.=E5=A4=84?=
 =?UTF-8?q?=E7=90=86=E6=A3=80=E9=AA=8C=E6=89=A9=E5=B1=95=E6=95=B0=E6=8D=AE?=
 =?UTF-8?q?=E4=B8=AD=E5=B1=9E=E4=BA=8E=E5=9F=BA=E5=B3=B0=E7=9A=84=E5=80=BC?=
 =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../TestRecordSampleDataConstant.java         |  2 ++
 .../TestRecordSampleDataConverter.java        |  8 ++++++-
 .../impl/PushDataToLabsCareServiceImpl.java   |  2 +-
 .../vo/TestRecordSampleDataExpandVO.java      | 21 +++++++++++++++----
 .../inspection/vo/TestRecordSampleDataVO.java | 11 ++++++----
 5 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/constant/TestRecordSampleDataConstant.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/constant/TestRecordSampleDataConstant.java
index e89d9d1..add09b1 100644
--- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/constant/TestRecordSampleDataConstant.java
+++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/constant/TestRecordSampleDataConstant.java
@@ -63,6 +63,8 @@ public interface TestRecordSampleDataConstant {
 
      Double INVALID_VALUE = -999d;
 
+     String INVALID_VALUE_STR = "/";
+
      // 判断当前值是否是无效值
     static boolean isInvalidValue(Double value) {
         return value != null && INVALID_VALUE.equals(value);
diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordSampleDataConverter.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordSampleDataConverter.java
index 473fb96..14d5ce7 100644
--- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordSampleDataConverter.java
+++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordSampleDataConverter.java
@@ -5,6 +5,7 @@ import digital.laboratory.platform.inspection.dto.SampleInspectDataDTO;
 import digital.laboratory.platform.inspection.entity.TestRecordSampleData;
 import digital.laboratory.platform.inspection.vo.TestRecordSampleDataVO;
 
+import java.math.BigDecimal;
 import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -28,7 +29,12 @@ public class TestRecordSampleDataConverter {
         testRecordSampleData.setSampleConcentration(vo.getSampleConcentration());
         testRecordSampleData.setCompoundName(vo.getCompoundName());
         testRecordSampleData.setRtTimeWithinError(vo.getRtTimeWithinError());
-        testRecordSampleData.setRtTimeError(vo.getRtTimeError());
+        String rtTimeError = vo.getRtTimeError();
+        if (rtTimeError != null && rtTimeError.equals(TestRecordSampleDataConstant.INVALID_VALUE_STR)) {
+            testRecordSampleData.setRtTimeError(null);
+        } else {
+            testRecordSampleData.setRtTimeError(new BigDecimal(rtTimeError));
+        }
         testRecordSampleData.setTargetRtTime(vo.getTargetRtTime());
         testRecordSampleData.setStdRtTime(vo.getStdRtTime());
         testRecordSampleData.setIsDetected(vo.getIsDetected().equals(TestRecordSampleDataConstant.IS) ? 1 : 0);
diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java
index 550840e..ee4b87b 100644
--- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java
+++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java
@@ -324,7 +324,7 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService
                 testDataJson.set("swsj", NULL_PLACEHOLDER); // 上机
                 testDataJson.set("swyxtj", NULL_PLACEHOLDER); // 	液相条件
                 testDataJson.set("swzptj", NULL_PLACEHOLDER); // 质谱条件
-                testDataJson.set("wjcjgpd", "±" + processInspectDataService.getHairCaseIonAbundanceRatioWithinErrorRange(stdData.getIonAbundanceRatio().doubleValue())); //相对离子丰度比的最大允许相对误差(%)
+                testDataJson.set("wjcjgpd", "±" + processInspectDataService.getHairCaseIonAbundanceRatioWithinErrorRange(Double.parseDouble(stdData.getIonAbundanceRatio()))); //相对离子丰度比的最大允许相对误差(%)
                 testDataJson.set("wtdw", entrustInfo.getEntrustDepartment());
                 testDataJson.set("wzdy", StrUtil.join(",", drug.getMainDeclusteringPotential(), drug.getMinorDeclusteringPotential()));
                 return testDataJson;
diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java
index 956d20e..d689a1c 100644
--- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java
+++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java
@@ -50,12 +50,25 @@ public class TestRecordSampleDataExpandVO {
 
     /************************  处理需要特定格式返回的字段  **************************/
 
-    public BigDecimal getIonAbundanceRatio() {
-        return ionAbundanceRatio != null ? ionAbundanceRatio.setScale(2, RoundingMode.HALF_UP) : null;
+    public String getIonAbundanceRatio() {
+        if (getBasePeak()) {
+            return "/";
+        }
+        return ionAbundanceRatio != null ? ionAbundanceRatio.setScale(2, RoundingMode.HALF_UP).toString() : null;
     }
 
-    public BigDecimal getIonAbundanceRatioError() {
-        return ionAbundanceRatioError != null ? ionAbundanceRatioError.setScale(2, RoundingMode.HALF_UP) : null;
+    public String getIonAbundanceRatioError() {
+        if (getBasePeak()) {
+            return "/";
+        }
+        return ionAbundanceRatioError != null ? ionAbundanceRatioError.setScale(2, RoundingMode.HALF_UP).toString() : null;
+    }
+
+    public String getIonAbundanceRatioWithinError() {
+        if (getBasePeak()) {
+            return "/";
+        }
+        return ionAbundanceRatioWithinError;
     }
 }
 
diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java
index 79fd4f0..263e556 100644
--- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java
+++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java
@@ -89,8 +89,11 @@ public class TestRecordSampleDataVO {
         return isDetected.equals(1) ? TestRecordSampleDataConstant.IS : TestRecordSampleDataConstant.NO;
     }
 
-    public BigDecimal getRtTimeError() {
-        return rtTimeError != null ? rtTimeError.setScale(3, RoundingMode.HALF_UP) : null;
+    public String getRtTimeError() {
+        if (sampleType.equals(TestRecordSampleDataConstant.SAMPLE_TYPE_STD)) {
+            return TestRecordSampleDataConstant.INVALID_VALUE_STR;
+        }
+        return rtTimeError != null ? rtTimeError.setScale(3, RoundingMode.HALF_UP).toString() : null;
     }
 
     /**
@@ -98,11 +101,11 @@ public class TestRecordSampleDataVO {
      *
      * @return
      */
-    public BigDecimal getIonAbundanceRatioError() {
+    public String getIonAbundanceRatioError() {
         return expandList != null && expandList.size() > 1 ? expandList.get(1).getIonAbundanceRatioError() : null;
     }
 
-    public BigDecimal getIonAbundanceRatio() {
+    public String getIonAbundanceRatio() {
         return expandList != null && expandList.size() > 1 ? expandList.get(1).getIonAbundanceRatio() : null;
     }