fix:Sample_G_Analysis

This commit is contained in:
nieziyan 2023-09-05 15:55:24 +08:00
parent 521f45a799
commit 842b544b43
24 changed files with 611 additions and 62 deletions

View File

@ -27,7 +27,7 @@ public interface Prompt {
String NOT_REPEAT = " Can Not Be Repeat!"; String NOT_REPEAT = " Can Not Be Repeat!";
String PARAM_REQUIRED = "Param Is Required!"; String PARAM_REQUIRED = " Is Required!";
String PARAM_NOT_EMPTY = "Param Cat Not Be Empty!"; String PARAM_NOT_EMPTY = "Param Cat Not Be Empty!";

View File

@ -0,0 +1,26 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import java.util.List;
@Data
public class GardsNuclIdedDto {
private List<String> nucl_ided_Nuclidename; // 核素名称
private List<String> nucl_ided_Type; //核素类型 未知
private List<String> nucl_ided_Halflife; //核素半衰期
private List<String> nucl_ided_ave_activ; //平均活度值NULL
private List<String> nucl_ided_ave_activ_err; //平均活度值不确定度NULL
private List<String> nucl_ided_activ_key; //主射线活度值 未知
private List<String> nucl_ided_activ_key_err; //主射线活度值不确定度
private List<String> nucl_ided_mda; //核素的最小可探测活度
private List<String> nucl_ided_mda_err; //核素的最小可探测活度不确定度
private List<String> nucl_ided_nid_flag; //核素识别标志未知
private List<String> nucl_ided_csc_ratio; //符合相加校正因子无设为1
private List<String> nucl_ided_csc_ratio_err; //符合相加校正因子不确定度无设为0
private List<String> nucl_ided_csc_mod_flag; //活度是否经过符合相加校正0
private List<String> nucl_ided_MDC;
private List<String> nucl_ided_Concentration;
private List<String> nucl_ided_Key_Energy; //
private List<String> nucl_ided_Key_Yield;
}

View File

@ -0,0 +1,13 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import java.util.List;
@Data
public class QcCheckDto {
private List<String> QC_CHECK_QC_NAME;
private List<String> QC_CHECK_QC_VALUE;
private List<String> QC_CHECK_QC_STANDARD;
private List<String> QC_CHECK_QC_RESULT;
}

View File

@ -36,7 +36,7 @@ public class AlarmAnalysisLogController extends JeecgController<AlarmAnalysisLog
public Result<?> byTime(@RequestParam String startDate, public Result<?> byTime(@RequestParam String startDate,
@RequestParam String endDate) { @RequestParam String endDate) {
if (StrUtil.isBlank(startDate) || StrUtil.isBlank(endDate)) if (StrUtil.isBlank(startDate) || StrUtil.isBlank(endDate))
return Result.error(Prompt.PARAM_REQUIRED); return Result.error("StartDate Or EndDate" + Prompt.PARAM_REQUIRED);
return Result.OK(service.byTime(startDate, endDate)); return Result.OK(service.byTime(startDate, endDate));
} }
@ -45,7 +45,7 @@ public class AlarmAnalysisLogController extends JeecgController<AlarmAnalysisLog
public Result<?> byStatoin(@RequestParam String startDate, public Result<?> byStatoin(@RequestParam String startDate,
@RequestParam String endDate) { @RequestParam String endDate) {
if (StrUtil.isBlank(startDate) || StrUtil.isBlank(endDate)) if (StrUtil.isBlank(startDate) || StrUtil.isBlank(endDate))
return Result.error(Prompt.PARAM_REQUIRED); return Result.error("StartDate Or EndDate" + Prompt.PARAM_REQUIRED);
return Result.OK(service.byStatoin(startDate, endDate)); return Result.OK(service.byStatoin(startDate, endDate));
} }
@ -54,7 +54,7 @@ public class AlarmAnalysisLogController extends JeecgController<AlarmAnalysisLog
public Result<?> bySource(@RequestParam String startDate, public Result<?> bySource(@RequestParam String startDate,
@RequestParam String endDate) { @RequestParam String endDate) {
if (StrUtil.isBlank(startDate) || StrUtil.isBlank(endDate)) if (StrUtil.isBlank(startDate) || StrUtil.isBlank(endDate))
return Result.error(Prompt.PARAM_REQUIRED); return Result.error("StartDate Or EndDate" + Prompt.PARAM_REQUIRED);
return Result.OK(service.bySource(startDate, endDate)); return Result.OK(service.bySource(startDate, endDate));
} }
} }

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.rnauto.GardsNuclLinesIded;
import org.jeecg.modules.base.entity.rnauto.GardsPeaks;
@Mapper
public interface GardsNuclLinesIdedAutoMapper extends BaseMapper<GardsNuclLinesIded> {
}

View File

@ -0,0 +1,10 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.rnauto.GardsPeaks;
@Mapper
public interface GardsPeaksAutoMapper extends BaseMapper<GardsPeaks> {
}

View File

@ -0,0 +1,10 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.rnauto.GardsQcCheck;
@Mapper
public interface GardsQcCheckAutoMapper extends BaseMapper<GardsQcCheck> {
}

View File

