diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java
index d2e6d78d..04e15e75 100644
--- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java
+++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SpectrumPathProperties.java
@@ -26,6 +26,11 @@ public class SpectrumPathProperties implements Serializable {
*/
private String rootPath;
+ /**
+ * 日志文件存储路径
+ */
+ private String logPath;
+
/**
* 能谱文件存储路径以能谱系统类型/能谱类型为key,以存储路径为value
*/
diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclLinesLib.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclLinesLib.java
new file mode 100644
index 00000000..ec730402
--- /dev/null
+++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclLinesLib.java
@@ -0,0 +1,44 @@
+package org.jeecg.modules.base.entity.configuration;
+
+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 = "CONFIGURATION.GARDS_NUCL_LINES_LIB")
+public class GardsNuclLinesLib implements Serializable {
+ @TableField(value = "NAME")
+ private String name;
+
+ @TableField(value = "ENERGY")
+ private Integer energy;
+
+ @TableField(value = "ENERGY_UNCERT")
+ private Integer energyUncert;
+
+ @TableField(value = "YIELD")
+ private Integer yield;
+
+ @TableField(value = "YIELD_UNCERT")
+ private Integer yieldUncert;
+
+ @TableField(value = "KEY_FLAG")
+ private Integer keyFlag;
+
+ @TableField(value = "NUCLIDE_ID")
+ private Integer nuclideId;
+
+ @TableField(value = "FULLNAME")
+ private String fullName;
+
+ @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;
+
+}
diff --git a/jeecg-module-spectrum-analysis/pom.xml b/jeecg-module-spectrum-analysis/pom.xml
index 2803eafa..77a9993c 100644
--- a/jeecg-module-spectrum-analysis/pom.xml
+++ b/jeecg-module-spectrum-analysis/pom.xml
@@ -29,6 +29,12 @@
ejml-simple
0.39
+
+
+ com.google.guava
+ guava
+ 23.0
+
\ No newline at end of file
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/LocalCache.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/LocalCache.java
new file mode 100644
index 00000000..fe49f1a7
--- /dev/null
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/cache/LocalCache.java
@@ -0,0 +1,33 @@
+package org.jeecg.common.cache;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import org.jeecg.modules.entity.vo.PHDFile;
+import org.springframework.stereotype.Component;
+
+import java.util.concurrent.TimeUnit;
+
+@Component
+public class LocalCache {
+ private Cache phdCache = CacheBuilder.newBuilder()
+ //设置缓存初始大小,应该合理设置,后续会扩容
+ .initialCapacity(10)
+ //最大值
+ .maximumSize(100)
+ //并发数设置
+ .concurrencyLevel(5)
+ //缓存过期时间,写入后5秒钟过期
+ .expireAfterWrite(5, TimeUnit.HOURS)
+ //统计缓存命中率
+ .recordStats()
+ .build();
+
+ public Cache getPHDCache() {
+ return phdCache;
+ }
+
+ public void setPHDCache(Cache phdCache) {
+ this.phdCache = phdCache;
+ }
+
+}
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java
index a9f8454f..2c910c91 100644
--- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java
@@ -9,6 +9,8 @@ import org.apache.commons.net.ftp.FTPFile;
import org.ejml.simple.SimpleMatrix;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.properties.SpectrumPathProperties;
+import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
+import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
@@ -27,13 +29,16 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
+import static sun.misc.DoubleConsts.NaN;
+
@Component
public class GammaFileUtil {
@@ -74,7 +79,7 @@ public class GammaFileUtil {
ftpClient.changeWorkingDirectory(pathName);
List ftpFiles = Arrays.asList(ftpClient.listFiles());
ftpFiles = ftpFiles.stream().filter(item-> item.getName().equals(fileName)).collect(Collectors.toList());
- if (CollectionUtils.isEmpty(ftpFiles)){
+ if (ftpFiles.size() == 0){
result.error500("ftp获取文件数据失败");
}
FTPFile ftpFile = ftpFiles.get(0);
@@ -260,6 +265,214 @@ public class GammaFileUtil {
}
}
+ public void SetBaseInfo(PHDFile phd, Integer sampleId){
+ //根据sampleId获取sample文件路径
+ String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
+ String pathName = sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
+ String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
+ //文件名称需要加上自动处理的前缀以及修改不同的文件后缀名
+ String subFileName = fileName.substring(0, fileName.lastIndexOf(StringPool.DOT));
+ try {
+ pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + pathName;
+ if(StringUtils.isNotBlank(subFileName)){
+ //连接ftp
+ FTPClient ftpClient = ftpUtil.LoginFTP();
+ if (Objects.isNull(ftpClient)){
+ String warning = "ftp连接失败";
+ }
+ //切换被动模式
+ ftpClient.enterLocalPassiveMode();
+ ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
+ // 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
+ ftpClient.setControlEncoding("UTF-8");
+ ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
+ ftpClient.changeWorkingDirectory(pathName);
+ List ftpFiles = Arrays.asList(ftpClient.listFiles());
+ String lcFileName = "RNAUTO_"+subFileName + ".lc";
+ List lcFiles = ftpFiles.stream().filter(item -> item.getName().equals(lcFileName)).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(lcFiles)){
+ FTPFile lcFile = lcFiles.get(0);
+ if (Objects.nonNull(lcFile)){
+ InputStream inputStream = ftpClient.retrieveFileStream(lcFile.getName());
+ //声明一个临时文件
+ File file = File.createTempFile("tmp", null);
+ //将ftp文件的输入流复制给临时文件
+ FileUtils.copyInputStreamToFile(inputStream, file);
+ List readLines = FileUtils.readLines(file, "UTF-8");
+ List vData = ReadLcScacInfo(readLines);
+ phd.setVLc(vData);
+ }
+ }
+ try {
+ ftpClient.disconnect();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if(StringUtils.isNotBlank(subFileName)){
+ //连接ftp
+ FTPClient ftpClient = ftpUtil.LoginFTP();
+ if (Objects.isNull(ftpClient)){
+ String warning = "ftp连接失败";
+ }
+ //切换被动模式
+ ftpClient.enterLocalPassiveMode();
+ ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
+ // 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
+ ftpClient.setControlEncoding("UTF-8");
+ ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
+ ftpClient.changeWorkingDirectory(pathName);
+ List ftpFiles = Arrays.asList(ftpClient.listFiles());
+ String scacFileName = "RNAUTO_"+subFileName + ".scac";
+ List scacFiles = ftpFiles.stream().filter(item -> item.getName().equals(scacFileName)).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(scacFiles)){
+ FTPFile scacFile = scacFiles.get(0);
+ if (Objects.nonNull(scacFile)){
+ InputStream inputStream = ftpClient.retrieveFileStream(scacFile.getName());
+ //声明一个临时文件
+ File file = File.createTempFile("tmp", null);
+ //将ftp文件的输入流复制给临时文件
+ FileUtils.copyInputStreamToFile(inputStream, file);
+ List readLines = FileUtils.readLines(file, "UTF-8");
+ List vData = ReadLcScacInfo(readLines);
+ phd.setVScac(vData);
+ }
+ }
+ try {
+ ftpClient.disconnect();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if(StringUtils.isNotBlank(subFileName)){
+ //连接ftp
+ FTPClient ftpClient = ftpUtil.LoginFTP();
+ if (Objects.isNull(ftpClient)){
+ String warning = "ftp连接失败";
+ }
+ //切换被动模式
+ ftpClient.enterLocalPassiveMode();
+ ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
+ // 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
+ ftpClient.setControlEncoding("UTF-8");
+ ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
+ ftpClient.changeWorkingDirectory(pathName);
+ List ftpFiles = Arrays.asList(ftpClient.listFiles());
+ String baselineFileName = "RNAUTO_"+subFileName + ".baseline";
+ List baselineFiles = ftpFiles.stream().filter(item -> item.getName().equals(baselineFileName)).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(baselineFiles)){
+ FTPFile baselineFile = baselineFiles.get(0);
+ if (Objects.nonNull(baselineFile)){
+ InputStream inputStream = ftpClient.retrieveFileStream(baselineFile.getName());
+ //声明一个临时文件
+ File file = File.createTempFile("tmp", null);
+ //将ftp文件的输入流复制给临时文件
+ FileUtils.copyInputStreamToFile(inputStream, file);
+ List readLines = FileUtils.readLines(file, "UTF-8");
+ ReadBaseCtrlInfo(phd,readLines);
+ phd.setVBase(phd.getBaseCtrls().getBaseline());
+ }
+ }
+ try {
+ ftpClient.disconnect();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public List ReadLcScacInfo(List readLines){
+ List vData = new LinkedList<>();
+ for (int i=0; i< readLines.size(); i++){
+ String line = readLines.get(i);
+ if (line.contains("#")){
+ int j=i+1;
+ line = readLines.get(j);
+ String line1 = line;
+ while (j != readLines.size()-1 && StringUtils.isNotBlank(line) ){
+ j++;
+ line = readLines.get(j);
+ if (!line.contains("#")){
+ line1 += " " + line;
+ }else {
+ break;
+ }
+ }
+ line1 = line1.trim();
+ List strList = Arrays.asList(line1.split("\\s+"));
+ if(strList.size() < 2){
+ continue;
+ }
+ for(int k=1; k readLines){
+ for (int i=0; i< readLines.size(); i++){
+ String line = readLines.get(i);
+ if (line.contains("#")){
+ String block_name = line.trim();
+ int j=i+1;
+ line = readLines.get(j);
+ String block_data = line;
+ while(j!= readLines.size()-1 && StringUtils.isNotBlank(line)) {
+ j++;
+ line = readLines.get(j);
+ if (!line.contains("#")){
+ block_data += " " + line;
+ }else {
+ break;
+ }
+ }
+ i=j-1;
+ block_data = block_data.trim();
+ List str_list = Arrays.asList(block_data.split("\\s+"));
+ if(str_list.size() < 1){
+ continue;
+ }
+ List vTemp = new LinkedList<>();
+ for(String str:str_list) {
+ if (StringUtils.isNotBlank(str) && !str.equalsIgnoreCase("nan")){
+ double d = Double.valueOf(str);
+ vTemp.add(d);
+ } else if (StringUtils.isNotBlank(str) && str.equalsIgnoreCase("nan")) {
+ vTemp.add(0.0);
+ }
+ }
+ if(block_name.contains("#AnalyseRange")) {
+ if(vTemp.size() == 2) {
+ phd.getBaseCtrls().setRg_low(vTemp.get(0).intValue());
+ phd.getBaseCtrls().setRg_high(vTemp.get(1).intValue());
+ }
+ } else if(block_name.contains("#XCtrl")) {
+ phd.getBaseCtrls().setXCtrl(vTemp);
+ } else if(block_name.contains("#YCtrl")) {
+ phd.getBaseCtrls().setYCtrl(vTemp);
+ } else if(block_name.contains("#YSlope")) {
+ phd.getBaseCtrls().setYSlope(vTemp);
+ } else if(block_name.contains("#Baseline")) {
+ List list = vTemp.subList(1, vTemp.size());
+ phd.getBaseCtrls().setBaseline(list);
+ } else if(block_name.contains("#StepCounts")) {
+ List list = vTemp.subList(1, vTemp.size());
+ phd.getBaseCtrls().setStepCounts(list);
+ }
+ }
+ }
+ }
+
public boolean getResultFromDB(String dbName, Integer sampleId, PHDFile phd, Result result){
//判断连接的数据库
String T_analy, T_calib, T_peaks, T_param, T_nuc_line, T_nuc_act, T_qc, T_setting;
@@ -338,7 +551,8 @@ public class GammaFileUtil {
peakInfo.upperTail = peaksSpectrum.getUpperTail()==null?0:peaksSpectrum.getUpperTail();
peakInfo.upperTailAlpha = peaksSpectrum.getUpperTailAlpha()==null?0:peaksSpectrum.getUpperTailAlpha();
peakInfo.BWWidthChan = peaksSpectrum.getBwwidthchan()==null?0:peaksSpectrum.getBwwidthchan();
- peakInfo.recoilDeltaChan = peaksSpectrum.getRecoildeltachan()==null?0:peaksSpectrum.getRecoildeltachan();
+ peakInfo.recoilBetaChan = "1";
+ peakInfo.recoilDeltaChan = peaksSpectrum.getRecoildeltachan()==null?"1":peaksSpectrum.getRecoildeltachan().toString();
peakInfo.comments = peaksSpectrum.getPeakcomments();
phd.getVPeak().add(peakInfo);
}
@@ -360,22 +574,22 @@ public class GammaFileUtil {
phd.setUsedEner(pairsSpectrum.getInput());
gEnergyBlock.getCentroid_channel().add(pairsSpectrum.getXValue());
gEnergyBlock.getG_energy().add(pairsSpectrum.getYValue());
- gEnergyBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? null:Double.valueOf(pairsSpectrum.getUncYValue()));
+ gEnergyBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? 0:Double.valueOf(pairsSpectrum.getUncYValue()));
} else if(calType.equals("Resolution")) {
phd.setUsedReso(pairsSpectrum.getInput());
gResolutionBlock.getG_energy().add(pairsSpectrum.getXValue());
gResolutionBlock.getFWHM().add(pairsSpectrum.getYValue());
- gResolutionBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? null: Double.valueOf(pairsSpectrum.getUncYValue()));
+ gResolutionBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? 0: Double.valueOf(pairsSpectrum.getUncYValue()));
} else if(calType.equals("efficiency")) {
phd.setUsedEffi(pairsSpectrum.getInput());
gEfficiencyBlock.getG_energy().add(pairsSpectrum.getXValue());
gEfficiencyBlock.getEfficiency().add(pairsSpectrum.getYValue());
- gEfficiencyBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? null: Double.valueOf(pairsSpectrum.getUncYValue()));
+ gEfficiencyBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? 0: Double.valueOf(pairsSpectrum.getUncYValue()));
} else if(calType.equals("TotalEfficiency")) {
phd.setUsedTotE(pairsSpectrum.getInput());
totaleffBlock.getG_energy().add(pairsSpectrum.getXValue());
totaleffBlock.getTotal_efficiency().add(pairsSpectrum.getYValue());
- totaleffBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? null: Double.valueOf(pairsSpectrum.getUncYValue()));
+ totaleffBlock.getUncertainty().add(pairsSpectrum.getUncYValue().isEmpty()? 0: Double.valueOf(pairsSpectrum.getUncYValue()));
}
}
if (phd.getUsedEner().isEmpty()){
@@ -432,7 +646,7 @@ public class GammaFileUtil {
String[] list_coeff = calibrationSpectrum.getCoeffString().split(StringPool.COMMA);
for (String str:list_coeff) {
para.getP().add(Double.valueOf(str));
- para.getPerr().add(null);
+ para.getPerr().add(NaN);
}
if(calType.equals("energy")) {
phd.setUsedEnerPara(para);
@@ -463,7 +677,7 @@ public class GammaFileUtil {
phd.getMapNucActMda().get(str_key).setActivity(Double.valueOf(nuclLinesIdedSpectrum.getActivity()));
phd.getMapNucActMda().get(str_key).setAct_err(nuclLinesIdedSpectrum.getUncActivity());
phd.getMapNucActMda().get(str_key).setEfficiency(nuclLinesIdedSpectrum.getEffic());
- phd.getMapNucActMda().get(str_key).setEffi_err(nuclLinesIdedSpectrum.getUncEffic());
+ phd.getMapNucActMda().get(str_key).setEffi_err(nuclLinesIdedSpectrum.getUnEffic());
phd.getMapNucActMda().get(str_key).setMda(nuclLinesIdedSpectrum.getMda());
phd.getMapNucActMda().get(str_key).setMdc(Double.valueOf(nuclLinesIdedSpectrum.getMdc()));
phd.getMapNucActMda().get(str_key).setConcentration(Double.valueOf(nuclLinesIdedSpectrum.getConcentration()));
@@ -525,7 +739,7 @@ public class GammaFileUtil {
if (Objects.nonNull(analySetting)){
phd.getUsedSetting().setECutAnalysis_Low(analySetting.getEcutanalysisLow());
double t_d = analySetting.getEcutanalysisHigh();
- phd.getUsedSetting().setECutAnalysis_High((t_d <= phd.getUsedSetting().getECutAnalysis_Low() ? null : t_d));
+ phd.getUsedSetting().setECutAnalysis_High((t_d <= phd.getUsedSetting().getECutAnalysis_Low() ? 0 : t_d));
phd.getUsedSetting().setEnergyTolerance(analySetting.getEnergytolerance());
phd.getUsedSetting().setCalibrationPSS_high(analySetting.getCalibrationpssHigh());
phd.getUsedSetting().setCalibrationPSS_low(analySetting.getCalibrationpssLow());
@@ -1170,7 +1384,7 @@ public class GammaFileUtil {
regChan.add(d);
d += 0.25;
}
- List t_base = new LinkedList<>(vBase.subList(peak.left-1, peak.right));
+ List t_base = vBase.subList(peak.left, peak.right + 1);
List regPeak = CalValuesHandler.interp1(peak, t_base, regChan);
if(bEnergy) {
@@ -1634,4 +1848,1693 @@ public class GammaFileUtil {
return mapLines;
}
+ public ChartData Channel_BaseLine(PHDFile phd, List m_vCount, long m_nCount) {
+ ChartData cData = new ChartData();
+ int start =0;
+ long end = 0;
+ if(m_nCount > 1 && phd.getVBase().size() == m_nCount) {
+ if(start < 1){
+ start = 1;
+ }
+ if(end > m_nCount || end < 1){
+ end = m_nCount;
+ }
+
+ for(int i=start-1; i Differance(PHDFile phd, List vecPeak, List m_vCount, long m_nCount){
+ System.loadLibrary("GammaAnaly");
+ List pointlist = new LinkedList<>();
+ int start =0;
+ long end = 0;
+ int peakNum = vecPeak.size();
+ if(peakNum < 1 || phd.getVBase().size() != m_nCount){
+ return pointlist;
+ }
+
+ if(start < 1){
+ start = 1;
+ }
+ if(end > m_nCount || end < 1){
+ end = m_nCount;
+ }
+
+ // 找出在所给范围的第一道拟合峰和最后一道拟合峰的索引下标
+ int index = 0;
+ int startPeak = -1;
+ int endPeak = peakNum-1;
+ while(index < peakNum && start > vecPeak.get(index).right){
+ ++index;
+ }
+ if(index < peakNum) {
+ startPeak = index;
+ while(index < peakNum && vecPeak.get(index).left < end){
+ ++index;
+ }
+ endPeak = index-1;
+ }
+ if(startPeak < 0 || startPeak > endPeak){
+ return pointlist;
+ }
+
+ List regPeak = new LinkedList<>();
+ int channel = 1;
+ for(int i=start-1; i= peak.left && channel <= peak.right) {
+ if(CollectionUtils.isEmpty(regPeak)) {
+ List regChan = new LinkedList<>();
+ for(double d=peak.left; d<=peak.right; d+=1.0){
+ regChan.add(d);
+ }
+ List vBase = phd.getVBase();
+ List t_base = vBase.subList(peak.left-1, peak.right);
+ regPeak = CalValuesHandler.interp1(peak, t_base, regChan);
+ }
+ // 差值 = 原谱值 - 峰面积
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(channel);
+ seriseData.setY(m_vCount.get(i) - regPeak.get(channel-peak.left));
+ pointlist.add(seriseData);
+ } else if(m_vCount.get(i) > 0 && phd.getVBase().get(i) > 0) {
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(channel);
+ seriseData.setY(m_vCount.get(i) - phd.getVBase().get(i));
+ pointlist.add(seriseData);
+ } else{
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(channel);
+ seriseData.setY(0);
+ pointlist.add(seriseData);
+ }
+
+ if(vecPeak.get(startPeak).right < channel) {
+ ++startPeak; regPeak.clear();
+ }
+ if(startPeak > endPeak){
+ break;
+ }
+ }
+ for(int i=channel; i 0 && phd.getVBase().get(i) > 0) {
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(i+1);
+ seriseData.setY(m_vCount.get(i) - phd.getVBase().get(i));
+ pointlist.add(seriseData);
+ } else {
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(i+1);
+ seriseData.setY(0);
+ pointlist.add(seriseData);
+ }
+ }
+
+ return pointlist;
+ }
+
+ public void ReadData(List m_vEnergy, List m_vNuclide){
+ try {
+ String filePath = parameterFilePath+File.separator+"Energy_Nuclide.txt";
+ File file = new File(filePath);
+ List readLines = FileUtils.readLines(file, "UTF-8");
+ for (int i=0; i= 2 && m_curParam.getP().get(2) > 0) {
+ // Polynomial: y=a0+a1*x+a2*x^2+a3*x^3
+ equation +="Energy = "+m_curParam.getP().get(1)+" + C * "+m_curParam.getP().get(2);
+ for(int i=3; i<=p_size; ++i) {
+ equation += " + C" + (i-1) +" * "+m_curParam.getP().get(i)+"";
+ }
+ } else if(p_size == 1) {
+ equation = "Energy = "+m_curParam.getP().get(1)+" * C";
+ }
+ return equation;
+ }
+
+ public void UpdateChartEnergy(List m_vCurEnergy, ParameterInfo m_curParam, List m_vCurCentroid, PHDFile phd, Map map) {
+ System.loadLibrary("GammaAnaly");
+ int num = m_vCurEnergy.size();
+ if(num < 1){
+ return;
+ }
+ List datalist = new LinkedList<>();
+ if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
+ // 拟合曲线
+ ChartData lData = new ChartData();
+ lData.setColor("255, 255, 0");
+ lData.setType("Line");
+
+ List vChan = new LinkedList<>();
+ double MaxChan = Double.valueOf(phd.getSpec().getNum_g_channel());
+ double d = 1;
+ double dStep = MaxChan / 30 * 2;
+ while(d < MaxChan) {
+ vChan.add(d);
+ d+= dStep;
+ }
+ vChan.add(MaxChan);
+
+ List vFit = CalValuesHandler.calFcnEval(vChan, m_curParam.getP()).counts;
+ for(int i=0; i 0){
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(vChan.get(i));
+ seriseData.setY(vFit.get(i));
+ lData.getPointlist().add(seriseData);
+ }
+ }
+ if(lData.getPointlist().size() > 1){
+ datalist.add(lData);
+ }
+ }
+
+ // Channel——Energy 点集
+ ChartData pData = new ChartData();
+ pData.setColor("red");
+ pData.setType("Scatter");
+ for(int i=0; i= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
+ // Square root of polynomial: y = sqrt(a0+a1*x+a2*x^2+a3*x^3 )
+ equation += "FWHM = ("+m_curParam.getP().get(1)+" + E * "+m_curParam.getP().get(2);
+ for(int i=3; i<=p_size; ++i) {
+ equation += " + E"+(i-1)+" * "+m_curParam.getP().get(i);
+ }
+ equation += ")"+1+"/"+2+"";
+ }
+ return equation;
+ }
+
+ public void UpdateChartResolution(List m_vCurEnergy, ParameterInfo m_curParam, List m_vCurReso, PHDFile phd, Map map) {
+ System.loadLibrary("GammaAnaly");
+ int num = m_vCurEnergy.size();
+ if(num < 1) return;
+
+ List datalist = new LinkedList<>();
+ if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
+ // 拟合曲线
+ ChartData lData = new ChartData();
+ lData.setColor("255, 255, 0");
+ lData.setType("Line");
+
+ List vChan = new LinkedList<>();
+ vChan.add(1.0);
+ vChan.add(Double.valueOf(phd.getSpec().getNum_g_channel()));
+
+ List vEner = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP()).counts;
+ double d = vEner.get(0), maxE = vEner.get(1);
+ double dStep = maxE / 30 * 2;
+
+ vEner.remove(vEner.size()-1);
+ while(d < maxE) {
+ vEner.add(d);
+ d += dStep;
+ }
+ vEner.add(maxE);
+
+ List vFit = CalValuesHandler.calFcnEval(vEner, m_curParam.getP()).counts;
+ for(int i=0; i 0){
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(vEner.get(i));
+ seriseData.setY(vFit.get(i));
+ lData.getPointlist().add(seriseData);
+ }
+ }
+ if(lData.getPointlist().size() > 1){
+ datalist.add(lData);
+ }
+ }
+
+ // Channel——Energy 点集
+ ChartData pData = new ChartData();
+ pData.setColor("red");
+ pData.setType("Scatter");
+ for(int i=0; i m_vCurEnergy, ParameterInfo m_curParam) {
+ String equation = "";
+ if(m_curParam.getP().size() > 2) {
+ int p_size = m_curParam.getP().size()-1;
+ int e_size = m_vCurEnergy.size();
+ int funId = m_curParam.getP().get(0).intValue();
+ switch(funId) {
+ case 1: // Interpolation: y=yi+(y(i+1)-yi)*(x-xi)/(x(i+1)-xi) for xi<=x= 4) {
+ int i = 0;
+ if(i < 0 || i >= e_size) break;
+
+ double y1, y0, x1, x0;
+ if(i < e_size - 1)
+ {
+ y1 = m_curParam.getP().get(i*2+3);
+ y0 = m_curParam.getP().get(i*2+1);
+ x1 = m_curParam.getP().get(i*2+2);
+ x0 = m_curParam.getP().get(i*2);
+ }
+ else {
+ y1 = m_curParam.getP().get(i*2+1);
+ y0 = m_curParam.getP().get(i*2-1);
+ x1 = m_curParam.getP().get(i*2);
+ x0 = m_curParam.getP().get(i*2-2);
+ }
+ equation += "Efficiency = "+y0+" + ("+y1+"-"+y0+") * (E - "+x0+") / ("+x1+" - "+x0+")";
+ }
+ break;
+ case 5: // HT Efficiency: y = A*exp(-(E1/x)^k)*(1-exp(-(E2/x)^n))
+ if(p_size == 5) {
+ for(int i=1; i<=p_size; ++i) {
+ if(m_curParam.getP().get(i) <= 0) break;
+ }
+ equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)"+m_curParam.getP().get(3)+") * "+
+ "(1-exp(-("+m_curParam.getP().get(4)+" / E)"+m_curParam.getP().get(5)+"))";
+ }
+ break;
+ case 6: // Polynomial in log(y) against log(x): log(y) = a0 + a1*log(x) +a2*log(x)^2+ a3*log(x)^3
+ if(p_size >= 2) {
+ equation += "log(Efficiency) = "+m_curParam.getP().get(1)+" + "+m_curParam.getP().get(2)+" * log(E)";
+ for(int i=3; i<=p_size; ++i) {
+ equation += " + "+m_curParam.getP().get(i)+" * log(E)"+(i-1)+"";
+ }
+ }
+ break;
+ case 8: // Polynomial in log(y) against log(1/x): log(y) = a0 + a1*log(c/x) + a2*log(c/x)^2 + a3*log(c/x)^3 + a4*log(c/x)^4
+ if(p_size >= 3) {
+ equation += "log(Efficiency) = "+m_curParam.getP().get(1)+" + "+m_curParam.getP().get(2)+" * log(C/E)";
+ for(int i=3; i<=p_size; ++i) {
+ equation += " + "+m_curParam.getP().get(i)+" * log(C/E)"+(i-1)+"";
+ }
+ }
+ break;
+ case 93: // HAE Efficiency (1-3): y=S*exp(-(E1/x)^k)*(1- exp(-(2*E3/(x-E3))^n))
+ if(p_size == 5) {
+ equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)"+m_curParam.getP().get(3)+") * "+
+ "(1 - exp(-(2 * "+m_curParam.getP().get(4)+" / (E - "+m_curParam.getP().get(4)+"))"+m_curParam.getP().get(5)+"))";
+ }
+ break;
+ case 94: // HAE Efficiency (1-2): y=S*exp(-(E1/x)^k)*(1- exp(-b*(1/(x-E2))^m))
+ if(p_size == 6) {
+ equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)"+m_curParam.getP().get(3)+") * "+
+ "(1 - exp(-"+m_curParam.getP().get(4)+" * (1 / (E - "+m_curParam.getP().get(5)+"))"+m_curParam.getP().get(6)+"))";
+ }
+ break;
+ case 95: // HAE Efficiency (1-2-3): y = S * exp(-(E1/x)^k) * (1- exp(-b*(1/(x-E2))^m)) *(1 - exp(-(2*E3/(E-E3))^n))
+ if(p_size == 8) {
+ equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)"+m_curParam.getP().get(3)+") * "+
+ "(1 - exp(-"+m_curParam.getP().get(4)+" * (1 / (E - "+m_curParam.getP().get(5)+"))"+m_curParam.getP().get(6)+")) * "+
+ "(1 - exp(-(2 * "+m_curParam.getP().get(7)+" / (E - "+m_curParam.getP().get(7)+"))"+m_curParam.getP().get(8)+"))";
+ }
+ break;
+ }
+ }
+ return equation;
+ }
+
+ public void UpdateChartEfficiency(List m_vCurEnergy, ParameterInfo m_curParam, List m_vCurEffi, PHDFile phd, Map map) {
+ System.loadLibrary("GammaAnaly");
+ int num = m_vCurEnergy.size();
+ if(num < 1) return;
+
+ List datalist = new LinkedList<>();
+ if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
+ // 拟合曲线
+ ChartData lData = new ChartData();
+ lData.setColor("255, 255, 0");
+ lData.setType("Line");
+
+ List vChan = new LinkedList<>();
+ vChan.add(1.0);
+ vChan.add(Double.valueOf(phd.getSpec().getNum_g_channel()));
+
+ List vEner = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP()).counts;
+ double d = vEner.get(0);
+ double maxE = vEner.get(1);
+ double dStep = maxE / 30 * 2;
+
+ vEner.remove(vEner.size()-1);
+ while(d < maxE) {
+ vEner.add(d);
+ d += dStep;
+ }
+ vEner.add(maxE);
+
+ List vFit = CalValuesHandler.calFcnEval(vEner, m_curParam.getP()).counts;
+ for(int i=0; i 0){
+ SeriseData seriseData = new SeriseData();
+ seriseData.setX(vEner.get(i));
+ seriseData.setY(vFit.get(i));
+ lData.getPointlist().add(seriseData);
+ }
+ }
+ if(lData.getPointlist().size() > 1){
+ datalist.add(lData);
+ }
+ }
+
+ // Channel——Energy 点集
+ ChartData pData = new ChartData();
+ pData.setColor("red");
+ pData.setType("Scatter");
+ for(int i=0; i InitNuclideLine(String editEnergy, double err, String name) {
+ Double min = null;
+ Double max = null;
+ if (StringUtils.isNotBlank(editEnergy) && Objects.nonNull(err)){
+ double editEnergyDou = Double.valueOf(editEnergy);
+ min = editEnergyDou - err;
+ max = editEnergyDou + err;
+ }
+ List nuclideLines = spectrumAnalysisMapper.getNuclideLine(min, max, name);
+ return nuclideLines;
+ }
+
+ public Map InitNuclideInfo(String name) {
+ Map map = new HashMap<>();
+ GardsNuclLib nuclideInfo = spectrumAnalysisMapper.getNuclideInfo(name);
+ if(Objects.nonNull(nuclideInfo)) {
+ Long numLines = nuclideInfo.getNumLines();
+ map.put("lab_lines", numLines.toString());
+ if(Objects.isNull(nuclideInfo.getHalflife())) {
+ map.put("lab_halfLife", "");
+ } else {
+ String units = "D";
+ double halflife = nuclideInfo.getHalflife().doubleValue();
+ if(halflife >= 1000) {
+ halflife = halflife / 365.25;
+ units = "A";
+ } else if(halflife < 0.1 && halflife >= 1.0 / 1440.0) {
+ halflife = halflife * 1440.0;
+ units = "M";
+ } else if(halflife <= 1.0 / 1440.0 && halflife > 0.0) {
+ halflife = halflife * 86400.0;
+ units = "S";
+ }
+ char flag = 'f';
+ if(halflife >= 1000){
+ flag = 'e';
+ }
+ if (flag == 'f'){
+ map.put("lab_halfLife", String.format("%.3f", halflife)+units);
+ } else if (flag == 'e') {
+ NumberFormat numberFormat = new DecimalFormat("0.###E0");
+ String formatNum = numberFormat.format(halflife);
+ map.put("lab_halfLife", formatNum+units);
+ }
+ }
+ if(Objects.isNull(nuclideInfo.getHalflifeErr())) {
+ map.put("lab_halfLifeErr", "");
+ } else {
+ map.put("lab_halfLifeErr", String.format("%.3f", nuclideInfo.getHalflifeErr().doubleValue())+"%");
+ }
+ }
+ return map;
+ }
+
+ public Map InitParentAndDaughter(String name) {
+ Map map = new HashMap<>();
+ GardsNuclLib parentAndDaughter = spectrumAnalysisMapper.getParentAndDaughter(name);
+ List parentList = new LinkedList<>();
+ if(Objects.nonNull(parentAndDaughter)) {
+ parentList.add(parentAndDaughter.getDaughters1());
+ parentList.add(parentAndDaughter.getDaughters2());
+ parentList.add(parentAndDaughter.getDaughters3());
+ parentList.add(parentAndDaughter.getDaughters4());
+ parentList.add(parentAndDaughter.getDaughters5());
+ map.put("list_parent", parentList);
+ List daughterList = new LinkedList<>();
+ TableDaughter tableDaughter1 = new TableDaughter();
+ tableDaughter1.setDaughters(parentAndDaughter.getDaughters1());
+ tableDaughter1.setBranchingratios(String.format("%.2f", parentAndDaughter.getBranchingratios1().doubleValue())+"%");
+ tableDaughter1.setDaughtersstable(parentAndDaughter.getDaughtersstable1().intValue() == 1? "Stable" : "Unstable");
+ daughterList.add(tableDaughter1);
+ TableDaughter tableDaughter2 = new TableDaughter();
+ tableDaughter2.setDaughters(parentAndDaughter.getDaughters2());
+ tableDaughter2.setBranchingratios(String.format("%.2f", parentAndDaughter.getBranchingratios2().doubleValue())+"%");
+ tableDaughter2.setDaughtersstable(parentAndDaughter.getDaughtersstable2().intValue() == 1? "Stable" : "Unstable");
+ daughterList.add(tableDaughter2);
+ TableDaughter tableDaughter3 = new TableDaughter();
+ tableDaughter3.setDaughters(parentAndDaughter.getDaughters3());
+ tableDaughter3.setBranchingratios(String.format("%.2f", parentAndDaughter.getBranchingratios3().doubleValue())+"%");
+ tableDaughter3.setDaughtersstable(parentAndDaughter.getDaughtersstable3().intValue() == 1? "Stable" : "Unstable");
+ daughterList.add(tableDaughter3);
+ TableDaughter tableDaughter4 = new TableDaughter();
+ tableDaughter4.setDaughters(parentAndDaughter.getDaughters4());
+ tableDaughter4.setBranchingratios(String.format("%.2f", parentAndDaughter.getBranchingratios4().doubleValue())+"%");
+ tableDaughter4.setDaughtersstable(parentAndDaughter.getDaughtersstable4().intValue() == 1? "Stable" : "Unstable");
+ daughterList.add(tableDaughter4);
+ TableDaughter tableDaughter5 = new TableDaughter();
+ tableDaughter5.setDaughters(parentAndDaughter.getDaughters5());
+ tableDaughter5.setBranchingratios(String.format("%.2f", parentAndDaughter.getBranchingratios5().doubleValue())+"%");
+ tableDaughter5.setDaughtersstable(parentAndDaughter.getDaughtersstable5().intValue() == 1? "Stable" : "Unstable");
+ daughterList.add(tableDaughter5);
+ map.put("table_daughter", daughterList);
+ }
+ return map;
+ }
+
+ public String GetReportContent(PHDFile phd, boolean bLog) {
+ GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
+ this.GetInterMiddlData(phd, middleData);
+ if(bLog) {
+ return this.GetLogContent(middleData);
+ } else {
+ return this.GetReportContent(middleData);
+ }
+ }
+
+ public boolean GetInterMiddlData(PHDFile phd, GStoreMiddleProcessData middleData){
+ boolean bRet = true;
+ Map temp = new HashMap<>();
+ try {
+ bRet = GetMiddleData(phd,temp,middleData);
+ middleData.analyses_type ="Interactive";
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ return bRet;
+ }
+
+ public String GetLogContent(GStoreMiddleProcessData middleData){
+ StringBuffer strBuffer = new StringBuffer();
+ strBuffer.append("-------------------------- Sample Analyse Beginning at "+DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss")+" ---------------------------\n");
+ strBuffer.append("\n");
+ strBuffer.append("....................................... Read calibration data ........................................\n");
+ strBuffer.append("\n");
+ strBuffer.append("Reading gamma energy pairs(sampleID: "+middleData.sample_id+").....\n");
+ strBuffer.append("\n");
+ for (int i=0;i0) {
+ strBuffer.append("Energy Calibration ["+middleData.calibration_pairs_E_Input+" ]\n");
+ strBuffer.append("Function: "+middleData.calibration_E_functionTypeDef+"\n");
+ strBuffer.append("E: "+middleData.calibration_E_functionDef+"\n");
+ strBuffer.append("P: "+middleData.calibration_E_coeff_string+"\n");
+ strBuffer.append("Err: "+middleData.calibration_E_uncoeff_string+"\n");
+ strBuffer.append("Data: "+middleData.calibration_pairs_E_Input+"\n");
+ }
+ if(middleData.calibration_pairs_R_idCalPoint.size()>0) {
+ strBuffer.append("Resolution Calibration ["+middleData.calibration_pairs_R_Input+" ]\n");
+ strBuffer.append("Function: "+middleData.calibration_R_functionTypeDef+"\n");
+ strBuffer.append("E: "+middleData.calibration_R_functionDef+"\n");
+ strBuffer.append("P: "+middleData.calibration_R_coeff_string+"\n");
+ strBuffer.append("Err: "+middleData.calibration_R_uncoeff_string+"\n");
+ strBuffer.append("Data: "+middleData.calibration_pairs_R_Input+"\n");
+ }
+ if(middleData.calibration_pairs_EF_idCalPoint.size()>0) {
+ strBuffer.append("Efficiency Calibration ["+middleData.calibration_pairs_EF_Input+" ]\n");
+ strBuffer.append("Function: "+middleData.calibration_EF_functionTypeDef+"\n");
+ strBuffer.append("E: "+middleData.calibration_EF_functionDef+"\n");
+ strBuffer.append("P: "+middleData.calibration_EF_coeff_string+"\n");
+ strBuffer.append("Err: "+middleData.calibration_EF_uncoeff_string+"\n");
+ strBuffer.append("Data: "+middleData.calibration_pairs_EF_Input+"\n");
+ }
+ if(middleData.calibration_pairs_T_idCalPoint.size()>0) {
+ strBuffer.append("Tot_efficiency Calibration ["+middleData.calibration_pairs_T_Input+" ]\n");
+ strBuffer.append("Function: "+middleData.calibration_T_functionTypeDef+"\n");
+ strBuffer.append("E: "+middleData.calibration_T_functionDef+"\n");
+ strBuffer.append("P: "+middleData.calibration_T_coeff_string+"\n");
+ strBuffer.append("Err: "+middleData.calibration_T_uncoeff_string+"\n");
+ strBuffer.append("Data: "+middleData.calibration_pairs_T_Input+"\n");
+ }
+ strBuffer.append("\n");
+ strBuffer.append("........................................ Calibration Finished ........................................");
+ strBuffer.append("\n");
+ strBuffer.append("..................................... Starting Spectrum Analysis .....................................");
+ strBuffer.append("\n");
+ strBuffer.append("PROCESSING PARAMETERS.....\n");
+ strBuffer.append("ECutAnalysis_Low : "+middleData.setting_specSetup.getECutAnalysis_Low()+"\n");
+ strBuffer.append("ECutAnalysis_High : "+middleData.setting_specSetup.getECutAnalysis_High()+"\n");
+ strBuffer.append("EnergyTolerance : "+middleData.setting_specSetup.getEnergyTolerance()+"\n");
+ strBuffer.append("BaseImprovePSS : "+middleData.setting_specSetup.getBaseImprovePSS()+"\n");
+ strBuffer.append("PSS_low : "+middleData.setting_specSetup.getPSS_low()+"\n");
+ strBuffer.append("k_back : "+middleData.setting_specSetup.getK_back()+"\n");
+ strBuffer.append("k_alpha : "+middleData.setting_specSetup.getK_alpha()+"\n");
+ strBuffer.append("k_beta : "+middleData.setting_specSetup.getK_beta()+"\n");
+ strBuffer.append("RiskLevelK : "+middleData.setting_specSetup.getRiskLevelK()+"\n");
+ strBuffer.append("refTime_act : "+middleData.setting_specSetup.getRefTime_act()+"\n");
+ strBuffer.append("refTime_conc : "+middleData.setting_specSetup.getRefTime_conc()+"\n");
+ strBuffer.append("\n");
+ strBuffer.append("CALIBRATION PARAMETERS.....\n");
+ strBuffer.append("\n");
+ strBuffer.append("CalibrationPSS_low : "+middleData.setting_specSetup.getCalibrationPSS_low()+"\n");
+ strBuffer.append("CalibrationPSS_high : "+middleData.setting_specSetup.getCalibrationPSS_high()+"\n");
+ strBuffer.append("bUpdateCal : "+(middleData.setting_specSetup.isBUpdateCal()?"1":"0")+"\n");
+ strBuffer.append("KeepCalPeakSearchPeaks : "+(middleData.setting_specSetup.isKeepCalPeakSearchPeaks()?"1":"0")+"\n");
+ strBuffer.append("\n");
+ double peaksUsed = 0;
+ for(int m=0;m1)
+ {
+ qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.get(middleData.nucl_ided_Nuclidename.size()-1);
+ }
+ strBuffer.append("Nuclide Identified.....\n");
+ strBuffer.append("\n");
+ strBuffer.append("Nuclides Identified : "+qsNuclidesName+"\n");
+ strBuffer.append("Keyline Activities for Nuclides with defined Reference Line : \n");
+ strBuffer.append("Activity Reference Time : "+middleData.sample_acquisiton_start+"\n");
+ strBuffer.append("Concentration Reference Time : "+middleData.sample_collection_start+"\n");
+ strBuffer.append("\n");
+ for (int i=0;i1) {
+ qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.get(middleData.nucl_ided_Nuclidename.size()-1);
+ }
+ strBuffer.append("#ACTIVITY SUMMARY\n");
+ strBuffer.append(" Nuclides Identified: "+qsNuclidesName+"\n");
+ strBuffer.append(" Keyline Activities for Nuclides: \n");
+ strBuffer.append(" with defined Reference Line: \n");
+ strBuffer.append(" Activity Reference Time: "+middleData.sample_acquisiton_start+"\n");
+ strBuffer.append(" Concentration Reference Time: "+middleData.sample_collection_start+"\n");
+ strBuffer.append(" \n");
+ strBuffer.append(" \n");
+ strBuffer.append(" \n");
+ strBuffer.append(" Nuclide Halflife(s) Activity(Bq) RelErr% MDA(Bq) Conc(uBq/m^3) MDC\n");
+ for (int i=0; i0) {
+ strBuffer.append("#Calibration\n");
+ strBuffer.append(" Energy Calibration ["+middleData.calibration_pairs_E_Input+" ]\n");
+ strBuffer.append(" Function: "+middleData.calibration_E_functionTypeDef+"\n");
+ strBuffer.append(" E: "+middleData.calibration_E_functionDef+"\n");
+ strBuffer.append(" P: "+middleData.calibration_E_coeff_string+"\n");
+ strBuffer.append(" Err: "+middleData.calibration_E_uncoeff_string+"\n");
+ strBuffer.append(" Data: "+middleData.calibration_pairs_E_Input+"\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ }
+ if(middleData.calibration_pairs_R_idCalPoint.size()>0) {
+ strBuffer.append(" Resolution Calibration ["+middleData.calibration_pairs_R_Input+" ]\n");
+ strBuffer.append(" Function: "+middleData.calibration_R_functionTypeDef+"\n");
+ strBuffer.append(" E: "+middleData.calibration_R_functionDef+"\n");
+ strBuffer.append(" P: "+middleData.calibration_R_coeff_string+"\n");
+ strBuffer.append(" Err: "+middleData.calibration_R_uncoeff_string+"\n");
+ strBuffer.append(" Data: "+middleData.calibration_pairs_R_Input+"\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ }
+ if(middleData.calibration_pairs_EF_idCalPoint.size()>0) {
+ strBuffer.append(" Efficiency Calibration ["+middleData.calibration_pairs_EF_Input+" ]\n");
+ strBuffer.append(" Function: "+middleData.calibration_EF_functionTypeDef+"\n");
+ strBuffer.append(" E: "+middleData.calibration_EF_functionDef+"\n");
+ strBuffer.append(" P: "+middleData.calibration_EF_coeff_string+"\n");
+ strBuffer.append(" Err: "+middleData.calibration_EF_uncoeff_string+"\n");
+ strBuffer.append(" Data: "+middleData.calibration_pairs_EF_Input+"\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ }
+ if(middleData.calibration_pairs_T_idCalPoint.size()>0) {
+ strBuffer.append(" Tot_efficiency Calibration ["+middleData.calibration_pairs_T_Input+" ]\n");
+ strBuffer.append(" Function: "+middleData.calibration_T_functionTypeDef+"\n");
+ strBuffer.append(" E: "+middleData.calibration_T_functionDef+"\n");
+ strBuffer.append(" P: "+middleData.calibration_T_coeff_string+"\n");
+ strBuffer.append(" Err: "+middleData.calibration_T_uncoeff_string+"\n");
+ strBuffer.append(" Data: "+middleData.calibration_pairs_T_Input+"\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ strBuffer.append("\n");
+ }
+ strBuffer.append("#DATA QUALITY FLAGS\n");
+ strBuffer.append(" Name Pass/Fail Value Test\n");
+ for (int i=0;i DoubleLimit(List data){
+ for(int pos=0;pos DoubleLimit_G(List _data) {
+ NumberFormat numberFormat = new DecimalFormat("0.##########E0");
+ List rdata = new LinkedList<>();
+ for(int pos=0;pos<_data.size();pos++) {
+ if(Objects.isNull(_data.get(pos))) {
+ rdata.add("NULL");
+ } else {
+ rdata.add(numberFormat.format(_data.get(pos)));
+ }
+ }
+ return rdata;
+ }
+
+ public String EquationDescription(int funcId) {
+ String desc = "";
+ switch (funcId)
+ {
+ case 1: desc = "y=yi+(y(i+1)-yi)*(x-xi)/(x(i+1)-xi) for xi<=x nucline,GStoreMiddleProcessData middleData) throws ParseException {
+ boolean bRet=true;
+ double totalNumber = 0.0;
+ for(int m=0;m temp = new LinkedList<>();
+ for(int pos=0;pos temp = new LinkedList<>();
+ for(int pos=0;pos temp = new LinkedList<>();
+ for(int pos=0;pos temp = new LinkedList<>();
+ for(int pos=0;pos0) {
+ funcType = fileAnlyse.getUsedEnerPara().getP().get(0).intValue();
+ }
+ for(int m=1;m0) {
+ coeffEnergy+=numberFormat.format(fileAnlyse.getUsedEnerPara().getP().get(coeffNumber-1));
+ }
+
+ uncerNumber = fileAnlyse.getUsedEnerPara().getPerr().size();
+ for(int m=0;m0) {
+ uncerEnergy+=numberFormat.format(fileAnlyse.getUsedEnerPara().getPerr().get(uncerNumber-1));
+ }
+ funcDefEnergy = EquationDescription(funcType);
+ funcTypeDefEnergy = EquationName(funcType);
+ middleData.calibration_E_Caltype = "energy";
+ middleData.calibration_E_function = funcType;
+ middleData.calibration_E_functionDef = funcDefEnergy;
+ middleData.calibration_E_functionTypeDef = funcTypeDefEnergy;
+ middleData.calibration_E_startOfRange = 0;
+ middleData.calibration_E_endOfRange = 1;
+ middleData.calibration_E_coeff_string = coeffEnergy;
+
+
+ String coeffEffi = "";
+ String uncerEffi = "";
+ String funcDefEffi = "";
+ String funcTypeDefEffi = "";
+ coeffNumber = fileAnlyse.getUsedEffiPara().getP().size();
+ if(coeffNumber>0) {
+ funcType = fileAnlyse.getUsedEffiPara().getP().get(0).intValue();
+ }
+ for(int m=1;m0) {
+ coeffEffi+=numberFormat.format(fileAnlyse.getUsedEffiPara().getP().get(coeffNumber-1));
+ }
+
+ uncerNumber = fileAnlyse.getUsedEffiPara().getPerr().size();
+ for(int m=0;m0) {
+ uncerEffi+= numberFormat.format(fileAnlyse.getUsedEffiPara().getPerr().get(uncerNumber-1));
+ }
+ funcDefEffi = EquationDescription(funcType);
+ funcTypeDefEffi = EquationName(funcType);
+ middleData.calibration_EF_Caltype = "efficiency";
+ middleData.calibration_EF_function = funcType;
+ middleData.calibration_EF_functionDef = funcDefEffi;
+ middleData.calibration_EF_functionTypeDef = funcTypeDefEffi;
+ middleData.calibration_EF_startOfRange = 0;
+ middleData.calibration_EF_endOfRange = 1;
+ middleData.calibration_EF_coeff_string = coeffEffi;
+
+ String coeffReso = "";
+ String uncerReso = "";
+ String funcDefReso = "";
+ String funcTypeDefReso = "";
+ coeffNumber = fileAnlyse.getUsedResoPara().getP().size();
+ if(coeffNumber>0) {
+ funcType = fileAnlyse.getUsedResoPara().getP().get(0).intValue();
+ }
+ for(int m=1;m0) {
+ coeffReso+= numberFormat.format(fileAnlyse.getUsedResoPara().getP().get(coeffNumber-1));
+ }
+
+ uncerNumber = fileAnlyse.getUsedResoPara().getPerr().size();
+ for(int m=0;m0) {
+ uncerReso+= numberFormat.format(fileAnlyse.getUsedResoPara().getPerr().get(uncerNumber-1));
+ }
+ funcDefReso = EquationDescription(funcType);
+ funcTypeDefReso = EquationName(funcType);
+ middleData.calibration_R_Caltype = "Resolution";
+ middleData.calibration_R_function = funcType;
+ middleData.calibration_R_functionDef = funcDefReso;
+ middleData.calibration_R_functionTypeDef = funcTypeDefReso;
+ middleData.calibration_R_startOfRange = 0;
+ middleData.calibration_R_endOfRange = 1;
+ middleData.calibration_R_coeff_string = coeffReso;
+
+ String coeffTotE = "";
+ String uncerTotE = "";
+ String funcDefTotE = "";
+ String funcTypeDefTotE = "";
+ coeffNumber = fileAnlyse.getUsedTotEPara().getP().size();
+ if(coeffNumber>0) {
+ funcType = fileAnlyse.getUsedTotEPara().getP().get(0).intValue();
+ }
+ for(int m=1;m0) {
+ coeffTotE+= numberFormat.format(fileAnlyse.getUsedTotEPara().getP().get(coeffNumber-1));
+ }
+
+ uncerNumber = fileAnlyse.getUsedTotEPara().getPerr().size();
+ for(int m=0;m0) {
+ uncerTotE+= numberFormat.format(fileAnlyse.getUsedTotEPara().getPerr().get(uncerNumber-1));
+ }
+ funcDefTotE = EquationDescription(funcType);
+ funcTypeDefTotE = EquationName(funcType);
+ middleData.calibration_T_Caltype = "TotalEfficiency";
+ middleData.calibration_T_function = funcType;
+ middleData.calibration_T_functionDef = funcDefTotE;
+ middleData.calibration_T_functionTypeDef = funcTypeDefTotE;
+ middleData.calibration_T_startOfRange = 0;
+ middleData.calibration_T_endOfRange = 1;
+ middleData.calibration_T_coeff_string = coeffTotE;
+
+ //gards_ peaks数据表
+
+ if(fileAnlyse.getVPeak().size() != 0) {
+ List dvctIDPEAK = new LinkedList<>();
+ List dvctCENTROIDCHANNEL = new LinkedList<>();
+ List dvctUNCCENTROIDCHANNEL = new LinkedList<>();
+ List dvctENERGY = new LinkedList<>();
+ List dvctUNCENERGY = new LinkedList<>();
+ List dvctAREA = new LinkedList<>();
+ List dvctnetCountRate = new LinkedList<>();
+ List dvctuncNetCountRate = new LinkedList<>();
+ List dvctUNCAREA = new LinkedList<>();
+ List dvctEFFICIENCY = new LinkedList<>();
+ List dvctUNCEFFICIENCY = new LinkedList<>();
+ List dvctFWHM = new LinkedList<>();
+ List dvctFWTM = new LinkedList<>();
+ List dvctSIGNIFICANCE = new LinkedList<>();
+ List dvctSENSITIVITY = new LinkedList<>();
+ List dvctMULTIINDEX = new LinkedList<>();
+ List dvctROISTART = new LinkedList<>();
+ List dvctROIEND = new LinkedList<>();
+ List dvctTAIL = new LinkedList<>();
+ List dvctTAILALPHA = new LinkedList<>();
+ List dvctUPPERTAIL = new LinkedList<>();
+ List dvctUPPERTAILALPHA = new LinkedList<>();
+ List dvctBWWIDTHCHAN = new LinkedList<>();
+ List dvctRECOILBETACHAN = new LinkedList<>();
+ List dvctRECOILDELTACHAN = new LinkedList<>();
+ List dvctSTEPRAIO = new LinkedList<>();
+ List dvctBACKGROUNDAREA = new LinkedList<>();
+ List dvctMEANBACKCOUNT = new LinkedList<>();
+ List dvctLC = new LinkedList<>();
+ List dvctLD = new LinkedList<>();
+ List dvctNuclide_name = new LinkedList<>();
+ List dvctComments = new LinkedList<>();
+ for(int m=0;m 1024){
+ t_comment = t_comment.substring(0, 1025);
+ }
+ dvctComments.add(t_comment);
+
+ String qsName = "";
+ for(int n=0;n svctNUCLIDEFULLNAME = new LinkedList<>();
+ List dvctIDPEAK = new LinkedList<>();
+ List dvctENERGY = new LinkedList<>();
+ List dvctUNCENERGY = new LinkedList<>();
+ List dvctABUNDANCE = new LinkedList<>();
+ List dvctUNCABUNDANCE = new LinkedList<>();
+ List dvctACTIVITY = new LinkedList<>();
+ List dvctUNCACTIVITY = new LinkedList<>();
+ List dvctEFFIC = new LinkedList<>();
+ List dvctUNEFFIC = new LinkedList<>();
+ List dvctMDA = new LinkedList<>();
+ List dvctKEY_FLAG = new LinkedList<>();
+ List dvctCSC_RATIO = new LinkedList<>();
+ List dvctCSC_RATIO_ERR = new LinkedList<>();
+ List dvctCSC_MOD_FLAG = new LinkedList<>();
+ List dvctMDC = new LinkedList<>();
+ List dvctCONCENTRATION = new LinkedList<>();
+ for(Map.Entry itor:fileAnlyse.getMapNucActMda().entrySet()) {
+ int first=itor.getValue().getFullNames().size();
+ int second=itor.getValue().getVPeakIdx().size();
+ first = first svctNUCLIDEFULLNAME1 = new LinkedList<>();
+ List svctTYPE = new LinkedList<>();
+ List dvctHALFLIFE = new LinkedList<>();
+ List dvctAVE_ACTIV = new LinkedList<>();
+ List dvctAVE_ACTIV_ERR = new LinkedList<>();
+ List dvctACTIV_KEY = new LinkedList<>();
+ List dvctACTIV_KEY_ERR = new LinkedList<>();
+ List dvctMDA1 = new LinkedList<>();
+ List dvctMDA_ERR = new LinkedList<>();
+ List dvctNID_FLAG = new LinkedList<>();
+ List dvctCSC_RATIO1 = new LinkedList<>();
+ List dvctCSC_RATIO_ERR1 = new LinkedList<>();
+ List dvctCSC_MOD_FLAG1 = new LinkedList<>();
+ List dvctMDC1 = new LinkedList<>();
+ List dvctCONCENTRATION1 = new LinkedList<>();
+ List dvctKey_Energy = new LinkedList<>();
+ List dvctKey_Yield = new LinkedList<>();
+
+ if( fileAnlyse.getMapNucActMda().size() != 0) {
+ for(Map.Entry itor_v: fileAnlyse.getMapNucActMda().entrySet()) {
+ String nuclideName = itor_v.getKey();
+ svctNUCLIDEFULLNAME1.add(nuclideName);
+ dvctHALFLIFE.add(itor_v.getValue().getHalflife());
+ dvctACTIV_KEY.add(itor_v.getValue().getActivity());
+ dvctACTIV_KEY_ERR.add(itor_v.getValue().getAct_err());
+ dvctMDA1.add(numberFormat.format(itor_v.getValue().getMda()));
+ dvctMDC1.add(numberFormat.format(itor_v.getValue().getMdc()));
+ dvctCONCENTRATION1.add(numberFormat.format(itor_v.getValue().getConcentration()));
+ dvctCSC_RATIO1.add(1.0);
+ dvctCSC_RATIO_ERR1.add(0.0);
+ if(itor_v.getValue().getCalculateIdx() >= 0 && itor_v.getValue().getCalculateIdx()= 0 && itor_v.getValue().getCalculateIdx() qvctQC_NAME = new LinkedList<>();
+ List dvctQC_VALUE = new LinkedList<>();
+ List qvctQC_STANDARD = new LinkedList<>();
+ List dvctQC_RESULT = new LinkedList<>();
+ if( fileAnlyse.getQcItems().size() != 0) {
+ for(Map.Entry itor_q:fileAnlyse.getQcItems().entrySet()) {
+ String nuclideName = itor_q.getKey();
+ qvctQC_NAME.add(nuclideName);
+ dvctQC_VALUE.add(itor_q.getValue().getValue());
+ qvctQC_STANDARD.add(itor_q.getValue().getStandard());
+ dvctQC_RESULT.add(itor_q.getValue().isBPass()?1.0:0.0);
+ }
+ middleData.QC_CHECK_QC_NAME=qvctQC_NAME;
+ middleData.QC_CHECK_QC_RESULT=DoubleLimit_G(dvctQC_RESULT);
+ middleData.QC_CHECK_QC_STANDARD=qvctQC_STANDARD;
+ middleData.QC_CHECK_QC_VALUE=DoubleLimit_G(dvctQC_VALUE);
+ }
+
+ //sample info
+ middleData.sample_collection_start = fileAnlyse.getCollect().getCollection_start_date()+" "+fileAnlyse.getCollect().getCollection_start_time();
+ middleData.sample_collection_stop = fileAnlyse.getCollect().getCollection_stop_date()+" "+fileAnlyse.getCollect().getCollection_stop_time();
+
+ if(Objects.nonNull(fileAnlyse.getQcItems().get("col_time"))) {
+ middleData.sample_time = String.format("%.4f", fileAnlyse.getQcItems().get("col_time").getValue());
+ if(fileAnlyse.getQcItems().get("col_time").getValue()!=0) {
+ middleData.sample_Avg_Flow_Rate = String.format("%.5f", fileAnlyse.getCollect().getAir_volume()/fileAnlyse.getQcItems().get("col_time").getValue());
+ }
+ }
+ if(Objects.nonNull(fileAnlyse.getQcItems().get("decay_time"))) {
+ middleData.sample_decay_time = String.format("%.5f", fileAnlyse.getQcItems().get("decay_time").getValue());
+ }
+ if(Objects.nonNull(fileAnlyse.getQcItems().get("acq_time"))) {
+ middleData.sample_acquistion_time = String.format("%.5f", fileAnlyse.getQcItems().get("acq_time").getValue());
+ }
+ middleData.sample_quantity = String.format("%.4f", fileAnlyse.getCollect().getAir_volume());
+ middleData.sample_acquisiton_start = fileAnlyse.getAcq().getAcquisition_start_date()+" "+fileAnlyse.getAcq().getAcquisition_start_time();
+ String acquisition_start = middleData.sample_acquisiton_start;
+ Date dataTime = DateUtils.parseDate(acquisition_start.substring(0, acquisition_start.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss");
+ acquisition_start = DateUtils.formatDate(dataTime, "yyyy/MM/dd HH:mm:ss");
+ middleData.sample_acquistion_stop = DateUtils.formatDate(new Date((long) (dataTime.getTime()/1000 + fileAnlyse.getAcq().getAcquisition_live_time())), "yyyy/MM/dd HH:mm:ss");
+ middleData.sample_acquistion_time = String.format("%.2f", fileAnlyse.getAcq().getAcquisition_real_time()) ;
+ middleData.sample_stationID = fileAnlyse.getHeader().getSite_code();
+ middleData.sample_detectID = fileAnlyse.getHeader().getDetector_code();
+ middleData.sample_Geometry = fileAnlyse.getHeader().getSample_geometry();
+ middleData.sample_Type = fileAnlyse.getHeader().getSystem_type();
+ middleData.setting_specSetup = fileAnlyse.getUsedSetting();
+
+ middleData.Collection_Station_Comments = fileAnlyse.getOriTotalCmt();
+ middleData.NDC_Analysis_General_Comments = fileAnlyse.getTotalCmt();
+ return bRet;
+ }
+
+ public Map UpdateDatasNuclideActivity(Map mapNucAct, Date act_ref, Date con_ref) {
+ Map map = new HashMap<>();
+ map.put("dateTime_act_ref", act_ref);
+ map.put("dateTime_con_ref", con_ref);
+
+ //m_mapAct = mapNucAct;
+ int size_map = mapNucAct.size();
+ if(size_map < 1){
+ return map;
+ }
+ List nuclideActivityList = new LinkedList<>();
+ for(Map.Entry iter:mapNucAct.entrySet()){
+ TableNuclideActivity tableNuclideActivity = new TableNuclideActivity();
+ NuclideActMda nuc = iter.getValue();
+ tableNuclideActivity.setNuclide(iter.getKey());
+ char units = 'S';
+ double halflife = nuc.getHalflife();
+ if(halflife >= 31556736) // 1年 = 365.24 * 24 * 60 * 60 = 31556736s
+ {
+ halflife /= 31556736;
+ units = 'A';
+ }
+ else if(halflife >= 86400) // 1天 = 24 * 60 * 60 = 86400s
+ {
+ halflife /= 86400;
+ units = 'D';
+ }
+ else if(halflife >= 3600)
+ {
+ halflife /= 3600;
+ units = 'H';
+ }
+ tableNuclideActivity.setHalfLife(halflife+" "+units);
+ tableNuclideActivity.setEnergy(nuc.getVEnergy().get(nuc.getCalculateIdx()).toString());
+ tableNuclideActivity.setYield(String.valueOf(nuc.getVYield().get(nuc.getCalculateIdx())*100));
+
+ String str_effi = (nuc.getEfficiency() <= 0 ? "null" : String.valueOf(nuc.getEfficiency()));
+ tableNuclideActivity.setEfficiency(str_effi);
+
+ String str_act = (nuc.getActivity() <= 0 ? "null" : String.valueOf(nuc.getActivity()));
+ tableNuclideActivity.setActivity(str_act);
+
+ String str_act_err = (nuc.getActivity() <= 0 ? "null" : String.valueOf(nuc.getAct_err() / nuc.getActivity() * 100));
+ tableNuclideActivity.setActErr(str_act_err);
+
+ String str_mda = (nuc.getMda() <= 0 ? "null" : String.valueOf(nuc.getMda()));
+ tableNuclideActivity.setMda(str_mda);
+
+ String str_con = (nuc.getConcentration() <= 0 ? "null" : String.valueOf(nuc.getConcentration()));
+ tableNuclideActivity.setConc(str_con);
+
+ String str_mdc = (nuc.getMdc() <= 0 ? "null" : String.valueOf(nuc.getMdc()));
+ tableNuclideActivity.setMdc(str_mdc);
+ nuclideActivityList.add(tableNuclideActivity);
+ }
+ map.put("table", nuclideActivityList);
+ return map;
+ }
+
+ public String RightFill(String str, int fieldWidth) {
+ String fillChar = " ";
+ int fillNum = fieldWidth - str.length();
+ while(fillNum > 0) {
+ str+=fillChar;
+ --fillNum;
+ }
+ return str;
+ }
+
+ public String MakeUpSpectrum(PHDFile phd) {
+ StringBuffer spectrum = new StringBuffer();
+
+ spectrum.append("BEGIN IMS2.0\r\n");
+ spectrum.append("MSG_TYPE "+phd.getMsgInfo().getMsg_type()+"\r\n");
+ spectrum.append("MSG_ID "+phd.getMsgInfo().getMsg_id()+" "+phd.getMsgInfo().getMsg_src_code()+"\r\n");
+ if(phd.getMsgInfo().isVerify_srid()) {
+ spectrum.append("REF_ID\r\n");
+ spectrum.append(phd.getMsgInfo().getRef_id_str()+" "+phd.getMsgInfo().getRef_src_code()+" "+phd.getMsgInfo().getSeq_num()+" "+phd.getMsgInfo().getTot_num()+"\r\n");
+ spectrum.append("PROD_ID "+phd.getMsgInfo().getProduct_id()+" "+phd.getMsgInfo().getDelivery_id()+"\r\n");
+ }
+ spectrum.append("DATA_TYPE "+phd.getMsgInfo().getData_type()+"\r\n");
+
+ List data_types = new LinkedList<>();
+ data_types.add("SAMPLEPHD");
+ data_types.add("SPHDF");
+ data_types.add("SPHDP");
+ data_types.add("GASBKPHD");
+ data_types.add("BLANKPHD");
+ data_types.add("DETBKPHD");
+ data_types.add("QCPHD");
+ data_types.add("CALIBPHD");
+
+ if(!data_types.contains(phd.getMsgInfo().getData_type())){
+ return spectrum.toString();
+ }
+
+ // #Header
+ spectrum.append("#Header "+phd.getHeader().getDesignator()+"\r\n");
+ spectrum.append(RightFill(phd.getHeader().getSite_code(), 5)+
+ " "+RightFill(phd.getHeader().getDetector_code(), 9)+
+ " "+RightFill(phd.getHeader().getSystem_type(), 1)+
+ " "+RightFill(phd.getHeader().getSample_geometry(), 17)+
+ " "+RightFill(phd.getHeader().getSpectrum_quantity(), 4)+"\r\n");
+ spectrum.append(phd.getHeader().getSample_ref_id() + "\r\n");
+ spectrum.append(RightFill(phd.getHeader().getMeasurement_id(), 31)+" "+RightFill(phd.getHeader().getDetector_bk_measurement_id(), 31)+" "+phd.getHeader().getGas_bk_measurement_id()+"\r\n");
+ spectrum.append(phd.getHeader().getTransmit_date()+" "+phd.getHeader().getTransmit_time()+"\r\n");
+
+ // #Comment
+ if(StringUtils.isNotBlank(phd.getOriTotalCmt())) {
+ String comment = phd.getOriTotalCmt().replace("\r\n", "\n");
+ comment.replace("\n", "\r\n");
+ spectrum.append("#Comment\r\n");
+ spectrum.append(comment + "\r\n");
+ }
+
+ // #Collection
+ spectrum.append("#Collection\r\n");
+ spectrum.append(phd.getCollect().getCollection_start_date()+" "+phd.getCollect().getCollection_start_time()+
+ " "+phd.getCollect().getCollection_stop_date()+" "+phd.getCollect().getCollection_stop_time()+" "+phd.getCollect().getAir_volume()+"\r\n");
+
+ // #Acquisition
+ spectrum.append("#Acquisition\r\n");
+ spectrum.append(phd.getAcq().getAcquisition_start_date()+" "+phd.getAcq().getAcquisition_start_time()+
+ " "+RightFill(String.format("%.2f", phd.getAcq().getAcquisition_real_time()), 14)+
+ " "+RightFill(String.format("%.2f", phd.getAcq().getAcquisition_live_time()), 14)+"\r\n");
+
+ // #Processing
+ if(phd.getProcess().getSample_volume_of_Xe() > 0) {
+ spectrum.append("#Processing\r\n");
+ spectrum.append(RightFill(String.valueOf(phd.getProcess().getSample_volume_of_Xe()), 8)+" "+RightFill(String.valueOf(phd.getProcess().getUncertainty_1()), 8)+"\r\n"+
+ " "+RightFill(String.valueOf(phd.getProcess().getXe_collection_yield()), 8)+" "+RightFill(String.valueOf(phd.getProcess().getUncertainty_2()), 8)+"\r\n"+
+ " "+phd.getProcess().getArchive_bottle_id()+"\r\n");
+ }
+
+ // #Sample
+ if(phd.getSampleBlock().getDimension_1() > 0) {
+ spectrum.append("#Sample\r\n");
+ spectrum.append(phd.getSampleBlock().getDimension_1()+" "+phd.getSampleBlock().getDimension_2()+"\r\n");
+ }
+
+ // Certificate
+ if(CollectionUtils.isNotEmpty(phd.getCertificate().getG_energy())) {
+ spectrum.append("#Certificate\r\n");
+ spectrum.append(phd.getCertificate().getTotal_source_activity()+""+ phd.getCertificate().getAssay_date()+""
+ + phd.getCertificate().getAssay_time()+""+phd.getCertificate().getUnits_activity() + "\r\n");
+
+ int fieldWidth = 12;
+ for(int i=0; i 0) {
+ spectrum.append("#TotalEff\r\n");
+ TotaleffBlock g_totE = phd.getUsedTotEKD();
+ for(int i=0; i input = gammaService.KorSumInput(coeffData);
+ result.setSuccess(true);
+ result.setResult(input);
+ return result;
+ }
+
+ @GetMapping("energyCalibration")
+ public Result energyCalibration(@RequestParam Integer sampleId){
+ return gammaService.energyCalibration(sampleId);
+ }
+
+ @GetMapping("resolutionCalibration")
+ public Result resolutionCalibration(@RequestParam Integer sampleId){
+ return gammaService.resolutionCalibration(sampleId);
+ }
+
+ @GetMapping("EfficiencyCalibration")
+ public Result EfficiencyCalibration(@RequestParam Integer sampleId){
+ return gammaService.EfficiencyCalibration(sampleId);
+ }
+
+ @GetMapping("NuclideLibrary")
+ public Result NuclideLibrary(String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request){
+ return gammaService.NuclideLibrary(editEnergy, err, libraryName, nuclideName, request);
+ }
+
+ @GetMapping("configUserLibrary")
+ public Result configUserLibrary(HttpServletRequest request){
+ return gammaService.configUserLibrary(request);
+ }
+
+ @GetMapping("viewComment")
+ public Result viewComment(@RequestParam Integer sampleId){
+ return gammaService.viewComment(sampleId);
+ }
+
+ @GetMapping("peakInformation")
+ public Result peakInformation(@RequestParam Integer sampleId){
+ return gammaService.peakInformation(sampleId);
+ }
+
+ @GetMapping("viewARR")
+ public Result viewARR(Integer sampleId, HttpServletResponse response){
+ return gammaService.viewARR(sampleId, response);
+ }
+
+ @GetMapping("viewRRR")
+ public Result viewRRR(Integer sampleId){
+ return gammaService.viewRRR(sampleId);
+ }
+
+ @GetMapping("radionuclideActivity")
+ public Result radionuclideActivity(Integer sampleId){
+ return gammaService.radionuclideActivity(sampleId);
+ }
+
+ @GetMapping("Spectrum")
+ public Result Spectrum(Integer sampleId){
+ return gammaService.Spectrum(sampleId);
+ }
+
+ @GetMapping("sampleInformation")
+ public Result sampleInformation(Integer sampleId){
+ return gammaService.sampleInformation(sampleId);
+ }
+
+ @GetMapping("viewQCResult")
+ public Result viewQCResult(Integer sampleId){
+ return gammaService.viewQCResult(sampleId);
+ }
+
+ @GetMapping("viewRLR")
+ public Result viewRLR(Integer sampleId){
+ return gammaService.viewRLR(sampleId);
+ }
+
+ @GetMapping("viewAutomaticAnalysisLog")
+ public Result viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response){
+ return gammaService.viewAutomaticAnalysisLog(sampleId, response);
+ }
+
+ @GetMapping("viewGammaviewerLog")
+ public Result viewGammaviewerLog(Integer sampleId){
+ return gammaService.viewGammaviewerLog(sampleId);
+ }
}
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/GardsNuclLinesIdedSpectrum.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/GardsNuclLinesIdedSpectrum.java
index 78081493..7ff5d653 100644
--- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/GardsNuclLinesIdedSpectrum.java
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/GardsNuclLinesIdedSpectrum.java
@@ -73,7 +73,7 @@ public class GardsNuclLinesIdedSpectrum implements Serializable {
/**
* 该峰处的探测效率不确定度
*/
- private Double uncEffic;
+ private Double unEffic;
/**
* 利用该峰计算得到的最小可探测活度
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/CoeffData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/CoeffData.java
new file mode 100644
index 00000000..b7adab90
--- /dev/null
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/CoeffData.java
@@ -0,0 +1,37 @@
+package org.jeecg.modules.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class CoeffData implements Serializable {
+
+ public Double totalEf1;
+
+ public Double totalEf2;
+
+ public Double totalEf3;
+
+ public Double totalEf4;
+
+ public Double totalEf5;
+
+ public Double totalEf6;
+
+ public Double Effciency1;
+
+ public Double Effciency2;
+
+ public Double Effciency3;
+
+ public Double Effciency4;
+
+ public Double Effciency5;
+
+ public Double Effciency6;
+
+ public List energys;
+
+}
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java
new file mode 100644
index 00000000..11b3253e
--- /dev/null
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java
@@ -0,0 +1,9 @@
+package org.jeecg.modules.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ConfigureData implements Serializable {
+}
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/EfficiencyData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/EfficiencyData.java
new file mode 100644
index 00000000..587e672f
--- /dev/null
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/EfficiencyData.java
@@ -0,0 +1,18 @@
+package org.jeecg.modules.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class EfficiencyData implements Serializable {
+
+ private String Energy;
+
+ private String Efficiency;
+
+ private String Fit;
+
+ private String Delta;
+
+}
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/EnergyData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/EnergyData.java
new file mode 100644
index 00000000..47704580
--- /dev/null
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/EnergyData.java
@@ -0,0 +1,18 @@
+package org.jeecg.modules.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class EnergyData implements Serializable {
+
+ public String channel;
+
+ public String Energy;
+
+ public String Fit;
+
+ public String Delta;
+
+}
diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/GStoreMiddleProcessData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/GStoreMiddleProcessData.java
new file mode 100644
index 00000000..ee5980d9
--- /dev/null
+++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/GStoreMiddleProcessData.java
@@ -0,0 +1,423 @@
+package org.jeecg.modules.entity.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class GStoreMiddleProcessData implements Serializable {
+
+ public boolean dbWriteFlag; //数据库存储标示 例如
+ public String dbWriteStatusFlag; //数据写入状态标示 例如 P U F 等
+ public String ErrorInfo; //错误信息
+ //gards_analyses数据表数据
+ public String IdAnalysis; //分析ID号
+ public String sample_id; //样品ID号
+ public String analyses_analysisBegin; //分析开始时
+ public String analyses_analysisEnd; //分析的结束时间
+ public String analyses_type; //Reviewed:交互 Auto:自动
+ public String analyses_software; //使用的软件
+ public String analyses_swVersion; //软件版本号
+ public String analyses_analyst; //分析员名称
+ public String analyses_baseline_filePath; //基线数据路径
+ public String analyses_lc_filePath; //lc数据基线路径
+ public String analyses_scac_filePath; //scac数据路径
+ public String analyses_save_filePath; //原始文件存储文件名
+ public String analyses_baselineMethod; //基线计数方
+ public String analyses_peaksMethod; //寻峰方法描
+ public String analyses_nuclideMethod; //核素识别方
+ public String analyses_uncCalcMethod; //不确定度计
+ public String analyses_lcMethod; //Lc计算方法
+ public String analyses_LogPath; //日志路径
+ public String analyses_ReportPath; //报告路径
+
+ public String analyses_baseline_absolute_filePath; //基线数据绝对路径
+ public String analyses_lc_absolute_filePath; //lc数据基线绝对路径
+ public String analyses_scac_absolute_filePath; //scac数据绝对路径
+ public String analyses_save_absolute_filePath; //原始文件存储绝对文件名
+ public String analyses_absolute_LogPath; //日志绝对路径
+ public String analyses_absolute_ReportPath; //报告绝对路径
+
+ public double analyses_searchStartChannel; //寻峰起始道
+ public double analyses_searchEndChannel; //寻峰结束道
+ public double analyses_searchThreshold; //寻峰阈值
+ public double analyses_numberOfPeaks; //峰数目
+ public double analyses_totalCounts; //总计数 未知
+ public double analyses_category; //分级结果
+ public String analyses_comments; //注释
+
+ //gards_ calibration_pairs数据表
+ public String calibration_pairs_sample_type; //G:gamma探测器的数据,#g_;B:beta探测器的数据,#b_
+
+ public String calibration_pairs_E_Caltype; //energy:能量刻度
+ public String calibration_pairs_E_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_E_idCalPoint; //刻度点ID号
+ public List calibration_pairs_E_xValue; //
+ public List calibration_pairs_E_yValue; //
+ public List calibration_pairs_E_uncYValue; //
+
+ public String calibration_pairs_EF_Caltype; //Efficiency:效率刻度;
+ public String calibration_pairs_EF_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_EF_idCalPoint; //刻度点ID号
+ public List calibration_pairs_EF_xValue; //
+ public List calibration_pairs_EF_yValue; //
+ public List calibration_pairs_EF_uncYValue; //
+
+ public String calibration_pairs_R_Caltype; //Resolution:分辨率刻度;
+ public String calibration_pairs_R_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_R_idCalPoint; //刻度点ID号
+ public List calibration_pairs_R_xValue; //
+ public List calibration_pairs_R_yValue; //
+ public List calibration_pairs_R_uncYValue; //
+
+ public String calibration_pairs_T_Caltype; //TotalEfficiency:总效率刻度;
+ public String calibration_pairs_T_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_T_idCalPoint; //刻度点ID号
+ public List calibration_pairs_T_xValue; //
+ public List calibration_pairs_T_yValue; //
+ public List calibration_pairs_T_uncYValue; //
+
+ //原始谱 数据
+ public String calibration_pairs_S_E_Caltype; //energy:能量刻度
+ public String calibration_pairs_S_E_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_S_E_idCalPoint; //刻度点ID号
+ public List calibration_pairs_S_E_xValue; //
+ public List calibration_pairs_S_E_yValue; //
+ public List calibration_pairs_S_E_uncYValue; //
+
+ public String calibration_pairs_S_EF_Caltype; //Efficiency:效率刻度;
+ public String calibration_pairs_S_EF_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_S_EF_idCalPoint; //刻度点ID号
+ public List calibration_pairs_S_EF_xValue; //
+ public List calibration_pairs_S_EF_yValue; //
+ public List calibration_pairs_S_EF_uncYValue; //
+
+ public String calibration_pairs_S_R_Caltype; //Resolution:分辨率刻度;
+ public String calibration_pairs_S_R_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_S_R_idCalPoint; //刻度点ID号
+ public List calibration_pairs_S_R_xValue; //
+ public List calibration_pairs_S_R_yValue; //
+ public List calibration_pairs_S_R_uncYValue; //
+
+ public String calibration_pairs_S_T_Caltype; //TotalEfficiency:总效率刻度;
+ public String calibration_pairs_S_T_Input; //PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等
+ public List calibration_pairs_S_T_idCalPoint; //刻度点ID号
+ public List calibration_pairs_S_T_xValue; //
+ public List calibration_pairs_S_T_yValue; //
+ public List calibration_pairs_S_T_uncYValue; //
+
+ //gards_ calibration 数据表
+ public String calibration_sample_type; //G:gamma探测器的数据,#g_;B:beta探测器的数据,#b_
+ public String calibration_E_Caltype; //energy:能量刻度
+ public double calibration_E_function; //拟合方程ID号(统一定义)
+ public String calibration_E_functionTypeDef; //函数类型描述
+ public String calibration_E_functionDef; //拟合方程描述
+ public double calibration_E_startOfRange; //拟合的起始值
+ public double calibration_E_endOfRange; //拟合的结束值
+ public String calibration_E_coeff_string; //拟合系数
+ public String calibration_E_uncoeff_string; //拟合系数1不确定度
+
+ public String calibration_EF_Caltype; //Efficiency:效率刻度;
+ public double calibration_EF_function; //拟合方程ID号(统一定义)
+ public String calibration_EF_functionTypeDef; //函数类型描述
+ public String calibration_EF_functionDef; //拟合方程描述
+ public double calibration_EF_startOfRange; //拟合的起始值
+ public double calibration_EF_endOfRange; //拟合的结束值
+ public String calibration_EF_coeff_string; //拟合系数
+ public String calibration_EF_uncoeff_string; //拟合系数1不确定度
+
+ public String calibration_R_Caltype; //Resolution:分辨率刻度;
+ public double calibration_R_function; //拟合方程ID号(统一定义)
+ public String calibration_R_functionTypeDef; //函数类型描述
+ public String calibration_R_functionDef; //拟合方程描述
+ public double calibration_R_startOfRange; //拟合的起始值
+ public double calibration_R_endOfRange; //拟合的结束值
+ public String calibration_R_coeff_string; //拟合系数
+ public String calibration_R_uncoeff_string; //拟合系数1不确定度
+
+ public String calibration_T_Caltype; //TotalEfficiency:总效率刻度;
+ public double calibration_T_function; //拟合方程ID号(统一定义)
+ public String calibration_T_functionTypeDef; //函数类型描述
+ public String calibration_T_functionDef; //拟合方程描述
+ public double calibration_T_startOfRange; //拟合的起始值
+ public double calibration_T_endOfRange; //拟合的结束值
+ public String calibration_T_coeff_string; //拟合系数
+ public String calibration_T_uncoeff_string; //拟合系数1不确定度
+
+ //gards_ peaks数据表
+ public List peaks_idPeak; //峰序号
+ public List peaks_peakCentroid; //峰中心道(道址)
+ public List peaks_uncpeakCentroid; //峰中心道不确定度(道址)
+ public List peaks_Energy; //峰中心道能量(keV)
+ public List peaks_uncEnergy; //峰中心道能量不确定度(keV)
+ public List peaks_Area; //峰面积(计数)。已扣除基线面积,但未扣除空白样品计数和探测器本底计数
+ public List peaks_areaErr; //峰面积不确定度(以计数为单位)
+ public List peaks_netCountRate; //峰的净计数率(1/s)=峰面积/活时间 未知
+ public List peaks_uncNetCountRate; //峰的净计数率的不确定度(1/s) 未知
+ public List peaks_Efficiency; //测量系统在峰能量处的绝对效率
+ public List peaks_Uncefficiency; //测量系统在峰能量处的绝对效率的不确定度
+ public List peaks_Fwhm; //峰的半高宽(keV)
+ public List peaks_Fwhmc; //峰的半高宽(Channel)
+ public List peaks_Significance; //峰的灵敏度
+ public List peaks_Sensitivity; //重峰序号
+ public List peaks_multiIndex; //峰的感兴趣区的起始道left
+ public List peaks_ROIstart; //峰的感兴趣区的结束道right
+ public List peaks_ROIend; //峰序号
+ public List peaks_tail; //
+ public List peaks_tailAlpha; //
+ public List peaks_upperTail; //
+ public List peaks_upperTailAlpha; //
+ public List peaks_BWWidthChan; //
+ public List peaks_recoilBetaChan;
+ public List peaks_recoilDeltaChan; //
+ public List peaks_stepRatio; //
+ public List peaks_backgroundArea; //在峰区域下的基线面积(计数)
+ public List peaks_meanBackCount; //基线面积/道数(计数)
+ public List peaks_Lc; //峰的可探测线Lc
+ public List peaks_Ld; //峰的可探测线Ld
+ public List peaks_Nuclide_name; //文件名称
+ public List peaks_comments;
+ // gards_ nucl_lines_ided数据表
+ private Map nucl_lines_ided_data;
+ //gards_ nucl_ided数据表
+ public List nucl_ided_Nuclidename; // 核素名称
+ public List nucl_ided_Type; //核素类型 未知
+ public List nucl_ided_Halflife; //核素半衰期
+ public List nucl_ided_ave_activ; //平均活度值NULL
+ public List nucl_ided_ave_activ_err; //平均活度值不确定度NULL
+ public List nucl_ided_activ_key; //主射线活度值 未知
+ public List