Laboratory quality management document intelligent generation method and system based on retrieval enhancement

By constructing a vector knowledge base and using a large language model to generate documents, the problems of low efficiency and poor compliance in the compilation of laboratory quality management documents were solved, and efficient and accurate automatic document generation was achieved.

CN120951955APending Publication Date: 2025-11-14WUHAN LISIHONG MEDICAL TECHNOLOGY CO LTD

Patent Information

Application Number
CN202511057560.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In existing technologies, the compilation of laboratory quality management documents is inefficient and prone to errors. The standard clause retrieval and matching are inaccurate, and the integration of laboratory business data is difficult, resulting in the inability to update documents in real time, which affects document quality and compliance.

Method used

By semantically encoding preset standard texts, constructing a vector knowledge base, retrieving related standard clauses based on document topics, extracting structured data from the laboratory's business system, generating text using a large language model, and performing compliance verification through a rule model, quality management documents can be automatically generated within minutes.

Benefits of technology

It enables the automatic generation of laboratory quality management documents within minutes, improving the efficiency and quality of document preparation and ensuring the compliance and accuracy of the documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120951955A_ABST
    Figure CN120951955A_ABST
Patent Text Reader

Abstract

The invention discloses a laboratory quality management document intelligent generation method and system based on retrieval enhancement, and relates to the technical field related to data processing.The method comprises the steps that semantic coding is conducted on a preset standard text, and a vector knowledge base is constructed; retrieving associated standard terms according to the document theme, and extracting structured data from a laboratory business system; embedding the standard terms and the business data into a Prompt template, and calling a preset large language model to generate a text; and performing paragraph splicing and hierarchical control on the generated text, automatically checking compliance by utilizing term consistency of rule model fusion and a numerical value comparison algorithm, and outputting a quality management document. The technical problems that in the prior art, standard term retrieval and matching are not accurate, laboratory business data fusion is difficult, and consequently document compiling efficiency and quality are poor are solved, and the technical effects that minute-level automatic generation of laboratory quality management documents is achieved, and document compiling efficiency, quality and compliance are improved are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, specifically to a method and system for intelligent generation of laboratory quality management documents based on retrieval enhancement. Background Technology

[0002] With increasingly stringent requirements for laboratory quality management, various standards are placing higher demands on the standardization, completeness, and traceability of documents. Current quality management document preparation relies on manual labor, which leads to inefficiency, error-proneness, and difficulties in version management, especially in scenarios with multiple standards running concurrently or frequently updated. Large language model text generation may contain factual errors or inconsistencies with standard clauses, making compliance difficult to guarantee. Furthermore, accurate retrieval and dynamic integration of standard clauses with complex hierarchical structures and technical terminology, coupled with laboratory business data, are challenging, resulting in document generation not being updated in real time and impacting the efficiency and quality of laboratory quality management document generation.

[0003] Therefore, current technologies suffer from inaccurate standard clause retrieval and matching, and difficulties in integrating laboratory business data, resulting in poor document compilation efficiency and quality. Summary of the Invention

[0004] This application provides a search-enhanced intelligent generation method and system for laboratory quality management documents, which solves the technical problems in the prior art, such as inaccurate matching of standard clauses and difficulty in integrating laboratory business data, resulting in poor document compilation efficiency and quality. It achieves the technical effect of realizing minute-level automatic generation of laboratory quality management documents and improving document compilation efficiency, quality and compliance.

[0005] This application provides a retrieval-enhanced intelligent generation method for laboratory quality management documents. The method includes: semantically encoding a preset standard text to construct a vector knowledge base; retrieving associated standard clauses based on the document topic from the vector knowledge base and extracting structured data from the laboratory business system; embedding the standard clauses and business data into a Prompt template and calling a preset large language model to generate text; performing paragraph splicing and hierarchical control on the generated text, and automatically verifying compliance using clause consistency and numerical comparison algorithms fused by rule models, and outputting a quality management document.

[0006] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement further performs the following processing: extracting the full text of clauses from the preset standard text and generating a main semantic vector; identifying obligation keywords in the extracted full text of clauses and generating sub-vectors; establishing an association index between the main semantic vector and the sub-vectors, and constructing the vector knowledge base.

[0007] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement also performs the following processing: according to the preset standard text recognition clause version encoding, a version identifier is generated for the full text of the clause, wherein when the detected clause text change rate exceeds a threshold, re-encoding is triggered, and the change type and previous version ID are recorded in the new vector metadata as the version identifier; based on the version identifier, a version filtering index is set to dynamically limit the retrieval scope and support version semantic traceability.

[0008] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement further performs the following processing: identifying parallel clauses in the full text of the clauses, wherein the parallel clauses are clauses containing parallel requirements; splitting the parallel clauses into independent semantic clauses, encoding and storing the hierarchical relationship of each semantic clause; generating a parent clause vector by the mean of the clause vectors, and mapping the encoded vectors of the semantic clauses to their corresponding parent clause vectors according to the hierarchical relationship to generate the main semantic vector.