@ -0,0 +1,9 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnauto.GardsNuclLinesIded;
import org.jeecg.modules.base.entity.rnauto.GardsPeaks;
public interface GardsNuclLinesIdedAutoService extends IService<GardsNuclLinesIded> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnauto.GardsPeaks;
public interface GardsPeaksAutoService extends IService<GardsPeaks> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnauto.GardsQcCheck;
public interface GardsQcCheckAutoService extends IService<GardsQcCheck> {
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnauto.GardsCalibration;
import org.jeecg.modules.base.entity.rnauto.GardsCalibrationPairs;
import org.jeecg.modules.mapper.GardsCalibrationMapper;
import org.jeecg.modules.mapper.GardsCalibrationPairsMapper;
import org.jeecg.modules.service.GardsCalibrationService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsCalibrationServiceImpl extends ServiceImpl<GardsCalibrationMapper, GardsCalibration> implements GardsCalibrationService {
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnauto.GardsNuclLinesIded;
import org.jeecg.modules.mapper.GardsNuclLinesIdedAutoMapper;
import org.jeecg.modules.service.GardsNuclLinesIdedAutoService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsNuclLinesIdedAutoServiceImpl extends ServiceImpl<GardsNuclLinesIdedAutoMapper, GardsNuclLinesIded> implements GardsNuclLinesIdedAutoService {
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnauto.GardsPeaks;
import org.jeecg.modules.mapper.GardsPeaksAutoMapper;
import org.jeecg.modules.service.GardsPeaksAutoService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsPeaksAutoServiceImpl extends ServiceImpl<GardsPeaksAutoMapper, GardsPeaks> implements GardsPeaksAutoService {
}

View File

@ -0,0 +1,18 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnauto.GardsNuclLinesIded;
import org.jeecg.modules.base.entity.rnauto.GardsQcCheck;
import org.jeecg.modules.mapper.GardsNuclLinesIdedAutoMapper;
import org.jeecg.modules.mapper.GardsQcCheckAutoMapper;
import org.jeecg.modules.service.GardsNuclLinesIdedAutoService;
import org.jeecg.modules.service.GardsQcCheckAutoService;
import org.springframework.stereotype.Service;
@Service
@DS("ora")
public class GardsQcCheckAutoServiceImpl extends ServiceImpl<GardsQcCheckAutoMapper, GardsQcCheck> implements GardsQcCheckAutoService {
}

View File

@ -1,26 +1,22 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.Setting; import org.jeecg.common.constant.Setting;
import org.jeecg.common.util.SpringContextUtils; import org.jeecg.modules.base.dto.GardsNuclIdedDto;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib; import org.jeecg.modules.base.dto.QcCheckDto;
import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.base.entity.rnauto.*;
import org.jeecg.modules.base.entity.rnauto.GardsCalibrationPairs; import org.jeecg.modules.base.vo.*;
import org.jeecg.modules.base.entity.rnauto.GardsRoiChannels;
import org.jeecg.modules.base.vo.GStoreMiddleProcessData;
import org.jeecg.modules.base.vo.PHDFile;
import org.jeecg.modules.base.vo.SpecSetup;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import java.lang.reflect.Field;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Map;
@Data @Data
public class Sample_G_Analysis { public class Sample_G_Analysis {
@ -45,17 +41,42 @@ public class Sample_G_Analysis {
/* 准备Gamma分析需要的数据 */ /* 准备Gamma分析需要的数据 */
PHDFile phdFile = getSettingFromDB(); PHDFile phdFile = getSettingFromDB();
// 从MiddleData获取需要的数据 Map<String,String> fieldMap = fieldMap();
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
String calibrationSampleType = middleData.getCalibration_sample_type();
String calibrationPairsECaltype = middleData.getCalibration_pairs_E_Caltype();
String calibrationPairsEInput = middleData.getCalibration_pairs_E_Input();
List<String> calibrationPairsEIdCalPoint = middleData.getCalibration_pairs_E_idCalPoint();
List<String> calibrationPairsEXValue = middleData.getCalibration_pairs_E_xValue();
List<String> calibrationPairsEYValue = middleData.getCalibration_pairs_E_yValue();
List<String> calibrationPairsEUncYValue = middleData.getCalibration_pairs_E_uncYValue();
// 保存分析结果(Gards_Analyses) /** 从MiddleData获取需要的数据 **/
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
String pairsSampleType = middleData.getCalibration_pairs_sample_type();
String calibrationSampleType = middleData.getCalibration_sample_type();
// Energy
String pairsECaltype = middleData.getCalibration_pairs_E_Caltype();
String pairsEInput = middleData.getCalibration_pairs_E_Input();
List<String> pairsEIdCalPoint = middleData.getCalibration_pairs_E_idCalPoint();
List<String> pairsEXValue = middleData.getCalibration_pairs_E_xValue();
List<String> pairsEYValue = middleData.getCalibration_pairs_E_yValue();
List<String> pairsEUncYValue = middleData.getCalibration_pairs_E_uncYValue();
// Efficiency
String pairsEfCaltype = middleData.getCalibration_pairs_EF_Caltype();
String pairsEfInput = middleData.getCalibration_pairs_EF_Input();
List<String> pairsEfIdCalPoint = middleData.getCalibration_pairs_EF_idCalPoint();
List<String> pairsEfXValue = middleData.getCalibration_pairs_EF_xValue();
List<String> pairsEfYValue = middleData.getCalibration_pairs_EF_yValue();
List<String> pairsEfUncYValue = middleData.getCalibration_pairs_EF_uncYValue();
// Resolution
String pairsRCaltype = middleData.getCalibration_pairs_R_Caltype();
String pairsRInput = middleData.getCalibration_pairs_R_Input();
List<String> pairsRIdCalPoint = middleData.getCalibration_pairs_R_idCalPoint();
List<String> pairsRXValue = middleData.getCalibration_pairs_R_xValue();
List<String> pairsRYValue = middleData.getCalibration_pairs_R_yValue();
List<String> pairsRUncYValue = middleData.getCalibration_pairs_R_uncYValue();
// TotalEfficiency
String pairsTCaltype = middleData.getCalibration_pairs_T_Caltype();
String pairsTInput = middleData.getCalibration_pairs_T_Input();
List<String> pairsTIdCalPoint = middleData.getCalibration_pairs_T_idCalPoint();
List<String> pairsTXValue = middleData.getCalibration_pairs_T_xValue();
List<String> pairsTYValue = middleData.getCalibration_pairs_T_yValue();
List<String> pairsTUncYValue = middleData.getCalibration_pairs_T_uncYValue();
// 保存分析结果 ==> INSERT INTO RNAUTO.GARDS_ANALYSES
GardsAnalyses analysis = toAnalysis(middleData); GardsAnalyses analysis = toAnalysis(middleData);
Integer sampleId = sampleData.getSampleId(); Integer sampleId = sampleData.getSampleId();
analysis.setSampleId(sampleId); analysis.setSampleId(sampleId);
@ -64,18 +85,254 @@ public class Sample_G_Analysis {
Integer IdAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(sampleId); Integer IdAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(sampleId);
// ==> UPDATE ORIGINAL.GARDS_SAMPLE_DATA // ==> UPDATE ORIGINAL.GARDS_SAMPLE_DATA
serviceQuotes.getSampleDataService().updateStatus(null,null); serviceQuotes.getSampleDataService().updateStatus(null,null);
// ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS // Energy ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
GardsCalibrationPairs calibrationPairs = new GardsCalibrationPairs(); GardsCalibrationPairs calibrationPairs = new GardsCalibrationPairs();
calibrationPairs.setSampleId(sampleId); calibrationPairs.setSampleId(sampleId);
calibrationPairs.setIdAnalysis(IdAnalysis); calibrationPairs.setIdAnalysis(IdAnalysis);
calibrationPairs.setSampleType(calibrationSampleType); calibrationPairs.setSampleType(pairsSampleType);
calibrationPairs.setCaltype(calibrationPairsECaltype); calibrationPairs.setCaltype(pairsECaltype);
calibrationPairs.setInput(calibrationPairsEInput); calibrationPairs.setInput(pairsEInput);
calibrationPairs.setIdCalPoint(null); calibrationPairs.setIdCalPoint(null);
calibrationPairs.setXValue(null); calibrationPairs.setXValue(null);
calibrationPairs.setYValue(null); calibrationPairs.setYValue(null);
calibrationPairs.setUncYValue(null); calibrationPairs.setUncYValue(null);
serviceQuotes.getGardsCalibrationPairsService().save(calibrationPairs); serviceQuotes.getGardsCalibrationPairsService().save(calibrationPairs);
// Efficiency ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
calibrationPairs.setCaltype(pairsEfCaltype);
calibrationPairs.setInput(pairsEfInput);
calibrationPairs.setIdCalPoint(null);
calibrationPairs.setXValue(null);
calibrationPairs.setYValue(null);
calibrationPairs.setUncYValue(null);
serviceQuotes.getGardsCalibrationPairsService().save(calibrationPairs);
// Resolution ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
calibrationPairs.setCaltype(pairsRCaltype);
calibrationPairs.setInput(pairsRInput);
calibrationPairs.setIdCalPoint(null);
calibrationPairs.setXValue(null);
calibrationPairs.setYValue(null);
calibrationPairs.setUncYValue(null);
serviceQuotes.getGardsCalibrationPairsService().save(calibrationPairs);
// TotalEfficiency ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS
calibrationPairs.setCaltype(pairsTCaltype);
calibrationPairs.setInput(pairsTInput);
calibrationPairs.setIdCalPoint(null);
calibrationPairs.setXValue(null);
calibrationPairs.setYValue(null);
calibrationPairs.setUncYValue(null);
serviceQuotes.getGardsCalibrationPairsService().save(calibrationPairs);
// E ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
GardsCalibration calibration = new GardsCalibration();
calibration.setSampleId(sampleId);
calibration.setIdAnalysis(IdAnalysis);
calibration.setSampleType(calibrationSampleType);
if (CollUtil.isNotEmpty(pairsEIdCalPoint)){
String eCaltype = middleData.getCalibration_E_Caltype();
double eFunction = middleData.getCalibration_E_function();
String eFunctionDef = middleData.getCalibration_E_functionDef();
double eStartOfRange = middleData.getCalibration_E_startOfRange();
double eEndOfRange = middleData.getCalibration_E_endOfRange();
String eCoeffString = middleData.getCalibration_E_coeff_string();
calibration.setCalType(eCaltype);
calibration.setFunction((int)eFunction);
calibration.setFunctionDef(eFunctionDef);
calibration.setStartOfRange((int)eStartOfRange);
calibration.setEndOfRange((int)eEndOfRange);
calibration.setCoeffString(eCoeffString);
serviceQuotes.getGardsCalibrationService().save(calibration);
}
// EF ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsEfIdCalPoint)){
String efCaltype = middleData.getCalibration_EF_Caltype();
double efFunction = middleData.getCalibration_EF_function();
String efFunctionDef = middleData.getCalibration_EF_functionDef();
double efStartOfRange = middleData.getCalibration_EF_startOfRange();
double efEndOfRange = middleData.getCalibration_EF_endOfRange();
String efCoeffString = middleData.getCalibration_EF_coeff_string();
calibration.setCalType(efCaltype);
calibration.setFunction((int)efFunction);
calibration.setFunctionDef(efFunctionDef);
calibration.setStartOfRange((int)efStartOfRange);
calibration.setEndOfRange((int)efEndOfRange);
calibration.setCoeffString(efCoeffString);
serviceQuotes.getGardsCalibrationService().save(calibration);
}
// R ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsRIdCalPoint)){
String rCaltype = middleData.getCalibration_R_Caltype();
double rFunction = middleData.getCalibration_R_function();
String rFunctionDef = middleData.getCalibration_R_functionDef();
double rStartOfRange = middleData.getCalibration_R_startOfRange();
double rEndOfRange = middleData.getCalibration_R_endOfRange();
String rCoeffString = middleData.getCalibration_R_coeff_string();
calibration.setCalType(rCaltype);
calibration.setFunction((int)rFunction);
calibration.setFunctionDef(rFunctionDef);
calibration.setStartOfRange((int)rStartOfRange);
calibration.setEndOfRange((int)rEndOfRange);
calibration.setCoeffString(rCoeffString);
serviceQuotes.getGardsCalibrationService().save(calibration);
}
// T ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
if (CollUtil.isNotEmpty(pairsTIdCalPoint)){
String tCaltype = middleData.getCalibration_T_Caltype();
double tFunction = middleData.getCalibration_T_function();
String tFunctionDef = middleData.getCalibration_T_functionDef();
double tStartOfRange = middleData.getCalibration_T_startOfRange();
double tEndOfRange = middleData.getCalibration_T_endOfRange();
String tCoeffString = middleData.getCalibration_T_coeff_string();
calibration.setCalType(tCaltype);
calibration.setFunction((int)tFunction);
calibration.setFunctionDef(tFunctionDef);
calibration.setStartOfRange((int)tStartOfRange);
calibration.setEndOfRange((int)tEndOfRange);
calibration.setCoeffString(tCoeffString);
serviceQuotes.getGardsCalibrationService().save(calibration);
}
// Gards_Peaks数据表 ==> INSERT INTO RNAUTO.GARDS_PEAKS
List<String> idPeak = middleData.getPeaks_idPeak();
if (CollUtil.isNotEmpty(idPeak)){
List<String> peakCentroid = middleData.getPeaks_peakCentroid();
List<String> uncpeakCentroid = middleData.getPeaks_uncpeakCentroid();
List<String> energy = middleData.getPeaks_Energy();
List<String> uncEnergy = middleData.getPeaks_uncEnergy();
List<String> area = middleData.getPeaks_Area();
List<String> areaErr = middleData.getPeaks_areaErr();
List<String> efficiency = middleData.getPeaks_Efficiency();
List<String> uncefficiency = middleData.getPeaks_Uncefficiency();
List<String> fwhm = middleData.getPeaks_Fwhm();
List<String> fwhmc = middleData.getPeaks_Fwhmc();
List<String> significance = middleData.getPeaks_Significance();
List<String> sensitivity = middleData.getPeaks_Sensitivity();
List<String> multiIndex = middleData.getPeaks_multiIndex();
List<String> roIstart = middleData.getPeaks_ROIstart();
List<String> roIend = middleData.getPeaks_ROIend();
List<String> tail = middleData.getPeaks_tail();
List<String> tailAlpha = middleData.getPeaks_tailAlpha();
List<String> upperTail = middleData.getPeaks_upperTail();
List<String> upperTailAlpha = middleData.getPeaks_upperTailAlpha();
List<String> bwWidthChan = middleData.getPeaks_BWWidthChan();
List<String> recoilDeltaChan = middleData.getPeaks_recoilDeltaChan();
List<String> stepRatio = middleData.getPeaks_stepRatio();
List<String> backgroundArea = middleData.getPeaks_backgroundArea();
List<String> meanBackCount = middleData.getPeaks_meanBackCount();
List<String> lc = middleData.getPeaks_Lc();
List<String> ld = middleData.getPeaks_Ld();
List<String> netCountRate = middleData.getPeaks_netCountRate();
List<String> uncNetCountRate = middleData.getPeaks_uncNetCountRate();
List<GardsPeaks> peaks = new ArrayList<>();
for (int i = 0; i < idPeak.size(); i++) {
GardsPeaks peak = new GardsPeaks();
peak.setSampleId(sampleId);
peak.setIdAnalysis(IdAnalysis);
if (StrUtil.isNotBlank(idPeak.get(i)))
peak.setIdPeak(Integer.valueOf(idPeak.get(i)));
if (StrUtil.isNotBlank(peakCentroid.get(i)))
peak.setCentroidChannel(Double.valueOf(peakCentroid.get(i)));
if (StrUtil.isNotBlank(uncpeakCentroid.get(i)))
peak.setUncCentroidChannel(Double.valueOf(uncpeakCentroid.get(i)));
if (StrUtil.isNotBlank(energy.get(i)))
peak.setEnergy(Double.valueOf(energy.get(i)));
if (StrUtil.isNotBlank(uncEnergy.get(i)))
peak.setUncEnergy(Double.valueOf(uncEnergy.get(i)));
if (StrUtil.isNotBlank(area.get(i)))
peak.setArea(Double.valueOf(area.get(i)));
if (StrUtil.isNotBlank(areaErr.get(i)))
peak.setUncArea(Double.valueOf(areaErr.get(i)));
if (StrUtil.isNotBlank(efficiency.get(i)))
peak.setEfficiency(Double.valueOf(efficiency.get(i)));
if (StrUtil.isNotBlank(uncefficiency.get(i)))
peak.setUncefficiency(Double.valueOf(uncefficiency.get(i)));
if (StrUtil.isNotBlank(fwhm.get(i)))
peak.setFwhm(Double.valueOf(fwhm.get(i)));
if (StrUtil.isNotBlank(fwhmc.get(i)))
peak.setFwtm(Double.valueOf(fwhmc.get(i)));
if (StrUtil.isNotBlank(significance.get(i)))
peak.setSignificance(Double.valueOf(significance.get(i)));
if (StrUtil.isNotBlank(sensitivity.get(i)))
peak.setSensitivity(Double.valueOf(sensitivity.get(i)));
if (StrUtil.isNotBlank(multiIndex.get(i)))
peak.setMulitiIndex(Double.valueOf(multiIndex.get(i)));
if (StrUtil.isNotBlank(roIstart.get(i)))
peak.setRoiStart(Double.valueOf(roIstart.get(i)));
if (StrUtil.isNotBlank(roIend.get(i)))
peak.setRoiEnd(Double.valueOf(roIend.get(i)));
if (StrUtil.isNotBlank(tail.get(i)))
peak.setTail(Double.valueOf(tail.get(i)));
if (StrUtil.isNotBlank(tailAlpha.get(i)))
peak.setTailAlpha(Double.valueOf(tailAlpha.get(i)));
if (StrUtil.isNotBlank(upperTail.get(i)))
peak.setUpperTail(Double.valueOf(upperTail.get(i)));
if (StrUtil.isNotBlank(upperTailAlpha.get(i)))
peak.setUpperTailAlpha(Double.valueOf(upperTailAlpha.get(i)));
if (StrUtil.isNotBlank(bwWidthChan.get(i)))
peak.setBwwidthchan(Double.valueOf(bwWidthChan.get(i)));
if (StrUtil.isNotBlank(recoilDeltaChan.get(i)))
peak.setRecoildeltachan(Double.valueOf(recoilDeltaChan.get(i)));
if (StrUtil.isNotBlank(stepRatio.get(i)))
peak.setStepraio(Double.valueOf(stepRatio.get(i)));
if (StrUtil.isNotBlank(backgroundArea.get(i)))
peak.setBackgroundarea(Double.valueOf(backgroundArea.get(i)));
if (StrUtil.isNotBlank(meanBackCount.get(i)))
peak.setMeanbackcount(Double.valueOf(meanBackCount.get(i)));
if (StrUtil.isNotBlank(lc.get(i)))
peak.setLc(Double.valueOf(lc.get(i)));
if (StrUtil.isNotBlank(ld.get(i)))
peak.setLd(Double.valueOf(ld.get(i)));
if (StrUtil.isNotBlank(netCountRate.get(i)))
peak.setNetCountRate(Double.valueOf(netCountRate.get(i)));
if (StrUtil.isNotBlank(uncNetCountRate.get(i)))
peak.setUncNetCountRate(Double.valueOf(uncNetCountRate.get(i)));
peaks.add(peak);
}
serviceQuotes.getGardsPeaksAutoService().saveBatch(peaks);
}
// Gards_Nucl_Lines_Ided数据表 ==> INSERT INTO RNAUTO.GARDS_NUCL_LINES_IDED
Map<String, GStoreMiddleProcessDataNuclLinesIded> nuclLinesIdedData = middleData.getNucl_lines_ided_data();
String base_idPeak = "idPeak";
List<GardsNuclLinesIded> allNuclLinesIdeds = new ArrayList<>();
for (Map.Entry<String, GStoreMiddleProcessDataNuclLinesIded> entry : nuclLinesIdedData.entrySet()) {
String nuclideName = entry.getKey();
GStoreMiddleProcessDataNuclLinesIded nuclLinesIded = entry.getValue();
GardsNuclLinesIded gardsNuclLinesIded = new GardsNuclLinesIded();
List<GardsNuclLinesIded> gardsNuclLinesIdeds =
mapFields(nuclLinesIded, gardsNuclLinesIded, base_idPeak, fieldMap);
if (CollUtil.isNotEmpty(gardsNuclLinesIdeds)){
for (GardsNuclLinesIded ided : gardsNuclLinesIdeds) {
ided.setSampleId(sampleId);
ided.setIdAnalysis(IdAnalysis);
ided.setNuclideName(nuclideName);
}
allNuclLinesIdeds.addAll(gardsNuclLinesIdeds);
}
}
serviceQuotes.getGardsNuclLinesIdedAutoService().saveBatch(allNuclLinesIdeds);
// Gards_Nucl_Ided数据表 ==> INSERT INTO RNAUTO.GARDS_NUCL_IDED
GardsNuclIdedDto gardsNuclIdedDto = new GardsNuclIdedDto();
GardsNuclIded gardsNuclIded = new GardsNuclIded();
BeanUtil.copyProperties(middleData,gardsNuclIdedDto);
String base_nuclideName = "nucl_ided_Nuclidename";
List<GardsNuclIded> gardsNuclIdeds =
mapFields(gardsNuclIdedDto, gardsNuclIded, base_nuclideName, fieldMap);
for (GardsNuclIded ided : gardsNuclIdeds) {
ided.setSampleId(sampleId);
ided.setIdAnalysis(IdAnalysis);
}
// serviceQuotes.get
// Gards_Qc_Check数据表 ==> INSERT INTO RNAUTO.GARDS_QC_CHECK
Map<String, QcCheckItem> qcItems = phdFile.getQcItems();
if (MapUtil.isNotEmpty(qcItems)){
String base_QC = String.valueOf(qcItems.size());
QcCheckDto qcCheckDto = new QcCheckDto();
BeanUtil.copyProperties(middleData,qcCheckDto);
GardsQcCheck gardsQcCheck = new GardsQcCheck();
List<GardsQcCheck> gardsQcChecks = mapFields(qcCheckDto, gardsQcCheck,base_QC,fieldMap);
for (GardsQcCheck qcCheck : gardsQcChecks) {
qcCheck.setSampleId(sampleId);
qcCheck.setIdanalysis(IdAnalysis);
}
serviceQuotes.getGardsQcCheckAutoService().saveBatch(gardsQcChecks);
}
} }
@ -84,7 +341,49 @@ public class Sample_G_Analysis {
} }
public void getNuclideLinesP(){ public void getNuclideLinesP(){
}
public Map<String,String> fieldMap(){
Map<String,String> fieldMap = new HashMap<>();
// Gards_Nucl_Lines_Ided
fieldMap.put("nuclideFullname","nuclidefullname");
fieldMap.put("Energy","energy");
fieldMap.put("Abundance","abundance");
fieldMap.put("Activity","activity");
fieldMap.put("Effic","effic");
fieldMap.put("uncEffic","unEffic");
fieldMap.put("Mda","mda");
fieldMap.put("key_flag","keyFlag");
fieldMap.put("csc_ratio","cscRatio");
fieldMap.put("csc_ratio_err","cscRatioErr");
fieldMap.put("csc_mod_flag","cscModFlag");
fieldMap.put("MDC","mdc");
fieldMap.put("Concentration","concentration");
// Gards_Nucl_Ided
fieldMap.put("nucl_ided_Nucidename","nuclideName");
fieldMap.put("nucl_ided_Type","type");
fieldMap.put("nucl_ided_Halflife","halflife");
fieldMap.put("nucl_ided_ave_activ","aveActiv");
fieldMap.put("nucl_ided_ave_activ_err","aveActivErr");
fieldMap.put("nucl_ided_activ_key","activKey");
fieldMap.put("nucl_ided_activ_key_err","activKeyErr");
fieldMap.put("nucl_ided_mda","mda");
fieldMap.put("nucl_ided_mda_err","mdaErr");
fieldMap.put("nucl_ided_nid_flag","nidFlag");
fieldMap.put("nucl_ided_csc_ratio","cscRatio");
fieldMap.put("nucl_ided_csc_ratio_err","cscRatioErr");
fieldMap.put("nucl_ided_csc_mod_flag","cscModFlag");
fieldMap.put("nucl_ided_MDC","mdc");
fieldMap.put("nucl_ided_Concentration","concentration");
fieldMap.put("nucl_ided_Key_Energy","keyEnergy");
fieldMap.put("nucl_ided_Key_Yield","keyYield");
// Gards_Qc_Check
fieldMap.put("QC_CHECK_QC_NAME","qcName");
fieldMap.put("QC_CHECK_QC_VALUE","qcValue");
fieldMap.put("QC_CHECK_QC_STANDARD","qcStandard");
fieldMap.put("QC_CHECK_QC_RESULT","qcResult");
return fieldMap;
} }
public PHDFile getSettingFromDB(){ public PHDFile getSettingFromDB(){
@ -172,4 +471,57 @@ public class Sample_G_Analysis {
gardsAnalyses.setReportPath(middleData.getAnalyses_ReportPath()); gardsAnalyses.setReportPath(middleData.getAnalyses_ReportPath());
return gardsAnalyses; return gardsAnalyses;
} }
public static <T1,T2> List<T2> mapFields(T1 source, T2 tartget, String baseLine, Map<String,String> fieldMap) {
try {
List<T2> result = new ArrayList<>();
Class<?> sourceClass = source.getClass();
boolean isNumber = NumberUtil.isNumber(baseLine);
int total;
if (isNumber){
total = Integer.parseInt(baseLine);
}else {
List<String> baseList = (List<String>) sourceClass.getDeclaredField(baseLine).get(source);
if (CollUtil.isEmpty(baseList))
return result;
total = baseList.size();
}
Class<T2> tartgetClass = (Class<T2>) tartget.getClass();
Field[] sourceFields = sourceClass.getDeclaredFields();
for (int i = 0; i < total; i++) {
tartget = tartgetClass.newInstance();
for (Field sourceField : sourceFields) {
sourceField.setAccessible(true);
List<String> sourceList = (List<String>) sourceField.get(source);
if (CollUtil.isEmpty(sourceList))
continue;
if (sourceList.size() <= i)
continue;
String value = sourceList.get(i);
if (StrUtil.isNotBlank(value)){
String sourceFieldName = sourceField.getName();
String targetFieldName = fieldMap.get(sourceFieldName);
targetFieldName = StrUtil.isBlank(targetFieldName) ? sourceFieldName : targetFieldName;
Field tartgetField = tartgetClass.getDeclaredField(targetFieldName);
tartgetField.setAccessible(true);
Class<?> type = tartgetField.getType();
if (type == String.class) {
tartgetField.set(tartget, value);
} else if (type == Integer.class || type == int.class) {
tartgetField.set(tartget,Integer.valueOf(value));
} else if (type == Double.class || type == double.class) {
tartgetField.set(tartget,Double.valueOf(value));
} else if (type == Boolean.class || type == boolean.class) {
tartgetField.set(tartget, Boolean.valueOf(value));
}
}
}
result.add(tartget);
}
return result;
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<>();
}
}
} }

View File

@ -50,5 +50,13 @@ public class SpectrumServiceQuotes {
private final IGardsGammaDefaultParamsService gammaDefaultParamsService; private final IGardsGammaDefaultParamsService gammaDefaultParamsService;
private final GardsCalibrationService gardsCalibrationService;
private final GardsCalibrationPairsService gardsCalibrationPairsService; private final GardsCalibrationPairsService gardsCalibrationPairsService;
private final GardsPeaksAutoService gardsPeaksAutoService;
private final GardsNuclLinesIdedAutoService gardsNuclLinesIdedAutoService;
private final GardsQcCheckAutoService gardsQcCheckAutoService;
} }

