fix:修复新beta的分析接口,增加对roiParams的处理

This commit is contained in:
xiaoguangbin 2024-08-07 17:24:37 +08:00
parent cd3d19db70
commit e266148da1
3 changed files with 84 additions and 70 deletions

View File

@ -1582,7 +1582,7 @@ public class SelfStationUtil extends AbstractLogOrReport {
* 检查ROI是否更新 * 检查ROI是否更新
* @param sampleVueData * @param sampleVueData
* @param ROINum * @param ROINum
* @return * @return true = 内容发生变化
*/ */
public boolean checkROIRenew(SelfStationVueData sampleVueData, String ROINum) { public boolean checkROIRenew(SelfStationVueData sampleVueData, String ROINum) {
boolean flag = false; boolean flag = false;
@ -1617,24 +1617,26 @@ public class SelfStationUtil extends AbstractLogOrReport {
} }
break; break;
} }
} else {
if (!sampleVueData.getUsedROIOneBetaStart().equals(sampleVueData.getROIOneBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROIOneBetaStop().equals(sampleVueData.getROIOneBetaStop())) {
return true;
} else if (!sampleVueData.getUsedROITwoBetaStart().equals(sampleVueData.getROITwoBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROITwoBetaStop().equals(sampleVueData.getROITwoBetaStop())) {
return true;
} else if (!sampleVueData.getUsedROIThreeBetaStart().equals(sampleVueData.getROIThreeBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROIThreeBetaStop().equals(sampleVueData.getROIThreeBetaStop())) {
return true;
} else if (!sampleVueData.getUsedROIFourBetaStart().equals(sampleVueData.getROIFourBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROIFourBetaStop().equals(sampleVueData.getROIFourBetaStop())) {
return true;
}
} }
if (!sampleVueData.getUsedROIOneBetaStart().equals(sampleVueData.getROIOneBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROIOneBetaStop().equals(sampleVueData.getROIOneBetaStop())) {
return true;
} else if (!sampleVueData.getUsedROITwoBetaStart().equals(sampleVueData.getROITwoBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROITwoBetaStop().equals(sampleVueData.getROITwoBetaStop())) {
return true;
} else if (!sampleVueData.getUsedROIThreeBetaStart().equals(sampleVueData.getROIThreeBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROIThreeBetaStop().equals(sampleVueData.getROIThreeBetaStop())) {
return true;
} else if (!sampleVueData.getUsedROIFourBetaStart().equals(sampleVueData.getROIFourBetaStart())) {
return true;
} else if (!sampleVueData.getUsedROIFourBetaStop().equals(sampleVueData.getROIFourBetaStop())) {
return true;
}
return flag; return flag;
} }
} }

View File

@ -190,7 +190,7 @@ public class SelfStationController {
@PostMapping("Reprocessing") @PostMapping("Reprocessing")
@ApiOperation(value = "analyze菜单下Reprocessing页面数据", notes = "analyze菜单下Reprocessing页面数据") @ApiOperation(value = "analyze菜单下Reprocessing页面数据", notes = "analyze菜单下Reprocessing页面数据")
public Result Reprocessing(@RequestParam String fileName, @RequestParam String processKey, public Result Reprocessing(@RequestParam String fileName, @RequestParam String processKey,
@RequestParam String roiParams, HttpServletRequest request) { @RequestParam(required = false) String roiParams, HttpServletRequest request) {
return selfStationService.Reprocessing(fileName, processKey, roiParams, request); return selfStationService.Reprocessing(fileName, processKey, roiParams, request);
} }

View File

@ -677,7 +677,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
roiBBoundaryStart.add(roiParam.getRoiNum() - 1, roiParam.getStartChannel()); roiBBoundaryStart.add(roiParam.getRoiNum() - 1, roiParam.getStartChannel());
roiBBoundaryStop.add(roiParam.getRoiNum() - 1, roiParam.getEndChannel()); roiBBoundaryStop.add(roiParam.getRoiNum() - 1, roiParam.getEndChannel());
} }
selfStationUtil.getGammaByROI(struct.system_type, roiBBoundaryStart, roiBBoundaryStop, selfStationData); selfStationUtil.getGammaByROI("sample", roiBBoundaryStart, roiBBoundaryStop, selfStationData);
} }
@Override @Override
@ -2140,10 +2140,31 @@ public class SelfStationServiceImpl implements ISelfStationService {
boolean bROI2 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI2); boolean bROI2 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI2);
boolean bROI3 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI3); boolean bROI3 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI3);
boolean bROI4 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI4); boolean bROI4 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI4);
roiMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, bROI1)); int flag = gammaFileUtil.AnalyseData(phdOne);
roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, bROI2)); // 如果参数没有修改且没有修改任何ROI则不允许分析
roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, bROI3)); if (flag == 0 && !bROI1 && !bROI2 && !bROI3 && !bROI4) {
roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, bROI4)); String warning = "The spectrum needn't Analyed. Maybe:\n" +
"1. It has already Analyed.\n" +
"2. You didn't change any setting or calibration.";
result.error500(StrUtil.replace(warning, "%s", "ROI"));
return result;
}
// 如果参数修改 或者 修改某个ROI 只重新分析某个gamma
if (flag != 0 || bROI1) {
roiMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, flag));
}
if (flag != 0 || bROI2) {
roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, flag));
}
if (flag != 0 || bROI3) {
roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, flag));
}
if (flag != 0 || bROI4) {
roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, flag));
}
// roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, bROI2));
// roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, bROI3));
// roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, bROI4));
// 用于下次分析判断是否更新 // 用于下次分析判断是否更新
sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart()); sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart());
sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop()); sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop());
@ -2151,7 +2172,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
sampleVueData.setUsedROITwoBetaStop(sampleVueData.getROITwoBetaStop()); sampleVueData.setUsedROITwoBetaStop(sampleVueData.getROITwoBetaStop());
sampleVueData.setUsedROIThreeBetaStart(sampleVueData.getROIThreeBetaStart()); sampleVueData.setUsedROIThreeBetaStart(sampleVueData.getROIThreeBetaStart());
sampleVueData.setUsedROIThreeBetaStop(sampleVueData.getROIThreeBetaStop()); sampleVueData.setUsedROIThreeBetaStop(sampleVueData.getROIThreeBetaStop());
sampleVueData.setUsedROIFourBetaStart(sampleVueData.getUsedROIFourBetaStart()); sampleVueData.setUsedROIFourBetaStart(sampleVueData.getROIFourBetaStart());
sampleVueData.setUsedROIFourBetaStop(sampleVueData.getROIFourBetaStop()); sampleVueData.setUsedROIFourBetaStop(sampleVueData.getROIFourBetaStop());
sampleVueData.setUsedEner(phdOne.getUsedEner()); sampleVueData.setUsedEner(phdOne.getUsedEner());
@ -5484,64 +5505,55 @@ public class SelfStationServiceImpl implements ISelfStationService {
* @throws RuntimeException * @throws RuntimeException
*/ */
private Map<String, Object> gammaAnalyse(String processKey, PHDFile phd, Map<String, NuclideLines> nuclideLinesMap, private Map<String, Object> gammaAnalyse(String processKey, PHDFile phd, Map<String, NuclideLines> nuclideLinesMap,
Map<String, String> colorMap, boolean bROI) throws RuntimeException{ Map<String, String> colorMap, int flag) throws RuntimeException{
phd.setUserId(processKey); phd.setUserId(processKey);
// 赋值xml文件存放路径 // 赋值xml文件存放路径
phd.setXmlFilePath(parameterProperties.getFilePath()); phd.setXmlFilePath(parameterProperties.getFilePath());
int flag = gammaFileUtil.AnalyseData(phd); if (flag == -1) {
// bROI = false 表示ROI数据没有被修改 //分析时将phd的核素map重置
if (flag == 0 || !bROI) { phd.setPhdNuclideMap(nuclideLinesMap);
String warning = "The spectrum needn't Analyed. Maybe:\n" + //重新计算核素的活度浓度
"1. It has already Analyed.\n" + gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
"2. You didn't change any setting or calibration."; phd.setEfficiencyParam(phd.getUsedEffiPara().getP());
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0);
// 重新计算峰值
Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
String warning = "Finish three tasks:\n" +
"\t1.Update efficiencies of all peaks;\n" +
"\t2.Identify nuclides again;\n" +
"\t3.Test QC again.";
throw new RuntimeException(warning); throw new RuntimeException(warning);
} else { } else {
if (flag == -1) { Map<String, Object> map = new HashMap<>();
//分析时将phd的核素map重置 //分析时将phd的核素map重置
phd.setPhdNuclideMap(nuclideLinesMap); phd.setPhdNuclideMap(nuclideLinesMap);
//重新计算核素的活度浓度 //读取redis缓存的计算mdc信息
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap);
}
//调用分析算法
boolean analyseSpectrum = gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
if (analyseSpectrum) {
phd.setEfficiencyParam(phd.getUsedEffiPara().getP()); phd.setEfficiencyParam(phd.getUsedEffiPara().getP());
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy()); phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0); phd.setEfficiencyCurRow(0);
// 重新计算峰值 // 重新计算峰值
Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap"); Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap); gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
String warning = "Finish three tasks:\n" + gammaFileUtil.UpdateChart(phd, map, colorMap);
"\t1.Update efficiencies of all peaks;\n" + map.put("bAnalyed", phd.isBAnalyed());
"\t2.Identify nuclides again;\n" + map.put("peak", phd.getVPeak());
"\t3.Test QC again."; map.put("BaseCtrls", phd.getBaseCtrls());
throw new RuntimeException(warning); // Bar Chart 柱状图
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
map.put("barChart", differance);
return map;
} else { } else {
Map<String, Object> map = new HashMap<>(); throw new RuntimeException("There is a problem with the current %s phd file, Analysis failure!");
//分析时将phd的核素map重置
phd.setPhdNuclideMap(nuclideLinesMap);
//读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap);
}
//调用分析算法
boolean analyseSpectrum = gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
if (analyseSpectrum) {
phd.setEfficiencyParam(phd.getUsedEffiPara().getP());
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0);
// 重新计算峰值
Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
gammaFileUtil.UpdateChart(phd, map, colorMap);
map.put("bAnalyed", phd.isBAnalyed());
map.put("peak", phd.getVPeak());
map.put("BaseCtrls", phd.getBaseCtrls());
// Bar Chart 柱状图
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
map.put("barChart", differance);
return map;
} else {
throw new RuntimeException("There is a problem with the current %s phd file, Analysis failure!");
}
} }
} }
} }