fix:修复新beta 保存到数据库失败问题
This commit is contained in:
parent
979f24a10c
commit
9a7cdbe1ed
|
@ -54,8 +54,9 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//存储页面操作数据
|
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
||||||
SelfStationVueData selfStationVueData = new SelfStationVueData();
|
SelfStationVueData detVueData = selfStationData.getDetVueData();
|
||||||
|
|
||||||
//封装散点图下的基础数据信息
|
//封装散点图下的基础数据信息
|
||||||
SpectrumData spectrumData = new SpectrumData();
|
SpectrumData spectrumData = new SpectrumData();
|
||||||
//Station Code
|
//Station Code
|
||||||
|
@ -119,7 +120,6 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
spectrumData.setMeasurementId(measurementId);
|
spectrumData.setMeasurementId(measurementId);
|
||||||
map.put("spectrumData", spectrumData);
|
map.put("spectrumData", spectrumData);
|
||||||
|
|
||||||
//计算边界值
|
|
||||||
//gamma能量部分的计算参数 道值对应能量
|
//gamma能量部分的计算参数 道值对应能量
|
||||||
List<Double> gEnergy = struct.g_energy;
|
List<Double> gEnergy = struct.g_energy;
|
||||||
//gamma能量部分的计算参数 道值
|
//gamma能量部分的计算参数 道值
|
||||||
|
@ -144,92 +144,9 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
List<Integer> roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start;
|
List<Integer> roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start;
|
||||||
List<Integer> roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop;
|
List<Integer> roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop;
|
||||||
|
|
||||||
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
|
||||||
SelfStationVueData detVueData = selfStationData.getDetVueData();
|
|
||||||
|
|
||||||
//根据范围1划分 范围1对应的折线图
|
//根据范围1划分 范围1对应的折线图
|
||||||
Map<String, Object> oneMap = statisticsROIList(roiBBoundaryStart.get(0), roiBBoundaryStop.get(0), struct.b_channels, struct.g_channels, struct.h_counts);
|
Map<String, Object> gammaByROI = this.getGammaByROI(systemType, roiBBoundaryStart, roiBBoundaryStop, selfStationData);
|
||||||
if (CollectionUtils.isNotEmpty(oneMap) ) {
|
map.putAll(gammaByROI);
|
||||||
Integer startChannel = (Integer) oneMap.get("startChannel");
|
|
||||||
Integer endChannel = (Integer) oneMap.get("endChannel");
|
|
||||||
List<SeriseData> seriseDataList = (List<SeriseData>) oneMap.get("dataList");
|
|
||||||
if (systemType.equals("sample")) {
|
|
||||||
sampleVueData.setROIOneBetaStart(startChannel);
|
|
||||||
sampleVueData.setROIOneBetaStop(endChannel);
|
|
||||||
sampleVueData.setROIOneList(seriseDataList);
|
|
||||||
sampleVueData.setROIOneCounts((List<Long>)oneMap.get("counts"));
|
|
||||||
} else if (systemType.equals("det")) {
|
|
||||||
detVueData.setROIOneBetaStart(startChannel);
|
|
||||||
detVueData.setROIOneBetaStop(endChannel);
|
|
||||||
detVueData.setROIOneList(seriseDataList);
|
|
||||||
}
|
|
||||||
map.put("ROIOneStart", roiBBoundaryStart.get(0));
|
|
||||||
map.put("ROIOneStop", roiBBoundaryStop.get(0));
|
|
||||||
map.put("ROIOneList", seriseDataList);
|
|
||||||
}
|
|
||||||
//根据范围2划分 范围2对应的折线图
|
|
||||||
Map<String, Object> twoMap = statisticsROIList(roiBBoundaryStart.get(1), roiBBoundaryStop.get(1),
|
|
||||||
struct.b_channels, struct.g_channels, struct.h_counts);
|
|
||||||
if ( CollectionUtils.isNotEmpty(twoMap) ) {
|
|
||||||
Integer startChannel = (Integer) twoMap.get("startChannel");
|
|
||||||
Integer endChannel = (Integer) twoMap.get("endChannel");
|
|
||||||
List<SeriseData> seriseDataList = (List<SeriseData>) twoMap.get("dataList");
|
|
||||||
if (systemType.equals("sample")) {
|
|
||||||
sampleVueData.setROITwoBetaStart(startChannel);
|
|
||||||
sampleVueData.setROITwoBetaStop(endChannel);
|
|
||||||
sampleVueData.setROITwoList(seriseDataList);
|
|
||||||
sampleVueData.setROITwoCounts((List<Long>)twoMap.get("counts"));
|
|
||||||
} else if (systemType.equals("det")) {
|
|
||||||
detVueData.setROITwoBetaStart(startChannel);
|
|
||||||
detVueData.setROITwoBetaStop(endChannel);
|
|
||||||
detVueData.setROITwoList(seriseDataList);
|
|
||||||
}
|
|
||||||
map.put("ROITwoStart", roiBBoundaryStart.get(1));
|
|
||||||
map.put("ROITwoStop", roiBBoundaryStop.get(1));
|
|
||||||
map.put("ROITwoList", seriseDataList);
|
|
||||||
}
|
|
||||||
//根据范围3划分 范围3对应的折线图
|
|
||||||
Map<String, Object> threeMap = statisticsROIList(roiBBoundaryStart.get(2), roiBBoundaryStop.get(2),
|
|
||||||
struct.b_channels, struct.g_channels, struct.h_counts);
|
|
||||||
if ( CollectionUtils.isNotEmpty(threeMap) ) {
|
|
||||||
Integer startChannel = (Integer) threeMap.get("startChannel");
|
|
||||||
Integer endChannel = (Integer) threeMap.get("endChannel");
|
|
||||||
List<SeriseData> seriseDataList = (List<SeriseData>) threeMap.get("dataList");
|
|
||||||
if (systemType.equals("sample")) {
|
|
||||||
sampleVueData.setROIThreeBetaStart(startChannel);
|
|
||||||
sampleVueData.setROIThreeBetaStop(endChannel);
|
|
||||||
sampleVueData.setROIThreeList(seriseDataList);
|
|
||||||
sampleVueData.setROIThreeCounts((List<Long>)threeMap.get("counts"));
|
|
||||||
} else if (systemType.equals("det")) {
|
|
||||||
detVueData.setROIThreeBetaStart(startChannel);
|
|
||||||
detVueData.setROIThreeBetaStop(endChannel);
|
|
||||||
detVueData.setROIThreeList(seriseDataList);
|
|
||||||
}
|
|
||||||
map.put("ROIThreeStart", roiBBoundaryStart.get(2));
|
|
||||||
map.put("ROIThreeStop", roiBBoundaryStop.get(2));
|
|
||||||
map.put("ROIThreeList", seriseDataList);
|
|
||||||
}
|
|
||||||
//根据范围4划分 范围4对应的折线图
|
|
||||||
Map<String, Object> fourMap = statisticsROIList(roiBBoundaryStart.get(3), roiBBoundaryStop.get(3), struct.b_channels, struct.g_channels, struct.h_counts);
|
|
||||||
if ( CollectionUtils.isNotEmpty(fourMap) ) {
|
|
||||||
Integer startChannel = (Integer) fourMap.get("startChannel");
|
|
||||||
Integer endChannel = (Integer) fourMap.get("endChannel");
|
|
||||||
List<SeriseData> seriseDataList = (List<SeriseData>) fourMap.get("dataList");
|
|
||||||
if (systemType.equals("sample")) {
|
|
||||||
sampleVueData.setROIFourBetaStart(startChannel);
|
|
||||||
sampleVueData.setROIFourBetaStop(endChannel);
|
|
||||||
sampleVueData.setROIFourList(seriseDataList);
|
|
||||||
sampleVueData.setROIFourCounts((List<Long>)fourMap.get("counts"));
|
|
||||||
} else if (systemType.equals("det")) {
|
|
||||||
detVueData.setROIFourBetaStart(startChannel);
|
|
||||||
detVueData.setROIFourBetaStop(endChannel);
|
|
||||||
detVueData.setROIFourList(seriseDataList);
|
|
||||||
}
|
|
||||||
map.put("ROIFourStart", roiBBoundaryStart.get(3));
|
|
||||||
map.put("ROIFourStop", roiBBoundaryStop.get(3));
|
|
||||||
map.put("ROIFourList", seriseDataList);
|
|
||||||
}
|
|
||||||
//散点图
|
|
||||||
//统计散点图
|
//统计散点图
|
||||||
//横坐标 beta-gamma
|
//横坐标 beta-gamma
|
||||||
long bChannels = struct.b_channels;
|
long bChannels = struct.b_channels;
|
||||||
|
@ -262,7 +179,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
map.put("histogramDataList", histogramDataList);
|
map.put("histogramDataList", histogramDataList);
|
||||||
// map.put("histogramDataDList", histogramDataDList);
|
// map.put("histogramDataDList", histogramDataDList);
|
||||||
//调用算法 传入道值和道值对应的能量 得到计算gamma能量公式的参数
|
//调用算法 传入道值和道值对应的能量 得到计算gamma能量公式的参数
|
||||||
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(struct.g_centroid_channel, struct.g_energy);
|
||||||
//存储需要计算gamma能量的道值
|
//存储需要计算gamma能量的道值
|
||||||
List<Double> gchannels = new ArrayList<>();
|
List<Double> gchannels = new ArrayList<>();
|
||||||
for (int i=0; i<gChannels; i++){
|
for (int i=0; i<gChannels; i++){
|
||||||
|
@ -273,7 +190,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
//将gamma能量折线图进行赋值返回
|
//将gamma能量折线图进行赋值返回
|
||||||
map.put("gammaEnergyData", gammaEnergyList);
|
map.put("gammaEnergyData", gammaEnergyList);
|
||||||
//调用算法 传入道值和道值对应的能量 得到计算beta能量公式的参数
|
//调用算法 传入道值和道值对应的能量 得到计算beta能量公式的参数
|
||||||
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(struct.b_channel, struct.b_electron_energy);
|
||||||
List<Double> bchannels = new ArrayList<>();
|
List<Double> bchannels = new ArrayList<>();
|
||||||
for (int i=0; i<bChannels; i++){
|
for (int i=0; i<bChannels; i++){
|
||||||
bchannels.add(Double.valueOf(i));
|
bchannels.add(Double.valueOf(i));
|
||||||
|
@ -354,6 +271,8 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
selfStationData.setSampleTmpPath(file.getAbsolutePath());
|
selfStationData.setSampleTmpPath(file.getAbsolutePath());
|
||||||
} else if (type.equalsIgnoreCase("det")) {
|
} else if (type.equalsIgnoreCase("det")) {
|
||||||
selfStationData.setDetTmpPath(file.getAbsolutePath());
|
selfStationData.setDetTmpPath(file.getAbsolutePath());
|
||||||
|
} else if (type.equalsIgnoreCase("qc")) {
|
||||||
|
selfStationData.setQcTmpPath(file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
//解析文件内容
|
//解析文件内容
|
||||||
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
@ -408,6 +327,122 @@ public class SelfStationUtil extends AbstractLogOrReport {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getGammaByROI(String systemType, List<Integer> roiBBoundaryStart, List<Integer> roiBBoundaryStop,
|
||||||
|
SelfStationData selfStationData) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
|
||||||
|
long betaChannels = struct.b_channels, gammaChannels = struct.g_channels;
|
||||||
|
List<Long> h_counts = struct.h_counts;
|
||||||
|
|
||||||
|
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
||||||
|
SelfStationVueData detVueData = selfStationData.getDetVueData();
|
||||||
|
|
||||||
|
for (int r = 0; r < roiBBoundaryStart.size(); r++) {
|
||||||
|
List<SeriseData> seriseDataList = new LinkedList<>();
|
||||||
|
// g_counts
|
||||||
|
List<Long> counts = new LinkedList<>();
|
||||||
|
//存储同一列不同行加和后的数量
|
||||||
|
List<Integer> sumList = new LinkedList<>();
|
||||||
|
String roiStart = "", roiStop= "", roiList = "";
|
||||||
|
|
||||||
|
//根据范围划分 范围对应的折线图
|
||||||
|
int startChannel = roiBBoundaryStart.get(r);
|
||||||
|
int endChannel = roiBBoundaryStop.get(r);
|
||||||
|
//遍历所有列
|
||||||
|
for (int i=0; i<gammaChannels; i++) {
|
||||||
|
SeriseData seriseData = new SeriseData();
|
||||||
|
seriseData.setX(i);
|
||||||
|
int sum = 0;
|
||||||
|
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
|
||||||
|
for (int j=startChannel; j <= endChannel; j++) {
|
||||||
|
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
|
||||||
|
int index = (int) (i * betaChannels + j);
|
||||||
|
long count = 0;
|
||||||
|
//判断下标是否在h_counts范围内
|
||||||
|
if (index > 0 && index < h_counts.size()) {
|
||||||
|
count = h_counts.get(index);
|
||||||
|
}
|
||||||
|
sum+=count;
|
||||||
|
}
|
||||||
|
seriseData.setY(sum);
|
||||||
|
sumList.add(sum);
|
||||||
|
counts.add((long) sum);
|
||||||
|
seriseDataList.add(seriseData);
|
||||||
|
}
|
||||||
|
switch (r){
|
||||||
|
case 0:
|
||||||
|
roiStart = "ROIOneStart";
|
||||||
|
roiStop = "ROIOneStop";
|
||||||
|
roiList = "ROIOneList";
|
||||||
|
if (systemType.equals("sample")) {
|
||||||
|
sampleVueData.setROIOneBetaStart(startChannel);
|
||||||
|
sampleVueData.setROIOneBetaStop(endChannel);
|
||||||
|
sampleVueData.setROIOneList(seriseDataList);
|
||||||
|
sampleVueData.setROIOneCounts(counts);
|
||||||
|
} else if (systemType.equals("det")) {
|
||||||
|
detVueData.setROIOneBetaStart(startChannel);
|
||||||
|
detVueData.setROIOneBetaStop(endChannel);
|
||||||
|
detVueData.setROIOneList(seriseDataList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
roiStart = "ROITwoStart";
|
||||||
|
roiStop = "ROITwoStop";
|
||||||
|
roiList = "ROITwoList";
|
||||||
|
if (systemType.equals("sample")) {
|
||||||
|
sampleVueData.setROITwoBetaStart(startChannel);
|
||||||
|
sampleVueData.setROITwoBetaStop(endChannel);
|
||||||
|
sampleVueData.setROITwoList(seriseDataList);
|
||||||
|
sampleVueData.setROITwoCounts(counts);
|
||||||
|
} else if (systemType.equals("det")) {
|
||||||
|
detVueData.setROITwoBetaStart(startChannel);
|
||||||
|
detVueData.setROITwoBetaStop(endChannel);
|
||||||
|
detVueData.setROITwoList(seriseDataList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
roiStart = "ROIThreeStart";
|
||||||
|
roiStop = "ROIThreeStop";
|
||||||
|
roiList = "ROIThreeList";
|
||||||
|
if (systemType.equals("sample")) {
|
||||||
|
sampleVueData.setROIThreeBetaStart(startChannel);
|
||||||
|
sampleVueData.setROIThreeBetaStop(endChannel);
|
||||||
|
sampleVueData.setROIThreeList(seriseDataList);
|
||||||
|
sampleVueData.setROIThreeCounts(counts);
|
||||||
|
} else if (systemType.equals("det")) {
|
||||||
|
detVueData.setROIThreeBetaStart(startChannel);
|
||||||
|
detVueData.setROIThreeBetaStop(endChannel);
|
||||||
|
detVueData.setROIThreeList(seriseDataList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
roiStart = "ROIFourStart";
|
||||||
|
roiStop = "ROIFourStop";
|
||||||
|
roiList = "ROIFourList";
|
||||||
|
if (systemType.equals("sample")) {
|
||||||
|
sampleVueData.setROIFourBetaStart(startChannel);
|
||||||
|
sampleVueData.setROIFourBetaStop(endChannel);
|
||||||
|
sampleVueData.setROIFourList(seriseDataList);
|
||||||
|
sampleVueData.setROIFourCounts(counts);
|
||||||
|
} else if (systemType.equals("det")) {
|
||||||
|
detVueData.setROIFourBetaStart(startChannel);
|
||||||
|
detVueData.setROIFourBetaStop(endChannel);
|
||||||
|
detVueData.setROIFourList(seriseDataList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put(roiStart, startChannel);
|
||||||
|
map.put(roiStop, endChannel);
|
||||||
|
map.put(roiList, seriseDataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Long> roiList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
|
public List<Long> roiList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
|
||||||
// g_counts
|
// g_counts
|
||||||
List<Long> counts = new LinkedList<>();
|
List<Long> counts = new LinkedList<>();
|
||||||
|
|
|
@ -90,9 +90,9 @@ public interface SpectrumAnalysisMapper {
|
||||||
|
|
||||||
List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName);
|
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);
|
List<RoiDto> roiPaths(@Param("dbName") String dbName, @Param("idAnalysis") Integer idAnalysis);
|
||||||
|
|
||||||
List<RoiDto> roiPaths(@Param("dbName") String dbName, @Param("analysisId") Integer analysisId);
|
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||||
|
|
||||||
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||||
|
|
||||||
|
|
|
@ -1113,7 +1113,7 @@
|
||||||
select NAME from CONFIGURATION.GARDS_NUCL_LIB
|
select NAME from CONFIGURATION.GARDS_NUCL_LIB
|
||||||
</select>
|
</select>
|
||||||
<select id="roiPaths" resultType="org.jeecg.modules.base.dto.RoiDto">
|
<select id="roiPaths" resultType="org.jeecg.modules.base.dto.RoiDto">
|
||||||
SELECT ROI_NUM, PHD_PATH FROM ${dbName}.GARDS_ANALYSIS_ROI WHERE IDANALYSIS = #{analysisId} ORDER BY ROI_NUM ASC
|
SELECT ROI_NUM, PHD_PATH FROM ${dbName}.GARDS_ANALYSIS_ROI WHERE IDANALYSIS = #{idAnalysis} ORDER BY ROI_NUM ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -12,12 +12,12 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.cache.SelfCache;
|
import org.jeecg.common.cache.SelfCache;
|
||||||
import org.jeecg.common.constant.Prompt;
|
|
||||||
import org.jeecg.common.constant.StringConstant;
|
import org.jeecg.common.constant.StringConstant;
|
||||||
import org.jeecg.common.constant.enums.FileTypeEnum;
|
import org.jeecg.common.constant.enums.FileTypeEnum;
|
||||||
import org.jeecg.common.properties.ParameterProperties;
|
import org.jeecg.common.properties.ParameterProperties;
|
||||||
|
@ -29,7 +29,7 @@ import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||||
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
|
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
|
||||||
import org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi;
|
import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi;
|
||||||
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
||||||
import org.jeecg.modules.base.enums.SampleFileHeader;
|
import org.jeecg.modules.base.enums.SampleFileHeader;
|
||||||
import org.jeecg.modules.entity.*;
|
import org.jeecg.modules.entity.*;
|
||||||
|
@ -57,9 +57,9 @@ import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@DS("ora")
|
||||||
public class SelfStationServiceImpl implements ISelfStationService {
|
public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -133,10 +133,18 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DS("ora")
|
|
||||||
public Result loadFromDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
public Result loadFromDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
||||||
|
//页面展示结果数组
|
||||||
|
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||||
|
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList= new LinkedList<>();
|
||||||
|
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
|
||||||
|
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
|
||||||
|
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
|
||||||
|
List<GardsCalibrationPairsSpectrum> gammaCalibrationPairsList = new LinkedList<>();
|
||||||
|
List<GardsCalibrationPairsSpectrum> betaCalibrationPairsList = new LinkedList<>();
|
||||||
|
|
||||||
//获取用户名
|
//获取用户名
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
//获取自建台站缓存信息
|
//获取自建台站缓存信息
|
||||||
|
@ -152,14 +160,16 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
List<RoiDto> roiPaths = new ArrayList<>();
|
List<RoiDto> roiPaths = new ArrayList<>();
|
||||||
if (dbName.equalsIgnoreCase("auto")){
|
if (dbName.equalsIgnoreCase("auto")){
|
||||||
dbName = "RNAUTO";
|
dbName = "RNAUTO";
|
||||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
analyst = "RNAUTO";
|
||||||
// 获取gamma谱
|
|
||||||
roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID);
|
|
||||||
} else if (dbName.equalsIgnoreCase("man")){
|
} else if (dbName.equalsIgnoreCase("man")){
|
||||||
dbName = "RNMAN";
|
dbName = "RNMAN";
|
||||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, analyst);
|
|
||||||
roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID);
|
|
||||||
}
|
}
|
||||||
|
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, analyst);
|
||||||
|
if (analysisID == null) {
|
||||||
|
result.error500("The queried Sample data does not exist");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID);
|
||||||
try {
|
try {
|
||||||
if (Objects.nonNull(analysisID)) {
|
if (Objects.nonNull(analysisID)) {
|
||||||
//查询数据库文件信息
|
//查询数据库文件信息
|
||||||
|
@ -180,11 +190,39 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
detBg = spectrumAnalysisMapper.findSampleByFilePath(dbSpectrumFilePath.getDetBgFilePath());
|
detBg = spectrumAnalysisMapper.findSampleByFilePath(dbSpectrumFilePath.getDetBgFilePath());
|
||||||
detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)+1);
|
detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)+1);
|
||||||
}
|
}
|
||||||
|
//获取qc相关信息
|
||||||
|
String dbQcFilePath = "";
|
||||||
|
GardsSampleData qc = null;
|
||||||
|
String qcFileName = "";
|
||||||
|
if (Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode())) {
|
||||||
|
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||||
|
dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||||
|
if (StringUtils.isNotBlank(dbQcFilePath)) {
|
||||||
|
qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath);
|
||||||
|
qcFileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//从缓存中获取公用变量的数据
|
//从缓存中获取公用变量的数据
|
||||||
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
||||||
if (Objects.isNull(selfStationData)) {
|
if (Objects.isNull(selfStationData)) {
|
||||||
//初始化自建台站数据对象
|
//初始化自建台站数据对象
|
||||||
selfStationData = new SelfStationData();
|
selfStationData = new SelfStationData();
|
||||||
|
if (dbName.equalsIgnoreCase("RNAUTO")) {
|
||||||
|
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults(dbName, analysisID, sampleId);
|
||||||
|
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam("RNAUTO", analysisID);
|
||||||
|
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam("RNAUTO", analysisID);
|
||||||
|
roiChannelsSpectrumList = spectrumAnalysisMapper.ReadROIChannels("RNAUTO", analysisID, sampleId);
|
||||||
|
roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults("RNAUTO", analysisID, sampleId);
|
||||||
|
} else {
|
||||||
|
gammaCalibrationPairsList = spectrumAnalysisMapper.ReadGammaFitChannelEnergy(analysisID);
|
||||||
|
betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID);
|
||||||
|
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults(dbName, analysisID, sampleId);
|
||||||
|
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam("RNMAN", analysisID);
|
||||||
|
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam("RNMAN", analysisID);
|
||||||
|
roiChannelsSpectrumList = spectrumAnalysisMapper.ReadROIChannels("RNMAN", analysisID, sampleId);
|
||||||
|
roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults("RNMAN", analysisID, sampleId);
|
||||||
|
}
|
||||||
//判断sample文件名是否为空
|
//判断sample文件名是否为空
|
||||||
if (Objects.nonNull(sample)) {
|
if (Objects.nonNull(sample)) {
|
||||||
//拼接sample文件路径
|
//拼接sample文件路径
|
||||||
|
@ -197,6 +235,18 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
selfStationData.setSampleStruct(struct);
|
selfStationData.setSampleStruct(struct);
|
||||||
selfStationData.setSampleTmpPath(sampleFilePath);
|
selfStationData.setSampleTmpPath(sampleFilePath);
|
||||||
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
|
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
|
||||||
|
// 交互库需要获取最新的ROI数据
|
||||||
|
if (dbName.equalsIgnoreCase("man")) {
|
||||||
|
List<GardsAnalysisRoi> roiList = analysisRoiManService.analysisRoi(analysisID);
|
||||||
|
LinkedList<Integer> start = Lists.newLinkedList();
|
||||||
|
LinkedList<Integer> stop = Lists.newLinkedList();
|
||||||
|
for (GardsAnalysisRoi f : roiList) {
|
||||||
|
start.add(f.getRoiNum() -1, f.getMinX().intValue());
|
||||||
|
stop.add(f.getRoiNum() -1, f.getMinY().intValue());
|
||||||
|
}
|
||||||
|
Map<String, Object> gammaByROI = selfStationUtil.getGammaByROI("", start, stop, selfStationData);
|
||||||
|
map.putAll(gammaByROI);
|
||||||
|
}
|
||||||
resultMap.put("sample", map);
|
resultMap.put("sample", map);
|
||||||
|
|
||||||
// 返回Beta和Gamma的数据
|
// 返回Beta和Gamma的数据
|
||||||
|
@ -218,6 +268,21 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
resultMap.put("det", map);
|
resultMap.put("det", map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//判断qc文件名是否为空
|
||||||
|
if (Objects.nonNull(qc)) {
|
||||||
|
//拼接det文件路径
|
||||||
|
String qcFilePath = prefix + dbSpectrumFilePath.getQcFilePath();
|
||||||
|
//返回结果map
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
//获取sample分析后的对象
|
||||||
|
EnergySpectrumStruct struct = selfStationUtil.getSourceData(qcFilePath, "qc", selfStationData);
|
||||||
|
if (Objects.nonNull(struct)) {
|
||||||
|
selfStationData.setQcStruct(struct);
|
||||||
|
selfStationData.setQcTmpPath(qcFilePath);
|
||||||
|
selfStationUtil.loadFile(selfStationData, qc.getSampleId(), qc.getStatus(), "qc", map);
|
||||||
|
resultMap.put("qc", map);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 初始化自建台站Configure信息
|
// 初始化自建台站Configure信息
|
||||||
if (!StrUtil.equals(dbName, "RNAUTO")) initConfigure(analysisID, selfStationData);
|
if (!StrUtil.equals(dbName, "RNAUTO")) initConfigure(analysisID, selfStationData);
|
||||||
// 初始化自建台站用户核素库信息
|
// 初始化自建台站用户核素库信息
|
||||||
|
@ -280,6 +345,18 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
//返回结果map
|
//返回结果map
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
|
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
|
||||||
|
// 交互库需要获取最新的ROI数据
|
||||||
|
if (dbName.equalsIgnoreCase("man")) {
|
||||||
|
List<GardsAnalysisRoi> roiList = analysisRoiManService.analysisRoi(analysisID);
|
||||||
|
LinkedList<Integer> start = Lists.newLinkedList();
|
||||||
|
LinkedList<Integer> stop = Lists.newLinkedList();
|
||||||
|
for (GardsAnalysisRoi f : roiList) {
|
||||||
|
start.add(f.getRoiNum() -1, f.getMinX().intValue());
|
||||||
|
stop.add(f.getRoiNum() -1, f.getMinY().intValue());
|
||||||
|
}
|
||||||
|
Map<String, Object> gammaByROI = selfStationUtil.getGammaByROI("", start, stop, selfStationData);
|
||||||
|
map.putAll(gammaByROI);
|
||||||
|
}
|
||||||
resultMap.put("sample", map);
|
resultMap.put("sample", map);
|
||||||
// 返回Beta和Gamma的数据
|
// 返回Beta和Gamma的数据
|
||||||
bGSpectrum(selfStationData.getSampleStruct(), map);
|
bGSpectrum(selfStationData.getSampleStruct(), map);
|
||||||
|
@ -664,35 +741,39 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
LinkedList<Integer> roiBBoundaryStart = Lists.newLinkedList();
|
||||||
|
LinkedList<Integer> roiBBoundaryStop = Lists.newLinkedList();
|
||||||
for (ROIParam roiParam : roiParams) {
|
for (ROIParam roiParam : roiParams) {
|
||||||
Integer ROINum = roiParam.getRoiNum();
|
roiBBoundaryStart.add(roiParam.getRoiNum()-1, roiParam.getStartChannel());
|
||||||
Map<String, Object> resultMap = selfStationUtil.statisticsROIList(roiParam.getStartChannel(), roiParam.getEndChannel(),
|
roiBBoundaryStop.add(roiParam.getRoiNum()-1, roiParam.getEndChannel());
|
||||||
struct.b_channels, struct.g_channels, struct.h_counts);
|
|
||||||
if ( CollectionUtils.isNotEmpty(resultMap) ) {
|
// Map<String, Object> resultMap = selfStationUtil.statisticsROIList(roiParam.getStartChannel(), roiParam.getEndChannel(),
|
||||||
Integer startChannelValue = (Integer) resultMap.get("startChannel");
|
// struct.b_channels, struct.g_channels, struct.h_counts);
|
||||||
Integer endChannelValue = (Integer) resultMap.get("endChannel");
|
// if ( CollectionUtils.isNotEmpty(resultMap) ) {
|
||||||
List<SeriseData> seriseDataList = (List<SeriseData>) resultMap.get("dataList");
|
// Integer startChannelValue = (Integer) resultMap.get("startChannel");
|
||||||
if (1 == ROINum) {
|
// Integer endChannelValue = (Integer) resultMap.get("endChannel");
|
||||||
map.put("ROIOneList", seriseDataList);
|
// List<SeriseData> seriseDataList = (List<SeriseData>) resultMap.get("dataList");
|
||||||
map.put("ROIOneStart", startChannelValue);
|
// if (1 == ROINum) {
|
||||||
map.put("ROIOneStop", endChannelValue);
|
// map.put("ROIOneList", seriseDataList);
|
||||||
} else if (2 == ROINum) {
|
// map.put("ROIOneStart", startChannelValue);
|
||||||
map.put("ROITwoList", seriseDataList);
|
// map.put("ROIOneStop", endChannelValue);
|
||||||
map.put("ROITwoStart", startChannelValue);
|
// } else if (2 == ROINum) {
|
||||||
map.put("ROITwoStop", endChannelValue);
|
// map.put("ROITwoList", seriseDataList);
|
||||||
} else if (3 == ROINum) {
|
// map.put("ROITwoStart", startChannelValue);
|
||||||
map.put("ROIThreeList", seriseDataList);
|
// map.put("ROITwoStop", endChannelValue);
|
||||||
map.put("ROIThreeStart", startChannelValue);
|
// } else if (3 == ROINum) {
|
||||||
map.put("ROIThreeStop", endChannelValue);
|
// map.put("ROIThreeList", seriseDataList);
|
||||||
} else if (4 == ROINum) {
|
// map.put("ROIThreeStart", startChannelValue);
|
||||||
map.put("ROIFourList", seriseDataList);
|
// map.put("ROIThreeStop", endChannelValue);
|
||||||
map.put("ROIFourStart", startChannelValue);
|
// } else if (4 == ROINum) {
|
||||||
map.put("ROIFourStop", endChannelValue);
|
// map.put("ROIFourList", seriseDataList);
|
||||||
}
|
// map.put("ROIFourStart", startChannelValue);
|
||||||
}
|
// map.put("ROIFourStop", endChannelValue);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(selfStationUtil.getGammaByROI(struct.system_type, roiBBoundaryStart, roiBBoundaryStop, selfStationData));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5219,8 +5300,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
||||||
if (!FileUtil.exist(reportPath))
|
if (!FileUtil.exist(reportPath))
|
||||||
return Result.error("The automatic handler generated report does not exist!");
|
return Result.error("The automatic handler generated report does not exist!");
|
||||||
result.put("Beta", FileUtil.readUtf8String(reportPath));
|
result.put("Beta", FileUtil.readUtf8String(reportPath));
|
||||||
List<GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
|
List<org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi> analysisRois = analysisRoiAutoService.analysisRoi(idAnalysis);
|
||||||
for (GardsAnalysisRoi analysisRoi : analysisRois) {
|
for (org.jeecg.modules.base.entity.rnauto.GardsAnalysisRoi analysisRoi : analysisRois) {
|
||||||
Integer roiNum = analysisRoi.getRoiNum();
|
Integer roiNum = analysisRoi.getRoiNum();
|
||||||
String roiReportPath = analysisRoi.getReportPath();
|
String roiReportPath = analysisRoi.getReportPath();
|
||||||
roiReportPath = rootPath + saveFilePath + StrUtil.SLASH + roiReportPath + FileTypeEnum.arr.getType();
|
roiReportPath = rootPath + saveFilePath + StrUtil.SLASH + roiReportPath + FileTypeEnum.arr.getType();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user