A medical document content deduplication, resuming and ordered merging method and system

By separating the retrieval and processing of document instances and content processing records in the medical document processing system, and using file characteristics to generate file identity determination results, the problem of inconsistent document positions in cross-batch uploads and asynchronous processing is solved, and continuous and orderly merging of documents is achieved.

CN122673165BActive Publication Date: 2026-11-03HUNAN TRASEN SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611165634.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-11-03
Estimated Expiration
2046-08-03

AI Technical Summary

Technical Problem

In scenarios involving cross-batch uploading of medical documents and asynchronous OCR processing, existing technologies struggle to effectively distinguish between the identity of the file content and the identity of the uploaded instance, leading to inconsistent processing of duplicate content and difficulty in forming continuous and orderly merged documents.

Method used

By separating and retrieving document instances and content processing records, file identity determination results are generated using the original file name, byte size, and content hash value. Matching document instance records are reused, new document instance records are created and associated with completed content processing records, a global sort number is assigned, OCR results are reused and unfinished processing is continued, and the merging range is controlled to maintain the continuity of the document sequence.

Benefits of technology

It avoids duplicate OCR processing in cross-batch uploads and asynchronous processing, maintains the independent sorting position of document instances, ensures the continuity and consistency of document merging, and avoids document position confusion caused by misjudgment of file names or content hash values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122673165B_ABST
    Figure CN122673165B_ABST
Patent Text Reader

Abstract

The present application relates to medical document data processing technical field, especially to a kind of medical document content deduplication continuation and ordered merging method and system.The method obtains medical document, batch order and original name, calculates byte size and content hash value, and retrieves document instance record and content processing record;According to the matching result, use the original document instance, or create new document instance associated with content processing record, or create new document instance and new content processing record, and distribute global sorting number;Reuse completed OCR result, perform OCR processing on new content, and continue processing using the original instance and original sorting number for incomplete content;Retrieve available document instance from the current merging position, read associated OCR result according to global sorting number, update ordered merging document and merging state record.The present application reuses OCR result for the same content and preserves independent sorting position, so that processing continuation and cross-batch merging remain continuous.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical document data processing and computer file management technology, and in particular to a method and system for deduplicating and resuming medical document content and orderly merging. Background Technology

[0002] In the field of medical document data processing technology, medical institutions typically convert medical documents such as admission records, progress notes, laboratory reports, imaging reports, and discharge records into electronic files. These files are then processed through file uploading, optical character recognition (OCR), text storage, and document merging to create digital documents available for later retrieval. Existing solutions generally identify duplicate files based on file name, file content hash value, or text fingerprint, perform OCR on unprocessed files, and organize the recognition results according to upload time, document time, or database sorting fields. While such solutions can complete basic document recognition and text aggregation in scenarios with a single batch, a small number of files, and continuous processing, they are prone to issues in scenarios involving cross-batch uploads and asynchronous processing of medical documents. These issues can lead to problems such as files with the same name but different content, files with different names but identical content, and discrepancies between the order in which documents are processed and the order in which they are uploaded.

[0003] Existing file deduplication schemes often use file content hash values ​​as the basis for determining duplicates. Upon matching identical content, they typically reject duplicate uploads, delete duplicate records, or directly reuse the original processed record. When using this approach, the identity of the file content and the identity of the upload instance are usually not distinguished; when the same content reappears in different upload batches, the new upload position may be ignored along with the duplicate content. If a complete processing record is re-established to preserve the upload position, optical character recognition may be repeatedly performed on the same file content. Recreating tasks or reassigning sorting positions after processing is interrupted can also easily lead to inconsistencies between the original processing progress, document instance records, and document sequence positions.

[0004] Furthermore, existing document merging schemes typically arrange currently recognized documents directly according to a time field or a sorting field. When a preceding medical document is still being processed while a subsequent medical document has already been recognized, directly merging completed records can easily create gaps in the intermediate order; arranging by recognition completion time will change the original position of the medical documents in the upload batch. For the joint processing of document instances, file content, recognition results, processing progress, and cross-batch sorting positions, existing technologies still have inconsistencies in their relationships regarding duplicate content reuse, processing interruptions, and continuous document merging. Therefore, it is necessary to address the challenges of preserving the independent document instance sorting positions and forming continuously ordered merged documents when reusing recognition results for the same file content in scenarios involving cross-batch uploads of medical documents and asynchronous optical character recognition. Summary of the Invention

[0005] To address the above issues, this invention provides a method for deduplicating and resuming the transmission of medical documents in an ordered manner. This method addresses the problem of separating document instances from content processing records during cross-batch uploads and asynchronous OCR processing of medical documents, enabling the reuse of OCR results for identical content while preserving independent sorting positions, thus forming continuously ordered merged documents.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0007] S100: Obtain the medical document file, batch order, and original file name in the medical document processing session; calculate the file byte size and file content hash value; retrieve document instance records using the original file name, file byte size, and file content hash value; if no match is found, retrieve content processing records using the file byte size and file content hash value; generate a file identity determination result.

[0008] S200. Based on the file identity determination result, the matching document instance record is retained; for files that only match the content processing record, a new document instance record is created that is associated with the content processing record; for files that do not match, new document instance records and new content processing records are created that are mutually associated; an incrementing global sort number is assigned to the new document instance record according to the order within the batch, and an ordered document instance record set is generated.

[0009] S300. Based on the ordered document instance record set, reuse the OCR results in the completed content processing records, perform OCR processing on the new content processing records, and continue processing the incomplete content processing records using the original document instance records and the original global sort number to generate a document instance processing status set.

[0010] S400. Based on the document instance processing status set, retrieve consecutive result available document instance records from the current merging position according to the global sort number; read the OCR results associated with the document instance records and merge them, and update the ordered merged documents and merge status records.

[0011] Furthermore, the generation of the file identity determination result includes:

[0012] When a document instance record is found that matches the original file name, file size in bytes, and file content hash value, the medical document file is recorded as the instance matching file, and the content processing record and global sort number associated with the document instance record are read.

[0013] If no matching document instance record is found, but a content processing record is found that matches both the file size in bytes and the file content hash value, the medical document file is recorded as a content matching file.

[0014] If no matching document instance record or content processing record is found, the medical document file is recorded as a content-unmatched file.

[0015] Furthermore, the document instance record includes a document instance identifier, a session identifier, a batch identifier, the original file name, the order within the batch, the global sort number, the content processing record identifier, the instance processing status, and the merge status;

[0016] The content processing record includes a content processing record identifier, file size in bytes, file content hash value, OCR processing status, OCR processing progress, OCR result, processing configuration version, and last update time;

[0017] Multiple document instance records are associated with the same content processing record through a content processing record identifier, and the global sort number is recorded in the document instance record.

[0018] Furthermore, the incrementally assigned global sort number includes:

[0019] Count the number of new document instance records corresponding to the content-matching files and the content-unmatching files;

[0020] Read the sorting status of the medical document processing session, and reserve consecutive global sorting numbers in the sorting status that are the same as the number of records of the new document instance;

[0021] According to the batch order, the consecutive global sort numbers are sequentially written into the new document instance record;

[0022] Write the last global sort number in the consecutive global sort numbers into the sorting state;

[0023] The instance matching file uses the global sort number from the matched document instance record.

[0024] Furthermore, the reuse of the OCR results from the completed content processing record includes:

[0025] Read the OCR processing status, OCR result, and processing configuration version from the content processing record;

[0026] Compare the current processing configuration version with the processing configuration version in the content processing record;

[0027] When the OCR processing status is completed, the OCR result is not empty, and the two processing configuration versions are consistent, the new document instance record is associated with the content processing record, and the instance processing status of the new document instance record is updated to the reused status.

[0028] Furthermore, the OCR processing of the new content processing record includes:

[0029] An OCR processing task is created based on the new content processing record, and the OCR processing status is updated to "processing".

[0030] Perform page conversion and text recognition on the medical document file, and record the set of completed pages and the page processing results;

[0031] After completing the text recognition of the medical document file, the processing results of each page are merged into an OCR result according to the page order, and the OCR processing status is updated to the completed status.

[0032] Furthermore, the continued processing of incomplete content processing records includes:

[0033] Read the OCR processing status, the set of completed pages, and the last update time from the incomplete content processing record;

[0034] The incomplete pages are determined based on the set of completed pages;

[0035] Using the incomplete content processing record and its associated document instance record and global sort number, continue to perform text recognition on the incomplete page;

[0036] Write the page processing result of the incomplete page into the incomplete content processing record, and update the OCR processing status and the document instance processing status.

[0037] Furthermore, the continuous results of the retrieval can be recorded using document instance records, including:

[0038] Starting from the global sort number after the merge position in the merge status record, read the document instance records sequentially;

[0039] When the instance processing status of the document instance record is in the result available state or the reused state, the document instance record is added to the mergeable document instance range, and the document instance record corresponding to the next global sort number is read.

[0040] When the instance processing status of the document instance record is in the processing state or the recoverable failure state, reading subsequent document instance records will stop.

[0041] The global sort number of the last result that can be used as the mergeable position is recorded in the document instance.

[0042] Furthermore, the updating of the ordered merged documents and merge status records includes:

[0043] Read the document instance records within the range of mergeable document instances according to the global sort number;

[0044] The OCR results are read based on the record identifiers in each document instance record;

[0045] Each OCR result is written into the ordered merged document according to the global sort number;

[0046] Write the mergeable position into the merge position in the merge status record, and update the merge version.

[0047] This invention also provides a system for deduplicating and resuming medical document content and for orderly merging, comprising:

[0048] The file identity determination module is used to obtain the medical document file, batch order and original file name in the medical document processing session, calculate the file size in bytes and the file content hash value; retrieve document instance records using the original file name, file size in bytes and file content hash value, and retrieve content processing records using the file size in bytes and file content hash value when no match is found, and generate a file identity determination result.

[0049] The document instance management module, connected to the file identity determination module, is used to retain the matching document instance record based on the file identity determination result; create a new document instance record associated with the content processing record for files that only match the content processing record; and create a new document instance record and a new content processing record that are mutually associated for files that do not match either, thereby generating a document instance association result.

[0050] The global sorting management module, connected to the document instance management module, is used to assign an incrementing global sorting number to the new document instance record according to the batch order based on the document instance association result, thereby generating an ordered document instance record set;

[0051] The content processing module, connected to the global sorting management module, is used to reuse the OCR results in the completed content processing records based on the ordered document instance record set, and to perform OCR processing on the new content processing records and save the OCR processing progress and OCR results to generate content processing results.

[0052] The processing recovery module, connected to the content processing module, is used to continue performing incomplete OCR processing on incomplete content processing records based on the content processing results, using the original document instance record and the original global sort number, and to generate a document instance processing status set.

[0053] The merge range determination module, connected to the processing recovery module, is used to retrieve consecutive available document instance records based on the document instance processing status set, starting from the current merge position in the merge status record and according to the global sort number, to generate a mergeable document instance range.

[0054] The ordered merging module, connected to the merging range determination module, is used to read the OCR results in the content processing records associated with each document instance record based on the mergeable document instance range, merge the OCR results according to the global sort number, and update the ordered merging documents and the merging status record.

[0055] The key innovations of this invention include:

[0056] (1) Treat document instance records and content processing records as different retrieval objects. First, retrieve document instance records based on the original file name, file size in bytes and file content hash value. Then, retrieve content processing records based on file size in bytes and file content hash value when no match is found. Instance matching results, content matching results and no match results control the reuse of document instance records, the association of content processing records and the creation of new records, respectively.

[0057] (2) Create a new document instance record for medical document files that only match the content processing record, associate the new document instance record with the OCR result in the completed content processing record, and assign a new global sort number according to the batch order of the current upload batch; multiple document instance records share the same content processing record, and the upload position and sort position of each document instance are retained respectively.

[0058] (3) Map the reuse of OCR results, processing of new content OCR and processing of incomplete OCR to document instance processing status in the same way; starting from the current merging position in the merge status record, continuously search the available document instance records according to the global sort number. Stop expanding the range of mergeable document instances when encountering a processing status or a recoverable failure status. Then read the OCR results according to the content processing records associated with each document instance record and update the ordered merged document.

[0059] The following are its main beneficial effects:

[0060] (1) By searching document instance records and content processing records separately, it is possible to distinguish between the same upload instance, instances with different file names but the same content, and instances with different file content, thus avoiding the reuse of files with the same name but different content based solely on the file name, and also avoiding the direct exclusion of new upload instances based solely on the content hash value.

[0061] (2) By associating the new document instance record with the existing content processing record and recording the new global sort number in the document instance record, the same file content does not need to be re-executed with OCR, and the historical sort position of the existing OCR result will not replace the position of the current document instance in the cross-batch document sequence.

[0062] (3) By continuing the unfinished OCR processing by using the original document instance record and the original global sort number, and controlling the merging range based on the continuous results available in the document instance record, the reuse time, recovery time and completion time of the OCR task will not change the order of document instances. When the preceding instance is not completed, the subsequent instance will not cross the corresponding sorting position to enter the ordered merged document. Attached Figure Description

[0063] Figure 1 A flowchart illustrating a method for deduplication and ordered merging of medical document content, provided in an embodiment of this application;

[0064] Figure 2 This is a structural block diagram of a medical document content deduplication and sequential merging system provided in an embodiment of this application. Detailed Implementation

[0065] To enable those skilled in the art to better understand the technical solution, the present invention will be described in detail below with reference to embodiments. The description in this part is only exemplary and explanatory, and should not be used to limit the scope of protection of the present invention in any way.

[0066] Example 1: Refer to Figure 1 This is a flowchart illustrating a method for deduplication and ordered merging of medical document content according to an embodiment of the present invention. The process may include at least steps S100-S400:

[0067] S100: Obtain the medical document file, batch order, and original file name in the medical document processing session; calculate the file byte size and file content hash value; retrieve document instance records using the original file name, file byte size, and file content hash value; if no match is found, retrieve content processing records using the file byte size and file content hash value; generate a file identity determination result.

[0068] S200. Based on the file identity determination result, the matching document instance record is retained; for files that only match the content processing record, a new document instance record is created that is associated with the content processing record; for files that do not match, new document instance records and new content processing records are created that are mutually associated; an incrementing global sort number is assigned to the new document instance record according to the order within the batch, and an ordered document instance record set is generated.

[0069] S300. Based on the ordered document instance record set, reuse the OCR results in the completed content processing records, perform OCR processing on the new content processing records, and continue processing the incomplete content processing records using the original document instance records and the original global sort number to generate a document instance processing status set.

