feat:自建台站SaveToDB
This commit is contained in:
parent
48fc1b30e5
commit
bc74b2e32e
|
@ -17,7 +17,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||
@Accessors(chain = true)
|
||||
public class GardsAnalysisRoi {
|
||||
|
||||
@TableId("IDANALYSIS")
|
||||
@TableField("IDANALYSIS")
|
||||
private Integer idAnalysis;
|
||||
|
||||
private Integer sampleId;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.base.entity.rnman;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
@ -10,7 +11,7 @@ import lombok.experimental.Accessors;
|
|||
@Accessors(chain = true)
|
||||
public class GardsAnalysisRoi {
|
||||
|
||||
@TableId("IDANALYSIS")
|
||||
@TableField("IDANALYSIS")
|
||||
private Integer idAnalysis;
|
||||
|
||||
private Integer sampleId;
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.spectrum;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
|
@ -21,6 +22,7 @@ import org.jeecg.common.constant.enums.SpectrumSystemType;
|
|||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.ErrorLogManager;
|
||||
import org.jeecg.modules.base.bizVo.AttributeItemVo;
|
||||
import org.jeecg.modules.base.dto.*;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
|
@ -29,6 +31,7 @@ import org.jeecg.modules.base.enums.DSType;
|
|||
import org.jeecg.modules.base.enums.MiddleDataType;
|
||||
import org.jeecg.modules.base.enums.SpectrumType;
|
||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.exception.AnalySpectrumException;
|
||||
import org.jeecg.modules.exception.CAnalyseException;
|
||||
|
@ -131,7 +134,7 @@ public class Sample_C_Analysis {
|
|||
|
||||
private List<String> phdFilePaths;
|
||||
|
||||
private Table<Integer, Integer, GStoreMiddleProcessData> middleDataTable;
|
||||
private Map<Integer, GStoreMiddleProcessData> middleDataMap;
|
||||
|
||||
public Sample_C_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler, EnergySpectrumStruct sampleStruct, SpectrumServiceQuotes serviceQuotes,
|
||||
GardsSampleData sampleData) {
|
||||
|
@ -202,33 +205,26 @@ public class Sample_C_Analysis {
|
|||
boolean analyFlag2 = gammaFileUtil.GetMiddleData(phdFile2, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData2, MiddleDataType.Auto.getType(), "");
|
||||
boolean analyFlag3 = gammaFileUtil.GetMiddleData(phdFile3, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData3, MiddleDataType.Auto.getType(), "");
|
||||
boolean analyFlag4 = gammaFileUtil.GetMiddleData(phdFile4, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData4, MiddleDataType.Auto.getType(), "");
|
||||
// 数据插入数据库
|
||||
this.storageDataToDatabase(mdcInfoMap, null,
|
||||
middleData1, middleData2, middleData3, middleData4);
|
||||
/*if (analyFlag) {
|
||||
|
||||
boolean analyFlag = analyFlag1 && analyFlag2 && analyFlag3 && analyFlag4;
|
||||
|
||||
if (analyFlag) {
|
||||
// 数据插入数据库
|
||||
this.storageDataToDatabase(mdcInfoMap, null,
|
||||
middleData1, middleData2, middleData3, middleData4);
|
||||
|
||||
// 生成日志文件
|
||||
writeLog(middleData.getAnalyses_LogPath(), middleData);
|
||||
writeLog(middleData1, middleData2, middleData3, middleData4);
|
||||
|
||||
// 生成报告文件
|
||||
spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class);
|
||||
String reportContent = gammaFileUtil.GetReportContent(middleData);
|
||||
String reportPath = StringUtils.substringBeforeLast(middleData.getAnalyses_ReportPath(), StringPool.SLASH);
|
||||
String reportName = StringUtils.substringAfterLast(middleData.getAnalyses_ReportPath(), StringPool.SLASH) + ".txt";
|
||||
String savePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + File.separator + reportPath +
|
||||
File.separator + reportName;
|
||||
// 保存文件
|
||||
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
||||
writeReport(middleData1, middleData2, middleData3, middleData4);
|
||||
//发送数据到redis
|
||||
middleData.setSample_id(String.valueOf(sampleId));
|
||||
pushToRedis(middleData);
|
||||
// middleData.setSample_id(String.valueOf(sampleId));
|
||||
// pushToRedis(middleData);
|
||||
} else {
|
||||
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), phdFile.getAnalyMessage(), this.sampleFilename));
|
||||
throw new AnalySpectrumException(phdFile.getAnalyMessage());
|
||||
}*/
|
||||
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), phdFile1.getAnalyMessage(), this.sampleFilename));
|
||||
throw new AnalySpectrumException(phdFile1.getAnalyMessage());
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("Sample_C_Analysis", e);
|
||||
|
@ -287,29 +283,30 @@ public class Sample_C_Analysis {
|
|||
bChannels, gChannels, hCounts);
|
||||
|
||||
// 根据ROI生成四个Gamma谱文件 文件命名格式为: 样品谱原名_ROI_x.PHD
|
||||
String savePath = this.saveFullPath();
|
||||
String saveFullPath = this.saveFullPath();
|
||||
String gammaOneName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_1.PHD";
|
||||
selfStationUtil.createGammaFile(savePath, gammaOneName, this.sampleStruct, roiOneCounts);
|
||||
selfStationUtil.createGammaFile(saveFullPath, gammaOneName, this.sampleStruct, roiOneCounts);
|
||||
|
||||
String gammaTwoName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_2.PHD";
|
||||
selfStationUtil.createGammaFile(savePath, gammaTwoName, this.sampleStruct, roiTwoCounts);
|
||||
selfStationUtil.createGammaFile(saveFullPath, gammaTwoName, this.sampleStruct, roiTwoCounts);
|
||||
|
||||
String gammaThreeName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_3.PHD";
|
||||
selfStationUtil.createGammaFile(savePath, gammaThreeName, this.sampleStruct, roiThreeCounts);
|
||||
selfStationUtil.createGammaFile(saveFullPath, gammaThreeName, this.sampleStruct, roiThreeCounts);
|
||||
|
||||
String gammaFourName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_4.PHD";
|
||||
selfStationUtil.createGammaFile(savePath, gammaFourName, this.sampleStruct, roiFourCounts);
|
||||
selfStationUtil.createGammaFile(saveFullPath, gammaFourName, this.sampleStruct, roiFourCounts);
|
||||
// 将生成的GammaPHD文件转换为PHDFile对象
|
||||
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, savePath);
|
||||
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, saveFullPath);
|
||||
this.phdFile1.setRoiSuffix("_ROI_1");
|
||||
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, savePath);
|
||||
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, saveFullPath);
|
||||
this.phdFile2.setRoiSuffix("_ROI_2");
|
||||
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, savePath);
|
||||
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, saveFullPath);
|
||||
this.phdFile3.setRoiSuffix("_ROI_3");
|
||||
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, savePath);
|
||||
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, saveFullPath);
|
||||
this.phdFile4.setRoiSuffix("_ROI_4");
|
||||
// 生成PHD的inputFileName
|
||||
String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath();
|
||||
// String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath();
|
||||
String saveRelativePath = this.savePath();
|
||||
gammaOneName = saveRelativePath + StrUtil.SLASH + gammaOneName;
|
||||
gammaTwoName = saveRelativePath + StrUtil.SLASH + gammaTwoName;
|
||||
gammaThreeName = saveRelativePath + StrUtil.SLASH + gammaThreeName;
|
||||
|
@ -317,6 +314,23 @@ public class Sample_C_Analysis {
|
|||
phdFilePaths = ListUtil.toList(gammaOneName, gammaTwoName, gammaThreeName, gammaFourName);
|
||||
}
|
||||
|
||||
public String savePath(){
|
||||
//measurement_id切割后的字符数组
|
||||
String[] arr = this.sampleStruct.measurement_id.split(StringConstant.DASH);
|
||||
//切割后第一个,元素是年,第二个是月
|
||||
final String[] yearMonth = arr[1].split(StringConstant.SLASH);
|
||||
SpectrumPathProperties properties = this.spectrumPathProperties;
|
||||
StringBuilder relativePath = new StringBuilder();
|
||||
relativePath.append(properties.getFilePathMap().get(this.sampleStruct.system_type));
|
||||
relativePath.append(StrUtil.SLASH);
|
||||
relativePath.append(properties.getFilePathMap().get(this.sampleStruct.data_type));
|
||||
relativePath.append(StrUtil.SLASH);
|
||||
relativePath.append(yearMonth[0]);
|
||||
relativePath.append(StrUtil.SLASH);
|
||||
relativePath.append(yearMonth[1]);
|
||||
return relativePath.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取savefile全路径 不包含文件名
|
||||
* */
|
||||
|
@ -431,32 +445,36 @@ public class Sample_C_Analysis {
|
|||
|
||||
public void storageDataToDatabase(Map<String, CalMDCInfo> mdcInfoMap, Map<String, QcCheckItem> qcItems, GStoreMiddleProcessData... middleDatas){
|
||||
// 如果数据已经存储 不再重复存储
|
||||
final Integer idAnalysisAny = serviceQuotes.getAnalysisRoiAutoService().getIdAnalysisAny(this.sampleData.getSampleId());
|
||||
if(Objects.nonNull(idAnalysisAny)) return;
|
||||
Integer idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
||||
if(ObjectUtil.isNotNull(idAnalysis)) return;
|
||||
DataSourceSwitcher.switchToOracle();
|
||||
final TransactionStatus transactionStatus = serviceQuotes.getTransactionManager().getTransaction(serviceQuotes.getTransactionDefinition());
|
||||
try {
|
||||
Integer sampleId = this.sampleData.getSampleId();
|
||||
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES
|
||||
saveAnalysisROI(sampleId, middleDatas);
|
||||
saveAnalysis(middleDatas[0], sampleId);
|
||||
// 获取分析结果ID ==> SELECT IDANALYSIS
|
||||
idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(sampleId);
|
||||
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES
|
||||
saveAnalysisROI(sampleId, idAnalysis, middleDatas);
|
||||
// 获取Table IdAnalysis:RoiId:GStoreMiddleProcessData
|
||||
middleDataTable(sampleId, middleDatas);
|
||||
// 修改保存结果状态 ==> UPDATE ORIGINAL.GARDS_SAMPLE_DATA
|
||||
// serviceQuotes.getSampleDataService().updateStatus(null,null);
|
||||
/* GARDS_CALIBRATION_PAIRS_ROI 数据表保存 */
|
||||
saveCalibrationPairsROI(sampleId);
|
||||
saveCalibrationPairsROI(sampleId, idAnalysis);
|
||||
/* GARDS_CALIBRATION_ROI 数据表保存 */
|
||||
saveCalibrationROI(sampleId);
|
||||
saveCalibrationROI(sampleId, idAnalysis);
|
||||
/* Gards_Peaks_ROI 数据表保存 */
|
||||
savePeaksROI(sampleId);
|
||||
savePeaksROI(sampleId, idAnalysis);
|
||||
/* Gards_Nucl_Lines_Ided_ROI 数据表保存 */
|
||||
saveNuclLinesIdedROI(sampleId);
|
||||
saveNuclLinesIdedROI(sampleId, idAnalysis);
|
||||
/* Gards_Nucl_Ided_ROI 数据表保存 */
|
||||
saveNuclIdedROI(sampleId);
|
||||
saveNuclIdedROI(sampleId, idAnalysis);
|
||||
/* Gards_Qc_Check_ROI 数据表保存 */
|
||||
// saveQcCheckROI(sampleId, qcItems);
|
||||
/* GARDS_MDC_ROI 数据表保存 */
|
||||
saveMDCROI(sampleId, mdcInfoMap);
|
||||
saveMDCROI(sampleId, idAnalysis,mdcInfoMap);
|
||||
//提交事务
|
||||
serviceQuotes.getTransactionManager().commit(transactionStatus);
|
||||
} catch (Exception e) {
|
||||
|
@ -470,6 +488,26 @@ public class Sample_C_Analysis {
|
|||
}
|
||||
}
|
||||
|
||||
private void writeLog(GStoreMiddleProcessData... middleDatas) {
|
||||
for (GStoreMiddleProcessData middleData : middleDatas) {
|
||||
writeLog(middleData.getAnalyses_LogPath(), middleData);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeReport(GStoreMiddleProcessData... middleDatas) throws IOException {
|
||||
spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class);
|
||||
GammaFileUtil gammaFileUtil = ApplicationContextUtil.getContext().getBean(GammaFileUtil.class);
|
||||
String prefix = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath();
|
||||
for (GStoreMiddleProcessData middleData : middleDatas) {
|
||||
String reportContent = gammaFileUtil.GetReportContent(middleData);
|
||||
String reportPath = StringUtils.substringBeforeLast(middleData.getAnalyses_ReportPath(), StringPool.SLASH);
|
||||
String reportName = StringUtils.substringAfterLast(middleData.getAnalyses_ReportPath(), StringPool.SLASH) + ".txt";
|
||||
String savePath = prefix + StrUtil.SLASH + reportPath + StrUtil.SLASH + reportName;
|
||||
// 保存文件
|
||||
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成日志文件
|
||||
* @param logFilePath
|
||||
|
@ -745,12 +783,13 @@ public class Sample_C_Analysis {
|
|||
}
|
||||
}
|
||||
|
||||
public void saveAnalysisROI(Integer sampleId, GStoreMiddleProcessData... middleDatas){
|
||||
public void saveAnalysisROI(Integer sampleId, Integer idAnalysis, GStoreMiddleProcessData... middleDatas){
|
||||
List<GardsAnalysisRoi> analysisRois = new ArrayList<>();
|
||||
for (int i = 0; i < middleDatas.length; i++) {
|
||||
GStoreMiddleProcessData middleData = middleDatas[i];
|
||||
GardsAnalysisRoi analysisRoi = new GardsAnalysisRoi();
|
||||
analysisRoi.setSampleId(sampleId);
|
||||
analysisRoi.setIdAnalysis(idAnalysis);
|
||||
analysisRoi.setPhdPath(this.phdFilePaths.get(i));
|
||||
analysisRoi.setBaselinePath(middleData.getAnalyses_baseline_filePath());
|
||||
analysisRoi.setLcPath(middleData.getAnalyses_lc_filePath());
|
||||
|
@ -774,14 +813,13 @@ public class Sample_C_Analysis {
|
|||
|
||||
public void middleDataTable(Integer sampleId, GStoreMiddleProcessData... middleDatas){
|
||||
List<GardsAnalysisRoi> analysisRois = serviceQuotes.getAnalysisRoiAutoService().analysisRoi(sampleId);
|
||||
Table<Integer, Integer, GStoreMiddleProcessData> middleDataTable = HashBasedTable.create();
|
||||
Map<Integer, GStoreMiddleProcessData> middleDataMap = new LinkedHashMap<>();
|
||||
for (int i = 0; i < analysisRois.size(); i++) {
|
||||
GardsAnalysisRoi analysisRoi = analysisRois.get(i);
|
||||
Integer idAnalysis = analysisRoi.getIdAnalysis();
|
||||
Integer roiId = analysisRoi.getRoiId();
|
||||
middleDataTable.put(idAnalysis, roiId, middleDatas[i]);
|
||||
middleDataMap.put(roiId, middleDatas[i]);
|
||||
}
|
||||
this.middleDataTable = middleDataTable;
|
||||
this.middleDataMap = middleDataMap;
|
||||
}
|
||||
|
||||
public List<GardsCalibrationPairsRoi> saveCalibrationPairsROI(Integer sampleId, Integer IdAnalysis,
|
||||
|
@ -867,13 +905,12 @@ public class Sample_C_Analysis {
|
|||
return allPairs;
|
||||
}
|
||||
|
||||
public void saveCalibrationPairsROI(Integer sampleId){
|
||||
public void saveCalibrationPairsROI(Integer sampleId, Integer IdAnalysis){
|
||||
List<GardsCalibrationPairsRoi> pairsRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataTable.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
pairsRois.addAll(saveCalibrationPairsROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
}
|
||||
this.serviceQuotes.getCalibrationPairsRoiAutoService().saveBatch(pairsRois);
|
||||
|
@ -972,13 +1009,12 @@ public class Sample_C_Analysis {
|
|||
return calibrations;
|
||||
}
|
||||
|
||||
public void saveCalibrationROI(Integer sampleId){
|
||||
public void saveCalibrationROI(Integer sampleId, Integer IdAnalysis){
|
||||
List<GardsCalibrationRoi> calibrationRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataTable.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
calibrationRois.addAll(saveCalibrationROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
}
|
||||
this.serviceQuotes.getCalibrationRoiAutoService().createBatch(calibrationRois);
|
||||
|
@ -1003,13 +1039,12 @@ public class Sample_C_Analysis {
|
|||
return peaks;
|
||||
}
|
||||
|
||||
public void savePeaksROI(Integer sampleId){
|
||||
public void savePeaksROI(Integer sampleId, Integer IdAnalysis){
|
||||
List<GardsPeaksRoi> peaksRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataTable.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
peaksRois.addAll(savePeaksROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
}
|
||||
this.serviceQuotes.getPeaksRoiAutoService().saveBatch(peaksRois);
|
||||
|
@ -1039,13 +1074,12 @@ public class Sample_C_Analysis {
|
|||
return allNuclLinesIdeds;
|
||||
}
|
||||
|
||||
public void saveNuclLinesIdedROI(Integer sampleId){
|
||||
public void saveNuclLinesIdedROI(Integer sampleId, Integer IdAnalysis){
|
||||
List<GardsNuclLinesIdedRoi> linesIdedRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataTable.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
linesIdedRois.addAll(saveNuclLinesIdedROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
}
|
||||
this.serviceQuotes.getNuclLinesIdedRoiAutoService().saveBatch(linesIdedRois);
|
||||
|
@ -1070,13 +1104,12 @@ public class Sample_C_Analysis {
|
|||
return nuclIdedRois;
|
||||
}
|
||||
|
||||
public void saveNuclIdedROI(Integer sampleId){
|
||||
public void saveNuclIdedROI(Integer sampleId, Integer IdAnalysis){
|
||||
List<GardsNuclIdedRoi> idedRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataTable.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
idedRois.addAll(saveNuclIdedROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
}
|
||||
this.serviceQuotes.getNuclIdedRoiAutoService().saveBatch(idedRois);
|
||||
|
@ -1133,12 +1166,10 @@ public class Sample_C_Analysis {
|
|||
return mdcRois;
|
||||
}
|
||||
|
||||
public void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap){
|
||||
public void saveMDCROI(Integer sampleId, Integer IdAnalysis, Map<String, CalMDCInfo> mdcInfoMap){
|
||||
List<GardsMDCRoi> mdcRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataTable.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
Set<Integer> roiIds = this.middleDataMap.keySet();
|
||||
for (Integer roiId : roiIds) {
|
||||
mdcRois.addAll(saveMDCROI(sampleId, IdAnalysis, roiId, mdcInfoMap));
|
||||
}
|
||||
this.serviceQuotes.getMdcRoiAutoService().saveBatch(mdcRois);
|
||||
|
@ -1302,6 +1333,31 @@ public class Sample_C_Analysis {
|
|||
}
|
||||
}
|
||||
|
||||
public void saveAnalysis(GStoreMiddleProcessData middleData, Integer sampleId){
|
||||
GardsAnalyses analysis = toAnalysis(middleData);
|
||||
analysis.setSampleId(sampleId);
|
||||
serviceQuotes.getAnalysesService().save(analysis);
|
||||
}
|
||||
|
||||
private GardsAnalyses toAnalysis(GStoreMiddleProcessData middleData){
|
||||
GardsAnalyses gardsAnalyses = new GardsAnalyses();
|
||||
String dateTime = DateConstant.DATE_BIAS_TIME;
|
||||
String analysisBegin = middleData.getAnalyses_analysisBegin();
|
||||
Date analysis_Begin = DateUtil.parse(analysisBegin, dateTime)
|
||||
.toJdkDate();
|
||||
gardsAnalyses.setAnalysisBegin(analysis_Begin);
|
||||
String analysisEnd = middleData.getAnalyses_analysisEnd();
|
||||
Date analysis_End = DateUtil.parse(analysisEnd, dateTime)
|
||||
.toJdkDate();
|
||||
gardsAnalyses.setAnalysisEnd(analysis_End);
|
||||
gardsAnalyses.setType(middleData.getAnalyses_type());
|
||||
gardsAnalyses.setSoftware(middleData.getAnalyses_software());
|
||||
gardsAnalyses.setSwVersion(middleData.getAnalyses_swVersion());
|
||||
gardsAnalyses.setAnalyst(middleData.getAnalyses_analyst());
|
||||
gardsAnalyses.setComments(middleData.getAnalyses_comments());
|
||||
return gardsAnalyses;
|
||||
}
|
||||
|
||||
/* public <T1,T2> List<T2> mapFields(T1 source, T2 tartget, String baseLine, Map<String,String> fieldMap) {
|
||||
try {
|
||||
List<T2> result = new ArrayList<>();
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.service;
|
|||
import org.jeecg.modules.base.entity.rnman.GardsAnalyses;
|
||||
import org.jeecg.modules.entity.vo.CalMDCInfo;
|
||||
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData;
|
||||
import org.jeecg.modules.entity.vo.PHDFile;
|
||||
import org.jeecg.modules.entity.vo.QcCheckItem;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
|
||||
|
@ -47,4 +48,6 @@ public interface AnalysisManService {
|
|||
void saveQcCheckROI(Integer sampleId, Map<String, QcCheckItem> qcItems, Integer idAnalysis);
|
||||
|
||||
void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap, Integer idAnalysis);
|
||||
|
||||
void saveAnalySettingROI(Integer sampleId, Integer idAnalysis, List<PHDFile> phdFiles);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -11,10 +12,7 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Table;
|
||||
import org.jeecg.modules.base.dto.*;
|
||||
import org.jeecg.modules.base.entity.rnman.*;
|
||||
import org.jeecg.modules.entity.vo.CalMDCInfo;
|
||||
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData;
|
||||
import org.jeecg.modules.entity.vo.GStoreMiddleProcessDataNuclLinesIded;
|
||||
import org.jeecg.modules.entity.vo.QcCheckItem;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -57,7 +55,7 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
@Override
|
||||
public void middleDataTable(Integer idAnalysis, List<GStoreMiddleProcessData> middleDatas) {
|
||||
List<GardsAnalysisRoi> analysisRois = analysisRoiManService.analysisRoi(idAnalysis);
|
||||
Map<Integer, GStoreMiddleProcessData> middleDataMap = new HashMap<>();
|
||||
Map<Integer, GStoreMiddleProcessData> middleDataMap = new LinkedHashMap<>();
|
||||
for (int i = 0; i < analysisRois.size(); i++) {
|
||||
GardsAnalysisRoi analysisRoi = analysisRois.get(i);
|
||||
Integer roiId = analysisRoi.getRoiId();
|
||||
|
@ -109,69 +107,61 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
|
||||
@Override
|
||||
public void deleteCalibration(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsCalibrationRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsCalibrationRoi::getIdAnalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsCalibrationRoi::getIdAnalysis, idAnalysis);
|
||||
calibrationRoiManService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePeaks(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsPeaksRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsPeaksRoi::getIdAnalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsPeaksRoi::getIdAnalysis, idAnalysis);
|
||||
peaksRoiManService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNuclLines(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsNuclLinesIdedRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsNuclLinesIdedRoi::getIdAnalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsNuclLinesIdedRoi::getIdAnalysis, idAnalysis);
|
||||
nuclLinesIdedRoiManService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNucl(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsNuclIdedRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsNuclIdedRoi::getIdAnalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsNuclIdedRoi::getIdAnalysis, idAnalysis);
|
||||
nuclIdedRoiManService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQCCheck(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsQcCheckRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsQcCheckRoi::getIdAnalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsQcCheckRoi::getIdAnalysis, idAnalysis);
|
||||
qcCheckRoiManService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMDC(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsMDCRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsMDCRoi::getIdAnalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsMDCRoi::getIdAnalysis, idAnalysis);
|
||||
mdcRoiManService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAnalySetting(Integer idAnalysis) {
|
||||
Set<Integer> idAnalysisSet = middleDataMap.rowKeySet();
|
||||
LambdaUpdateWrapper<GardsAnalySettingRoi> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(GardsAnalySettingRoi::getIdanalysis, idAnalysisSet);
|
||||
wrapper.eq(GardsAnalySettingRoi::getIdanalysis, idAnalysis);
|
||||
analySettingRoiService.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis) {
|
||||
List<GardsCalibrationPairsRoi> pairsRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
pairsRois.addAll(saveCalibrationPairsROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
pairsRois.addAll(saveCalibrationPairsROI(sampleId, idAnalysis, roiId, middleData));
|
||||
}
|
||||
calibrationPairsRoiManService.saveBatch(pairsRois);
|
||||
}
|
||||
|
@ -262,12 +252,11 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
@Override
|
||||
public void saveCalibrationROI(Integer sampleId, Integer idAnalysis) {
|
||||
List<GardsCalibrationRoi> calibrationRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
calibrationRois.addAll(saveCalibrationROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
calibrationRois.addAll(saveCalibrationROI(sampleId, idAnalysis, roiId, middleData));
|
||||
}
|
||||
calibrationRoiManService.createBatch(calibrationRois);
|
||||
}
|
||||
|
@ -368,12 +357,11 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
@Override
|
||||
public void savePeaksROI(Integer sampleId, Integer idAnalysis) {
|
||||
List<GardsPeaksRoi> peaksRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
peaksRois.addAll(savePeaksROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
peaksRois.addAll(savePeaksROI(sampleId, idAnalysis, roiId, middleData));
|
||||
}
|
||||
peaksRoiManService.saveBatch(peaksRois);
|
||||
}
|
||||
|
@ -400,12 +388,11 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
@Override
|
||||
public void saveNuclLinesIdedROI(Integer sampleId, Integer idAnalysis){
|
||||
List<GardsNuclLinesIdedRoi> linesIdedRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
linesIdedRois.addAll(saveNuclLinesIdedROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
linesIdedRois.addAll(saveNuclLinesIdedROI(sampleId, idAnalysis, roiId, middleData));
|
||||
}
|
||||
nuclLinesIdedRoiManService.saveBatch(linesIdedRois);
|
||||
}
|
||||
|
@ -455,12 +442,11 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
@Override
|
||||
public void saveNuclIdedROI(Integer sampleId, Integer idAnalysis){
|
||||
List<GardsNuclIdedRoi> idedRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
GStoreMiddleProcessData middleData = cell.getValue();
|
||||
idedRois.addAll(saveNuclIdedROI(sampleId, IdAnalysis, roiId, middleData));
|
||||
Set<Map.Entry<Integer, GStoreMiddleProcessData>> entries = this.middleDataMap.entrySet();
|
||||
for (Map.Entry<Integer, GStoreMiddleProcessData> entry : entries) {
|
||||
Integer roiId = entry.getKey();
|
||||
GStoreMiddleProcessData middleData = entry.getValue();
|
||||
idedRois.addAll(saveNuclIdedROI(sampleId, idAnalysis, roiId, middleData));
|
||||
}
|
||||
nuclIdedRoiManService.saveBatch(idedRois);
|
||||
}
|
||||
|
@ -505,15 +491,47 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
@Override
|
||||
public void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap, Integer idAnalysis){
|
||||
List<GardsMDCRoi> mdcRois = new ArrayList<>();
|
||||
Set<Table.Cell<Integer, Integer, GStoreMiddleProcessData>> cells = this.middleDataMap.cellSet();
|
||||
for (Table.Cell<Integer, Integer, GStoreMiddleProcessData> cell : cells) {
|
||||
Integer IdAnalysis = cell.getRowKey();
|
||||
Integer roiId = cell.getColumnKey();
|
||||
mdcRois.addAll(saveMDCROI(sampleId, IdAnalysis, roiId, mdcInfoMap));
|
||||
Set<Integer> roiIds = this.middleDataMap.keySet();
|
||||
for (Integer roiId : roiIds) {
|
||||
mdcRois.addAll(saveMDCROI(sampleId, idAnalysis, roiId, mdcInfoMap));
|
||||
}
|
||||
mdcRoiManService.saveBatch(mdcRois);
|
||||
}
|
||||
|
||||
public GardsAnalySettingRoi saveAnalySettingROI(Integer sampleId, Integer idAnalysis,
|
||||
Integer roiId, PHDFile phd) {
|
||||
GardsAnalySettingRoi analySettingRoi = new GardsAnalySettingRoi();
|
||||
analySettingRoi.setIdanalysis(idAnalysis);
|
||||
analySettingRoi.setSampleId(sampleId);
|
||||
analySettingRoi.setRoiId(roiId);
|
||||
analySettingRoi.setEcutanalysisLow(phd.getUsedSetting().getECutAnalysis_Low());
|
||||
analySettingRoi.setEcutanalysisHigh(phd.getUsedSetting().getECutAnalysis_High());
|
||||
analySettingRoi.setEnergytolerance(phd.getUsedSetting().getEnergyTolerance());
|
||||
analySettingRoi.setCalibrationpssHigh(phd.getUsedSetting().getCalibrationPSS_high());
|
||||
analySettingRoi.setCalibrationpssLow(phd.getUsedSetting().getCalibrationPSS_low());
|
||||
analySettingRoi.setBaseimprovepss(phd.getUsedSetting().getBaseImprovePSS());
|
||||
analySettingRoi.setPssLow(phd.getUsedSetting().getPss_low());
|
||||
analySettingRoi.setKBack(phd.getUsedSetting().getK_back());
|
||||
analySettingRoi.setKAlpha(phd.getUsedSetting().getK_alpha());
|
||||
analySettingRoi.setKBeta(phd.getUsedSetting().getK_beta());
|
||||
analySettingRoi.setRisklevelk(phd.getUsedSetting().getRiskLevelK());
|
||||
analySettingRoi.setBupdatecal(phd.getUsedSetting().isBUpdateCal()?1:0);
|
||||
analySettingRoi.setKeepcalpeakserchpeaks(phd.getUsedSetting().isKeepCalPeakSearchPeaks()?1:0);
|
||||
analySettingRoi.setReftimeAct(phd.getUsedSetting().getRefTime_act());
|
||||
analySettingRoi.setReftimeConc(phd.getUsedSetting().getRefTime_conc());
|
||||
return analySettingRoi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAnalySettingROI(Integer sampleId, Integer idAnalysis, List<PHDFile> phdFiles) {
|
||||
List<GardsAnalySettingRoi> analySettingRois = new ArrayList<>();
|
||||
List<Integer> roiIds = ListUtil.toList(this.middleDataMap.keySet());
|
||||
for (int i = 0; i < roiIds.size(); i++) {
|
||||
analySettingRois.add(saveAnalySettingROI(sampleId, idAnalysis, roiIds.get(i), phdFiles.get(i)));
|
||||
}
|
||||
analySettingRoiService.saveBatch(analySettingRois);
|
||||
}
|
||||
|
||||
public Map<String,String> fieldMap(){
|
||||
Map<String,String> fieldMap = new HashMap<>();
|
||||
// Gards_Nucl_Lines_Ided
|
||||
|
|
|
@ -28,7 +28,7 @@ public class GardsAnalysisRoiManServiceImpl extends ServiceImpl<GardsAnalysisRoi
|
|||
public List<GardsAnalysisRoi> analysisRoi(Integer idAnalysis) {
|
||||
LambdaQueryWrapper<GardsAnalysisRoi> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsAnalysisRoi::getIdAnalysis, idAnalysis);
|
||||
wrapper.orderByAsc(GardsAnalysisRoi::getRoiNum);
|
||||
wrapper.orderByAsc(GardsAnalysisRoi::getRoiId);
|
||||
return list(wrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,10 @@ public class SelfStationData implements Serializable {
|
|||
* 是否点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮
|
||||
*/
|
||||
private boolean bBetaEnergyValidDet;
|
||||
/*
|
||||
* 是否进行了重新分析
|
||||
* */
|
||||
private boolean bAnalyed;
|
||||
|
||||
|
||||
public SelfStationData() {
|
||||
|
@ -137,6 +141,7 @@ public class SelfStationData implements Serializable {
|
|||
bBetaEnergyValidGas = false;
|
||||
bGammaEnergyValidDet = false;
|
||||
bBetaEnergyValidDet = false;
|
||||
bAnalyed = false;
|
||||
|
||||
gammaNewEnergyListNow = new LinkedList<>();
|
||||
betaNewEnergyListNow = new LinkedList<>();
|
||||
|
|
|
@ -9,4 +9,5 @@ public interface GardsAnalysesManMapper extends BaseMapper<GardsAnalyses> {
|
|||
|
||||
void updateEntity(@Param(value = "analyses") GardsAnalysesSpectrum analyses);
|
||||
|
||||
void updateAnalyses(@Param("analyses") GardsAnalysesSpectrum analyses);
|
||||
}
|
||||
|
|
|
@ -23,5 +23,15 @@
|
|||
WHERE
|
||||
IDANALYSIS = #{analyses.idAnalysis}
|
||||
</update>
|
||||
<update id="updateAnalyses">
|
||||
UPDATE
|
||||
RNMAN.GARDS_ANALYSES
|
||||
SET ANALYSISBEGIN = to_date(#{analyses.analysisBeginStr},'yyyy/MM/dd HH24:mi:ss'),
|
||||
ANALYSISEND = to_date(#{analyses.analysisEndStr},'yyyy/MM/dd HH24:mi:ss'),
|
||||
ANALYST = #{analyses.analyst},
|
||||
COMMENTS = #{analyses.comments}
|
||||
WHERE
|
||||
IDANALYSIS = #{analyses.idAnalysis}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -14,4 +14,5 @@ public interface IGardsAnalysesSpectrumService extends IService<GardsAnalyses> {
|
|||
|
||||
Integer saveAnalyses(Integer sampleId, String startTime, String userName);
|
||||
|
||||
void updateAnalyses(String startTime, String userName, Integer idAnalysis);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsAnalyses;
|
||||
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData;
|
||||
import org.jeecg.modules.entity.vo.PHDFile;
|
||||
import org.jeecg.modules.entity.GardsAnalysesSpectrum;
|
||||
import org.jeecg.modules.mapper.GardsAnalysesManMapper;
|
||||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||
import org.jeecg.modules.service.IGardsAnalysesSpectrumService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -19,6 +23,9 @@ import java.util.Date;
|
|||
@DS("ora")
|
||||
public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesManMapper, GardsAnalyses> implements IGardsAnalysesSpectrumService {
|
||||
|
||||
@Autowired
|
||||
private SpectrumAnalysisMapper spectrumAnalysisMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer insertEntity(GStoreMiddleProcessData middleData, PHDFile phd, String userName, String comments) {
|
||||
|
@ -87,7 +94,17 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesM
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
this.save(analyses);
|
||||
return analyses.getIdAnalysis();
|
||||
String idAnalysis = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(sampleId.toString(), userName);
|
||||
return StrUtil.isBlank(idAnalysis) ? null : Integer.valueOf(idAnalysis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAnalyses(String startTime, String userName, Integer idAnalysis) {
|
||||
GardsAnalysesSpectrum analyses = new GardsAnalysesSpectrum();
|
||||
analyses.setIdAnalysis(idAnalysis);
|
||||
analyses.setAnalysisBeginStr(startTime);
|
||||
analyses.setAnalyst(userName);
|
||||
analyses.setAnalysisEndStr(DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss"));
|
||||
this.baseMapper.updateAnalyses(analyses);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -43,9 +45,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.w3c.dom.*;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
|
@ -2017,6 +2024,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
sampleVueData.setMapEffiPara(phdOne.getMapEffiPara());
|
||||
result.setSuccess(true);
|
||||
result.setResult(roiMap);
|
||||
selfStationData.setBAnalyed(true);
|
||||
} catch (RuntimeException e) {
|
||||
result.error500(StrUtil.replace(e.getMessage(), "%s", "ROI"));
|
||||
}
|
||||
|
@ -4020,7 +4028,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
result.error500("Please select the parse file first!");
|
||||
return result;
|
||||
}
|
||||
if (!phd.isBAnalyed()) {
|
||||
if (!selfStationData.isBAnalyed()) {
|
||||
result.error500("Please first Reprocessing!");
|
||||
return result;
|
||||
}
|
||||
|
@ -4032,10 +4040,10 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
List<String> userStation = userTaskUtil.findUserStation(userName);
|
||||
boolean bAnalysisResultWriteAuthority = userStation.contains(String.valueOf(stationId));
|
||||
// 获取Beta谱文件的inputFileName
|
||||
String saveFileName = saveFileName(sampleStruct);
|
||||
String savePathName = savePathName(sampleStruct);
|
||||
String saveFileName = saveFileName(sampleStruct);
|
||||
String sampleInputFileName = savePathName + StrUtil.SLASH + saveFileName;
|
||||
//判断当前分析员是否有过历史分析当前文件 TODO RNMAN.GARDS_ANALYSIS_ROI表没有分析员字段
|
||||
//判断当前分析员是否有过历史分析当前文件 TODO
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleInputFileName, userName);
|
||||
// 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员
|
||||
if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) {
|
||||
|
@ -4051,6 +4059,9 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
List<GStoreMiddleProcessData> middleDatas =
|
||||
ListUtil.toList(middleData1, middleData2, middleData3, middleData4);
|
||||
List<PHDFile> phdFiles = create4PHD(sampleStruct);
|
||||
//读取参数内容
|
||||
Map<String, CalMDCInfo> mdcInfoMap = readMDCParameter(phdFiles);
|
||||
|
||||
bRet = gammaFileUtil.GetInterMiddlData(phdFiles, userName, middleDatas, "save");
|
||||
if (!bRet) {
|
||||
result.error500("Transform PHDFile into structGStoreMiddleProcessData failed.");
|
||||
|
@ -4088,8 +4099,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
// 修改sample_data状态
|
||||
spectrumAnalysisMapper.updateAnalysesStatus(sampleInputFileName);
|
||||
} else {
|
||||
// 更新 RNMAN.GARDS_ANALYSES 表数据 TODO
|
||||
|
||||
// 更新 RNMAN.GARDS_ANALYSES 表数据
|
||||
analysesSpectrumService.updateAnalyses(phd.getAnaly_start_time(), userName, idAnalysis);
|
||||
// 删除 RNMAN.GARDS_ANALYSES_ROI 表数据
|
||||
analysisManService.deleteAnalysisROI(idAnalysis);
|
||||
// 删除GARDS_CALIBRATION_PAIRS_ROI表数据
|
||||
|
@ -4123,9 +4134,9 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
// 向 RNMAN.GARDS_QC_CHECK 表写入 QC 检查结果
|
||||
//analysisManService.saveQcCheckROI(sampleId, null);
|
||||
// 向 RNMAN.GARDS_ANALY_SETTING 表写入 SpecSetup 分析参数设置
|
||||
analysisManService.saveAnalySettingGamma(phd, idAnalysis);
|
||||
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果 TODO
|
||||
analysisManService.saveMDCROI(sampleId, null, idAnalysis);
|
||||
analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles);
|
||||
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
||||
analysisManService.saveMDCROI(sampleId, mdcInfoMap, idAnalysis);
|
||||
if (bRet) {
|
||||
phd.setStatus("R");
|
||||
//分析成功后存储日志文件和报告文件
|
||||
|
@ -4166,6 +4177,77 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Map<String, CalMDCInfo> readMDCParameter(List<PHDFile> phdFiles) {
|
||||
//存储文件结果用的map
|
||||
Map<String, CalMDCInfo> mdcInfoMap = new TreeMap<>();
|
||||
if (CollUtil.isEmpty(phdFiles)) return mdcInfoMap;
|
||||
String systemType = phdFiles.get(0).getHeader().getSystem_type();
|
||||
//配置文件路径
|
||||
String filePath = parameterProperties.getFilePath()+ File.separator + "MDCParameter.xml";
|
||||
try {
|
||||
//创建一个文档解析器工厂
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
//创建文档解析器
|
||||
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
|
||||
//读取xml文件生成一个文档
|
||||
Document document = documentBuilder.parse(filePath);
|
||||
if (Objects.nonNull(document)){
|
||||
//获取文档的根元素
|
||||
Element element = document.getDocumentElement();
|
||||
//获取根元素的子节点
|
||||
NodeList docChildNodes = element.getChildNodes();
|
||||
//判断文件内的节点是否大于0
|
||||
if (Objects.nonNull(docChildNodes) && docChildNodes.getLength() > 0) {
|
||||
//遍历文件节点读取内容
|
||||
for (int i=0; i<docChildNodes.getLength(); i++) {
|
||||
//获取节点信息
|
||||
Node node = docChildNodes.item(i);
|
||||
if (node.getNodeName().equalsIgnoreCase(systemType)) {
|
||||
NodeList childNodes = node.getChildNodes();
|
||||
if (Objects.nonNull(childNodes) && childNodes.getLength() > 0) {
|
||||
//遍历子节点信息
|
||||
for (int j=0; j< childNodes.getLength(); j++) {
|
||||
//获取子节点信息
|
||||
Node childNode = childNodes.item(j);
|
||||
//判断节点名称是否是item
|
||||
if (childNode.getNodeName().equalsIgnoreCase("item")) {
|
||||
//获取节点属性信息
|
||||
NamedNodeMap attributes = childNode.getAttributes();
|
||||
//判断节点属性信息是否为空
|
||||
if (Objects.nonNull(attributes)) {
|
||||
CalMDCInfo info = new CalMDCInfo();
|
||||
//遍历属性信息
|
||||
for (int k=0; k<attributes.getLength(); k++) {
|
||||
//根据顺序读取属性
|
||||
Node attribute = attributes.item(k);
|
||||
if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) {
|
||||
info.setNuclideName(attribute.getNodeValue());
|
||||
} else if (attribute.getNodeName().equalsIgnoreCase("halflife")) {
|
||||
info.setHalflife(Double.valueOf(attribute.getNodeValue()));
|
||||
}
|
||||
}
|
||||
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(info.getNuclideName()) && Objects.nonNull(info.getHalflife())) {
|
||||
mdcInfoMap.put(info.getNuclideName(), info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MapUtil.isNotEmpty(mdcInfoMap)) {
|
||||
for (PHDFile phdFile : phdFiles) {
|
||||
phdFile.setMdcInfoMap(mdcInfoMap);
|
||||
}
|
||||
}
|
||||
} catch (ParserConfigurationException | IOException | SAXException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return mdcInfoMap;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
boolean bRet = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user