View File

@ -1,9 +1,12 @@
package org.jeecg.modules.system.controller; package org.jeecg.modules.system.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib; import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.system.service.IGardsNuclLibService; import org.jeecg.modules.system.service.IGardsNuclLibService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@Api(value = "核素信息库管理",tags = "核素信息库管理") @Api(value = "核素信息库管理",tags = "核素信息库管理")
@ -11,4 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("gardsNuclLib") @RequestMapping("gardsNuclLib")
public class GardsNuclLibController extends JeecgController<GardsNuclLib, IGardsNuclLibService> { public class GardsNuclLibController extends JeecgController<GardsNuclLib, IGardsNuclLibService> {
@ApiOperation(value = "核素名称列表",tags = "核素名称列表")
@GetMapping("allName")
public Result<?> allName(){
return Result.OK(service.allName());
}
} }

View File

@ -34,22 +34,24 @@ public class SysDefaultNuclideController extends JeecgController<SysDefaultNucli
@GetMapping(value = "/findPage") @GetMapping(value = "/findPage")
public Result<?> findPage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, public Result<?> findPage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam Integer useType) { Integer useType, String nuclideType) {
return service.queryNuclideByType(pageNo, pageSize, useType); return service.queryNuclideByType(pageNo, pageSize, useType,nuclideType);
} }
@ApiOperation(value = "核素名称列表", notes = "核素名称列表") @ApiOperation(value = "核素名称列表", notes = "核素名称列表")
@GetMapping(value = "/allName") @GetMapping(value = "/allName")
public Result<?> allName(@RequestParam Integer useType) { public Result<?> allName(Integer useType, String nuclideType) {
return service.allName(useType); return service.allName(useType, nuclideType);
} }
@ApiOperation(value = "添加核素配置信息", notes = "添加添加核素配置信息") @ApiOperation(value = "添加核素配置信息", notes = "添加添加核素配置信息")
@RequiresRoles("admin") @RequiresRoles("admin")
@PostMapping(value = "/add") @GetMapping(value = "/add")
public Result<?> add(@RequestBody List<SysDefaultNuclide> nuclides) { public Result<?> add(@RequestParam List<String> nuclideNames,
return service.add(nuclides); @RequestParam String nuclideType,
@RequestParam Integer useType) {
return service.add(nuclideNames, nuclideType, useType);
} }

