Nursing record processing method and system based on large language model

By adopting a nursing record processing method based on a large language model, the problems of low processing efficiency and low accuracy caused by the diversity of nursing record document formats are solved. It realizes automated processing and structured coding of multi-format documents, ensuring the standardization and accuracy of nursing records.

CN121636768APending Publication Date: 2026-03-10GENERAL HOSPITAL OF PLA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Nursing records are in the form of unstructured text, resulting in diverse data formats, difficulty in uniform processing, low efficiency and accuracy, lack of validation and terminology mapping mechanisms, and non-standard output.

Method used

A nursing record processing method based on a large language model was adopted, including preprocessing, hybrid retrieval, coding and terminology mapping. A large language model was constructed using the Deepseek framework, and iterative optimization was carried out in combination with a general nursing text database. A nursing professional dictionary and terminology database were introduced, and structured coding results were generated through hybrid retrieval and coding rules.

Benefits of technology

It has achieved automated processing of multi-format nursing documents, improved processing efficiency and accuracy, ensured that the coding results meet the standard specifications, suppressed the illusion problem of continuous model operation, and ensured the standardization and accuracy of the output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121636768A_ABST
    Figure CN121636768A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of natural language processing, and discloses a nursing record processing method and system based on a large language model. The method comprises the following steps: preprocessing all nursing documents to obtain a preprocessed nursing document text comprising a plurality of clauses; performing candidate document matching on the plurality of preprocessed nursing document texts by using a mixed retrieval method to generate a final model input list; encoding the final model input list by using a large language model in combination with an encoding rule to obtain an encoding result; performing verification and term mapping on the coding result by using a large language model to obtain a structured coding result; and performing structured conversion on the structured coding result to obtain a structured result, and verifying the structured result and counting coding precision indexes in combination with a manually marked coding result. According to the invention, the problems of low efficiency, low accuracy and poor processing effect in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing technology, specifically relating to a nursing record processing method and system based on a large language model. Background Technology

[0002] With the advancement of hospital information technology construction, the number of nursing record documents has surged. Standardizing the processing of these documents to improve management efficiency is a crucial development direction in this field. However, current nursing record documents are mostly in unstructured text format with diverse formats, and their standardization processes suffer from the following problems:

[0003] 1) Low efficiency: The data formats are diverse and difficult to process uniformly. Manual coding requires professionals to read, understand and judge nursing records one by one, which is time-consuming and labor-intensive and cannot meet the processing needs of massive amounts of data.

[0004] 2) Low accuracy: The accuracy of professional terminology recognition is low, and there is a lack of in-depth support for nursing terminology.

[0005] 3) Poor processing results: The encoding results lack verification and terminology mapping mechanisms, and the output is not standardized. Summary of the Invention

[0006] In order to address the problems of low efficiency, low accuracy and poor processing effect of existing technologies, the present invention aims to provide a nursing record processing method and system based on a large language model.

[0007] The technical solution adopted in this invention is as follows:

[0008] A nursing record processing method based on a large language model includes the following steps:

[0009] All nursing documents are preprocessed to obtain preprocessed nursing document text containing several clauses;

[0010] A hybrid retrieval method is used to perform candidate document matching on several preprocessed nursing document texts to generate the final model input list.

[0011] Using a large language model and combining encoding rules, the final model input list is encoded to obtain the encoding result;

[0012] Using a large language model, the encoding results are validated and terms are mapped to obtain structured encoding results;

[0013] The structured coding results are transformed into structured results, and the structured results are verified by combining them with manually labeled coding results, and the coding accuracy index is statistically analyzed.

[0014] Furthermore, all nursing documents are preprocessed to obtain preprocessed nursing document text containing several clauses, including the following steps:

[0015] Based on the file extension, the format of each nursing document is identified, and based on the format of each nursing document, the corresponding parsing technology is used to extract the cell text content of the nursing document, resulting in several nursing document texts.

[0016] Based on regular expressions, the delimiters of each nursing document text are matched, and a character traversal algorithm is used to divide the long text in the nursing document text into several clauses.

[0017] Using the MD5 hash algorithm, the text fingerprint of the nursing document text, which includes several clauses, is calculated. Based on the text fingerprint, all nursing document texts are deduplicated to obtain several deduplicated nursing document texts.

[0018] Load a custom dictionary for the nursing field, and based on the custom dictionary, call a word segmentation tool to segment several deduplicated nursing document texts to obtain preprocessed nursing document texts including several clauses.

[0019] Furthermore, a hybrid retrieval method is used to perform candidate document matching on several preprocessed nursing document texts to generate the final model input list, including the following steps:

[0020] Using the Nomic model, the preprocessed nursing document text is replaced with high-dimensional vectors. The cosine similarity of all high-dimensional vectors is calculated, and the k most relevant documents are selected based on the cosine similarity to obtain the first search result, where k is the preset total number of documents.

[0021] Based on CCC nursing terminology, the BM25 algorithm is used to calculate the matching degree between clauses and documents in the preprocessed nursing document text, and the k highest-scoring documents are selected to obtain the second search result;