[0070] S400. Based on the document instance processing status set, retrieve consecutive result available document instance records from the current merging position according to the global sort number; read the OCR results associated with the document instance records and merge them, and update the ordered merged documents and merge status records.

[0071] S100: Obtain the medical document files, batch order, and original file names from the medical document processing session; calculate the file size in bytes and the file content hash value; retrieve document instance records using the original file name, file size in bytes, and file content hash value; if no match is found, retrieve content processing records using the file size in bytes and file content hash value, and generate a file identity determination result.

[0072] In this embodiment, the medical document processing system is deployed on a medical document receiving server, which communicates with a file storage component, a state storage unit, an optical character recognition (OCR) component, and an ordered merging component. Optical character recognition (OCR) is used for this purpose. A medical document processing session corresponds to a single document collection task for the same patient, or a continuous document processing task associated with the same patient profile report. Multiple upload batches are allowed within the same medical document processing session, and the medical document files in each batch are ordered according to their position in the submission list. The order within a batch is based on the file list submitted by the client; the server's completion time for receiving file data does not change this order, preventing smaller files from being uploaded first and altering the order of user-submitted files.

[0073] After receiving the uploaded batch, the medical document receiving server first reads the session identifier, batch identifier, and file list, and then receives the medical document files item by item according to the file list. The medical document files are PDF files or image files. The original file name is taken from the file metadata carried in the upload request, and the order within the batch is taken from the file's position in the file list. File identity matching is not performed before file reception is complete to prevent the calculation of content hash values ​​for incomplete byte streams. After file reception is complete, the file feature generation unit calculates the file size in bytes based on the actual number of bytes received and performs a hash calculation on the complete byte stream. In one implementation, the file content hash value is generated using the SHA-256 algorithm; in another implementation, a hash algorithm capable of generating a fixed-length digest for the complete byte stream is used. The file content hash value is calculated based on the file's byte content, without including the original file name, upload path, or upload time in the hash input.

[0074] When byte stream gaps occur during file reading, the received file length differs from the length specified in the upload request, or the file storage component returns a write failure, the file feature generation unit does not perform subsequent matching on the incomplete byte stream. In this case, the system retains the session identifier, batch identifier, original file name, and batch order, and records the file's reception status as a failure. After the complete file is received again, the file size and content hash value are recalculated. If an anomaly occurs during hash calculation, the original file is stored in a temporary storage area; this file is not included in content processing record retrieval, nor is an OCR processing task created, thus preventing incomplete file features from participating in historical record matching.

[0075] After completing the file feature calculation, the file identity determination unit first performs instance-level joint matching in the historical document instance records associated with the current medical document processing session. Instance-level joint matching uses the original file name, file size in bytes, and file content hash value as search criteria. If all three search criteria are consistent, the currently uploaded file is considered to correspond to the same file instance as an existing document instance record. The search scope of instance-level joint matching is limited to the current medical document processing session; files with the same name or content in different sessions are not directly used as instance matching results for the current session to avoid confusion regarding document instance relationships between patients.

[0076] After retrieving a document instance record that matches all three features, the file identity determination unit reads the content processing record, instance processing status, and global sort number associated with that document instance record. When the instance processing status is "result available," "reused," or "completed," the currently uploaded file is classified as an instance-matching file, and the original document instance record and its global sort number are used subsequently. When the instance processing status is "processing" or "recoverable failure," the currently uploaded file is also classified as an instance-matching file, but the file identity determination result also carries a "pending recovery" status, allowing S300 to read the original content processing progress. This processing method does not create a second document instance record due to the same instance being submitted again, nor does it change the original position of the instance in the session sequence due to resubmission.

[0077] When no document instance record matching all three features is found, the file identity determination unit does not directly create an OCR processing task, but instead switches to content-level matching. Content-level matching retrieves content processing records based on file size and file content hash value, no longer using the original file name as a query condition. Content processing records with the same file size and the same file content hash value indicate that the current file and a historical file have the same byte content, even if their original file names are different, and still enter the content matching branch. This retrieval method separates upload instance identity from file content identity; instance-level joint matching is responsible for identifying the same submission record, while content-level matching is responsible for identifying whether different submission records share the same file content.

[0078] After a content-level match is found, the file identity determination unit reads the matched content processing record identifier, OCR processing status, OCR result, and processing configuration version. At this stage, only the current file is classified as a content-matched file; the global sort number of historical document instances is not directly assigned to the current file. The global sort number of historical document instances describes the historical upload position; the current file belongs to a new document instance in the current upload batch, and their instance positions are different. When the content processing record is in a completed state and the OCR result is not empty, the matched content processing record identifier is written into the file identity determination result; when the content processing record is in a processing state or a recoverable failure state, the matched content processing record identifier and corresponding status are retained in the file identity determination result, and S300 decides to continue the original content processing task based on this status; when the OCR result in the content processing record is empty or the record status is inconsistent with the actual result, the record is not directly used as a reusable result.

[0079] When neither instance-level joint matching nor content-level matching matches, the current file is classified as a file with unmatched content. The file identity determination result includes the session identifier, batch identifier, intra-batch order, original file name, file size in bytes, file content hash value, and file classification result. For instance-matched files, the file identity determination result also includes the matched document instance identifier, content processing record identifier, original global sort number, and instance processing status; for content-matched files, the file identity determination result includes the matched content processing record identifier and OCR processing status; for unmatched files, the file identity determination result does not carry a history record identifier. The above information is read by S200, and based on this, it selects to reuse the document instance record, create a new document instance record that is only associated with historical content processing records, or create a new document instance record and a new content processing record simultaneously.

[0080] S200. Based on the file identity determination result, retain the matching document instance records; for files that only match the content processing record, create a new document instance record associated with the content processing record; for files that do not match, create mutually associated new document instance records and new content processing records; assign incremental global sort numbers to the new document instance records according to the batch order, generating an ordered document instance record set:

[0081] After receiving the file identity determination result generated by S100, the document instance management unit establishes record relationships for instance-matched files, content-matched files, and content-unmatched files. The document instance record carries the instance position of a medical document file in the current session and the current upload batch, while the content processing record carries the OCR processing status, OCR processing progress, and OCR result corresponding to the file's byte content. These two types of records are associated through a content processing record identifier, establishing a one-to-many relationship between one content processing record and multiple document instance records. The global sort number is recorded in the document instance record but not in the content processing record; when a content processing record is shared by multiple document instances, it does not have a single document sequence position.

[0082] For instance-matched files, the document instance management unit reads the document instance identifier from the file identity determination result and directly uses the corresponding document instance record. The session identifier, batch identifier, content processing record identifier, and global sort number in this document instance record remain unchanged. The current upload request does not create a new document instance record, nor does it reuse the sort number. If the content processing record corresponding to the instance-matched file has been completed, the document instance record enters the subsequent result reading branch; if the content processing record has not yet been completed, the document instance record enters the pending recovery branch. Therefore, duplicate submissions of the same instance will not create duplicate positions in the session sequence.

