package jnpf.elnService.field;
|
|
import java.util.Arrays;
|
import java.util.Collections;
|
import java.util.LinkedHashSet;
|
import java.util.Set;
|
|
/** ELN 向 LIMS 明确提交的两个系统业务字段。 */
|
public final class ElnTestResultFields {
|
public static final String RESULT = "jianyan_jieguo_7d4c1a";
|
public static final String CONCLUSION = "jianyan_jielun_3e8b5f";
|
private static final String DOCX_FIELD_PREFIX = "eln.field.";
|
public static final Set<String> CONCLUSION_CODES = Collections.unmodifiableSet(
|
new LinkedHashSet<>(Arrays.asList("compliant", "non_compliant", "not_inspected", "external")));
|
private static final Set<String> RESULT_DOCX_TAGS = documentTags(
|
RESULT, "jianyan_jieguo", "test.result", "inspection.result");
|
private static final Set<String> CONCLUSION_DOCX_TAGS = documentTags(
|
CONCLUSION, "jianyan_jielun", "test.conclusion", "inspection.conclusion");
|
|
private ElnTestResultFields() {
|
}
|
|
public static boolean isSystemField(String code) {
|
return RESULT.equals(code) || CONCLUSION.equals(code);
|
}
|
|
/** 新模板使用新编码 Tag;已标注 DOCX 保留旧 Tag 的填写兼容。 */
|
public static Set<String> docxTags(String code) {
|
if (RESULT.equals(code)) return RESULT_DOCX_TAGS;
|
if (CONCLUSION.equals(code)) return CONCLUSION_DOCX_TAGS;
|
return Collections.singleton(DOCX_FIELD_PREFIX + code);
|
}
|
|
private static Set<String> documentTags(String currentCode, String... legacyCodes) {
|
LinkedHashSet<String> tags = new LinkedHashSet<>();
|
tags.add(DOCX_FIELD_PREFIX + currentCode);
|
for (String legacyCode : legacyCodes) {
|
tags.add(DOCX_FIELD_PREFIX + legacyCode);
|
}
|
return Collections.unmodifiableSet(tags);
|
}
|
}
|