[0009] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement also performs the following processing: calculating a query vector based on the topic of the document to be generated; based on the query vector, performing cosine similarity matching according to the vector knowledge base to recall semantically similar standard clauses, and simultaneously extracting structured business data from the laboratory business system and converting it into a predefined format intermediate representation.

[0010] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement also performs the following processing: performing type matching on the topic of the document to be generated; if no preset type is matched, performing natural language intent parsing to extract keywords; encoding a keyword vector set based on the extracted keywords; when a preset matching type exists, calling the pre-encoded vector of the preset matching type; and generating the query vector by fusing the vector mean based on the pre-encoded vector or the keyword vector set.

[0011] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement also performs the following processing: filtering inapplicable clauses by version identifier and adding weight to clauses of the currently valid version; increasing the sorting priority of clauses containing keywords; and excluding irrelevant clauses according to laboratory type tags.

[0012] In a possible implementation, the retrieval-enhanced intelligent generation method for laboratory quality management documents further performs the following processing: constructing a chain-driven prompt template, including a first-round generation of a document key framework, a second-round injection of business data segment by segment according to the framework to generate the main text, and a final-round supplementation of compliance statements for specific clause requirements, wherein fixed columns include purpose, scope, responsibilities, data reference fields, and standard clause reference formats; embedding the retrieved standard clause content and structured business data into the Prompt template slots to construct a complete Prompt including writing instructions, context, and format requirements; and calling a large language model trained by the laboratory to process the content format and context of the input complete Prompt and output the target document text.

[0013] In a possible implementation, the intelligent generation method for laboratory quality management documents based on retrieval enhancement also performs the following processing: splicing paragraphs of the output text according to a document type template, verifying the completeness of chapters and supplementing missing parts; verifying the accuracy of clause citations, terminology consistency, and business data consistency through a dual review model, and outputting the spliced ​​document that meets the verification requirements. The dual review model includes a rule layer and a model layer. The rule layer matches the clause number format and terminology database keywords using regular expressions, and the model layer calls the review model to verify the consistency of clauses and data.

[0014] This application also provides a retrieval-enhanced intelligent generation system for laboratory quality management documents. The system includes: a semantic encoding unit for semantically encoding preset standard text and constructing a vector knowledge base; a structured data extraction unit for retrieving associated standard clauses based on the document topic according to the vector knowledge base and extracting structured data from the laboratory business system; a text generation unit for embedding standard clauses and business data into a Prompt template and calling a preset large language model to generate text; and a quality management document output unit for performing paragraph splicing and hierarchical control on the generated text, and automatically verifying compliance using clause consistency and numerical comparison algorithms fused by rule models, and outputting quality management documents.

[0015] This application proposes a retrieval-enhanced intelligent generation method and system for laboratory quality management documents. The method involves semantically encoding preset standard text to construct a vector knowledge base; retrieving relevant standard clauses based on document topics and extracting structured data from the laboratory's business system; embedding the standard clauses and business data into a Prompt template; generating text by calling a preset large language model; performing paragraph splicing and hierarchical control on the generated text; and automatically verifying compliance using clause consistency and numerical comparison algorithms fused with a rule model, ultimately outputting a quality management document. This addresses the technical problems of inaccurate standard clause retrieval and matching, and difficulties in integrating laboratory business data, which lead to poor document compilation efficiency and quality in existing technologies. It achieves the technical effect of automatically generating laboratory quality management documents within minutes, improving document compilation efficiency, quality, and compliance. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments of this disclosure will be briefly described below. Flowcharts are used in this application to illustrate the operations performed by the system according to the embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from these processes.

[0017] Figure 1 A schematic diagram of the intelligent generation method for laboratory quality management documents based on retrieval enhancement provided in this application embodiment.

[0018] Figure 2 A schematic diagram of the structure of the intelligent generation system for laboratory quality management documents based on retrieval enhancement provided in this application embodiment.

[0019] Figure labeling: Semantic coding unit 10, structured data extraction unit 20, text generation unit 30, quality management document output unit 40. Detailed Implementation

[0020] The above description is merely an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below.

[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description of this application will be provided in conjunction with the accompanying drawings. The described embodiments should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] In the following description, references to "some embodiments" describe a subset of all possible embodiments. However, it is understood that "some embodiments" can be the same or different subsets of all possible embodiments and can be combined with each other without conflict. The terms "first" and "second" are used merely to distinguish similar objects and do not represent a specific ordering of objects. The terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only.

[0023] This application provides an embodiment of a method for intelligently generating laboratory quality management documents based on retrieval enhancement, such as... Figure 1 As shown, the method includes:

[0024] Step S100: Semantically encode the preset standard text to construct a vector knowledge base.

[0025] Step S100 further includes step S110, extracting the full text of the clauses from the preset standard text and generating a main semantic vector; step S120, identifying obligation keywords in the extracted full text of the clauses and generating sub-vectors; and step S130, establishing an association index between the main semantic vector and the sub-vectors to construct the vector knowledge base.