[0022] Based on preset weights, the first and second search results are merged to obtain merged search results. The merged search results are then reordered using the BGE Reranker Base model to obtain the final model input list. The preset weights include vector search weights and BM25 search weights. The range of vector search weights is 0.6-0.8, and the range of BM25 search weights is 0.2-0.4.

[0023] Furthermore, using a large language model and combining encoding rules, the final model input list is encoded to obtain the encoding result, including the following steps:

[0024] The torch.topk algorithm is used to select the top-k similar document set for each clause in the retrieved documents in the input list of the final model.

[0025] The top-k similar document sets of all clauses of each retrieved document in the final model input list are merged to obtain the merged final model input list.

[0026] Based on the predefined RAG template, each retrieved document in the input list of the merged final model is concatenated with several corresponding clauses to obtain the corresponding RAG suggestion words;

[0027] Using a large language model, the RAG prompt words of the final model input list after removing duplicate documents are encoded to obtain the corresponding encoding results.

[0028] Furthermore, the method for constructing a large language model includes the following steps:

[0029] Use the Deepseek framework to build an initial large language model;

[0030] Based on a general nursing text database, the initial large language model was iteratively optimized and trained to obtain a trained large language model.

[0031] In each iteration of training optimization, the improved optimization algorithm is used to optimize the hyperparameters of the trained large language model, and the optimized hyperparameters are used as the initial hyperparameters for the next iteration.

[0032] If the number of iterations for optimization training exceeds a threshold, or the accuracy of the trained large language model exceeds a threshold, then the final large language model is output. Further, the large language model is used to validate the encoding results and perform term mapping to obtain structured encoding results, including the following steps:

[0033] The CCC nursing terminology is used to validate the encoding results output by the large language model, and the format validation logic is performed on the encoding results through the validator decorator.

[0034] If the verification passes, nursing terms are queried from the corresponding nursing terminology file according to the coding type of the coding result, and a large language model is used to establish a mapping relationship between the coding result and the nursing terminology to obtain the structured coding result.

[0035] The structured encoding results are stored in a cache managed by the LRU policy. The cache data structure is implemented using a combination of hash table and doubly linked list. When the cache is full, the least used data is automatically deleted.

[0036] If the verification fails, return to the encoding result generation step and re-perform the verification and term mapping based on the new encoding result.

[0037] Furthermore, the structured coding results are subjected to structured transformation to obtain structured results, and the structured results are verified by combining them with manually labeled coding results. The coding accuracy index is statistically analyzed, including the following steps:

[0038] Based on regular expressions, a JSON encoding list of structured coding results is extracted; based on the JSON encoding list, corresponding nursing terminology information is queried according to the encoding, and the structured coding results are transformed into structured results; the structured results are compared with manually labeled coding results item by item, and coding accuracy indicators are calculated based on the comparison results.

[0039] If the coding accuracy index does not meet the requirements, the nursing record processing flow is optimized and the preprocessing step is returned; otherwise, the structured result is output. A nursing record processing system based on a large language model is used to implement nursing record processing methods. The system includes a preprocessing unit, a candidate document matching unit, a coding result generation unit, a verification and terminology mapping unit, and a structured result output unit connected in sequence.

[0040] The preprocessing unit is used to preprocess all nursing documents to obtain preprocessed nursing document text including several clauses;

[0041] The candidate document matching unit is used to perform candidate document matching on several preprocessed nursing document texts using a hybrid retrieval method to generate the final model input list.

[0042] The encoding result generation unit is used to encode the final model input list using a large language model and encoding rules to obtain the encoding result;

[0043] The verification and term mapping unit is used to verify and map the encoding results using a large language model to obtain structured encoding results.

[0044] The structured result output unit is used to perform structured transformation on the structured coding results to obtain structured results, and to verify the structured results by combining them with manually marked coding results, and to statistically analyze the coding accuracy index.

[0045] Furthermore, the preprocessing unit includes a file parsing module, a clause segmentation module, a text deduplication module, and a text word segmentation module connected in sequence;

[0046] The file parsing module is used to identify the format of each nursing document based on the file extension, and then use the corresponding parsing technology to extract the cell text content of each nursing document to obtain several nursing document texts.

[0047] The clause segmentation module is used to match the delimiters of each nursing document text based on regular expressions, and to divide the long text in the nursing document text into several clauses using a character traversal algorithm;

[0048] The text deduplication module is used to calculate the text fingerprint of nursing document text containing several clauses using the MD5 hash algorithm, and to deduplicate all nursing document texts based on the text fingerprints to obtain several deduplicated nursing document texts.

[0049] The text segmentation module is used to load a custom dictionary in the nursing field, and based on the custom dictionary, call the segmentation tool to segment several deduplicated nursing document texts to obtain preprocessed nursing document texts including several clauses.

[0050] Furthermore, the candidate document matching unit includes a first candidate document matching module, a second candidate document matching module, and a merge retrieval module connected in sequence;

[0051] The first candidate document matching module uses the Nomic model to convert the preprocessed nursing document text into high-dimensional vectors, calculates the cosine similarity of all high-dimensional vectors, and selects the k most relevant documents based on the cosine similarity to obtain the first search result.