View File

@ -10,4 +10,6 @@ import java.util.List;
public interface GardsNuclLibMapper extends BaseMapper<GardsNuclLib> { public interface GardsNuclLibMapper extends BaseMapper<GardsNuclLib> {
List<GardsNuclLibDto> halfLife(List<String> nuclideNames); List<GardsNuclLibDto> halfLife(List<String> nuclideNames);
List<String> allName();
} }

View File

@ -17,4 +17,7 @@
</if> </if>
</where> </where>
</select> </select>
<select id="allName" resultType="java.lang.String">
SELECT NAME FROM CONFIGURATION.GARDS_NUCL_LIB
</select>
</mapper> </mapper>

View File

@ -9,4 +9,6 @@ import java.util.Map;
public interface IGardsNuclLibService extends IService<GardsNuclLib> { public interface IGardsNuclLibService extends IService<GardsNuclLib> {
Map<String,Double> halfLife(List<String> nuclideNames); Map<String,Double> halfLife(List<String> nuclideNames);
List<String> allName();
} }

View File

@ -15,11 +15,11 @@ import java.util.Map;
*/ */
public interface ISysDefaultNuclideService extends IService<SysDefaultNuclide> { public interface ISysDefaultNuclideService extends IService<SysDefaultNuclide> {
Result<?> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType); Result<?> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType,String nuclideType);
Result<?> allName(Integer useType); Result<?> allName(Integer useType, String nuclideType);
Result<?> add(List<SysDefaultNuclide> nuclides); Result<?> add(List<String> nuclideNames,String nuclideType,Integer useType);
Map<String,List<GardsNuclLinesLib>> mapLines(String nuclideType); Map<String,List<GardsNuclLinesLib>> mapLines(String nuclideType);

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.base.dto.GardsNuclLibDto; import org.jeecg.modules.base.dto.GardsNuclLibDto;
@ -29,4 +30,10 @@ public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, Gar
.toMap(GardsNuclLibDto::getName, GardsNuclLibDto::getHalflife)); .toMap(GardsNuclLibDto::getName, GardsNuclLibDto::getHalflife));
return halfLife; return halfLife;
} }
@Override
public List<String> allName() {
return baseMapper.allName().stream().filter(StrUtil::isNotBlank)
.collect(Collectors.toList());
}
} }

