Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
nieziyan 2023-11-20 19:12:56 +08:00
commit 8e1b03cf7d
21 changed files with 1019 additions and 326 deletions

View File

@ -13,7 +13,7 @@ public class StcGraph implements Serializable {
private String m_strGraphName;
private List<Date> m_Keys;
private List<String> m_Keys;
private List<Double> m_Values;

View File

@ -126,7 +126,7 @@ public class Sample_G_Analysis {
spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class);
ftpUtil = SpringContextUtils.getBean(FTPUtil.class);
String sampleFilePath = sampleData.getInputFileName();
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + File.separator +
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +
sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
@ -171,7 +171,7 @@ public class Sample_G_Analysis {
FileOperation.saveOrAppendFile(savePath, reportContent, false);
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage());
log.error("Sample_G_Analysis", e);
throw new GAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
}finally {

View File

@ -3430,8 +3430,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
dvctUPPERTAIL.add(fileAnlyse.getVPeak().get(m).upperTail);
dvctUPPERTAILALPHA.add(fileAnlyse.getVPeak().get(m).upperTailAlpha);
dvctBWWIDTHCHAN.add(fileAnlyse.getVPeak().get(m).BWWidthChan);
dvctRECOILBETACHAN.add(fileAnlyse.getVPeak().get(m).recoilBetaChan.equalsIgnoreCase("nan")?Double.NaN:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilBetaChan));
dvctRECOILDELTACHAN.add(fileAnlyse.getVPeak().get(m).recoilDeltaChan.equalsIgnoreCase("nan")?Double.NaN:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilDeltaChan));
dvctRECOILBETACHAN.add(fileAnlyse.getVPeak().get(m).recoilBetaChan.equalsIgnoreCase("nan")?null:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilBetaChan));
dvctRECOILDELTACHAN.add(fileAnlyse.getVPeak().get(m).recoilDeltaChan.equalsIgnoreCase("nan")?null:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilDeltaChan));
dvctSTEPRAIO.add(fileAnlyse.getVPeak().get(m).stepRatio);
dvctBACKGROUNDAREA.add(fileAnlyse.getVPeak().get(m).backgroundArea);
dvctMEANBACKCOUNT.add(fileAnlyse.getVPeak().get(m).meanBackCount);

View File

@ -115,6 +115,11 @@ public class SpectrumAnalysesController {
spectrumAnalysisService.exportQCResult(sampleId, dbName, sampleFileName, gasFileName ,detFileName, request,response);
}
@GetMapping("exportQCResultTXT")
public void exportQCResultTXT(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response) {
spectrumAnalysisService.exportQCResultTXT(sampleId, dbName, sampleFileName, gasFileName, detFileName, request, response);
}
@GetMapping("viewRLR")
@ApiOperation(value = "查看RLR数据", notes = "查看RLR数据")
public Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request) {

View File

@ -44,6 +44,8 @@ public interface ISpectrumAnalysisService {
void exportQCResult(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response);
void exportQCResultTXT(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response);
Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request);
void exportRLR(BetaRLR betaRLR, HttpServletResponse response);

View File

@ -779,12 +779,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
}
// RNMAN.GARDS_ANALY_SETTING 表读分析设置
if (dbName.equals("auto")) {
if (!dbName.equals("auto")) {
GardsAnalySetting analySetting = spectrumAnalysisMapper.getAnalySetting(analysis.getIdAnalysis());
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() ? 0 : t_d));
phd.getUsedSetting().setECutAnalysis_High((Objects.nonNull(analySetting.getEcutanalysisHigh())?(analySetting.getEcutanalysisHigh() <= phd.getUsedSetting().getECutAnalysis_Low()?-9999:analySetting.getEcutanalysisHigh()):-9999));
phd.getUsedSetting().setEnergyTolerance(analySetting.getEnergytolerance());
phd.getUsedSetting().setCalibrationPSS_high(analySetting.getCalibrationpssHigh());
phd.getUsedSetting().setCalibrationPSS_low(analySetting.getCalibrationpssLow());

View File