[0052] The second candidate document matching module is used to calculate the matching degree between clauses of preprocessed nursing document text and documents based on CCC nursing terminology and the BM25 algorithm, and to filter the k highest-scoring documents to obtain the second search result.

[0053] The merge search module is used to merge the first search result and the second search result according to the preset weights to obtain the merged search result. Then, the merged search result is reordered using the BGE Reranker Base model to obtain the final model input list.

[0054] The beneficial effects of this invention are as follows:

[0055] This invention discloses a nursing record processing method and system based on a large language model. It is independent of specific nursing document formats and can process various common formats such as .txt, .xlsx, and .pdf. It supports unified parsing and processing of multi-format nursing documents. The entire process, from document parsing to final output, is fully automated without manual intervention, improving the efficiency of nursing record processing. Nursing professional dictionaries and terminology databases are introduced in the preprocessing and retrieval stages to ensure accurate identification of professional terms. Hybrid retrieval and vector indexing technologies significantly improve retrieval accuracy and efficiency. The two-stage operation of the large language model separates the creativity of coding from the rigor of verification, effectively suppressing the "illusion" problem of continuous model operation and ensuring that the coding results conform to standards and specifications, significantly improving accuracy. A coding verification and terminology mapping mechanism is introduced to ensure standardized output.

[0056] Other beneficial effects of the present invention will be further explained in the specific embodiments. Attached Figure Description

[0057] Figure 1 This is a flowchart of the nursing record processing method based on a large language model in this invention.

[0058] Figure 2 This is a flowchart illustrating the nursing record processing method based on a large language model in this invention.

[0059] Figure 3 This is a structural block diagram of the nursing record processing system based on a large language model in this invention. Detailed Implementation

[0060] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments.

[0061] Example 1:

[0062] like Figure 1 and Figure 2 As shown in the figure, this embodiment provides a nursing record processing method based on a large language model, including the following steps:

[0063] S1: Preprocess all nursing documents to obtain preprocessed nursing document text containing several clauses, including the following steps:

[0064] S1-1: Based on the file extension, identify the format of each nursing document (such as .txt, .xlsx, .pdf, etc.), and based on the format of each nursing document, use the corresponding parsing technology to extract the cell text content of the nursing document to obtain several nursing document texts;

[0065] For example, the openpyxl library is used to parse the table structure of .xlsx files and extract the text content of cells; the PyPDF2 library is used to extract the page text of .pdf files, and documents of different formats are uniformly converted into plain text to provide a unified data format for subsequent processing.

[0066] S1-2: Based on regular expressions, match the delimiters (such as Chinese and English commas) in each nursing document text, and use a character traversal algorithm to divide the long text in the nursing document text into several clauses;

[0067] In this embodiment, whitespace characters (including tabs and newlines) are matched and deleted using regular expressions, and punctuation noise is removed using [^\w\s]. This process is based on the principles of text preprocessing in natural language processing to eliminate the interference of non-semantic symbols on subsequent analysis.

[0068] S1-3: Using the Message-Digest (MD5) hash algorithm, calculate the text fingerprint of the nursing document text, which includes several clauses, and based on the text fingerprint, deduplicate all nursing document texts to obtain several deduplicated nursing document texts.

[0069] In this embodiment, the calculated fingerprint is compared with the fingerprint set stored in the file. If the same fingerprint exists, the text is determined to be duplicated and removed. The uniqueness of the hash algorithm is used to achieve data deduplication and improve processing efficiency.

[0070] The formula is:

[0071]

[0072] In the formula, The generated hash value, i.e., the text fingerprint; The MD5 hash calculation function; The text to be processed;

[0073] S1-4: Load a custom dictionary for the nursing field, and based on the custom dictionary, call a word segmentation tool to segment several deduplicated nursing document texts to obtain preprocessed nursing document texts including several clauses;

[0074] In this embodiment, the word segmentation process is based on a statistical language model. The word segmentation boundary is determined by calculating the probability of word occurrence and the probability of adjacent character pairing. At the same time, a custom dictionary is used to supplement professional terms to improve the accuracy of nursing terminology recognition.

[0075] S2: Using a hybrid retrieval method, candidate document matching is performed on several preprocessed nursing document texts to generate the final model input list, including the following steps:

[0076] S2-1: Using the Nomic model, the preprocessed nursing document text is replaced with high-dimensional vectors. The cosine similarity of all high-dimensional vectors is calculated, and the k most relevant documents are selected based on the cosine similarity to obtain the first search result, where k is the preset total number of documents.

[0077] In this embodiment, high-dimensional vectors are stored in the Facebook AI Similarity Search (FAISS) vector library. Small-scale data is indexed using FlatL2, while large-scale data is indexed using Hierarchical NavHMOAble Small World (HNSW) or Inverted File with Flat Compression (IVFFlat).

[0078] S2-2: Based on the nursing terminology of the Clinical Care Classification (CCC) system, the Best Match 25 (BM25) algorithm is used to calculate the matching degree between the clauses of the preprocessed nursing document text and the document, and the k highest-scoring documents are selected to obtain the second search result;

