beta功能statistics返回数据格式修改

beta功能全部分析结果赋值问题修改
This commit is contained in:
qiaoqinzheng 2023-11-17 17:27:48 +08:00
parent 171657a6a2
commit a3dee8432c
2 changed files with 110 additions and 39 deletions

View File

@ -13,7 +13,7 @@ public class StcGraph implements Serializable {
private String m_strGraphName;
private List<Date> m_Keys;
private List<String> m_Keys;
private List<Double> m_Values;

View File

@ -2336,7 +2336,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
//根据类型判断查询对应数据
List<StatisticsData> statisticsData = spectrumAnalysisMapper.statisticsQueryNuclides(statisticsQueryData);
Map<String, Object> resultMap = new HashMap<>();
List<StcGraph> stcGraphList = new LinkedList<>();
List<String> allDate = new LinkedList<>();
for (StatisticsData data:statisticsData) {
Date collectStart = data.getCollectStart();
String formatDate = DateUtils.formatDate(collectStart, "yyyy-MM-dd HH:mm:ss");
allDate.add(formatDate);
}
allDate = allDate.stream().distinct().sorted().collect(Collectors.toList());
//判断查询结果是否包含Xe131m的信息
if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_131m.getType())){
StcGraph stcGraphMDC = new StcGraph();
stcGraphMDC.setM_strGraphName("Xe131m MDC");
@ -2345,25 +2354,32 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
stcGraphAct.setM_strGraphName("Xe131m Activity Concentration");
stcGraphAct.setM_GraphPen("#f89c1f");
List<StatisticsData> xe131m = new LinkedList<>();
//提取出Xe131m相关数据
if (CollectionUtils.isNotEmpty(statisticsData)) {
xe131m = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_131m.getType())).collect(Collectors.toList());
}
//判断数据是否为空
if (CollectionUtils.isNotEmpty(xe131m)){
//判断是否有勾选MDC数据进行返回
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
//遍历xe11m的数据
for (StatisticsData data:xe131m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
//遍历xe131m数据
for (StatisticsData data:xe131m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2386,20 +2402,23 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (CollectionUtils.isNotEmpty(xe133m)){
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
//遍历xe133m数据
for (StatisticsData data:xe133m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe133m) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2422,20 +2441,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (CollectionUtils.isNotEmpty(xe133)){
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe133) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe133) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2458,20 +2479,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (CollectionUtils.isNotEmpty(xe135)){
if (statisticsQueryData.isMDC()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe135) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getMdc());
}
stcGraphMDC.setM_Keys(keys);
stcGraphMDC.setM_Values(values);
}
if (statisticsQueryData.isActivity()){
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:xe135) {
keys.add(data.getCollectStart());
String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
keys.add(formatDate);
values.add(data.getConc());
}
stcGraphAct.setM_Keys(keys);
@ -2481,8 +2504,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
stcGraphList.add(stcGraphMDC);
stcGraphList.add(stcGraphAct);
}
resultMap.put("allDate", allDate);
resultMap.put("allList", stcGraphList);
result.setSuccess(true);
result.setResult(stcGraphList);
result.setResult(resultMap);
return result;
}
@ -2513,10 +2538,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Colloction Time");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2528,10 +2553,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Acquisition Time");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2543,10 +2568,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Xe Volumn");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2558,10 +2583,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
StcGraph stcGraph = new StcGraph();
stcGraph.setM_strGraphName("Sample Volumn");
stcGraph.setM_GraphPen("green");
List<Date> keys = new LinkedList<>();
List<String> keys = new LinkedList<>();
List<Double> values = new LinkedList<>();
for (StatisticsData data:statisticsData) {
keys.add(data.getDateTime());
keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss"));
values.add(data.getDataValue());
}
stcGraph.setM_Keys(keys);
@ -2991,6 +3016,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setBgPara(spectrum_group.BgCalPara);
}
} else {
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
betaDataFile.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
betaDataFile.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
}
xeMap.put("XeData", Collections.EMPTY_LIST);
}
}
@ -3146,19 +3187,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (bRet) {
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
sampleBetaData.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
betaDataFile.setGasBoundary(gasBoundary);
sampleBetaData.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
betaDataFile.setDetBoundary(detBoundary);
sampleBetaData.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
sampleBetaData.setQcBoundary(qcBoundary);
}
List<GardsXeResultsSpectrum> xeResultsSpectrumList = (List<GardsXeResultsSpectrum>) xeMap.get("XeData");
if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){
@ -3186,7 +3227,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
analyseResultMap.put(sampleFileName, xeMap);
} else {
xeMap.clear();
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
sampleBetaData.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
sampleBetaData.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
sampleBetaData.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
sampleBetaData.setQcBoundary(qcBoundary);
}
xeMap.put("XeData", Collections.EMPTY_LIST);
analyseResultMap.put(sampleFileName, xeMap);
}
@ -3351,14 +3407,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
//调用分析方法
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map, betaDataFile);
if (bRet) {
//分析qc文件信息并重新计算qc边界值
if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) {
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map, betaDataFile);
}
//分析qc文件信息并重新计算qc边界值
if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) {
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
if (Objects.nonNull(struct)) {
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map, betaDataFile);
}
}
if (bRet) {
List<Boundary> sampleBoundary = (List<Boundary>) map.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
@ -3402,7 +3458,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
map.put("savedAnalysisResult", true);
mapList.put(sampleFileName, map);
} else {
map.clear();
List<Boundary> sampleBoundary = (List<Boundary>) map.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
betaDataFile.setSampleBoundary(sampleBoundary);
}
List<Boundary> gasBoundary = (List<Boundary>) map.get("GasBoundary");
if(CollectionUtils.isNotEmpty(gasBoundary)) {
betaDataFile.setGasBoundary(gasBoundary);
}
List<Boundary> detBoundary = (List<Boundary>) map.get("DetBoundary");
if(CollectionUtils.isNotEmpty(detBoundary)) {
betaDataFile.setDetBoundary(detBoundary);
}
List<Boundary> qcBoundary = (List<Boundary>) map.get("QCBoundary");
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
}
map.put("XeData", Collections.EMPTY_LIST);
mapList.put(sampleFileName, map);
}