[0026] Preferably, the preset standard text refers to text conforming to the ISO 15189 standard. The complete full text of each clause is extracted from it, including extracting key clauses, requirements, and explanations from each clause. For example, a laboratory should regularly calibrate equipment and retain calibration records. Then, embedded semantic coding models such as BERT and Sentence-BERT are used to encode each clause into a high-dimensional semantic vector representation, generating a main semantic vector to characterize the overall semantics of the clause. Next, obligation keywords are identified from the extracted full text of the clause. This involves using natural language processing algorithms such as dependency parsing and keyword extraction models to identify key obligation requirements from the full text of the clause, typically descriptions of actions or responsibilities. Each obligation keyword is then individually encoded to generate a sub-vector, used to refine the specific obligation requirements in the clause and support more precise retrieval. Finally, using foreign key relationships in the database, the main semantic vector and sub-vectors are linked through hierarchical relationships to establish a mapping relationship between the main semantic vector and sub-vectors, ultimately forming a structured vector database.

[0027] Furthermore, step S110 also includes step S111, generating a version identifier for the full text of the clause according to the preset standard text recognition clause version encoding, wherein when the detected clause text change rate exceeds the threshold, re-encoding is triggered, and the change type and previous version ID are recorded in the new vector metadata as the version identifier; step S112, setting a version filtering index based on the version identifier, which is used to dynamically limit the search scope and support version semantic tracing.

[0028] Preferably, dynamic management of standard clauses is achieved through version coding and change detection, ensuring that the clauses used when the document is generated are always the latest and compliant versions, while also supporting historical traceability. Specifically, the clause version code is identified based on the preset standard text, which may include the standard type, clause number, version number, etc., and a unique version identifier is generated for the entire clause text to quickly locate the clause of a specific version, and a version chain is formed through the previous version ID in the metadata. When the clause text change rate exceeds the threshold (e.g., content modification exceeds 10%), where the change type may include content revision, such as changing the calibration cycle from 12 months to 6 months; new requirements, such as adding calibration that must be performed by a certification body; or deleted entries, such as removing records that need to be archived on paper, this triggers recoding, generating a new version code, and recording the change type and previous version ID in the vector metadata of the new version as a unique version identifier. Finally, based on version identifiers, a version filtering index is set up. This involves attaching a version status tag (e.g., valid or obsolete) to each clause in the vector knowledge base. During retrieval, the search scope is dynamically limited by the version identifier to ensure that only the currently valid version of the clause content is used when generating documents. Simultaneously, version semantic traceability is supported, allowing backtracking using the preceding version ID of the version identifier, combined with change type metadata, to generate a change log and retrieve all historical versions, such as viewing the historical modification records of a specific clause. Through version identifiers and change-aware vector metadata, dynamic management and semantic traceability of standard clauses are achieved, solving the problems of version confusion and delayed updates in traditional document generation.

[0029] Furthermore, step S110 also includes step S113, identifying parallel clauses in the full text of the clause, wherein the parallel clauses are clauses containing parallel requirements; step S114, splitting the parallel clauses into independent semantic clauses, encoding and storing the hierarchical relationship of the semantic clauses respectively; step S115, generating a parent clause vector by the mean of the clause vectors, mapping the encoded vectors of the semantic clauses to their corresponding parent clause vectors according to the hierarchical relationship, and generating the main semantic vector.

[0030] Preferably, for common parallel structures in standard clauses, semantic decomposition and hierarchical encoding are used to achieve a refined vector representation of the clause content. Specifically, natural language processing techniques (such as dependency parsing and conjunction detection) are used to identify parallel clauses in the clauses. Parallel clauses are clauses containing parallel requirements. For example, if the original clause is "Laboratories should periodically calibrate equipment and keep calibration records," the identification result will yield two parallel clauses: clause 1 "regularly calibrate equipment" and clause 2 "keep calibration records." The parallel clauses are then decomposed into independent semantic clauses, and each semantic clause is encoded separately using the BERT model, preserving its core semantics. For example, the vector of clause 1 represents the equipment calibration frequency, and the vector of clause 2 represents the record archiving requirement. Then, the weighted average of all parallel clause vectors is calculated to generate a parent clause vector representing the overall semantics of the clause. The encoded vectors of the semantic clauses are mapped to their corresponding parent clause vectors according to hierarchical relationships. A parent-child association index is established in the vector knowledge base, and finally, the main semantic vector is generated, thereby ensuring accurate retrieval and semantic integrity.

[0031] Step S200: Based on the vector knowledge base, retrieve the associated standard terms according to the document topic, and extract structured data from the laboratory business system.

[0032] Step S200 further includes step S210, calculating a query vector based on the topic of the document to be generated; step S220, based on the query vector, performing cosine similarity matching according to the vector knowledge base, recalling standard clauses with similar semantics, and simultaneously extracting structured business data from the laboratory business system and converting it into a predefined format intermediate representation.

