|
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -61,6 +62,32 @@ public class ReportIndicatorResultServiceImpl implements ReportIndicatorResultSe
|
|
|
|
|
|
@Override
|
|
|
public boolean update(ReportIndicatorResult result) {
|
|
|
+ // 如果testValue不为空且indicatorId不为空,则进行异常判断
|
|
|
+ if (result.getTestValue() != null && result.getIndicatorId() != null) {
|
|
|
+ // 查询指标信息获取参考范围
|
|
|
+ MedicalIndicator indicator = medicalIndicatorMapper.getById(result.getIndicatorId());
|
|
|
+
|
|
|
+ if (indicator != null && indicator.getReferenceMin() != null && indicator.getReferenceMax() != null) {
|
|
|
+ BigDecimal testValue = result.getTestValue();
|
|
|
+ BigDecimal referenceMin = indicator.getReferenceMin();
|
|
|
+ BigDecimal referenceMax = indicator.getReferenceMax();
|
|
|
+
|
|
|
+ // 判断是否在正常范围内
|
|
|
+ if (testValue.compareTo(referenceMin) >= 0 && testValue.compareTo(referenceMax) <= 0) {
|
|
|
+ // 正常范围内
|
|
|
+ result.setIsAbnormal(0);
|
|
|
+ result.setAbnormalType(null);
|
|
|
+ } else if (testValue.compareTo(referenceMin) < 0) {
|
|
|
+ // 偏低
|
|
|
+ result.setIsAbnormal(1);
|
|
|
+ result.setAbnormalType("偏低");
|
|
|
+ } else {
|
|
|
+ // 偏高
|
|
|
+ result.setIsAbnormal(1);
|
|
|
+ result.setAbnormalType("偏高");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return reportIndicatorResultMapper.update(result) > 0;
|
|
|
}
|
|
|
|