[0079] S2-3: According to the preset weights, merge the first search result and the second search result to obtain the merged search result, and use the Beijing Academy of Artificial Intelligence's General Embedding RerankerBase (BGE Reranker Base) rerank the merged search result to obtain the final model input list;

[0080] The formula is:

[0081]

[0082] In the formula, The final search score for merging search results is used for reordering; The preset vector retrieval weights and BM25 retrieval weights, and ; The search score for the first search result and the search score for the second search result;

[0083] The preset weights include vector retrieval weights and BM25 retrieval weights. The vector retrieval weights range from 0.6 to 0.8, and the BM25 retrieval weights range from 0.2 to 0.4.

[0084] S3: Using a large language model and combining encoding rules, encode the final model input list to obtain the encoding result, including the following steps:

[0085] S3-1: Use the torch.topk algorithm to select the top-k similar document set for each clause in the retrieved documents in the input list of the final model;

[0086] S3-2: Merge the top-k similar document sets of all clauses of each retrieved document in the final model input list to obtain the merged final model input list;

[0087] S3-3: Based on the predefined Retrieval-Augmented Generation (RAG) template, each retrieval document in the merged final model input list is concatenated with several corresponding clauses to obtain the corresponding RAG suggestion words;

[0088] The RAG template follows a structure of "role setting - reference materials - task description - format requirements": First, it clarifies the role of the large language model as a "professional nursing coding expert"; then, it uses the retrieved documents as reference materials; next, it describes the task of CCC coding nursing records; finally, it specifies that the output should be in JSON format, including the fields of codes (code list) and rationale (coding reason), and provides an example; and it guides the large language model to generate coding results that conform to the specifications through structured prompts.

[0089] S3-4: Using a large language model, encode the RAG prompt words in the final model input list after removing duplicate documents to obtain the corresponding encoding results;

[0090] The construction method of a large language model includes the following steps:

[0091] A-1: Use the Deepseek framework to build an initial large language model;

[0092] A-2: Based on the general nursing text database, the initial large language model is iteratively optimized and trained to obtain the trained large language model;

[0093] A-3: In each iteration of training optimization, an improved Hybrid Metaheuristic Optimization Algorithm (HMOA) is used to optimize the hyperparameters of the trained large language model, and the optimized hyperparameters are used as the initial hyperparameters for the next iteration. This includes the following steps:

[0094] A-3-1: Perform text preprocessing on several general nursing text data in the general nursing text database, and divide them into training sample set and test sample set in a 7:3 ratio;

[0095] A-3-2: Encode the hyperparameters of the trained large language model into individual vectors of HMOA individuals in the HMOA algorithm, and set a multi-objective optimization function for hyperparameter optimization;

[0096] The formula is:

[0097]

[0098] In the formula, It is a multi-objective optimization function; This is the loss objective function, used to measure the accuracy of the model; The generalization gap objective function is used to measure the model's generalization ability. This is the time efficiency objective function, used to measure the computational efficiency of the model; This is the first weighting coefficient for each objective, which can be adjusted according to actual needs;

[0099] A-3-3: Use the multi-objective optimization function as the fitness function of the HMOA algorithm, and set the HMOA population parameters and the maximum number of iterations for the HMOA algorithm;

[0100] A-3-4: Based on the HMOA population parameters, the initial HMOA population is obtained by initializing using the Tent chaotic mapping sequence; each HMOA individual in the HMOA population corresponds to a candidate hyperparameter.

[0101] Hyperparameters include the learning rate, batch size, and number of layers for large language models;

[0102] The formula is:

[0103]

[0104] In the formula, The i-th initial HMOA individual in the initial HMOA population; Let i be the i-th chaotic variable; represents the upper and lower bounds of the search space; i represents the HMOA individual indicator;

[0105]

[0106] In the formula, Let i be the (i-1)th chaotic variable;

[0107] A-3-5: In the iterative optimization phase, the Levy flight mechanism and the search step size adjusted by the convergence factor are introduced to iteratively update the initial HMOA population and obtain the updated population.

[0108] The formula is:

[0109]

[0110] In the formula, For iteration number t+1,t, the updated HMOA individual is the i-th updated HMOA individual in the HMOA population; For the updated HMOA individual in the HMOA population at iteration number t, i and j are the HMOA individual indicators; The search step size is adjusted to the convergence factor; The displacement coefficient reflects the impact of overall population information; Let b be a random number distributed by Levy; b is the Levy step size, and b∈[1,2]. Levy flight weights; A random number between [0, 1];

[0111]

[0112] In the formula, The differences for the j-th updated HMOA individual; It is a symbolic function;

[0113]

[0114] In the formula, The root mean square of the fitness values ​​in the updated HMOA population; The fitness of the updated HMOA individual for the j-th generation; The fitness function;

[0115]

[0116] In the formula, The multi-objective optimization function value for the j-th updated HMOA individual;

[0117]

[0118] In the formula, These are the maximum and minimum values ​​of the search step size; This represents the current iteration number; This represents the maximum number of iterations.

