新增实体类封装b-gEfficiency相关信息
新增查询QC文件路径接口 新增计算得到折线图对应Energy数据信息方法 新增封装XeData相关信息
This commit is contained in:
parent
fc36ff1ac3
commit
fec6b24164
|
@ -7,6 +7,7 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.modules.entity.vo.HistogramData;
|
||||
import org.jeecg.modules.entity.vo.SeriseData;
|
||||
import org.jeecg.modules.entity.vo.SpectrumData;
|
||||
import org.jeecg.modules.entity.vo.XeData;
|
||||
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -82,65 +83,126 @@ public class PHDFileUtil {
|
|||
}
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
for (int j=0; j< list.size(); j++){
|
||||
HistogramData his = new HistogramData();
|
||||
his.setB(i);
|
||||
his.setG(j);
|
||||
Long count = list.get(j);
|
||||
his.setC(count);
|
||||
histogramDataList.add(his);
|
||||
if (count > 0){
|
||||
HistogramData his = new HistogramData();
|
||||
his.setB(i);
|
||||
his.setG(j);
|
||||
his.setC(count);
|
||||
histogramDataList.add(his);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("histogramDataList", histogramDataList);
|
||||
|
||||
//Gamma Spectrum Original
|
||||
List<Long> gammaOriginalData = new LinkedList<>();
|
||||
long numGChannel = struct.num_g_channel;
|
||||
List<Long> gCounts = struct.g_counts;
|
||||
List<SeriseData> gammaOriginalSeriseData = new LinkedList<>();
|
||||
for (int i=0; i<numGChannel; i++){
|
||||
Long count = gCounts.get(i);
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i);
|
||||
seriseData.setY(count);
|
||||
gammaOriginalSeriseData.add(seriseData);
|
||||
}
|
||||
map.put("gammaOriginalData", gammaOriginalSeriseData);
|
||||
|
||||
//Gamma Spectrum Projected
|
||||
List<Long> gammaProjectedData = new LinkedList<>();
|
||||
for (int i=0; i<gChannels; i++) {
|
||||
long i_count = 0;
|
||||
for (int j=0; j<bChannels; j++) {
|
||||
i_count += hCounts.get((int) (i*bChannels + j));
|
||||
}
|
||||
gammaOriginalData.add(i_count);
|
||||
gammaProjectedData.add(i_count);
|
||||
}
|
||||
List<SeriseData> gammaSeriseData = new LinkedList<>();
|
||||
for (int i=0; i<gammaOriginalData.size(); i++){
|
||||
List<SeriseData> gammaProjectedSeriseData = new LinkedList<>();
|
||||
for (int i=0; i<gammaProjectedData.size(); i++){
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i);
|
||||
seriseData.setY(gammaOriginalData.get(i));
|
||||
gammaSeriseData.add(seriseData);
|
||||
seriseData.setY(gammaProjectedData.get(i));
|
||||
gammaProjectedSeriseData.add(seriseData);
|
||||
}
|
||||
map.put("gammaOriginalData", gammaSeriseData);
|
||||
map.put("gammaProjectedData", gammaProjectedSeriseData);
|
||||
|
||||
//Gamma Spectrum Projected
|
||||
//Gamma Energy
|
||||
List<List<Double>> gammaEnergyList = new LinkedList<>();
|
||||
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||
List<Double> gEnergy = struct.g_energy;
|
||||
List<Double> gammaProjectedData = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||
map.put("gammaProjectedData", gammaProjectedData);
|
||||
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||
List<Double> gchannels = new ArrayList<>();
|
||||
for (int i=0; i<numGChannel; i++){
|
||||
gchannels.clear();
|
||||
gchannels.add(Double.valueOf(i));
|
||||
List<Double> gammaEnergy = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam);
|
||||
gammaEnergyList.add(gammaEnergy);
|
||||
}
|
||||
map.put("gammaEnergyData", gammaEnergyList);
|
||||
|
||||
|
||||
//Beta Spectrum Original
|
||||
List<Long> betaOriginalData = new LinkedList<>();
|
||||
long numBChannel = struct.num_b_channel;
|
||||
List<Long> bCounts = struct.b_counts;
|
||||
List<SeriseData> betaOriginalSeriseData = new LinkedList<>();
|
||||
for (int i=0; i<numBChannel; i++){
|
||||
Long count = bCounts.get(i);
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i);
|
||||
seriseData.setY(count);
|
||||
betaOriginalSeriseData.add(seriseData);
|
||||
}
|
||||
map.put("betaOriginalData", betaOriginalSeriseData);
|
||||
|
||||
//Beta Spectrum Projected
|
||||
List<Long> betaProjectedData = new LinkedList<>();
|
||||
for (int j=0; j<bChannels; ++j) {
|
||||
long j_count = 0;
|
||||
for (int i=0; i<gChannels; ++i)
|
||||
{
|
||||
j_count += hCounts.get((int) (i*bChannels + j));
|
||||
}
|
||||
betaOriginalData.add(j_count);
|
||||
betaProjectedData.add(j_count);
|
||||
}
|
||||
List<SeriseData> betaSeriseData = new LinkedList<>();
|
||||
for (int i=0; i<betaOriginalData.size(); i++){
|
||||
List<SeriseData> betaProjectedSeriseData = new LinkedList<>();
|
||||
for (int i=0; i<betaProjectedData.size(); i++){
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i);
|
||||
seriseData.setY(betaOriginalData.get(i));
|
||||
betaSeriseData.add(seriseData);
|
||||
seriseData.setY(betaProjectedData.get(i));
|
||||
betaProjectedSeriseData.add(seriseData);
|
||||
}
|
||||
map.put("betaOriginalData", betaSeriseData);
|
||||
|
||||
//Beta Spectrum Projected
|
||||
map.put("betaProjectedData", betaProjectedSeriseData);
|
||||
//Beta Energy
|
||||
List<List<Double>> betaEnergyList = new LinkedList<>();
|
||||
List<Double> bChannel = struct.b_channel;
|
||||
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||
List<Double> betaProjectedData = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
||||
map.put("betaProjectedData", betaProjectedData);
|
||||
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
||||
List<Double> bchannels = new ArrayList<>();
|
||||
for (int i=0; i<numGChannel; i++){
|
||||
bchannels.clear();
|
||||
bchannels.add(Double.valueOf(i));
|
||||
List<Double> betaEnergy = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
|
||||
betaEnergyList.add(betaEnergy);
|
||||
}
|
||||
map.put("betaEnergyData", betaEnergyList);
|
||||
|
||||
//Xe
|
||||
List<XeData> xeDataList = new LinkedList<>();
|
||||
List<String> bgNuclideName = struct.bg_nuclide_name;
|
||||
List<String> bgRoiNumber = struct.bg_ROI_number;
|
||||
List<Double> bgEfficiency = struct.bg_efficiency;
|
||||
List<Double> bgUncertainty = struct.bg_uncertainty;
|
||||
for (int i=0; i< bgNuclideName.size(); i++){
|
||||
XeData xeData = new XeData();
|
||||
xeData.setIsotope(bgNuclideName.get(i));
|
||||
xeData.setConcentration(bgRoiNumber.get(i));
|
||||
xeData.setUncertainty(bgUncertainty.get(i));
|
||||
xeData.setMDC(bgEfficiency.get(i));
|
||||
xeDataList.add(xeData);
|
||||
}
|
||||
map.put("XeData", xeDataList);
|
||||
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -37,7 +37,7 @@ public class SpectrumAnalysesController {
|
|||
|
||||
@GetMapping("getDBSpectrumChart")
|
||||
@ApiOperation(value = "查询折线图相关信息接口", notes = "查询折线图相关信息接口")
|
||||
public Result getDBSpectrumPie(String dbName, Integer[] sampleId){
|
||||
public Result getDBSpectrumPie(String dbName, Integer sampleId){
|
||||
return spectrumAnalysisService.getDBSpectrumPie(dbName, sampleId);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -24,6 +26,8 @@ public class SpectrumFileRecord implements Serializable {
|
|||
|
||||
private String siteDetCode;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date collectStart;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class XeData implements Serializable {
|
||||
|
||||
private String Isotope;
|
||||
|
||||
private String Concentration;
|
||||
|
||||
private Double Uncertainty;
|
||||
|
||||
private Double MDC;
|
||||
|
||||
}
|
|
@ -4,13 +4,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.modules.base.entity.GardsSampleData;
|
||||
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SpectrumAnalysisMapper {
|
||||
|
||||
Page<GardsSampleData> getDBSpectrumList(IPage<GardsSampleData> page, GardsSampleData gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStop, boolean AcqStart, String startTime, String endTime);
|
||||
|
||||
SpectrumFileRecord getDBSpectrumFilePath(String dbName, List<Integer> sampleIds);
|
||||
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId);
|
||||
|
||||
String getQCFilePath(String siteDetCode, String collectStartStr);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
<select id="getDBSpectrumList" resultType="org.jeecg.modules.base.entity.GardsSampleData">
|
||||
select c.sample_id,
|
||||
b.station_code,
|
||||
a.detector_code,
|
||||
b.station_code stationName,
|
||||
a.detector_code detectorsName,
|
||||
c.sample_type,
|
||||
c.data_type,
|
||||
c.spectral_qualifie,
|
||||
|
@ -78,13 +78,22 @@
|
|||
FROM ORIGINAL.GARDS_SAMPLE_DATA org_sample,
|
||||
${dbName} analyses
|
||||
<where>
|
||||
analyses.SAMPLE_ID IN
|
||||
<foreach collection="sampleIds" item="sampleId" open="(" close=")" separator=",">
|
||||
#{sampleId}
|
||||
</foreach>
|
||||
analyses.SAMPLE_ID = #{sampleId}
|
||||
AND org_sample.SAMPLE_ID=analyses.SAMPLE_ID
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getQCFilePath" resultType="java.lang.String">
|
||||
SELECT org_sample_data.INPUT_FILE_NAME
|
||||
FROM ORIGINAL.GARDS_SAMPLE_DATA org_sample_data
|
||||
<where>
|
||||
org_sample_data.ACQUISITION_START=
|
||||
(SELECT MAX(qc_samples.ACQUISITION_START) FROM ORIGINAL.GARDS_SAMPLE_DATA qc_samples WHERE qc_samples.SITE_DET_CODE= '${siteDetCode}'
|
||||
AND qc_samples.DATA_TYPE='Q'
|
||||
AND qc_samples.SPECTRAL_QUALIFIE='FULL'
|
||||
AND qc_samples.ACQUISITION_START <= TO_DATE('${collectStartStr}', 'YYYY-MM-DD hh24:mi:ss'))
|
||||
AND org_sample_data.SITE_DET_CODE= '${siteDetCode}'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -12,6 +12,6 @@ public interface ISpectrumAnalysisService {
|
|||
|
||||
Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate);
|
||||
|
||||
Result getDBSpectrumPie(String dbName, Integer[] sampleId);
|
||||
Result getDBSpectrumPie(String dbName, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
result.error500("请勾选数据库类型");
|
||||
return result;
|
||||
}
|
||||
String tempDBName = dbName;
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO.GARDS_ANALYSES";
|
||||
}else if (dbName.equalsIgnoreCase("man")){
|
||||
|
@ -124,18 +125,26 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
//声明分页page
|
||||
Page<GardsSampleData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
Page<GardsSampleData> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStop, AcqStart, startTime, endTime);
|
||||
sampleDataPage.getRecords().stream().forEach(item->{
|
||||
item.setDbName(tempDBName);
|
||||
});
|
||||
result.setSuccess(true);
|
||||
result.setResult(sampleDataPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getDBSpectrumPie(String dbName, Integer[] sampleId) {
|
||||
public Result getDBSpectrumPie(String dbName, Integer sampleId) {
|
||||
Result result = new Result();
|
||||
Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
||||
List<Integer> sampleIds = Arrays.asList(sampleId);
|
||||
if (CollectionUtils.isEmpty(sampleIds)){
|
||||
result.error500("至少需要选择一个数据");
|
||||
if (redisUtil.hasKey("Spectrum_"+sampleId)){
|
||||
resultMap = (Map<String, Map<String, Object>>) redisUtil.get("Spectrum_" + sampleId);
|
||||
result.setSuccess(true);
|
||||
result.setResult(resultMap);
|
||||
return result;
|
||||
}
|
||||
if (Objects.isNull(sampleId)){
|
||||
result.error500("请选择一条数据");
|
||||
return result;
|
||||
}
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
|
@ -147,31 +156,40 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return result;
|
||||
}
|
||||
//查询数据库文件信息
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleIds);
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
||||
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath();
|
||||
String pathName = sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
resultMap.put("sample",map);
|
||||
}
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())){
|
||||
String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath();
|
||||
String pathName = gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
}
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())){
|
||||
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
|
||||
String pathName = detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
}
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getQcFilePath())){
|
||||
String qcFilePath = dbSpectrumFilePath.getQcFilePath();
|
||||
String pathName = qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = qcFilePath.substring(qcFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||
if (Objects.nonNull(dbSpectrumFilePath)) {
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
||||
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath();
|
||||
String pathName = sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
resultMap.put("sample",map);
|
||||
}
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())){
|
||||
String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath();
|
||||
String pathName = gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
resultMap.put("gasBg",map);
|
||||
}
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())){
|
||||
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
|
||||
String pathName = detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
resultMap.put("detBg",map);
|
||||
}
|
||||
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
|
||||
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||
dbSpectrumFilePath.setQcFilePath(dbQcFilePath);
|
||||
if(StringUtils.isNotBlank(dbSpectrumFilePath.getQcFilePath())){
|
||||
String qcFilePath = dbSpectrumFilePath.getQcFilePath();
|
||||
String pathName = qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = qcFilePath.substring(qcFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
Map<String, Object> map = this.fenxi(pathName, fileName);
|
||||
resultMap.put("qc",map);
|
||||
}
|
||||
redisUtil.set("Spectrum_"+sampleId, resultMap);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(resultMap);
|
||||
|
|
Loading…
Reference in New Issue
Block a user