[0033] Preferably, based on a vector knowledge base, standard clauses related to document topics are retrieved, and the document topics are transformed into mathematical vectors to achieve intelligent matching with standard clauses. Laboratory business data is dynamically integrated. Specifically, the topic of the document to be generated is parsed. If the topic matches a preset type, a pre-encoded template vector is directly called. If it is a free description, keywords are extracted using an NLP model. Then, the keywords or topic text are encoded into a query vector through a semantic model to represent the user's true intent. Next, the cosine similarity between the query vector and the clause vectors in the vector knowledge base is calculated, with a value range of [-1, 1]. The closer to 1, the more similar the two are. Then, the clause vector with the highest semantic similarity is recalled, and the standard clause content related to the current document is quickly obtained through a semantic retrieval mechanism. For example, when a user requests the generation of a personnel qualification assessment procedure document, the system retrieves clauses related to personnel training and qualification assessment in ISO 15189 and their content summaries, ensuring that the large model references the latest and most relevant standard basis during the generation process. The retrieved clause content will be injected as contextual information in subsequent prompts, thus making the text generated by the model reliable and reducing unfounded fabrication.

[0034] Preferably, structured data is extracted from laboratory business systems. These systems may include, but are not limited to, testing data from laboratory information systems, statistical results from instrument quality control systems, personnel qualification and training records from human resources systems, and manually entered laboratory record forms. The structured business data from these sources is obtained through predefined data interfaces or ETL processes, and then format conversion and field extraction are performed. That is, it is transformed into an intermediate representation in a predefined format. For example, for internal quality control records, the system extracts the daily quality control results of each testing item over a period of time from the quality control database, such as mean, standard deviation, and bias, to form structured data objects.

[0035] Furthermore, step S210 also includes step S211, performing type matching on the topic of the document to be generated; if no matching preset type is found, performing natural language intent parsing to extract keywords; step S212, encoding a keyword vector set based on the extracted keywords; step S213, when a preset matching type exists, calling the pre-encoded vector of the preset matching type; step S214, generating the query vector by fusing the vector mean based on the pre-encoded vector or the keyword vector set.

[0036] Preferably, by intelligently analyzing document topics, high-quality query vectors are automatically generated for accurate retrieval of standard clauses in the vector knowledge base. The optimal vector generation strategy is selected based on the different forms of the input topic, such as structured types or free text. The preset types include three categories: quality manuals, program documents, and record reports. Specifically, the topic of the document to be generated is matched against the preset types. When a perfect match is found, the pre-encoded vector for that type is directly invoked. When no match is found, natural language intent parsing is performed to extract keywords, including using dependency parsing to identify core verb-object structures, filtering stop words and retaining technical terms, and standardizing synonyms (such as quality control standardization). (For quality control); then, based on the extracted keyword encoding keyword vector set, core terms are embedded using the domain-specific embedding model BioBERT, while common words are embedded using a general embedding model; when a preset matching type exists, the pre-encoded vector of the preset matching type is called, where the pre-encoded vector is generated by clustering historical queries, for example, collecting 1000+ queries of the same type, encoding them, and then calculating the centroid vector as the pre-encoded vector; finally, the average value of the vectors is fused based on the pre-encoded vector or the keyword vector set, that is, the average value is calculated to generate a comprehensive query vector. The final generated query vector retains semantic integrity and highlights the key points of the query, thus effectively realizing the intelligent conversion from fuzzy requirements to precise queries.

[0037] Furthermore, step S200 also includes step S230, filtering inapplicable clauses by version identifier and increasing the weight of currently valid version clauses; step S240, increasing the ranking priority of clauses containing keywords; and step S250, excluding irrelevant clauses according to laboratory type labels.

[0038] Preferably, historically obsolete or expired clauses are automatically excluded using version identifiers, while currently valid clauses are given increased weight, such as a similarity score multiplier of 1.2, ensuring priority is given to recalling the latest compliant content. Then, clauses containing user query keywords are given higher ranking priority, using TF-IDF or BM25 algorithms to quantify keyword importance and adjust the final similarity score; for example, clauses containing both equipment and calibration are ranked higher than those containing only equipment. Finally, irrelevant clauses are excluded based on laboratory type labels. This involves establishing clause association rules based on laboratory labels, such as biochemistry, environmental, and pharmaceutical GMP, and automatically excluding obviously irrelevant clauses during retrieval. For example, pharmaceutical GMP clauses are not returned to environmental laboratories, thereby improving retrieval accuracy and efficiency, and ensuring that the retrieved results simultaneously meet the requirements of timeliness, relevance, and professionalism.

[0039] Step S300: Embed the standard terms and business data into the Prompt template and call the preset large language model to generate text.

[0040] Step S300 further includes step S310, constructing a chain-linked prompt template, including the first round of generating a document key framework, the second round of injecting business data segment by segment according to the framework to generate the main text, and the final round of supplementing compliance statements for specific clause requirements. The fixed columns include purpose, scope, responsibilities, data reference fields, and standard clause reference format. Step S320, embedding the retrieved standard clause content and structured business data into the Prompt template slots to construct a complete Prompt including writing instructions, context, and format requirements. Step S330, calling a large language model trained in the laboratory to process the content format and context of the input complete Prompt and output the target document text.