[0119] A-3-6: Based on the training sample set and the test sample set, obtain the fitness value of each updated HMOA individual in the updated HMOA population according to the fitness function.

[0120] A-3-7: Select the optimal solution based on the fitness value and retain the first optimal solution in the updated HMOA population in each iteration;

[0121] A-3-8: Introduce a dynamic reverse mechanism, with a reverse probability p, to generate several reverse solutions for the updated HMOA population in each iteration, and select the first global better solution from the corresponding first optimal solution and several reverse solutions;

[0122] The formula is:

[0123]

[0124] In the formula, This represents the dynamic reverse trigger probability. These represent the maximum and minimum values ​​of the dynamic reverse trigger probability;

[0125]

[0126] In the formula, The reverse solution for the i-th HMOA individual at iteration number t+1; This is the current solution for the i-th HMOA individual in the updated HMOA population; The reverse solution for the i-th HMOA individual in the updated HMOA population; The fitness function;

[0127] A-3-9: Introduce an adaptive mutation mechanism to generate several mutated solutions for the updated HMOA population in each iteration with mutation probability q, and select the second global better solution from the corresponding first global better solution and several mutated solutions;

[0128] The formula is:

[0129]

[0130] In the formula, These are the initial and final values ​​of the mutation probability;

[0131]

[0132] In the formula, The mutated solution for the i-th HMOA individual at iteration number t+1; This is the current solution for the i-th HMOA individual in the updated HMOA population; For variation perturbation;

[0133]

[0134] In the formula, For variable asynchronous length; It follows a standard normal distribution;

[0135]

[0136] In the formula, The initial and final values ​​for variable asynchronous length;

[0137] A-3-10: When the number of iterations reaches the maximum number of iterations or the fitness function value of the second global better solution meets the requirements, terminate the iteration update and output the second global better solution of the current iteration as the final optimal solution;

[0138] A-3-11: Decode the individual vector of the HMOA individual corresponding to the final optimal solution to obtain the optimized hyperparameters, and use the obtained optimized hyperparameters as the initial hyperparameters for the next iteration;

[0139] A-4: If the number of iterations for optimization training exceeds the iteration threshold, or the accuracy of the trained large language model exceeds the threshold, then output the final large language model.

[0140] In this embodiment, the locally deployed Deepseek language model is invoked, and parameters such as temperature=0.0 (eliminating output randomness and ensuring result determinism), seed=42 (fixed random seed to ensure reproducible results) and repeat_penalty=1.1 (suppressing the generation of duplicate content) are set. Based on the Transformer architecture, the Deepseek language model encodes prompt words through a self-attention mechanism, generates encoded results word by word in the Decoder stage, and returns the encoded text in JSON format.

[0141] S4: Using a large language model, validate and map the encoding results to obtain structured encoding results, including the following steps:

[0142] S4-1: Use CCC nursing terminology to validate the encoding results output by the large language model, and use the validator decorator to perform format validation logic on the encoding results;

[0143] In this embodiment, the verification includes: verifying whether the code conforms to the "type-classification code-code" format, whether the type is diagnosis (nursing diagnosis) or intervention (nursing intervention), and ensuring the standardization of the coding results;

[0144] S4-2: If the verification passes, then according to the encoding type of the encoding result, use the pandas library to read the nursing terminology file in Excel format, query the nursing terminology (type, classification, name, etc.) from the corresponding nursing terminology file, quickly obtain relevant information through the encoding index, and use the large language model to establish the mapping relationship between the encoding result and the nursing terminology to obtain the structured encoding result;

[0145] S4-3: Store the structured encoding results in a cache managed using the Least Recently Used (LRU) strategy. The cache data structure is implemented using a combination of hash table and doubly linked list. When the cache is full, the least recently used data is automatically deleted.

[0146] S4-4: If the verification fails, return to the encoding result generation step and re-perform the verification and term mapping based on the new encoding result;

[0147] S5: Perform a structured transformation on the structured coding results to obtain structured results, and verify the structured results by combining them with manually labeled coding results, and statistically analyze the coding accuracy indicators, including the following steps:

[0148] S5-1: Extract the JavaScript Object Notation (JSON) encoding list of structured encoding results based on regular expressions;

[0149] S5-2: Based on the JSON encoding list, query the corresponding nursing terminology information according to the encoding, perform structured conversion on the structured encoding results, and obtain structured results;

[0150] S5-3: Construct a manually labeled verification dataset, and perform preprocessing, mixed retrieval, and encoding operations on the manually labeled verification dataset to obtain the manually labeled encoding results;

[0151] Specifically, nursing record samples covering multiple scenarios such as nursing diagnoses and nursing interventions are selected. Professionals with nursing coding qualifications manually code and mark each item in the samples according to the CCC coding standard, forming a manually labeled verification dataset containing nursing record text and manual standard codes. This ensures that the samples in the dataset cover different disease types and nursing operation scenarios, guaranteeing the representativeness of the verification.