[0083] For content-matching files, if the original file name or batch position differs from historical document instances, the document instance management unit creates a new document instance record. The new document instance record writes the current session identifier, current batch identifier, current file original name, and current batch order, while using the content processing record identifier retrieved in S100 as the association identifier. At this time, neither historical OCR results nor historical document instance records are copied; the new document instance reads the same OCR result through the content processing record identifier. Historical document instances and new document instances retain their respective original file names, batch identifiers, and global sort numbers, but they are associated with the same content processing record.

[0084] If the content processing record associated with the content matching file has been completed and meets the reuse conditions, the instance processing status of the new document instance record is initially recorded as pending reuse. After the S300 completes the processing configuration version verification, it is updated to the reused status. If the associated content processing record is still in the processing state, the instance processing status of the new document instance record remains associated with that content processing record. Once the original content processing task is completed, multiple associated document instances simultaneously obtain a result-available status. This approach avoids repeatedly creating parallel OCR tasks for the same file content, preventing inconsistent results from multiple instances processing the same byte of content separately.

[0085] For files with unmatched content, the document instance management unit creates a new content processing record and a new document instance record associated with that content processing record. The new content processing record is written with the file size in bytes, file content hash value, pending status, current processing configuration version, and creation time; the OCR processing progress and OCR result are initialized to empty. The new document instance record is written with the session identifier, batch identifier, original file name, batch order, and new content processing record identifier. This step only establishes record relationships; page conversion or text recognition is not performed within the record creation transaction to avoid time-consuming OCR operations occupying the record creation transaction.

[0086] Before a new document instance record is created, the global sorting management unit first counts the number of files in the current upload batch that need to obtain a new sorting position. These files include content-matching files and content-unmatching files, but do not include instance-matching files that reuse historical document instance records. The global sorting management unit reads the sorting status of the current medical document processing session, which records either the next allocatable sorting number or the last currently assigned global sorting number. When multiple new document instances need to be assigned sorting numbers, the system reserves consecutive global sorting numbers equal to the number of new document instances in a single transaction and writes them sequentially to each new document instance record according to the batch order.

[0087] For example, if the last global sort number assigned to the current session is 5, and there are 3 files in the current batch that require the creation of new document instance records, with the batch order of these 3 files being 1, 2, and 3 respectively, then the global sorting management unit reserves three sort numbers: 6, 7, and 8, and writes them into the corresponding document instance records according to the batch order. Even if sort number 6 corresponds to a content-matching file, and sort numbers 7 and 8 correspond to content-unmatched files, the three are still arranged according to the submission order of the same batch. The content processing type does not change the sequence position of the document instances.

[0088] The processes of reserving sort numbers, creating new document instance records, associating content processing records, and updating session sorting status are all performed within the same transaction boundary. If any new document instance record write fails, the current transaction undones reserved sort numbers and records that were not fully created, while retaining the sorting status values ​​from before the transaction began. This process avoids situations where some files have already obtained sort numbers, while others fail to be created, leaving sorting positions without corresponding instances. When multiple upload batches enter the same medical document processing session in parallel, updating the session sorting status through transactions ensures that different batches obtain non-overlapping, continuous sorting intervals.

[0089] The document instance record includes the document instance identifier, session identifier, batch identifier, original file name, batch order, global sort number, content processing record identifier, instance processing status, and merge status. The content processing record includes the content processing record identifier, file size in bytes, file content hash value, OCR processing status, OCR processing progress, OCR result, processing configuration version, and last update time. In one implementation, the OCR processing progress includes the total number of pages in the file, the set of completed pages, and the processing result for each page; image files are recorded as single-page files with page number 1, while PDF files record multiple pages according to the original page order.

[0090] After document instance creation and sorting number assignment are completed, the document instance management unit organizes the instance records in the current session according to the global sorting number, forming an ordered document instance record set. This record set does not copy the OCR results, but retains the content processing record identifier, instance processing status, and global sorting number corresponding to each document instance. S300 then enters the result reuse, new content OCR processing, or unfinished processing continuation branch according to these relationships.

[0091] S300. Based on the ordered document instance record set, reuse the OCR results in the completed content processing records, perform OCR processing on the new content processing records, and continue processing the incomplete content processing records using the original document instance record and the original global sort number, generating a document instance processing status set:

[0092] After receiving the ordered set of document instance records, the content processing and result reuse unit allocates processing paths according to the status of the content processing records associated with each document instance. Since multiple document instances may be associated with the same content processing record, the system first merges pending items according to the content processing record identifier, and then performs a status read for each content processing record. Content processing records in the completed state enter the result reuse verification; new content processing records in the pending state enter the OCR processing task creation; content processing records in the processing state or the recoverable failure state enter the processing recovery verification. The global sort number of the document instance does not participate in OCR task scheduling, and the sort position of the document instance is not modified when the OCR task execution order changes.

[0093] For records where content processing has been completed, the content processing and result reuse unit reads the OCR processing status, OCR result, and processing configuration version. The current processing configuration version corresponds to the page conversion configuration, text recognition configuration, and text merging rule version used in this medical document processing session. Only when the content processing record is in a completed state, the OCR result is not empty, and the historical processing configuration version is consistent with the current processing configuration version, is the OCR result reused by the current document instance. After verification, the new document instance record continues to be associated with the original content processing record, and the instance processing status is updated from pending reuse to reused.

[0094] When processing configuration versions are inconsistent, historical OCR results are not directly incorporated into the current document instance's processing state set. In one implementation, the system creates a new content processing record for the same file content. This new record retains the file's byte size and content hash value, and is written with the current processing configuration version. The current document instance record is then associated with the new content processing record, and OCR is executed according to the new content processing branch. The old content processing record continues to be available for document instances using the historical processing configuration version, without overwriting the original OCR results. This approach preserves result versions under different processing configurations, preventing new rule processing results from overwriting historical results already referenced by other instances.

[0095] When new content processing records enter OCR processing, the OCR task scheduling component creates an OCR processing task based on the content processing record identifier and updates the OCR processing status from pending to processing. When the medical document file is a PDF file, the page conversion component reads the PDF page numbers and converts each page into an image page according to the original page order; when the medical document file is an image file, the original image is input as a single page into the text recognition component. The page conversion result corresponds to the page number, which serves as the basis for merging subsequent page processing results.

[0096] When page conversion fails, the content processing record retains the completed page conversion results and writes the failed page number into the OCR processing progress. For unreadable PDF pages, empty OCR text is not generated to impersonate a completed result; the OCR processing status remains in a recoverable failure state, and the most recent update time records the end time of this processing. During subsequent recovery, the system re-executes the conversion and text recognition of incomplete pages based on the set of completed pages and the failed page number. When the entire file cannot be parsed, the content processing record retains the file size in bytes, the file content hash value, and the failure status; the associated document instance does not enter a result-available state.

[0097] The text recognition component processes page images page by page according to page number. After each page's text recognition is completed, the page processing result and page number are saved to the content processing record, and the page number is added to the completed page set. Saving the page processing result and updating the completed page set are performed within the same submission process to avoid situations where the page text has been saved but the page status still shows as incomplete. If the submission process is interrupted, upon resumption, the consistency between the saved page processing result and the completed page set is checked. If a page processing result exists but the page number has not been added to the completed page set, the page number is added after verifying the completeness of the page result, or the incomplete page result is deleted and the page is re-recognized.