[0041] Preferably, a chain-like prompt template is constructed, including the first round of generating a document's key points framework, the second round of injecting business data segment by segment according to the framework to generate the main text, and the final round of supplementing compliance statements for specific clause requirements. That is, the model first lists the key points that the document should include, and then the main text is written segment by segment based on this. The multi-stage prompt, together with the background scheduling control, forms a model call chain, which can reduce the cognitive load of generating a long document at once, improve the completeness and logic of the generated content, and all prompt templates are verified in the design and testing phases to ensure that the generated results meet the expected format and tone. The Prompt template acts as a script guiding the creation of the large model. Combining instructions, context, and output format examples, it ensures the model produces content according to the expected style and structure. For program documents, the template includes fixed sections such as the purpose, scope, responsibilities, process, data reference fields, and standard clause reference formats. For record and report documents, the template emphasizes result descriptions, exception explanations, conclusions, and improvement measures. Specifically, it employs a fill-in-the-blank template approach and chain-like prompts, embedding the acquired standard clause context and structured business data into predefined locations, supplemented by clear instructions to guide model writing. The Prompt template clearly defines the structural key points and tone requirements of the output document and provides rich contextual information. This allows the large language model to, during generation, both refer to the standard reference section to ensure adherence to ISO 15189 requirements and utilize specific data for analysis and explanation, thereby producing well-reasoned and supported content.

[0042] Preferably, a pre-defined Prompt template slot includes standard clause slots and business data slots. The standard clause slots are used to embed the latest retrieved regulatory texts, while the business data slots are used to fill in experimental data for structured transformation. The retrieved standard clause content and structured business data are then embedded into the Prompt template slots to construct a complete Prompt including writing instructions, context, and formatting requirements. A large language model trained in the laboratory is invoked. The training corpus includes: ISO 15189 standard clauses and explanatory texts, examples of chapters in the laboratory quality manual, and sample texts of various procedural documents and record forms. The laboratory corpus is cleaned and organized, and converted into question-answer pairs or instruction-response formats that the model can learn. For example, using drafting a document as an instruction and referencing sample text as the expected output, the model learns how to generate standardized text from instructions and context. To improve fine-tuning efficiency and reduce the risk of model overfitting, the LoRA (Local Area Restriction and Adjustment) parameter-efficient fine-tuning technique is used to inject medical laboratory-specific expressions and terminology preferences while maintaining the model's general knowledge. The finely tuned large language model significantly improves its ability to understand and generate medical laboratory scenarios, enabling it to use accurate technical terminology and adhere to formal text.

[0043] Preferably, the final step involves processing the complete input Prompt for content formatting and contextual understanding. Specifically, the system and model use a unified interface protocol for input and output formats. The input is encapsulated in a JSON structure, including task type identifiers; contextual content, such as retrieved clause text fragments; business data, such as structured field values; and generation parameters, such as the required document language and length. After receiving the input, the large language model returns the generated text according to the Prompt requirements. The output is in UTF-8 encoded plain text or Markdown format. During the model generation process, the model output is guided to be divided into predetermined paragraphs by controlling the content order and markings in the context window, such as using special delimiters between different parts. Finally, the target document text is generated, and the returned data structure is parsed, such as removing unnecessary auxiliary markings and retaining only the main text content. In addition, the model output format follows a predefined document template, such as program files starting with subheadings like "Purpose, Scope...", and record reports starting with the date and title. Through fine-tuning technology, the finely tuned large language model, combined with a rigorously designed input and output format, enables out-of-the-box document generation capabilities, with the output content being highly consistent with manually written documents in terms of style and layout.

[0044] Step S400: Perform paragraph splicing and hierarchical control on the generated text, and automatically verify compliance using the clause consistency and numerical comparison algorithm fused by the rule model, and output quality management documents.

[0045] Step S400 further includes step S410, which involves splicing paragraphs into the output text according to the document type template, verifying the integrity of the chapters and supplementing any missing parts; step S420, which involves verifying the accuracy of clause citations, the consistency of terminology, and the consistency of business data through a dual review model, and outputting the spliced ​​document that meets the verification requirements. The dual review model includes a rule layer and a model layer. The rule layer matches the clause number format and terminology keywords using regular expressions, and the model layer calls the review model to verify the consistency of clauses and data.

[0046] Preferably, based on a predefined template for the document type, the generated text is intelligently sorted and paragraphs are concatenated according to standard chapters. A chapter title matching algorithm automatically identifies missing parts, triggering a large language model to supplement the generation. A dual-review model verifies the accuracy of clause citations, terminology consistency, and business data consistency. This dual-review model includes a rule layer and a model layer. The rule layer uses regular expressions to match clause number formats and terminology keywords. The model layer calls the review model to verify clause and data consistency. Specifically, it strictly matches standard number formats using regular expressions to block ambiguous expressions; it compares with the organization's terminology database and automatically replaces inconsistent expressions; and it verifies numerical ranges based on the rule base, such as requiring a culture temperature of 37±1℃. Verification issues are categorized into blocking errors and suggested modifications. The former must be corrected before output; simple issues are directly replaced, while complex issues are marked and submitted for manual review. The final output document includes a review log, recording all automatically corrected items and their basis. This dual-review process reduces the error rate of quality management document generation to below 1%, improving document preparation efficiency and quality, and ensuring that each output document simultaneously meets format specifications, terminology standards, and data authenticity requirements.

