feat:自建台站交互分析

This commit is contained in:
nieziyan 2024-07-26 19:15:46 +08:00
parent 82ebe1009e
commit 01ea4f8c63
55 changed files with 2321 additions and 55 deletions

View File

@ -0,0 +1,78 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "RNMAN.GARDS_ANALY_SETTING_ROI")
public class GardsAnalySettingRoi implements Serializable {
@TableField(value = "IDANALYSIS")
private Integer idanalysis;
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
private Integer roiId;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date moddate;
@TableField(value = "ECUTANALYSIS_LOW")
private Double ecutanalysisLow;
@TableField(value = "ECUTANALYSIS_HIGH")
private Double ecutanalysisHigh;
@TableField(value = "ENERGYTOLERANCE")
private Double energytolerance;
@TableField(value = "CALIBRATIONPSS_HIGH")
private Double calibrationpssHigh;
@TableField(value = "CALIBRATIONPSS_LOW")
private Double calibrationpssLow;
@TableField(value = "BASEIMPROVEPSS")
private Double baseimprovepss;
@TableField(value = "PSS_LOW")
private Double pssLow;
@TableField(value = "K_BACK")
private Double KBack;
@TableField(value = "K_ALPHA")
private Double KAlpha;
@TableField(value = "K_BETA")
private Double KBeta;
@TableField(value = "RISKLEVELK")
private Double risklevelk;
@TableField(value = "BUPDATECAL")
private Integer bupdatecal;
@TableField(value = "KEEPCALPEAKSERCHPEAKS")
private Integer keepcalpeakserchpeaks;
@TableField(value = "REFTIME_ACT")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reftimeAct;
@TableField(value = "REFTIME_CONC")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reftimeConc;
}

View File

@ -0,0 +1,41 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@TableName("RNMAN.GARDS_ANALYSIS_ROI")
@Accessors(chain = true)
public class GardsAnalysisRoi {
@TableId("IDANALYSIS")
private Integer idAnalysis;
private Integer sampleId;
private Integer roiId;
private Integer roiNum;
private Double minX;
private Double maxX;
private Double minY;
private Double maxY;
private String phdPath;
private String baselinePath;
private String lcPath;
private String scacPath;
private String logPath;
private String reportPath;
}

View File

@ -0,0 +1,74 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 存储数据分析过程中能量分辨率和效率刻度实际使用的刻度点数据
*/
@Data
@TableName("RNMAN.GARDS_CALIBRATION_PAIRS_ROI")
public class GardsCalibrationPairsRoi implements Serializable {
/**
* 样品id
*/
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
/**
* 分析ID号
*/
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
private Integer roiId;
/**
* Ggamma探测器的数据#g_Bbeta探测器的数据,#b_
*/
@TableField(value = "SAMPLE_TYPE")
private String sampleType;
/**
* energy能量刻度
* efficiency效率刻度
* Resolution分辨率刻度
*/
@TableField(value = "CALTYPE")
private String caltype;
/**
* PHD代表数据来自PHD文件External代表数据来自外部如刻度工具其它文件等
*/
@TableField(value = "INPUT")
private String input;
/**
* 刻度点ID号
*/
@TableField(value = "IDCALPOINT")
private Integer idCalPoint;
@TableField(value = "XVALUE")
private Double xValue;
@TableField(value = "YVALUE")
private Double yValue;
@TableField(value = "DECAY_MODE")
private String decayMode;
/**
* y值不确定度
*/
@TableField(value = "UNCYVALUE")
private Double uncYValue;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}

View File

@ -0,0 +1,119 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 存储数据分析过程中能量分辨率和效率刻度的拟合结果
*/
@Data
@TableName("RNMAN.GARDS_CALIBRATION_ROI")
public class GardsCalibrationRoi implements Serializable {
/**
* 样品id
*/
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
/**
* 分析ID号
*/
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
@TableField(value = "ROI_ID")
private Integer roiId;
/**
* Ggamma探测器的数据#g_Bbeta探测器的数据,#b_
*/
@TableField(value = "SAMPLE_TYPE")
private String sampleType;
/**
* energy能量刻度
* efficiency效率刻度
* Resolution分辨率刻度
*/
@TableField(value = "CALTYPE")
private String calType;
/**
* 拟合方程ID号统一定义
*/
@TableField(value = "FUNCTION")
private Integer function;
/**
* 拟合方程描述
*/
@TableField(value = "FUNCTIONDEF")
private String functionDef;
/**
* 拟合的起始值
*/
@TableField(value = "STARTOFRANGE")
private Integer startOfRange;
/**
* 拟合的结束值
*/
@TableField(value = "ENDOFRANGE")
private Integer endOfRange;
/**
* 拟合系数1
*/
@TableField(value = "COEFF1")
private Double coeff1;
/**
* 拟合系数2
*/
@TableField(value = "COEFF2")
private Double coeff2;
/**
* 拟合系数3
*/
@TableField(value = "COEFF3")
private Double coeff3;
/**
* 拟合系数4
*/
@TableField(value = "COEFF4")
private Double coeff4;
/**
* 拟合系数5
*/
@TableField(value = "COEFF5")
private Double coeff5;
/**
* 拟合系数6
*/
@TableField(value = "COEFF6")
private Double coeff6;
/**
* 拟合系数7
*/
@TableField(value = "COEFF7")
private Double coeff7;
/**
* 拟合系数8
*/
@TableField(value = "COEFF8")
private Double coeff8;
/**
* 拟合系数9
*/
@TableField(value = "COEFF9")
private Double coeff9;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(value = "COEFF_STRING")
private String coeffString;
}

View File

@ -0,0 +1,48 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("RNMAN.GARDS_MDC_ROI")
public class GardsMDCRoi implements Serializable {
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
@TableField(value = "ROI_ID")
private Integer roiId;
@TableField(value = "NUCLIDENAME")
private String nuclideName;
@TableField(value = "ENERGY")
private Double energy;
@TableField(value = "YIELD")
private Double yield;
@TableField(value = "EFFICIENCY")
private Double efficiency;
@TableField(value = "MDC")
private String mdc;
@TableField(value = "MDC_ERR")
private String mdcErr;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}

View File

@ -0,0 +1,122 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 存储gamma谱中识别到的核素计算结果
*/
@Data
@TableName("RNMAN.GARDS_NUCL_IDED_ROI")
public class GardsNuclIdedRoi implements Serializable {
/**
* 样品id
*/
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
/**
* 分析ID号
*/
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
@TableField(value = "ROI_ID")
private Integer roiId;
/**
* 核素名称
*/
@TableField(value = "NUCLIDENAME")
private String nuclideName;
/**
* 核素类型
*/
@TableField(value = "TYPE")
private String type;
/**
* 核素半衰期
*/
@TableField(value = "HALFLIFE")
private String halflife;
/**
* 平均活度值
*/
@TableField(value = "AVE_ACTIV")
private String aveActiv;
/**
* 平均活度值不确定度
*/
@TableField(value = "AVE_ACTIV_ERR")
private Double aveActivErr;
/**
* 主射线活度值
*/
@TableField(value = "ACTIV_KEY")
private Double activKey;
/**
* 主射线活度值不确定度
*/
@TableField(value = "ACTIV_KEY_ERR")
private Double activKeyErr;
/**
* 核素的最小可探测活度
*/
@TableField(value = "MDA")
private String mda;
/**
* 核素的最小可探测活度不确定度
*/
@TableField(value = "MDA_ERR")
private Double mdaErr;
/**
* 核素识别标志
*/
@TableField(value = "NID_FLAG")
private Integer nidFlag;
@TableField(value = "ACTIV_DECAY")
private Double activDecay;
@TableField(value = "ACTIV_DECAY_ERR")
private Double activDecayErr;
/**
* 符合相加校正因子无设为1
*/
@TableField(value = "CSC_RATIO")
private Double cscRatio;
/**
* 符合相加校正因子不确定度无设为0
*/
@TableField(value = "CSC_RATIO_ERR")
private Double cscRatioErr;
/**
* 活度是否经过符合相加校正
*/
@TableField(value = "CSC_MOD_FLAG")
private Integer cscModFlag;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(value = "MDC")
private String mdc;
@TableField(value = "CONCENTRATION")
private String concentration;
@TableField(value = "KEY_ENERGY")
private String keyEnergy;
@TableField(value = "KEY_YIELD")
private String keyYield;
}

View File

@ -0,0 +1,126 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 存储gamma谱中识别到的峰计算结果
*/
@Data
@TableName("RNMAN.GARDS_NUCL_LINES_IDED_ROI")
public class GardsNuclLinesIdedRoi implements Serializable {
/**
* 分析ID号
*/
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
/**
* 样品id
*/
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
@TableField(value = "ROI_ID")
private Integer roiId;
/**
* 峰序号
*/
@TableField(value = "IDPEAK")
private Integer idPeak;
/**
* 核素名称
*/
@TableField(value = "NUCLIDENAME")
private String nuclideName;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
/**
* 核素库中核素对应峰的能量keV
*/
@TableField(value = "ENERGY")
private Double energy;
/**
* 核素库中核素对应峰的能量不确定度keV
*/
@TableField(value = "UNCENERGY")
private Double uncEnergy;
/**
* 核素库中核素对应峰的发射几率
*/
@TableField(value = "ABUNDANCE")
private Double abundance;
/**
* 核素库中核素对应峰的发射几率不确定度
*/
@TableField(value = "UNCABUNDANCE")
private Double uncAbundance;
/**
* 利用该峰计算得到的活度
*/
@TableField(value = "ACTIVITY")
private String activity;
/**
* 利用该峰计算得到的活度不确定度
*/
@TableField(value = "UNCACTIVITY")
private Double uncActivity;
/**
* 该峰处的探测效率
*/
@TableField(value = "EFFIC")
private Double effic;
/**
* 该峰处的探测效率不确定度
*/
@TableField(value = "UNEFFIC")
private Double unEffic;
/**
* 利用该峰计算得到的最小可探测活度
*/
@TableField(value = "MDA")
private Double mda;
/**
* 主射线标识01
*/
@TableField(value = "KEY_FLAG")
private Double keyFlag;
/**
* 符合相加校正因子无设为1
*/
@TableField(value = "CSC_RATIO")
private Double cscRatio;
/**
* 符合相加校正因子不确定度无设为0
*/
@TableField(value = "CSC_RATIO_ERR")
private Double cscRatioErr;
/**
* 活度是否经过符合相加校正
*/
@TableField(value = "CSC_MOD_FLAG")
private Double cscModFlag;
@TableField(value = "NUCLIDEFULLNAME")
private String nuclidefullname;
@TableField(value = "MDC")
private String mdc;
@TableField(value = "CONCENTRATION")
private String concentration;
}