[0152] The nursing record text in the manually labeled verification dataset is input into the large language model to be verified according to the aforementioned preprocessing, hybrid retrieval, and encoding generation steps. The automatic encoding results output by the model are obtained. The automatic encoding results must conform to the structured format of "type-classification code-encoding" and include the encoding rationale field, which is the manually labeled encoding result.

[0153] S5-4: Compare the structured results with the manually labeled coding results item by item, and based on the comparison results, calculate the coding accuracy index;

[0154] Specifically, establish result comparison rules, and match the model's automatic coding results with manually labeled standard codes item by item. The comparison dimensions include: consistency of coding type (nursing diagnosis / nursing intervention), accuracy of classification code, completeness of coding value, and semantic matching degree between coding reason and nursing record text; count the number of fully matched coding entries, the number of partially matched entries (such as correct type but incorrect coding value) and the number of completely mismatched entries.

[0155] Coding precision metrics include: precision (P), recall (R), F1 score (F1), and joint crossover (IoU);

[0156] S5-5: If the coding accuracy index does not meet the requirements, optimize the nursing record processing flow and return to the preprocessing step; otherwise, output the structured results in comma-separated values ​​(CSV) or JSON format.

[0157] If the statistical coding accuracy index does not reach the preset threshold and the accuracy rate is ≤80%, then the coding accuracy index does not meet the requirements. Optimize the nursing record processing flow, adjust the prompt word template of the model input (such as supplementing coding rule examples for the corresponding error type) according to the error type in the verification report, optimize the weight parameters of the hybrid retrieval or update the custom dictionary in the nursing domain, and return to the preprocessing step to perform iterative nursing record processing and the next round of iterative verification until the accuracy index meets the application requirements.

[0158] Example 2:

[0159] like Figure 3 As shown, this embodiment provides a nursing record processing system based on a large language model to implement a nursing record processing method. The system includes a preprocessing unit, a candidate document matching unit, an encoding result generation unit, a verification and terminology mapping unit, and a structured result output unit connected in sequence.

[0160] The preprocessing unit is used to preprocess all nursing documents to obtain preprocessed nursing document text including several clauses;

[0161] The candidate document matching unit is used to perform candidate document matching on several preprocessed nursing document texts using a hybrid retrieval method to generate the final model input list.

[0162] The encoding result generation unit is used to encode the final model input list using a large language model and encoding rules to obtain the encoding result;

[0163] The verification and term mapping unit is used to verify and map the encoding results using a large language model to obtain structured encoding results.

[0164] The structured result output unit is used to perform structured transformation on the structured coding results to obtain structured results, and to verify the structured results by combining them with manually marked coding results, and to statistically analyze the coding accuracy index.

[0165] Preferably, the preprocessing unit includes a file parsing module, a clause segmentation module, a text deduplication module, and a text segmentation module connected in sequence.

[0166] The file parsing module is used to identify the format of each nursing document based on the file extension, and then use the corresponding parsing technology to extract the cell text content of each nursing document to obtain several nursing document texts.

[0167] The clause segmentation module is used to match the delimiters of each nursing document text based on regular expressions, and to divide the long text in the nursing document text into several clauses using a character traversal algorithm;

[0168] The text deduplication module is used to calculate the text fingerprint of nursing document text containing several clauses using the MD5 hash algorithm, and to deduplicate all nursing document texts based on the text fingerprints to obtain several deduplicated nursing document texts.

[0169] The text segmentation module is used to load a custom dictionary in the nursing field, and based on the custom dictionary, call the segmentation tool to segment several deduplicated nursing document texts to obtain preprocessed nursing document texts including several clauses.

[0170] Preferably, the candidate document matching unit includes a first candidate document matching module, a second candidate document matching module, and a merge retrieval module connected in sequence.

[0171] The first candidate document matching module uses the Nomic model to convert the preprocessed nursing document text into high-dimensional vectors, calculates the cosine similarity of all high-dimensional vectors, and selects the k most relevant documents based on the cosine similarity to obtain the first search result.

[0172] The second candidate document matching module is used to calculate the matching degree between clauses of preprocessed nursing document text and documents based on CCC nursing terminology and the BM25 algorithm, and to filter the k highest-scoring documents to obtain the second search result.

[0173] The merge search module is used to merge the first search result and the second search result according to the preset weights to obtain the merged search result. Then, the merged search result is reordered using the BGE Reranker Base model to obtain the final model input list.

[0174] Preferably, the encoding result generation unit includes a similar document selection module, a similar document merging module, a clause splicing module, and a RAG prompt word encoding module connected in sequence.

[0175] The similar document selection module is used to select the top-k similar document set for each clause in the retrieved documents in the input list of the final model using the torch.topk algorithm.

[0176] The similar document merging module is used to merge the top-k similar document sets of all clauses of each retrieved document in the final model input list to obtain the merged final model input list;

[0177] The clause concatenation module is used to concatenate each retrieval document in the merged final model input list with several corresponding clauses according to the predefined RAG template to obtain the corresponding RAG prompt words;

[0178] The RAG prompt word encoding module is used to encode the RAG prompt words in the final model input list after removing duplicate documents using a large language model, and obtain the corresponding encoding results.