[0098] After text recognition is completed on all pages, the content processing and result reuse unit sorts the page processing results according to the page number and merges them into OCR results. Pages are saved using a preset page separation method, and the page separation information does not change the text order on the pages. After the OCR result is successfully saved, the OCR processing status is updated to "completed," and the last update time is updated. The document instance record associated with this content processing record is then updated to "result available." If multiple document instances are associated with the same content processing record, all document instances reference the same OCR result, but retain their respective global sort numbers.

[0099] For incomplete content processing records, the processing recovery unit reads the OCR processing status, the set of completed pages, the page processing results, and the last update time. If the OCR processing status is "in progress" but the last update time has not exceeded the task's occupied period, the system considers the original task to still be executing and does not create a second processing task. If the last update time exceeds the task's occupied period, or the OCR processing status is "recoverable failure," the processing recovery unit acquires processing permissions for the content processing record and calculates the incomplete pages based on the set of completed pages. The process of acquiring processing permissions uses the content processing record identifier as an index to prevent multiple recovery tasks from simultaneously taking over the same content processing record.

[0100] The recovery task uses the original content processing record and does not create new content processing records with identical content; the document instance identifier and global sort number associated with the content processing record also remain unchanged. For completed pages, the recovery task directly reads the saved page processing results; for incomplete pages, page conversion and text recognition are re-executed. New page processing results added during the recovery process are continued to be written to the original content processing record. After all pages are completed, a complete OCR result is reconstructed according to the page order, and the original content processing record is updated to the completed state.

[0101] When an instance matches a file corresponding to an incomplete content processing record, the recovery process uses the instance's original global sort number. When a content matching file is associated with the same incomplete content processing record, the new document instance has already obtained its own global sort number in S200. After the shared content processing record is completed, the old and new document instances respectively enter the result-available state. Therefore, the processing resumption is implemented for the content processing task, and the sequence position of the document instance does not change due to the start or completion time of the recovery task.

[0102] When a content processing record contains a conflict where the OCR processing status is "completed" but the OCR result is empty, the associated document instance is not updated to a result-available status. The content processing and result reuse unit checks whether the page processing result is complete; if the page processing result is complete, the OCR results are merged again according to the page sequence number and the content processing record is updated; if the page processing result is incomplete, the OCR processing status is adjusted to a recoverable failure status, and the missing page is entered into the recovery branch as an incomplete page. When the OCR result exists but the OCR processing status is still "processing," the system verifies the set of completed pages and the total number of pages in the file. If they match, the "completed" status is added; otherwise, the missing page continues to be processed.

[0103] After each content processing record completes reuse verification, new content processing, or incomplete processing recovery, the system summarizes the current status according to the document instance identifier, forming a document instance processing status set. The document instance processing status set includes the document instance identifier, global sort number, content processing record identifier, and instance processing status; the instance processing status includes result available status, reused status, processing status, and recoverable failure status. The S400 does not select merging objects based on the completion time of the OCR task, but instead retrieves consecutive result available document instance records based on this status set and the global sort number.

[0104] S400. Based on the document instance processing status set, retrieve consecutive available document instance records from the current merging position according to the global sort number; read the OCR results associated with the document instance records and merge them, and update the ordered merged documents and merge status records:

[0105] The merge range determination unit reads the merge status record of the current medical document processing session after the document instance processing status changes. The merge position in the merge status record indicates the last global sort number that has been stably written into the ordered merged document; when a new medical document processing session is created, the merge position is initialized to 0. The merge version corresponds to the update batch of the ordered merged document, and the merge version increments by one for each consecutive interval of writing. The merge position and merge version are not updated directly upon completion of a single OCR task, but are updated together after writing is completed within a consecutive mergeable interval.

[0106] The retrieval begins with the first global sort number after the merge position. For example, if the current merge position is 5, the merge range determination unit first reads the document instance record corresponding to global sort number 6. If the instance processing status of this instance is either result-available or reused, it is added to the mergeable document instance range, and the unit continues reading the instance record corresponding to global sort number 7. The retrieval process is executed item by item according to consecutive global sort numbers, without skipping intermediate sort positions and directly reading subsequent completed instances.

[0107] When encountering a document instance record whose processing status is "processing" or "recoverable failure," the retrieval stops at that sorting position. Even if multiple document instances after that sorting position have already achieved a usable result status, these subsequent instances are not added to the current mergeable document instance range. For example, if global sorting numbers 6 and 8 have already achieved a usable result status, while global sorting number 7 is still in the "processing" state, the current mergeable document instance range only includes sorting number 6; after sorting number 7 is completed, the next retrieval continues from the unmerged positions before merging position 7, and sorting numbers 7 and 8 are sequentially added to the consecutive range. This process does not use OCR completion time to replace the document instance order.

[0108] If the first document instance after the merge position is in a processing state or a recoverable failure state, the ordered merged document and merge status record will not be updated this time. The continuous interval retrieval will be triggered again after the document instance status is subsequently updated. If a document instance record is missing but the session sorting status indicates that the global sorting number has been assigned, the system records this position as a sequence anomaly and stops reading subsequent instances. The situation where the sorting number allocation transaction is completed but the instance record is not fully committed is handled through S200 transaction rollback; this gap should not occur during normal operation.

[0109] In one implementation, document instances in an unrecoverable failure state are also suspended from subsequent merging and await manual file correction or re-upload. In another implementation, an exception text block can be created for unrecoverable failure states. This exception text block includes the original file name, global sort number, and failure state. After the exception text block is created, the instance processing status of the document instance is adjusted to a result-available state, and it then participates in continuous interval retrieval. This optional processing does not apply to the processing state and the recoverable failure state, both of which still await the completion of the original content processing task.

[0110] After obtaining the range of mergeable document instances, the ordered merging unit reads the document instance records within the range sequentially according to the global sort number. Each document instance record accesses its corresponding content processing record through its content processing record identifier and reads the OCR result therein. When multiple document instances are associated with the same content processing record, the ordered merging unit reads the same OCR result at the sort position of each document instance, while the original file name, batch identifier, and global sort number of the document instances remain independent. The storage location and generation time of the OCR result do not participate in the text block sorting.

[0111] The ordered merging unit forms a document text block for each document instance. The document text blocks are arranged according to the global sort number of the document instance, with the original file name and global sort number recorded at the beginning of the block, followed by the associated OCR result. In one implementation, the document text block also records a batch identifier for subsequent medical document analysis procedures to identify the document's source batch. Document text blocks are separated by a fixed delimiter, which is not included in the OCR text content. Multiple text blocks within the currently mergeable document instance range are sequentially appended to the existing ordered merged document according to their global sort numbers.

[0112] For medical document processing sessions that have not yet generated an ordered merged document, the ordered merge unit creates a new merged document and begins writing from the consecutive available document instance with the smallest global sort number. For sessions that already have an ordered merged document, only the range of mergeable document instances after the current merge position is appended to the existing merged document; instances that have already been merged are not read repeatedly. Before appending, the system checks the merge version in the merge status record against the current version of the ordered merged document; if the two are inconsistent, the appending is paused, the merge position of the previous version is read, and any incomplete writes are checked to avoid appending the same document text block repeatedly.

[0113] After all mergeable document instance ranges are successfully written, the global sort number of the last document instance in the range is recorded as the mergeable position. During the same state update process, the system writes the mergeable position to the merge position in the merge status record and updates the merge version; the merge status of each document instance within the range is updated to the merged state. When the ordered merge document writing fails, the merge position remains unchanged, the document instances within the range are not updated to the merged state, and the next merge continues to be executed from the original merge position.

