fix: 自建台站能谱算法增加参数和返回结果;增加自建台站报告
This commit is contained in:
parent
ee968ae840
commit
6096429d2d
|
@ -3,6 +3,7 @@ package org.jeecg.modules.spectrum;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
@ -28,6 +29,7 @@ import org.jeecg.modules.base.entity.rnauto.*;
|
||||||
import org.jeecg.modules.base.enums.*;
|
import org.jeecg.modules.base.enums.*;
|
||||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||||
|
import org.jeecg.modules.entity.GardsROIResultsSpectrum;
|
||||||
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
|
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.enums.ErrorType;
|
import org.jeecg.modules.enums.ErrorType;
|
||||||
|
@ -50,6 +52,8 @@ import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
@ -63,6 +67,12 @@ import java.util.*;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class Sample_C_Analysis {
|
public class Sample_C_Analysis {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告文件后缀
|
||||||
|
*/
|
||||||
|
private static final String ARR_FILE_SUFFIX = ".txt";
|
||||||
|
private static final String ARR_FILE_NAME_TAIL = "_rpt";
|
||||||
|
|
||||||
private final Map<String,String> fieldMap = fieldMap();
|
private final Map<String,String> fieldMap = fieldMap();
|
||||||
|
|
||||||
private AbstractS_D_Q_G_SpectrumHandler spectrumHandler;
|
private AbstractS_D_Q_G_SpectrumHandler spectrumHandler;
|
||||||
|
@ -150,6 +160,8 @@ public class Sample_C_Analysis {
|
||||||
|
|
||||||
private SelfBgAnalyseResult analyseResult;
|
private SelfBgAnalyseResult analyseResult;
|
||||||
|
|
||||||
|
private String spectrumFileRelativePath;
|
||||||
|
|
||||||
public Sample_C_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler, EnergySpectrumStruct sampleStruct, SpectrumServiceQuotes serviceQuotes,
|
public Sample_C_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler, EnergySpectrumStruct sampleStruct, SpectrumServiceQuotes serviceQuotes,
|
||||||
GardsSampleData sampleData) {
|
GardsSampleData sampleData) {
|
||||||
this.analyseResult = new SelfBgAnalyseResult();
|
this.analyseResult = new SelfBgAnalyseResult();
|
||||||
|
@ -163,6 +175,7 @@ public class Sample_C_Analysis {
|
||||||
this.sampleInputFilename = sampleData.getInputFileName();
|
this.sampleInputFilename = sampleData.getInputFileName();
|
||||||
this.sampleFilename = StringUtils.substring(sampleData.getInputFileName(),
|
this.sampleFilename = StringUtils.substring(sampleData.getInputFileName(),
|
||||||
sampleData.getInputFileName().lastIndexOf((StringConstant.SLASH))+1);
|
sampleData.getInputFileName().lastIndexOf((StringConstant.SLASH))+1);
|
||||||
|
this.spectrumFileRelativePath = spectrumHandler.getFileSaveRelativePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void analysis() throws CAnalyseException, AnalySpectrumException{
|
public void analysis() throws CAnalyseException, AnalySpectrumException{
|
||||||
|
@ -248,13 +261,28 @@ public class Sample_C_Analysis {
|
||||||
sampleStruct.POI_G_y2, sampleFilePathName, phdFile1, phdFile2, phdFile3, phdFile4);
|
sampleStruct.POI_G_y2, sampleFilePathName, phdFile1, phdFile2, phdFile3, phdFile4);
|
||||||
|
|
||||||
analyseResult.setXeResults(selfXeResults);
|
analyseResult.setXeResults(selfXeResults);
|
||||||
|
List<GardsROIResultsSpectrum> roiResult = SelfBaseUtil.getRoiResult(selfXeResults);
|
||||||
|
|
||||||
boolean analyFlag = analyFlag1 && analyFlag2 && analyFlag3 && analyFlag4 && !selfXeResults.isEmpty();
|
boolean analyFlag = analyFlag1 && analyFlag2 && analyFlag3 && analyFlag4 && !selfXeResults.isEmpty();
|
||||||
|
|
||||||
if (analyFlag) {
|
if (analyFlag) {
|
||||||
this.endAnalysisTime = new Date();
|
this.endAnalysisTime = new Date();
|
||||||
|
|
||||||
|
StringBuilder finalReportPath = new StringBuilder();
|
||||||
|
finalReportPath.append(spectrumPathProperties.getRootPath());
|
||||||
|
// finalReportPath.append(File.separator);
|
||||||
|
finalReportPath.append(spectrumPathProperties.getSaveFilePath());
|
||||||
|
finalReportPath.append(File.separator);
|
||||||
|
finalReportPath.append(spectrumPathProperties.getArrPath());
|
||||||
|
finalReportPath.append(File.separator);
|
||||||
|
finalReportPath.append(this.spectrumFileRelativePath);
|
||||||
|
// finalReportPath.append(arrFilePath);
|
||||||
|
finalReportPath.append(File.separator);
|
||||||
|
String arrFileTail = ARR_FILE_NAME_TAIL+ARR_FILE_SUFFIX;
|
||||||
|
finalReportPath.append(this.sampleFilename.replace(DataType.SAMPLEPHD.getSuffix(),arrFileTail));
|
||||||
|
|
||||||
// gamma数据插入数据库
|
// gamma数据插入数据库
|
||||||
this.storageDataToDatabase(mdcInfoMap,
|
this.storageDataToDatabase(mdcInfoMap, finalReportPath.toString(), null,
|
||||||
middleData1, middleData2, middleData3, middleData4);
|
middleData1, middleData2, middleData3, middleData4);
|
||||||
|
|
||||||
// 生成gamma日志文件
|
// 生成gamma日志文件
|
||||||
|
@ -262,6 +290,9 @@ public class Sample_C_Analysis {
|
||||||
|
|
||||||
// 生成gamma报告文件
|
// 生成gamma报告文件
|
||||||
writeReport(middleData1, middleData2, middleData3, middleData4);
|
writeReport(middleData1, middleData2, middleData3, middleData4);
|
||||||
|
|
||||||
|
// 生成beta报告
|
||||||
|
SelfBaseUtil.createReport(sampleId, finalReportPath.toString(), sampleStruct, null, selfXeResults);
|
||||||
//发送数据到redis
|
//发送数据到redis
|
||||||
// middleData.setSample_id(String.valueOf(sampleId));
|
// middleData.setSample_id(String.valueOf(sampleId));
|
||||||
// pushToRedis(middleData);
|
// pushToRedis(middleData);
|
||||||
|
@ -539,7 +570,8 @@ public class Sample_C_Analysis {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void storageDataToDatabase(Map<String, CalMDCInfo> mdcInfoMap, GStoreMiddleProcessData... middleDatas){
|
public void storageDataToDatabase(Map<String, CalMDCInfo> mdcInfoMap, String reportPath, String logFilePath,
|
||||||
|
GStoreMiddleProcessData... middleDatas){
|
||||||
// 如果数据已经存储 不再重复存储
|
// 如果数据已经存储 不再重复存储
|
||||||
Integer idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
Integer idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
||||||
if(ObjectUtil.isNotNull(idAnalysis)) return;
|
if(ObjectUtil.isNotNull(idAnalysis)) return;
|
||||||
|
@ -548,7 +580,7 @@ public class Sample_C_Analysis {
|
||||||
try {
|
try {
|
||||||
Integer sampleId = this.sampleData.getSampleId();
|
Integer sampleId = this.sampleData.getSampleId();
|
||||||
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES TODO 填充Beta分析产生的报告和日志地址
|
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES TODO 填充Beta分析产生的报告和日志地址
|
||||||
saveAnalysis(sampleId, this.detSampleData, this.startAnalysisTime, this.endAnalysisTime, null, null);
|
saveAnalysis(sampleId, this.detSampleData, this.startAnalysisTime, this.endAnalysisTime, logFilePath, reportPath);
|
||||||
// 获取分析结果ID ==> SELECT IDANALYSIS
|
// 获取分析结果ID ==> SELECT IDANALYSIS
|
||||||
idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(sampleId);
|
idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(sampleId);
|
||||||
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES
|
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.jeecg.common.util;
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.IORuntimeException;
|
import cn.hutool.core.io.IORuntimeException;
|
||||||
import cn.hutool.core.lang.Console;
|
import cn.hutool.core.lang.Console;
|
||||||
|
@ -12,9 +15,12 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.SerializationUtils;
|
||||||
|
import org.jeecg.common.constant.StringConstant;
|
||||||
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
|
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
|
||||||
import org.jeecg.modules.base.enums.CalName;
|
import org.jeecg.modules.base.enums.CalName;
|
||||||
import org.jeecg.modules.base.enums.SampleFileHeader;
|
import org.jeecg.modules.base.enums.SampleFileHeader;
|
||||||
|
import org.jeecg.modules.entity.GardsROIResultsSpectrum;
|
||||||
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
|
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.native_jni.CalValuesHandler;
|
import org.jeecg.modules.native_jni.CalValuesHandler;
|
||||||
|
@ -186,6 +192,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
if (StrUtil.isNotEmpty(filePathName) && new File(filePathName).exists()) {
|
if (StrUtil.isNotEmpty(filePathName) && new File(filePathName).exists()) {
|
||||||
//解析文件内容
|
//解析文件内容
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
struct = EnergySpectrumHandler.getSourceDataNotHis(filePathName);
|
struct = EnergySpectrumHandler.getSourceDataNotHis(filePathName);
|
||||||
Console.log("getsource:{}", (System.currentTimeMillis() - start));
|
Console.log("getsource:{}", (System.currentTimeMillis() - start));
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
|
@ -727,8 +734,8 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
* @param gammaPhdFiles gammaPHD
|
* @param gammaPhdFiles gammaPHD
|
||||||
* @throws JsonProcessingException
|
* @throws JsonProcessingException
|
||||||
*/
|
*/
|
||||||
public static List<GardsXeResultsSpectrum> betaAnalyse(HashMap<String, NuclideLine> nuclideMap, List<Double> POI_G_y1, List<Double> POI_G_y2,
|
public static List<GardsXeResultsSpectrum> betaAnalyse(HashMap<String, NuclideLine> nuclideMap, List<Double> POI_G_y1,
|
||||||
String betaPhdFile, PHDFile ... gammaPhdFiles) {
|
List<Double> POI_G_y2, String betaPhdFile, PHDFile ... gammaPhdFiles) {
|
||||||
List<GardsXeResultsSpectrum> xeDataList = Lists.newArrayList();
|
List<GardsXeResultsSpectrum> xeDataList = Lists.newArrayList();
|
||||||
|
|
||||||
// 获取峰面积、半衰期、发射几率
|
// 获取峰面积、半衰期、发射几率
|
||||||
|
@ -736,6 +743,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
Console.log(JSON.toJSONString(nuclideParam));
|
Console.log(JSON.toJSONString(nuclideParam));
|
||||||
// 调用beta分析算法
|
// 调用beta分析算法
|
||||||
String resultStr = EnergySpectrumHandler.selfBgAnalyse(betaPhdFile, JSON.toJSONString(nuclideParam));
|
String resultStr = EnergySpectrumHandler.selfBgAnalyse(betaPhdFile, JSON.toJSONString(nuclideParam));
|
||||||
|
Console.log(resultStr);
|
||||||
if (StrUtil.isNotBlank(resultStr)) {
|
if (StrUtil.isNotBlank(resultStr)) {
|
||||||
xeDataList = JSON.parseArray(resultStr, GardsXeResultsSpectrum.class);
|
xeDataList = JSON.parseArray(resultStr, GardsXeResultsSpectrum.class);
|
||||||
xeDataList.forEach(GardsXeResultsSpectrum::getMdc);
|
xeDataList.forEach(GardsXeResultsSpectrum::getMdc);
|
||||||
|
@ -765,10 +773,38 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.log(resultStr);
|
|
||||||
return xeDataList;
|
return xeDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取
|
||||||
|
* @param xeResultsList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<GardsROIResultsSpectrum> getRoiResult (List<GardsXeResultsSpectrum> xeResultsList) {
|
||||||
|
List<GardsROIResultsSpectrum> results = Lists.newArrayList();
|
||||||
|
for (GardsXeResultsSpectrum xe : xeResultsList) {
|
||||||
|
GardsROIResultsSpectrum gardsRoiResults = new GardsROIResultsSpectrum();
|
||||||
|
BeanUtil.copyProperties(xe, gardsRoiResults);
|
||||||
|
switch (xe.getNuclideName()) {
|
||||||
|
case "XE-131m":
|
||||||
|
gardsRoiResults.setRoi(1);
|
||||||
|
break;
|
||||||
|
case "XE-133m":
|
||||||
|
gardsRoiResults.setRoi(2);
|
||||||
|
break;
|
||||||
|
case "XE-133":
|
||||||
|
gardsRoiResults.setRoi(3);
|
||||||
|
break;
|
||||||
|
case "XE-135":
|
||||||
|
gardsRoiResults.setRoi(4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
results.add(gardsRoiResults);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取结算结果需要的参数(峰面积、半衰期、发射几率)
|
* 获取结算结果需要的参数(峰面积、半衰期、发射几率)
|
||||||
* @param gStart RoiLimit Gamma Start
|
* @param gStart RoiLimit Gamma Start
|
||||||
|
@ -807,8 +843,8 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
// 半衰期
|
// 半衰期
|
||||||
nuclideParam.put("halflife", nuclideMap.get(nuclideName).getHalflife().toString());
|
nuclideParam.put("halflife", nuclideMap.get(nuclideName).getHalflife().toString());
|
||||||
// baseline 计数,这里使用的energy是固定的 从配置文件中取出
|
// baseline 计数,这里使用的energy是固定的 从配置文件中取出
|
||||||
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()));
|
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) +"");
|
||||||
|
nuclideParam.put("lcConst", "2.33");
|
||||||
for (PeakInfo info : vPeak) {
|
for (PeakInfo info : vPeak) {
|
||||||
double energy = info.energy;
|
double energy = info.energy;
|
||||||
// 找匹配roi范围的 energy
|
// 找匹配roi范围的 energy
|
||||||
|
@ -865,6 +901,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
nuclideParam.put("exist", false);
|
nuclideParam.put("exist", false);
|
||||||
nuclideParam.put("area", area+"");
|
nuclideParam.put("area", area+"");
|
||||||
|
|
||||||
}
|
}
|
||||||
param.put(mapKey, nuclideParam);
|
param.put(mapKey, nuclideParam);
|
||||||
}
|
}
|
||||||
|
@ -898,17 +935,17 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
// 通过energy带入到FHWM公式中,将结果energy转化channel,加减1.25之后取这个范围之内的baseline进行加和
|
// 通过energy带入到FHWM公式中,将结果energy转化channel,加减1.25之后取这个范围之内的baseline进行加和
|
||||||
List<Double> energyList = Lists.newLinkedList();
|
List<Double> energyList = Lists.newLinkedList();
|
||||||
energyList.add(energy - (fwhm - 1.25));
|
energyList.add(energy - (fwhm - Math.pow(fwhm, 1.25)));
|
||||||
// 使用gamma公式将能量转换为道址
|
// 使用gamma公式将能量转换为道址
|
||||||
CalValuesOut energyToChannel = CalValuesHandler.energyToChannel(energyList, userEnerParaP);
|
CalValuesOut energyToChannel = CalValuesHandler.energyToChannel(energyList, userEnerParaP);
|
||||||
|
|
||||||
long begin = Math.round(energyToChannel.counts.get(0));
|
long begin = Math.round(energyToChannel.counts.get(0));
|
||||||
Console.log("nuclide:{},energy:{},fwhmL:{},beginChannel:{}",nuclideName, energy, (fwhm - 1.25), begin);
|
Console.log("nuclide:{},energy:{},fwhmL:{},beginChannel:{}",nuclideName, energy, (fwhm - Math.pow(fwhm, 1.25)), begin);
|
||||||
energyList = Lists.newLinkedList();
|
energyList = Lists.newLinkedList();
|
||||||
energyList.add(energy + (fwhm + 1.25));
|
energyList.add(energy + (fwhm + Math.pow(fwhm, 1.25)));
|
||||||
energyToChannel = CalValuesHandler.energyToChannel(energyList, userEnerParaP);
|
energyToChannel = CalValuesHandler.energyToChannel(energyList, userEnerParaP);
|
||||||
long end = Math.round(energyToChannel.counts.get(0));
|
long end = Math.round(energyToChannel.counts.get(0));
|
||||||
Console.log("nuclide:{},energy:{},fwhmR:{},endChannel:{}",nuclideName, energy, (fwhm + 1.25), end);
|
Console.log("nuclide:{},energy:{},fwhmR:{},endChannel:{}",nuclideName, energy, (fwhm + Math.pow(fwhm, 1.25)), end);
|
||||||
if (begin >= 0 && end <= vBase.size()) {
|
if (begin >= 0 && end <= vBase.size()) {
|
||||||
for (long i = begin; i < end; i++) {
|
for (long i = begin; i < end; i++) {
|
||||||
baseLineCount += vBase.get((int)i);
|
baseLineCount += vBase.get((int)i);
|
||||||
|
@ -917,4 +954,306 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
||||||
return baseLineCount;
|
return baseLineCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static StringBuilder reportContent = null;
|
||||||
|
protected static EnergySpectrumStruct sampleStruct = null;
|
||||||
|
protected static EnergySpectrumStruct qcStruct = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自建台站beta报告
|
||||||
|
* @param sampleId
|
||||||
|
* @param sampleStruct sample
|
||||||
|
* @param qcStruct qc
|
||||||
|
* @param selfXeResults 分析结果
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getReport(Integer sampleId, EnergySpectrumStruct sampleStruct, EnergySpectrumStruct qcStruct,
|
||||||
|
List<GardsXeResultsSpectrum> selfXeResults) {
|
||||||
|
reportContent = new StringBuilder();
|
||||||
|
SelfBaseUtil.sampleStruct = sampleStruct;
|
||||||
|
handleReportHeader();
|
||||||
|
handleFileInfoMation();
|
||||||
|
handleCollectionInfoMation(sampleId);
|
||||||
|
handleAcquisitionInfoMation();
|
||||||
|
handleSoftware();
|
||||||
|
handleGasCalibration(qcStruct);
|
||||||
|
handleGasLimits();
|
||||||
|
handleNetCount(selfXeResults);
|
||||||
|
handleConcetration(selfXeResults);
|
||||||
|
handleResult(selfXeResults);
|
||||||
|
if(null != sampleStruct) {
|
||||||
|
SelfBaseUtil.qcStruct = qcStruct;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reportContent.toString();
|
||||||
|
}
|
||||||
|
public static void createReport(Integer sampleId, String finalReportPath, EnergySpectrumStruct sampleStruct,
|
||||||
|
EnergySpectrumStruct qcStruct, List<GardsXeResultsSpectrum> selfXeResults) {
|
||||||
|
getReport(sampleId, sampleStruct, qcStruct, selfXeResults);
|
||||||
|
|
||||||
|
if(!FileUtil.exist(finalReportPath)){
|
||||||
|
FileUtil.writeString(reportContent.toString(), finalReportPath,"utf-8");
|
||||||
|
}else {
|
||||||
|
FileUtil.appendString(reportContent.toString(), finalReportPath,"utf-8");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理报告头
|
||||||
|
*/
|
||||||
|
private static void handleReportHeader(){
|
||||||
|
String header_1 = "%-64s CNL06 GENERATED REPORT";
|
||||||
|
String header_2 = "%-63s AUTO RADIONUCLIDE REPORT";
|
||||||
|
String header_3 = "%-65s (Noble Gas Version) ";
|
||||||
|
String createDateLine = "%-58s Creation Date %s";
|
||||||
|
final String createDate = DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss");
|
||||||
|
reportContent.append(String.format(header_1, StringConstant.SPACE));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(header_2,StringConstant.SPACE));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(header_3,StringConstant.SPACE));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(createDateLine,StringConstant.SPACE,createDate));
|
||||||
|
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理#FILE INFORMATION 模块
|
||||||
|
*/
|
||||||
|
private static void handleFileInfoMation(){
|
||||||
|
String fileBlock = "#FILE INFORMATION";
|
||||||
|
String sampleMeasId = " SampleMeasID:%-36s %s";
|
||||||
|
String gasMeasId = " GASBKMeasID:%-37s %s";
|
||||||
|
String detMeasId = " DETBKMeasID:%-37s %s";
|
||||||
|
String srId = " SRID:%-44s %s";
|
||||||
|
String detectorType = " Detector Type:%-35s %s";
|
||||||
|
reportContent.append(fileBlock);
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(sampleMeasId,StringConstant.SPACE,sampleStruct.measurement_id));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(gasMeasId,StringConstant.SPACE,sampleStruct.gas_bk_measurement_id));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(detMeasId,StringConstant.SPACE,sampleStruct.detector_bk_measurement_id));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(srId,StringConstant.SPACE,sampleStruct.sample_ref_id));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(detectorType,StringConstant.SPACE,"3D b-g"));
|
||||||
|
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理#COLLECTION INFORMATION 模块
|
||||||
|
*/
|
||||||
|
private static void handleCollectionInfoMation(Integer sampleId){
|
||||||
|
String collectionInfoBlock = "#COLLECTION INFORMATION";
|
||||||
|
String stationId = " Station ID:%-38s %s";
|
||||||
|
String detectorId = " Detector ID:%-37s %s";
|
||||||
|
String sampleIdLabel = " Sample ID:%-39s %s";
|
||||||
|
String collectionStart = " Collection Start:%-32s %s";
|
||||||
|
String collectionStop = " Collection Stop:%-33s %s";
|
||||||
|
String collectionTime = " Collection TIME(h):%-30s %s";
|
||||||
|
String airVolume = " Air Volume[cm3]:%-33s %s";
|
||||||
|
String xeVolume = " Xe Volume[cm3]:%-34s %s";
|
||||||
|
reportContent.append(collectionInfoBlock);
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(stationId,StringConstant.SPACE,sampleStruct.site_code));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(detectorId,StringConstant.SPACE,sampleStruct.detector_code));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(sampleIdLabel,StringConstant.SPACE, sampleId));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(collectionStart,StringConstant.SPACE,sampleStruct.collection_start_date+StringConstant.SPACE+sampleStruct.collection_start_time));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(collectionStop,StringConstant.SPACE,sampleStruct.collection_stop_date+StringConstant.SPACE+sampleStruct.collection_stop_time));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
DateTime collectStart = DateUtil.parse(sampleStruct.collection_start_date + StringConstant.SPACE + sampleStruct.collection_start_time);
|
||||||
|
DateTime collectStop = DateUtil.parse(sampleStruct.collection_stop_date + StringConstant.SPACE + sampleStruct.collection_stop_time);
|
||||||
|
|
||||||
|
reportContent.append(String.format(collectionTime,StringConstant.SPACE,String.valueOf((collectStop.getTime() - collectStart.getTime())/1000)));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(airVolume,StringConstant.SPACE,String.valueOf(sampleStruct.air_volume)));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(xeVolume,StringConstant.SPACE,String.valueOf(sampleStruct.sample_volume_of_Xe)));
|
||||||
|
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理#ACQUISITION INFORMATION 模块
|
||||||
|
*/
|
||||||
|
private static void handleAcquisitionInfoMation(){
|
||||||
|
String acqInfoBlock = "#ACQUISITION INFORMATION";
|
||||||
|
String acquisitionStart = " Acquisition Start:%-31s %s";
|
||||||
|
String acqRealTime = " Acq Real Time(s):%-32s %s";
|
||||||
|
String acqLiveTime = " Acq Live Time(s):%-32s %s";
|
||||||
|
reportContent.append(acqInfoBlock);
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(acquisitionStart,StringConstant.SPACE,sampleStruct.acquisition_start_date+StringConstant.SPACE+sampleStruct.acquisition_start_time));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(acqRealTime,StringConstant.SPACE,String.valueOf(sampleStruct.acquisition_real_time)));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(acqLiveTime,StringConstant.SPACE,String.valueOf(sampleStruct.acquisition_live_time)));
|
||||||
|
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理#SOFTWARE 模块
|
||||||
|
*/
|
||||||
|
private static void handleSoftware(){
|
||||||
|
String softwareBlock = "#SOFTWARE";
|
||||||
|
String version = " version:%-42s %s";
|
||||||
|
reportContent.append(softwareBlock);
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
// reportContent.append(String.format(version,StringConstant.SPACE, spectrumServiceQuotes.getSoftwareProperties().getSwVersion()));
|
||||||
|
reportContent.append(String.format(version,StringConstant.SPACE, "1.0"));
|
||||||
|
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleGasCalibration(EnergySpectrumStruct struct) {
|
||||||
|
reportContent.append("#GAS New CALIBRATION");
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
|
||||||
|
if(null == struct) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo 现在用的是分析之前的公式,分析之后的公式还需要补充
|
||||||
|
|
||||||
|
List<Double> bChannel = struct.b_channel;
|
||||||
|
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||||
|
|
||||||
|
//计算得到C to E公式数据
|
||||||
|
List<Double> bFittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
||||||
|
List<String> bFittingParaStr = new LinkedList<>();
|
||||||
|
for (Double para:bFittingPara) {
|
||||||
|
bFittingParaStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
DecimalFormat df = new DecimalFormat("0.000000");
|
||||||
|
|
||||||
|
|
||||||
|
//拼接新计算公式 CH
|
||||||
|
String newBetaGasCHStr = String.format("%sCH(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE,
|
||||||
|
(NumberFormatUtil.numberSixLen(bFittingParaStr.get(0))),
|
||||||
|
(NumberFormatUtil.numberSixLen(bFittingParaStr.get(1))),
|
||||||
|
(NumberFormatUtil.numberSixLen(bFittingParaStr.get(2))));
|
||||||
|
|
||||||
|
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||||
|
List<Double> gEnergy = struct.g_energy;
|
||||||
|
//计算C to E公式参数
|
||||||
|
List<Double> gFittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||||
|
List<String> gFittingParaStr = new LinkedList<>();
|
||||||
|
for (Double para:gFittingPara) {
|
||||||
|
gFittingParaStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
String newGammaGasCHStr = String.format("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s",
|
||||||
|
(NumberFormatUtil.numberSixLen(gFittingParaStr.get(0))),
|
||||||
|
(NumberFormatUtil.numberSixLen(gFittingParaStr.get(1))),
|
||||||
|
(NumberFormatUtil.numberSixLen(gFittingParaStr.get(2))),
|
||||||
|
StringPool.SPACE);
|
||||||
|
reportContent.append(String.format("%s%-"+(52-newBetaGasCHStr.length())+"s%s", newBetaGasCHStr, StringPool.SPACE, newGammaGasCHStr));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
|
||||||
|
//E to C
|
||||||
|
List<Double> bFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
|
||||||
|
List<String> bFittingParaToUiStr = new LinkedList<>();
|
||||||
|
for (Double para:bFittingParaToUi) {
|
||||||
|
bFittingParaToUiStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
//拼接新计算公式 E
|
||||||
|
String newBetaGasEStr = String.format("%sE(x) = (%s)+(%s)*x+(%s)x*x", StringPool.SPACE,
|
||||||
|
(NumberFormatUtil.numberSixLen(bFittingParaToUiStr.get(0))),
|
||||||
|
(NumberFormatUtil.numberSixLen(bFittingParaToUiStr.get(1))),
|
||||||
|
(NumberFormatUtil.numberSixLen(bFittingParaToUiStr.get(2))));
|
||||||
|
|
||||||
|
//计算E to C公式参数
|
||||||
|
List<Double> gFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
|
||||||
|
List<String> gFittingParaToUiStr = new LinkedList<>();
|
||||||
|
for (Double para:gFittingParaToUi) {
|
||||||
|
gFittingParaToUiStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
String newGammaGasEStr = String.format("E(x) = (%s)+(%s)*x+(%s)x*x%-24s",
|
||||||
|
(NumberFormatUtil.numberSixLen(gFittingParaToUiStr.get(0))),
|
||||||
|
(NumberFormatUtil.numberSixLen(gFittingParaToUiStr.get(1))),
|
||||||
|
(NumberFormatUtil.numberSixLen(gFittingParaToUiStr.get(2))),
|
||||||
|
StringPool.SPACE);
|
||||||
|
reportContent.append(String.format("%s%"+(52-newBetaGasEStr.length())+"s%s", newBetaGasEStr, StringPool.SPACE, newGammaGasEStr));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleGasLimits() {
|
||||||
|
String limitRoi = "%s%-15s%-25s%-25s";
|
||||||
|
reportContent.append("#GAS: LIMITS PER ROI");
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
reportContent.append(String.format(limitRoi, StringPool.SPACE, "Roi", "Beta", "Gamma"));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
for (int i = 0; i < sampleStruct.POI_B_x1.size(); i++) {
|
||||||
|
reportContent.append(String.format(limitRoi, StringPool.SPACE, i + 1,
|
||||||
|
sampleStruct.POI_B_x1.get(i)+" to " + sampleStruct.POI_B_x2.get(i),
|
||||||
|
sampleStruct.POI_G_y1.get(i) + " to " + sampleStruct.POI_G_y2.get(i)));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleNetCount(List<GardsXeResultsSpectrum> selfXeResults) {
|
||||||
|
List<GardsROIResultsSpectrum> roiResult = SelfBaseUtil.getRoiResult(selfXeResults);
|
||||||
|
reportContent.append("#NET COUNTS AND LC PER ROI");
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
String netRoi = "%s%-15s%-25s%-15s";
|
||||||
|
reportContent.append(String.format(netRoi, StringPool.SPACE, "Roi", "Net count", "LC"));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
|
||||||
|
|
||||||
|
for (GardsROIResultsSpectrum result : roiResult) {
|
||||||
|
reportContent.append(String.format(netRoi, StringPool.SPACE, result.getRoi(),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getNet())) +" +/- "+
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getNetErr())),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getLc()))));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleConcetration(List<GardsXeResultsSpectrum> selfXeResults) {
|
||||||
|
List<GardsROIResultsSpectrum> roiResult = SelfBaseUtil.getRoiResult(selfXeResults);
|
||||||
|
reportContent.append("#CONCENTRATION AND LC PER ROI");
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
String conLcRoi = "%s%-15s%-25s%-15s%-15s";
|
||||||
|
reportContent.append(String.format(conLcRoi, StringPool.SPACE, "Roi", "Conc(mBq/m3)", "LC(mBq/m3)", "MDC(mBq/m3):"));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
|
||||||
|
for (GardsROIResultsSpectrum result : roiResult) {
|
||||||
|
reportContent.append(String.format(conLcRoi, StringPool.SPACE, result.getRoi(),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getConc())) +" +/- "+
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getConcErr())),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getLc())),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getMdc())))
|
||||||
|
);
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleResult(List<GardsXeResultsSpectrum> selfXeResults) {
|
||||||
|
List<GardsROIResultsSpectrum> roiResult = SelfBaseUtil.getRoiResult(selfXeResults);
|
||||||
|
reportContent.append("#RESULT SUMMARY");
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
String resultSum = "%s%-15s%-25s%-25s%-15s%-15s";
|
||||||
|
reportContent.append(String.format(resultSum, StringPool.SPACE, "Nuclide Name", "Conc(mBq/m3)", "Uncertainty(mBq/m3)",
|
||||||
|
"MDC(mBq/m3)", "NID Flag"));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
for (GardsROIResultsSpectrum result : roiResult) {
|
||||||
|
reportContent.append(String.format(resultSum, StringPool.SPACE, result.getRoi(),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getConc())) +" +/- "+
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getConcErr())),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getConcErr())),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getMdc())),
|
||||||
|
NumberFormatUtil.numberSixLen(String.valueOf(result.getNidFlag()))
|
||||||
|
));
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
|
reportContent.append(System.lineSeparator());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.jeecg.modules.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GardsROIResultsSpectrum implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样品id
|
||||||
|
*/
|
||||||
|
private Integer sampleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区ID号
|
||||||
|
*/
|
||||||
|
private Integer roi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析ID号
|
||||||
|
*/
|
||||||
|
private Integer idAnalysis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样品谱感兴趣区总计数
|
||||||
|
*/
|
||||||
|
private Double sGross;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 气体本底谱感兴趣区总计数
|
||||||
|
*/
|
||||||
|
private Double gGross;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 探测器本底谱感兴趣区总计数
|
||||||
|
*/
|
||||||
|
private Double bGross;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样品谱感兴趣区净计数
|
||||||
|
*/
|
||||||
|
private Double sNet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 气体本底谱感兴趣区净计数
|
||||||
|
*/
|
||||||
|
private Double gNet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区净计数
|
||||||
|
*/
|
||||||
|
private Double net;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区净计数不确定度
|
||||||
|
*/
|
||||||
|
private Double netErr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区活度浓度
|
||||||
|
*/
|
||||||
|
private Double conc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区活度浓度不确定度
|
||||||
|
*/
|
||||||
|
private Double concErr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区LC
|
||||||
|
*/
|
||||||
|
private Double lc;
|
||||||
|
|
||||||
|
private Double lcCts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区MDC
|
||||||
|
*/
|
||||||
|
private Double mdc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 感兴趣区识别标示;1:识别到,0,未识别到
|
||||||
|
*/
|
||||||
|
private Integer nidFlag;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date moddate;
|
||||||
|
|
||||||
|
}
|
|
@ -15,4 +15,10 @@ public class GardsXeResultsSpectrum extends GardsXeResults implements Serializab
|
||||||
|
|
||||||
private String color;
|
private String color;
|
||||||
|
|
||||||
|
private Double concLc;
|
||||||
|
|
||||||
|
private Double net;
|
||||||
|
|
||||||
|
private Double netErr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ public interface AnalysisManService {
|
||||||
|
|
||||||
void deleteAnalySetting(Integer idAnalysis);
|
void deleteAnalySetting(Integer idAnalysis);
|
||||||
|
|
||||||
|
void deleteROIResults(Integer idAnalysis);
|
||||||
|
|
||||||
void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis);
|
void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis);
|
||||||
|
|
||||||
void saveCalibrationROI(Integer sampleId, Integer idAnalysis);
|
void saveCalibrationROI(Integer sampleId, Integer idAnalysis);
|
||||||
|
@ -60,4 +62,6 @@ public interface AnalysisManService {
|
||||||
void saveSampleG_EnergyRecord(List<Double> list, Integer sampleId, Integer anayId);
|
void saveSampleG_EnergyRecord(List<Double> list, Integer sampleId, Integer anayId);
|
||||||
|
|
||||||
void saveGardsXeResults(Integer sampleId, Integer idAnalysis, List<GardsXeResultsSpectrum> xeResultsList);
|
void saveGardsXeResults(Integer sampleId, Integer idAnalysis, List<GardsXeResultsSpectrum> xeResultsList);
|
||||||
|
|
||||||
|
void saveROIResults(Integer sampleId, Integer idAnalysis, List<GardsXeResultsSpectrum> xeResultsList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
||||||
private IGardsCalibrationPairsSpectrumService calibrationPairsSpectrumService;
|
private IGardsCalibrationPairsSpectrumService calibrationPairsSpectrumService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsXeResultsSpectrumService xeResultsSpectrumService;
|
private IGardsXeResultsSpectrumService xeResultsSpectrumService;
|
||||||
|
@Autowired
|
||||||
|
private IGardsROIResultsSpectrumService roiResultsSpectrumService;
|
||||||
|
|
||||||
private Map<Integer, GStoreMiddleProcessData> middleDataMap;
|
private Map<Integer, GStoreMiddleProcessData> middleDataMap;
|
||||||
|
|
||||||
|
@ -172,6 +174,13 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
||||||
analySettingRoiService.remove(wrapper);
|
analySettingRoiService.remove(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteROIResults(Integer idAnalysis) {
|
||||||
|
LambdaUpdateWrapper<GardsRoiResults> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.eq(GardsRoiResults::getIdAnalysis, idAnalysis);
|
||||||
|
roiResultsSpectrumService.remove(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis) {
|
public void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis) {
|
||||||
List<GardsCalibrationPairsRoi> pairsRois = new ArrayList<>();
|
List<GardsCalibrationPairsRoi> pairsRois = new ArrayList<>();
|
||||||
|
@ -825,6 +834,24 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void saveROIResults(Integer sampleId, Integer idAnalysis, List<GardsXeResultsSpectrum> xeResultsList) {
|
||||||
|
List<GardsRoiResults> results = Lists.newArrayList();
|
||||||
|
for (GardsXeResultsSpectrum result : xeResultsList) {
|
||||||
|
GardsRoiResults gardsRoiResults = new GardsRoiResults();
|
||||||
|
BeanUtil.copyProperties(result, gardsRoiResults);
|
||||||
|
gardsRoiResults.setSampleId(sampleId);
|
||||||
|
gardsRoiResults.setIdAnalysis(idAnalysis);
|
||||||
|
gardsRoiResults.setNet(result.getNet());
|
||||||
|
gardsRoiResults.setNetErr(result.getNetErr());
|
||||||
|
results.add(gardsRoiResults);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(results)) {
|
||||||
|
roiResultsSpectrumService.saveBatch(results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String,String> fieldMap(){
|
public Map<String,String> fieldMap(){
|
||||||
Map<String,String> fieldMap = new HashMap<>();
|
Map<String,String> fieldMap = new HashMap<>();
|
||||||
// Gards_Nucl_Lines_Ided
|
// Gards_Nucl_Lines_Ided
|
||||||
|
|
|
@ -154,6 +154,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
//页面展示结果数组
|
//页面展示结果数组
|
||||||
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||||
|
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
|
||||||
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList= new LinkedList<>();
|
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList= new LinkedList<>();
|
||||||
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
|
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
|
||||||
List<GardsCalibrationPairsSpectrum> gammaCalibrationPairsList = new LinkedList<>();
|
List<GardsCalibrationPairsSpectrum> gammaCalibrationPairsList = new LinkedList<>();
|
||||||
|
@ -235,6 +236,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID);
|
betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID);
|
||||||
}
|
}
|
||||||
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults(dbName, analysisID, sampleId);
|
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults(dbName, analysisID, sampleId);
|
||||||
|
roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults(dbName, analysisID, sampleId);
|
||||||
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam(dbName, analysisID);
|
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam(dbName, analysisID);
|
||||||
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam(dbName, analysisID);
|
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam(dbName, analysisID);
|
||||||
//判断sample文件名是否为空
|
//判断sample文件名是否为空
|
||||||
|
@ -479,6 +481,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
betaDataFile.setXeResultsSpectrumList(xeResultsSpectrumList);
|
betaDataFile.setXeResultsSpectrumList(xeResultsSpectrumList);
|
||||||
|
betaDataFile.setRoiResultsSpectrumList(roiResultsSpectrumList);
|
||||||
betaDataFile.setSaveAnalysisResult(true);
|
betaDataFile.setSaveAnalysisResult(true);
|
||||||
selfStationData.setBAnalyed(true);
|
selfStationData.setBAnalyed(true);
|
||||||
resultMap.put("XeData", phdFileUtil.viewXeData(xeResultsSpectrumList));
|
resultMap.put("XeData", phdFileUtil.viewXeData(xeResultsSpectrumList));
|
||||||
|
@ -2658,6 +2661,8 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
betaDataFile.setXeDataList(xeResults);
|
betaDataFile.setXeDataList(xeResults);
|
||||||
betaDataFile.setXeResultsSpectrumList(betaResult);
|
betaDataFile.setXeResultsSpectrumList(betaResult);
|
||||||
|
|
||||||
|
betaDataFile.setRoiResultsSpectrumList(SelfBaseUtil.getRoiResult(betaResult));
|
||||||
|
|
||||||
//横坐标 beta-gamma
|
//横坐标 beta-gamma
|
||||||
long bChannels = struct.b_channels;
|
long bChannels = struct.b_channels;
|
||||||
//纵坐标 gamma
|
//纵坐标 gamma
|
||||||
|
@ -5570,8 +5575,27 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
gardsAnalyses.setUseddetphdId(detId);
|
gardsAnalyses.setUseddetphdId(detId);
|
||||||
}
|
}
|
||||||
gardsAnalyses.setAnalyst(userName);
|
gardsAnalyses.setAnalyst(userName);
|
||||||
|
|
||||||
|
String subDirSavePath = "";
|
||||||
|
|
||||||
|
String dataType = sampleStruct.data_type;
|
||||||
|
subDirSavePath+=nameStandUtil.GetSysTemSubdir(sampleStruct.system_type);
|
||||||
|
subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType);
|
||||||
|
String path = nameStandUtil.SetFileDir(subDirSavePath, saveFileName);
|
||||||
|
Map<String, String> fileNameMap = nameStandUtil.NameStandard(dataType, sampleStruct.spectrum_quantity, sampleStruct.acquisition_live_time, betaDataFile.getSampleFileName(), sampleStruct.measurement_id);
|
||||||
|
String rptName = fileNameMap.get("rpt");
|
||||||
|
String qsReportPath="Rrr"+StringPool.SLASH+path+StringPool.SLASH+userName+"_"+rptName;
|
||||||
|
qsReportPath = qsReportPath.replace(StringPool.BACK_SLASH, StringPool.SLASH);
|
||||||
|
String reportPath = spectrumPathProperties.getSaveFilePath()+StringPool.SLASH+qsReportPath;
|
||||||
|
// 报告路径
|
||||||
|
gardsAnalyses.setReportPath(qsReportPath);
|
||||||
|
|
||||||
|
String logName = fileNameMap.get("log");
|
||||||
|
String qsLogPath= path+StringPool.SLASH+userName+"_"+logName;
|
||||||
|
qsLogPath = qsLogPath.replace(StringPool.BACK_SLASH, StringPool.SLASH);
|
||||||
|
String analyses_absolute_LogPath=spectrumPathProperties.getLogPath()+StringPool.SLASH+qsLogPath;
|
||||||
|
// todo 补充日志
|
||||||
gardsAnalyses.setLogPath("");
|
gardsAnalyses.setLogPath("");
|
||||||
gardsAnalyses.setReportPath("");
|
|
||||||
// 写入 RNMAN数据库
|
// 写入 RNMAN数据库
|
||||||
// 判断idAnalysis是否为空
|
// 判断idAnalysis是否为空
|
||||||
if (ObjectUtil.isNull(idAnalysis)) {
|
if (ObjectUtil.isNull(idAnalysis)) {
|
||||||
|
@ -5604,6 +5628,8 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
analysisManService.deleteMDC(idAnalysis);
|
analysisManService.deleteMDC(idAnalysis);
|
||||||
// 删除GARDS_ANALY_SETTING_ROI表数据
|
// 删除GARDS_ANALY_SETTING_ROI表数据
|
||||||
analysisManService.deleteAnalySetting(idAnalysis);
|
analysisManService.deleteAnalySetting(idAnalysis);
|
||||||
|
// 删除GARDS_ROI_RESULTS表数据
|
||||||
|
analysisManService.deleteROIResults(idAnalysis);
|
||||||
}
|
}
|
||||||
// 向 RNMAN.GARDS_ANALYSES_ROI 表插入数据
|
// 向 RNMAN.GARDS_ANALYSES_ROI 表插入数据
|
||||||
analysisManService.saveAnalysisROI(sampleId, idAnalysis, selfStationData.getRoiBBoundaryStart(),
|
analysisManService.saveAnalysisROI(sampleId, idAnalysis, selfStationData.getRoiBBoundaryStart(),
|
||||||
|
@ -5627,6 +5653,8 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles);
|
analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles);
|
||||||
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
||||||
analysisManService.saveMDCROI(sampleId, mdcInfoMaps, idAnalysis);
|
analysisManService.saveMDCROI(sampleId, mdcInfoMaps, idAnalysis);
|
||||||
|
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
||||||
|
analysisManService.saveROIResults(sampleId, idAnalysis, selfStationData.getBetaDataFile().getXeResultsSpectrumList());
|
||||||
|
|
||||||
// todo 逻辑不对 需要重写,用户修改QC刻度更新数据之后需要变更 20241009
|
// todo 逻辑不对 需要重写,用户修改QC刻度更新数据之后需要变更 20241009
|
||||||
// analysisManService.saveBetaCalibration(selfStationData.getBetaDataFile(), sampleId, idAnalysis);
|
// analysisManService.saveBetaCalibration(selfStationData.getBetaDataFile(), sampleId, idAnalysis);
|
||||||
|
@ -5694,6 +5722,21 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 存储报告文件
|
// 存储报告文件
|
||||||
|
{
|
||||||
|
String rptContent = SelfBaseUtil.getReport(sampleId, sampleStruct, qcStruct,
|
||||||
|
betaDataFile.getXeResultsSpectrumList());
|
||||||
|
String rptFileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
|
||||||
|
File rptFile = new File(rptFileName);
|
||||||
|
try {
|
||||||
|
FileUtil.writeString(rptContent, rptFile, "UTF-8");
|
||||||
|
FileInputStream in = new FileInputStream(rptFile);
|
||||||
|
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+reportPath+".txt", in);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
rptFile.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -5844,10 +5887,10 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
String rootPath = spectrumPathProperties.getRootPath();
|
String rootPath = spectrumPathProperties.getRootPath();
|
||||||
String saveFilePath = spectrumPathProperties.getSaveFilePath();
|
String saveFilePath = spectrumPathProperties.getSaveFilePath();
|
||||||
// todo beta报告暂时展示gamma
|
// todo beta报告暂时展示gamma
|
||||||
// reportPath = rootPath + saveFilePath + StrUtil.SLASH + reportPath + FileTypeEnum.arr.getType();
|
reportPath = rootPath + saveFilePath + StrUtil.SLASH + reportPath + FileTypeEnum.arr.getType();
|
||||||
// if (!FileUtil.exist(reportPath))
|
if (!FileUtil.exist(reportPath))
|
||||||
// return Result.error("The automatic handler generated report does not exist!");
|
return Result.error("The automatic handler generated report does not exist!");
|
||||||
// result.put("Beta", FileUtil.readUtf8String(reportPath));
|
result.put("Beta", FileUtil.readUtf8String(reportPath));
|
||||||
List<org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
|
List<org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
|
||||||
for (org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi analysisRoi : analysisRois) {
|
for (org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi analysisRoi : analysisRois) {
|
||||||
Integer roiNum = analysisRoi.getRoiNum();
|
Integer roiNum = analysisRoi.getRoiNum();
|
||||||
|
@ -5855,8 +5898,6 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
roiReportPath = rootPath + saveFilePath + StrUtil.SLASH + roiReportPath + FileTypeEnum.arr.getType();
|
roiReportPath = rootPath + saveFilePath + StrUtil.SLASH + roiReportPath + FileTypeEnum.arr.getType();
|
||||||
if (!FileUtil.exist(roiReportPath)) continue;
|
if (!FileUtil.exist(roiReportPath)) continue;
|
||||||
result.put("Gamma_ROI_" + roiNum, FileUtil.readUtf8String(roiReportPath));
|
result.put("Gamma_ROI_" + roiNum, FileUtil.readUtf8String(roiReportPath));
|
||||||
// todo beta报告暂时展示gamma
|
|
||||||
result.put("Beta", FileUtil.readUtf8String(roiReportPath));
|
|
||||||
}
|
}
|
||||||
return Result.OK(result);
|
return Result.OK(result);
|
||||||
}
|
}
|
||||||
|
@ -5890,8 +5931,8 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
result.put("Gamma_ROI_2", reportContent2);
|
result.put("Gamma_ROI_2", reportContent2);
|
||||||
result.put("Gamma_ROI_3", reportContent3);
|
result.put("Gamma_ROI_3", reportContent3);
|
||||||
result.put("Gamma_ROI_4", reportContent4);
|
result.put("Gamma_ROI_4", reportContent4);
|
||||||
// todo beta报告暂时使用gamma的
|
result.put("Beta", SelfBaseUtil.getReport(rrrLogInfo.getSampleId(), selfStationData.getSampleStruct(),
|
||||||
result.put("Beta", reportContent1);
|
selfStationData.getQcStruct(), selfStationData.getBetaDataFile().getXeResultsSpectrumList()));
|
||||||
return Result.OK(result);
|
return Result.OK(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user