[0179] Preferably, the verification and term mapping unit includes an encoding result verification module, a term mapping module, and a structured encoding result caching module connected in sequence.

[0180] The encoding result verification module is used to verify the encoding results output by the large language model using CCC nursing terminology, and performs format verification logic on the encoding results through the validator decorator.

[0181] The terminology mapping module is used to query nursing terms from the corresponding nursing terminology file based on the encoding type of the encoding results, and to establish a mapping relationship between the encoding results and nursing terms using a large language model to obtain structured encoding results.

[0182] The structured encoding result caching module is used to store the structured encoding results in a cache managed by the LRU policy. The cache data structure is implemented using a combination of hash table and doubly linked list. When the cache is full, the least used data is automatically deleted.

[0183] Preferably, the structured result output unit includes a JSON encoded list extraction module, a structured conversion module, and a structured result output module connected in sequence.

[0184] The JSON encoding list extraction module is used to extract a JSON encoding list of structured encoding results based on regular expressions.

[0185] The structured conversion module is used to convert the structured encoding results into structured results based on a JSON encoded list, query the corresponding nursing terminology information according to the encoding, and obtain the structured results.

[0186] The structured results output module is used to output structured results in formats such as CSV or JSON.

[0187] This invention discloses a nursing record processing method and system based on a large language model. It is independent of specific nursing document formats and can process various common formats such as .txt, .xlsx, and .pdf. It supports unified parsing and processing of multi-format nursing documents. The entire process, from document parsing to final output, is fully automated without manual intervention, improving the efficiency of nursing record processing. Nursing professional dictionaries and terminology databases are introduced in the preprocessing and retrieval stages to ensure accurate identification of professional terms. Hybrid retrieval and vector indexing technologies significantly improve retrieval accuracy and efficiency. The two-stage operation of the large language model separates the creativity of coding from the rigor of verification, effectively suppressing the "illusion" problem of continuous model operation and ensuring that the coding results conform to standards and specifications, significantly improving accuracy. A coding verification and terminology mapping mechanism is introduced to ensure standardized output.

[0188] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for processing a nursing record based on a large language model, characterized in that: The method comprises the following steps: Preprocessing all nursing documents to obtain preprocessed nursing document texts comprising a plurality of clauses; Using a hybrid retrieval method to perform candidate document matching on the plurality of preprocessed nursing document texts to generate a final model input list; Using a large language model to encode the final model input list in combination with coding rules to obtain a coding result; Using the large language model to verify and map the coding result to obtain a structured coding result; Structuring the structured coding result to obtain a structured result, and verifying the structured result in combination with the artificially marked coding result to count coding accuracy indicators.

2. The method of claim 1, wherein: The preprocessing of all nursing documents to obtain preprocessed nursing document texts comprising a plurality of clauses comprises the following steps: According to the file extension, the format of each nursing document is identified, and according to the format of each nursing document, the corresponding parsing technology is used to extract the cell text content of the nursing document to obtain a plurality of nursing document texts; Based on regular expressions, the delimiters of each nursing document text are matched, and character traversal algorithms are used to divide the long text in the nursing document text into a plurality of clauses; Using the MD5 hash algorithm, the text fingerprints of the nursing document texts comprising a plurality of clauses are calculated, and all nursing document texts are de-duplicated according to the text fingerprints to obtain a plurality of de-duplicated nursing document texts; Load the self-defined dictionary in the nursing field, and based on the self-defined dictionary, call the word segmentation tool to segment the plurality of de-duplicated nursing document texts to obtain preprocessed nursing document texts comprising a plurality of clauses.

3. The method of claim 2, wherein: The hybrid retrieval method is used to perform candidate document matching on the plurality of preprocessed nursing document texts to generate a final model input list, comprising the following steps: Using the Nomic model, the preprocessed nursing document texts are converted into high-dimensional vectors, the cosine similarity of all high-dimensional vectors is calculated, and k most relevant documents are selected according to the cosine similarity to obtain a first retrieval result, wherein k is a preset total number of documents; Based on the CCC nursing terminology, the BM25 algorithm is used to calculate the matching degree of the clauses of the preprocessed nursing document texts and the documents, and k highest scoring documents are selected to obtain a second retrieval result; According to the preset weight, the first retrieval result and the second retrieval result are combined to obtain a combined retrieval result, and the BGEReranker Base model is used to reorder the combined retrieval result to obtain a final model input list; the preset weight comprises a vector retrieval weight and a BM25 retrieval weight, the range of the vector retrieval weight is 0.6-0.8, and the range of the BM25 retrieval weight is 0.2-0.

4.

4. The method of claim 3, wherein the method further comprises: Using a large language model in combination with coding rules to encode the final model input list to obtain a coding result, comprising the following steps: Using the torch.topk algorithm to select top-k similar document sets for each clause in the retrieval documents in the final model input list; Merging the top-k similar document sets of all clauses of each retrieval document in the final model input list to obtain a merged final model input list; According to the predefined RAG template, each search document in the merged final model input list is spliced with a corresponding number of clauses to obtain a corresponding RAG prompt word; Using a large language model, the RAG prompt word of the final model input list after removing duplicate documents is encoded to obtain a corresponding encoding result.