[0114] The updated ordered merged documents can be read by subsequent medical document analysis programs according to the document text block order. When subsequent uploaded batches enter the same medical document processing session, S200 continues to allocate from the next available sort number in the session sorting status, and S400 continues to retrieve from the current merge position in the merge status record; reused OCR results, newly completed OCR results, and restored completed OCR results are all checked in the same continuous interval through the document instance processing status, forming a document sequence that is continuously updated across batches.

[0115] Example 2: Figure 2 This diagram illustrates a structural block diagram of a medical document content deduplication and sequential merging system according to an embodiment of the present invention. Figure 2 As shown, the structure may include:

[0116] The file identity determination module 01 is used to obtain the medical document files, batch order, and original file names in the medical document processing session, calculate the file size in bytes, and calculate the file content hash value; retrieve document instance records using the original file name, file size in bytes, and file content hash value, and if no match is found, retrieve content processing records using the same file size in bytes and file content hash value, generating a file identity determination result; the file identity determination module is connected to the medical document upload interface and the system's persistent storage area. After an upload request is established, the medical document upload interface provides the file identity determination module with a session identifier, batch identifier, a list of medical document files, and the file's position within the file list, where the position serves as the batch order. The file identity determination module receives the complete file byte stream according to the file list and reads the original file name from the upload metadata; the actual number of bytes received by the server is used as the file size in bytes, and the file content hash value is calculated based on the complete file byte stream, without including the original file name, upload path, and upload time in the hash input.

[0117] The file identity verification module first checks the file reception status. If a medical document file is not fully received, the actual number of bytes received does not match the file length recorded in the upload request, or the file byte stream cannot be read, the file identity verification module pauses the file's identity retrieval, retains its session identifier, batch identifier, original file name, and batch order, and establishes a reception anomaly status. After the file is fully received again, the file byte size and file content hash value are recalculated. If an anomaly occurs in the hash calculation, the generated intermediate hash results are not used to retrieve document instance records and content processing records to prevent incorrect matching between incomplete file characteristics and historical records.

[0118] When the file characteristics are complete, the file identity determination module uses the session identifier as the search scope and queries document instance records using the original file name, file size in bytes, and file content hash value as joint search conditions. If all three conditions are consistent, the file identity determination module assigns the current medical document file to the instance matching branch and reads the document instance identifier, content processing record identifier, global sort number, and instance processing status from the matched document instance record. If the instance processing status indicates that the original content processing is not yet complete, the file identity determination result retains this incomplete status for the subsequent processing recovery module to locate the original processing task.

[0119] When no matching document instance record is found, the file identity determination module uses the file size in bytes and the hash value of the file content to retrieve the content processing record. This retrieval does not use the original file name; if the file name changes but the file byte content remains the same, the current file enters the content matching branch. If neither the document instance record nor the content processing record is matched, the current file enters the content not matched branch. The file identity determination result includes the branch to which the file belongs, its order within the batch, and the identifier of the matched document instance or content processing record. The file identity determination module transmits this result to the document instance management module, which then establishes or continues the record relationship based on different branches.

[0120] The document instance management module 02, connected to the file identity determination module, is used to retain matching document instance records based on the file identity determination results; create new document instance records associated with content processing records for files that only match content processing records; and create mutually associated new document instance records and new content processing records for files that do not match, generating document instance association results. After receiving the file identity determination results, the document instance management module first reads the branch to which the file belongs, and then selects the corresponding record operation. A document instance record represents a submission position of a medical document file in a specific medical document processing session and upload batch. A content processing record represents a processing object determined by the file's byte content and carries the optical character recognition processing status, progress, and recognition result. The two types of records are associated through a content processing record identifier.

[0121] For instance-matched files, the document instance management module reads the document instance identifier from the file identity determination result, retains the existing document instance record and its content processing record identifier, and does not create a second document instance record. The global sort number and batch relationship in the original document instance record remain unchanged. When the content processing record associated with the document instance is in an incomplete state, the document instance management module retains the original content processing record identifier and the original instance processing status in the document instance association result, and the processing recovery module continues the original task accordingly.

[0122] For files that only match content processing records, the document instance management module creates a new document instance record, recording the current session identifier, batch identifier, original file name, and order within the batch. It also writes the content processing record identifier from the file identity determination result into the new document instance record. The new document instance record does not copy historical document instance records, nor does it copy the recognized text from the content processing record; subsequent modules read the original recognition result using the content processing record identifier. Multiple document instance records are thus associated with the same content processing record, and each document instance retains its own upload batch and sequence position.

[0123] For files where neither the document instance record nor the content processing record matches, the document instance management module first creates a new content processing record, recording the file size in bytes, the file content hash value, and the pending status in the new content processing record. Then, it creates a new document instance record and writes the new content processing record identifier into it. If the creation of a new content processing record fails, the corresponding new document instance record is not committed; if writing a new document instance record fails, the new content processing record is rolled back along with the current record transaction to avoid creating pending records without document instance references. The document instance association result includes the document instance records to be reused, the newly created document instance records, the content processing record identifiers corresponding to each document instance, and their batch order, and is sent to the global sorting management module.

[0124] The global sorting management module 03, connected to the document instance management module, is used to assign incremental global sorting numbers to new document instance records according to the batch order based on the document instance association results, generating an ordered set of document instance records. The global sorting management module filters newly created document instance records from the document instance association results; files using existing document instance records are not included in this sorting number allocation. The scope of the global sorting number is limited to the same medical document processing session. The global sorting management module reads the sorting status of the session and obtains the next available sorting number.

[0125] When the current upload batch contains multiple new document instance records, the global sorting management module arranges these records according to their batch order and reserves a continuous range of global sorting numbers within a single record transaction. The length of this continuous range is the same as the number of new document instance records, and the global sorting numbers within the range are written sequentially to the corresponding new document instance records according to their batch order. New document instances created only by matching content processing records and document instances corresponding to newly created content processing records use the same allocation rule; whether a file reuses historical identification results does not change its sequence position in the current upload batch.

[0126] After the global sort number is written, the global sorting management module updates the end sort number of the allocated interval to the sorting status of the medical document processing session. The sorting status update and the writing of the sort numbers for each new document instance record are on the same transaction boundary; if any document instance record writing fails, both the reserved interval and the sorting status update are revoked. When multiple upload batches enter the same medical document processing session in parallel, the global sorting management module performs an exclusive update to the sorting status, ensuring that different batches obtain non-overlapping sorting intervals. After sorting is complete, the global sorting management module organizes the document instance records according to the global sort number, forming an ordered document instance record set, and transmits the ordered document instance record set to the content processing module.

[0127] Content processing module 04, connected to the global sorting management module, is used to reuse the OCR results from completed content processing records based on the ordered document instance record set, perform OCR processing on the new content processing record, and save the OCR processing progress and OCR results to generate content processing results; wherein, OCR stands for Optical Character Recognition. The content processing module reads the content processing record identifiers from the ordered document instance record set and merges document instances according to the content processing record identifiers to prevent duplicate OCR processing tasks when multiple document instances are associated with the same content processing record.

