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

This commit is contained in:
orgin 2023-09-18 15:16:38 +08:00
commit 79e05be0e0
11 changed files with 660 additions and 174 deletions

View File

@ -18,4 +18,8 @@ public class FittingBody implements Serializable {
private Integer count;
private String qcFileName;
private String tabName;
}

View File

@ -0,0 +1,36 @@
package org.jeecg.common.cache;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.jeecg.modules.entity.vo.PHDFile;
import org.jeecg.modules.entity.vo.SeriseData;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Component
public class BetaCache {
private Cache<String, Map<String, Object>> betaCache = CacheBuilder.newBuilder()
//设置缓存初始大小应该合理设置后续会扩容
.initialCapacity(10)
//最大值
.maximumSize(100)
//并发数设置
.concurrencyLevel(5)
//缓存过期时间写入后5秒钟过期
.expireAfterWrite(5, TimeUnit.HOURS)
//统计缓存命中率
.recordStats()
.build();
public Cache<String, Map<String, Object>> getBetaCache() {
return betaCache;
}
public void setBetaCache(Cache<String, Map<String, Object>> betaCache) {
this.betaCache = betaCache;
}
}

View File

@ -2,7 +2,7 @@ package org.jeecg.common.util;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
@ -2717,14 +2717,37 @@ public class GammaFileUtil {
return data;
}
List<String> DoubleLimit_G(List<Double> _data) {
NumberFormat numberFormat = new DecimalFormat("0.##########E0");
public List<String> DoubleLimit_I(List<Double> _data) {
List<String> rdata = new LinkedList<>();
for(int pos=0;pos<_data.size();pos++) {
if(Objects.isNull(_data.get(pos))) {
rdata.add("NULL");
} else {
rdata.add(numberFormat.format(_data.get(pos)));
rdata.add(String.valueOf(_data.get(pos).intValue()));
}
}
return rdata;
}
public List<String> DoubleLimit_G(List<Double> _data) {
NumberFormat numberFormat = new DecimalFormat("0.##########E0");
List<String> rdata = new LinkedList<>();
for(int pos=0;pos<_data.size();pos++) {
Double value = _data.get(pos);
if (String.valueOf(value).indexOf("e")>0) {
if(Objects.isNull(value)) {
rdata.add("NULL");
} else {
rdata.add(numberFormat.format(value));
}
} else {
if (String.format("%.1f", value).indexOf(".0")>0) {
rdata.addAll(DoubleLimit_I(_data));
break;
} else {
rdata.addAll(DoubleLimit(_data));
break;
}
}
}
return rdata;
@ -3120,7 +3143,7 @@ public class GammaFileUtil {
List<Double> dvctLD = new LinkedList<>();
List<String> dvctNuclide_name = new LinkedList<>();
List<String> dvctComments = new LinkedList<>();
for(int m=0;m<fileAnlyse.getVPeak().size();m++) {
for(int m=0; m<fileAnlyse.getVPeak().size(); m++) {
dvctIDPEAK.add(Double.valueOf(m+1));
dvctCENTROIDCHANNEL.add(fileAnlyse.getVPeak().get(m).peakCentroid);
dvctENERGY.add(fileAnlyse.getVPeak().get(m).energy);
@ -3148,21 +3171,15 @@ public class GammaFileUtil {
dvctMEANBACKCOUNT.add(fileAnlyse.getVPeak().get(m).meanBackCount);
dvctLC.add(fileAnlyse.getVPeak().get(m).lc);
dvctLD.add(fileAnlyse.getVPeak().get(m).ld);
String t_comment = fileAnlyse.getVPeak().get(m).comments==null?"":fileAnlyse.getVPeak().get(m).comments.replace("\'", "\'\'").trim();
if(t_comment.length() > 1024){
t_comment = t_comment.substring(0, 1025);
}
dvctComments.add(t_comment);
String qsName = "";
for(int n=0;n<fileAnlyse.getVPeak().get(m).nuclides.size();n++) {
qsName = qsName+fileAnlyse.getVPeak().get(m).nuclides.get(n)+";";
}
dvctNuclide_name.add(qsName);
dvctNuclide_name.add(StringUtils.join(fileAnlyse.getVPeak().get(m).nuclides, ";"));
}
middleData.peaks_idPeak =DoubleLimit_G(dvctIDPEAK);
middleData.peaks_idPeak =DoubleLimit_I(dvctIDPEAK);
middleData.peaks_peakCentroid =DoubleLimit_G(dvctCENTROIDCHANNEL);
middleData.peaks_uncpeakCentroid =DoubleLimit_G(dvctUNCCENTROIDCHANNEL);
middleData.peaks_Energy =DoubleLimit_G(dvctENERGY);
@ -3192,28 +3209,27 @@ public class GammaFileUtil {
middleData.peaks_Ld =DoubleLimit_G(dvctLD);
middleData.peaks_comments = dvctComments;
middleData.peaks_Nuclide_name = dvctNuclide_name;
}
// gards_ nucl_lines_ided数据表
GStoreMiddleProcessDataNuclLinesIded nucl_lines_ided_data = new GStoreMiddleProcessDataNuclLinesIded();
List<String> svctNUCLIDEFULLNAME = new LinkedList<>();
List<Double> dvctIDPEAK = new LinkedList<>();
List<Double> dvctENERGY = new LinkedList<>();
List<Double> dvctUNCENERGY = new LinkedList<>();
List<Double> dvctABUNDANCE = new LinkedList<>();
List<Double> dvctUNCABUNDANCE = new LinkedList<>();
List<String> dvctACTIVITY = new LinkedList<>();
List<Double> dvctUNCACTIVITY = new LinkedList<>();
List<Double> dvctEFFIC = new LinkedList<>();
List<Double> dvctUNEFFIC = new LinkedList<>();
List<String> dvctMDA = new LinkedList<>();
List<Double> dvctKEY_FLAG = new LinkedList<>();
List<Double> dvctCSC_RATIO = new LinkedList<>();
List<Double> dvctCSC_RATIO_ERR = new LinkedList<>();
List<Double> dvctCSC_MOD_FLAG = new LinkedList<>();
List<String> dvctMDC = new LinkedList<>();
List<String> dvctCONCENTRATION = new LinkedList<>();
for(Map.Entry<String, NuclideActMda> itor:fileAnlyse.getMapNucActMda().entrySet()) {
List<String> svctNUCLIDEFULLNAME = new LinkedList<>();
List<Double> dvctIDPEAK = new LinkedList<>();
List<Double> dvctENERGY = new LinkedList<>();
List<Double> dvctUNCENERGY = new LinkedList<>();
List<Double> dvctABUNDANCE = new LinkedList<>();
List<Double> dvctUNCABUNDANCE = new LinkedList<>();
List<String> dvctACTIVITY = new LinkedList<>();
List<Double> dvctUNCACTIVITY = new LinkedList<>();
List<Double> dvctEFFIC = new LinkedList<>();
List<Double> dvctUNEFFIC = new LinkedList<>();
List<String> dvctMDA = new LinkedList<>();
List<Double> dvctKEY_FLAG = new LinkedList<>();
List<Double> dvctCSC_RATIO = new LinkedList<>();
List<Double> dvctCSC_RATIO_ERR = new LinkedList<>();
List<Double> dvctCSC_MOD_FLAG = new LinkedList<>();
List<String> dvctMDC = new LinkedList<>();
List<String> dvctCONCENTRATION = new LinkedList<>();
int first=itor.getValue().getFullNames().size();
int second=itor.getValue().getVPeakIdx().size();
first = first<second?first:second;
@ -3225,7 +3241,6 @@ public class GammaFileUtil {
first = first<second?first:second;
second = itor.getValue().getVUncertY().size();
first = first<second?first:second;
for(int m=0;m<first;m++) {
svctNUCLIDEFULLNAME.add( itor.getValue().getFullNames().get(m).replace("\'", "\'\'") );
dvctIDPEAK.add(itor.getValue().getVPeakIdx().get(m).doubleValue());
@ -3251,7 +3266,7 @@ public class GammaFileUtil {
dvctCONCENTRATION.add(numberFormat.format(itor.getValue().getConcentration()));
}
nucl_lines_ided_data.nuclideFullname = svctNUCLIDEFULLNAME;
nucl_lines_ided_data.idPeak =DoubleLimit_G(dvctIDPEAK);
nucl_lines_ided_data.idPeak =DoubleLimit_I(dvctIDPEAK);
nucl_lines_ided_data.Energy =DoubleLimit_G(dvctENERGY);
nucl_lines_ided_data.uncEnergy =DoubleLimit_G(dvctUNCENERGY);
nucl_lines_ided_data.Abundance =DoubleLimit_G(dvctABUNDANCE);
@ -3270,25 +3285,24 @@ public class GammaFileUtil {
middleData.getNucl_lines_ided_data().put(itor.getKey(), nucl_lines_ided_data);
}
// gards_ nucl_ided数据表
List<String> svctNUCLIDEFULLNAME1 = new LinkedList<>();
List<String> svctTYPE = new LinkedList<>();
List<Double> dvctHALFLIFE = new LinkedList<>();
List<String> dvctAVE_ACTIV = new LinkedList<>();
List<Double> dvctAVE_ACTIV_ERR = new LinkedList<>();
List<Double> dvctACTIV_KEY = new LinkedList<>();
List<Double> dvctACTIV_KEY_ERR = new LinkedList<>();
List<String> dvctMDA1 = new LinkedList<>();
List<Double> dvctMDA_ERR = new LinkedList<>();
List<Double> dvctNID_FLAG = new LinkedList<>();
List<Double> dvctCSC_RATIO1 = new LinkedList<>();
List<Double> dvctCSC_RATIO_ERR1 = new LinkedList<>();
List<Double> dvctCSC_MOD_FLAG1 = new LinkedList<>();
List<String> dvctMDC1 = new LinkedList<>();
List<String> dvctCONCENTRATION1 = new LinkedList<>();
List<Double> dvctKey_Energy = new LinkedList<>();
List<Double> dvctKey_Yield = new LinkedList<>();
if( fileAnlyse.getMapNucActMda().size() != 0) {
List<String> svctNUCLIDEFULLNAME1 = new LinkedList<>();
List<String> svctTYPE = new LinkedList<>();
List<Double> dvctHALFLIFE = new LinkedList<>();
List<String> dvctAVE_ACTIV = new LinkedList<>();
List<Double> dvctAVE_ACTIV_ERR = new LinkedList<>();
List<Double> dvctACTIV_KEY = new LinkedList<>();
List<Double> dvctACTIV_KEY_ERR = new LinkedList<>();
List<String> dvctMDA1 = new LinkedList<>();
List<Double> dvctMDA_ERR = new LinkedList<>();
List<Double> dvctNID_FLAG = new LinkedList<>();
List<Double> dvctCSC_RATIO1 = new LinkedList<>();
List<Double> dvctCSC_RATIO_ERR1 = new LinkedList<>();
List<Double> dvctCSC_MOD_FLAG1 = new LinkedList<>();
List<String> dvctMDC1 = new LinkedList<>();
List<String> dvctCONCENTRATION1 = new LinkedList<>();
List<Double> dvctKey_Energy = new LinkedList<>();
List<Double> dvctKey_Yield = new LinkedList<>();
for(Map.Entry<String, NuclideActMda> itor_v: fileAnlyse.getMapNucActMda().entrySet()) {
String nuclideName = itor_v.getKey();
svctNUCLIDEFULLNAME1.add(nuclideName);
@ -3307,7 +3321,6 @@ public class GammaFileUtil {
dvctKey_Yield.add(itor_v.getValue().getVYield().get(itor_v.getValue().getCalculateIdx()));
}
}
middleData.nucl_ided_Nuclidename = svctNUCLIDEFULLNAME1;
middleData.nucl_ided_Type= svctTYPE;
middleData.nucl_ided_Halflife =DoubleLimit_G(dvctHALFLIFE);
@ -3322,17 +3335,16 @@ public class GammaFileUtil {
middleData.nucl_ided_csc_ratio_err =DoubleLimit_G(dvctCSC_RATIO_ERR1);
middleData.nucl_ided_csc_mod_flag =DoubleLimit_G(dvctCSC_MOD_FLAG1);
middleData.nucl_ided_MDC = dvctMDC1;
middleData.nucl_ided_Concentration = dvctCONCENTRATION;
middleData.nucl_ided_Concentration = dvctCONCENTRATION1;
middleData.nucl_ided_Key_Energy = DoubleLimit_G(dvctKey_Energy);
middleData.nucl_ided_Key_Yield = DoubleLimit_G(dvctKey_Yield);
}
// GARDS_QC_CHECK数据表
List<String> qvctQC_NAME = new LinkedList<>();
List<Double> dvctQC_VALUE = new LinkedList<>();
List<String> qvctQC_STANDARD = new LinkedList<>();
List<Double> dvctQC_RESULT = new LinkedList<>();
if( fileAnlyse.getQcItems().size() != 0) {
List<String> qvctQC_NAME = new LinkedList<>();
List<Double> dvctQC_VALUE = new LinkedList<>();
List<String> qvctQC_STANDARD = new LinkedList<>();
List<Double> dvctQC_RESULT = new LinkedList<>();
for(Map.Entry<String, QcCheckItem> itor_q:fileAnlyse.getQcItems().entrySet()) {
String nuclideName = itor_q.getKey();
qvctQC_NAME.add(nuclideName);
@ -3345,11 +3357,9 @@ public class GammaFileUtil {
middleData.QC_CHECK_QC_STANDARD=qvctQC_STANDARD;
middleData.QC_CHECK_QC_VALUE=DoubleLimit_G(dvctQC_VALUE);
}
//sample info
middleData.sample_collection_start = fileAnlyse.getCollect().getCollection_start_date()+StringPool.SPACE+fileAnlyse.getCollect().getCollection_start_time();
middleData.sample_collection_stop = fileAnlyse.getCollect().getCollection_stop_date()+StringPool.SPACE+fileAnlyse.getCollect().getCollection_stop_time();
if(Objects.nonNull(fileAnlyse.getQcItems().get("col_time"))) {
middleData.sample_time = String.format("%.4f", fileAnlyse.getQcItems().get("col_time").getValue());
if(fileAnlyse.getQcItems().get("col_time").getValue()!=0) {
@ -3365,16 +3375,14 @@ public class GammaFileUtil {
middleData.sample_quantity = String.format("%.4f", fileAnlyse.getCollect().getAir_volume());
middleData.sample_acquisiton_start = fileAnlyse.getAcq().getAcquisition_start_date()+StringPool.SPACE+fileAnlyse.getAcq().getAcquisition_start_time();
String acquisition_start = middleData.sample_acquisiton_start;
Date dataTime = DateUtils.parseDate(acquisition_start.substring(0, acquisition_start.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss");
acquisition_start = DateUtils.formatDate(dataTime, "yyyy/MM/dd HH:mm:ss");
middleData.sample_acquistion_stop = DateUtils.formatDate(new Date((long) (dataTime.getTime()/1000 + fileAnlyse.getAcq().getAcquisition_live_time())), "yyyy/MM/dd HH:mm:ss");
Date dataTime = DateUtils.parseDate(acquisition_start);
middleData.sample_acquistion_stop = DateUtils.formatDate(new Date((long) (dataTime.getTime()/1000 + fileAnlyse.getAcq().getAcquisition_live_time())) , "yyyy/MM/dd HH:mm:ss");
middleData.sample_acquistion_time = String.format("%.2f", fileAnlyse.getAcq().getAcquisition_real_time()) ;
middleData.sample_stationID = fileAnlyse.getHeader().getSite_code();
middleData.sample_detectID = fileAnlyse.getHeader().getDetector_code();
middleData.sample_Geometry = fileAnlyse.getHeader().getSample_geometry();
middleData.sample_Type = fileAnlyse.getHeader().getSystem_type();
middleData.setting_specSetup = fileAnlyse.getUsedSetting();
middleData.Collection_Station_Comments = fileAnlyse.getOriTotalCmt();
middleData.NDC_Analysis_General_Comments = fileAnlyse.getTotalCmt();
return bRet;

View File

@ -588,11 +588,11 @@ public class PHDFileUtil {
String dataType = sourceData.data_type;
StringBuffer path = new StringBuffer();
if(systemType.contains("B")) {
path.append(StringPool.SLASH+"Spectrum");
path.append("Spectrum");
path.append(StringPool.SLASH+"Xenon");
path.append(StringPool.SLASH+"Sauna");
} else if(systemType.contains("G")) {
path.append(StringPool.SLASH+"Spectrum");
path.append("Spectrum");
path.append(StringPool.SLASH+"Xenon");
path.append(StringPool.SLASH+"Spalax");
}

View File

@ -181,6 +181,7 @@ public class GammaController {
}
@PostMapping("saveDataEnergy")
@ApiOperation(value = "保存Energy Calibration数据", notes = "保存Energy Calibration数据")
public void saveDataEnergy(@RequestBody ChangeData changeData, HttpServletResponse response) {
gammaService.saveDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), response);
}
@ -203,6 +204,12 @@ public class GammaController {
return gammaService.applyDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getCurCalName(), changeData.getSampleId(), changeData.getFileName());
}
@PostMapping("saveDataResolution")
@ApiOperation(value = "保存Resolution Calibration数据", notes = "保存Resolution Calibration数据")
public void saveDataResolution(@RequestBody ChangeData changeData, HttpServletResponse response) {
gammaService.saveDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), response);
}
@GetMapping("EfficiencyCalibration")
@ApiOperation(value = "查看Efficiency Calibration数据", notes = "查看Efficiency Calibration数据")
public Result EfficiencyCalibration(@RequestParam Integer sampleId, String fileName, String currentText) {
@ -221,6 +228,12 @@ public class GammaController {
return gammaService.applyDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getCurCalName(), changeData.getSampleId(), changeData.getFileName());
}
@PostMapping("saveDataEfficiency")
@ApiOperation(value = "保存Efficiency Calibration数据", notes = "保存Efficiency Calibration数据")
public void saveDataEfficiency(@RequestBody ChangeData changeData, HttpServletResponse response) {
gammaService.saveDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getFuncId(), response);
}
@GetMapping("NuclideLibrary")
@ApiOperation(value = "查看Nuclide Library页面数据", notes = "查看Nuclide Library页面数据")
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {
@ -263,12 +276,22 @@ public class GammaController {
gammaService.viewARR(sampleId, response);
}
@GetMapping("exportARR")
public void exportARR(Integer sampleId, HttpServletResponse response) {
gammaService.exportARR(sampleId, response);
}
@GetMapping("viewRRR")
@ApiOperation(value = "查看RRR页面数据", notes = "查看RRR页面数据")
public Result viewRRR(Integer sampleId, String fileName) {
return gammaService.viewRRR(sampleId, fileName);
}
@GetMapping("exportRRR")
public void exportRRR(Integer sampleId, String fileName, HttpServletResponse response) {
gammaService.exportRRR(sampleId, fileName, response);
}
@GetMapping("radionuclideActivity")
@ApiOperation(value = "查看Radionuclide Activity页面数据", notes = "查看Radionuclide Activity页面数据")
public Result radionuclideActivity(Integer sampleId, String fileName) {

View File

@ -179,8 +179,8 @@ public class SpectrumAnalysesController {
@PostMapping("fitting")
@ApiOperation(value = "公式计算新的曲线", notes = "公式计算新的曲线")
public Result fitting(@RequestBody FittingBody fittingBody) {
return spectrumAnalysisService.fitting(fittingBody.getParamA(), fittingBody.getParamB(), fittingBody.getParamC(), fittingBody.getTempPoints(), fittingBody.getCount());
public Result fitting(@RequestBody FittingBody fittingBody, HttpServletRequest request) {
return spectrumAnalysisService.fitting(fittingBody.getParamA(), fittingBody.getParamB(), fittingBody.getParamC(), fittingBody.getTempPoints(), fittingBody.getCount(), fittingBody.getQcFileName(), fittingBody.getTabName(), request);
}
@GetMapping("getGammaGated")

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import org.jeecg.modules.entity.GardsCalibrationSpectrum;
import org.jeecg.modules.entity.GardsROIChannelsSpectrum;
import org.jeecg.modules.entity.GardsROIResultsSpectrum;
@ -177,15 +178,9 @@ public class BgDataAnlyseResultIn implements Serializable {
/**
* Beta Detector Calibration公式参数
*/
private String param_a_c2e_b_sample;
private String param_b_c2e_b_sample;
private String param_c_c2e_b_sample;
private String param_a_c2e_b_gas;
private String param_b_c2e_b_gas;
private String param_c_c2e_b_gas;
private String param_a_c2e_b_det;
private String param_b_c2e_b_det;
private String param_c_c2e_b_det;
private String param_a_c2e_b;
private String param_b_c2e_b;
private String param_c_c2e_b;
private double mdc_Xe135; //MDC XE135
private double mdc_Xe131m; //MDC XE131m
@ -222,6 +217,6 @@ public class BgDataAnlyseResultIn implements Serializable {
List<GardsROIResultsSpectrum> roiResultsSpectrumList;
List<GardsXeResultsSpectrum> XeData;
List<GardsXeResults> XeData;
}

View File

@ -71,12 +71,16 @@ public interface IGammaService{
Result applyDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName);
void saveDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText);
Result changeDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, Integer sampleId, String fileName);
Result applyDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName);
void saveDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, Integer funId, HttpServletResponse response);
Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request);
Result configUserLibrary(Integer sampleId, String fileName, HttpServletRequest request);
@ -91,8 +95,12 @@ public interface IGammaService{
void viewARR(Integer sampleId, HttpServletResponse response);
void exportARR(Integer sampleId, HttpServletResponse response);
Result viewRRR(Integer sampleId, String fileName);
void exportRRR(Integer sampleId, String fileName, HttpServletResponse response);
Result<?> radionuclideActivity(Integer sampleId, String fileName);
void exportRadionuclideActivity(Integer sampleId, String fileName, HttpServletResponse response);

View File

@ -62,7 +62,7 @@ public interface ISpectrumAnalysisService {
Result statisticsQueryBtn(Integer detectorId, String detectorName, Integer stationId, String statisticsType, Date startTime, Date endTime);
Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPointsArray, Integer count);
Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPointsArray, Integer count, String qcFileName, String tabName, HttpServletRequest request);
Result getGammaGated(Integer chartHeight, Integer channelWidth, Integer gammaChannel, Integer sampleId, String qcFileName, HttpServletRequest request);

View File

@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -1224,6 +1225,10 @@ public class GammaServiceImpl implements IGammaService {
}
OutputStream fos = null;
try {
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("EnergyCalibration.Ent","UTF-8"));
fos = response.getOutputStream();
fos.write(strBuffer.toString().getBytes());
} catch (FileNotFoundException e) {
@ -1365,6 +1370,34 @@ public class GammaServiceImpl implements IGammaService {
return result;
}
@Override
public void saveDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response) {
StringBuffer strBuffer = new StringBuffer();
strBuffer.append("#g_Resolution").append("\n");
for (int i=0; i<m_vCurReso.size(); i++) {
strBuffer.append(m_vCurEnergy.get(i)).append(" ").append(m_vCurReso.get(i)).append(" ").append(m_vCurUncert.get(i)).append("\n");
}
OutputStream fos = null;
try {
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("ResolutionCalibration.Ent","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 EfficiencyCalibration(Integer sampleId, String fileName, String currentText) {
Result result = new Result();
@ -1501,6 +1534,35 @@ public class GammaServiceImpl implements IGammaService {
return result;
}
@Override
public void saveDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, Integer funId, HttpServletResponse response) {
StringBuffer strBuffer = new StringBuffer();
strBuffer.append("#g_Efficiency").append("\n");
for (int i=0; i<m_vCurEffi.size(); i++) {
strBuffer.append(m_vCurEnergy.get(i)).append(" ").append(m_vCurEffi.get(i)).append(" ").append(m_vCurUncert.get(i)).append("\n");
}
strBuffer.append("FitType = ").append(funId);
OutputStream fos = null;
try {
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("EfficiencyCalibration.Eft","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 NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {
Result result = new Result();
@ -1738,6 +1800,73 @@ public class GammaServiceImpl implements IGammaService {
}
}
@Override
public void exportARR(Integer sampleId, HttpServletResponse response) {
if(Objects.isNull(sampleId)) {
String waring = "The file isn't existed.";
}
//获取自动处理生成的报告地址
String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
if(StringUtils.isBlank(reportPath.trim())) {
String waring = "The file isn't existed.";
}
String pathName = reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败");
}
InputStream inputStream = null;
ServletOutputStream outputStream = null;
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding("UTF-8");
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
pathName=StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + pathName;
ftpClient.changeWorkingDirectory(pathName);
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(ftpFiles)){
throw new RuntimeException("ftp下对应的报告文件不存在");
}
FTPFile ftpFile = ftpFiles.get(0);
if (Objects.nonNull(ftpFile)){
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("ARR.txt","UTF-8"));
outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
int bytesRead;
// 将文件输出流写入到输出流中
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(ftpClient)){
ftpClient.disconnect();
}
if (ObjectUtil.isNotNull(inputStream)){
inputStream.close();
}
if (ObjectUtil.isNotNull(outputStream)){
outputStream.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
@Override
public Result viewRRR(Integer sampleId, String fileName) {
Result result = new Result();
@ -1753,6 +1882,35 @@ public class GammaServiceImpl implements IGammaService {
return result;
}
@Override
public void exportRRR(Integer sampleId, String fileName, HttpServletResponse response) {
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)) {
return;
}
String reportContent = gammaFileUtil.GetReportContent(phd, false);
OutputStream fos = null;
try {
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode("RRR.txt","UTF-8"));
fos = response.getOutputStream();
fos.write(reportContent.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<Map<String, Object>> radionuclideActivity(Integer sampleId, String fileName) {
Result<Map<String, Object>> result = new Result();

View File

@ -9,12 +9,14 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.cache.Cache;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.BetaCache;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.system.util.JwtUtil;
@ -28,6 +30,7 @@ import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired;
@ -64,6 +67,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
@Autowired
private PHDFileUtil phdFileUtil;
@Autowired
private BetaCache betaCache;
@Autowired
private IGardsSampleDataSpectrumService sampleDataSpectrumService;
@Autowired
private IGardsSampleAuxSpectrumService sampleAuxSpectrumService;
@ -74,16 +79,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
@Autowired
private IGardsSampleCertLineSpectrumService sampleCertLineSpectrumService;
@Autowired
private IGardsCalibrationSpectrumService calibrationSpectrumService;
@Autowired
private IGardsROIChannelsSpectrumService roiChannelsSpectrumService;
@Autowired
private IGardsXeResultsSpectrumService xeResultsSpectrumService;
@Autowired
private IGardsROIResultsSpectrumService roiResultsSpectrumService;
@Autowired
private IGardsCalibrationPairsSpectrumService calibrationPairsSpectrumService;
@Autowired
private IGardsCalibrationPairsOrigSpectrumService calibrationPairsOrigSpectrumService;
@Autowired
private IGardsBgEfficiencyPairsSpectrumService bgEfficiencyPairsSpectrumService;
@ -1345,6 +1340,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
String qcPath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
//如果sampleId不为空
if (Objects.nonNull(sampleId)) {
@ -1463,6 +1460,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
map.put("min", min);
map.put("max", max);
map.put("gammaSpectrum", seriseDataList);
cacheMap.put("Series", oldScatterSeries);
cacheMap.put("fittingPara", fittingParaStr);
cache.put(qcFileName+"-"+userName+"-gamma", cacheMap);
betaCache.setBetaCache(cache);
}
}
} catch (IOException e) {
@ -1489,6 +1491,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
String qcPath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId)) {
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
@ -1609,6 +1613,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
fittingParaToUiStr.add(String.valueOf(para));
}
map.put("EToC", fittingParaToUiStr);
cacheMap.put("Series", oldScatterSeries);
cacheMap.put("fittingPara", fittingParaStr);
cache.put(qcFileName+"-"+userName+"-beta", cacheMap);
betaCache.setBetaCache(cache);
}
}
} catch (IOException e) {
@ -2181,8 +2190,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
@Override
public Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPoints, Integer count) {
public Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPoints, Integer count, String qcFileName, String tabName, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
Map<String, Object> map = new HashMap<>();
//加载dll工具库
System.loadLibrary("ReadPHDFile");
@ -2222,11 +2234,20 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
fittingParaToUiStr.add(String.valueOf(para));
}
map.put("EToC", fittingParaToUiStr);
}else {
cacheMap.put("Series", tempPoints);
cacheMap.put("fittingPara", fittingParaStr);
cache.put(qcFileName+"-"+userName+"-"+tabName, cacheMap);
betaCache.setBetaCache(cache);
} else {
List<Double> fittingPara = new LinkedList<>();
fittingPara.add(paramA);
fittingPara.add(paramB);
fittingPara.add(paramC);
List<String> fittingParaStr = new LinkedList<>();
fittingParaStr.add(String.valueOf(paramA));
fittingParaStr.add(String.valueOf(paramB));
fittingParaStr.add(String.valueOf(paramC));
List<Double> xs = new LinkedList<>();
for (int i=0; i<tempPoints.size(); i++){
xs.add(tempPoints.get(i).getX());
@ -2270,6 +2291,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
fittingParaToUiStr.add(String.valueOf(para));
}
map.put("EToC", fittingParaToUiStr);
cacheMap.put("Series", seriseDataList);
cacheMap.put("fittingPara", fittingParaStr);
cache.put(qcFileName+"-"+userName+"-"+tabName, cacheMap);
betaCache.setBetaCache(cache);
}
result.setSuccess(true);
result.setResult(map);
@ -2648,19 +2674,40 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
@Transactional
public Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request) {
Result result = new Result();
//根据请求体获取用户名
String userName = JwtUtil.getUserNameByToken(request);
//用户名赋值到 分析员
anlyseResultIn.setUserName(userName);
//从本地缓存获取beta gamma的数组
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(anlyseResultIn.getQcFileName() + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingPara = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingPara = (List<String>) betaMap.get("fittingPara");
}
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(anlyseResultIn.getQcFileName() + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingPara = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
}
//获取当前时间作为人工分析开始时间
String beginDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
//获取当前时间作为人工分析结束时间
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
//判断当前分析员是否有过排班任务
Integer stationId = spectrumAnalysisMapper.getStationId(anlyseResultIn.getStationName());
//判断当前分析员是否有过当前台站的排班任务
boolean bAnalysisResultWriteAuthority = userTaskUtil.CheckUserWriteAuthorityForStation(anlyseResultIn.getUserName(), stationId);
if ( !bAnalysisResultWriteAuthority ){
result.error500("This user has no right to store the results of the analysis to the database.");
return result;
}
//处理数据 获取对应的channel/energy值
getChannelAndEnergy(anlyseResultIn);
//获取ROI Limit数据
// getROILimit(anlyseResultIn);
//根据sample文件名称模糊查询sampleId
@ -2694,7 +2741,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
}
//处理数据 获取对应的channel/energy值
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
//分析文件内容
Map<String, Object> map = new HashMap<>();
analyzePHDFile(anlyseResultIn, betaFittingPara, gammaFittingPara, map);
//处理文件名称
String sampleFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
String gasFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
@ -2782,9 +2833,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
//gards_roi_channels数据表
List<GardsRoiChannels> roiChannelsList = new LinkedList<>();
getROIChannel(sampleId, idAnalysis, anlyseResultIn.getRoiChannelsSpectrumList(), roiChannelsList);
getROIChannel(gasId, idAnalysis, anlyseResultIn.getRoiChannelsSpectrumList(), roiChannelsList);
getROIChannel(detId, idAnalysis, anlyseResultIn.getRoiChannelsSpectrumList(), roiChannelsList);
getROIChannel(sampleId, idAnalysis, anlyseResultIn.getRoiChannelsSpectrumList(), roiChannelsList, DataTypeAbbr.SAMPLEPHD.getType());
getROIChannel(gasId, idAnalysis, anlyseResultIn.getRoiChannelsSpectrumList(), roiChannelsList, DataTypeAbbr.GASBKPHD.getType());
getROIChannel(detId, idAnalysis, anlyseResultIn.getRoiChannelsSpectrumList(), roiChannelsList, DataTypeAbbr.DETBKPHD.getType());
//如果分析过数据
if (Objects.nonNull(isExist)){
//删除gards_roi_channels数据表数据
@ -2815,7 +2866,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
}
//gards_roi_results数据表
List<GardsRoiResults> roiResultsSpectrumList = getROIResult(anlyseResultIn.getRoiResultsSpectrumList(), sampleId, idAnalysis, isExist);
List<GardsRoiResults> roiResultsSpectrumList = getROIResult(anlyseResultIn.getRoiResultsSpectrumList(), sampleId, idAnalysis);
if(Objects.nonNull(isExist)) {
//删除gards_roi_results数据表数据
spectrumAnalysisMapper.deleteROIResults(idAnalysis);
@ -2830,21 +2881,21 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
}
//上传本次文件到ftp人工交互存储路径下
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
try {
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
// File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
// File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
// File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
// try {
// ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
// ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
// ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
// } catch (FileNotFoundException e) {
// throw new RuntimeException(e);
// }
result.setSuccess(true);
return result;
}
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn) {
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List<SeriseData> betaList, List<SeriseData> gammaList) {
//获取ftp文件路径下临时文件
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
@ -2858,11 +2909,21 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (!anlyseResultIn.isBGammaEnergyValid()){
anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel);
anlyseResultIn.setG_energy_sample(sourceData.g_energy);
} else {
List<Double> channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList());
anlyseResultIn.setG_channel_sample(channels);
List<Double> energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
anlyseResultIn.setG_energy_sample(energys);
}
//没有点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮 channel/energy数据读取文件 如果点击过数据来源页面
if (!anlyseResultIn.isBGammaEnergyValid()){
anlyseResultIn.setB_channel_sample(sourceData.b_channel);
anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy);
} else {
List<Double> channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList());
anlyseResultIn.setB_channel_sample(channels);
List<Double> energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList());
anlyseResultIn.setB_energy_sample(energys);
}
} else {//如果没有勾选Energy Calibration页面下sample Data
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
@ -2878,10 +2939,20 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (!anlyseResultIn.isBGammaEnergyValid()){
anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel);
anlyseResultIn.setG_energy_gas(sourceData.g_energy);
} else {
List<Double> channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList());
anlyseResultIn.setG_channel_gas(channels);
List<Double> energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
anlyseResultIn.setG_energy_gas(energys);
}
if (!anlyseResultIn.isBGammaEnergyValid()){
anlyseResultIn.setB_channel_gas(sourceData.b_channel);
anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy);
} else {
List<Double> channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList());
anlyseResultIn.setB_channel_gas(channels);
List<Double> energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList());
anlyseResultIn.setB_energy_gas(energys);
}
} else {
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
@ -2897,10 +2968,20 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (!anlyseResultIn.isBGammaEnergyValid()){
anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel);
anlyseResultIn.setG_energy_det(sourceData.g_energy);
} else {
List<Double> channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList());
anlyseResultIn.setG_channel_det(channels);
List<Double> energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
anlyseResultIn.setG_energy_det(energys);
}
if (!anlyseResultIn.isBGammaEnergyValid()){
anlyseResultIn.setB_channel_det(sourceData.b_channel);
anlyseResultIn.setB_energy_det(sourceData.b_electron_energy);
} else {
List<Double> channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList());
anlyseResultIn.setB_channel_det(channels);
List<Double> energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList());
anlyseResultIn.setB_energy_det(energys);
}
} else {
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
@ -2912,6 +2993,203 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
}
public void analyzePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara, Map<String, Object> map) {
//根据文件路径 文件名称获取对应的临时文件
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
BgAnalyseResult bgAnalyseResult = null;
if (anlyseResultIn.isCheckSample() && anlyseResultIn.isCheckGas() && anlyseResultIn.isCheckDet()) {
bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
} else {
bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
}
List<GardsXeResults> xeResultsSpectrumList = new LinkedList<>();
GardsXeResults xe131m = new GardsXeResults();
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
xe131m.setConc(bgAnalyseResult.Xe131m_con);
xe131m.setConcErr(bgAnalyseResult.Xe131m_uncer);
xe131m.setLc(bgAnalyseResult.LC_Xe131m);
xe131m.setMdc(bgAnalyseResult.MDC_Xe131m);
xe131m.setNidFlag(anlyseResultIn.getXe131mFlag());
xeResultsSpectrumList.add(xe131m);
GardsXeResults xe133 = new GardsXeResults();
xe133.setNuclideName(XeNuclideName.XE_133.getType());
xe133.setConc(bgAnalyseResult.Xe133_con);
xe133.setConcErr(bgAnalyseResult.Xe133_uncer);
xe133.setLc(bgAnalyseResult.LC_Xe133);
xe133.setMdc(bgAnalyseResult.MDC_Xe133);
xe133.setNidFlag(anlyseResultIn.getXe133Flag());
xeResultsSpectrumList.add(xe133);
GardsXeResults xe133m = new GardsXeResults();
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
xe133m.setConc(bgAnalyseResult.Xe133m_con);
xe133m.setConcErr(bgAnalyseResult.Xe133m_uncer);
xe133m.setLc(bgAnalyseResult.LC_Xe133m);
xe133m.setMdc(bgAnalyseResult.MDC_Xe133m);
xe133m.setNidFlag(anlyseResultIn.getXe133mFlag());
xeResultsSpectrumList.add(xe133m);
GardsXeResults xe135 = new GardsXeResults();
xe135.setNuclideName(XeNuclideName.XE_135.getType());
xe135.setConc(bgAnalyseResult.Xe135_con);
xe135.setConcErr(bgAnalyseResult.Xe135_uncer);
xe135.setLc(bgAnalyseResult.LC_Xe135);
xe135.setMdc(bgAnalyseResult.MDC_Xe135);
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
xeResultsSpectrumList.add(xe135);
anlyseResultIn.setXeData(xeResultsSpectrumList);
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList = new LinkedList<>();
if (anlyseResultIn.isBGammaEnergyValid()) {
GardsCalibrationSpectrum gammaCalibrationS = new GardsCalibrationSpectrum();
gammaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
gammaCalibrationS.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
gammaCalibrationS.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
gammaCalibrationS.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
gammaCalibrationSpectrumList.add(gammaCalibrationS);
GardsCalibrationSpectrum gammaCalibrationG = new GardsCalibrationSpectrum();
gammaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
gammaCalibrationG.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
gammaCalibrationG.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
gammaCalibrationG.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
gammaCalibrationSpectrumList.add(gammaCalibrationG);
GardsCalibrationSpectrum gammaCalibrationD = new GardsCalibrationSpectrum();
gammaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
gammaCalibrationD.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
gammaCalibrationD.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
gammaCalibrationD.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
gammaCalibrationSpectrumList.add(gammaCalibrationD);
anlyseResultIn.setGammaCalibrationSpectrumList(gammaCalibrationSpectrumList);
} else {
GardsCalibrationSpectrum gammaCalibrationS = new GardsCalibrationSpectrum();
gammaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
gammaCalibrationS.setCoeff1(bgAnalyseResult.s_g_fitting_c_e.get(0));
gammaCalibrationS.setCoeff2(bgAnalyseResult.s_g_fitting_c_e.get(1));
gammaCalibrationS.setCoeff3(bgAnalyseResult.s_g_fitting_c_e.get(2));
gammaCalibrationSpectrumList.add(gammaCalibrationS);
GardsCalibrationSpectrum gammaCalibrationG = new GardsCalibrationSpectrum();
gammaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
gammaCalibrationG.setCoeff1(bgAnalyseResult.g_g_fitting_c_e.get(0));
gammaCalibrationG.setCoeff2(bgAnalyseResult.g_g_fitting_c_e.get(1));
gammaCalibrationG.setCoeff3(bgAnalyseResult.g_g_fitting_c_e.get(2));
gammaCalibrationSpectrumList.add(gammaCalibrationG);
GardsCalibrationSpectrum gammaCalibrationD = new GardsCalibrationSpectrum();
gammaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
gammaCalibrationD.setCoeff1(bgAnalyseResult.d_g_fitting_c_e.get(0));
gammaCalibrationD.setCoeff2(bgAnalyseResult.d_g_fitting_c_e.get(1));
gammaCalibrationD.setCoeff3(bgAnalyseResult.d_g_fitting_c_e.get(2));
gammaCalibrationSpectrumList.add(gammaCalibrationD);
anlyseResultIn.setGammaCalibrationSpectrumList(gammaCalibrationSpectrumList);
}
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
if (anlyseResultIn.isBBetaEnergyValid()) {
GardsCalibrationSpectrum betaCalibrationS = new GardsCalibrationSpectrum();
betaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
betaCalibrationS.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
betaCalibrationS.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
betaCalibrationS.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
betaCalibrationSpectrumList.add(betaCalibrationS);
GardsCalibrationSpectrum betaCalibrationG = new GardsCalibrationSpectrum();
betaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
betaCalibrationG.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
betaCalibrationG.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
betaCalibrationG.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
betaCalibrationSpectrumList.add(betaCalibrationG);
GardsCalibrationSpectrum betaCalibrationD = new GardsCalibrationSpectrum();
betaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
betaCalibrationD.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
betaCalibrationD.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
betaCalibrationD.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
betaCalibrationSpectrumList.add(betaCalibrationD);
} else {
GardsCalibrationSpectrum betaCalibrationS = new GardsCalibrationSpectrum();
betaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
betaCalibrationS.setCoeff1(bgAnalyseResult.s_b_fitting_c_e.get(0));
betaCalibrationS.setCoeff2(bgAnalyseResult.s_b_fitting_c_e.get(1));
betaCalibrationS.setCoeff3(bgAnalyseResult.s_b_fitting_c_e.get(2));
betaCalibrationSpectrumList.add(betaCalibrationS);
GardsCalibrationSpectrum betaCalibrationG = new GardsCalibrationSpectrum();
betaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
betaCalibrationG.setCoeff1(bgAnalyseResult.g_b_fitting_c_e.get(0));
betaCalibrationG.setCoeff2(bgAnalyseResult.g_b_fitting_c_e.get(1));
betaCalibrationG.setCoeff3(bgAnalyseResult.g_b_fitting_c_e.get(2));
betaCalibrationSpectrumList.add(betaCalibrationG);
GardsCalibrationSpectrum betaCalibrationD = new GardsCalibrationSpectrum();
betaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
betaCalibrationD.setCoeff1(bgAnalyseResult.d_b_fitting_c_e.get(0));
betaCalibrationD.setCoeff2(bgAnalyseResult.d_b_fitting_c_e.get(1));
betaCalibrationD.setCoeff3(bgAnalyseResult.d_b_fitting_c_e.get(2));
betaCalibrationSpectrumList.add(betaCalibrationD);
}
anlyseResultIn.setBetaCalibrationSpectrumList(betaCalibrationSpectrumList);
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
for (int i=0; i<bgAnalyseResult.S_ROI_B_Boundary_start.size(); i++) {
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
roiChannels.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(bgAnalyseResult.S_ROI_B_Boundary_start.get(i));
roiChannels.setBChanStop(bgAnalyseResult.S_ROI_B_Boundary_stop.get(i));
roiChannels.setGChanStart(bgAnalyseResult.S_ROI_G_Boundary_start.get(i));
roiChannels.setGChanStop(bgAnalyseResult.S_ROI_G_Boundary_stop.get(i));
roiChannelsSpectrumList.add(roiChannels);
}
for (int i=0; i<bgAnalyseResult.G_ROI_B_Boundary_start.size(); i++) {
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
roiChannels.setDataType(DataTypeAbbr.GASBKPHD.getType());
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(bgAnalyseResult.G_ROI_B_Boundary_start.get(i));
roiChannels.setBChanStop(bgAnalyseResult.G_ROI_B_Boundary_stop.get(i));
roiChannels.setGChanStart(bgAnalyseResult.G_ROI_G_Boundary_start.get(i));
roiChannels.setGChanStop(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i));
roiChannelsSpectrumList.add(roiChannels);
}
for (int i=0; i<bgAnalyseResult.D_ROI_B_Boundary_start.size(); i++) {
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
roiChannels.setDataType(DataTypeAbbr.DETBKPHD.getType());
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(bgAnalyseResult.D_ROI_B_Boundary_start.get(i));
roiChannels.setBChanStop(bgAnalyseResult.D_ROI_B_Boundary_stop.get(i));
roiChannels.setGChanStart(bgAnalyseResult.D_ROI_G_Boundary_start.get(i));
roiChannels.setGChanStop(bgAnalyseResult.D_ROI_G_Boundary_stop.get(i));
roiChannelsSpectrumList.add(roiChannels);
}
anlyseResultIn.setRoiChannelsSpectrumList(roiChannelsSpectrumList);
bgAnalyseResult.LC.add(0, 0.0);
bgAnalyseResult.MDC.add(0, 0.0);
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
for (int i=0; i<bgAnalyseResult.s_roi_cts.size(); i++) {
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
roiResults.setRoi(i+1);
roiResults.setLc(bgAnalyseResult.LC.get(i));
roiResults.setSGross(bgAnalyseResult.s_roi_cts.get(i));
roiResults.setGGross(bgAnalyseResult.g_roi_cts.get(i));
roiResults.setBGross(bgAnalyseResult.d_roi_cts.get(i));
roiResults.setSNet(bgAnalyseResult.s_deduct_d_cts.get((i+1)*3));
roiResults.setGNet(bgAnalyseResult.g_deduct_d_cts.get((i+1)*3));
roiResults.setNet(bgAnalyseResult.ROI_net_coutns.get(i));
roiResults.setNetErr(bgAnalyseResult.ROI_net_coutns_err.get(i));
roiResults.setConc(bgAnalyseResult.ROI_con_uncer.get(i));
roiResults.setConcErr(bgAnalyseResult.ROI_con_uncer_err.get(i));
roiResults.setMdc(bgAnalyseResult.MDC.get(i));
if(bgAnalyseResult.ROI_con_uncer.get(i)>bgAnalyseResult.MDC.get(i)) {
roiResults.setNidFlag(1);
} else {
roiResults.setNidFlag(0);
}
roiResultsSpectrumList.add(roiResults);
}
anlyseResultIn.setRoiResultsSpectrumList(roiResultsSpectrumList);
}
public List<GardsCalibrationPairs> getCalibrationPairs(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
List<GardsCalibrationPairs> calibrationPairsList = new LinkedList<>();
for (int i=0; i< anlyseResultIn.getB_channel_sample().size(); i++){
@ -3066,10 +3344,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
calibrationB.setFunctionDef(FittingType.POLY2.getDescription());
calibrationB.setStartOfRange(0);
calibrationB.setEndOfRange(1);
calibrationB.setCoeff1(Double.valueOf(anlyseResultIn.getParam_a_c2e_b_sample()));
calibrationB.setCoeff2(Double.valueOf(anlyseResultIn.getParam_b_c2e_b_sample()));
calibrationB.setCoeff3(Double.valueOf(anlyseResultIn.getParam_c_c2e_b_sample()));
List<GardsCalibrationSpectrum> betaCollect = anlyseResultIn.getBetaCalibrationSpectrumList().stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
GardsCalibrationSpectrum betaCalibrationSpectrum = betaCollect.get(0);
calibrationB.setCoeff1(Double.valueOf(betaCalibrationSpectrum.getCoeff1()));
calibrationB.setCoeff2(Double.valueOf(betaCalibrationSpectrum.getCoeff2()));
calibrationB.setCoeff3(Double.valueOf(betaCalibrationSpectrum.getCoeff3()));
calibrationSpectrumList.add(calibrationB);
GardsCalibration calibrationG = new GardsCalibration();
calibrationG.setSampleId(sampleId);
calibrationG.setIdAnalysis(idAnalysis);
@ -3079,13 +3360,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
calibrationG.setFunctionDef(FittingType.POLY2.getDescription());
calibrationG.setStartOfRange(0);
calibrationG.setEndOfRange(1);
calibrationG.setCoeff1(Double.valueOf(anlyseResultIn.getParam_a_c2e_g_sample()));
calibrationG.setCoeff2(Double.valueOf(anlyseResultIn.getParam_b_c2e_g_sample()));
calibrationG.setCoeff3(Double.valueOf(anlyseResultIn.getParam_c_c2e_g_sample()));
List<GardsCalibrationSpectrum> gammaCollect = anlyseResultIn.getGammaCalibrationSpectrumList().stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
GardsCalibrationSpectrum gammaCalibrationSpectrum = gammaCollect.get(0);
calibrationG.setCoeff1(Double.valueOf(gammaCalibrationSpectrum.getCoeff1()));
calibrationG.setCoeff2(Double.valueOf(gammaCalibrationSpectrum.getCoeff2()));
calibrationG.setCoeff3(Double.valueOf(gammaCalibrationSpectrum.getCoeff3()));
calibrationSpectrumList.add(calibrationG);
}
if (Objects.nonNull(gasId)) {
//gas文件 Beta部分
GardsCalibration calibrationB = new GardsCalibration();
calibrationB.setSampleId(gasId);
calibrationB.setIdAnalysis(idAnalysis);
@ -3095,10 +3379,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
calibrationB.setFunctionDef(FittingType.POLY2.getDescription());
calibrationB.setStartOfRange(0);
calibrationB.setEndOfRange(1);
calibrationB.setCoeff1(Double.valueOf(anlyseResultIn.getParam_a_c2e_b_gas()));
calibrationB.setCoeff2(Double.valueOf(anlyseResultIn.getParam_b_c2e_b_gas()));
calibrationB.setCoeff3(Double.valueOf(anlyseResultIn.getParam_c_c2e_b_gas()));
List<GardsCalibrationSpectrum> betaCollect = anlyseResultIn.getBetaCalibrationSpectrumList().stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
GardsCalibrationSpectrum betaCalibrationSpectrum = betaCollect.get(0);
calibrationB.setCoeff1(Double.valueOf(betaCalibrationSpectrum.getCoeff1()));
calibrationB.setCoeff2(Double.valueOf(betaCalibrationSpectrum.getCoeff2()));
calibrationB.setCoeff3(Double.valueOf(betaCalibrationSpectrum.getCoeff3()));
calibrationSpectrumList.add(calibrationB);
//gas文件 gamma部分
GardsCalibration calibrationG = new GardsCalibration();
calibrationG.setSampleId(gasId);
calibrationG.setIdAnalysis(idAnalysis);
@ -3108,9 +3395,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
calibrationG.setFunctionDef(FittingType.POLY2.getDescription());
calibrationG.setStartOfRange(0);
calibrationG.setEndOfRange(1);
calibrationG.setCoeff1(Double.valueOf(anlyseResultIn.getParam_a_c2e_g_gas()));
calibrationG.setCoeff2(Double.valueOf(anlyseResultIn.getParam_b_c2e_g_gas()));
calibrationG.setCoeff3(Double.valueOf(anlyseResultIn.getParam_c_c2e_g_gas()));
List<GardsCalibrationSpectrum> gammaCollect = anlyseResultIn.getGammaCalibrationSpectrumList().stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
GardsCalibrationSpectrum gammaCalibrationSpectrum = gammaCollect.get(0);
calibrationG.setCoeff1(Double.valueOf(gammaCalibrationSpectrum.getCoeff1()));
calibrationG.setCoeff2(Double.valueOf(gammaCalibrationSpectrum.getCoeff2()));
calibrationG.setCoeff3(Double.valueOf(gammaCalibrationSpectrum.getCoeff3()));
calibrationSpectrumList.add(calibrationG);
}
@ -3124,9 +3413,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
calibrationB.setFunctionDef(FittingType.POLY2.getDescription());
calibrationB.setStartOfRange(0);
calibrationB.setEndOfRange(1);
calibrationB.setCoeff1(Double.valueOf(anlyseResultIn.getParam_a_c2e_b_det()));
calibrationB.setCoeff2(Double.valueOf(anlyseResultIn.getParam_b_c2e_b_det()));
calibrationB.setCoeff3(Double.valueOf(anlyseResultIn.getParam_c_c2e_b_det()));
List<GardsCalibrationSpectrum> betaCollect = anlyseResultIn.getBetaCalibrationSpectrumList().stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
GardsCalibrationSpectrum betaCalibrationSpectrum = betaCollect.get(0);
calibrationB.setCoeff1(Double.valueOf(betaCalibrationSpectrum.getCoeff1()));
calibrationB.setCoeff2(Double.valueOf(betaCalibrationSpectrum.getCoeff2()));
calibrationB.setCoeff3(Double.valueOf(betaCalibrationSpectrum.getCoeff3()));
calibrationSpectrumList.add(calibrationB);
GardsCalibration calibrationG = new GardsCalibration();
calibrationG.setSampleId(detId);
@ -3137,15 +3428,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
calibrationG.setFunctionDef(FittingType.POLY2.getDescription());
calibrationG.setStartOfRange(0);
calibrationG.setEndOfRange(1);
calibrationG.setCoeff1(Double.valueOf(anlyseResultIn.getParam_a_c2e_g_det()));
calibrationG.setCoeff2(Double.valueOf(anlyseResultIn.getParam_b_c2e_g_det()));
calibrationG.setCoeff3(Double.valueOf(anlyseResultIn.getParam_c_c2e_g_det()));
List<GardsCalibrationSpectrum> gammaCollect = anlyseResultIn.getGammaCalibrationSpectrumList().stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
GardsCalibrationSpectrum gammaCalibrationSpectrum = gammaCollect.get(0);
calibrationG.setCoeff1(Double.valueOf(gammaCalibrationSpectrum.getCoeff1()));
calibrationG.setCoeff2(Double.valueOf(gammaCalibrationSpectrum.getCoeff2()));
calibrationG.setCoeff3(Double.valueOf(gammaCalibrationSpectrum.getCoeff3()));
calibrationSpectrumList.add(calibrationG);
}
return calibrationSpectrumList;
}
public void getROIChannel(Integer sampleId, Integer idAnalysis, List<GardsROIChannelsSpectrum> roiChannelsSpectrumList, List<GardsRoiChannels> roiChannelsList) {
public void getROIChannel(Integer sampleId, Integer idAnalysis, List<GardsROIChannelsSpectrum> roiChannelsSpectrumList, List<GardsRoiChannels> roiChannelsList, String dataType) {
roiChannelsSpectrumList = roiChannelsSpectrumList.stream().filter(item-> item.getDataType().equals(dataType)).collect(Collectors.toList());
for (int i=0; i<roiChannelsSpectrumList.size(); i++){
GardsRoiChannels roiChannels = new GardsRoiChannels();
roiChannels.setSampleId(sampleId);
@ -3209,51 +3503,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
}
public List<GardsXeResults> getXeResults(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer idAnalysis) {
List<GardsXeResults> xeResultsList = new LinkedList<>();
//Xe131m
GardsXeResults xe131m = new GardsXeResults();
xe131m.setSampleId(sampleId);
xe131m.setIdAnalysis(idAnalysis);
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
xe131m.setConc(anlyseResultIn.getXe131m_con());
xe131m.setConcErr(anlyseResultIn.getXe131m_uncer());
xe131m.setMdc(anlyseResultIn.getMdc_Xe131m());
xe131m.setLc(anlyseResultIn.getLc_Xe131m());
xe131m.setNidFlag(anlyseResultIn.getXe131mFlag());
xeResultsList.add(xe131m);
//Xe133
GardsXeResults xe133 = new GardsXeResults();
xe133.setSampleId(sampleId);
xe133.setIdAnalysis(idAnalysis);
xe133.setNuclideName(XeNuclideName.XE_133.getType());
xe133.setConc(anlyseResultIn.getXe133_con());
xe133.setConcErr(anlyseResultIn.getXe133_uncer());
xe133.setMdc(anlyseResultIn.getMdc_Xe133());
xe133.setLc(anlyseResultIn.getLc_Xe133());
xe133.setNidFlag(anlyseResultIn.getXe133Flag());
xeResultsList.add(xe133);
//Xe133m
GardsXeResults xe133m = new GardsXeResults();
xe133m.setSampleId(sampleId);
xe133m.setIdAnalysis(idAnalysis);
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
xe133m.setConc(anlyseResultIn.getXe133m_con());
xe133m.setConcErr(anlyseResultIn.getXe133m_uncer());
xe133m.setMdc(anlyseResultIn.getMdc_Xe133m());
xe133m.setLc(anlyseResultIn.getLc_Xe133m());
xe133m.setNidFlag(anlyseResultIn.getXe133mFlag());
xeResultsList.add(xe133m);
//Xe135
GardsXeResults xe135 = new GardsXeResults();
xe135.setSampleId(sampleId);
xe135.setIdAnalysis(idAnalysis);
xe135.setNuclideName(XeNuclideName.XE_135.getType());
xe135.setConc(anlyseResultIn.getXe135_con());
xe135.setConcErr(anlyseResultIn.getXe135_uncer());
xe135.setMdc(anlyseResultIn.getMdc_Xe135());
xe135.setLc(anlyseResultIn.getLc_Xe135());
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
xeResultsList.add(xe135);
List<GardsXeResults> xeResultsList = anlyseResultIn.getXeData();
for (GardsXeResults xeResults:xeResultsList) {
xeResults.setIdAnalysis(idAnalysis);
xeResults.setSampleId(sampleId);
}
return xeResultsList;
}
@ -3377,7 +3631,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
return readLines;
}
public List<GardsRoiResults> getROIResult(List<GardsROIResultsSpectrum> roiResultsSpectrumList, Integer sampleId, Integer idAnalysis, Integer isExist) {
public List<GardsRoiResults> getROIResult(List<GardsROIResultsSpectrum> roiResultsSpectrumList, Integer sampleId, Integer idAnalysis) {
List<GardsRoiResults> roiResultsList = new LinkedList<>();
for (int i=0; i<roiResultsSpectrumList.size(); i++) {
GardsRoiResults roiResults = new GardsRoiResults();