diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java new file mode 100644 index 00000000..5f739322 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; + +@Data +public class Calibration { + + private String beta; + + private String gamma; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java new file mode 100644 index 00000000..4eff1545 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java @@ -0,0 +1,66 @@ +package org.jeecg.modules.base.dto; + +import cn.hutool.core.util.ObjectUtil; +import lombok.Data; +import org.jeecg.common.util.NumUtil; + +@Data +public class ROIResultsStrDto { + + /** + * 感兴趣区ID号 + */ + private Integer roi; + + + /** + * 样品谱感兴趣区总计数 + */ + private Double sGross; + + /** + * 气体本底谱感兴趣区总计数 + */ + private Double gGross; + + /** + * 探测器本底谱感兴趣区总计数 + */ + private Double bGross; + + /** + * 感兴趣区净计数 + */ + private Double net; + + /** + * 感兴趣区净计数不确定度 + */ + private Double netErr; + + /** + * 感兴趣区活度浓度 + */ + private Double conc; + + /** + * 感兴趣区活度浓度不确定度 + */ + private Double concErr; + + /** + * 感兴趣区LC + */ + private String lc; + + private String lcCts = ""; + + /** + * 感兴趣区MDC + */ + private String mdc; + + private String netCount; + + private String concStr; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java new file mode 100644 index 00000000..754f8261 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; +import org.jeecg.common.util.NumUtil; + +@Data +public class XeResultsStrDto { + /** + * 核素名称 + */ + private String nuclideName; + /** + * 感兴趣区活度浓度 + */ + private Double conc; + + /** + * 感兴趣区活度浓度不确定度 + */ + private Double concErr; + /** + * 感兴趣区MDC + */ + private String mdc; + /** + * 感兴趣区LC + */ + private String lc; + /** + * 感兴趣区识别标示;1:识别到,0,未识别到 + */ + private Integer nidFlag; + + private String concStr; +} diff --git a/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls b/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls index 22c3e556..80e4219c 100644 Binary files a/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls and b/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls differ diff --git a/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveHtml.html b/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveHtml.html index f0047357..a0e201a4 100644 --- a/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveHtml.html +++ b/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveHtml.html @@ -42,11 +42,11 @@ Collection Start: - + Collection Stop: - + Collection TIME(h): @@ -68,7 +68,7 @@ Acquisition Start: - + Acq Real Time(s): @@ -98,13 +98,9 @@ Old Beta Old Gamma - - CH(x) = (?1)+(?2)*x+(?3)x*x - CH(x) = (?1)+(?2)*x+(?3)x*x - - - E(x) = (?1)+(?2)*x+(?3)x*x - E(x) = (?1)+(?2)*x+(?3)x*x + + +   @@ -116,13 +112,9 @@ New Beta New Gamma - - CH(x) = ([[${betaCalibrationSEC.coeff1}]])+([[${betaCalibrationSEC.coeff2}]])*x+([[${betaCalibrationSEC.coeff3}]])x*x - CH(x) = ([[${gammaCalibrationSEC.coeff1}]])+([[${gammaCalibrationSEC.coeff2}]])*x+([[${gammaCalibrationSEC.coeff3}]])x*x - - - E(x) = ([[${betaCalibrationSCE.coeff1}]])+([[${betaCalibrationSCE.coeff2}]])*x+([[${betaCalibrationSCE.coeff3}]])x*x - E(x) = ([[${gammaCalibrationSCE.coeff1}]])+([[${gammaCalibrationSCE.coeff2}]])*x+([[${gammaCalibrationSCE.coeff3}]])x*x + + +   @@ -150,13 +142,9 @@ Old Beta Old Gamma - - CH(x) = (?1)+(?2)*x+(?3)x*x - CH(x) = (?1)+(?2)*x+(?3)x*x - - - E(x) = (?1)+(?2)*x+(?3)x*x - E(x) = (?1)+(?2)*x+(?3)x*x + + +   @@ -168,13 +156,9 @@ New Beta New Gamma - - CH(x) = ([[${betaCalibrationDEC.coeff1}]])+([[${betaCalibrationDEC.coeff2}]])*x+([[${betaCalibrationDEC.coeff3}]])x*x - CH(x) = ([[${gammaCalibrationDEC.coeff1}]])+([[${gammaCalibrationDEC.coeff2}]])*x+([[${gammaCalibrationDEC.coeff3}]])x*x - - - E(x) = ([[${betaCalibrationDCE.coeff1}]])+([[${betaCalibrationDCE.coeff2}]])*x+([[${betaCalibrationDCE.coeff3}]])x*x - E(x) = ([[${gammaCalibrationDCE.coeff1}]])+([[${gammaCalibrationDCE.coeff2}]])*x+([[${gammaCalibrationDCE.coeff3}]])x*x + + +   @@ -203,13 +187,9 @@ Old Beta Old Gamma - - CH(x) = (?1)+(?2)*x+(?3)x*x - CH(x) = (?1)+(?2)*x+(?3)x*x - - - E(x) = (?1)+(?2)*x+(?3)x*x - E(x) = (?1)+(?2)*x+(?3)x*x + + +   @@ -221,13 +201,9 @@ New Beta New Gamma - - CH(x) = ([[${betaCalibrationGEC.coeff1}]])+([[${betaCalibrationGEC.coeff2}]])*x+([[${betaCalibrationGEC.coeff3}]])x*x - CH(x) = ([[${gammaCalibrationGEC.coeff1}]])+([[${gammaCalibrationGEC.coeff2}]])*x+([[${gammaCalibrationGEC.coeff3}]])x*x - - - E(x) = ([[${betaCalibrationGCE.coeff1}]])+([[${betaCalibrationGCE.coeff2}]])*x+([[${betaCalibrationGCE.coeff3}]])x*x - E(x) = ([[${gammaCalibrationGCE.coeff1}]])+([[${gammaCalibrationGCE.coeff2}]])*x+([[${gammaCalibrationGCE.coeff3}]])x*x + + +   @@ -276,6 +252,7 @@ +   diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java index 30d48380..312732e4 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java @@ -227,14 +227,14 @@ public class SpectrumAnalysesController { @PostMapping("saveToHTML") public void saveToHTML(HttpServletRequest request, HttpServletResponse response, - @RequestBody BgDataAnlyseResultIn anlyseResultIn){ - spectrumAnalysisService.saveToHTML(anlyseResultIn, request, response); + @RequestBody RRRLogInfo rrrLogInfo){ + spectrumAnalysisService.saveToHTML(rrrLogInfo, request, response); } @PostMapping("saveToExcel") public void saveToExcel(HttpServletRequest request, HttpServletResponse response, - @RequestBody BgDataAnlyseResultIn anlyseResultIn){ - spectrumAnalysisService.saveToExcel(anlyseResultIn, request, response); + @RequestBody RRRLogInfo rrrLogInfo){ + spectrumAnalysisService.saveToExcel(rrrLogInfo, request, response); } @PostMapping("saveToTxt") diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java index 32baead2..9a57ecc5 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java @@ -80,9 +80,9 @@ public interface ISpectrumAnalysisService { Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request); - void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response); + void saveToHTML(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response); - void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response); + void saveToExcel(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response); void saveToTxt(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java index 79d1d436..7325feff 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java @@ -3,7 +3,6 @@ package org.jeecg.modules.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.ListUtil; -import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; @@ -15,8 +14,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.cache.Cache; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.net.ftp.FTP; -import org.apache.commons.net.ftp.FTPClient; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; @@ -30,10 +27,7 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.*; import org.jeecg.modules.base.abstracts.AbstractLogOrReport; import org.jeecg.modules.base.bizVo.BetaRLR; -import org.jeecg.modules.base.dto.ESStructDto; -import org.jeecg.modules.base.dto.ROIChannelsDto; -import org.jeecg.modules.base.dto.ROIResultsDto; -import org.jeecg.modules.base.dto.XeResultsDto; +import org.jeecg.modules.base.dto.*; import org.jeecg.modules.base.entity.configuration.GardsDetectors; import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.base.entity.rnman.*; @@ -65,7 +59,6 @@ import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; -import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path; import static org.jeecg.modules.base.enums.ExportTemplate.*; @Service("spectrumAnalysisService") @@ -3690,17 +3683,434 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return analyze; } + private Map exportDataNew(RRRLogInfo rrrLogInfo){ + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + Map result = new HashMap<>(); + //获取本地缓存 + Cache cache = betaCache.getBetaCache(); + BetaDataFile betaDataFile = cache.getIfPresent(rrrLogInfo.getSampleFileName() + "-" + username); + if (Objects.isNull(betaDataFile)) { + return result; + } + GardsCalibrationSpectrum gammaCalibrationParamS = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamD = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamES = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamEG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamED = new GardsCalibrationSpectrum(); + + GardsCalibrationSpectrum betaCalibrationParamS = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamD = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamES = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamEG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamED = new GardsCalibrationSpectrum(); + + StringBuffer strBuffer = new StringBuffer(); + //判断 + if (betaDataFile.isSaveAnalysisResult()) { + //对分析后的内容进行数据获取 + List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); + List roiChannelsSpectrumsSample = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("S")).collect(Collectors.toList()); + List roiChannelsSpectrumsGas = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("G")).collect(Collectors.toList()); + List roiChannelsSpectrumsDet = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("D")).collect(Collectors.toList()); + List resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); + List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); + for (int i=0; i gammaCalibrationParamList = betaDataFile.getGammaCalibrationSpectrumList(); + List gammaCalibrationSpectrumEList = betaDataFile.getGammaCalibrationSpectrumEList(); + for (int i=0; i betaCalibrationParamList = betaDataFile.getBetaCalibrationSpectrumList(); + List betaCalibrationSpectrumEList = betaDataFile.getBetaCalibrationSpectrumEList(); + for (int i=0; i samplOldCalibrations = new ArrayList<>(); + Calibration samplOldCalibrationCH = new Calibration(); + Calibration samplOldCalibrationE = new Calibration(); + if (betaDataFile.isBBetaEnergyValidSample() || betaDataFile.isBGammaEnergyValidSample()){ + if (betaDataFile.isBBetaEnergyValidSample()) { + samplOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidSample()) { + samplOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBBetaEnergyValidSample()) { + samplOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidSample()) { + samplOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + } else { + samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + samplOldCalibrations.add(samplOldCalibrationCH); + samplOldCalibrations.add(samplOldCalibrationE); + result.put("samplOldCalibrations",samplOldCalibrations); + + // #SAMPLE New CALIBRATION + List samplNewCalibrations = new ArrayList<>(); + Calibration samplNewCalibrationCH = new Calibration(); + Calibration samplNewCalibrationE = new Calibration(); + samplNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3()))) + +")x*x"); + samplNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3()))) + +")x*x"); + samplNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3()))) + +")x*x"); + samplNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3()))) + +")x*x"); + samplNewCalibrations.add(samplNewCalibrationCH); + samplNewCalibrations.add(samplNewCalibrationE); + result.put("samplNewCalibrations",samplNewCalibrations); + + // #SAMPLE: LIMITS PER ROI + List roiChannelsDtosS = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsSample) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannels, roiChannelsDto); + roiChannelsDto.shift(); + roiChannelsDtosS.add(roiChannelsDto); + } + result.put("roiChannelsS",roiChannelsDtosS); + + /* + * DET + * */ + // #DET Old CALIBRATION + List detOldCalibrations = new ArrayList<>(); + Calibration detOldCalibrationCH = new Calibration(); + Calibration detOldCalibrationE = new Calibration(); + if (betaDataFile.isBBetaEnergyValidDet() || betaDataFile.isBGammaEnergyValidDet()){ + if (betaDataFile.isBBetaEnergyValidDet()) { + detOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidDet()) { + detOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBBetaEnergyValidDet()) { + detOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidDet()) { + detOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + } else { + detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + detOldCalibrations.add(detOldCalibrationCH); + detOldCalibrations.add(detOldCalibrationE); + result.put("detOldCalibrations", detOldCalibrations); + + // DET New CALIBRATION + List detNewCalibrations = new ArrayList<>(); + Calibration detNewCalibrationCH = new Calibration(); + Calibration detNewCalibrationE = new Calibration(); + detNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3()))) + +")x*x"); + detNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3()))) + +")x*x"); + detNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3()))) + +")x*x"); + detNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3()))) + +")x*x"); + detNewCalibrations.add(detNewCalibrationCH); + detNewCalibrations.add(detNewCalibrationE); + result.put("detNewCalibrations", detNewCalibrations); + + // DET: LIMITS PER ROI + List roiChannelsDtosD = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsDet) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannels, roiChannelsDto); + roiChannelsDto.shift(); + roiChannelsDtosD.add(roiChannelsDto); + } + result.put("roiChannelsD",roiChannelsDtosD); + + /* + * GAS + * */ + // #GAS Old CALIBRATION + List gasOldCalibrations = new ArrayList<>(); + Calibration gasOldCalibrationCH = new Calibration(); + Calibration gasOldCalibrationE = new Calibration(); + if (betaDataFile.isBBetaEnergyValidGas() || betaDataFile.isBGammaEnergyValidGas()){ + if (betaDataFile.isBBetaEnergyValidGas()) { + gasOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidGas()) { + gasOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBBetaEnergyValidGas()) { + gasOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidGas()) { + gasOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + } else { + gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + gasOldCalibrations.add(gasOldCalibrationCH); + gasOldCalibrations.add(gasOldCalibrationE); + result.put("gasOldCalibrations",gasOldCalibrations); + + // #GAS New CALIBRATION + List gasNewCalibrations = new ArrayList<>(); + Calibration gasNewCalibrationCH = new Calibration(); + Calibration gasNewCalibrationE = new Calibration(); + gasNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3()))) + +")x*x"); + gasNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3()))) + +")x*x"); + gasNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3()))) + +")x*x"); + gasNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3()))) + +")x*x"); + gasNewCalibrations.add(gasNewCalibrationCH); + gasNewCalibrations.add(gasNewCalibrationE); + result.put("gasNewCalibrations",gasNewCalibrations); + + // #GAS: LIMITS PER ROI + List roiChannelsDtosG = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsGas) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannels, roiChannelsDto); + roiChannelsDto.shift(); + roiChannelsDtosG.add(roiChannelsDto); + } + result.put("roiChannelsG",roiChannelsDtosG); + + /* + * GardsROIResultsSpectrum + * */ + // #GROSS COUNTS PER ROI + // #NET COUNTS AND LC PER ROI + // #CONCENTRATION AND LC PER ROI + List roiResults = new ArrayList<>(); + for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums) { + ROIResultsStrDto roiResultsStrDto = new ROIResultsStrDto(); + roiResultsStrDto.setRoi(resultsSpectrum.getRoi()); + roiResultsStrDto.setSGross(resultsSpectrum.getSGross()); + roiResultsStrDto.setGGross(resultsSpectrum.getGGross()); + roiResultsStrDto.setBGross(resultsSpectrum.getBGross()); + roiResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc()))); + roiResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))); + if (betaDataFile.isBProcessed()) { + roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); + roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr()))); + if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) { + roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))); + } + }else { + roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); + roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr())))); + if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) { + roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))); + } + } + roiResults.add(roiResultsStrDto); + } + result.put("roiResults", roiResults); + + /* + * GardsXeResultsSpectrum + * */ + // #RESULT SUMMARY + List xeResults = new ArrayList<>(); + for (GardsXeResultsSpectrum xeResultsSpectrum : xeResultsSpectrums) { + XeResultsStrDto xeResultsStrDto = new XeResultsStrDto(); + xeResultsStrDto.setNuclideName(xeResultsSpectrum.getNuclideName()); + xeResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr()))); + xeResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getLc()))); + xeResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getMdc()))); + xeResultsStrDto.setNidFlag(xeResultsSpectrum.getNidFlag()); + xeResults.add(xeResultsStrDto); + } + result.put("xeResults", xeResults); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + return result; + } + @Override - public void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) { + public void saveToHTML(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) { String userName = JwtUtil.getUserNameByToken(request); // 解析文件,生成导出数据 - Map analyze = exportData(anlyseResultIn, userName); + Map analyze = exportDataNew(rrrLogInfo); // 解析生成Html字符串并导出为Html文件 String result = parseHtml(analyze); PrintWriter writer = null; try { String export = "saveToHtml.html"; - String sampleFileName = anlyseResultIn.getSampleFileName(); + String sampleFileName = rrrLogInfo.getSampleFileName(); if (StrUtil.isNotBlank(sampleFileName)){ if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".html"); @@ -3716,14 +4126,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } @Override - public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) { + public void saveToExcel(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) { String userName = JwtUtil.getUserNameByToken(request); // 解析文件,生成导出数据 - Map analyze = exportData(anlyseResultIn, userName); + Map analyze = exportDataNew(rrrLogInfo); // 将Null值替换为"",避免空指针异常(集合为空集合,不能为null) analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); String export = "SaveToExcel.xls"; - String sampleFileName = anlyseResultIn.getSampleFileName(); + String sampleFileName = rrrLogInfo.getSampleFileName(); if (StrUtil.isNotBlank(sampleFileName)){ if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".xls");