|
@@ -444,13 +444,20 @@ public class PdfParseService {
|
|
|
int whitespaceSkipped = clean.substring(startAfter).length() - afterText.length();
|
|
int whitespaceSkipped = clean.substring(startAfter).length() - afterText.length();
|
|
|
valEnd = startAfter + whitespaceSkipped + vm.group(1).length();
|
|
valEnd = startAfter + whitespaceSkipped + vm.group(1).length();
|
|
|
|
|
|
|
|
|
|
+ // 安全截断,防止越界
|
|
|
|
|
+ if (valEnd > clean.length()) valEnd = clean.length();
|
|
|
|
|
+
|
|
|
// 状态文本:从数值后到下一个名称或区域结束
|
|
// 状态文本:从数值后到下一个名称或区域结束
|
|
|
String status = "";
|
|
String status = "";
|
|
|
if (i + 1 < uniquePositions.size()) {
|
|
if (i + 1 < uniquePositions.size()) {
|
|
|
int nextPos = uniquePositions.get(i + 1).position;
|
|
int nextPos = uniquePositions.get(i + 1).position;
|
|
|
- status = clean.substring(valEnd, nextPos).trim();
|
|
|
|
|
|
|
+ if (valEnd <= nextPos && nextPos <= clean.length()) {
|
|
|
|
|
+ status = clean.substring(valEnd, nextPos).trim();
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- status = clean.substring(valEnd).trim();
|
|
|
|
|
|
|
+ if (valEnd <= clean.length()) {
|
|
|
|
|
+ status = clean.substring(valEnd).trim();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// 清理状态中的残留标记
|
|
// 清理状态中的残留标记
|
|
|
status = status.replaceAll("注意大环内酯类|注意呋喃类|注意氯霉素类|注意喹诺酮类|" +
|
|
status = status.replaceAll("注意大环内酯类|注意呋喃类|注意氯霉素类|注意喹诺酮类|" +
|