[0128] When a content processing record is in a completed state, the content processing module reads the OCR result and processing configuration version from it. If the OCR result is not empty and the historical processing configuration version is consistent with the current processing configuration version, the content processing module updates the instance processing status of the associated document instance to a reused state and retains the content processing record identifier in the content processing result. If the processing configuration version is inconsistent or the OCR result is empty, the content processing module does not directly provide the historical OCR result; the system creates a new content processing record for the current processing configuration, and the document instance is associated with this new content processing record before entering the OCR processing branch. The original content processing record remains associated with the document instance using the original processing configuration.

[0129] After a new content processing record enters the OCR processing branch, the content processing module updates its OCR processing status to "processing" and performs page processing according to the medical document file type. PDF format medical document files are converted into multiple page images according to their original page order, while image format medical document files are processed as single-page objects. The content processing module maintains a correlation between page numbers and page images, performing text recognition page by page. Upon completion of each page, the page processing result and page number are saved to the corresponding content processing record, and the completed page set is updated. If saving a page processing result fails, that page is not added to the completed page set, and subsequent processing re-executes the page based on its page number.

[0130] After all pages have been processed, the content processing module arranges the page processing results according to the page number and forms a complete OCR result. Once the OCR result is successfully saved, the OCR processing status of the content processing record is updated to "completed"; the document instance associated with that content processing record is updated to "result available". If page conversion fails, page recognition is interrupted, or OCR result saving is incomplete, the content processing module retains the set of completed pages and the corresponding page processing results, keeping the content processing record in a "processing" state or adjusting it to a "recoverable failure" state. The content processing result includes a content processing record identifier, completed OCR result, incomplete processing status, and saved OCR processing progress, and is read by the processing recovery module.

[0131] The processing and recovery module 05, connected to the content processing module, is used to continue performing incomplete OCR processing on incomplete content processing records based on the content processing results, using the original document instance record and the original global sort number, to generate a document instance processing status set. The processing and recovery module filters content processing records in the processing results that are in a processing state or a recoverable failure state, and reads the completed page set, page processing results, and most recent update time from the content processing records. When the most recent update time corresponding to the processing state is still within the task execution cycle, the processing and recovery module does not create a parallel recovery task; when the most recent update time exceeds the task execution cycle or the content processing record is in a recoverable failure state, the processing and recovery module obtains processing permissions for that content processing record.

[0132] After obtaining processing permissions, the processing recovery module determines the incomplete pages based on the total number of pages in the file and the set of completed pages. Completed pages retain their original processing results, while incomplete pages re-enter the page conversion and text recognition process. During the recovery process, the original content processing record identifier continues to be used, and the document instance record and global sort number associated with the content processing record remain unchanged. When multiple document instances are associated with the same incomplete content processing record, only one OCR processing task corresponding to that content processing record is recovered; after the task is completed, the multiple document instances respectively obtain a result availability status.

[0133] When the content processing record shows a completed status but the OCR result is empty, the processing recovery module checks the page processing results and the set of completed pages. If all page processing results are complete, the OCR results are recombined according to the page sequence number, and the completed status is added. If there are missing pages, the missing pages are classified as incomplete pages, and the content processing record is adjusted to a recoverable failure status before processing continues. If the OCR result exists but the status is still in the processing stage, the processing recovery module checks the number of completed pages against the total number of pages in the file. If they match, the status is updated; if they do not match, the completed page results are retained, and the missing pages are processed.

[0134] After recovery, the processing recovery module summarizes the content processing status according to the document instance identifier, classifying the associated document instances into a result-available state, a reused state, a processing state, or a recoverable failure state, forming a document instance processing status set. This document instance processing status set retains the global sort number and content processing record identifier of each document instance and transmits it to the merging scope determination module. Abnormal states of incomplete tasks do not change the global sort number, nor do they prematurely mark subsequently completed document instances as mergeable.

[0135] The merge range determination module 06, connected to the processing recovery module, is used to retrieve consecutive available document instance records based on the document instance processing status set, starting from the current merge position in the merge status record and according to the global sort number, to generate a mergeable document instance range. The merge range determination module reads the merge status record of the current medical document processing session after a change in the document instance processing status. The current merge position in the merge status record represents the last global sort number of the ordered merged document; medical document processing sessions that have not yet performed a merge use the initial position as the current merge position.

[0136] The retrieval begins with the first global sort number after the current merging position. If the document instance corresponding to this sort number is in a result-available or reused state, the merging range determination module adds this document instance to the current mergeable document instance range and continues reading the next global sort number. When a document instance is encountered with a processing status of "processing" or "recoverable failure," the retrieval terminates at that sorting position. Document instances located after this sorting position, even if they have already obtained OCR results, will not be included in the current mergeable document instance range.

[0137] When the sorting status indicates that a global sort number has been assigned, but the corresponding document instance record is missing, the merge range determination module treats this position as a sequence anomaly and stops searching subsequent records. If there are no consecutive available document instances after the current merge position, no new mergeable document instance interval is formed, and the original merge status record remains unchanged. After continuous searching is completed, the merge range determination module transmits the global sort number of each document instance record within the interval and the last available document instance to the ordered merge module, with the last global sort number serving as the current mergeable position.

[0138] The ordered merging module 07, connected to the merging range determination module, is used to read the OCR results from the content processing records associated with each document instance record based on the mergeable document instance range, merge the OCR results according to the global sort number, and update the ordered merging document and the merging status record. The ordered merging module reads the document instance records within the mergeable document instance range sequentially according to the global sort number and accesses the corresponding content processing record through the content processing record identifier in each document instance record. When multiple document instances are associated with the same content processing record, the ordered merging module obtains the same OCR result according to the global sort number of each document instance; the creation time of the content processing record and the completion time of the OCR task are not used as the merging order.

[0139] After reading the OCR results, the ordered merging module forms corresponding document text blocks for each document instance and writes them sequentially into the ordered merged document according to the global sort number. If an ordered merged document already exists, only the range of mergeable document instances after the current merge position is written; if no ordered merged document exists, the document is created starting from the smallest global sort number in the current range. Before writing, the merge version in the merge status record is checked against the current version of the ordered merged document; if the versions are inconsistent, the current writing is paused, and the remaining unfinished document text blocks are read from the previous valid merge position.

[0140] After all mergeable document instance ranges are successfully written, the ordered merging module updates the current mergeable position to the new current merge position and updates the merged version in the merge status record; document instances within the range are simultaneously updated to the merged state. If an exception occurs during document writing, the current merge position and merged version remain unchanged, and document instances within the range are not updated to the merged state. The next merge will still start from after the original current merge position. The updated merge status record is returned to the merge range determination module. When subsequent document instance states change or a new batch of uploads is completed, the merge range determination module continues to retrieve consecutive results from the available document instance records based on the new current merge position.

Claims

