beta功能分析Statistics页面内容增加xeResultFlag查询过滤条件

gamma功能核素相关内容查询速度优化
This commit is contained in:
qiaoqinzheng 2023-11-16 15:33:54 +08:00
parent a36a101a08
commit 12bdd63d4b
5 changed files with 170 additions and 74 deletions

View File

@ -46,4 +46,6 @@ public class ConfigureData implements Serializable {
@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
private Date refTime_conc;
private boolean applyAll;
}

View File

@ -12,6 +12,7 @@ public class NuclideLines implements Serializable {
public List<Double> venergy; // 核素的所有γ射线能量
public List<Double> vuncertE;
public List<Double> vyield; // 核素γ射线分支比
public List<Double> vuncertY;

View File

@ -27,6 +27,8 @@ public class StatisticsQueryData implements Serializable {
private boolean filterGrpbox;
private boolean xeResultFlag;
private List<String> nuclidesList;
private String minCollectTimeLine;

View File

@ -252,10 +252,13 @@
<if test="statisticsQueryData.filterGrpbox == true">
and round(to_number(gsd.COLLECT_STOP-gsd.COLLECT_START)*24,2) BETWEEN #{statisticsQueryData.minCollectTimeLine} and #{statisticsQueryData.maxCollectTimeLine}
and ROUND(GSD.ACQUISITION_LIVE_SEC/60/60.00,2) BETWEEN #{statisticsQueryData.minAcqLiveLine} and #{statisticsQueryData.maxAcqLiveLine}
and GSD.QUANTITY>#{statisticsQueryData.quantityLine}
and gsa.xe_volume>#{statisticsQueryData.xeVolumeLine}
and gxr.mdc>#{statisticsQueryData.mdcLine}
and gxr.conc>#{statisticsQueryData.concLine}
and GSD.QUANTITY > #{statisticsQueryData.quantityLine}
and gsa.xe_volume > #{statisticsQueryData.xeVolumeLine}
and gxr.mdc > #{statisticsQueryData.mdcLine}
and gxr.conc > #{statisticsQueryData.concLine}
<if test="statisticsQueryData.xeResultFlag == true">
and GXR.NID_FLAG = 1
</if>
</if>
<if test="statisticsQueryData.detectorList.size == 0 and statisticsQueryData.detectorList!=null">
and gsd.SITE_DET_CODE IN ('')

View File

@ -172,7 +172,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
// 从数据库中读取phd其他相关信息
boolean bRet = getResultFromDB(dbName, analyst, sampleId, phd, result);
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) {
// 查询当前用户关联的核素信息
List<String> userLib = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
@ -182,6 +182,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
userLib = userLib.stream().sorted().collect(Collectors.toList());
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
}
// 判断数据库信息是否读取正常
@ -198,7 +199,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!bRet) {
return result;
}
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) {
// 查询当前用户关联的核素信息
List<String> userLib = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
@ -208,6 +209,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
userLib = userLib.stream().sorted().collect(Collectors.toList());
Map<String, NuclideLines> nuclideMap = GetNuclideLinesLocal(userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
}
key = fileName + "-" + userName;
@ -470,7 +472,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
// 从数据库中读取phd其他相关信息
boolean bRet = getResultFromDB(dbName, analyst, sampleId, phd, result);
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) {
// 查询当前用户关联的核素信息
List<String> userLib = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
@ -480,6 +482,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
userLib = userLib.stream().sorted().collect(Collectors.toList());
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
}
// 判断数据库信息是否读取正常
@ -836,7 +839,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!bRet) {
return result;
}
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) {
if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) {
// 查询当前用户关联的核素信息
List<String> userLib = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
@ -845,7 +848,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
}
userLib = userLib.stream().sorted().collect(Collectors.toList());
Map<String, NuclideLines> nuclideMap = GetNuclideLinesLocal(userLib);//GetNuclideLinesLocal(userLib);
Map<String, NuclideLines> nuclideMap = GetNuclideLinesLocal(userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
}
}
@ -998,26 +1002,52 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String userName = JwtUtil.getUserNameByToken(request);
String fileName = configureData.getFileName();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
if (configureData.isApplyAll()) {
for (String key: phdCache.asMap().keySet()) {
PHDFile phd = phdCache.getIfPresent(key);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
}
SpecSetup phdSetting = phd.getSetting();
phdSetting.setECutAnalysis_Low(configureData.getECutAnalysis_Low());
phdSetting.setECutAnalysis_High(configureData.getECutAnalysis_High());
phdSetting.setEnergyTolerance(configureData.getEnergyTolerance());
phdSetting.setPss_low(configureData.getPss_low());
phdSetting.setBaseImprovePSS(configureData.getBaseImprovePSS());
phdSetting.setK_back(configureData.getK_back());
phdSetting.setK_alpha(configureData.getK_alpha());
phdSetting.setK_beta(configureData.getK_beta());
phdSetting.setRiskLevelK(configureData.getRiskLevelK());
phdSetting.setBUpdateCal(configureData.isUpdateCalibration());
phdSetting.setKeepCalPeakSearchPeaks(configureData.isKeepCalPeakSearchPeaks());
phdSetting.setRefTime_act(configureData.getRefTime_act());
phdSetting.setRefTime_conc(configureData.getRefTime_conc());
}
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
} else {
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
}
SpecSetup phdSetting = phd.getSetting();
phdSetting.setECutAnalysis_Low(configureData.getECutAnalysis_Low());
phdSetting.setECutAnalysis_High(configureData.getECutAnalysis_High());
phdSetting.setEnergyTolerance(configureData.getEnergyTolerance());
phdSetting.setPss_low(configureData.getPss_low());
phdSetting.setBaseImprovePSS(configureData.getBaseImprovePSS());
phdSetting.setK_back(configureData.getK_back());
phdSetting.setK_alpha(configureData.getK_alpha());
phdSetting.setK_beta(configureData.getK_beta());
phdSetting.setRiskLevelK(configureData.getRiskLevelK());
phdSetting.setBUpdateCal(configureData.isUpdateCalibration());
phdSetting.setKeepCalPeakSearchPeaks(configureData.isKeepCalPeakSearchPeaks());
phdSetting.setRefTime_act(configureData.getRefTime_act());
phdSetting.setRefTime_conc(configureData.getRefTime_conc());
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
}
SpecSetup phdSetting = phd.getSetting();
phdSetting.setECutAnalysis_Low(configureData.getECutAnalysis_Low());
phdSetting.setECutAnalysis_High(configureData.getECutAnalysis_High());
phdSetting.setEnergyTolerance(configureData.getEnergyTolerance());
phdSetting.setPss_low(configureData.getPss_low());
phdSetting.setBaseImprovePSS(configureData.getBaseImprovePSS());
phdSetting.setK_back(configureData.getK_back());
phdSetting.setK_alpha(configureData.getK_alpha());
phdSetting.setK_beta(configureData.getK_beta());
phdSetting.setRiskLevelK(configureData.getRiskLevelK());
phdSetting.setBUpdateCal(configureData.isUpdateCalibration());
phdSetting.setKeepCalPeakSearchPeaks(configureData.isKeepCalPeakSearchPeaks());
phdSetting.setRefTime_act(configureData.getRefTime_act());
phdSetting.setRefTime_conc(configureData.getRefTime_conc());
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
result.success("Save successfully");
result.setResult(map);
return result;
@ -1653,16 +1683,32 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
int index = gammaFileUtil.FindNearPeak(phd.getVPeak(), channel, false);
// 查询当前用户关联的核素信息
List<String> userLib = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
if (CollectionUtils.isEmpty(userLib)) {
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
}
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
//计算核素范围的最小能量值
double min = phd.getVPeak().get(index).energy - phd.getSetting().getEnergyTolerance();
//计算核素范围的最大能量值
double max = phd.getVPeak().get(index).energy + phd.getSetting().getEnergyTolerance();
List<String> list_possible = spectrumAnalysisMapper.getPossibleNuclide(userLib, min, max);
//声明返回的数组内容
List<String> list_possible = new LinkedList<>();
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
list_possible.add(entry.getKey());
break;
}
}
}
}
// 用户当前已选中的核素名称
List<String> list_identify = phd.getVPeak().get(index).nuclides;
@ -1699,7 +1745,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// 根据要进行修改的列的数据下标 操作Vpeak数据
phd.getVPeak().get(curRow).nuclides.add(nuclideName);
// 查询当前用户所关心的核素名称
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(userLib);
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
// 查询出核素信息
NuclideLines it_line = mapNucLines.get(nuclideName);
// 如果核素信息不存在返回
@ -1884,14 +1930,30 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
BigDecimal bigDecimal = BigDecimal.valueOf(value);
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
map.put("energy", bigDecimal);
// 查询当前用户关联的核素信息
List<String> nuclides = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
if (CollectionUtils.isEmpty(nuclides)) {
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
//返回的核素列信息
List<String> nuclideList = new LinkedList<>();
double min = bigDecimal.doubleValue() - 0.5;
double max = bigDecimal.doubleValue() + 0.5;
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclideList.add(entry.getKey());
break;
}
}
}
}
List<String> nuclideList = InitList(bigDecimal.doubleValue(), 0.5, nuclides);
if (CollectionUtils.isNotEmpty(nuclideList)) {
map.put("list", nuclideList);
String name = nuclideList.get(0);
@ -1910,15 +1972,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result;
}
public List<String> InitList(double energy, double tolerance, List<String> nuclides) {
if (nuclides.size() < 1) {
return new LinkedList<>();
}
double min = energy - tolerance;
double max = energy + tolerance;
List<String> nuclideList = spectrumAnalysisMapper.findNuclideList(min, max, nuclides);
return nuclideList;
}
// public List<String> InitList(double energy, double tolerance, List<String> nuclides) {
// if (nuclides.size() < 1) {
// return new LinkedList<>();
// }
// double min = energy - tolerance;
// double max = energy + tolerance;
// List<String> nuclideList = spectrumAnalysisMapper.findNuclideList(min, max, nuclides);
// return nuclideList;
// }
public void InitTable(String name, Map<String, Object> map, PHDFile phd, Map<String, String> colorMap) {
InitNuclideInfo(name, map);
@ -2017,14 +2079,30 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
BigDecimal bigDecimal = BigDecimal.valueOf(energy);
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
map.put("energy", bigDecimal);
// 查询当前用户关联的核素信息
List<String> nuclides = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
if (CollectionUtils.isEmpty(nuclides)) {
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
//返回的核素列信息
List<String> nuclideList = new LinkedList<>();
double min = bigDecimal.doubleValue() - tolerance;
double max = bigDecimal.doubleValue() + tolerance;
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclideList.add(entry.getKey());
break;
}
}
}
}
List<String> nuclideList = InitList(bigDecimal.doubleValue(), tolerance, nuclides);
if (CollectionUtils.isNotEmpty(nuclideList)) {
map.put("list", nuclideList);
String name = nuclideList.get(0);
@ -3433,12 +3511,26 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
double min = editEnergyDou - err;
double max = editEnergyDou + err;
if (libraryName.equals("UserLibrary")) {
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
if (CollectionUtils.isEmpty(nuclides)) {
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclides.add(entry.getKey());
break;
}
}
}
}
nuclides = spectrumAnalysisMapper.getUserNuclideNames(nuclides, min, max);
} else if (libraryName.equals("FULLLibrary")) {
nuclides = spectrumAnalysisMapper.getFULLNuclideNames(min, max);
} else if (libraryName.equals("RelevantLibrary")) {
@ -3446,11 +3538,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
} else {
if (libraryName.equals("UserLibrary")) {
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
if (CollectionUtils.isEmpty(nuclides)) {
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
}
//redis中获取缓存的用户关注核素信息
nuclides = (List<String>)redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()+"-list");
} else if (libraryName.equals("FULLLibrary")) {
nuclides = spectrumAnalysisMapper.getNuclideNames("CONFIGURATION.GARDS_NUCL_LIB");
} else if (libraryName.equals("RelevantLibrary")) {
@ -3581,10 +3670,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result;
}
List<String> nuclides = spectrumAnalysisMapper.getNuclideNames("CONFIGURATION.GARDS_NUCL_LIB");
List<String> userNuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
if (CollectionUtils.isEmpty(userNuclides)) {
userNuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
}
//redis中获取缓存的用户关注核素信息
List<String> userNuclides = (List<String>)redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()+"-list");
map.put("AllNuclides", nuclides);
map.put("UserNuclides", userNuclides);
result.setSuccess(true);
@ -3618,6 +3705,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
}
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap);
} else {
result.success("Modification failure");