5. The method of claim 4, wherein: The method for constructing the large language model comprises the following steps: An initial large language model is constructed using a Deepseek framework; The initial large language model is iteratively optimized and trained according to a nursing general text database to obtain a trained large language model; During each iteration of the optimization and training process, an improved optimization algorithm is used to optimize the hyperparameters of the trained large language model, and the optimized hyperparameters are used as the initial hyperparameters for the next iteration; If the number of iterations of the optimization and training is greater than a threshold number of iterations, or the accuracy of the trained large language model is greater than a threshold value, then the final large language model is output.

6. The method of claim 5, wherein: The encoding result is verified and mapped to a term using the large language model to obtain a structured encoding result, comprising the following steps: The encoding result output by the large language model is verified using CCC nursing terms, and the validator decorator is used to perform format checking logic on the encoding result; If the verification is passed, then the nursing terms are queried from the corresponding nursing term file according to the encoding type of the encoding result, and the mapping relationship between the encoding result and the nursing terms is established using the large language model to obtain a structured encoding result; The structured encoding result is stored in a cache managed by an LRU strategy, and the cache data structure is implemented using a combination of a hash table and a doubly linked list, and the oldest data is automatically deleted when the cache is full; If the verification fails, then the encoding result generation step is returned, and the verification and term mapping are performed again based on the new encoding result.

7. The method of claim 6, wherein: The structured encoding result is structured and converted to obtain a structured result, and the structured result is verified based on the manually labeled encoding result to calculate an encoding accuracy index, comprising the following steps: Based on a regular expression, a JSON encoding list of the structured encoding result is extracted; Based on the JSON encoding list, the structured encoding result is structured and converted to obtain a structured result according to the corresponding nursing term information queried based on the encoding; An artificial labeling verification data set is constructed, and preprocessing, mixed retrieval, and encoding operations are performed on the artificial labeling verification data set to obtain an artificial labeling encoding result; The structured result and the artificial labeling encoding result are compared item by item, and based on the comparison result, the encoding accuracy index is calculated; If the encoding accuracy index does not meet the requirements, then the nursing record processing flow is optimized, and the preprocessing step is returned, otherwise, the structured result is output.

8. A large language model-based nursing record processing system for implementing the nursing record processing method according to any one of claims 1-7, characterized in that: The system comprises a preprocessing unit, a candidate document matching unit, an encoding result generation unit, a verification and term mapping unit, and a structured result output unit connected in sequence; The preprocessing unit is used to preprocess all nursing documents to obtain preprocessed nursing document texts comprising a plurality of clauses; The candidate document matching unit is configured to perform candidate document matching on the preprocessed nursing document texts using a hybrid retrieval method to generate a final model input list; The encoding result generation unit is configured to encode the final model input list using a large language model in combination with an encoding rule to obtain an encoding result; The verification and term mapping unit is configured to verify and map terms of the encoding result using the large language model to obtain a structured encoding result; The structured result output unit is configured to perform structured conversion on the structured encoding result to obtain a structured result, and verify the structured result in combination with the artificially labeled encoding result to count an encoding accuracy index.

9. The nursing record processing system based on a large language model according to claim 8, characterized in that: The preprocessing unit comprises a file parsing module, a clause division module, a text deduplication module, and a text segmentation module connected in sequence; The file parsing module is configured to identify the format of each nursing document according to the file extension, and extract cell text content of the nursing document using a corresponding parsing technology according to the format of each nursing document to obtain a plurality of nursing document texts; The clause division module is configured to match a separator of each nursing document text based on a regular expression, and divide long text in the nursing document text into a plurality of clauses using a character traversal algorithm; The text deduplication module is configured to calculate a text fingerprint of the nursing document text including a plurality of clauses using an MD5 hash algorithm, and deduplicate all nursing document texts according to the text fingerprint to obtain a plurality of deduplicated nursing document texts; The text segmentation module is configured to load a self-defined dictionary in the nursing field, and call a segmentation tool to segment the plurality of deduplicated nursing document texts based on the self-defined dictionary to obtain preprocessed nursing document texts including a plurality of clauses.

10. The nursing record processing system based on a large language model according to claim 9, characterized in that: The candidate document matching unit comprises a first candidate document matching module, a second candidate document matching module, and a merged retrieval module connected in sequence; The first candidate document matching module is configured to convert the preprocessed nursing document texts into high-dimensional vectors using an Nomic model, calculate the cosine similarity of all high-dimensional vectors, and select k most relevant documents according to the cosine similarity to obtain a first retrieval result; The second candidate document matching module is configured to calculate the matching degree of the clauses of the preprocessed nursing document texts and the documents using a BM25 algorithm based on CCC nursing terms, and select k highest scoring documents to obtain a second retrieval result; The merged retrieval module is configured to merge the first retrieval result and the second retrieval result according to a preset weight to obtain a merged retrieval result, and reorder the merged retrieval result using a BGEReranker Base model to obtain a final model input list.