@ -53,6 +53,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -1469,7 +1470,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
String xe133MDCEvaluationMetrics = "0.001 ~ 5";
qcResult.setXe133MDCEvaluationMetrics(xe133MDCEvaluationMetrics);
//获取数据信息
GardsXeResultsSpectrum gardsXeResults = new GardsXeResultsSpectrum();
GardsXeResultsSpectrum gardsXeResults = null;
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
try {
xeDataList = betaDataFile.getXeResultsSpectrumList();
@ -1542,7 +1543,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
qcResult.setXe133MDCStatus("Failed");
}
} else {
qcResult.setXe133MDCStatus("Pass");
qcResult.setXe133MDCValue("None");
qcResult.setXe133MDCStatus("None");
}
}
} catch (Exception e) {
@ -1574,6 +1576,56 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
ExportUtil.exportXls(response,template,dataMap,export);
}
@Override
public void exportQCResultTXT(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response) {
Result<QCResult> result = viewQCResult(sampleId, dbName, sampleFileName, gasFileName, detFileName, request);
QCResult qcResult = result.getResult();
if (ObjectUtil.isNull(qcResult)) return;
StringBuffer strBuffer = new StringBuffer();
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%-25s", "#QC RESULT"));
strBuffer.append(System.lineSeparator());
String qcTitle = "%s%-24s%-21s%-10s%-9s";
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "QC Flags", "Evaluation Metrics", "Value", "Status"));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Collection Time (h)", StringUtils.isNotBlank(qcResult.getCollectTimeEvaluationMetrics())?qcResult.getCollectTimeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getCollectTimeValue())?qcResult.getCollectTimeValue():"", StringUtils.isNotBlank(qcResult.getCollectTimeStatus())?qcResult.getCollectTimeStatus():"Failed"));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Acqusition Time (h)", StringUtils.isNotBlank(qcResult.getAcquisitionTimeEvaluationMetrics())?qcResult.getAcquisitionTimeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getAcquisitionTimeValue())?qcResult.getAcquisitionTimeValue():"", StringUtils.isNotBlank(qcResult.getAcquisitionTimeStatus())?qcResult.getAcquisitionTimeStatus():"Failed"));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Xenon Volume (ml)", StringUtils.isNotBlank(qcResult.getXenonVolumeEvaluationMetrics())?qcResult.getXenonVolumeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getXenonVolumeValue())?qcResult.getXenonVolumeValue():"", StringUtils.isNotBlank(qcResult.getXenonVolumeStatus())?qcResult.getXenonVolumeStatus():"Failed"));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Gas Bg", StringUtils.isNotBlank(qcResult.getGasBgEvaluationMetrics())?qcResult.getGasBgEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getGasBgValue())?qcResult.getGasBgValue():"", qcResult.isGasBgValueAndStatus()?"Pass":"Failed"));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Det Bg", StringUtils.isNotBlank(qcResult.getDetBgEvaluationMetrics())?qcResult.getDetBgEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getDetBgValue())?qcResult.getDetBgValue():"", qcResult.isDetBgValueAndStatus()?"Pass":"Failed"));
strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "MDC for Xe133 (mBq/m3)", StringUtils.isNotBlank(qcResult.getXe133MDCEvaluationMetrics())?qcResult.getXe133MDCEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getXe133MDCValue())?qcResult.getXe133MDCValue():"None", StringUtils.isNotBlank(qcResult.getXe133MDCStatus())?qcResult.getXe133MDCStatus():"None"));
strBuffer.append(System.lineSeparator());
strBuffer.append(System.lineSeparator());
OutputStream fos = null;
try {
String fileName = sampleFileName.substring(0, sampleFileName.lastIndexOf(StringPool.DOT) - 1);
fileName = fileName + "_QC_Result.txt";
// 设置响应类型
response.setContentType("application/octet-stream");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
// 解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(fileName, "UTF-8"));
fos = response.getOutputStream();
fos.write(strBuffer.toString().getBytes());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
fos.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
@Override
public Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request) {
Result result = new Result();
@ -2336,7 +2388,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
//根据类型判断查询对应数据
List<StatisticsData> statisticsData = spectrumAnalysisMapper.statisticsQueryNuclides(statisticsQueryData);
Map<String, Object> resultMap = new HashMap<>();
List<StcGraph> stcGraphList = new LinkedList<>();
List<String> allDate = new LinkedList<>();
for (StatisticsData data:statisticsData) {
Date collectStart = data.getCollectStart();
String formatDate = DateUtils.formatDate(collectStart, "yyyy-MM-dd HH:mm:ss");
allDate.add(formatDate);
}
allDate = allDate.stream().distinct().sorted().collect(Collectors.toList());
//判断查询结果是否包含Xe131m的信息
if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_131m.getType())){
StcGraph stcGraphMDC = new StcGraph();
stcGraphMDC.setM_strGraphName("Xe131m MDC");
@ -2345,25 +2406,32 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
stcGraphAct.setM_strGraphName("Xe131m Activity Concentration");
stcGraphAct.setM_GraphPen("#f89c1f");
List<StatisticsData> xe131m = new LinkedList<>();
//提取出Xe131m相关数据
if (CollectionUtils.isNotEmpty(statisticsData)) {
xe131m = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_131m.getType())).collect(Collectors.toList());
}
//判断数据是否为空
if (CollectionUtils.isNotEmpty(xe131m)){
//判断是否有勾选MDC数据进行返回
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
//遍历xe11m的数据
for (StatisticsData data:xe131m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
//遍历xe131m数据
for (StatisticsData data:xe131m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2386,20 +2454,23 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (CollectionUtils.isNotEmpty(xe133m)){
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
//遍历xe133m数据
for (StatisticsData data:xe133m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe133m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2422,20 +2493,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (CollectionUtils.isNotEmpty(xe133)){
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe133) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe133) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2458,20 +2531,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (CollectionUtils.isNotEmpty(xe135)){
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe135) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe135) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2481,8 +2556,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
stcGraphList.add(stcGraphMDC);
stcGraphList.add(stcGraphAct);
}
resultMap.put("allDate", allDate);
resultMap.put("allList", stcGraphList);
result.setSuccess(true);
result.setResult(stcGraphList);
result.setResult(resultMap);
return result;
}
@ -2513,10 +2590,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Colloction Time");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2528,10 +2605,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Acquisition Time");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2543,10 +2620,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Xe Volumn");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2558,10 +2635,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Sample Volumn");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2991,6 +3068,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setBgPara(spectrum_group.BgCalPara);
}
} else {
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
betaDataFile.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
betaDataFile.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
}
xeMap.put("XeData", Collections.EMPTY_LIST);
}
}
@ -3146,19 +3239,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (bRet) {
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
sampleBetaData.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
betaDataFile.setGasBoundary(gasBoundary);
sampleBetaData.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
betaDataFile.setDetBoundary(detBoundary);
sampleBetaData.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
sampleBetaData.setQcBoundary(qcBoundary);
}
List<GardsXeResultsSpectrum> xeResultsSpectrumList = (List<GardsXeResultsSpectrum>) xeMap.get("XeData");
if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){
@ -3186,7 +3279,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
analyseResultMap.put(sampleFileName, xeMap);
} else {
xeMap.clear();
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
sampleBetaData.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
sampleBetaData.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
sampleBetaData.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
sampleBetaData.setQcBoundary(qcBoundary);
}
xeMap.put("XeData", Collections.EMPTY_LIST);
analyseResultMap.put(sampleFileName, xeMap);
}
@ -3351,14 +3459,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
//调用分析方法
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map, betaDataFile);
if (bRet) {
//分析qc文件信息并重新计算qc边界值
if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) {
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map, betaDataFile);
}
//分析qc文件信息并重新计算qc边界值
if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) {
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map, betaDataFile);
}
}
if (bRet) {
List<Boundary> sampleBoundary = (List<Boundary>) map.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
@ -3402,7 +3510,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
map.put("savedAnalysisResult", true);
mapList.put(sampleFileName, map);
} else {
map.clear();
List<Boundary> sampleBoundary = (List<Boundary>) map.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) map.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
betaDataFile.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) map.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
betaDataFile.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) map.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
}
map.put("XeData", Collections.EMPTY_LIST);
mapList.put(sampleFileName, map);
}

View File