[0047] Preferably, a document paragraph splicing and structure control module is set up to perform paragraph splicing and hierarchical control on the generated text, so as to ensure that the generated content is assembled into a complete document. That is, according to the document type template, the text generated by the large language model is integrated and adjusted at the paragraph level to ensure that the chapter structure and layout format of the final document are correct. Specifically, for documents generated using a single Prompt template, the large language model outputs all paragraphs and verifies them according to the established structure template. For example, it compares whether the model output contains all the necessary sections. For example, the quality manual chapters need to cover organizational structure, personnel, equipment, process control, etc. If a missing section is found, the completion process is triggered, and the missing parts are supplemented by adding a Prompt query to the model. For multi-step document generation, the content of each part is obtained separately and then assembled in a predetermined order. For example, four paragraphs are determined in sequence: general overview, data analysis, anomaly analysis, and conclusion. These paragraphs are then merged into a complete document according to a template order, with necessary headings or numbering inserted. During the assembly process, special attention is paid to coherence; if adjacent paragraphs have content connections, transition words and contextual consistency are checked, and minor adjustments are made to sentences or the large language model is used for secondary polishing if necessary. Furthermore, the structural control logic also covers formatting specifications, such as numbering styles and font requirements. For example, it ensures that citations are presented in the prescribed format and that tables and charts are inserted correctly. Through paragraph assembly and hierarchical control, text fragments generated by the large language model can be combined into a complete document that conforms to the preset document specification framework. This modular control method improves the reliability of generating long documents, ensuring that each output document is clearly structured and complete in its elements.

[0048] Preferably, compliance is automatically verified using a rule-based model that integrates clause consistency and numerical comparison algorithms. Specifically, a rule model integrating clause consistency and numerical comparison algorithms is configured to verify the generated documents in terms of the accuracy of clause citations, consistency of professional terminology, and version standardization. This ensures that the generated quality management documents fully comply with ISO 15189 standards and laboratory quality system requirements. Specifically, the text generated by the large language model is scanned to identify the standard clause numbers or content cited, and compared with previously retrieved knowledge base content to prevent irrelevant citations from the large language model. If citation errors or inaccuracies are found, they can be automatically replaced with correct clauses or marked for manual review. A terminology database and abbreviation table for medical laboratory quality management are set up, covering common professional terms. The generated text is checked to ensure that the use of professional terms is consistent with the terminology database. For example, "quality control product" should be used instead of the common term "reference product," and "precision" should be used instead of "repeatability" to conform to the standard definition. If deviations are found, term replacements are performed or the model is prompted to restate the terminology. In addition, for abbreviations appearing for the first time, the rule model is required to automatically supplement complete definitions. The ISO 15189 standard is updated periodically. Version attributes of clauses are noted in the knowledge base, and the standard version used must be explicitly stated when generating documents. The rule model checks whether the standard-related parts of the output content are marked with their version and are consistent with the currently used version. If the laboratory's internal documents have their own version number or controlled status, version information is inserted or updated, such as the version number in the document header and controlled status markings, automatically populated or updated according to the latest database. Simultaneously, the version control module records the standard and data versions used for each document generation to facilitate future traceability and auditing. Furthermore, the rule model uses regular expressions to match the clause format and validate the output text format, ensuring that headers, footers, signature fields, etc., meet the laboratory's document control requirements. This ensures that every document output by the system undergoes multiple checks to minimize errors, ultimately generating quality management documents that strictly comply with the requirements of the ISO 15189 standard and the laboratory's internal specifications in both content and form.

[0049] In the above text, refer to Figure 1 This paper describes in detail a method for intelligent generation of laboratory quality management documents based on retrieval enhancement according to embodiments of the present invention. Next, reference will be made to... Figure 2 This invention describes a search-enhanced intelligent generation system for laboratory quality management documents.

[0050] The intelligent generation system for laboratory quality management documents based on retrieval enhancement according to embodiments of the present invention addresses the technical problems in the prior art, such as inaccurate matching of standard clauses and difficulties in integrating laboratory business data, leading to poor document compilation efficiency and quality. It achieves the technical effect of automatically generating laboratory quality management documents within minutes, improving document compilation efficiency, quality, and compliance. Figure 2 As shown, the intelligent generation system for laboratory quality management documents based on retrieval enhancement includes: a semantic encoding unit 10, a structured data extraction unit 20, a text generation unit 30, and a quality management document output unit 40.

[0051] Semantic encoding unit 10 is used to semantically encode preset standard text and construct a vector knowledge base; structured data extraction unit 20 is used to retrieve associated standard clauses based on the document topic according to the vector knowledge base and extract structured data from the laboratory business system; text generation unit 30 is used to embed standard clauses and business data into a Prompt template and call a preset large language model to generate text; quality management document output unit 40 is used to perform paragraph splicing and hierarchical control on the generated text, and automatically verify compliance using clause consistency and numerical comparison algorithms fused by rule model, and output quality management documents.