View File

@ -0,0 +1,166 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 存储gamma谱的寻峰结果
*/
@Data
@TableName("RNMAN.GARDS_PEAKS_ROI")
public class GardsPeaksRoi implements Serializable {
/**
* 样品id
*/
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
/**
* 峰序号
*/
@TableField(value = "IDPEAK")
private Integer idPeak;
/**
* 分析ID号
*/
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
@TableField(value = "ROI_ID")
private Integer roiId;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
/**
* 峰中心道道址
*/
@TableField(value = "CENTROIDCHANNEL")
private Double centroidChannel;
/**
* 峰中心道不确定度道址
*/
@TableField(value = "UNCCENTROIDCHANNEL")
private Double uncCentroidChannel;
/**
* 峰中心道能量keV
*/
@TableField(value = "ENERGY")
private Double energy;
/**
* 峰中心道能量不确定度keV
*/
@TableField(value = "UNCENERGY")
private Double uncEnergy;
/**
* 峰面积计数已扣除基线面积但未扣除空白样品计数和探测器本底计数
*/
@TableField(value = "AREA")
private Double area;
/**
* 峰面积不确定度计数
*/
@TableField(value = "UNCAREA")
private Double uncArea;
/**
* 峰的净计数率1/s=峰面积/活时间
*/
@TableField(value = "NETCOUNTRATE")
private Double netCountRate;
/**
* 峰的净计数率的不确定度1/s
*/
@TableField(value = "UNCNETCOUNTRATE")
private Double uncNetCountRate;
/**
* 测量系统在峰能量处的绝对效率
*/
@TableField(value = "EFFICIENCY")
private Double efficiency;
/**
* 测量系统在峰能量处的绝对效率的不确定度
*/
@TableField(value = "UNCEFFICIENCY")
private Double uncefficiency;
/**
* 峰的半高宽
*/
@TableField(value = "FWHM")
private Double fwhm;
/**
* 峰的十分之一高宽
*/
@TableField(value = "FWTM")
private Double fwtm;
/**
* 峰的重要性因子
*/
@TableField(value = "SIGNIFICANCE")
private Double significance;
/**
* 峰的可探测线Lc
*/
@TableField(value = "LC")
private Double lc;
/**
* 峰的感兴趣区的起始道
*/
@TableField(value = "ROISTART")
private Double roiStart;
/**
* 峰的感兴趣区的结束道
*/
@TableField(value = "ROIEND")
private Double roiEnd;
@TableField(value = "MULTIINDEX")
private Double mulitiIndex;
@TableField(value = "TAIL")
private Double tail;
@TableField(value = "TAILALPHA")
private Double tailAlpha;
@TableField(value = "UPPERTAIL")
private Double upperTail;
@TableField(value = "UPPERTAILALPHA")
private Double upperTailAlpha;
@TableField(value = "BWWIDTHCHAN")
private Double bwwidthchan;
@TableField(value = "RECOILDELTACHAN")
private Double recoildeltachan;
@TableField(value = "STEPRAIO")
private Double stepraio;
@TableField(value = "LD")
private Double ld;
@TableField(value = "SENSITIVITY")
private Double sensitivity;
@TableField(value = "BACKGROUNDAREA")
private Double backgroundarea;
@TableField(value = "MEANBACKCOUNT")
private Double meanbackcount;
@TableField(value = "RECOILBETACHAN")
private Double recoilbetachan;
@TableField(value = "PEAKCOMMENTS")
private String peakcomments;
}

View File

@ -0,0 +1,42 @@
package org.jeecg.modules.base.entity.rnman;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "RNMAN.GARDS_QC_CHECK_ROI")
public class GardsQcCheckRoi implements Serializable {
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
@TableField(value = "IDANALYSIS")
private Integer idAnalysis;
@TableField(value = "ROI_ID")
private Integer roiId;
@TableField(value = "QC_NAME")
private String qcName;
@TableField(value = "QC_VALUE")
private Double qcValue;
@TableField(value = "QC_STANDARD")
private String qcStandard;
@TableField(value = "QC_RESULT")
private Integer qcResult;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date moddate;
}

View File