@ -814,8 +814,6 @@ public class CalculateStationData {
* @param stationInfos 台站信息列表
*/
public void mutiThreadGetStationInfo(List<StationInfo> stationInfos, RateParam mRateParam) {
// 声明当前开始执行时间
Date startTime = new Date();
//声明一个数组用于接收最后的结果情况
Map<String, StationInfo> finallySta = Objects.nonNull(redisUtil.get("dataStationInfoList"))? (Map<String, StationInfo>) redisUtil.get("dataStationInfoList"):new HashMap<>();
//声明一个线程池

View File

@ -1,20 +1,14 @@
package org.jeecg.common.util;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.entity.data.HistogramData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

View File

@ -8,10 +8,10 @@ import java.util.List;
@Data
public class BetaSpectrum implements Serializable {
private Integer numberBChannels;
private Long numberBChannels;
private Integer energySpan;
private Long energySpan;
private List<Integer> bSpectrumSubBlock;
private List<Long> bSpectrumSubBlock;
}

View File

@ -8,10 +8,10 @@ import java.util.List;
@Data
public class GammaSpectrum implements Serializable {
private Integer numberGChannels;
private Long numberGChannels;
private Integer energySpan;
private Long energySpan;
private List<Integer> gSpectrumSubBlock;
private List<Long> gSpectrumSubBlock;
}

View File

@ -8,13 +8,13 @@ import java.util.List;
@Data
public class Histogram implements Serializable {
private Integer BChannels;
private Long BChannels;
private Integer BEnergySpan;
private Long BEnergySpan;
private Integer GChannels;
private Long GChannels;
private Integer GEnergySpan;
private Long GEnergySpan;
private List<HistogramData> histogramSubBlock;

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;

View File

@ -2,9 +2,6 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
import org.jeecg.modules.entity.GardsAlertDataWeb;
import java.util.Date;
public interface SysEmailLogStatMapper extends BaseMapper<SysEmailLog> {

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
/**
* 能谱处理本地类
*/
public class EnergySpectrumHandler {
/**
* 获取能谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native EnergySpectrumStruct getSourceData(String path);
}

View File

@ -0,0 +1,555 @@
package org.jeecg.modules.native_jni.struct;
import lombok.Data;
import java.util.List;
/**
* 能谱结构体字段信息
*/
@Data
public class EnergySpectrumStruct {
/************************* Infomations ******************/
/**
* 消息类型
*/
public String msg_type;
/**
* 消息id
*/
public String msg_id;
/**
* 数据类型
*/
public String data_type;
/************************* Header Black ******************/
/**
* designator
*/
public String designator;
/**
* site code
*/
public String site_code;
/**
* detector code
*/
public String detector_code;
/**
* system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and
*/
public String system_type;
/**
* sample geometry
*/
public String sample_geometry;
/**
* spectrum qualifier: preliminary ( PREL )or full ( FULL)
*/
public String spectrum_quantity;
/**
* sample reference identification
*/
public String sample_ref_id;
/**
* measurement identification
*/
public String measurement_id;
/**
* detector background measurement identification
*/
public String detector_bk_measurement_id;
/**
* gas background measurement identification (memory effect)
*/
public String gas_bk_measurement_id;
/**
* transmit date (yyyy / mm / dd)
*/
public String transmit_date;
/**
* transmit time (hh : mm : ss . s)
*/
public String transmit_time;
/************************* Sample ******************/
public double dimension_1;
public double dimension_2;
/************************* Comment ******************/
public String comment;
/************************* Acquisition Block ******************/
/**
* acquisition start date (yyyy / mm / dd)
*/
public String acquisition_start_date;
/**
* acquisition start time (hh : mm : ss . s)
*/
public String acquisition_start_time;
/**
* acquisition real time (s)
*/
public double acquisition_real_time;
/**
* acquisition live time (s)
*/
public double acquisition_live_time;
/************************* Collection Block ******************/
/**
* collection start date (yyyy / mm / dd)
*/
public String collection_start_date;
/**
* collection start time (hh : mm : ss . s)
*/
public String collection_start_time;
/**
* collection stop date (yyyy / mm / dd)
*/
public String collection_stop_date;
/**
* collection stop time (hh : mm : ss . s)
*/
public String collection_stop_time;
/**
* total air volume sampled (standard cubic meters [scm])
*/
public double air_volume;
/************************* Processing Block ******************/
/**
* sample volume of Xe (cm 3 )
*/
public double sample_volume_of_Xe;
/**
* uncertainty (cm 3 )
*/
public double uncertainty_1;
/**
* Xe collection yield (Xe gas in sample/total Xe gas sampled)
*/
public double Xe_collection_yield;
/**
* uncertainty (Xe gas in sample/total Xe gas sampled)
*/
public double uncertainty_2;
/**
* archive bottle identification
*/
public String archive_bottle_id;
/************************* Calibration Block ******************/
/**
* date of last calibration (yyyy / mm / dd)
*/
public String date_calibration;
/**
* time of last calibration (hh : mm : ss)
*/
public String time_calibration;
/************************* g_Energy Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_energy;
/**
* centroid channel
*/
public List<Double> g_centroid_channel;
/**
* uncertainty (channels)
*/
public List<Double> g_uncertainty;
public int g_record_count;
/************************* b_Energy Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_electron_energy;
/**
* decay mode descriptor: B for β-particle, C for conversion electron (CE)
*/
public List<String> b_decay_mode;
/**
* maximum channel of β-particle distribution or centroid channel of CE (channels)
*/
public List<Double> b_channel;
/**
* uncertainty (channels)
*/
public List<Double> b_uncertainty;
public int b_record_count;
/************************* g_Resolution Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_r_energy;
/**
* FWHM (keV)
*/
public List<Double> g_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> g_r_uncertainty;
public int g_r_record_count;
/************************* b_Resolution Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_r_electron_energy;
/**
* FWHM (keV)
*/
public List<Double> b_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> b_r_uncertainty;
public int b_r_record_count;
/************************* g_Efficiency Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_e_energy;
/**
* efficiency (counts in peak/photon emitted)
*/
public List<Double> g_e_efficiency;
/**
* uncertainty (counts in peak/photon emitted)
*/
public List<Double> g_e_uncertainty;
public int g_e_record_count;
/************************* ROI_Limits Block ******************/
/**
* ROI number
*/
public List<String> ROI_number;
/**
* 2-D ROI β-range start, x 1 (keV)
*/
public List<Double> POI_B_x1;
/**
* 2-D ROI β-range stop, x 2 (keV)
*/
public List<Double> POI_B_x2;
/**
* 2-D ROI γ-range start, y 1 (keV)
*/
public List<Double> POI_G_y1;
/**
* 2-D ROI γ-range stop, y 2 (keV)
*/
public List<Double> POI_G_y2;
public int roi_record_count;
/************************* b-gEfficiency Block ******************/
/**
* nuclide name
*/
public List<String> bg_nuclide_name;
/**
* ROI number
*/
public List<Double> bg_ROI_number;
/**
* β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_efficiency;
/**
* uncertainty (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_uncertainty;
public int bg_record_count;
/************************* Ratios Block ******************/
/**
* ratio identifier
*/
public List<String> ratio_id;
/**
* ROI number for the higher γ -energy ROI
*/
public List<String> ROI_num_highter_G_energy_ROI;
/**
* ROI number for the lower γ -energy ROI
*/
public List<String> ROI_num_lower_G_energy_ROI;
/**
* Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI)
*/
public List<Double> count_ratio;
/**
* count ratio uncertainty (percent)
*/
public List<Double> count_ratio_uncertainty;
public int ratio_record_count;
/************************* g_Spectrum Block ******************/
/**
* number of γ channels
*/
public long num_g_channel;
/**
* γ-energy span (keV)
*/
public long g_energy_span;
/**
* begin of channels
*/
public long g_begin_channel;
/**
* count at channel
*/
public List<Long> g_counts;
/************************* b_Spectrum Block ******************/
/**
* number of β -channels
*/
public long num_b_channel;
/**
* β -energy span (keV)
*/
public long b_energy_span;
/**
* begin of channels
*/
public long b_begin_channel;
/**
* counts at channels
*/
public List<Long> b_counts;
/************************* Histogram Block ******************/
/**
* β-channels
*/
public long b_channels;
/**
* γ-channels
*/
public long g_channels;
/**
* β-energy span
*/
public long b_h_energy_span;
/**
* γ-energy span
*/
public long g_h_energy_span;
/**
* counts at channels
*/
public List<Long> h_counts;
/************************* Certificate_Block ******************/
/**
* total source activity (Bq)
*/
public double total_source_activity;
/**
* assay date (yyyy / mm / dd)
*/
public String assay_date;
/**
* assay time (hh : mm : ss)
*/
public String assay_time;
/**
* units of activity: B, b for Bq or [blank]; if nothing, then B is assigned
*/
public String units_activity;
/**
* nuclide name
*/
public List<String> nuclide_name;
/**
* half-life in seconds, hours, days, or years
*/
public List<String> half_life_time;
/**
* time unit(Y, D, H, S)
*/
public List<String> time_unit;
/**
* activity of nuclide at time of assay
*/
public List<Double> activity_nuclide_time_assay;
/**
* uncertainty (%)
*/
public List<Double> uncertainty;
/**
* γ-energy (keV)
*/
public List<Double> cer_g_energy;
/**
* γ-intensity (percent)
*/
public List<Double> g_intensity;
/**
* electron decay mode descriptor: B for β particle or C for conversion electron (CE), 0 for none (that is, γ-only source)
*/
public List<String> electron_decay_mode;
/**
* maximum β-particle energy or CE energy (keV)
*/
public List<Double> maximum_energy;
/**
* intensity of β-particle (percent)
*/
public List<Double> intensity_b_particle;
public int record_count;
/************************* Totaleff Block ******************/
/**
* γ-energy (keV)
*/
public List<Double> t_g_energy;
/**
* total efficiency (counts/photon emitted)
*/
public List<Double> total_efficiency;
/**
* uncertainty (counts/photon emitted)
*/
public List<Double> t_uncertainty;
public int t_record_count;
public EnergySpectrumStruct() {
super();
}
@Override
public String toString() {
return "EnergySpectrumStruct{" +
"msg_type='" + msg_type + '\'' +
", msg_id='" + msg_id + '\'' +
", data_type='" + data_type + '\'' +
", designator='" + designator + '\'' +
", site_code='" + site_code + '\'' +
", detector_code='" + detector_code + '\'' +
", system_type='" + system_type + '\'' +
", sample_geometry='" + sample_geometry + '\'' +
", spectrum_quantity='" + spectrum_quantity + '\'' +
", sample_ref_id='" + sample_ref_id + '\'' +
", measurement_id='" + measurement_id + '\'' +
", detector_bk_measurement_id='" + detector_bk_measurement_id + '\'' +
", gas_bk_measurement_id='" + gas_bk_measurement_id + '\'' +
", transmit_date='" + transmit_date + '\'' +
", transmit_time='" + transmit_time + '\'' +
", comment='" + comment + '\'' +
", acquisition_start_date='" + acquisition_start_date + '\'' +
", acquisition_start_time='" + acquisition_start_time + '\'' +
", acquisition_real_time=" + acquisition_real_time +
", acquisition_live_time=" + acquisition_live_time +
", collection_start_date='" + collection_start_date + '\'' +
", collection_start_time='" + collection_start_time + '\'' +
", collection_stop_date='" + collection_stop_date + '\'' +
", collection_stop_time='" + collection_stop_time + '\'' +
", air_volume=" + air_volume +
", sample_volume_of_Xe=" + sample_volume_of_Xe +
", uncertainty_1=" + uncertainty_1 +
", Xe_collection_yield=" + Xe_collection_yield +
", uncertainty_2=" + uncertainty_2 +
", archive_bottle_id='" + archive_bottle_id + '\'' +
", date_calibration='" + date_calibration + '\'' +
", time_calibration='" + time_calibration + '\'' +
", g_energy=" + g_energy +
", g_centroid_channel=" + g_centroid_channel +
", g_uncertainty=" + g_uncertainty +
", g_record_count=" + g_record_count +
", b_electron_energy=" + b_electron_energy +
", b_decay_mode=" + b_decay_mode +
", b_channel=" + b_channel +
", b_uncertainty=" + b_uncertainty +
", b_record_count=" + b_record_count +
", g_r_energy=" + g_r_energy +
", g_r_FWHM=" + g_r_FWHM +
", g_r_uncertainty=" + g_r_uncertainty +
", g_r_record_count=" + g_r_record_count +
", b_r_electron_energy=" + b_r_electron_energy +
", b_r_FWHM=" + b_r_FWHM +
", b_r_uncertainty=" + b_r_uncertainty +
", b_r_record_count=" + b_r_record_count +
", g_e_energy=" + g_e_energy +
", g_e_efficiency=" + g_e_efficiency +
", g_e_uncertainty=" + g_e_uncertainty +
", g_e_record_count=" + g_e_record_count +
", ROI_number=" + ROI_number +
", POI_B_x1=" + POI_B_x1 +
", POI_B_x2=" + POI_B_x2 +
", POI_G_y1=" + POI_G_y1 +
", POI_G_y2=" + POI_G_y2 +
", roi_record_count=" + roi_record_count +
", bg_nuclide_name=" + bg_nuclide_name +
", bg_ROI_number=" + bg_ROI_number +
", bg_efficiency=" + bg_efficiency +
", bg_uncertainty=" + bg_uncertainty +
", bg_record_count=" + bg_record_count +
", ratio_id=" + ratio_id +
", ROI_num_highter_G_energy_ROI=" + ROI_num_highter_G_energy_ROI +
", ROI_num_lower_G_energy_ROI=" + ROI_num_lower_G_energy_ROI +
", count_ratio=" + count_ratio +
", count_ratio_uncertainty=" + count_ratio_uncertainty +
", ratio_record_count=" + ratio_record_count +
", num_g_channel=" + num_g_channel +
", g_energy_span=" + g_energy_span +
", g_begin_channel=" + g_begin_channel +
", g_counts=" + g_counts +
", num_b_channel=" + num_b_channel +
", b_energy_span=" + b_energy_span +
", b_begin_channel=" + b_begin_channel +
", b_counts=" + b_counts +
", b_channels=" + b_channels +
", g_channels=" + g_channels +
", b_h_energy_span=" + b_h_energy_span +
", g_h_energy_span=" + g_h_energy_span +
", h_counts=" + h_counts +
", total_source_activity=" + total_source_activity +
", assay_date='" + assay_date + '\'' +
", assay_time='" + assay_time + '\'' +
", units_activity='" + units_activity + '\'' +
", nuclide_name=" + nuclide_name +
", half_life_time=" + half_life_time +
", time_unit=" + time_unit +
", activity_nuclide_time_assay=" + activity_nuclide_time_assay +
", uncertainty=" + uncertainty +
", cer_g_energy=" + cer_g_energy +
", g_intensity=" + g_intensity +
", electron_decay_mode=" + electron_decay_mode +
", maximum_energy=" + maximum_energy +
", intensity_b_particle=" + intensity_b_particle +
", record_count=" + record_count +
'}';
}
public static void main(String[] args) {
EnergySpectrumStruct s = new EnergySpectrumStruct();
System.out.println(s);
System.out.println(s.gas_bk_measurement_id);
}
}

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.swagger.models.auth.In;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSampleDataWeb;

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
import java.util.Date;
public interface ISysEmailLogStatService extends IService<SysEmailLog> {

View File

@ -18,6 +18,7 @@ import org.jeecg.modules.service.IGardsMetDataService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -20,12 +20,15 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.*;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.base.entity.original.*;
import org.jeecg.modules.base.entity.original.GardsSampleAux;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.original.GardsSampleDescription;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.data.*;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import org.jeecg.modules.mapper.*;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.IGardsSampleDataWebService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -37,7 +40,6 @@ import java.io.*;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
import static org.jeecg.modules.base.enums.PageType.*;
@ -138,32 +140,43 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
public Result findGeneratedReport(Integer sampleId) {
Result result = new Result();
Report report = new Report();
//查询info
this.findInfo(sampleId, report);
//查询G_energy
this.findGEnergy(sampleId, report);
//查询B_energy
this.findBEnergy(sampleId, report);
//查询G_Resolution
this.findGResolution(sampleId, report);
//查询B_Resolution
this.findBResolution(sampleId, report);
//查询G_Efficiency
this.findGEfficiency(sampleId, report);
//查询B_gEfficiency
this.findBgEfficiency(sampleId, report);
//查询ROI
this.findRoiLimits(sampleId, report);
//查询RATIOS
this.findRatios(sampleId, report);
//查询 GAMMA SPECTRUM
this.findGSpectrum(sampleId, report);
//查询 BETA SPECTRUM
this.findBSpectrum(sampleId, report);
//查询Histogram
this.findHistogram(sampleId, report);
//查询Certificate
this.findCertificate(sampleId, report);
File file = null;
//根据sampleId查询对应的文件路径
GardsSampleDataWeb sampleData = getOneSample(sampleId);
String filePath = sampleData.getInputFileName();
if (StringUtils.isNotBlank(filePath)) {
file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath, "betaGamma");
if (Objects.nonNull(file)) {
System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//查询info
this.findInfo(sampleId, report);
//查询G_energy
this.findGEnergy(sourceData, report);
//查询B_energy
this.findBEnergy(sourceData, report);
//查询G_Resolution
this.findGResolution(sourceData, report);
//查询B_Resolution
this.findBResolution(sourceData, report);
//查询G_Efficiency
this.findGEfficiency(sourceData, report);
//查询B_gEfficiency
this.findBgEfficiency(sourceData, report);
//查询ROI
this.findRoiLimits(sourceData, report);
//查询RATIOS
this.findRatios(sourceData, report);
//查询 GAMMA SPECTRUM
this.findGSpectrum(sourceData, report);
//查询 BETA SPECTRUM
this.findBSpectrum(sourceData, report);
//查询Histogram
this.findHistogram(sourceData, report);
//查询Certificate
this.findCertificate(sourceData, report);
}
}
result.setSuccess(true);
result.setResult(report);
return result;
@ -404,328 +417,319 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
report.setCalibrationBlock(calibration);
}
private void findGEnergy(Integer sampleId, Report report) {
private void findGEnergy(EnergySpectrumStruct sourceData, Report report) {
List<GEnergy> gEnergySubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.g_energy) && CollectionUtils.isNotEmpty(sourceData.g_centroid_channel) && CollectionUtils.isNotEmpty(sourceData.g_uncertainty)){
gEnergySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.g_energy.size(); i++) {
GEnergy gEnergy = new GEnergy();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
gEnergy.setEnergy(orig.getYValue());
gEnergy.setCentroid(orig.getXValue());
gEnergy.setUncertainty(orig.getUncYValue());
gEnergySubBlock.add(gEnergy);
}
gEnergy.setEnergy(sourceData.g_energy.get(i));
gEnergy.setCentroid(sourceData.g_centroid_channel.get(i));
gEnergy.setUncertainty(sourceData.g_uncertainty.get(i));
gEnergySubBlock.add(gEnergy);
}
}
report.setGEnergyBlock(gEnergySubBlock);
}
private void findBEnergy(Integer sampleId, Report report) {
private void findBEnergy(EnergySpectrumStruct sourceData, Report report) {
List<BEnergy> bEnergySubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.b_electron_energy) && CollectionUtils.isNotEmpty(sourceData.b_channel) && CollectionUtils.isNotEmpty(sourceData.b_uncertainty) && CollectionUtils.isNotEmpty(sourceData.b_decay_mode)){
bEnergySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.b_electron_energy.size(); i++) {
BEnergy bEnergy = new BEnergy();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue()) && Objects.nonNull(orig.getDecayMode())){
bEnergy.setElectronEnergy(orig.getYValue());
bEnergy.setMaximumChannel(orig.getXValue());
bEnergy.setUncertainty(orig.getUncYValue());
bEnergy.setDecayModeDescriptor(orig.getDecayMode());
bEnergySubBlock.add(bEnergy);
}
bEnergy.setElectronEnergy(sourceData.b_electron_energy.get(i));
bEnergy.setMaximumChannel(sourceData.b_channel.get(i));
bEnergy.setUncertainty(sourceData.b_uncertainty.get(i));
bEnergy.setDecayModeDescriptor(sourceData.b_decay_mode.get(i));
bEnergySubBlock.add(bEnergy);
}
}
report.setBEnergyBlock(bEnergySubBlock);
}
private void findGResolution(Integer sampleId, Report report) {
private void findGResolution(EnergySpectrumStruct sourceData, Report report) {
List<GResolution> gResolutionSubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.g_r_energy) && CollectionUtils.isNotEmpty(sourceData.g_r_FWHM) && CollectionUtils.isNotEmpty(sourceData.g_r_uncertainty)){
gResolutionSubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.g_r_energy.size(); i++) {
GResolution gResolution = new GResolution();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
gResolution.setEnergy(orig.getXValue());
gResolution.setFWHM(orig.getYValue());
gResolution.setUncertainty(orig.getUncYValue());
gResolutionSubBlock.add(gResolution);
}
gResolution.setEnergy(sourceData.g_r_energy.get(i));
gResolution.setFWHM(sourceData.g_r_FWHM.get(i));
gResolution.setUncertainty(sourceData.g_r_uncertainty.get(i));
gResolutionSubBlock.add(gResolution);
}
}
report.setGResolutionBlock(gResolutionSubBlock);
}
private void findBResolution(Integer sampleId, Report report) {
private void findBResolution(EnergySpectrumStruct sourceData, Report report) {
List<BResolution> bResolutionSubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.b_r_electron_energy) && CollectionUtils.isNotEmpty(sourceData.b_r_FWHM) && CollectionUtils.isNotEmpty(sourceData.b_r_uncertainty)){
bResolutionSubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.b_r_electron_energy.size(); i++) {
BResolution bResolution = new BResolution();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
bResolution.setElectronEnergy(orig.getXValue());
bResolution.setFWHM(orig.getYValue());
bResolution.setUncertainty(orig.getUncYValue());
bResolutionSubBlock.add(bResolution);
}
bResolution.setElectronEnergy(sourceData.b_r_electron_energy.get(i));
bResolution.setFWHM(sourceData.b_r_FWHM.get(i));
bResolution.setUncertainty(sourceData.b_r_uncertainty.get(i));
bResolutionSubBlock.add(bResolution);
}
}
report.setBResolutionBlock(bResolutionSubBlock);
}
private void findGEfficiency(Integer sampleId, Report report) {
private void findGEfficiency(EnergySpectrumStruct sourceData, Report report) {
List<GEfficiency> gEfficiencySubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.g_e_energy) && CollectionUtils.isNotEmpty(sourceData.g_e_efficiency) && CollectionUtils.isNotEmpty(sourceData.g_e_uncertainty)){
gEfficiencySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.g_e_energy.size(); i++) {
GEfficiency gEfficiency = new GEfficiency();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
gEfficiency.setEnergy(orig.getXValue());
gEfficiency.setEfficiency(orig.getYValue());
gEfficiency.setUncertainty(orig.getUncYValue());
gEfficiencySubBlock.add(gEfficiency);
}
gEfficiency.setEnergy(sourceData.g_e_energy.get(i));
gEfficiency.setEfficiency(sourceData.g_e_efficiency.get(i));
gEfficiency.setUncertainty(sourceData.g_e_uncertainty.get(i));
gEfficiencySubBlock.add(gEfficiency);
}
}
report.setGEfficiencyBlock(gEfficiencySubBlock);
}
private void findBgEfficiency(Integer sampleId, Report report) {
private void findBgEfficiency(EnergySpectrumStruct sourceData, Report report) {
List<BEfficiency> bgEfficiencySubBlock = null;
LambdaQueryWrapper<GardsBgEfficiencyPairs> bgEfficiencyPairsQueryWrapper = new LambdaQueryWrapper<>();
bgEfficiencyPairsQueryWrapper.eq(GardsBgEfficiencyPairs::getSampleId, sampleId);
List<GardsBgEfficiencyPairs> gardsBgEfficiencyPairs = gardsBgEfficiencyPairsMapper.selectList(bgEfficiencyPairsQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsBgEfficiencyPairs)){
// LambdaQueryWrapper<GardsBgEfficiencyPairs> bgEfficiencyPairsQueryWrapper = new LambdaQueryWrapper<>();
// bgEfficiencyPairsQueryWrapper.eq(GardsBgEfficiencyPairs::getSampleId, sampleId);
// List<GardsBgEfficiencyPairs> gardsBgEfficiencyPairs = gardsBgEfficiencyPairsMapper.selectList(bgEfficiencyPairsQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.bg_ROI_number) && CollectionUtils.isNotEmpty(sourceData.bg_nuclide_name) && CollectionUtils.isNotEmpty(sourceData.bg_efficiency) && CollectionUtils.isNotEmpty(sourceData.bg_uncertainty)){
bgEfficiencySubBlock = new LinkedList<>();
for (GardsBgEfficiencyPairs pairs:gardsBgEfficiencyPairs) {
for (int i=0; i<sourceData.bg_ROI_number.size(); i++) {
BEfficiency bEfficiency = new BEfficiency();
if (Objects.nonNull(pairs.getRoi()) && Objects.nonNull(pairs.getNuclideName()) && Objects.nonNull(pairs.getBgEfficiency()) && Objects.nonNull(pairs.getBgEfficError())){
bEfficiency.setRoiNumber(pairs.getRoi());
bEfficiency.setNuclideName(pairs.getNuclideName());
bEfficiency.setCoincidenceEfficiency(pairs.getBgEfficiency());
bEfficiency.setUncertainty(pairs.getBgEfficError());
bgEfficiencySubBlock.add(bEfficiency);
}
bEfficiency.setRoiNumber(sourceData.bg_ROI_number.get(i).intValue());
bEfficiency.setNuclideName(sourceData.bg_nuclide_name.get(i));
bEfficiency.setCoincidenceEfficiency(sourceData.bg_efficiency.get(i));
bEfficiency.setUncertainty(sourceData.bg_uncertainty.get(i));
bgEfficiencySubBlock.add(bEfficiency);
}
}
report.setBgEfficiencyBlock(bgEfficiencySubBlock);
}
private void findRoiLimits(Integer sampleId, Report report) {
private void findRoiLimits(EnergySpectrumStruct sourceData, Report report) {
List<Roi> roiLimitsSubBlock = null;
LambdaQueryWrapper<GardsRoiLimits> roiLimitsQueryWrapper = new LambdaQueryWrapper<>();
roiLimitsQueryWrapper.eq(GardsRoiLimits::getSampleId, sampleId);
roiLimitsQueryWrapper.orderByAsc(GardsRoiLimits::getRoi);
List<GardsRoiLimits> gardsRoiLimitsList = gardsRoiLimitsMapper.selectList(roiLimitsQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsRoiLimitsList)){
// LambdaQueryWrapper<GardsRoiLimits> roiLimitsQueryWrapper = new LambdaQueryWrapper<>();
// roiLimitsQueryWrapper.eq(GardsRoiLimits::getSampleId, sampleId);
// roiLimitsQueryWrapper.orderByAsc(GardsRoiLimits::getRoi);
// List<GardsRoiLimits> gardsRoiLimitsList = gardsRoiLimitsMapper.selectList(roiLimitsQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.ROI_number) && CollectionUtils.isNotEmpty(sourceData.POI_B_x1) && CollectionUtils.isNotEmpty(sourceData.POI_B_x2) && CollectionUtils.isNotEmpty(sourceData.POI_G_y1) && CollectionUtils.isNotEmpty(sourceData.POI_G_y2)){
roiLimitsSubBlock = new LinkedList<>();
for (GardsRoiLimits roiLimits:gardsRoiLimitsList) {
for (int i=0; i<sourceData.ROI_number.size(); i++) {
Roi roi = new Roi();
if (Objects.nonNull(roiLimits.getRoi()) && Objects.nonNull(roiLimits.getGEnergyStart()) && Objects.nonNull(roiLimits.getGEnergyStop())
&& Objects.nonNull(roiLimits.getBEnergyStart()) && Objects.nonNull(roiLimits.getBEnergyStop()) ){
roi.setRoiNumber(roiLimits.getRoi());
roi.setRoiGRangeStart(roiLimits.getGEnergyStart());
roi.setRoiGRangeStop(roiLimits.getGEnergyStop());
roi.setRoiBRangeStart(roiLimits.getBEnergyStart());
roi.setRoiBRangeStop(roiLimits.getBEnergyStop());
roiLimitsSubBlock.add(roi);
}
roi.setRoiNumber(Integer.valueOf(sourceData.ROI_number.get(i)));
roi.setRoiGRangeStart(sourceData.POI_G_y1.get(i));
roi.setRoiGRangeStop(sourceData.POI_G_y2.get(i));
roi.setRoiBRangeStart(sourceData.POI_B_x1.get(i));
roi.setRoiBRangeStop(sourceData.POI_B_x2.get(i));
roiLimitsSubBlock.add(roi);
}
}
report.setRoiLimitsBlock(roiLimitsSubBlock);
}
private void findRatios(Integer sampleId, Report report) {
private void findRatios(EnergySpectrumStruct sourceData, Report report) {
List<Ratios> ratiosSubBlock = null;
LambdaQueryWrapper<GardsSampleRatios> ratiosQueryWrapper = new LambdaQueryWrapper<>();
ratiosQueryWrapper.eq(GardsSampleRatios::getSampleId, sampleId);
ratiosQueryWrapper.orderByAsc(GardsSampleRatios::getRatioId);
List<GardsSampleRatios> sampleRatiosList = gardsSampleRatiosMapper.selectList(ratiosQueryWrapper);
if (CollectionUtils.isNotEmpty(sampleRatiosList)){
// LambdaQueryWrapper<GardsSampleRatios> ratiosQueryWrapper = new LambdaQueryWrapper<>();
// ratiosQueryWrapper.eq(GardsSampleRatios::getSampleId, sampleId);
// ratiosQueryWrapper.orderByAsc(GardsSampleRatios::getRatioId);
// List<GardsSampleRatios> sampleRatiosList = gardsSampleRatiosMapper.selectList(ratiosQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.count_ratio) && CollectionUtils.isNotEmpty(sourceData.ratio_id) && CollectionUtils.isNotEmpty(sourceData.count_ratio_uncertainty) && CollectionUtils.isNotEmpty(sourceData.ROI_num_lower_G_energy_ROI) && CollectionUtils.isNotEmpty(sourceData.ROI_num_highter_G_energy_ROI)){
ratiosSubBlock = new LinkedList<>();
for (GardsSampleRatios sampleRatios:sampleRatiosList) {
for (int i=0; i<sourceData.ratio_id.size(); i++) {
Ratios ratios = new Ratios();
if (Objects.nonNull(sampleRatios.getCountRatio()) && StringUtils.isNotBlank(sampleRatios.getRatioId()) && Objects.nonNull(sampleRatios.getCountRatioErr())
&& Objects.nonNull(sampleRatios.getLowerRoiNumber()) && Objects.nonNull(sampleRatios.getUpperRoiNumber()) ){
ratios.setCountRatio(sampleRatios.getCountRatio());
ratios.setRatioId(sampleRatios.getRatioId());
ratios.setCountRatioUncertainty(sampleRatios.getCountRatioErr());
ratios.setRoiNumberLowerEnergy(sampleRatios.getLowerRoiNumber());
ratios.setRoiNumberHigherEnergy(sampleRatios.getUpperRoiNumber());
ratiosSubBlock.add(ratios);
}
ratios.setCountRatio(sourceData.count_ratio.get(i));
ratios.setRatioId(sourceData.ratio_id.get(i));
ratios.setCountRatioUncertainty(sourceData.count_ratio_uncertainty.get(i));
ratios.setRoiNumberLowerEnergy(Integer.valueOf(sourceData.ROI_num_lower_G_energy_ROI.get(i)));
ratios.setRoiNumberHigherEnergy(Integer.valueOf(sourceData.ROI_num_highter_G_energy_ROI.get(i)));
ratiosSubBlock.add(ratios);
}
}
report.setRatiosBlock(ratiosSubBlock);
}
private void findGSpectrum(Integer sampleId, Report report) {
private void findGSpectrum(EnergySpectrumStruct sourceData, Report report) {
GammaSpectrum gSpectrumBlock = null;
LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "G");
spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(gardsSpectrum)){
// LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "G");
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
// GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(sourceData)){
gSpectrumBlock = new GammaSpectrum();
Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.GSPECTRUM.getMessage());
List<Integer> gSpectrumSubBlock = new LinkedList<>();
if (CollectionUtils.isNotEmpty(map)){
gSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.GSPECTRUM.getMessage());
// Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.GSPECTRUM.getMessage());
// List<Integer> gSpectrumSubBlock = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(map)){
// gSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.GSPECTRUM.getMessage());
// }
gSpectrumBlock.setGSpectrumSubBlock(sourceData.g_counts);
if (Objects.nonNull(sourceData.g_energy_span)){
gSpectrumBlock.setEnergySpan(sourceData.g_energy_span);
}
gSpectrumBlock.setGSpectrumSubBlock(gSpectrumSubBlock);
if (Objects.nonNull(gardsSpectrum.getEnergySpan())){
gSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
}
if (Objects.nonNull(gardsSpectrum.getChannels())){
gSpectrumBlock.setNumberGChannels(gardsSpectrum.getChannels());
if (Objects.nonNull(sourceData.num_g_channel)){
gSpectrumBlock.setNumberGChannels(sourceData.num_g_channel);
}
}
report.setGSpectrumBlock(gSpectrumBlock);
}
private void findBSpectrum(Integer sampleId, Report report) {
private void findBSpectrum(EnergySpectrumStruct sourceData, Report report) {
BetaSpectrum bSpectrumBlock = null;
LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "B");
spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(gardsSpectrum)){
// LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "B");
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
// GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(sourceData)){
bSpectrumBlock = new BetaSpectrum();
Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.BSPECTRUM.getMessage());
List<Integer> bSpectrumSubBlock = new LinkedList<>();
if (CollectionUtils.isNotEmpty(map)) {
bSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.BSPECTRUM.getMessage());
// Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.BSPECTRUM.getMessage());
// List<Integer> bSpectrumSubBlock = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(map)) {
// bSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.BSPECTRUM.getMessage());
// }
bSpectrumBlock.setBSpectrumSubBlock(sourceData.b_counts);
if (Objects.nonNull(sourceData.b_energy_span)){
bSpectrumBlock.setEnergySpan(sourceData.b_energy_span);
}
bSpectrumBlock.setBSpectrumSubBlock(bSpectrumSubBlock);
if (Objects.nonNull(gardsSpectrum.getEnergySpan())){
bSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
}
if (Objects.nonNull(gardsSpectrum.getChannels())){
bSpectrumBlock.setNumberBChannels(gardsSpectrum.getChannels());
if (Objects.nonNull(sourceData.num_b_channel)){
bSpectrumBlock.setNumberBChannels(sourceData.num_b_channel);
}
}
report.setBSpectrumBlock(bSpectrumBlock);
}
private void findHistogram(Integer sampleId, Report report) {
private void findHistogram(EnergySpectrumStruct sourceData, Report report) {
Histogram histogramBlock = null;
LambdaQueryWrapper<GardsHistogram> histogramQueryWrapper = new LambdaQueryWrapper<>();
histogramQueryWrapper.eq(GardsHistogram::getSampleId, sampleId);
GardsHistogram gardsHistogram = gardsHistogramMapper.selectOne(histogramQueryWrapper);
if (Objects.nonNull(gardsHistogram)){
// LambdaQueryWrapper<GardsHistogram> histogramQueryWrapper = new LambdaQueryWrapper<>();
// histogramQueryWrapper.eq(GardsHistogram::getSampleId, sampleId);
// GardsHistogram gardsHistogram = gardsHistogramMapper.selectOne(histogramQueryWrapper);
if (Objects.nonNull(sourceData)){
histogramBlock = new Histogram();
Map<String, Object> map = readLineUtil.readLine(gardsHistogram.getFilename(), SampleFileHeader.HISTOGRAM.getMessage());
List<HistogramData> histogramSubBlock = new LinkedList<>();
if (CollectionUtils.isNotEmpty(map)) {
histogramSubBlock = (List<HistogramData>)map.get(SampleFileHeader.HISTOGRAM.getMessage());
}
List<HistogramData> histogramSubBlock = readValue(sourceData);
// Map<String, Object> map = readLineUtil.readLine(gardsHistogram.getFilename(), SampleFileHeader.HISTOGRAM.getMessage());
// List<HistogramData> histogramSubBlock = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(map)) {
// histogramSubBlock = (List<HistogramData>)map.get(SampleFileHeader.HISTOGRAM.getMessage());
// }
histogramBlock.setHistogramSubBlock(histogramSubBlock);
if (Objects.nonNull(gardsHistogram.getBChannels())){
histogramBlock.setBChannels(gardsHistogram.getBChannels());
if (Objects.nonNull(sourceData.b_channels)){
histogramBlock.setBChannels(sourceData.b_channels);
}
if (Objects.nonNull(gardsHistogram.getBEnergySpan())){
histogramBlock.setBEnergySpan(gardsHistogram.getBEnergySpan());
if (Objects.nonNull(sourceData.b_h_energy_span)){
histogramBlock.setBEnergySpan(sourceData.b_h_energy_span);
}
if (Objects.nonNull(gardsHistogram.getGChannels())){
histogramBlock.setGChannels(gardsHistogram.getGChannels());
if (Objects.nonNull(sourceData.g_channels)){
histogramBlock.setGChannels(sourceData.g_channels);
}
if (Objects.nonNull(gardsHistogram.getGEnergySpan())){
histogramBlock.setGEnergySpan(gardsHistogram.getGEnergySpan());
if (Objects.nonNull(sourceData.g_h_energy_span)){
histogramBlock.setGEnergySpan(sourceData.g_h_energy_span);
}
}
report.setHistogramBlock(histogramBlock);
}
private void findCertificate(Integer sampleId, Report report) {
private void findCertificate(EnergySpectrumStruct sourceData, Report report) {
Certificate certificateBlock = null;
LambdaQueryWrapper<GardsSampleCert> sampleCertQueryWrapper = new LambdaQueryWrapper<>();
sampleCertQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId);
GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper);
if (Objects.nonNull(gardsSampleCert)) {
certificateBlock = new Certificate();
if (Objects.nonNull(gardsSampleCert.getQuantity())){
certificateBlock.setTotalSourceActivity(gardsSampleCert.getQuantity());
}
if (Objects.nonNull(gardsSampleCert.getAssayDate())){
certificateBlock.setAssayDate(DateUtils.formatDate(gardsSampleCert.getAssayDate(), "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(gardsSampleCert.getUnit())){
certificateBlock.setUnitsOfActivity(gardsSampleCert.getUnit());
}
}
LambdaQueryWrapper<GardsSampleCertLine> sampleCertLineQueryWrapper = new LambdaQueryWrapper<>();
sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId);
List<GardsSampleCertLine> gardsSampleCertLines = gardsSampleCertLineMapper.selectList(sampleCertLineQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsSampleCertLines)) {
if (Objects.isNull(certificateBlock)){
// LambdaQueryWrapper<GardsSampleCert> sampleCertQueryWrapper = new LambdaQueryWrapper<>();
// sampleCertQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId);
// GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper);
try {
if (Objects.nonNull(sourceData)) {
certificateBlock = new Certificate();
if (Objects.nonNull(sourceData.total_source_activity)){
certificateBlock.setTotalSourceActivity(sourceData.total_source_activity);
}
if (StringUtils.isNotBlank(sourceData.assay_date) && StringUtils.isNotBlank(sourceData.assay_time)){
Date assayDate = DateUtils.parseDate(sourceData.assay_date + " " + sourceData.assay_time);
certificateBlock.setAssayDate(DateUtils.formatDate(assayDate, "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(sourceData.units_activity)){
certificateBlock.setUnitsOfActivity(sourceData.units_activity);
}
}
List<CertificateLine> certificateSubBlock = new LinkedList<>();
for (GardsSampleCertLine sampleCertLine:gardsSampleCertLines) {
CertificateLine certificateLine = new CertificateLine();
if (StringUtils.isNotBlank(sampleCertLine.getNuclName())){
certificateLine.setNuclideName(sampleCertLine.getNuclName());
// LambdaQueryWrapper<GardsSampleCertLine> sampleCertLineQueryWrapper = new LambdaQueryWrapper<>();
// sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId);
// List<GardsSampleCertLine> gardsSampleCertLines = gardsSampleCertLineMapper.selectList(sampleCertLineQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.nuclide_name) && CollectionUtils.isNotEmpty(sourceData.half_life_time) && CollectionUtils.isNotEmpty(sourceData.activity_nuclide_time_assay)
&& CollectionUtils.isNotEmpty(sourceData.uncertainty) && CollectionUtils.isNotEmpty(sourceData.cer_g_energy) && CollectionUtils.isNotEmpty(sourceData.g_intensity)
&& CollectionUtils.isNotEmpty(sourceData.electron_decay_mode) && CollectionUtils.isNotEmpty(sourceData.maximum_energy) && CollectionUtils.isNotEmpty(sourceData.intensity_b_particle)) {
if (Objects.isNull(certificateBlock)){
certificateBlock = new Certificate();
}
if (StringUtils.isNotBlank(sampleCertLine.getHalflife())){
certificateLine.setHalfLife(sampleCertLine.getHalflife());
List<CertificateLine> certificateSubBlock = new LinkedList<>();
for (int i=0; i<sourceData.nuclide_name.size(); i++) {
CertificateLine certificateLine = new CertificateLine();
certificateLine.setNuclideName(sourceData.nuclide_name.get(i));
certificateLine.setHalfLife(sourceData.half_life_time.get(i));
certificateLine.setNuclideActivity(sourceData.activity_nuclide_time_assay.get(i));
certificateLine.setUncertainty(sourceData.uncertainty.get(i));
certificateLine.setGenergy(sourceData.cer_g_energy.get(i));
certificateLine.setIntensity(sourceData.g_intensity.get(i));
certificateLine.setElectronDecayModeDescriptor(sourceData.electron_decay_mode.get(i));
certificateLine.setMaxBParticleEnergy(sourceData.maximum_energy.get(i));
certificateLine.setParticleBIntensity(sourceData.intensity_b_particle.get(i));
certificateSubBlock.add(certificateLine);
}
if (Objects.nonNull(sampleCertLine.getActivity())){
certificateLine.setNuclideActivity(sampleCertLine.getActivity());
}
if (Objects.nonNull(sampleCertLine.getError())){
certificateLine.setUncertainty(sampleCertLine.getError());
}
if (Objects.nonNull(sampleCertLine.getEnergy())){
certificateLine.setGenergy(sampleCertLine.getEnergy());
}
if (Objects.nonNull(sampleCertLine.getAbundance())){
certificateLine.setIntensity(sampleCertLine.getAbundance());
}
if (StringUtils.isNotBlank(sampleCertLine.getDecayMode())){
certificateLine.setElectronDecayModeDescriptor(sampleCertLine.getDecayMode());
}
if (Objects.nonNull(sampleCertLine.getBEnergy())){
certificateLine.setMaxBParticleEnergy(sampleCertLine.getBEnergy());
}
if (Objects.nonNull(sampleCertLine.getBAbundance())){
certificateLine.setParticleBIntensity(sampleCertLine.getBAbundance());
}
certificateSubBlock.add(certificateLine);
certificateBlock.setCertificateSubBlock(certificateSubBlock);
}
certificateBlock.setCertificateSubBlock(certificateSubBlock);
report.setCertificateBlock(certificateBlock);
} catch (ParseException e) {
throw new RuntimeException(e);
}
report.setCertificateBlock(certificateBlock);
}
public List<HistogramData> readValue(EnergySpectrumStruct sourceData) {
List<HistogramData> result = new LinkedList<>();
if (CollectionUtils.isNotEmpty(sourceData.h_counts) && Objects.nonNull(sourceData.g_channels) && Objects.nonNull(sourceData.b_channels)) {
for (int i=0; i<sourceData.g_channels; i++) {
for (int j=0; j<sourceData.b_channels; j++) {
List<Long> subList = sourceData.h_counts.subList((int) (i * sourceData.b_channels), (int) ((i + 1) * sourceData.b_channels));
if (!"0".equals(String.valueOf(subList.get(j)))){
HistogramData histogramData = new HistogramData();
histogramData.setG(i);
histogramData.setB(j);
histogramData.setC(subList.get(j).intValue());
result.add(histogramData);
}
}
}
}
return result;
}
@Override

View File

@ -7,7 +7,6 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.codec.language.bm.Lang;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;