[0052] The specific configuration of the semantic encoding unit 10 will be described in detail below. The semantic encoding unit 10 further includes: extracting the full text of the clauses from the preset standard text and generating a main semantic vector; identifying obligation keywords in the extracted full text of the clauses and generating sub-vectors; establishing an association index between the main semantic vector and the sub-vectors, and constructing the vector knowledge base.

[0053] The specific configuration of the semantic encoding unit 10 will be described in detail below. The semantic encoding unit 10 further includes: identifying the version encoding of the clause according to the preset standard text, generating a version identifier for the full text of the clause, wherein when the detected clause text change rate exceeds a threshold, re-encoding is triggered, and the change type and the previous version ID are recorded in the new vector metadata as the version identifier; based on the version identifier, a version filtering index is set to dynamically limit the search scope and support version semantic tracing.

[0054] The specific configuration of the semantic encoding unit 10 will be described in detail below. The semantic encoding unit 10 further includes: identifying parallel clauses in the full text of the clause, wherein the parallel clauses are clause content containing parallel requirements; splitting the parallel clauses into independent semantic clauses, encoding and storing the hierarchical relationship of the semantic clauses respectively; generating a parent clause vector by the mean of the clause vectors, and mapping the encoded vectors of the semantic clauses to their corresponding parent clause vectors according to the hierarchical relationship to generate the main semantic vector.

[0055] The specific configuration of the structured data extraction unit 20 will be described in detail below. The structured data extraction unit 20 further includes: calculating a query vector based on the topic of the document to be generated; performing cosine similarity matching based on the query vector and the vector knowledge base to recall semantically similar standard terms, while extracting structured business data from the laboratory business system and converting it into a predefined intermediate representation.

[0056] The specific configuration of the structured data extraction unit 20 will be described in detail below. The structured data extraction unit 20 further includes: performing type matching on the topic of the document to be generated; if no preset type is matched, performing natural language intent parsing to extract keywords; encoding a keyword vector set based on the extracted keywords; when a preset matching type exists, calling the pre-encoded vector of the preset matching type; and generating the query vector by fusing the vector mean based on the pre-encoded vector or the keyword vector set.

[0057] The specific configuration of the structured data extraction unit 20 will be described in detail below. The structured data extraction unit 20 further includes: filtering inapplicable clauses by version identifier and adding weight to currently valid clauses; increasing the ranking priority of clauses containing keywords; and excluding irrelevant clauses according to laboratory type labels.

[0058] The specific configuration of the text generation unit 30 will be described in detail below. The text generation unit 30 further includes: constructing a chained prompt template, including a first-round generation of a document key framework, a second-round injection of business data segment by segment according to the framework to generate the main text, and a final round supplementing compliance statements for specific clause requirements. Fixed columns include purpose, scope, responsibilities, data reference fields, and standard clause reference formats. The retrieved standard clause content and structured business data are embedded into the Prompt template slots to construct a complete Prompt including writing instructions, context, and formatting requirements. A large language model, trained in the laboratory, is invoked to process the input complete Prompt for content formatting and contextual understanding, outputting the target document text.

[0059] The specific configuration of the quality management document output unit 40 will be described in detail below. The quality management document output unit 40 further includes: splicing paragraphs of the output text according to a document type template, verifying the completeness of chapters and supplementing missing parts; verifying the accuracy of clause citations, terminology consistency, and business data consistency through a dual review model, and outputting the spliced ​​document that meets the verification requirements. The dual review model includes a rule layer and a model layer. The rule layer matches clause number formats and terminology keywords using regular expressions, and the model layer calls the review model to verify clause and data consistency.

[0060] The intelligent generation system for laboratory quality management documents based on retrieval enhancement provided in this embodiment of the invention can execute the intelligent generation method for laboratory quality management documents based on retrieval enhancement provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0061] Although this application makes various references to certain modules in the system according to the embodiments of this application, any number of different modules can be used and run on user terminals and / or servers. The various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy distinction between each other and are not used to limit the scope of protection of this invention.

[0062] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for intelligent generation of laboratory quality management documents based on retrieval enhancement, characterized in that: include: Semantic encoding is performed on preset standard text to construct a vector knowledge base; Based on the vector knowledge base, relevant standard clauses are retrieved according to document topics, and structured data is extracted from the laboratory business system; Embed standard terms and business data into the Prompt template, and call the preset large language model to generate text; The generated text is subjected to paragraph splicing and hierarchical control, and compliance is automatically verified by using clause consistency and numerical comparison algorithms fused by rule model, and quality management documents are output.

2. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 1, characterized in that, Semantic encoding is performed on predefined standard text to construct a vector knowledge base, including: Extract the full text of the clauses from the preset standard text and generate the main semantic vector; Identify the obligatory keywords from the extracted full text of the clauses and generate sub-vectors; Establish an association index between the main semantic vector and the sub-vectors, and construct the vector knowledge base.

3. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 2, characterized in that, Extract the full text of the clauses from the preset standard text and generate the main semantic vector, including: According to the preset standard text recognition clause version encoding, a version identifier is generated for the full text of the clause. When the detected clause text change rate exceeds the threshold, re-encoding is triggered, and the change type and the previous version ID are recorded in the new vector metadata as the version identifier. Based on the version identifier, a version filtering index is set to dynamically limit the search scope and support version semantic tracing.

4. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 2, characterized in that, The generation of the main semantic vector also includes: Identify parallel clauses in the full text of the terms, where parallel clauses are clause content containing parallel requirements; The parallel clauses are split into independent semantic clauses, and the hierarchical relationships of the semantic clauses are encoded and stored separately. The parent clause vector is generated by averaging the clause vectors, and the encoded vectors of the semantic clauses are mapped to their corresponding parent clause vectors according to the hierarchical relationship to generate the main semantic vector.

5. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 4, characterized in that, Based on the vector knowledge base, relevant standard clauses are retrieved according to document topics, and structured data is extracted from the laboratory business system, including: Calculate the query vector based on the topic of the document to be generated; Based on the query vector, cosine similarity matching is performed according to the vector knowledge base to recall semantically similar standard terms. At the same time, structured business data is extracted from the laboratory business system and transformed into a predefined intermediate representation.

6. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 5, characterized in that, Calculate the query vector based on the topic of the document to be generated, including: The document to be generated is type-matched to the subject. If no preset type is matched, natural language intent parsing is performed to extract keywords. Based on the extracted keyword encoding keyword vector set; If a preset matching type exists, the pre-encoded vector of the preset matching type is invoked; The query vector is generated by fusing the mean of the vectors from the pre-encoded vector or keyword vector set.

7. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 3, characterized in that, Based on the vector knowledge base, relevant standard terms are retrieved according to document topic, including: Filter out inapplicable terms by version identifiers and increase the weight of terms in the currently valid version; Increase the sorting priority for clauses containing keywords; Irrelevant clauses are excluded based on the laboratory type label.

8. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 1, characterized in that, The step of embedding standard terms and business data into a Prompt template and calling a preset large language model to generate text includes: Construct a chain-linked prompt template, including the first round of generating a document key framework, the second round of injecting business data segment by segment according to the framework to generate the main text, and the final round of supplementing compliance statements for specific clause requirements. The fixed columns include purpose, scope, responsibilities, data reference fields and standard clause reference format. The retrieved standard clauses and structured business data are embedded into the Prompt template slots to build a complete Prompt that includes writing instructions, context, and formatting requirements. The system invokes a large language model that has been pre-trained in the lab to process the complete input Prompt for content formatting and contextual understanding, and outputs the target document text.

9. The intelligent generation method for laboratory quality management documents based on retrieval enhancement according to claim 1, characterized in that, The generated text undergoes paragraph splicing and hierarchical control, and compliance is automatically verified using rule-based model-integrated clause consistency and numerical comparison algorithms. The resulting quality management documents include: The output text is concatenated into paragraphs according to the document type template, and the completeness of the chapters is verified and missing parts are added. The accuracy of clause citations, terminology consistency, and business data consistency are verified through a dual review model. The concatenated document that meets the verification requirements is then output. The dual review model includes a rule layer and a model layer. The rule layer uses regular expressions to match the clause number format and terminology keywords. The model layer calls the review model to verify the consistency of clauses and data.

10. A retrieval-enhanced intelligent document generation system for laboratory quality management, characterized in that: The system is used to implement the intelligent generation method for laboratory quality management documents based on retrieval enhancement as described in any one of claims 1 to 9, and the system comprises: Semantic encoding units are used to semantically encode preset standard text and construct a vector knowledge base; The structured data extraction unit is used to retrieve associated standard clauses based on the document topic according to the vector knowledge base, and extract structured data from the laboratory business system. The text generation unit is used to embed standard terms and business data into the Prompt template and call the preset large language model to generate text; The quality management document output unit is used to perform paragraph splicing and hierarchical control on the generated text, and automatically verify compliance using clause consistency and numerical comparison algorithms fused by rule model, and output quality management documents.

Citation Information

Patent Citations

  • Medical AI assistant implementation method and system based on data driving and large model

    CN118098585A

  • Retrieval enhancement generation method based on multistage semantics

    CN120011535A

  • Bidding document generation method based on retrieval enhancement generation and large language model

    CN120297242A

  • Pathology laboratory ISO15189 intelligent face-to-face inspection auxiliary system based on knowledge graph

    CN120376082A

Cited By

  • Water conservancy inspection retrieval execution method and system based on LoRA fine tuning

    CN121350230A

  • Hydrogen storage product document generation system and method

    CN121580986A

  • Document checking method and device

    CN121597821A

  • Language model enhancement-based patent text search metering method, system and equipment

    CN121636721A

  • Patent text search and measurement method, system and device based on language model enhancement

    CN121636721B