@ -2,12 +2,12 @@ package org.jeecg.modules.spectrum;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Lists;
@ -21,7 +21,6 @@ import org.jeecg.common.constant.enums.SpectrumSystemType;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.*;
import org.jeecg.modules.ErrorLogManager;
import org.jeecg.modules.base.bizVo.AttributeItemVo;
import org.jeecg.modules.base.dto.*;
import org.jeecg.modules.base.entity.original.GardsSampleData;
@ -30,7 +29,6 @@ import org.jeecg.modules.base.enums.DSType;
import org.jeecg.modules.base.enums.MiddleDataType;
import org.jeecg.modules.base.enums.SpectrumType;
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.exception.AnalySpectrumException;
import org.jeecg.modules.exception.CAnalyseException;
@ -131,6 +129,8 @@ public class Sample_C_Analysis {
private PHDFile phdFile3;
private PHDFile phdFile4;
private List<String> phdFilePaths;
private Table<Integer, Integer, GStoreMiddleProcessData> middleDataTable;
public Sample_C_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler, EnergySpectrumStruct sampleStruct, SpectrumServiceQuotes serviceQuotes,
@ -287,37 +287,45 @@ public class Sample_C_Analysis {
bChannels, gChannels, hCounts);
// 根据ROI生成四个Gamma谱文件 文件命名格式为: 样品谱原名_ROI_x.PHD
String savePath = this.saveFullPath();
String gammaOneName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_1.PHD";
selfStationUtil.createGammaFile(this.savePath(), gammaOneName, this.sampleStruct, roiOneCounts);
selfStationUtil.createGammaFile(savePath, gammaOneName, this.sampleStruct, roiOneCounts);
String gammaTwoName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_2.PHD";
selfStationUtil.createGammaFile(this.savePath(), gammaTwoName, this.sampleStruct, roiTwoCounts);
selfStationUtil.createGammaFile(savePath, gammaTwoName, this.sampleStruct, roiTwoCounts);
String gammaThreeName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_3.PHD";
selfStationUtil.createGammaFile(this.savePath(), gammaThreeName, this.sampleStruct, roiThreeCounts);
selfStationUtil.createGammaFile(savePath, gammaThreeName, this.sampleStruct, roiThreeCounts);
String gammaFourName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_4.PHD";
selfStationUtil.createGammaFile(this.savePath(), gammaFourName, this.sampleStruct, roiFourCounts);
selfStationUtil.createGammaFile(savePath, gammaFourName, this.sampleStruct, roiFourCounts);
// 将生成的GammaPHD文件转换为PHDFile对象
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, this.savePath());
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, savePath);
this.phdFile1.setRoiSuffix("_ROI_1");
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, this.savePath());
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, savePath);
this.phdFile2.setRoiSuffix("_ROI_2");
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, this.savePath());
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, savePath);
this.phdFile3.setRoiSuffix("_ROI_3");
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, this.savePath());
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, savePath);
this.phdFile4.setRoiSuffix("_ROI_4");
// 生成PHD的inputFileName
String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath();
gammaOneName = saveRelativePath + StrUtil.SLASH + gammaOneName;
gammaTwoName = saveRelativePath + StrUtil.SLASH + gammaTwoName;
gammaThreeName = saveRelativePath + StrUtil.SLASH + gammaThreeName;
gammaFourName = saveRelativePath + StrUtil.SLASH + gammaFourName;
phdFilePaths = ListUtil.toList(gammaOneName, gammaTwoName, gammaThreeName, gammaFourName);
}
/*
* 获取savefile全路径 不包含文件名
* */
public String savePath(){
public String saveFullPath(){
spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class);
String rootPath = spectrumPathProperties.getRootPath();
String saveFilePath = spectrumPathProperties.getSaveFilePath();
String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath();
return rootPath + saveFilePath + File.separator + saveRelativePath;
return rootPath + saveFilePath + StrUtil.SLASH + saveRelativePath;
}
/**
@ -739,10 +747,11 @@ public class Sample_C_Analysis {
public void saveAnalysisROI(Integer sampleId, GStoreMiddleProcessData... middleDatas){
List<GardsAnalysisRoi> analysisRois = new ArrayList<>();
for (GStoreMiddleProcessData middleData : middleDatas) {
for (int i = 0; i < middleDatas.length; i++) {
GStoreMiddleProcessData middleData = middleDatas[i];
GardsAnalysisRoi analysisRoi = new GardsAnalysisRoi();
analysisRoi.setSampleId(sampleId);
analysisRoi.setPhdPath(this.spectrumHandler.spectrumFileRelativePath);
analysisRoi.setPhdPath(this.phdFilePaths.get(i));
analysisRoi.setBaselinePath(middleData.getAnalyses_baseline_filePath());
analysisRoi.setLcPath(middleData.getAnalyses_lc_filePath());
analysisRoi.setScacPath(middleData.getAnalyses_scac_filePath());

View File

@ -2325,6 +2325,21 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
return bRet;
}
public boolean GetInterMiddlData(List<PHDFile> phds, String userName, List<GStoreMiddleProcessData> middleDatas, String flag) {
boolean bRet = true;
try {
for (int i = 0; i < phds.size(); i++) {
Map<String, NuclideLines> temp = new HashMap<>();
PHDFile phd = phds.get(i);
GStoreMiddleProcessData middleData = middleDatas.get(i);
bRet = GetMiddleData(phd, userName, temp,middleData, MiddleDataType.InterAction.getType(), flag);
middleData.analyses_type ="Interactive";
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
return bRet;
}
public String GetLogContent(GStoreMiddleProcessData middleData) {
StringBuffer strBuffer = new StringBuffer();

View File

@ -0,0 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi;
public interface GardsAnalySettingRoiMapper extends BaseMapper<GardsAnalySettingRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi;
public interface GardsAnalysisRoiManMapper extends BaseMapper<GardsAnalysisRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairsRoi;
public interface GardsCalibrationPairsRoiManMapper extends BaseMapper<GardsCalibrationPairsRoi> {
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi;
import java.util.List;
public interface GardsCalibrationRoiManMapper extends BaseMapper<GardsCalibrationRoi> {
@InterceptorIgnore(tenantLine = "true")
int createBatch(@Param("calibrationRois") List<GardsCalibrationRoi> calibrationRois);
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsMDCRoi;
public interface GardsMdcRoiManMapper extends BaseMapper<GardsMDCRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsNuclIdedRoi;
public interface GardsNuclIdedRoiManMapper extends BaseMapper<GardsNuclIdedRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsNuclLinesIdedRoi;
public interface GardsNuclLinesIdedRoiManMapper extends BaseMapper<GardsNuclLinesIdedRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsPeaksRoi;
public interface GardsPeaksRoiManMapper extends BaseMapper<GardsPeaksRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.rnman.GardsQcCheckRoi;
public interface GardsQcCheckRoiManMapper extends BaseMapper<GardsQcCheckRoi> {
}

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsCalibrationRoiManMapper">
<insert id="createBatch" parameterType="org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi">
begin
<foreach collection="calibrationRois" separator=";" close=";" item="calibration">
insert into RNMAN.GARDS_CALIBRATION_ROI(
SAMPLE_ID,
ROI_ID,
IDANALYSIS,
SAMPLE_TYPE,
CALTYPE,
FUNCTION,
FUNCTIONDEF,
STARTOFRANGE,
ENDOFRANGE,
COEFF_STRING,
moddate)
values
(#{calibration.sampleId},
#{calibration.roiId},
#{calibration.idAnalysis},
#{calibration.sampleType},
#{calibration.calType},
#{calibration.function},
#{calibration.functionDef},
#{calibration.startOfRange},
#{calibration.endOfRange},
#{calibration.coeffString},
#{calibration.moddate})
</foreach>
end;
</insert>
</mapper>

View File

@ -0,0 +1,50 @@
package org.jeecg.modules.service;
import org.jeecg.modules.base.entity.rnman.GardsAnalyses;
import org.jeecg.modules.entity.vo.CalMDCInfo;
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData;
import org.jeecg.modules.entity.vo.QcCheckItem;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import java.util.List;
import java.util.Map;
public interface AnalysisManService {
void middleDataTable(Integer idAnalysis, List<GStoreMiddleProcessData> middleDatas);
void saveAnalysisROI(Integer sampleId, Integer idAnalysis,EnergySpectrumStruct sampleStruct,
List<GStoreMiddleProcessData> middleDatas, List<String> phdFilePaths);
void deleteAnalysisROI(Integer idAnalysis);
void deleteCalibrationPairs(Integer idAnalysis);
void deleteCalibration(Integer idAnalysis);
void deletePeaks(Integer idAnalysis);
void deleteNuclLines(Integer idAnalysis);
void deleteNucl(Integer idAnalysis);
void deleteQCCheck(Integer idAnalysis);
void deleteMDC(Integer idAnalysis);
void deleteAnalySetting(Integer idAnalysis);
void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis);
void saveCalibrationROI(Integer sampleId, Integer idAnalysis);
void savePeaksROI(Integer sampleId, Integer idAnalysis);
void saveNuclLinesIdedROI(Integer sampleId, Integer idAnalysis);
void saveNuclIdedROI(Integer sampleId, Integer idAnalysis);
void saveQcCheckROI(Integer sampleId, Map<String, QcCheckItem> qcItems, Integer idAnalysis);
void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap, Integer idAnalysis);
}

View File

@ -0,0 +1,10 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi;
import org.jeecg.modules.entity.vo.PHDFile;
public interface IGardsAnalySettingRoiService extends IService<GardsAnalySettingRoi> {
}

View File

@ -0,0 +1,13 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi;
import java.util.List;
public interface IGardsAnalysisRoiManService extends IService<GardsAnalysisRoi> {
Integer getIdAnalysisAny(Integer sampleId);
List<GardsAnalysisRoi> analysisRoi(Integer idAnalysis);
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairsRoi;
public interface IGardsCalibrationPairsRoiManService extends IService<GardsCalibrationPairsRoi> {
}

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi;
import java.util.List;
public interface IGardsCalibrationRoiManService extends IService<GardsCalibrationRoi> {
int createBatch(List<GardsCalibrationRoi> calibrationRois);
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsMDCRoi;
public interface IGardsMdcRoiManService extends IService<GardsMDCRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsNuclIdedRoi;
public interface IGardsNuclIdedRoiManService extends IService<GardsNuclIdedRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsNuclLinesIdedRoi;
public interface IGardsNuclLinesIdedRoiManService extends IService<GardsNuclLinesIdedRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsPeaksRoi;
public interface IGardsPeaksRoiManService extends IService<GardsPeaksRoi> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnman.GardsQcCheckRoi;
public interface IGardsQcCheckRoiManService extends IService<GardsQcCheckRoi> {
}

View File

@ -0,0 +1,665 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Lists;
import com.google.common.collect.Table;
import org.jeecg.modules.base.dto.*;
import org.jeecg.modules.base.entity.rnman.*;
import org.jeecg.modules.entity.vo.CalMDCInfo;
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData;
import org.jeecg.modules.entity.vo.GStoreMiddleProcessDataNuclLinesIded;
import org.jeecg.modules.entity.vo.QcCheckItem;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.*;
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.lang.reflect.Field;
import java.util.*;
import static org.jeecgframework.codegenerate.a.a.i;
@Service
@Transactional(propagation = Propagation.REQUIRES_NEW)
public class AnalysisManServiceImpl implements AnalysisManService {
@Autowired
private IGardsAnalysisRoiManService analysisRoiManService;
@Autowired
private IGardsCalibrationPairsRoiManService calibrationPairsRoiManService;
@Autowired
private IGardsCalibrationRoiManService calibrationRoiManService;
@Autowired
private IGardsMdcRoiManService mdcRoiManService;
@Autowired
private IGardsNuclIdedRoiManService nuclIdedRoiManService;
@Autowired
private IGardsNuclLinesIdedRoiManService nuclLinesIdedRoiManService;
@Autowired
private IGardsPeaksRoiManService peaksRoiManService;
@Autowired
private IGardsQcCheckRoiManService qcCheckRoiManService;
@Autowired
private IGardsAnalySettingRoiService analySettingRoiService;
private Map<Integer, GStoreMiddleProcessData> middleDataMap;
private final Map<String,String> fieldMap = fieldMap();
@Override
public void middleDataTable(Integer idAnalysis, List<GStoreMiddleProcessData> middleDatas) {
List<GardsAnalysisRoi> analysisRois = analysisRoiManService.analysisRoi(idAnalysis);
Map<Integer, GStoreMiddleProcessData> middleDataMap = new HashMap<>();
for (int i = 0; i < analysisRois.size(); i++) {
GardsAnalysisRoi analysisRoi = analysisRois.get(i);
Integer roiId = analysisRoi.getRoiId();
middleDataMap.put(roiId, middleDatas.get(i));
}
this.middleDataMap = middleDataMap;
}
@Override
public void saveAnalysisROI(Integer sampleId, Integer idAnalysis, EnergySpectrumStruct sampleStruct, List<GStoreMiddleProcessData> middleDatas, List<String> phdFilePaths) {
List<GardsAnalysisRoi> analysisRois = new ArrayList<>();
List<String> roiNumber = sampleStruct.ROI_number;
for (int i = 0; i < middleDatas.size(); i++) {
GStoreMiddleProcessData middleData = middleDatas.get(i);
GardsAnalysisRoi analysisRoi = new GardsAnalysisRoi();
analysisRoi.setSampleId(sampleId);
analysisRoi.setIdAnalysis(idAnalysis);
analysisRoi.setPhdPath(phdFilePaths.get(i));
analysisRoi.setBaselinePath(middleData.getAnalyses_baseline_filePath());
analysisRoi.setLcPath(middleData.getAnalyses_lc_filePath());
analysisRoi.setScacPath(middleData.getAnalyses_scac_filePath());
analysisRoi.setLogPath(middleData.getAnalyses_LogPath());
analysisRoi.setReportPath(middleData.getAnalyses_ReportPath());
analysisRoi.setRoiNum(Integer.valueOf(roiNumber.get(i)));
analysisRoi.setMinX(sampleStruct.POI_B_x1.get(i));
analysisRoi.setMaxX(sampleStruct.POI_B_x2.get(i));
analysisRoi.setMinY(sampleStruct.POI_G_y1.get(i));
analysisRoi.setMaxY(sampleStruct.POI_G_y2.get(i));
analysisRois.add(analysisRoi);
}
analysisRoiManService.saveBatch(analysisRois);
}
@Override
public void deleteAnalysisROI(Integer idAnalysis) {
LambdaUpdateWrapper<GardsAnalysisRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(GardsAnalysisRoi::getIdAnalysis, idAnalysis);
analysisRoiManService.remove(wrapper);
}
// 根据 IDANALYSIS 删除数据
@Override
public void deleteCalibrationPairs(Integer idAnalysis) {
LambdaUpdateWrapper<GardsCalibrationPairsRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(GardsCalibrationPairsRoi::getIdAnalysis, idAnalysis);
calibrationPairsRoiManService.remove(wrapper);
}
@Override
public void deleteCalibration(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsCalibrationRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsCalibrationRoi::getIdAnalysis, idAnalysisSet);
calibrationRoiManService.remove(wrapper);
}
@Override
public void deletePeaks(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsPeaksRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsPeaksRoi::getIdAnalysis, idAnalysisSet);
peaksRoiManService.remove(wrapper);
}
@Override
public void deleteNuclLines(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsNuclLinesIdedRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsNuclLinesIdedRoi::getIdAnalysis, idAnalysisSet);
nuclLinesIdedRoiManService.remove(wrapper);
}
@Override
public void deleteNucl(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsNuclIdedRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsNuclIdedRoi::getIdAnalysis, idAnalysisSet);
nuclIdedRoiManService.remove(wrapper);
}
@Override
public void deleteQCCheck(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsQcCheckRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsQcCheckRoi::getIdAnalysis, idAnalysisSet);
qcCheckRoiManService.remove(wrapper);
}
@Override
public void deleteMDC(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsMDCRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsMDCRoi::getIdAnalysis, idAnalysisSet);
mdcRoiManService.remove(wrapper);
}
@Override
public void deleteAnalySetting(Integer idAnalysis) {
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
LambdaUpdateWrapper<GardsAnalySettingRoi> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(GardsAnalySettingRoi::getIdanalysis, idAnalysisSet);
analySettingRoiService.remove(wrapper);
}
@Override
public void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis) {
List<GardsCalibrationPairsRoi> pairsRois = new ArrayList<>();
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
Integer IdAnalysis = cell.getRowKey();
Integer roiId = cell.getColumnKey();
GStoreMiddleProcessData middleData = cell.getValue();
pairsRois.addAll(saveCalibrationPairsROI(sampleId, IdAnalysis, roiId, middleData));
}
calibrationPairsRoiManService.saveBatch(pairsRois);
}
public List<GardsCalibrationPairsRoi> saveCalibrationPairsROI(Integer sampleId, Integer IdAnalysis,
Integer roiId, GStoreMiddleProcessData middleData){
String pairsSampleType = middleData.getCalibration_pairs_sample_type();
GardsCalibrationPairsRoi pairs = new GardsCalibrationPairsRoi();
// GARDS_CALIBRATION_PAIRS (Energy) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
String base_E_Paris = "calibration_pairs_E_idCalPoint";
PairsEDto pairsEDto = new PairsEDto();
BeanUtil.copyProperties(middleData, pairsEDto);
List<GardsCalibrationPairsRoi> pairsE = Lists.newArrayList();
if (pairsEDto.getCalibration_pairs_E_idCalPoint().size() > 0) {
pairsE = mapFields(pairsEDto, pairs, base_E_Paris, fieldMap);
String pairsECaltype = middleData.getCalibration_pairs_E_Caltype();
String pairsEInput = middleData.getCalibration_pairs_E_Input();
for (GardsCalibrationPairsRoi onePairs : pairsE) {
onePairs.setSampleId(sampleId);
onePairs.setRoiId(roiId);
onePairs.setIdAnalysis(IdAnalysis);
onePairs.setSampleType(pairsSampleType);
onePairs.setCaltype(pairsECaltype);
onePairs.setInput(pairsEInput);
}
}
// GARDS_CALIBRATION_PAIRS (Efficiency) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
String base_EF_Paris = "calibration_pairs_EF_idCalPoint";
PairsEFDto pairsEFDto = new PairsEFDto();
BeanUtil.copyProperties(middleData, pairsEFDto);
List<GardsCalibrationPairsRoi> pairsEF = Lists.newArrayList();
if (pairsEFDto.getCalibration_pairs_EF_idCalPoint().size() > 0) {
pairsEF = mapFields(pairsEFDto, pairs, base_EF_Paris, fieldMap);
String pairsEFCaltype = middleData.getCalibration_pairs_EF_Caltype();
String pairsEFInput = middleData.getCalibration_pairs_EF_Input();
for (GardsCalibrationPairsRoi onePairs : pairsEF) {
onePairs.setSampleId(sampleId);
onePairs.setRoiId(roiId);
onePairs.setIdAnalysis(IdAnalysis);
onePairs.setSampleType(pairsSampleType);
onePairs.setCaltype(pairsEFCaltype);
onePairs.setInput(pairsEFInput);
}
}
// GARDS_CALIBRATION_PAIRS (Resolution) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
String base_R_Paris = "calibration_pairs_R_idCalPoint";
PairsRDto pairsRDto = new PairsRDto();
BeanUtil.copyProperties(middleData,pairsRDto);
List<GardsCalibrationPairsRoi> pairsR = Lists.newArrayList();
if (pairsRDto.getCalibration_pairs_R_idCalPoint().size() > 0) {
pairsR = mapFields(pairsRDto, pairs, base_R_Paris, fieldMap);
String pairsRCaltype = middleData.getCalibration_pairs_R_Caltype();
String pairsRInput = middleData.getCalibration_pairs_R_Input();
for (GardsCalibrationPairsRoi onePairs : pairsR) {
onePairs.setSampleId(sampleId);
onePairs.setRoiId(roiId);
onePairs.setIdAnalysis(IdAnalysis);
onePairs.setSampleType(pairsSampleType);
onePairs.setCaltype(pairsRCaltype);
onePairs.setInput(pairsRInput);
}
}
// GARDS_CALIBRATION_PAIRS (TotalEfficiency) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
String base_T_Paris = "calibration_pairs_T_idCalPoint";
PairsTDto pairsTDto = new PairsTDto();
BeanUtil.copyProperties(middleData,pairsTDto);
List<GardsCalibrationPairsRoi> pairsT = Lists.newArrayList();
if (pairsTDto.getCalibration_pairs_T_idCalPoint().size() > 0) {
pairsT = mapFields(pairsTDto, pairs, base_T_Paris, fieldMap);
String pairsTCaltype = middleData.getCalibration_pairs_T_Caltype();
String pairsTInput = middleData.getCalibration_pairs_T_Input();
for (GardsCalibrationPairsRoi onePairs : pairsT) {
onePairs.setSampleId(sampleId);
onePairs.setRoiId(roiId);
onePairs.setIdAnalysis(IdAnalysis);
onePairs.setSampleType(pairsSampleType);
onePairs.setCaltype(pairsTCaltype);
onePairs.setInput(pairsTInput);
}
}
// GARDS_CALIBRATION_PAIRS 汇总保存
List<GardsCalibrationPairsRoi> allPairs = new ArrayList<>();
allPairs.addAll(pairsE);allPairs.addAll(pairsEF);
allPairs.addAll(pairsR);allPairs.addAll(pairsT);
return allPairs;
}
@Override
public void saveCalibrationROI(Integer sampleId, Integer idAnalysis) {
List<GardsCalibrationRoi> calibrationRois = new ArrayList<>();
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
Integer IdAnalysis = cell.getRowKey();
Integer roiId = cell.getColumnKey();
GStoreMiddleProcessData middleData = cell.getValue();
calibrationRois.addAll(saveCalibrationROI(sampleId, IdAnalysis, roiId, middleData));
}
calibrationRoiManService.createBatch(calibrationRois);
}
public List<GardsCalibrationRoi> saveCalibrationROI(Integer sampleId, Integer IdAnalysis, Integer roiId,
GStoreMiddleProcessData middleData){
String calibrationSampleType = middleData.getCalibration_sample_type();
List<String> pairsEIdCalPoint = middleData.getCalibration_pairs_E_idCalPoint();
List<String> pairsEFIdCalPoint = middleData.getCalibration_pairs_EF_idCalPoint();
List<String> pairsRIdCalPoint = middleData.getCalibration_pairs_R_idCalPoint();
List<String> pairsTIdCalPoint = middleData.getCalibration_pairs_T_idCalPoint();
List<GardsCalibrationRoi> calibrations = new ArrayList<>();
// GARDS_CALIBRATION (E) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsEIdCalPoint)){
GardsCalibrationRoi calibration = new GardsCalibrationRoi();
calibration.setSampleId(sampleId);
calibration.setRoiId(roiId);
calibration.setIdAnalysis(IdAnalysis);
calibration.setSampleType(calibrationSampleType);
calibration.setCalType(middleData.getCalibration_E_Caltype());
calibration.setFunction((int)middleData.getCalibration_E_function());
calibration.setFunctionDef(middleData.getCalibration_E_functionDef());
calibration.setStartOfRange((int)middleData.getCalibration_E_startOfRange());
calibration.setEndOfRange((int)middleData.getCalibration_E_endOfRange());
calibration.setCoeffString(middleData.getCalibration_E_coeff_string());
calibration.setModdate(new Date());
calibrations.add(calibration);
}
// GARDS_CALIBRATION (EF) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsEFIdCalPoint)){
GardsCalibrationRoi calibration = new GardsCalibrationRoi();
calibration.setSampleId(sampleId);
calibration.setRoiId(roiId);
calibration.setIdAnalysis(IdAnalysis);
calibration.setSampleType(calibrationSampleType);
String efCaltype = middleData.getCalibration_EF_Caltype();
double efFunction = middleData.getCalibration_EF_function();
String efFunctionDef = middleData.getCalibration_EF_functionDef();
double efStartOfRange = middleData.getCalibration_EF_startOfRange();
double efEndOfRange = middleData.getCalibration_EF_endOfRange();
String efCoeffString = middleData.getCalibration_EF_coeff_string();
calibration.setCalType(efCaltype);
calibration.setFunction((int)efFunction);
calibration.setFunctionDef(efFunctionDef);
calibration.setStartOfRange((int)efStartOfRange);
calibration.setEndOfRange((int)efEndOfRange);
calibration.setCoeffString(efCoeffString);
calibration.setModdate(new Date());
calibrations.add(calibration);
}
// GARDS_CALIBRATION (R) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsRIdCalPoint)){
GardsCalibrationRoi calibration = new GardsCalibrationRoi();
calibration.setSampleId(sampleId);
calibration.setRoiId(roiId);
calibration.setIdAnalysis(IdAnalysis);
calibration.setSampleType(calibrationSampleType);
String rCaltype = middleData.getCalibration_R_Caltype();
double rFunction = middleData.getCalibration_R_function();
String rFunctionDef = middleData.getCalibration_R_functionDef();
double rStartOfRange = middleData.getCalibration_R_startOfRange();
double rEndOfRange = middleData.getCalibration_R_endOfRange();
String rCoeffString = middleData.getCalibration_R_coeff_string();
calibration.setCalType(rCaltype);
calibration.setFunction((int)rFunction);
calibration.setFunctionDef(rFunctionDef);
calibration.setStartOfRange((int)rStartOfRange);
calibration.setEndOfRange((int)rEndOfRange);
calibration.setCoeffString(rCoeffString);
calibration.setModdate(new Date());
calibrations.add(calibration);
}
// GARDS_CALIBRATION (T) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsTIdCalPoint)){
GardsCalibrationRoi calibration = new GardsCalibrationRoi();
calibration.setSampleId(sampleId);
calibration.setRoiId(roiId);
calibration.setIdAnalysis(IdAnalysis);
calibration.setSampleType(calibrationSampleType);
String tCaltype = middleData.getCalibration_T_Caltype();
double tFunction = middleData.getCalibration_T_function();
String tFunctionDef = middleData.getCalibration_T_functionDef();
double tStartOfRange = middleData.getCalibration_T_startOfRange();
double tEndOfRange = middleData.getCalibration_T_endOfRange();
String tCoeffString = middleData.getCalibration_T_coeff_string();
calibration.setCalType(tCaltype);
calibration.setFunction((int)middleData.getCalibration_T_function());
calibration.setFunctionDef(tFunctionDef);
calibration.setStartOfRange((int)tStartOfRange);
calibration.setEndOfRange((int)tEndOfRange);
calibration.setCoeffString(tCoeffString);
calibration.setModdate(new Date());
calibrations.add(calibration);
}
return calibrations;
}
@Override
public void savePeaksROI(Integer sampleId, Integer idAnalysis) {
List<GardsPeaksRoi> peaksRois = new ArrayList<>();
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
Integer IdAnalysis = cell.getRowKey();
Integer roiId = cell.getColumnKey();
GStoreMiddleProcessData middleData = cell.getValue();
peaksRois.addAll(savePeaksROI(sampleId, IdAnalysis, roiId, middleData));
}
peaksRoiManService.saveBatch(peaksRois);
}
public List<GardsPeaksRoi> savePeaksROI(Integer sampleId, Integer IdAnalysis,
Integer roiId, GStoreMiddleProcessData middleData){
// Gards_Peaks_ROI数据表 ==> INSERT INTO RNAUTO.GARDS_PEAKS_ROI
String base_P_IdPeak = "peaks_idPeak";
GardsPeaksDto gardsPeaksDto = new GardsPeaksDto();
BeanUtil.copyProperties(middleData, gardsPeaksDto);
GardsPeaksRoi peak = new GardsPeaksRoi();
List<GardsPeaksRoi> peaks = new ArrayList<>();
if (CollUtil.isNotEmpty(gardsPeaksDto.getPeaks_idPeak())) {
peaks = mapFields(gardsPeaksDto, peak, base_P_IdPeak, fieldMap);
peaks.forEach(item -> {
item.setRoiId(roiId);
item.setSampleId(sampleId);
item.setIdAnalysis(IdAnalysis);
});
}
return peaks;
}
@Override
public void saveNuclLinesIdedROI(Integer sampleId, Integer idAnalysis){
List<GardsNuclLinesIdedRoi> linesIdedRois = new ArrayList<>();
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
Integer IdAnalysis = cell.getRowKey();
Integer roiId = cell.getColumnKey();
GStoreMiddleProcessData middleData = cell.getValue();
linesIdedRois.addAll(saveNuclLinesIdedROI(sampleId, IdAnalysis, roiId, middleData));
}
nuclLinesIdedRoiManService.saveBatch(linesIdedRois);
}
public List<GardsNuclLinesIdedRoi> saveNuclLinesIdedROI(Integer sampleId, Integer IdAnalysis, Integer roiId,
GStoreMiddleProcessData middleData){
// Gards_Nucl_Lines_Ided数据表 ==> INSERT INTO RNAUTO.GARDS_NUCL_LINES_IDED
Map<String, GStoreMiddleProcessDataNuclLinesIded> nuclLinesIdedData = middleData.getNucl_lines_ided_data();
String base_IdPeak = "idPeak";
List<GardsNuclLinesIdedRoi> allNuclLinesIdeds = new ArrayList<>();
for (Map.Entry<String, GStoreMiddleProcessDataNuclLinesIded> entry : nuclLinesIdedData.entrySet()) {
String nuclideName = entry.getKey();
GStoreMiddleProcessDataNuclLinesIded nuclLinesIded = entry.getValue();
GardsNuclLinesIdedRoi linesIdedRoi = new GardsNuclLinesIdedRoi();
List<GardsNuclLinesIdedRoi> linesIdedRois = mapFields(nuclLinesIded, linesIdedRoi, base_IdPeak, fieldMap);
if (CollUtil.isNotEmpty(linesIdedRois)){
for (GardsNuclLinesIdedRoi idedRoi : linesIdedRois) {
idedRoi.setRoiId(roiId);
idedRoi.setSampleId(sampleId);
idedRoi.setIdAnalysis(IdAnalysis);
idedRoi.setNuclideName(nuclideName);
}
allNuclLinesIdeds.addAll(linesIdedRois);
}
}
return allNuclLinesIdeds;
}
public List<GardsNuclIdedRoi> saveNuclIdedROI(Integer sampleId, Integer IdAnalysis,
Integer roiId, GStoreMiddleProcessData middleData){
// Gards_Nucl_Ided数据表 ==> INSERT INTO RNAUTO.GARDS_NUCL_IDED
GardsNuclIdedDto nuclIdedDto = new GardsNuclIdedDto();
GardsNuclIdedRoi nuclIdedRoi = new GardsNuclIdedRoi();
BeanUtil.copyProperties(middleData, nuclIdedDto);
List<GardsNuclIdedRoi> nuclIdedRois = new ArrayList<>();
if (CollUtil.isNotEmpty(nuclIdedDto.getNucl_ided_Nuclidename())) {
String base_NuclideName = "nucl_ided_Nuclidename";
nuclIdedRois = mapFields(nuclIdedDto, nuclIdedRoi, base_NuclideName, fieldMap);
for (GardsNuclIdedRoi idedRoi : nuclIdedRois) {
idedRoi.setRoiId(roiId);
idedRoi.setSampleId(sampleId);
idedRoi.setIdAnalysis(IdAnalysis);
}
}
return nuclIdedRois;
}
@Override
public void saveNuclIdedROI(Integer sampleId, Integer idAnalysis){
List<GardsNuclIdedRoi> idedRois = new ArrayList<>();
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
Integer IdAnalysis = cell.getRowKey();
Integer roiId = cell.getColumnKey();
GStoreMiddleProcessData middleData = cell.getValue();
idedRois.addAll(saveNuclIdedROI(sampleId, IdAnalysis, roiId, middleData));
}
nuclIdedRoiManService.saveBatch(idedRois);
}
public void saveQcCheckROI(Integer sampleId, Integer IdAnalysis, Integer roiId,
Map<String, QcCheckItem> qcItems,
GStoreMiddleProcessData middleData){
}
@Override
public void saveQcCheckROI(Integer sampleId, Map<String, QcCheckItem> qcItems, Integer idAnalysis){
}
public List<GardsMDCRoi> saveMDCROI(Integer sampleId, Integer IdAnalysis,
Integer roiId, Map<String, CalMDCInfo> mdcInfoMap) {
List<GardsMDCRoi> mdcRois = new LinkedList<>();
for (CalMDCInfo mdcInfo :mdcInfoMap.values()) {
if (ObjectUtil.isNull(mdcInfo)) continue;
if (Objects.nonNull(mdcInfo.getEnergy()) && Objects.nonNull(mdcInfo.getYield())
&& Objects.nonNull(mdcInfo.getEfficiency())) {
GardsMDCRoi mdcRoi = new GardsMDCRoi();
mdcRoi.setRoiId(roiId);
mdcRoi.setSampleId(sampleId);
mdcRoi.setIdAnalysis(IdAnalysis);
mdcRoi.setNuclideName(mdcInfo.getNuclideName());
mdcRoi.setEnergy(mdcInfo.getEnergy());
mdcRoi.setYield(mdcInfo.getYield());
mdcRoi.setEfficiency(mdcInfo.getEfficiency());
if (Objects.nonNull(mdcInfo.getMdc()) && Double.isFinite(mdcInfo.getMdc())) {
mdcRoi.setMdc(String.valueOf(mdcInfo.getMdc()));
} else {
mdcRoi.setMdc(null);
}
mdcRoi.setMdcErr(null);
mdcRois.add(mdcRoi);
}
}
return mdcRois;
}
@Override
public void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap, Integer idAnalysis){
List<GardsMDCRoi> mdcRois = new ArrayList<>();
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
Integer IdAnalysis = cell.getRowKey();
Integer roiId = cell.getColumnKey();
mdcRois.addAll(saveMDCROI(sampleId, IdAnalysis, roiId, mdcInfoMap));
}
mdcRoiManService.saveBatch(mdcRois);
}
public Map<String,String> fieldMap(){
Map<String,String> fieldMap = new HashMap<>();
// Gards_Nucl_Lines_Ided
fieldMap.put("nuclideFullname","nuclidefullname");
fieldMap.put("Energy","energy");
fieldMap.put("Abundance","abundance");
fieldMap.put("Activity","activity");
fieldMap.put("Effic","effic");
fieldMap.put("uncEffic","unEffic");
fieldMap.put("Mda","mda");
fieldMap.put("key_flag","keyFlag");
fieldMap.put("csc_ratio","cscRatio");
fieldMap.put("csc_ratio_err","cscRatioErr");
fieldMap.put("csc_mod_flag","cscModFlag");
fieldMap.put("MDC","mdc");
fieldMap.put("Concentration","concentration");
// Gards_Nucl_Ided
fieldMap.put("nucl_ided_Nuclidename","nuclideName");
fieldMap.put("nucl_ided_Type","type");
fieldMap.put("nucl_ided_Halflife","halflife");
fieldMap.put("nucl_ided_ave_activ","aveActiv");
fieldMap.put("nucl_ided_ave_activ_err","aveActivErr");
fieldMap.put("nucl_ided_activ_key","activKey");
fieldMap.put("nucl_ided_activ_key_err","activKeyErr");
fieldMap.put("nucl_ided_mda","mda");
fieldMap.put("nucl_ided_mda_err","mdaErr");
fieldMap.put("nucl_ided_nid_flag","nidFlag");
fieldMap.put("nucl_ided_csc_ratio","cscRatio");
fieldMap.put("nucl_ided_csc_ratio_err","cscRatioErr");
fieldMap.put("nucl_ided_csc_mod_flag","cscModFlag");
fieldMap.put("nucl_ided_MDC","mdc");
fieldMap.put("nucl_ided_Concentration","concentration");
fieldMap.put("nucl_ided_Key_Energy","keyEnergy");
fieldMap.put("nucl_ided_Key_Yield","keyYield");
// Gards_Qc_Check
fieldMap.put("QC_CHECK_QC_NAME","qcName");
fieldMap.put("QC_CHECK_QC_VALUE","qcValue");
fieldMap.put("QC_CHECK_QC_STANDARD","qcStandard");
fieldMap.put("QC_CHECK_QC_RESULT","qcResult");
// Gards_Peaks
fieldMap.put("peaks_idPeak", "idPeak");
fieldMap.put("peaks_peakCentroid", "centroidChannel");
fieldMap.put("peaks_uncpeakCentroid", "uncCentroidChannel");
fieldMap.put("peaks_Energy", "energy");
fieldMap.put("peaks_uncEnergy", "uncEnergy");
fieldMap.put("peaks_Area", "area");
fieldMap.put("peaks_areaErr", "uncArea");
fieldMap.put("peaks_netCountRate", "netCountRate");
fieldMap.put("peaks_uncNetCountRate", "uncNetCountRate");
fieldMap.put("peaks_Efficiency", "efficiency");
fieldMap.put("peaks_Uncefficiency", "uncefficiency");
fieldMap.put("peaks_Fwhm", "fwhm");
fieldMap.put("peaks_Fwhmc", "fwtm");
fieldMap.put("peaks_Significance", "significance");
fieldMap.put("peaks_Sensitivity", "sensitivity");
fieldMap.put("peaks_multiIndex", "mulitiIndex");
fieldMap.put("peaks_ROIstart", "roiStart");
fieldMap.put("peaks_ROIend", "roiEnd");
fieldMap.put("peaks_tail", "tail");
fieldMap.put("peaks_tailAlpha", "tailAlpha");
fieldMap.put("peaks_upperTail", "upperTail");
fieldMap.put("peaks_upperTailAlpha", "upperTailAlpha");
fieldMap.put("peaks_BWWidthChan", "bwwidthchan");
fieldMap.put("peaks_recoilDeltaChan", "recoildeltachan");
fieldMap.put("peaks_stepRatio", "stepraio");
fieldMap.put("peaks_backgroundArea", "backgroundarea");
fieldMap.put("peaks_meanBackCount", "meanbackcount");
fieldMap.put("peaks_Lc", "lc");
fieldMap.put("peaks_Ld", "ld");
// GARDS_CALIBRATION_PAIRS
fieldMap.put("calibration_pairs_E_idCalPoint","idCalPoint");
fieldMap.put("calibration_pairs_E_xValue","xValue");
fieldMap.put("calibration_pairs_E_yValue","yValue");
fieldMap.put("calibration_pairs_E_uncYValue","uncYValue");
fieldMap.put("calibration_pairs_EF_idCalPoint","idCalPoint");
fieldMap.put("calibration_pairs_EF_xValue","xValue");
fieldMap.put("calibration_pairs_EF_yValue","yValue");
fieldMap.put("calibration_pairs_EF_uncYValue","uncYValue");
fieldMap.put("calibration_pairs_R_idCalPoint","idCalPoint");
fieldMap.put("calibration_pairs_R_xValue","xValue");
fieldMap.put("calibration_pairs_R_yValue","yValue");
fieldMap.put("calibration_pairs_R_uncYValue","uncYValue");
fieldMap.put("calibration_pairs_T_idCalPoint","idCalPoint");
fieldMap.put("calibration_pairs_T_xValue","xValue");
fieldMap.put("calibration_pairs_T_yValue","yValue");
fieldMap.put("calibration_pairs_T_uncYValue","uncYValue");
return fieldMap;
}
public <T1,T2> List<T2> mapFields(T1 source, T2 tartget, String baseLine, Map<String,String> fieldMap) {
try {
List<T2> result = new ArrayList<>();
Class<?> sourceClass = source.getClass();
boolean isNumber = NumberUtil.isNumber(baseLine);
int total;
if (isNumber){
total = Integer.parseInt(baseLine);
}else {
Field declaredField = sourceClass.getDeclaredField(baseLine);
declaredField.setAccessible(true);
List<String> baseList = (List<String>) declaredField.get(source);
if (CollUtil.isEmpty(baseList))
return result;
total = baseList.size();
}
Class<T2> tartgetClass = (Class<T2>) tartget.getClass();
Field[] sourceFields = sourceClass.getDeclaredFields();
for (int i = 0; i < total; i++) {
tartget = tartgetClass.newInstance();
for (Field sourceField : sourceFields) {
try {
sourceField.setAccessible(true);
List<String> sourceList = (List<String>) sourceField.get(source);
if (CollUtil.isEmpty(sourceList))
continue;
if (sourceList.size() <= i)
continue;
String value = sourceList.get(i);
if (StrUtil.isNotBlank(value)){
String sourceFieldName = sourceField.getName();
String targetFieldName = fieldMap.get(sourceFieldName);
targetFieldName = StrUtil.isBlank(targetFieldName) ? sourceFieldName : targetFieldName;
Field tartgetField = tartgetClass.getDeclaredField(targetFieldName);
tartgetField.setAccessible(true);
Class<?> type = tartgetField.getType();
if (type == String.class) {
tartgetField.set(tartget, value);
} else if (type == Integer.class || type == int.class) {
// 避免类似0.000的String值转Integer时NumberFormatException
tartgetField.set(tartget, Double.valueOf(value).intValue());
} else if (type == Double.class || type == double.class) {
tartgetField.set(tartget, Double.valueOf(value));
} else if (type == Boolean.class || type == boolean.class) {
tartgetField.set(tartget, Boolean.valueOf(value));
}
}
}catch (Exception e){
System.out.println("Sample_G_Analysis.mapFields()值映射异常: " + e.getMessage());
}
}
result.add(tartget);
}
return result;
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<>();
}
}
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi;
import org.jeecg.modules.entity.vo.PHDFile;
import org.jeecg.modules.mapper.GardsAnalySettingRoiMapper;
import org.jeecg.modules.service.IGardsAnalySettingRoiService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@DS("ora")
public class GardsAnalySettingRoiServiceImpl extends ServiceImpl<GardsAnalySettingRoiMapper, GardsAnalySettingRoi> implements IGardsAnalySettingRoiService {
}

View File

@ -0,0 +1,34 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi;
import org.jeecg.modules.mapper.GardsAnalysisRoiManMapper;
import org.jeecg.modules.service.IGardsAnalysisRoiManService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@DS("ora")
public class GardsAnalysisRoiManServiceImpl extends ServiceImpl<GardsAnalysisRoiManMapper, GardsAnalysisRoi> implements IGardsAnalysisRoiManService {
@Override
public Integer getIdAnalysisAny(Integer sampleId) {
LambdaQueryWrapper<GardsAnalysisRoi> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAnalysisRoi::getSampleId, sampleId);
List<GardsAnalysisRoi> analysisRois = list(wrapper);
return analysisRois.stream().findAny().orElse(new GardsAnalysisRoi())
.getIdAnalysis();
}
@Override
public List<GardsAnalysisRoi> analysisRoi(Integer idAnalysis) {
LambdaQueryWrapper<GardsAnalysisRoi> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAnalysisRoi::getIdAnalysis, idAnalysis);
wrapper.orderByAsc(GardsAnalysisRoi::getRoiNum);
return list(wrapper);
}
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.rnauto.GardsCalibrationPairsRoi;
import org.jeecg.modules.mapper.GardsCalibrationPairsRoiMapper;
import org.jeecg.modules.service.IGardsCalibrationPairsRoiAutoService;
@ -7,13 +8,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2024-07-24
* @Version: V1.0
*/
@Service
@DS("ora")
public class GardsCalibrationPairsRoiAutoServiceImpl extends ServiceImpl<GardsCalibrationPairsRoiMapper, GardsCalibrationPairsRoi> implements IGardsCalibrationPairsRoiAutoService {
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairsRoi;
import org.jeecg.modules.mapper.GardsCalibrationPairsRoiManMapper;
import org.jeecg.modules.service.IGardsCalibrationPairsRoiManService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsCalibrationPairsRoiManServiceImpl extends ServiceImpl<GardsCalibrationPairsRoiManMapper, GardsCalibrationPairsRoi> implements IGardsCalibrationPairsRoiManService {
}

View File

@ -0,0 +1,20 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi;
import org.jeecg.modules.mapper.GardsCalibrationRoiManMapper;
import org.jeecg.modules.service.IGardsCalibrationRoiManService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@DS("ora")
public class GardsCalibrationRoiManServiceImpl extends ServiceImpl<GardsCalibrationRoiManMapper, GardsCalibrationRoi> implements IGardsCalibrationRoiManService {
@Override
public int createBatch(List<GardsCalibrationRoi> calibrationRois) {
return this.baseMapper.createBatch(calibrationRois);
}
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.rnauto.GardsMDCRoi;
import org.jeecg.modules.mapper.GardsMdcRoiMapper;
import org.jeecg.modules.service.IGardsMdcRoiAutoService;
@ -8,6 +9,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
@DS("ora")
public class GardsMdcRoiAutoServiceImpl extends ServiceImpl<GardsMdcRoiMapper, GardsMDCRoi> implements IGardsMdcRoiAutoService {
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsMDCRoi;
import org.jeecg.modules.mapper.GardsMdcRoiManMapper;
import org.jeecg.modules.service.IGardsMdcRoiManService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsMdcRoiManServiceImpl extends ServiceImpl<GardsMdcRoiManMapper, GardsMDCRoi> implements IGardsMdcRoiManService {
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIdedRoi;
import org.jeecg.modules.mapper.GardsNuclIdedRoiMapper;
import org.jeecg.modules.service.IGardsNuclIdedRoiAutoService;
@ -7,13 +8,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2024-07-24
* @Version: V1.0
*/
@Service
@DS("ora")
public class GardsNuclIdedRoiAutoServiceImpl extends ServiceImpl<GardsNuclIdedRoiMapper, GardsNuclIdedRoi> implements IGardsNuclIdedRoiAutoService {
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsNuclIdedRoi;
import org.jeecg.modules.mapper.GardsNuclIdedRoiManMapper;
import org.jeecg.modules.service.IGardsNuclIdedRoiManService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsNuclIdedRoiManServiceImpl extends ServiceImpl<GardsNuclIdedRoiManMapper, GardsNuclIdedRoi> implements IGardsNuclIdedRoiManService {
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.rnauto.GardsNuclLinesIdedRoi;
import org.jeecg.modules.mapper.GardsNuclLinesIdedRoiMapper;
import org.jeecg.modules.service.IGardsNuclLinesIdedRoiAutoService;
@ -7,13 +8,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2024-07-24
* @Version: V1.0
*/
@Service
@DS("ora")
public class GardsNuclLinesIdedRoiAutoServiceImpl extends ServiceImpl<GardsNuclLinesIdedRoiMapper, GardsNuclLinesIdedRoi> implements IGardsNuclLinesIdedRoiAutoService {
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsNuclLinesIdedRoi;
import org.jeecg.modules.mapper.GardsNuclLinesIdedRoiManMapper;
import org.jeecg.modules.service.IGardsNuclLinesIdedRoiManService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsNuclLinesIdedRoiManServiceImpl extends ServiceImpl<GardsNuclLinesIdedRoiManMapper, GardsNuclLinesIdedRoi> implements IGardsNuclLinesIdedRoiManService {
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.rnauto.GardsPeaksRoi;
import org.jeecg.modules.mapper.GardsPeaksRoiMapper;
import org.jeecg.modules.service.IGardsPeaksRoiAutoService;
@ -7,13 +8,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2024-07-24
* @Version: V1.0
*/
@Service
@DS("ora")
public class GardsPeaksRoiAutoServiceImpl extends ServiceImpl<GardsPeaksRoiMapper, GardsPeaksRoi> implements IGardsPeaksRoiAutoService {
}

View File

@ -0,0 +1,13 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsPeaksRoi;
import org.jeecg.modules.mapper.GardsPeaksRoiManMapper;
import org.jeecg.modules.service.IGardsPeaksRoiManService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsPeaksRoiManServiceImpl extends ServiceImpl<GardsPeaksRoiManMapper, GardsPeaksRoi> implements IGardsPeaksRoiManService {
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.rnauto.GardsQcCheckRoi;
import org.jeecg.modules.mapper.GardsQcCheckRoiMapper;
import org.jeecg.modules.service.IGardsQcCheckRoiAutoService;
@ -7,13 +8,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2024-07-24
* @Version: V1.0
*/
@Service
@DS("ora")
public class GardsQcCheckRoiAutoServiceImpl extends ServiceImpl<GardsQcCheckRoiMapper, GardsQcCheckRoi> implements IGardsQcCheckRoiAutoService {
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnman.GardsQcCheckRoi;
import org.jeecg.modules.mapper.GardsQcCheckRoiManMapper;
import org.jeecg.modules.service.IGardsQcCheckRoiManService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsQcCheckRoiManServiceImpl extends ServiceImpl<GardsQcCheckRoiManMapper, GardsQcCheckRoi> implements IGardsQcCheckRoiManService {
}

View File

@ -333,4 +333,10 @@ public class SelfStationController {
public Result viewSpectrum(String fileName, HttpServletRequest request) {
return selfStationService.viewSpectrum(fileName, request);
}
@GetMapping("saveToDB")
@ApiOperation(value = "Save To DB按钮", notes = "Save To DB按钮")
public Result saveToDB(String fileName, HttpServletRequest request) {
return selfStationService.saveToDB(fileName, request);
}
}

View File

@ -12,4 +12,6 @@ public interface IGardsAnalysesSpectrumService extends IService<GardsAnalyses> {
void updateEntity(GStoreMiddleProcessData middleData, PHDFile phd, String userName, String comments, String idAnalysis);
Integer saveAnalyses(Integer sampleId, String startTime, String userName);
}

View File

@ -108,4 +108,6 @@ public interface ISelfStationService {
Result configureSave(ConfigureData configureData, HttpServletRequest request);
Result viewSpectrum(String fileName, HttpServletRequest request);
Result saveToDB(String fileName, HttpServletRequest request);
}

View File

@ -72,4 +72,22 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesM
this.baseMapper.updateEntity(analyses);
}
@Override
public Integer saveAnalyses(Integer sampleId, String startTime, String userName) {
GardsAnalyses analyses = new GardsAnalyses();
try {
analyses.setSampleId(sampleId);
analyses.setAnalysisBegin(DateUtils.parseDate(startTime));
analyses.setAnalysisEnd(new Date());
analyses.setType("Interactive");
analyses.setSoftware("");
analyses.setSwVersion("1.0.1");
analyses.setAnalyst(userName);
} catch (ParseException e) {
throw new RuntimeException(e);
}
this.save(analyses);
return analyses.getIdAnalysis();
}
}

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@ -19,6 +20,7 @@ import org.apache.commons.math3.fitting.WeightedObservedPoints;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.cache.SelfCache;
import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.system.util.JwtUtil;
@ -27,17 +29,19 @@ import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgBoundary;
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.ISelfStationService;
import org.jeecg.modules.service.ISysDefaultNuclideSpectrumService;
import org.jeecg.modules.service.ISysUserColorService;
import org.jeecg.modules.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
@ -74,9 +78,40 @@ public class SelfStationServiceImpl implements ISelfStationService {
@Autowired
private SpectrumAnalysisMapper spectrumAnalysisMapper;
@Autowired
private LocalCache localCache;
private UserTaskUtil userTaskUtil;
@Autowired
private NameStandUtil nameStandUtil;
@Autowired
private ISysDefaultNuclideSpectrumService defaultNuclideSpectrumService;
@Autowired
private IGardsAnalysisRoiManService analysisRoiManService;
@Autowired
private AnalysisManService analysisManService;
@Autowired
private IGardsSampleDataSpectrumService sampleDataSpectrumService;
@Autowired
private IGardsSampleAuxSpectrumService sampleAuxSpectrumService;
@Autowired
private IGardsSampleDescriptionSpectrumService sampleDescriptionSpectrumService;
@Autowired
private IGardsSampleCertSpectrumService sampleCertSpectrumService;
@Autowired
private IGardsSampleCertLineSpectrumService sampleCertLineSpectrumService;
@Autowired
private IGardsCalibrationPairsOrigSpectrumService calibrationPairsOrigSpectrumService;
@Autowired
private IGardsTotalEfficiencyPairsSpectrumService totalEfficiencyPairsSpectrumService;
@Autowired
private IGardsSpectrumSpectrumService spectrumService;
@Autowired
private IGardsCalibrationPairsSpectrumService calibrationPairsSpectrumService;
@Autowired
private IGardsCalibrationSpectrumService calibrationSpectrumService;
@Autowired
private IGardsAnalysesSpectrumService analysesSpectrumService;
private List<String> phdFilePaths;
@Override
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String detFileName,
@ -3449,6 +3484,320 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
@Override
public Result saveToDB(String fileName, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
boolean bRet = false;
//读取本地缓存
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
SelfStationData selfStationData = selfCache.getIfPresent(fileName + StringPool.DASH + userName);
if (Objects.isNull(selfStationData)) {
result.error500("Please select the parse file first");
return result;
}
if (!phd.isBAnalyed()) {
result.error500("Please first Reprocessing!");
return result;
}
//获取当前操作的台站的id
EnergySpectrumStruct sampleStruct = selfStationData.getSampleStruct();
String siteCode = sampleStruct.site_code;
Integer stationId = spectrumAnalysisMapper.getStationId(siteCode);
//判断当前分析员当天是否有对应台站的排班任务
List<String> userStation = userTaskUtil.findUserStation(userName);
boolean bAnalysisResultWriteAuthority = userStation.contains(String.valueOf(stationId));
// 获取Beta谱文件的inputFileName
String saveFileName = saveFileName(sampleStruct);
String savePathName = savePathName(sampleStruct);
String sampleInputFileName = savePathName + StrUtil.SLASH + saveFileName;
//判断当前分析员是否有过历史分析当前文件 TODO RNMAN.GARDS_ANALYSIS_ROI表没有分析员字段
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleInputFileName, userName);
// 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员
if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) {
result.error500("You have no permission to save "+siteCode+" results to DB!");
return result;
}
// 如果有权限则开始保存数据库操作
// 将PHDFile数据 生成用于数据库存储的数据结构
GStoreMiddleProcessData middleData1 = new GStoreMiddleProcessData();
GStoreMiddleProcessData middleData2 = new GStoreMiddleProcessData();
GStoreMiddleProcessData middleData3 = new GStoreMiddleProcessData();
GStoreMiddleProcessData middleData4 = new GStoreMiddleProcessData();
List<GStoreMiddleProcessData> middleDatas =
ListUtil.toList(middleData1, middleData2, middleData3, middleData4);
List<PHDFile> phdFiles = create4PHD(sampleStruct);
bRet = gammaFileUtil.GetInterMiddlData(phdFiles, userName, middleDatas, "save");
if (!bRet) {
result.error500("Transform PHDFile into structGStoreMiddleProcessData failed.");
return result;
}
// 根据文件名称查询对应的sampleId 如果存在则赋值sampleId, Status 如果不存在则先存储数据信息到sampleData
PHDFile phd = new PHDFile();
BeanUtils.copyProperties(phdFiles.get(0), phd);
GardsSampleDataSpectrum sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName);
if (ObjectUtil.isNotNull(sampleData)) {
phd.setId_sample(sampleData.getSampleId().toString());
phd.setStatus(sampleData.getStatus());
} else {
// 如果sampleData为空 存储数据
bRet = SaveSampleToDB(phd, sampleInputFileName);
if (!bRet) {
result.error500("The Database hasn't this Spectrum(" + saveFileName + ") and Insert it to Database failed.");
return result;
}
sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName);
}
Integer sampleId = sampleData.getSampleId();
// 根据sampleId 查询idAnalysis
String idAnalysisStr = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(sampleId.toString(), userName);
Integer idAnalysis = StrUtil.isBlank(idAnalysisStr) ? null : Integer.valueOf(idAnalysisStr);
// 写入 RNMAN数据库
// 判断idAnalysis是否为空
if (ObjectUtil.isNull(idAnalysis)) {
// RNMAN.GARDS_ANALYSES 表插入数据
idAnalysis = analysesSpectrumService.saveAnalyses(sampleId, phd.getAnaly_start_time(), userName);
// RNMAN.GARDS_ANALYSES_ROI 表插入数据
analysisManService.saveAnalysisROI(sampleId, idAnalysis, sampleStruct, middleDatas, this.phdFilePaths);
// 获取Table IdAnalysis:RoiId:GStoreMiddleProcessData
analysisManService.middleDataTable(idAnalysis, middleDatas);
// 修改sample_data状态
spectrumAnalysisMapper.updateAnalysesStatus(sampleInputFileName);
} else {
// 更新 RNMAN.GARDS_ANALYSES 表数据 TODO
// 删除 RNMAN.GARDS_ANALYSES_ROI 表数据
analysisManService.deleteAnalysisROI(idAnalysis);
// 删除GARDS_CALIBRATION_PAIRS_ROI表数据
analysisManService.deleteCalibrationPairs(idAnalysis);
// 删除GARDS_CALIBRATION_ROI表数据
analysisManService.deleteCalibration(idAnalysis);
// 删除GARDS_PEAKS_ROI表数据
analysisManService.deletePeaks(idAnalysis);
// 删除GARDS_NUCL_LINES_IDED_ROI表数据
analysisManService.deleteNuclLines(idAnalysis);
// 删除GARDS_NUCL_IDED_ROI表数据
analysisManService.deleteNucl(idAnalysis);
// 删除GARDS_QC_CHECK_ROI表数据
//analysisManService.deleteQCCheck(Integer.valueOf(idAnalysis));
// 删除GARDS_MDC_ROI表数据
analysisManService.deleteMDC(idAnalysis);
// 删除GARDS_ANALY_SETTING_ROI表数据
analysisManService.deleteAnalySetting(idAnalysis);
}
// RNMAN.GARDS_ANALYSES_ROI 表插入数据
analysisManService.saveAnalysisROI(sampleId, idAnalysis, sampleStruct, middleDatas, this.phdFilePaths);
// RNMAN.GARDS_CALIBRATION_PAIRS 表写入 Energy 刻度数据对
analysisManService.saveCalibrationPairsROI(sampleId, idAnalysis);
analysisManService.saveCalibrationROI(sampleId, idAnalysis);
// RNMAN.GARDS_PEAKS 表写入峰信息
analysisManService.savePeaksROI(sampleId, idAnalysis);
// RNMAN.GARDS_NUCL_LINES_IDED 表写入被识别核素的射线信息
analysisManService.saveNuclLinesIdedROI(sampleId, idAnalysis);
// RNMAN.GARDS_NUCL_IDED 表写入被识别核素的活度浓度信息
analysisManService.saveNuclIdedROI(sampleId, idAnalysis);
// RNMAN.GARDS_QC_CHECK 表写入 QC 检查结果
//analysisManService.saveQcCheckROI(sampleId, null);
// RNMAN.GARDS_ANALY_SETTING 表写入 SpecSetup 分析参数设置
analysisManService.saveAnalySettingGamma(phd, idAnalysis);
// RNMAN.GARDS_MDC 表写入 MDC计算结果 TODO
analysisManService.saveMDCROI(sampleId, null, idAnalysis);
if (bRet) {
phd.setStatus("R");
//分析成功后存储日志文件和报告文件
for (GStoreMiddleProcessData middleData : middleDatas) {
String logFileName = middleData.analyses_absolute_LogPath.substring(middleData.analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH)+1);
String rptFileName = middleData.analyses_absolute_ReportPath.substring(middleData.analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
File logFile = new File(logFileName);
File rptFile = new File(rptFileName);
try {
FileUtil.writeString(gammaFileUtil.GetLogContent(middleData), logFile, "UTF-8");
FileInputStream logIn = new FileInputStream(logFile);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_LogPath, logIn);
FileUtil.writeString(gammaFileUtil.GetReportContent(middleData), rptFile, "UTF-8");
FileInputStream rptIn = new FileInputStream(rptFile);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_ReportPath+".txt", rptIn);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
logFile.delete();
rptFile.delete();
}
}
} else {
result.error500("Save analysis results to DB failed.");
return result;
}
Map<String, Object> map = new HashMap<>();
//更新detial Information
List<String> detailedInfo = gammaFileUtil.DetailedInfo(sampleId.toString(), phd);
map.put("DetailedInformation", detailedInfo);
//发送数据到redis
/*middleData.setSample_stationID(String.valueOf(stationId));
middleData.setSample_id(String.valueOf(phd.getId_sample()));
pushToRedis(middleData, phd);*/
result.setSuccess(true);
result.setResult(map);
return result;
}
@Transactional
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
boolean bRet = false;
String sit_det_code = phd.getHeader().getSite_code();
String detect_code = phd.getHeader().getDetector_code();
// 查询 station_id detect_id
Integer station_id = spectrumAnalysisMapper.getStationId(sit_det_code);
Integer detect_id = spectrumAnalysisMapper.getDetectorId(detect_code);
// ORIGINAL.GARDS_SAMPLE_DATA 表数据
Integer saveSampleDataGamma = sampleDataSpectrumService.saveSampleDataGamma(phd, input_file_name, station_id, detect_id);
if (saveSampleDataGamma > 0) {
bRet = true;
} else {
bRet = false;
return bRet;
}
// 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID
Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name);
// ORIGINAL.GARDS_SAMPLE_AUX 表数据
Integer saveSampleAuxGamma = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
if (saveSampleAuxGamma > 0) {
bRet = true;
} else {
bRet = false;
return bRet;
}
// ORIGINAL.gards_sample_description 数据表
sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
// ORIGINAL.GARDS_SAMPLE_CERT ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表
if (phd.getCertificate().getRecord_count() > 0) {
sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId);
sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
}
// gards_ calibration_pairs_orig数据表
Integer saveCalibrationPairsOrigGamma = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
// gards_total_efficiency _pairs数据表(IDC没有)
Integer saveTotalEfficiencyPairsGamma = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
// gards_spectrum数据表
Integer saveSpectrumGamma = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
// 根据文件名称获取sample基础数据信息
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
if (Objects.nonNull(samplData)) {
phd.setId_sample(samplData.getSampleId().toString());
phd.setStatus(samplData.getStatus());
}
return bRet;
}
private String saveFileName(EnergySpectrumStruct struct){
String dataType = struct.data_type;
String measurementId = struct.measurement_id;
String spectrumQuantity = struct.spectrum_quantity;
double acquisitionLiveTime = struct.acquisition_live_time;
String suffix = nameStandUtil
.GetSuffix(dataType, spectrumQuantity, String.valueOf(acquisitionLiveTime));
return nameStandUtil.GetFileNameFromDateTime(measurementId, suffix);
}
private String savePathName(EnergySpectrumStruct struct){
String dataType = struct.data_type;
String systemType = struct.system_type;
String measurementId = struct.measurement_id;
//measurement_id切割后的字符数组
String[] arr = measurementId.split(StringConstant.DASH);
//切割后第一个元素是年第二个是月
final String[] yearMonth = arr[1].split(StringConstant.SLASH);
StringBuilder relativePath = new StringBuilder();
relativePath.append(spectrumPathProperties.getFilePathMap().get(systemType));
relativePath.append(File.separator);
relativePath.append(spectrumPathProperties.getFilePathMap().get(dataType));
relativePath.append(File.separator);
relativePath.append(yearMonth[0]);
relativePath.append(File.separator);
relativePath.append(yearMonth[1]);
return relativePath.toString();
}
private String saveFullPathName(EnergySpectrumStruct struct){
String rootPath = spectrumPathProperties.getRootPath();
String saveFilePath = spectrumPathProperties.getSaveFilePath();
String saveRelativePath = savePathName(struct);
return rootPath + saveFilePath + StrUtil.SLASH + saveRelativePath;
}
private List<PHDFile> create4PHD(EnergySpectrumStruct sampleStruct){
// 计算边界值
List<Double> gEnergy = sampleStruct.g_energy;
List<Double> gCentroidChannel = sampleStruct.g_centroid_channel;
List<Double> bElectronEnergy = sampleStruct.b_electron_energy;
List<Double> bChannel = sampleStruct.b_channel;
long bChannels = sampleStruct.b_channels;
long gChannels = sampleStruct.g_channels;
List<Long> hCounts = sampleStruct.h_counts;
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
calcBgBoundaryParam.b_e_cal = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
calcBgBoundaryParam.b_energy = sampleStruct.b_electron_energy;
calcBgBoundaryParam.b_channel = sampleStruct.b_channel;
calcBgBoundaryParam.g_channel = sampleStruct.g_centroid_channel;
calcBgBoundaryParam.g_energy = sampleStruct.g_energy;
calcBgBoundaryParam.ROI_B_start_x1 = sampleStruct.POI_B_x1;
calcBgBoundaryParam.ROI_B_stop_x2 = sampleStruct.POI_B_x2;
calcBgBoundaryParam.ROI_G_start_y1 = sampleStruct.POI_G_y1;
calcBgBoundaryParam.ROI_G_stop_y2 = sampleStruct.POI_G_y2;
BgBoundary bgBoundary = EnergySpectrumHandler.CalcBgBoundary(calcBgBoundaryParam);
// 新Beta谱只取X轴数据从Y轴0的位置开始连成一条线一直到顶画出矩形框 这个矩形框内的数据就是Gamma谱数据
List<Integer> roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start;
List<Integer> roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop;
// 根据范围1划分 范围1对应的折线图
List<Long> roiOneCounts = selfStationUtil.roiList(roiBBoundaryStart.get(0), roiBBoundaryStop.get(0),
bChannels, gChannels, hCounts);
// 根据范围2划分 范围2对应的折线图
List<Long> roiTwoCounts = selfStationUtil.roiList(roiBBoundaryStart.get(1), roiBBoundaryStop.get(1),
bChannels, gChannels, hCounts);
// 根据范围3划分 范围3对应的折线图
List<Long> roiThreeCounts = selfStationUtil.roiList(roiBBoundaryStart.get(2), roiBBoundaryStop.get(2),
bChannels, gChannels, hCounts);
// 根据范围4划分 范围4对应的折线图
List<Long> roiFourCounts = selfStationUtil.roiList(roiBBoundaryStart.get(3), roiBBoundaryStop.get(3),
bChannels, gChannels, hCounts);
// 根据ROI生成四个Gamma谱文件 文件命名格式为: 样品谱原名_ROI_x.PHD
String sampleFilename = saveFileName(sampleStruct);
String saveFullPathName = saveFullPathName(sampleStruct);
String gammaOneName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_1.PHD";
selfStationUtil.createGammaFile(saveFullPathName, gammaOneName, sampleStruct, roiOneCounts);
String gammaTwoName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_2.PHD";
selfStationUtil.createGammaFile(saveFullPathName, gammaTwoName, sampleStruct, roiTwoCounts);
String gammaThreeName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_3.PHD";
selfStationUtil.createGammaFile(saveFullPathName, gammaThreeName, sampleStruct, roiThreeCounts);
String gammaFourName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_4.PHD";
selfStationUtil.createGammaFile(saveFullPathName, gammaFourName, sampleStruct, roiFourCounts);
// 将生成的GammaPHD文件转换为PHDFile对象
PHDFile phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, saveFullPathName);
phdFile1.setRoiSuffix("_ROI_1");
PHDFile phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, saveFullPathName);
phdFile2.setRoiSuffix("_ROI_2");
PHDFile phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, saveFullPathName);
phdFile3.setRoiSuffix("_ROI_3");
PHDFile phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, saveFullPathName);
phdFile4.setRoiSuffix("_ROI_4");
String saveRelativePath = savePathName(sampleStruct);
String path1 = saveRelativePath + StrUtil.SLASH + gammaOneName;
String path2 = saveRelativePath + StrUtil.SLASH + gammaTwoName;
String path3 = saveRelativePath + StrUtil.SLASH + gammaThreeName;
String path4 = saveRelativePath + StrUtil.SLASH + gammaFourName;
phdFilePaths = ListUtil.toList(path1, path2, path3, path4);
return ListUtil.toList(phdFile1, phdFile2, phdFile3, phdFile4);
}
/**
* 执行gamma分析
* @param phd gamma 数据

View File

@ -144,7 +144,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
}
@Override
// @Override
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType) {
Result result = new Result();
//接收返回结果

View File

@ -1,5 +1,5 @@
#code_generate_project_path
project_path=C:\\Users\\a\\Desktop
project_path=C:\\Users\\Manchester\\Desktop
#bussi_package[User defined]
bussi_package=org.jeecg
#bussi_package=org.jeecg.modules

View File

@ -13,10 +13,10 @@
#database_name=original
diver_name=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@82.157.234.81:1521:orcl
username=configuration
url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
username=RNAUTO
password=123456
database_name=configuration
database_name=RNAUTO
#diver_name=oracle.jdbc.driver.OracleDriver
#url=jdbc:oracle:thin:@82.157.234.81:1521:orcl