View File

@ -41,18 +41,20 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
private IGardsNuclLinesLibService nuclLinesLibService; private IGardsNuclLinesLibService nuclLinesLibService;
@Override @Override
public Result<?> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType) { public Result<?> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType,String nuclideType) {
Page<SysDefaultNuclide> page = new Page<>(pageNo, pageSize); Page<SysDefaultNuclide> page = new Page<>(pageNo, pageSize);
LambdaQueryWrapper<SysDefaultNuclide> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(null != useType, SysDefaultNuclide::getUseType, useType); wrapper.eq(ObjectUtil.isNotNull(useType), SysDefaultNuclide::getUseType, useType);
IPage<SysDefaultNuclide> result = this.page(page, queryWrapper); wrapper.eq(StrUtil.isNotBlank(nuclideType),SysDefaultNuclide::getNuclideType,nuclideType);
IPage<SysDefaultNuclide> result = this.page(page, wrapper);
return Result.OK(result); return Result.OK(result);
} }
@Override @Override
public Result<?> allName(Integer useType) { public Result<?> allName(Integer useType, String nuclideType) {
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDefaultNuclide::getUseType,useType); wrapper.eq(ObjectUtil.isNotNull(useType),SysDefaultNuclide::getUseType,useType);
wrapper.eq(StrUtil.isNotBlank(nuclideType),SysDefaultNuclide::getNuclideType,nuclideType);
List<String> allName = list(wrapper).stream() List<String> allName = list(wrapper).stream()
.map(SysDefaultNuclide::getNuclideName) .map(SysDefaultNuclide::getNuclideName)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -60,21 +62,24 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
} }
@Override @Override
public Result<?> add(List<SysDefaultNuclide> nuclides) { public Result<?> add(List<String> nuclideNames,String nuclideType,Integer useType) {
if (CollUtil.isEmpty(nuclides)) if (CollUtil.isEmpty(nuclideNames))
return Result.error(Prompt.PARAM_NOT_EMPTY); return Result.error(Prompt.PARAM_NOT_EMPTY);
Integer useType = nuclides.get(0).getUseType(); if (StrUtil.isBlank(nuclideType))
List<Integer> type = ListUtil.toList(1, 2); return Result.error("nuclideType" + Prompt.PARAM_REQUIRED);
if (ObjectUtil.isNotNull(useType) && type.contains(useType)){ if (ObjectUtil.isNull(useType))
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>(); return Result.error("useType" + Prompt.PARAM_REQUIRED);
wrapper.eq(SysDefaultNuclide::getUseType,useType); List<SysDefaultNuclide> SysDefaultNuclides = new ArrayList<>();
remove(wrapper); for (String nuclideName : nuclideNames) {
SysDefaultNuclide sysDefaultNuclide = new SysDefaultNuclide();
sysDefaultNuclide.setNuclideName(nuclideName);
sysDefaultNuclide.setNuclideType(nuclideType);
sysDefaultNuclide.setUseType(useType);
SysDefaultNuclides.add(sysDefaultNuclide);
} }
boolean success = saveBatch(nuclides); boolean success = saveBatch(SysDefaultNuclides);
if (success){ if (success)
mapLines2Redis();
return Result.OK(Prompt.ADD_SUCC); return Result.OK(Prompt.ADD_SUCC);
}
return Result.error(Prompt.ADD_ERR); return Result.error(Prompt.ADD_ERR);
} }