|
@@ -12,7 +12,10 @@ import com.fs.medical.param.ReportIndicatorResultQueryDto;
|
|
|
import com.fs.medical.service.ReportIndicatorResultService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
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;
|
|
|
|
|
@@ -59,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;
|
|
|
}
|
|
|
|
|
@@ -80,4 +109,13 @@ public class ReportIndicatorResultServiceImpl implements ReportIndicatorResultSe
|
|
|
}
|
|
|
return allIndicatorByReportId;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
|
|
|
+ public boolean updateBatch(List<ReportIndicatorResult> resultList) {
|
|
|
+ for (ReportIndicatorResult reportIndicatorResult : resultList) {
|
|
|
+ this.update(reportIndicatorResult);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|