人工交互模块计算mdc的数据来源改为读取全核素信息

新增人工交互启动时缓存全核素信息方法
This commit is contained in:
qiaoqinzheng 2024-01-09 18:46:04 +08:00
parent a4568a528e
commit a573f651dd
6 changed files with 86 additions and 4 deletions

View File

@ -80,6 +80,8 @@ public interface SpectrumAnalysisMapper {
List<HalfData> getHalf(@Param(value = "names") List<String> names);
HalfData getOneHalf(@Param(value = "name") String name);
List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName);
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
@ -175,4 +177,6 @@ public interface SpectrumAnalysisMapper {
Integer getSampleIdLikeFileName(@Param(value = "fileName") String fileName);
List<String> findNuclidesAnalysis();
}

View File

@ -589,6 +589,15 @@
</foreach>
</select>
<select id="getOneHalf" resultType="org.jeecg.modules.entity.vo.HalfData">
SELECT
NAME as name,
HALFLIFE as half
FROM
CONFIGURATION.GARDS_NUCL_LIB
WHERE NAME = #{name}
</select>
<select id="UserNuclide" resultType="java.lang.String">
SELECT nuclide_name FROM sys_default_nuclide where use_type = 3 and nuclide_type = #{systemType} and create_by = #{userName}
</select>
@ -1084,4 +1093,8 @@
select SAMPLE_ID from ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME LIKE CONCAT('%', #{fileName})
</select>
<select id="findNuclidesAnalysis" resultType="java.lang.String">
select NAME from CONFIGURATION.GARDS_NUCL_LIB
</select>
</mapper>

View File

@ -9,4 +9,6 @@ public interface IGardsNuclIdedSpectrumService extends IService<GardsNuclIded> {
int saveNuclIdedGamma(GStoreMiddleProcessData middleData, Integer sampleId, String idAnalysis);
void getNuclideMap();
}

View File

@ -24,6 +24,7 @@ import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.system.util.JwtUtil;
@ -1280,7 +1281,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0);
// 重新计算峰值
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMap);
Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
String warning = "Finish three tasks:\n" +
"\t1.Update efficiencies of all peaks;\n" +
"\t2.Identify nuclides again;\n" +
@ -1295,7 +1297,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0);
// 重新计算峰值
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMap);
Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
Map<String, Object> map = new HashMap<>();
gammaFileUtil.UpdateChart(phd, map, colorMap);
// 更新 QC Flags 状态

View File

@ -2,21 +2,39 @@ package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
import org.jeecg.modules.base.enums.SystemType;
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData;
import org.jeecg.modules.entity.vo.HalfData;
import org.jeecg.modules.entity.vo.NuclideLine;
import org.jeecg.modules.entity.vo.NuclideLines;
import org.jeecg.modules.mapper.GardsNuclIdedSpectrumMapper;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.mapper.SysDefaultNuclideSpectrumMapper;
import org.jeecg.modules.service.IGardsNuclIdedSpectrumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.LinkedList;
import java.util.List;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
import java.util.stream.Collectors;
@Service("gardsNuclIdedSpectrumService")
@DS("ora")
public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl<GardsNuclIdedSpectrumMapper, GardsNuclIded> implements IGardsNuclIdedSpectrumService {
@Autowired
private SpectrumAnalysisMapper spectrumAnalysisMapper;
@Autowired
private RedisUtil redisUtil;
@Override
@Transactional
@ -54,4 +72,42 @@ public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl<GardsNuclIdedS
return nuclIdedList.size();
}
@Override
public void getNuclideMap() {
List<String> nuclideLibs = spectrumAnalysisMapper.findNuclidesAnalysis();
Map<String, NuclideLines> nuclideMap = GetNuclideLines(nuclideLibs);
redisUtil.set("AllNuclideMap", nuclideMap);
}
public Map<String, NuclideLines> GetNuclideLines(List<String> nuclideList) {
Map<String, NuclideLines> mapLines = new HashMap<>();
if (nuclideList.size() < 1) {
return mapLines;
}
for (String name : nuclideList) {
NuclideLines nlines = new NuclideLines();
List<NuclideLine> nuclideLineList = spectrumAnalysisMapper.getNuclideLines(name);
for (int j = 0; j < nuclideLineList.size(); j++) {
nlines.getFullNames().add(nuclideLineList.get(j).getFullName());
nlines.getVenergy().add(nuclideLineList.get(j).getEnergy());
nlines.getVuncertE().add(nuclideLineList.get(j).getEnergyUncert());
nlines.getVyield().add(nuclideLineList.get(j).getYield() / 100);
nlines.getVuncertY().add(nuclideLineList.get(j).getYieldUncert());
if (Objects.nonNull(nuclideLineList.get(j).getKeyFlag()) && nuclideLineList.get(j).getKeyFlag().intValue() > 0) {
nlines.key_flag = j;
nlines.maxYeildIdx = j;
}
}
mapLines.put(name, nlines);
}
for (String name:nuclideList) {
HalfData half = spectrumAnalysisMapper.getOneHalf(name);
NuclideLines nuclideLines = mapLines.get(half.getName());
nuclideLines.setHalflife(half.getHalf() == null ? 0 : half.getHalf() * 86400);// 将天转换成秒
mapLines.put(half.getName(), nuclideLines);
}
return mapLines;
}
}

View File

@ -7,6 +7,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.service.IDataService;
import org.jeecg.modules.service.IGammaService;
import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService;
import org.jeecg.modules.service.IGardsNuclIdedSpectrumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@ -35,6 +36,8 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Autowired
private IGardsNuclCoincidenceSumSpectrumService nuclCoincidenceSumSpectrumService;
@Autowired
private IGardsNuclIdedSpectrumService nuclIdedSpectrumService;
@Autowired
private IDataService dataService;
@ -69,6 +72,7 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
betaCache.initCache();
localCache.initCache();
gammaService.readMDCParameter();
nuclIdedSpectrumService.getNuclideMap();
nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap();
dataService.viewStations();
}