1. A method for deduplicating and resuming the transmission of medical document content and for ordered merging, characterized in that, include: S100: Obtain the medical document file, batch order, and original file name in the medical document processing session; calculate the file byte size and file content hash value; retrieve document instance records using the original file name, file byte size, and file content hash value; if no match is found, retrieve content processing records using the file byte size and file content hash value; generate a file identity determination result. The document instance record includes a document instance identifier, a session identifier, a batch identifier, the original file name, the order within the batch, the global sort number, the content processing record identifier, the instance processing status, and the merge status. The content processing record includes a content processing record identifier, file size in bytes, file content hash value, OCR processing status, OCR processing progress, OCR result, processing configuration version, and last update time; wherein, the OCR processing progress includes the total number of pages in the file, the set of pages completed, and the processing result for each page; The file identity determination result includes: instance matching file, content matching file, or content not matching file; S200. Based on the file identity determination result, the matching document instance record is retained; for files that only match the content processing record, a new document instance record is created that is associated with the content processing record; for files that do not match, new document instance records and new content processing records are created that are mutually associated; an incrementing global sort number is assigned to the new document instance record according to the order within the batch, and an ordered document instance record set is generated. S300. Based on the ordered document instance record set, when the content processing record is in a completed state, the OCR result is not empty, and the processing configuration version in the content processing record is consistent with the processing configuration version of the current medical document processing session, the OCR result in the completed content processing record is reused, OCR processing is performed on the new content processing record, and for the incomplete content processing record, the original content processing record identifier is retained, the document instance record associated with the incomplete content processing record and its global sort number remain unchanged, the incomplete page is determined according to the set of completed pages, the page processing result of the completed page is directly read, the page conversion and text recognition are re-executed for the incomplete page, and after all pages are completed, a complete OCR result is re-formed according to the page sequence number, and a document instance processing status set is generated. The document instance processing status set includes a document instance identifier, a global sort number, a content processing record identifier, and an instance processing status; the instance processing status includes a result available status, a reused status, a processing status, and a recoverable failure status. S400: Based on the document instance processing status set, retrieve consecutive results available document instance records from the current merging position according to the global sort number; read the OCR results associated with the document instance records and merge them, and update the ordered merged documents and merge status records; The current merge position is the last global sort number that has been successfully written into the ordered merged document. When a new medical document processing session is created, the current merge position is initialized to 0. The retrieval is performed item by item according to the consecutive global sort number. When a document instance record is encountered with an instance processing status of "processing" or "recoverable failure", the retrieval stops at that sort position. The results available document instance records include document instance records whose instance processing status is either result available or reused.

2. The method according to claim 1, characterized in that, The generation of the file identity determination result includes: When a document instance record is found that matches the original file name, file size in bytes, and file content hash value, the medical document file is recorded as the instance matching file, and the content processing record and global sort number associated with the document instance record are read. If no matching document instance record is found, but a content processing record is found that matches both the file size in bytes and the file content hash value, the medical document file is recorded as a content matching file. If no matching document instance record or content processing record is found, the medical document file is recorded as a content-unmatched file.

3. The method according to claim 1, characterized in that: The document instance record includes document instance identifier, session identifier, batch identifier, original file name, batch order, global sort number, content processing record identifier, instance processing status, and merge status; The content processing record includes a content processing record identifier, file size in bytes, file content hash value, OCR processing status, OCR processing progress, OCR result, processing configuration version, and last update time; Multiple document instance records are associated with the same content processing record through a content processing record identifier, and the global sort number is recorded in the document instance record.

4. The method according to claim 2, characterized in that, The incrementing global sort number assigned includes: Count the number of new document instance records corresponding to the content-matching files and the content-unmatching files; Read the sorting status of the medical document processing session, and reserve consecutive global sorting numbers in the sorting status that are the same as the number of records of the new document instance; According to the batch order, the consecutive global sort numbers are sequentially written into the new document instance record; Write the last global sort number in the consecutive global sort numbers into the sorting state; The instance matching file uses the global sort number from the matching document instance record.

5. The method according to claim 1, characterized in that, The reused OCR results from the completed content processing records include: Read the OCR processing status, OCR result, and processing configuration version from the content processing record; Compare the current processing configuration version with the processing configuration version in the content processing record; When the OCR processing status is completed, the OCR result is not empty, and the two processing configuration versions are consistent, the new document instance record is associated with the content processing record, and the instance processing status of the new document instance record is updated to the reused status.

6. The method according to claim 5, characterized in that, The process of performing OCR processing on the new content processing record includes: An OCR processing task is created based on the new content processing record, and the OCR processing status is updated to "processing". Perform page conversion and text recognition on the medical document file, and record the set of completed pages and the page processing results; After completing the text recognition of the medical document file, the processing results of each page are merged into an OCR result according to the page order, and the OCR processing status is updated to the completed status.

7. The method according to claim 1, characterized in that, The continued processing of incomplete content records includes: Read the OCR processing status, the set of completed pages, and the last update time from the incomplete content processing record; The incomplete pages are determined based on the set of completed pages; Using the incomplete content processing record and its associated document instance record and global sort number, continue to perform text recognition on the incomplete page; Write the page processing result of the incomplete page into the incomplete content processing record, and update the OCR processing status and the document instance processing status.

8. The method according to claim 1, characterized in that, The continuous search results can be recorded in document instances, including: Starting from the global sort number after the merge position in the merge status record, read the document instance records sequentially; When the instance processing status of the document instance record is in the result available state or the reused state, the document instance record is added to the mergeable document instance range, and the document instance record corresponding to the next global sort number is read. When the instance processing status of the document instance record is in the processing state or the recoverable failure state, reading subsequent document instance records will stop. The global sort number of the last result that can be used as the mergeable position is recorded in the document instance.

9. The method according to claim 8, characterized in that, The updated ordered merged documents and merge status records include: Read the document instance records within the range of mergeable document instances according to the global sort number; The OCR results are read based on the record identifiers in each document instance record; Each OCR result is written into the ordered merged document according to the global sort number; Write the mergeable position into the merge position in the merge status record.

10. A medical document content deduplication and sequential merging system, applied to the method of any one of claims 1 to 9, characterized in that, include: The file identity determination module is used to obtain the medical document file, batch order and original file name in the medical document processing session, calculate the file size in bytes and the file content hash value; retrieve document instance records using the original file name, file size in bytes and file content hash value, and retrieve content processing records using the file size in bytes and file content hash value when no match is found, and generate a file identity determination result. The document instance management module, connected to the file identity determination module, is used to retain the matching document instance record based on the file identity determination result; create a new document instance record associated with the content processing record for files that only match the content processing record; and create a new document instance record and a new content processing record that are mutually associated for files that do not match either, thereby generating a document instance association result. The global sorting management module, connected to the document instance management module, is used to assign an incrementing global sorting number to the new document instance record according to the batch order based on the document instance association result, thereby generating an ordered document instance record set; The content processing module, connected to the global sorting management module, is used to reuse the OCR results in the completed content processing records based on the ordered document instance record set, and to perform OCR processing on the new content processing records and save the OCR processing progress and OCR results to generate content processing results. The processing recovery module, connected to the content processing module, is used to continue performing incomplete OCR processing on incomplete content processing records based on the content processing results, using the original document instance record and the original global sort number, and to generate a document instance processing status set. The merge range determination module, connected to the processing recovery module, is used to retrieve consecutive available document instance records based on the document instance processing status set, starting from the current merge position in the merge status record and according to the global sort number, to generate a mergeable document instance range. The ordered merging module, connected to the merging range determination module, is used to read the OCR results in the content processing records associated with each document instance record based on the mergeable document instance range, merge the OCR results according to the global sort number, and update the ordered merging documents and the merging status record.

Citation Information

Patent Citations

  • Multi-modal document data processing method and system oriented to large language model training

    CN121093293A

  • System and method for digital archival document extraction service using machine learning-based OCR and automatic labeling technology

    KR102888843B1