feat:comment接口 loadFromDB

This commit is contained in:
nieziyan 2024-08-14 15:15:50 +08:00
parent c0ba24aae4
commit 6d2ec53b4c
17 changed files with 776 additions and 47 deletions

View File

@ -13,6 +13,8 @@ public class CalMDCInfo implements Serializable {
*/
private String nuclideName;
private Integer roiId;
/**
* 核素能量
*/

View File

@ -9,6 +9,6 @@ public class CommentData implements Serializable {
private String analyst;
private String comment;
private String comments;
}

View File

@ -236,6 +236,7 @@ public class Sample_C_Analysis {
boolean analyFlag = analyFlag1 && analyFlag2 && analyFlag3 && analyFlag4;
if (analyFlag) {
this.endAnalysisTime = new Date();
// 数据插入数据库
this.storageDataToDatabase(mdcInfoMap, null,
middleData1, middleData2, middleData3, middleData4);
@ -262,8 +263,6 @@ public class Sample_C_Analysis {
} else {
throw new CAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
}
}finally {
this.endAnalysisTime = new Date();
}
log.info("SelfStaion自动处理分析--End");
}
@ -372,10 +371,13 @@ public class Sample_C_Analysis {
}
private void queryPHDFile() throws FileNotExistException {
//查询det和gas能谱文
this.detSampleData = serviceQuotes.getSampleDataService().getSampleIdAndInputFileName(this.sampleStruct.detector_bk_measurement_id, DataTypeAbbr.DETBKPHD.getType(), this.sampleStruct.system_type);
//查询det 能谱文件
String detectorBkMeasurementId = this.sampleStruct.detector_bk_measurement_id;
if (StrUtil.equals(detectorBkMeasurementId, "0")) return;
//如果找不到sampledetgas谱文件数据则解析失败修改记录状态
this.detSampleData = serviceQuotes.getSampleDataService().getSampleIdAndInputFileName(detectorBkMeasurementId, DataTypeAbbr.DETBKPHD.getType(), this.sampleStruct.system_type);
//如果找不到sampledet谱文件数据则解析失败修改记录状态
if(StringUtils.isEmpty(this.sampleData.getInputFileName()) || Objects.isNull(this.detSampleData) || StringUtils.isEmpty(this.detSampleData.getInputFileName())){
parsingProcessLog.setFileNotExist(true);
@ -386,6 +388,8 @@ public class Sample_C_Analysis {
}
private void getPHDFile() throws FileNotExistException {
if (ObjectUtil.isNull(detSampleData)) return;
boolean flag = false;
//det谱PHD文件本地路径
@ -1413,8 +1417,10 @@ public class Sample_C_Analysis {
analysis.setSwVersion(serviceQuotes.getSoftwareProperties().getSwVersion());
analysis.setAnalyst(serviceQuotes.getSoftwareProperties().getAnalyst());
analysis.setComments("test");//按C++代码写死的test
analysis.setUseddetphd(detSampleData.getInputFileName());
analysis.setUseddetphdId(detSampleData.getSampleId());
if (ObjectUtil.isNotNull(detSampleData)){
analysis.setUseddetphd(detSampleData.getInputFileName());
analysis.setUseddetphdId(detSampleData.getSampleId());
}
analysis.setLogPath(FileOperation.separatorConvert(logPath));
analysis.setReportPath(FileOperation.separatorConvert(reportPath));
serviceQuotes.getAnalysesService().save(analysis);

View File

@ -443,6 +443,121 @@ public class SelfStationUtil extends AbstractLogOrReport {
return map;
}
public Map<String, Object> getGammaByROI1(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);
}
return map;
}
public List<Long> roiList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
// g_counts
List<Long> counts = new LinkedList<>();

View File

@ -439,4 +439,10 @@ public class SelfStationController {
public void exportPeakInformation(String sampleFileName, HttpServletRequest request, HttpServletResponse response){
selfStationService.exportPeakInformation(sampleFileName, request, response);
}
@GetMapping("viewComment")
@ApiOperation(value = "查看comment数据", notes = "查看comment数据")
public Result viewComment(Integer sampleId, String sampleFileName, HttpServletRequest request) {
return selfStationService.viewComment(sampleId, sampleFileName, request);
}
}

View File

@ -16,6 +16,8 @@ public class GardsCalibrationPairsSpectrum implements Serializable {
*/
private Integer sampleId;
private Integer roiId;
/**
* 分析ID号
*/

View File

@ -16,6 +16,8 @@ public class GardsCalibrationSpectrum implements Serializable {
*/
private Integer sampleId;
private Integer roiId;
/**
* 分析ID号
*/

View File

@ -16,6 +16,8 @@ public class GardsNuclIdedSpectrum implements Serializable {
*/
private Integer sampleId;
private Integer roiId;
/**
* 分析ID号
*/

View File

@ -16,6 +16,8 @@ public class GardsNuclLinesIdedSpectrum implements Serializable {
*/
private Integer sampleId;
private Integer roiId;
/**
* 峰序号
*/

View File

@ -16,6 +16,8 @@ public class GardsPeaksSpectrum implements Serializable {
*/
private Integer sampleId;
private Integer roiId;
/**
* 峰序号
*/

View File

@ -12,6 +12,8 @@ public class GardsQcCheckSpectrum implements Serializable {
private Integer sampleId;
private Integer roiId;
private Integer idanalysis;
private String qcName;

View File

@ -66,22 +66,40 @@ public interface SpectrumAnalysisMapper {
GardsAnalysesSpectrum getAnalysis(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
List<Integer> roiIds(@Param(value = "dbName") String dbName, @Param("idAnalysis") Integer idAnalysis);
List<GardsPeaksSpectrum> getPeaks(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsPeaksSpectrum> getPeaksROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsCalibrationPairsSpectrum> getCalibrationPairs(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsCalibrationPairsSpectrum> getCalibrationPairsROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsCalibrationSpectrum> getPara(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsCalibrationSpectrum> getParaROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsNuclLinesIdedSpectrum> getNuclLinesIded(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsNuclLinesIdedSpectrum> getNuclLinesIdedROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsNuclIdedSpectrum> getNuclIded(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsNuclIdedSpectrum> getNuclIdedROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsQcCheckSpectrum> getQcCheck(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<GardsQcCheckSpectrum> getQcCheckROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<CalMDCInfo> getMDC(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
List<CalMDCInfo> getMDCROI(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
GardsAnalySetting getAnalySetting(@Param(value = "idAnalysis") Integer idAnalysis);
List<GardsAnalySettingRoi> getAnalySettingROI(@Param(value = "idAnalysis") Integer idAnalysis);
List<NuclideLine> getNuclideLines(@Param(value = "name") String name);
List<HalfData> getHalf(@Param(value = "names") List<String> names);

View File

@ -465,6 +465,10 @@
and ANALYST = #{userName}
</select>
<select id="roiIds" resultType="Integer">
SELECT ROI_ID FROM ${dbName} WHERE IDANALYSIS = #{idAnalysis} ORDER BY ROI_ID ASC
</select>
<select id="getPeaks" resultType="org.jeecg.modules.entity.GardsPeaksSpectrum">
SELECT
IDPEAK idPeak,
@ -497,14 +501,55 @@
ORDER BY IDPEAK
</select>
<select id="getPeaksROI" resultType="org.jeecg.modules.entity.GardsPeaksSpectrum">
SELECT
IDPEAK idPeak,
ROI_ID roiId,
CENTROIDCHANNEL centroidChannel,
ENERGY energy,
AREA area,
UNCAREA uncArea,
EFFICIENCY efficiency,
FWHM fwhm,
FWTM fwtm,
SIGNIFICANCE significance,
LC lc,
ROISTART roiStart,
ROIEND roiEnd,
MULTIINDEX mulitiIndex,
TAIL tail,
TAILALPHA tailAlpha,
UPPERTAIL upperTail,
UPPERTAILALPHA upperTailAlpha,
BWWIDTHCHAN bwwidthchan,
RECOILDELTACHAN recoildeltachan,
STEPRAIO stepraio,
LD ld,
SENSITIVITY sensitivity,
BACKGROUNDAREA backgroundarea,
MEANBACKCOUNT meanbackcount,
PEAKCOMMENTS peakcomments
FROM ${dbName}
WHERE IDANALYSIS = #{idAnalysis}
ORDER BY IDPEAK
</select>
<select id="getCalibrationPairs" resultType="org.jeecg.modules.entity.GardsCalibrationPairsSpectrum">
SELECT CALTYPE, INPUT, XVALUE, YVALUE, UNCYVALUE FROM ${dbName} WHERE IDANALYSIS = #{idAnalysis} ORDER BY XVALUE
SELECT CALTYPE, INPUT, XVALUE, YVALUE, UNCYVALUE, ROI_ID FROM ${dbName} WHERE IDANALYSIS = #{idAnalysis} ORDER BY XVALUE
</select>
<select id="getCalibrationPairsROI" resultType="org.jeecg.modules.entity.GardsCalibrationPairsSpectrum">
SELECT CALTYPE, INPUT, XVALUE, YVALUE, UNCYVALUE, ROI_ID FROM ${dbName} WHERE IDANALYSIS = #{idAnalysis} ORDER BY XVALUE
</select>
<select id="getPara" resultType="org.jeecg.modules.entity.GardsCalibrationSpectrum">
SELECT * FROM ${dbName} WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getParaROI" resultType="org.jeecg.modules.entity.GardsCalibrationSpectrum">
SELECT * FROM ${dbName} WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getNuclLinesIded" resultType="org.jeecg.modules.entity.GardsNuclLinesIdedSpectrum">
SELECT
NUCLIDENAME nuclideName,
@ -526,6 +571,28 @@
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getNuclLinesIdedROI" resultType="org.jeecg.modules.entity.GardsNuclLinesIdedSpectrum">
SELECT
ROI_ID roiId,
NUCLIDENAME nuclideName,
NUCLIDEFULLNAME nuclidefullname,
IDPEAK idPeak,
ENERGY energy,
UNCENERGY uncEnergy,
ABUNDANCE abundance,
UNCABUNDANCE uncAbundance,
ACTIVITY activity,
UNCACTIVITY uncActivity,
EFFIC effic,
UNEFFIC unEffic,
MDA mda,
KEY_FLAG keyFlag,
MDC mdc,
CONCENTRATION concentration
FROM ${dbName}
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getNuclIded" resultType="org.jeecg.modules.entity.GardsNuclIdedSpectrum">
SELECT NUCLIDENAME nuclideName,
HALFLIFE halflife,
@ -535,6 +602,17 @@
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getNuclIdedROI" resultType="org.jeecg.modules.entity.GardsNuclIdedSpectrum">
SELECT
ROI_ID roiId,
NUCLIDENAME nuclideName,
HALFLIFE halflife,
KEY_ENERGY keyEnergy,
KEY_YIELD keyYield
FROM ${dbName}
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getQcCheck" resultType="org.jeecg.modules.entity.GardsQcCheckSpectrum">
SELECT QC_NAME qcName,
QC_VALUE qcValue,
@ -544,6 +622,16 @@
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getQcCheckROI" resultType="org.jeecg.modules.entity.GardsQcCheckSpectrum">
SELECT ROI_ID roiId,
QC_NAME qcName,
QC_VALUE qcValue,
QC_STANDARD qcStandard,
QC_RESULT qcResult
FROM ${dbName}
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getMDC" resultType="org.jeecg.modules.entity.vo.CalMDCInfo">
SELECT NUCLIDENAME nuclideName,
ENERGY energy,
@ -554,6 +642,17 @@
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getMDCROI" resultType="org.jeecg.modules.entity.vo.CalMDCInfo">
SELECT ROI_ID roiId,
NUCLIDENAME nuclideName,
ENERGY energy,
YIELD yield,
EFFICIENCY efficiency,
MDC mdc
FROM ${dbName}
WHERE IDANALYSIS = #{idAnalysis}
</select>
<select id="getAnalySetting" resultType="org.jeecg.modules.base.entity.rnman.GardsAnalySetting">
SELECT
ECUTANALYSIS_LOW,
@ -575,6 +674,28 @@
WHERE idanalysis = #{idAnalysis}
</select>
<select id="getAnalySettingROI" resultType="org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi">
SELECT
ROI_ID,
ECUTANALYSIS_LOW,
ECUTANALYSIS_HIGH,
ENERGYTOLERANCE,
CALIBRATIONPSS_HIGH,
CALIBRATIONPSS_LOW,
BASEIMPROVEPSS,
PSS_LOW,
K_BACK,
K_ALPHA,
K_BETA,
RISKLEVELK,
BUPDATECAL,
KEEPCALPEAKSERCHPEAKS,
REFTIME_ACT,
REFTIME_CONC
FROM RNMAN.GARDS_ANALY_SETTING_ROI
WHERE idanalysis = #{idAnalysis}
</select>
<select id="getNuclideLines" resultType="org.jeecg.modules.entity.vo.NuclideLine">
SELECT FULLNAME as fullName,
ENERGY as energy,

View File

@ -142,4 +142,6 @@ public interface ISelfStationService {
Result<?> peakInformation(String sampleFileName, HttpServletRequest request);
void exportPeakInformation(String sampleFileName, HttpServletRequest request, HttpServletResponse response);
Result<?> viewComment(Integer sampleId, String sampleFileName, HttpServletRequest request);
}

View File

@ -3871,7 +3871,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (Objects.nonNull(sampleId)) {
CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId);
if (Objects.nonNull(commentData)) {
temp = commentData.getComment() == null ? "" : commentData.getComment().trim();
temp = commentData.getComments() == null ? "" : commentData.getComments().trim();
if (StringUtils.isNotBlank(temp)) {
comments += "\n\nComments From " + commentData.getAnalyst() + "\n:" + temp;
}

View File

@ -34,14 +34,18 @@ import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi;
import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.base.enums.CalName;
import org.jeecg.modules.base.enums.CalType;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.*;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -62,6 +66,7 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -177,6 +182,8 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
return result;
}
roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID);
// 获取当前角色配置的颜色信息
Map<String, String> colorMap = sysUserColorService.initColor(userName);
try {
if (Objects.nonNull(analysisID)) {
//查询数据库文件信息
@ -243,7 +250,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
selfStationData.setSampleTmpPath(sampleFilePath);
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
// 交互库需要获取最新的ROI数据
if (dbName.equalsIgnoreCase("man")) {
if (dbName.equalsIgnoreCase("RNMAN")) {
List<GardsAnalysisRoi> roiList = analysisRoiManService.analysisRoi(analysisID);
LinkedList<Integer> start = Lists.newLinkedList();
LinkedList<Integer> stop = Lists.newLinkedList();
@ -251,13 +258,60 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
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<String, Object> gammaByROI = selfStationUtil.getGammaByROI1("", start, stop, selfStationData);
map.putAll(gammaByROI);
}
// 将四个Gamma ROI文件对象放到缓存中
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
Map<Integer, String> roiPathMap = roiPaths.stream()
.collect(Collectors.toMap(RoiDto::getRoiNum, RoiDto::getPhdPath));
String fullPath1 = prefix + roiPathMap.get(1);
String fullPath2 = prefix + roiPathMap.get(2);
String fullPath3 = prefix + roiPathMap.get(3);
String fullPath4 = prefix + roiPathMap.get(4);
String name1 = FileUtil.getName(fullPath1);
String name2 = FileUtil.getName(fullPath2);
String name3 = FileUtil.getName(fullPath3);
String name4 = FileUtil.getName(fullPath4);
String path = fullPath1.substring(0, fullPath1.lastIndexOf(StrUtil.SLASH));
PHDFile phd1 = selfStationUtil.getGammaPHD(name1, path);
PHDFile phd2 = selfStationUtil.getGammaPHD(name2, path);
PHDFile phd3 = selfStationUtil.getGammaPHD(name3, path);
PHDFile phd4 = selfStationUtil.getGammaPHD(name4, path);
// 从数据库加载 ROI信息
List<PHDFile> phdFiles = ListUtil.toList(phd1, phd2, phd3, phd4);
getROIResultFromDB(dbName, sampleId, phdFiles, analysisID);
map.put("ROI1", loadROI(phd1, analyst, colorMap));
map.put("ROI2", loadROI(phd2, analyst, colorMap));
map.put("ROI3", loadROI(phd3, analyst, colorMap));
map.put("ROI4", loadROI(phd4, analyst, colorMap));
sampleVueData.setROIOneFileName(name1);
sampleVueData.setROIOnePHDFile(phd1);
sampleVueData.setROITwoFileName(name2);
sampleVueData.setROITwoPHDFile(phd2);
sampleVueData.setROIThreeFileName(name3);
sampleVueData.setROIThreePHDFile(phd3);
sampleVueData.setROIFourFileName(name4);
sampleVueData.setROIFourPHDFile(phd4);
resultMap.put("sample", map);
// 返回Beta和Gamma的数据
bGSpectrum(struct, map);
//将自建台站的数据封装到缓存对象中
selfCache.put(sampleFileName + StringPool.DASH + userName, selfStationData);
//将缓存对象存入到缓存中
selfStationCache.setSelfCache(selfCache);
}
}
//判断det文件名是否为空
@ -316,44 +370,14 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
redisUtil.set(userName+StringPool.DASH+systemType+"-list-self", userLib);
redisUtil.set(userName+StringPool.DASH+systemType+"-self", nuclideMap);
}
// 将四个Gamma ROI文件对象放到缓存中
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
Map<Integer, String> roiPathMap = roiPaths.stream()
.collect(Collectors.toMap(RoiDto::getRoiNum, RoiDto::getPhdPath));
String fullPath1 = prefix + roiPathMap.get(1);
String fullPath2 = prefix + roiPathMap.get(2);
String fullPath3 = prefix + roiPathMap.get(3);
String fullPath4 = prefix + roiPathMap.get(4);
String name1 = FileUtil.getName(fullPath1);
String name2 = FileUtil.getName(fullPath2);
String name3 = FileUtil.getName(fullPath3);
String name4 = FileUtil.getName(fullPath4);
String path = fullPath1.substring(0, fullPath1.lastIndexOf(StrUtil.SLASH));
sampleVueData.setROIOneFileName(name1);
sampleVueData.setROIOnePHDFile(selfStationUtil.getGammaPHD(name1, path));
sampleVueData.setROITwoFileName(name2);
sampleVueData.setROITwoPHDFile(selfStationUtil.getGammaPHD(name2, path));
sampleVueData.setROIThreeFileName(name3);
sampleVueData.setROIThreePHDFile(selfStationUtil.getGammaPHD(name3, path));
sampleVueData.setROIFourFileName(name4);
sampleVueData.setROIFourPHDFile(selfStationUtil.getGammaPHD(name4, path));
}
//将自建台站的数据封装到缓存对象中
selfCache.put(sampleFileName + StringPool.DASH + userName, selfStationData);
//将缓存对象存入到缓存中
selfStationCache.setSelfCache(selfCache);
} else {
if (Objects.nonNull(sample)) {
//返回结果map
Map<String, Object> map = new HashMap<>();
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
// 交互库需要获取最新的ROI数据
if (dbName.equalsIgnoreCase("man")) {
if (dbName.equalsIgnoreCase("RNMAN")) {
List<GardsAnalysisRoi> roiList = analysisRoiManService.analysisRoi(analysisID);
LinkedList<Integer> start = Lists.newLinkedList();
LinkedList<Integer> stop = Lists.newLinkedList();
@ -361,9 +385,20 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
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<String, Object> gammaByROI = selfStationUtil.getGammaByROI1("", start, stop, selfStationData);
map.putAll(gammaByROI);
}
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
PHDFile phd1 = sampleVueData.getROIOnePHDFile();
PHDFile phd2 = sampleVueData.getROITwoPHDFile();
PHDFile phd3 = sampleVueData.getROIThreePHDFile();
PHDFile phd4 = sampleVueData.getROIFourPHDFile();
map.put("ROI1", loadROI(phd1, analyst, colorMap));
map.put("ROI2", loadROI(phd2, analyst, colorMap));
map.put("ROI3", loadROI(phd3, analyst, colorMap));
map.put("ROI4", loadROI(phd4, analyst, colorMap));
resultMap.put("sample", map);
// 返回Beta和Gamma的数据
bGSpectrum(selfStationData.getSampleStruct(), map);
@ -512,6 +547,367 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
return result;
}
public Map<String, Object> loadROI(PHDFile phdFile, String analyst, Map<String, String> colorMap){
Map<String, Object> map = new HashMap<>();
// 加载phd数据所需的lcscacbaseline数据
gammaFileUtil.SetBaseInfo(phdFile, analyst);
map.put("bAnalyed", phdFile.isBAnalyed());
map.put("peak", phdFile.getVPeak());
map.put("BaseCtrls", phdFile.getBaseCtrls());
List<SeriseData> differance = gammaFileUtil.Differance(phdFile, phdFile.getVPeak());
map.put("barChart", differance);
gammaFileUtil.UpdateChart(phdFile, map, colorMap);
return map;
}
public boolean getROIResultFromDB(String dbName, Integer sampleId, List<PHDFile> phdFiles, Integer idAnalysis) {
// 判断连接的数据库
String T_analy = "";
String T_calib = "";
String T_peaks = "";
String T_param = "";
String T_nuc_line = "";
String T_nuc_act = "";
String T_qc = "";
String T_mdc = "";
if (dbName.equals("RNAUTO")) {
T_analy = "RNAUTO.GARDS_ANALYSIS_ROI";
T_calib = "RNAUTO.GARDS_CALIBRATION_PAIRS_ROI";
T_peaks = "RNAUTO.GARDS_PEAKS_ROI";
T_param = "RNAUTO.GARDS_CALIBRATION_ROI";
T_nuc_line = "RNAUTO.GARDS_NUCL_LINES_IDED_ROI";
T_nuc_act = "RNAUTO.GARDS_NUCL_IDED_ROI";
T_qc = "RNAUTO.GARDS_QC_CHECK_ROI";
T_mdc = "RNAUTO.GARDS_MDC_ROI";
} else if (dbName.equals("RNMAN")) {
T_analy = "RNMAN.GARDS_ANALYSIS_ROI";
T_calib = "RNMAN.GARDS_CALIBRATION_PAIRS_ROI";
T_peaks = "RNMAN.GARDS_PEAKS_ROI";
T_param = "RNMAN.GARDS_CALIBRATION_ROI";
T_nuc_line = "RNMAN.GARDS_NUCL_LINES_IDED_ROI";
T_nuc_act = "RNMAN.GARDS_NUCL_IDED_ROI";
T_qc = "RNMAN.GARDS_QC_CHECK_ROI";
T_mdc = "RNMAN.GARDS_MDC_ROI";
} else {
return false;
}
String status = spectrumAnalysisMapper.getStatus(sampleId);
if (org.apache.commons.lang3.StringUtils.isNotBlank(status)) {
if (!StrUtil.equals(status, "P") && !StrUtil.equals(status, "R")) {
return false;
}
} else {
return false;
}
List<Integer> roiIds = spectrumAnalysisMapper.roiIds(T_analy, idAnalysis);
// 获取峰信息列表
List<GardsPeaksSpectrum> peaks = spectrumAnalysisMapper.getPeaksROI(T_peaks, idAnalysis);
Map<Integer, List<GardsPeaksSpectrum>> peaksMap = peaks.stream()
.collect(Collectors.groupingBy(GardsPeaksSpectrum::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phdFile = phdFiles.get(i);
List<GardsPeaksSpectrum> peakList = peaksMap.get(roiId);
if (CollUtil.isEmpty(peakList)) continue;
for (GardsPeaksSpectrum peaksSpectrum : peakList) {
PeakInfo peakInfo = new PeakInfo();
peakInfo.index = peaksSpectrum.getIdPeak() == null ? 0 : peaksSpectrum.getIdPeak();
peakInfo.multiIndex = peaksSpectrum.getMulitiIndex() == null ? 0 : peaksSpectrum.getMulitiIndex().intValue();
peakInfo.left = peaksSpectrum.getRoiStart() == null ? 0 : peaksSpectrum.getRoiStart().intValue();
peakInfo.right = peaksSpectrum.getRoiEnd() == null ? 0 : peaksSpectrum.getRoiEnd().intValue();
peakInfo.peakCentroid = peaksSpectrum.getCentroidChannel() == null ? 0 : peaksSpectrum.getCentroidChannel();
peakInfo.energy = peaksSpectrum.getEnergy() == null ? 0 : peaksSpectrum.getEnergy();
peakInfo.fwhmc = peaksSpectrum.getFwtm() == null ? 0 : peaksSpectrum.getFwtm();
peakInfo.fwhm = peaksSpectrum.getFwhm() == null ? 0 : peaksSpectrum.getFwhm();
peakInfo.area = peaksSpectrum.getArea() == null ? 0 : peaksSpectrum.getArea();
peakInfo.areaErr = peaksSpectrum.getUncArea() == null ? 0 : peaksSpectrum.getUncArea();
peakInfo.efficiency = peaksSpectrum.getEfficiency() == null ? 0 : peaksSpectrum.getEfficiency();
peakInfo.lc = peaksSpectrum.getLc() == null ? 0 : peaksSpectrum.getLc();
peakInfo.ld = peaksSpectrum.getLd() == null ? 0 : peaksSpectrum.getLd();
peakInfo.meanBackCount = peaksSpectrum.getMeanbackcount() == null ? 0 : peaksSpectrum.getMeanbackcount();
peakInfo.backgroundArea = peaksSpectrum.getBackgroundarea() == null ? 0 : peaksSpectrum.getBackgroundarea();
peakInfo.significance = peaksSpectrum.getSignificance() == null ? Double.NaN : peaksSpectrum.getSignificance();
peakInfo.sensitivity = peaksSpectrum.getSensitivity() == null ? Double.NaN : peaksSpectrum.getSensitivity();
peakInfo.stepRatio = peaksSpectrum.getStepraio() == null ? 0 : peaksSpectrum.getStepraio();
peakInfo.tail = peaksSpectrum.getTail() == null ? 0 : peaksSpectrum.getTail();
peakInfo.tailAlpha = peaksSpectrum.getTailAlpha() == null ? 0 : peaksSpectrum.getTailAlpha();
peakInfo.upperTail = peaksSpectrum.getUpperTail() == null ? 0 : peaksSpectrum.getUpperTail();
peakInfo.upperTailAlpha = peaksSpectrum.getUpperTailAlpha() == null ? 0 : peaksSpectrum.getUpperTailAlpha();
peakInfo.BWWidthChan = peaksSpectrum.getBwwidthchan() == null ? Double.NaN : peaksSpectrum.getBwwidthchan();
peakInfo.recoilBetaChan = "nan";
peakInfo.recoilDeltaChan = peaksSpectrum.getRecoildeltachan() == null ? "nan" : String.valueOf(peaksSpectrum.getRecoildeltachan());
peakInfo.comments = org.apache.commons.lang3.StringUtils.isNotBlank(peaksSpectrum.getPeakcomments()) ? peaksSpectrum.getPeakcomments() : "";
phdFile.getVPeak().add(peakInfo);
}
}
// 获取刻度点数据
List<GardsCalibrationPairsSpectrum> calibrationPairs = spectrumAnalysisMapper.getCalibrationPairsROI(T_calib, idAnalysis);
Map<Integer, List<GardsCalibrationPairsSpectrum>> calibrationPairsMap = calibrationPairs.stream()
.collect(Collectors.groupingBy(GardsCalibrationPairsSpectrum::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
List<GardsCalibrationPairsSpectrum> calibrationPaireList = calibrationPairsMap.get(roiId);
if (CollUtil.isEmpty(calibrationPaireList)) continue;
GEnergyBlock gEnergyBlock = new GEnergyBlock();
GResolutionBlock gResolutionBlock = new GResolutionBlock();
GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock();
TotaleffBlock totaleffBlock = new TotaleffBlock();
for (GardsCalibrationPairsSpectrum pairsSpectrum : calibrationPaireList) {
String calType = pairsSpectrum.getCaltype().trim();
if (calType.equals(CalType.ENERGY_CAL.getType())) {
phd.setUsedEner(pairsSpectrum.getInput());
gEnergyBlock.getCentroid_channel().add(pairsSpectrum.getXValue());
gEnergyBlock.getG_energy().add(pairsSpectrum.getYValue());
gEnergyBlock.getUncertainty().add(org.apache.commons.lang3.StringUtils.isBlank(pairsSpectrum.getUncYValue()) ? 0 : Double.valueOf(pairsSpectrum.getUncYValue()));
} else if (calType.equals(CalType.RESOLUTION_CAL.getType())) {
phd.setUsedReso(pairsSpectrum.getInput());
gResolutionBlock.getG_energy().add(pairsSpectrum.getXValue());
gResolutionBlock.getFWHM().add(pairsSpectrum.getYValue());
gResolutionBlock.getUncertainty().add(org.apache.commons.lang3.StringUtils.isBlank(pairsSpectrum.getUncYValue()) ? 0 : Double.valueOf(pairsSpectrum.getUncYValue()));
} else if (calType.equals(CalType.EFFICIENCY_CAL.getType())) {
phd.setUsedEffi(pairsSpectrum.getInput());
gEfficiencyBlock.getG_energy().add(pairsSpectrum.getXValue());
gEfficiencyBlock.getEfficiency().add(pairsSpectrum.getYValue());
gEfficiencyBlock.getUncertainty().add(org.apache.commons.lang3.StringUtils.isBlank(pairsSpectrum.getUncYValue()) ? 0 : Double.valueOf(pairsSpectrum.getUncYValue()));
} else if (calType.equals(CalType.TOTALEFFICIENCY_CAL.getType())) {
phd.setUsedTotE(pairsSpectrum.getInput());
totaleffBlock.getG_energy().add(pairsSpectrum.getXValue());
totaleffBlock.getTotal_efficiency().add(pairsSpectrum.getYValue());
totaleffBlock.getUncertainty().add(org.apache.commons.lang3.StringUtils.isBlank(pairsSpectrum.getUncYValue()) ? 0 : Double.valueOf(pairsSpectrum.getUncYValue()));
}
}
if (phd.getUsedEner().isEmpty()) {
phd.setUsedEner(CalName.CalPHD.getType());
}
if (phd.getUsedReso().isEmpty()) {
phd.setUsedReso(CalName.CalPHD.getType());
}
if (phd.getUsedEffi().isEmpty()) {
phd.setUsedEffi(CalName.CalPHD.getType());
}
if (phd.getUsedTotE().isEmpty()) {
phd.setUsedTotE(CalName.CalPHD.getType());
}
gEnergyBlock.setRecord_count(gEnergyBlock.getG_energy().size());
gResolutionBlock.setRecord_count(gResolutionBlock.getG_energy().size());
gEfficiencyBlock.setRecord_count(gEfficiencyBlock.getG_energy().size());
totaleffBlock.setRecord_count(totaleffBlock.getG_energy().size());
if (gEnergyBlock.getRecord_count() > 0) {
phd.setUsedEnerKD(gEnergyBlock);
phd.getMapEnerKD().put(phd.getUsedEner(), gEnergyBlock);
}
if (gResolutionBlock.getRecord_count() > 0) {
phd.setUsedResoKD(gResolutionBlock);
phd.getMapResoKD().put(phd.getUsedReso(), gResolutionBlock);
}
if (gEfficiencyBlock.getRecord_count() > 0) {
phd.setUsedEffiKD(gEfficiencyBlock);
phd.getMapEffiKD().put(phd.getUsedEffi(), gEfficiencyBlock);
}
if (totaleffBlock.getRecord_count() > 0) {
phd.setUsedTotEKD(totaleffBlock);
phd.getMapTotEKD().put(phd.getUsedTotE(), totaleffBlock);
}
}
// 获取刻度拟合系数
List<GardsCalibrationSpectrum> paras = spectrumAnalysisMapper.getParaROI(T_param, idAnalysis);
Map<Integer, List<GardsCalibrationSpectrum>> parasMap = paras.stream()
.collect(Collectors.groupingBy(GardsCalibrationSpectrum::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
List<GardsCalibrationSpectrum> parasList = parasMap.get(roiId);
if (CollUtil.isEmpty(parasList)) continue;
for (GardsCalibrationSpectrum calibrationSpectrum : parasList) {
ParameterInfo para = new ParameterInfo();
String calType = calibrationSpectrum.getCalType().trim();
para.getP().add(calibrationSpectrum.getFunction().doubleValue());
String[] list_coeff = calibrationSpectrum.getCoeffString().split(StringPool.COMMA);
for (String str : list_coeff) {
para.getP().add(Double.valueOf(str));
para.getPerr().add(0.0);
}
if (calType.equals(CalType.ENERGY_CAL.getType())) {
phd.setUsedEnerPara(para);
phd.getMapEnerPara().put(phd.getUsedEner(), para);
phd.setNewEner(phd.getUsedEner());
} else if (calType.equals(CalType.RESOLUTION_CAL.getType())) {
phd.setUsedResoPara(para);
phd.getMapResoPara().put(phd.getUsedReso(), para);
phd.setNewReso(phd.getUsedReso());
} else if (calType.equals(CalType.EFFICIENCY_CAL.getType())) {
phd.setUsedEffiPara(para);
phd.getMapEffiPara().put(phd.getUsedEffi(), para);
phd.setNewEffi(phd.getUsedEffi());
} else if (calType.equals(CalType.TOTALEFFICIENCY_CAL.getType())) {
phd.setUsedTotEPara(para);
phd.getMapTotEPara().put(phd.getUsedTotE(), para);
phd.setNewTotE(phd.getUsedTotE());
}
}
}
// 获取被识别核素射线信息
List<GardsNuclLinesIdedSpectrum> nuclLinesIdeds = spectrumAnalysisMapper.getNuclLinesIdedROI(T_nuc_line, idAnalysis);
Map<Integer, List<GardsNuclLinesIdedSpectrum>> nuclLinesIdedsMap = nuclLinesIdeds.stream()
.collect(Collectors.groupingBy(GardsNuclLinesIdedSpectrum::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
List<GardsNuclLinesIdedSpectrum> nuclLinesIdedsList = nuclLinesIdedsMap.get(roiId);
if (CollUtil.isEmpty(nuclLinesIdedsList)) continue;
for (GardsNuclLinesIdedSpectrum nuclLinesIdedSpectrum : nuclLinesIdedsList) {
String str_key = nuclLinesIdedSpectrum.getNuclideName();
if (Objects.isNull(phd.getMapNucActMda().get(str_key))) {
phd.getMapNucActMda().put(str_key, new NuclideActMda());
}
if (Objects.nonNull(phd.getMapNucActMda().get(str_key))) {
phd.getMapNucActMda().get(str_key).setActivity(Double.valueOf(nuclLinesIdedSpectrum.getActivity()));
phd.getMapNucActMda().get(str_key).setAct_err(nuclLinesIdedSpectrum.getUncActivity());
phd.getMapNucActMda().get(str_key).setEfficiency(nuclLinesIdedSpectrum.getEffic());
phd.getMapNucActMda().get(str_key).setEffi_err(nuclLinesIdedSpectrum.getUnEffic());
phd.getMapNucActMda().get(str_key).setMda(nuclLinesIdedSpectrum.getMda());
phd.getMapNucActMda().get(str_key).setMdc(nuclLinesIdedSpectrum.getMdc().equalsIgnoreCase("inf") ? null : Double.valueOf(nuclLinesIdedSpectrum.getMdc()));
phd.getMapNucActMda().get(str_key).setConcentration(nuclLinesIdedSpectrum.getConcentration().equalsIgnoreCase("inf") ? null : Double.valueOf(nuclLinesIdedSpectrum.getConcentration()));
if (phd.getMapNucActMda().get(str_key).getActivity() > 0) {
phd.getMapNucActMda().get(str_key).setBCalculateMDA(true);
}
}
if (nuclLinesIdedSpectrum.getKeyFlag().toString().equals("1")) {
phd.getMapNucActMda().get(str_key).setKey_flag(phd.getMapNucActMda().get(str_key).getVYield().size());
}
phd.getMapNucActMda().get(str_key).getFullNames().add(nuclLinesIdedSpectrum.getNuclidefullname());
phd.getMapNucActMda().get(str_key).getVEnergy().add(nuclLinesIdedSpectrum.getEnergy());
phd.getMapNucActMda().get(str_key).getVUncertE().add(nuclLinesIdedSpectrum.getUncEnergy());
phd.getMapNucActMda().get(str_key).getVYield().add(nuclLinesIdedSpectrum.getAbundance());
phd.getMapNucActMda().get(str_key).getVUncertY().add(nuclLinesIdedSpectrum.getUncAbundance());
int idx = nuclLinesIdedSpectrum.getIdPeak() - 1;
if (idx >= 0) { // && idx < peakNum
phd.getMapNucActMda().get(str_key).getVPeakIdx().add(idx + 1);
if (!phd.getVPeak().get(idx).nuclides.contains(str_key)) {
phd.getVPeak().get(idx).nuclides.add(str_key);
}
}
}
}
// 获取被识别核素的活度浓度
List<GardsNuclIdedSpectrum> nuclIdeds = spectrumAnalysisMapper.getNuclIdedROI(T_nuc_act, idAnalysis);
Map<Integer, List<GardsNuclIdedSpectrum>> nuclIdedsMap = nuclIdeds.stream()
.collect(Collectors.groupingBy(GardsNuclIdedSpectrum::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
List<GardsNuclIdedSpectrum> nuclIdedsList = nuclIdedsMap.get(roiId);
if (CollUtil.isEmpty(nuclIdedsList)) continue;
for (GardsNuclIdedSpectrum nuclIdedSpectrum : nuclIdedsList) {
String str_key = nuclIdedSpectrum.getNuclideName();
if (Objects.nonNull(phd.getMapNucActMda().get(str_key))) {
phd.getMapNucActMda().get(str_key).setHalflife(Double.valueOf(nuclIdedSpectrum.getHalflife()));
List<Double> vEner = phd.getMapNucActMda().get(str_key).getVEnergy();
Double key_ener = Double.valueOf(nuclIdedSpectrum.getKeyEnergy());
for (int j = 0; j < vEner.size(); j++) {
if (Math.abs(vEner.get(j) - key_ener) < 1E-6) {
phd.getMapNucActMda().get(str_key).setCalculateIdx(j);
break;
}
}
}
}
}
// 获取 QC 结果
List<GardsQcCheckSpectrum> qcChecks = spectrumAnalysisMapper.getQcCheckROI(T_qc, idAnalysis);
Map<Integer, List<GardsQcCheckSpectrum>> qcChecksMap = qcChecks.stream()
.collect(Collectors.groupingBy(GardsQcCheckSpectrum::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
List<GardsQcCheckSpectrum> qcChecksList = qcChecksMap.get(roiId);
if (CollUtil.isEmpty(qcChecksList)) continue;
for (GardsQcCheckSpectrum qcCheckSpectrum : qcChecksList) {
String str_key = qcCheckSpectrum.getQcName();
QcCheckItem qcCheckItem = new QcCheckItem();
qcCheckItem.setValue(qcCheckSpectrum.getQcValue() == null?0.0:qcCheckSpectrum.getQcValue());
qcCheckItem.setBPass(qcCheckSpectrum.getQcResult() == 1);
qcCheckItem.setStandard(qcCheckSpectrum.getQcStandard());
phd.getQcItems().put(str_key, qcCheckItem);
}
}
// 获取 MDC 结果
List<CalMDCInfo> calMDCInfo = spectrumAnalysisMapper.getMDCROI(T_mdc, idAnalysis);
Map<Integer, List<CalMDCInfo>> calMDCInfoMap = calMDCInfo.stream()
.collect(Collectors.groupingBy(CalMDCInfo::getRoiId));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
List<CalMDCInfo> calMDCInfoList = calMDCInfoMap.get(roiId);
if (CollUtil.isEmpty(calMDCInfoList)) continue;
Map<String, CalMDCInfo> mdcInfoMap = calMDCInfoList.stream()
.collect(Collectors.toMap(CalMDCInfo::getNuclideName, Function.identity()));
phd.setMdcInfoMap(mdcInfoMap);
}
// RNMAN.GARDS_ANALY_SETTING_ROI 表读分析设置
if (StrUtil.equals(dbName, "RNMAN")) {
List<GardsAnalySettingRoi> analySettingROIs = spectrumAnalysisMapper.getAnalySettingROI(idAnalysis);
Map<Integer, GardsAnalySettingRoi> analySettingROIsMap = analySettingROIs.stream()
.collect(Collectors.toMap(GardsAnalySettingRoi::getRoiId, analySettingROI -> analySettingROI));
for (int i = 0; i < roiIds.size(); i++) {
Integer roiId = roiIds.get(i);
PHDFile phd = phdFiles.get(i);
GardsAnalySettingRoi analySettingROI = analySettingROIsMap.get(roiId);
if (ObjectUtil.isNull(analySettingROI)) continue;
phd.getUsedSetting().setECutAnalysis_Low(analySettingROI.getEcutanalysisLow());
phd.getUsedSetting().setECutAnalysis_High((Objects.nonNull(analySettingROI.getEcutanalysisHigh())?(analySettingROI.getEcutanalysisHigh() <= phd.getUsedSetting().getECutAnalysis_Low()?-9999:analySettingROI.getEcutanalysisHigh()):-9999));
phd.getUsedSetting().setEnergyTolerance(analySettingROI.getEnergytolerance());
phd.getUsedSetting().setCalibrationPSS_high(analySettingROI.getCalibrationpssHigh());
phd.getUsedSetting().setCalibrationPSS_low(analySettingROI.getCalibrationpssLow());
phd.getUsedSetting().setBaseImprovePSS(analySettingROI.getBaseimprovepss());
phd.getUsedSetting().setPss_low(analySettingROI.getPssLow());
phd.getUsedSetting().setK_back(analySettingROI.getKBack());
phd.getUsedSetting().setK_alpha(analySettingROI.getKAlpha());
phd.getUsedSetting().setK_beta(analySettingROI.getKBeta());
phd.getUsedSetting().setRiskLevelK(analySettingROI.getRisklevelk());
phd.getUsedSetting().setBUpdateCal(analySettingROI.getBupdatecal() == 1);
phd.getUsedSetting().setKeepCalPeakSearchPeaks(analySettingROI.getKeepcalpeakserchpeaks() == 1);
Date reftimeAct = analySettingROI.getReftimeAct();
if (Objects.nonNull(reftimeAct)) {
phd.getUsedSetting().setRefTime_act(reftimeAct);
}
Date reftimeConc = analySettingROI.getReftimeConc();
if (Objects.nonNull(reftimeConc)) {
phd.getUsedSetting().setRefTime_conc(reftimeConc);
}
}
}
for (PHDFile phd : phdFiles) {
if (!phd.getUsedEnerPara().getP().isEmpty()) {
List<Double> vChan = new LinkedList<>();
double c = 1;
while (c <= phd.getSpec().getNum_g_channel()) {
vChan.add(c);
c += 1;
}
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP());
phd.setVEnergy(calValuesOut.counts);
phd.setBAnalyed(true);
}
}
return true;
}
public void initConfigure(EnergySpectrumStruct struct, SelfStationData selfStationData){
PHDFile roiOnePHDFile = selfStationData.getSampleVueData().getROIOnePHDFile();
PHDFile roiTwoPHDFile = selfStationData.getSampleVueData().getROITwoPHDFile();
@ -4935,6 +5331,27 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
List<String> lines = FileUtil.readUtf8Lines(selfStationData.getQcTmpPath());
map.put("qc", lines);
}
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
String tmpFilePath1 = sampleVueData.getROIOnePHDFile().getTmpFilePath();
if (FileUtil.exist(tmpFilePath1)) {
List<String> lines = FileUtil.readUtf8Lines(tmpFilePath1);
map.put("Gamma_ROI_1", lines);
}
String tmpFilePath2 = sampleVueData.getROITwoPHDFile().getTmpFilePath();
if (FileUtil.exist(tmpFilePath2)) {
List<String> lines = FileUtil.readUtf8Lines(tmpFilePath2);
map.put("Gamma_ROI_2", lines);
}
String tmpFilePath3 = sampleVueData.getROIThreePHDFile().getTmpFilePath();
if (FileUtil.exist(tmpFilePath3)) {
List<String> lines = FileUtil.readUtf8Lines(tmpFilePath3);
map.put("Gamma_ROI_3", lines);
}
String tmpFilePath4 = sampleVueData.getROIFourPHDFile().getTmpFilePath();
if (FileUtil.exist(tmpFilePath4)) {
List<String> lines = FileUtil.readUtf8Lines(tmpFilePath4);
map.put("Gamma_ROI_4", lines);
}
result.setSuccess(true);
result.setResult(map);
return result;
@ -5472,6 +5889,36 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
ExportUtil.exportXls(response, dataList, "PeakInformation.xls");
}
@Override
public Result<?> viewComment(Integer sampleId, String sampleFileName, HttpServletRequest request) {
CommentInfo commentInfo = new CommentInfo();
//根据请求体获取当前登录用户名
String userName = JwtUtil.getUserNameByToken(request);
//读取缓存数据
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
if (ObjectUtil.isNull(selfStationData))
return Result.error("Please select the parse file first!");
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
//判断sampleId是否为空 如果不为空 则当前操作数据来源是数据库 文件路径从数据库中查询
if (Objects.nonNull(sampleId)) {
CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId);
if (Objects.nonNull(commentData)){
if (!commentData.getAnalyst().equals(userName)){
if (StringUtils.isNotBlank(commentData.getComments())){
String line = "------------------------------------------------------------";
String comment = line+"\n[ User "+commentData.getAnalyst()+" Comment ] : \n"+commentData.getComments()+"\n"+line+" \n";
commentInfo.setSpectrumOtherCommentInfo(comment);
}
}else {
commentInfo.setSpectrumAnalysisCommentInfo(commentData.getComments());
}
}
}
commentInfo.setSpectrumCommentInfo(struct.comment);
return Result.OK(commentInfo);
}
@Transactional
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
boolean bRet = false;

View File

@ -929,13 +929,13 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
CommentData commentData = spectrumAnalysisMapper.viewComment(sampleId);
if (Objects.nonNull(commentData)){
if (!commentData.getAnalyst().equals(userName)){
if (StringUtils.isNotBlank(commentData.getComment())){
if (StringUtils.isNotBlank(commentData.getComments())){
String line = "------------------------------------------------------------";
String comment = line+"\n[ User "+commentData.getAnalyst()+" Comment ] : \n"+commentData.getComment()+"\n"+line+" \n";
String comment = line+"\n[ User "+commentData.getAnalyst()+" Comment ] : \n"+commentData.getComments()+"\n"+line+" \n";
commentInfo.setSpectrumOtherCommentInfo(comment);
}
}else {
commentInfo.setSpectrumAnalysisCommentInfo(commentData.getComment());
commentInfo.setSpectrumAnalysisCommentInfo(commentData.getComments());
}
}
}