fix: 核素分析规则增加QC 条件筛选

This commit is contained in:
xiaoguangbin 2025-01-02 14:52:13 +08:00
parent 3aefd94bde
commit befb0de7f1
4 changed files with 107 additions and 13 deletions

View File

@ -1,21 +1,11 @@
package org.jeecg.modules.base.entity.postgre;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.scheduling.annotation.Scheduled;
@Data
@TableName("alarm_analysis_rule")
@ -47,6 +37,39 @@ public class AlarmAnalysisRule extends JeecgEntity {
/** 联系人组id */
private String contactGroup;
private String colTime;
private String acqTime;
private Double airFlow;
private Double decayTime;
private Double sampVol;
@TableField("ba140_mdc")
private Double ba140MDC;
@TableField("be7_fwhm")
private Double be7FWHM;
@TableField("xe133_mdc")
private String xe133MDC;
@TableField("xe_vol")
private Double xeVol;
@TableField("xe131m_flag")
private Integer xe131mFlag;
@TableField("xe133m_flag")
private Integer xe133mFlag;
@TableField("xe133_flag")
private Integer xe133Flag;
@TableField("xe135_flag")
private Integer xe135Flag;
/** 备注 */
private String remark;
}

View File

@ -10,6 +10,7 @@
RNAUTO.GARDS_NUCL_IDED nucl
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
INNER JOIN RNAUTO.GARDS_QC_CHECK qc ON samp.SAMPLE_ID = qc.SAMPLE_ID
<where>
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
@ -21,6 +22,30 @@
#{item}
</foreach>
</if>
<if test="colTime != null and colTime.size() > 0">
AND (qc.qc_name = 'col_time' and qc.qc_value between #{colTime[0]} and #{colTime[1]} )
</if>
<if test="acqTime != null and acqTime.size() > 0">
AND (qc.qc_name = 'acq_time' and qc.qc_value between #{acqTime[0]} and #{acqTime[1]} )
</if>
<if test="airFlow != null">
AND (qc.qc_name = 'air_flow' and qc.qc_value &lt; #{airFlow} )
</if>
<if test="decayTime != nul">
AND (qc.qc_name = 'decay_time' and qc.qc_value &lt; #{decayTime} )
</if>
<if test="sampVol != null">
AND (qc.qc_name = 'samp_vol' and qc.qc_value &lt; #{sampVol} )
</if>
<if test="be7FWHM != null">
AND (qc.qc_name = 'Be7-FWHM' and qc.qc_value &lt; #{be7FWHM} )
</if>
<if test="ba140MDC != null">
AND (qc.qc_name = 'Ba140-MDC' and qc.qc_value &lt; #{ba140MDC} )
</if>
<if test="xe133MDC != null">
AND (qc.qc_name = 'Xe133-MDC' and qc.qc_value &lt; #{xe133MDC} )
</if>
</where>
</select>
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">

View File

@ -10,6 +10,7 @@
RNAUTO.GARDS_XE_RESULTS xe
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux ON samp.SAMPLE_ID = aux.SAMPLE_ID
<where>
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
@ -21,6 +22,18 @@
#{item}
</foreach>
</if>
<if test="colTime != null and colTime.size() > 0">
and ((TO_NUMBER(samp.COLLECT_STOP - samp.COLLECT_START) * 24) between #{colTime[0]} and #{colTime[1]} )
</if>
<if test="acqTime != null and acqTime.size() > 0">
and (samp.ACQUISITION_LIVE_SEC / 3600 between #{colTime[0]} and #{colTime[1]} )
</if>
<if test="XeVol != null">
AND (aux.XE_VOLUME &gt; #{XeVol} )
</if>
<if test="Xe133MDC != null and Xe133MDC.size() > 0">
AND (xe.NUCLIDE_NAME = 'Xe133m' AND MDC between #{Xe133MDC[0]} AND #{Xe133MDC[1]} )
</if>
</where>
</select>
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">

View File

@ -28,7 +28,6 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -76,11 +75,45 @@ public class CalculateConcServiceImpl implements CalculateConcService {
String comma = SymbolConstant.COMMA;
// 获取所有生效的报警规则
List<AlarmAnalysisRule> analysisRules = analysisRuleService.allAnalysisRule();
Map<String,Object> params = new HashMap<>();
// 对所有报警规则的关注台站和关注核素进行统计
Map<String, Set<String>> nuclideMap = new HashMap<>(); // key:台站code value:核素列表
for (AlarmAnalysisRule analysisRule : analysisRules) {
String stationStr = analysisRule.getStations();
String nuclideStr = analysisRule.getNuclides();
// QC Flags
List<String> colTime = StrUtil.isNotBlank(analysisRule.getColTime())
? ListUtil.toList(StrUtil.split(analysisRule.getColTime(), comma)) : null;
if(null != colTime) {
params.put("colTime", colTime);
}
List<String> acqTime = StrUtil.isNotBlank(analysisRule.getAcqTime())
? ListUtil.toList(StrUtil.split(analysisRule.getAcqTime(), comma)) : null;
if(null != acqTime) {
params.put("acqTime", acqTime);
}
List<String> xe133MDC = StrUtil.isNotBlank(analysisRule.getXe133MDC())
? ListUtil.toList(StrUtil.split(analysisRule.getXe133MDC(), comma)) : null;
if(null != xe133MDC) {
params.put("Xe133MDC", xe133MDC);
}
if(null != analysisRule.getAirFlow()) params.put("airFlow", analysisRule.getAirFlow());
if(null != analysisRule.getDecayTime()) params.put("decayTime", analysisRule.getDecayTime());
if(null != analysisRule.getSampVol()) params.put("sampVol", analysisRule.getSampVol());
if(null != analysisRule.getBa140MDC()) params.put("Ba140MDC", analysisRule.getBa140MDC());
if(null != analysisRule.getBe7FWHM()) params.put("Be7FWHM", analysisRule.getBe7FWHM());
if(null != analysisRule.getXeVol()) params.put("XeVol", analysisRule.getXeVol());
if(null != analysisRule.getXe131mFlag()) params.put("Xe131mFlag", analysisRule.getXe131mFlag());
if(null != analysisRule.getXe133mFlag()) params.put("Xe133mFlag", analysisRule.getXe133mFlag());
if(null != analysisRule.getXe133Flag()) params.put("Xe133Flag", analysisRule.getXe133Flag());
if(null != analysisRule.getXe135Flag()) params.put("Xe135Flag", analysisRule.getXe135Flag());
// 获取关注台站
List<String> stations = ListUtil.toList(StrUtil.split(stationStr, comma));
// 获取关注核素
@ -96,7 +129,7 @@ public class CalculateConcServiceImpl implements CalculateConcService {
}
}
// 核素浓度值查询参数准备
Map<String,Object> params = new HashMap<>();
AlarmAnalysisNuclideParam paramLatest = nuclideParamService.getLatest();
BigDecimal index = paramLatest.getIndex();
Integer days = paramLatest.getDays();
@ -177,7 +210,7 @@ public class CalculateConcServiceImpl implements CalculateConcService {
// 记录日志
log.info(log(allAvgs));
}catch (Exception e){
log.error("NucliedAvgJob执行异常: {}", e.getMessage());
log.error("NucliedAvgJob执行异常: ", e);
}
}