人工交互分析gamma部分新增加G气体相关MDC计算信息

自动处理增加G气体相关MDC计算信息
This commit is contained in:
qiaoqinzheng 2023-12-25 09:24:12 +08:00
parent 5e9642de91
commit 66ba744b79
2 changed files with 103 additions and 44 deletions

View File

@ -230,17 +230,24 @@ public class Sample_G_Analysis {
for (int i=0; i<docChildNodes.getLength(); i++) { for (int i=0; i<docChildNodes.getLength(); i++) {
//获取节点信息 //获取节点信息
Node node = docChildNodes.item(i); Node node = docChildNodes.item(i);
if (node.getNodeName().equalsIgnoreCase(phd.getHeader().getSystem_type())) {
NodeList childNodes = node.getChildNodes();
if (Objects.nonNull(childNodes) && childNodes.getLength() > 0) {
//遍历子节点信息
for (int j=0; j< childNodes.getLength(); j++) {
//获取子节点信息
Node childNode = childNodes.item(j);
//判断节点名称是否是item //判断节点名称是否是item
if (node.getNodeName().equalsIgnoreCase("item")) { if (childNode.getNodeName().equalsIgnoreCase("item")) {
//获取节点属性信息 //获取节点属性信息
NamedNodeMap attributes = node.getAttributes(); NamedNodeMap attributes = childNode.getAttributes();
//判断节点属性信息是否为空 //判断节点属性信息是否为空
if (Objects.nonNull(attributes)) { if (Objects.nonNull(attributes)) {
CalMDCInfo info = new CalMDCInfo(); CalMDCInfo info = new CalMDCInfo();
//遍历属性信息 //遍历属性信息
for (int j=0; j<attributes.getLength(); j++) { for (int k=0; k<attributes.getLength(); k++) {
//根据顺序读取属性 //根据顺序读取属性
Node attribute = attributes.item(j); Node attribute = attributes.item(k);
if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) { if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) {
info.setNuclideName(attribute.getNodeValue()); info.setNuclideName(attribute.getNodeValue());
} else if (attribute.getNodeName().equalsIgnoreCase("halflife")) { } else if (attribute.getNodeName().equalsIgnoreCase("halflife")) {
@ -255,6 +262,9 @@ public class Sample_G_Analysis {
} }
} }
} }
}
}
}
if (CollectionUtils.isNotEmpty(mdcInfoMap)) { if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap); phd.setMdcInfoMap(mdcInfoMap);
} }

View File

@ -207,7 +207,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result; return result;
} }
//读取redis缓存的计算mdc信息 //读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap"); Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) { if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap); phd.setMdcInfoMap(mdcInfoMap);
} }
@ -235,7 +235,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap); redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap);
} }
//读取redis缓存的计算mdc信息 //读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap"); Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) { if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap); phd.setMdcInfoMap(mdcInfoMap);
} }
@ -517,7 +517,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result; return result;
} }
//读取redis缓存的计算mdc信息 //读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap"); Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) { if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap); phd.setMdcInfoMap(mdcInfoMap);
} }
@ -893,7 +893,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap); redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap);
} }
//读取redis缓存的计算mdc信息 //读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap"); Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) { if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap); phd.setMdcInfoMap(mdcInfoMap);
} }
@ -5792,8 +5792,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
* 读取计算MDC参数文件方法 * 读取计算MDC参数文件方法
*/ */
public void readMDCParameter() { public void readMDCParameter() {
//存储文件结果用的map
Map<String, CalMDCInfo> mdcInfoMap = new TreeMap<>();
//配置文件路径 //配置文件路径
String filePath = parameterProperties.getFilePath()+ File.separator + "MDCParameter.xml"; String filePath = parameterProperties.getFilePath()+ File.separator + "MDCParameter.xml";
try { try {
@ -5814,17 +5812,28 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
for (int i=0; i<docChildNodes.getLength(); i++) { for (int i=0; i<docChildNodes.getLength(); i++) {
//获取节点信息 //获取节点信息
Node node = docChildNodes.item(i); Node node = docChildNodes.item(i);
//判断节点名称是否是 P
if (node.getNodeName().equalsIgnoreCase("P")) {
//存储文件结果用的map
Map<String, CalMDCInfo> mdcInfoMap = new TreeMap<>();
//获取节点下的子节点信息
NodeList childNodes = node.getChildNodes();
//如果子节点不为空
if (Objects.nonNull(childNodes) && childNodes.getLength() > 0) {
//遍历子节点信息 将核素信息封存到缓存中
for (int j=0; j<childNodes.getLength(); j++) {
Node childNode = childNodes.item(j);
//判断节点名称是否是item //判断节点名称是否是item
if (node.getNodeName().equalsIgnoreCase("item")) { if (childNode.getNodeName().equalsIgnoreCase("item")) {
//获取节点属性信息 //获取节点属性信息
NamedNodeMap attributes = node.getAttributes(); NamedNodeMap attributes = childNode.getAttributes();
//判断节点属性信息是否为空 //判断节点属性信息是否为空
if (Objects.nonNull(attributes)) { if (Objects.nonNull(attributes)) {
CalMDCInfo info = new CalMDCInfo(); CalMDCInfo info = new CalMDCInfo();
//遍历属性信息 //遍历属性信息
for (int j=0; j<attributes.getLength(); j++) { for (int k=0; k<attributes.getLength(); k++) {
//根据顺序读取属性 //根据顺序读取属性
Node attribute = attributes.item(j); Node attribute = attributes.item(k);
if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) { if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) {
info.setNuclideName(attribute.getNodeValue()); info.setNuclideName(attribute.getNodeValue());
} else if (attribute.getNodeName().equalsIgnoreCase("halflife")) { } else if (attribute.getNodeName().equalsIgnoreCase("halflife")) {
@ -5837,10 +5846,50 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
} }
} }
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
redisUtil.set("mdcInfoMap-P", mdcInfoMap);
}
}
} else if (node.getNodeName().equalsIgnoreCase("G")) {//判断节点名称是否是 G
//存储文件结果用的map
Map<String, CalMDCInfo> mdcInfoMap = new TreeMap<>();
//获取节点的子节点
NodeList childNodes = node.getChildNodes();
//判断子节点是否为空
if (Objects.nonNull(childNodes) && childNodes.getLength() > 0) {
//遍历子节点信息
for (int j=0; j<childNodes.getLength(); j++) {
Node childNode = childNodes.item(j);
//判断节点名称是否是item
if (childNode.getNodeName().equalsIgnoreCase("item")) {
//获取节点属性信息
NamedNodeMap attributes = childNode.getAttributes();
//判断节点属性信息是否为空
if (Objects.nonNull(attributes)) {
CalMDCInfo info = new CalMDCInfo();
//遍历属性信息
for (int k=0; k<attributes.getLength(); k++) {
//根据顺序读取属性
Node attribute = attributes.item(k);
if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) {
info.setNuclideName(attribute.getNodeValue());
} else if (attribute.getNodeName().equalsIgnoreCase("halflife")) {
info.setHalflife(Double.valueOf(attribute.getNodeValue()));
}
}
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(info.getNuclideName()) && Objects.nonNull(info.getHalflife())) {
mdcInfoMap.put(info.getNuclideName(), info);
}
}
} }
} }
if (CollectionUtils.isNotEmpty(mdcInfoMap)) { if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
redisUtil.set("mdcInfoMap", mdcInfoMap); redisUtil.set("mdcInfoMap-G", mdcInfoMap);
}
}
}
}
}
} }
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
throw new RuntimeException(e); throw new RuntimeException(e);