样品活度浓度区间频率分析返回结果添加级别信息

This commit is contained in:
duwenyuan 2025-10-17 09:40:09 +08:00
parent ad0a008820
commit 12ae5b0e99
3 changed files with 76 additions and 19 deletions

View File

@ -13,6 +13,10 @@ public class NuclideActConcIntvl {
*
*/
private Integer sampleId;
/**
* 级别
*/
private Integer category;
/**样品类型
* 系统类型P : particulate; B :gas with 3-D β-γ coincidence detection; G :all other gas systems (high-resolution

View File

@ -110,6 +110,7 @@
a.SAMPLE_TYPE,
a.STATION_ID,
a.STATUS,
c.CATEGORY,
b.NUCLIDENAME NUCLIDE_NAME,
b.CONCENTRATION AS conc,
b.MDC,
@ -117,6 +118,9 @@
FROM
ORIGINAL.GARDS_SAMPLE_DATA a
INNER JOIN
RNAUTO.GARDS_ANALYSES c
ON a.SAMPLE_ID=c.SAMPLE_ID
INNER JOIN
RNAUTO.GARDS_NUCL_IDED b
ON a.SAMPLE_ID = b.SAMPLE_ID
WHERE
@ -366,7 +370,7 @@
SELECT * FROM ${schemaName}.GARDS_THRESHOLD_RESULT_HIS
<where>
<if test="stationIds != null and stationIds.size() > 0">
AND STATION_ID IN
AND STATION_ID IN
<foreach collection="stationIds" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>

View File

@ -1,5 +1,6 @@
package org.jeecg.util;
import lombok.Data;
import org.jeecg.entity.NuclideActConcIntvl;
import java.util.*;
@ -9,20 +10,24 @@ public class DistributionAnalysisToolkit {
/**
* 区间统计结果
*/
@Data
public static class IntervalStat {
private final String interval;
private final int count;
private final List<Double> values;
public IntervalStat(String interval, int count, List<Double> values) {
private final Map<Integer, Integer> levelDistribution;
public IntervalStat(String interval, List<NuclideActConcIntvl> nuclideData) {
values=new ArrayList<>();
levelDistribution=new TreeMap<>();
this.interval = interval;
this.count = count;
this.values = values;
this.count = nuclideData.size();
for (NuclideActConcIntvl nuclide : nuclideData) {
//获取浓度值
values.add(nuclide.getConc());
//计算获取级别
levelDistribution.merge(nuclide.getCategory(),1,Integer::sum);
}
}
public String getInterval() { return interval; }
public int getCount() { return count; }
public List<Double> getValues() { return values; }
}
/**
@ -59,22 +64,61 @@ public class DistributionAnalysisToolkit {
/**
* 数据区间统计
*
* @param data 原始数据
* @param nuclideData 原始数据
* @param start 起始值
* @param step 区间宽度
* @return 区间统计结果列表
*/
public static List<IntervalStat> calculateIntervalStats(List<Double> data, double start, double step) {
if (data == null || data.isEmpty()) {
//region
// public static List<IntervalStat> calculateIntervalStats(List<Double> data, double start, double step) {
// if (data == null || data.isEmpty()) {
// throw new IllegalArgumentException("数据不能为空");
// }
//
// // 计算结束边界
// double max = Collections.max(data);
// double end = Math.ceil(max / step) * step + step;
//
// // 初始化区间映射
// Map<String, List<Double>> intervalMap = new TreeMap<>();
// for (double lower = start; lower < end; lower += step) {
// double upper = lower + step;
// String key = String.format("[%.1f, %.1f)", lower, upper);
// intervalMap.put(key, new ArrayList<>());
// }
//
// // 分配数据到区间
// for (double value : data) {
// double lower = Math.floor(value / step) * step;
// String key = String.format("[%.1f, %.1f)", lower, lower + step);
// intervalMap.get(key).add(value);
// }
//
// // 转换为统计结果对象
// List<IntervalStat> stats = new ArrayList<>();
// for (Map.Entry<String, List<Double>> entry : intervalMap.entrySet()) {
// stats.add(new IntervalStat(entry.getKey(), entry.getValue().size(), entry.getValue()));
// }
//
// return stats;
// }
//
//endregion
public static List<IntervalStat> calculateIntervalStats(List<NuclideActConcIntvl> nuclideData, double start, double step) {
if (nuclideData == null || nuclideData.isEmpty()) {
throw new IllegalArgumentException("数据不能为空");
}
// 计算结束边界
double max = Collections.max(data);
double end = Math.ceil(max / step) * step + step;
double maxConc = nuclideData.stream()
.mapToDouble(NuclideActConcIntvl::getConc)
.max()
.orElse(0.0);
double end = Math.ceil(maxConc / step) * step + step;
// 初始化区间映射
Map<String, List<Double>> intervalMap = new TreeMap<>();
Map<String, List<NuclideActConcIntvl>> intervalMap = new TreeMap<>();
for (double lower = start; lower < end; lower += step) {
double upper = lower + step;
String key = String.format("[%.1f, %.1f)", lower, upper);
@ -82,22 +126,27 @@ public class DistributionAnalysisToolkit {
}
// 分配数据到区间
for (double value : data) {
for (NuclideActConcIntvl nuclide : nuclideData) {
double value=nuclide.getConc();
double lower = Math.floor(value / step) * step;
String key = String.format("[%.1f, %.1f)", lower, lower + step);
intervalMap.get(key).add(value);
intervalMap.get(key).add(nuclide);
}
// 转换为统计结果对象
List<IntervalStat> stats = new ArrayList<>();
for (Map.Entry<String, List<Double>> entry : intervalMap.entrySet()) {
stats.add(new IntervalStat(entry.getKey(), entry.getValue().size(), entry.getValue()));
for (Map.Entry<String,List<NuclideActConcIntvl>> entry : intervalMap.entrySet()) {
stats.add(new IntervalStat(entry.getKey(), entry.getValue()));
}
return stats;
}
/**
* 计算95%累积线
*