Electronic medical record post-structured information extraction method based on large language model, electronic equipment and storage medium
By fine-tuning and element splitting of the structured tasks of the electronic medical record of the large language model, the problems of slow processing speed and high hallucination risk in the post-structured electronic medical record of the large language model are solved, achieving more efficient output and higher quality medical data.
Patent Information
- Application Number
- CN202510082058.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The large language model is slow to process in post-structured electronic medical records and has hallucination risks, resulting in deviations from the output information and real medical records information, affecting the data quality in the medical field.
By retraining the large language model, fine-tuning the structured tasks after electronic medical records, element splitting and optimization streamlining output methods are adopted to reduce the amount of output content, and strictly require the output content to be part of the original text to reduce the risk of hallucination.
It improves the output efficiency of large language models in post-structured electronic medical records, reduces hallucination risks, improves data quality in the medical field, and simplifies the implementation of large language models in the medical field.
Smart Images

Figure CN119514536A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing of large medical models, and in particular to a method for extracting post-structured information from electronic medical records based on a large language model, an electronic device and a storage medium. Background Art
[0002] Electronic medical records in the medical field contain a wide variety of written content. Electronic medical record systems must meet the requirements of both the structuring of medical information and the convenience of writing. Electronic medical record systems on the market will find a balance between structuring and convenience. One of the current solutions is to prioritize convenience and improve the efficiency of doctors' diagnosis and treatment. At the same time, the post-structuring method of medical records is used to meet the structural requirements of medical records. Earlier medical record post-structuring methods included rule-based and traditional NLP (natural language processing)-based information extraction methods. These methods have strong grammatical understanding of language and fast processing speed, but weak semantic understanding. With the rise of large language models, there are also methods based on large language models. Usually, in the post-structuring of medical records, large language models submit an electronic medical record as content and the corresponding question prompt words to the large model in the form of questions and answers. The large model outputs the structured information of the medical record in the form of text answers. The post-structuring of medical records based on the large language model has a stronger semantic understanding of language, but the processing speed is slow, especially for electronic medical records, where some elements are large texts, such as "history of current illness" and "discussion opinions", which are usually large texts, and the model output is slow; there is also the risk of hallucinations, such as the large model outputs some names, medicines, diseases and other words or sentences that do not exist in the original medical records. This output is the hallucination produced by the large language model. The existence of these sentences will cause the output information of the large language model to deviate from the actual medical record information, and the medical field has a low tolerance for information errors. This is one of the reasons why large language models are difficult to implement in the medical field. Summary of the invention
[0003] The present invention provides a method for extracting post-structured information from electronic medical records based on a large language model, an electronic device and a storage medium to address the deficiencies of the above-mentioned prior art. The method aims to address the problems of slow processing speed and high risk of hallucination in the post-structuring of electronic medical records using a large language model.
[0004] In order to achieve the purpose of the present invention, the following technologies are proposed: A method for extracting post-structured information from electronic medical records based on a large language model, including model training and application of the trained model; Model training is to fine-tune the general large language model for the electronic medical record post-structuring task through the method of retraining the large language model, so as to obtain the electronic medical record post-structuring model; The steps of model training are: Step a, post-structurally annotating the input electronic medical record text according to the elements contained in its medical record type; Step b, processing each element of the marked electronic medical record data separately; When processing each element of the marked electronic medical record data in step b, it includes classifying each element of the marked electronic medical record data and processing the original content of each element of the marked electronic medical record data according to the type of the element; Step c, organizing each processed element into training sample data; Step d, training / fine-tuning the large language model with training sample data; The application of the trained model is to apply the trained / fine-tuned EMR post-structural model.
[0005] Furthermore, in step a, the elements of the medical record type generally refer to the health industry standards, such as the basic data set of electronic medical records. For example, the medical record type "admission record" contains "name", "gender", "age", "current medical history", "family history", etc., and there are constraints on the length of the element values; for annotation, some existing general annotation systems can be used to annotate the values of each element separately.
[0006] Further, when processing the marked electronic medical record element in step b, the content length of the marked electronic medical record element is used as a condition; If the content length of the marked electronic medical record element is greater than or equal to the preset value, the element is considered an optimized element and needs to be processed. After processing, the element contains two values, one is the original content and the other is the optimized content. The element content length refers to the general length of the element, which can be referred to the health industry standards or adjusted by yourself.
[0007] If the content length of the marked electronic medical record element is less than a predetermined value, the element is deemed to be a regular element and does not need to be processed. The element contains only one value, namely, the original content.
[0008] By classifying, processing, and training the annotated electronic medical record elements according to the content length, a model with higher information extraction efficiency can be obtained, thereby responding to requests for medical record information extraction at a faster speed in subsequent model applications.
[0009] Furthermore, in step b, the optimization processing of the content of the optimized element is to intercept the original content of the element, intercept the first n characters as the first part, intercept the last n characters as the second part, and connect the first part and the second part with ellipsis or other punctuation marks that are not often used in medical records, so as to obtain the optimized content of the element.
[0010] Furthermore, in step c, each processed electronic medical record element is organized into one or two training sample data.
[0011] Further, in step c, each element is organized into one or two pieces of training sample data based on the type of each element identified in step b; If the element is an optimized element, its value has two values, namely the original content and the optimized content, then the output training sample data is two pieces of data corresponding to the two values respectively; If the element is a regular element and has only one value, namely the original content, the output training sample data is a piece of data corresponding to the original content.
[0012] Furthermore, in step c, the training data is organized. For a large language model, the data needs to be organized into three parts: input, prompt words, and output. The input is the original text of the electronic medical record in step a, the prompt words are to let the model know the task to be done for this electronic medical record text, and the output is the result of the task.
[0013] If the value corresponding to the data is the original content, set the prompt word to a regular prompt word, such as "Please extract the medical history of this admission record. Note that the extracted content must be extracted from the original text." The prompt word needs to mention the name of the element corresponding to the data to make it clear what data element is extracted for this task.
[0014] If the value corresponding to the data is optimized content, set the prompt word to the optimized prompt word, for example, "Please extract the medical history of this admission record. Note that the extracted content must be extracted from the original text. If the length of the extracted content is greater than 10, it will be output in the form of 'first 5 characters + ellipsis + last 5 characters'" to make it clear that the output format is the optimized format.
[0015] Furthermore, in step d, a general large language model, such as qwen2 of Alibaba Group Holding Limited and GLM of Beijing Zhipu Huazhang Technology Co., Ltd., can be used as a basic model, and the basic model can be further trained / fine-tuned using the training data organized in step c. Currently, the training data of various general large language models are input, output, and prompt words, and only the format is different, so they can be appropriately adapted.
[0016] For the application of large language models, under the same hardware resources, the number of words output is basically proportional to the time consumed. After the above steps b and c, the number of words output can be reduced as much as possible. For example, the "current medical history" of the "admission record" is one or two hundred words in most cases. If the output can be reduced, the time consumed can be reduced. In this scheme, the data elements marked with a small number of characters or words, such as "name", are processed according to the conventional large model processing method. For the "current medical history" content with a large number of characters or words, only the first 5 words and the last 5 words of the "current medical history" need to be output, and the middle is spliced with ellipsis. In this way, the number of output words can be reduced. Then, the full text of the "current medical history" is restored through subsequent low-cost processing. Special note: The start and end positions of the "current medical history" content in the original text of the medical record are output without reference to the traditional NLP method. This more concise method is because it is difficult for large language models to identify position information. Existing large language models with large parameters are difficult to directly give accurate position point information, and the positions given are often wrong. In addition, through step c, an electronic medical record is split and organized into multiple training data by elements. Compared with the traditional one medical record corresponding to one training data, on the one hand, for the large model, the detailed task is similar to "extract the current medical history from this admission record" instead of the traditional "extract structured data from this admission record". The task is clearer and reduces the probability of model error output. On the other hand, the output content is less, only the content of the element "current medical history" needs to be given, without the need to organize the format and give the names and values of multiple different elements, such as {"current medical history": "current medical history content", "other elements"...}; and the training data corresponding to the original value of the optimized element is retained, which is a return to the conventional processing method to prevent the model from using the optimization method to output abnormal output when the model is applied.
[0017] Specifically, the application steps of the training model are: Step 01, receiving electronic medical record text as input; Step 02, according to the type configuration corresponding to the received electronic medical record text, take out one of the elements in the type configuration, the corresponding type configuration is consistent with steps a and b, and the elements contained therein are generally derived from health industry standards, and the elements are identified to distinguish between the elements as regular elements or optimized elements.
[0018] Step 030, if the element obtained in step 02 is a regular element, the element name obtained in step 02 is used to organize a regular prompt word, and the regular prompt word of the element should be consistent with the regular prompt word in the aforementioned model training; Step 040, calling a large language model for the conventional prompt words in step 020 and the electronic medical record text provided in step 01; Step 050, verifying whether the output corresponding to the conventional prompt word meets the requirements; Further, step 050 verifies whether the output content of the large language model meets the requirements, mainly by verifying whether it is part of the original text, so as to prevent the large model from generating irrelevant hallucination content. Determine whether the content is part of the original text of the electronic medical record, if so, it meets the requirements, otherwise it does not meet the requirements; If it meets the requirements, go to step 06; If it does not meet the requirements, execute step 030. For a large language model, the model parameter topk=1 is generally added when calling. The same input will give the same output content. If the verification fails, it is necessary to adjust the parameter and execute step 030 to produce a result different from the previous one. Step 06, judging whether there is a next element according to the type configuration corresponding to the received electronic medical record text; If there is a next element in the type configuration corresponding to the received electronic medical record text, iteratively execute steps 030 to 06 with the next element; If the next element does not exist in the type configuration corresponding to the received electronic medical record text, execute step 07; Step 07, integrate each element in the type configuration corresponding to the received electronic medical record text and return it in a response format.
[0019] Further, in step 031, if the element obtained in step 02 is an optimized element, the element name taken out in step 02 is used to organize an optimized prompt word, and the optimized prompt word of the element should be consistent with the optimized prompt word in the aforementioned model training; Step 032, calling a large language model for the prompt words optimized in step 031 and the electronic medical record text provided in step 01; Step 033, verifying whether the output content of the large language model for the optimized prompt word meets the requirements; Furthermore, step 033 verifies whether the output content of the large language model meets the requirements, mainly by verifying whether it is part of the original text, so as to prevent the large model from generating irrelevant hallucination content.
[0020] If the output content does not contain ellipsis, determine whether the content is part of the original text of the electronic medical record. If so, it is in compliance, otherwise it is not in compliance. If the output content contains ellipsis, the output content is split into the first part and the second part by the first ellipsis, and it is determined whether the first part and the second part are part of the original text of the electronic medical record and are both unique. If so, it is compliant, otherwise it is not compliant If the output content of the large language model for the optimized prompt word meets the requirements, step 034 is executed; If the output content of the large language model for the optimized prompt word does not meet the requirements, the element obtained in step 02 is determined to be a regular element, and steps 030 to 07 are executed with the element obtained in step 02 as the regular element; Step 034, convert the output content of the large language model for the optimized prompt word into a normal value, and execute steps 06 to 07.
[0021] Furthermore, in step 034, the output content of the large language model for the optimized prompt word is converted into a normal value, that is, the output content containing ellipsis is converted, and the output content without ellipsis is directly taken.
[0022] If the output content contains ellipsis, the output content is split into two parts with the ellipsis as the split point, and the starting position of the first part in the original electronic medical record text is found, and the ending position of the second part in the original electronic medical record text is found. The text intercepted from the original electronic medical record text at the starting position and the ending position is the converted content.
[0023] In addition, an electronic device is provided, comprising at least a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the processor executes the method for extracting post-structured information from electronic medical records based on a large language model.
[0024] In addition, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method for extracting post-structured information from electronic medical records based on a large language model.
[0025] The advantages of the above technical solution are: The present invention splits the elements of the structured data annotation of the electronic medical record to reduce the number of words, phrases or character sequences output when the model is applied, thereby improving the output efficiency of the model.
[0026] The present invention splits the elements and processes them separately by the large model, so that the output target of the large model is clearer and the risk of error is smaller.
[0027] The present invention uses an optimized and simplified output method for elements with more content to reduce the number of output words, phrases or character sequences and improve the model output efficiency.
[0028] The present invention strictly requires that the output content is a part of the original text, thereby reducing the risk of hallucination in a large language model.
[0029] The present invention effectively improves the efficiency of large language model training and output, reduces the risk of hallucinations, and reduces the difficulty of implementing large language models in the medical field.
[0030] The application of the present invention in large language models and post-structuring of electronic medical records can effectively improve the data quality of the medical industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0032] Figure 1 A flowchart of model training in the extraction method in an embodiment of the present application is shown.
[0033] Figure 2 A flow chart of the model application in the extraction method of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0034] like Figure 1 As shown, a method for extracting post-structured information from electronic medical records based on a large language model includes model training and model application.
[0035] Model training is to fine-tune the electronic medical record post-structuring training model through the method of retraining the large language model. The training model application is to use the fine-tuned electronic medical record post-structuring training model to extract electronic medical record post-structuring information.
[0036] Among them Figure 1 As shown, the steps of model training are: Step a: perform post-structural annotation on the input electronic medical record text according to the elements of the medical record type. The annotation result is in a key-value pair format similar to {"element name": "element value"}, for example: {"name": "Zhang XX", "gender": "X"......} Step b, processing each element of the marked electronic medical record data separately. When processing each element of the marked electronic medical record data separately, it includes classifying each element of the marked electronic medical record data separately and processing the original content of each element of the marked electronic medical record data according to the type of element. When classifying each element of the marked electronic medical record data separately, the content length of the element of the marked electronic medical record data is used as a condition. If the content length of the marked electronic medical record element is greater than or equal to a predetermined value, the element is determined to be an optimized element, and the content of the element is processed. If the content length of the marked electronic medical record element is less than a predetermined value, the element is determined to be a regular element, and the content of the element is not processed, so that the content of the regular element is the original content text of the corresponding element in the electronic medical record text. When processing the content of the optimized element, the original content text of the optimized element is intercepted to obtain the optimized content text of the optimized element. When the original content text of the optimized element is intercepted and processed: the first n characters of the original content text corresponding to the optimized element in the electronic medical record text are intercepted as the first part of the optimized content text. The last n characters of the original content text corresponding to the optimized element in the electronic medical record text are intercepted as the second part of the optimized content text. The format of the optimized content text of the optimized element is: "first part" + "punctuation" + "second part". In this embodiment, the length of 15 characters is used as the distinguishing point. If the content length of the marked electronic medical record element is greater than 15 characters, the value of the element is processed. For example, the processed data format is: "the first 6 characters in the original content "......" the last 6 characters in the original content". The above number of characters can be adjusted as needed, and the "......" that is, the ellipsis can be replaced by other symbols, and the replaced symbols are symbols that are less frequently used in medical records to avoid confusion. If the content length of the marked electronic medical record element is less than 15 characters, the content of the element is not processed.
[0037] For example: Original key-value pair: { "Name": "Zhang XX", "Gender": "X", “Current medical history”: “Five years ago, palpitations, chest tightness, fatigue, and shortness of breath began to recur. They are more likely to occur after activities and can be relieved by rest. Each time, they can last for dozens of minutes. There is no blackout or syncope, no cough or sputum, no hemoptysis or blood in the sputum. The above symptoms have recurred for more than 4 years. They have been repeatedly diagnosed in our hospital as “1. Coronary heart disease; 2. Primary hypertension level 3 is very high risk; 3. Old cerebral infarction; 4. Type 2 diabetes; 5. Deep vein thrombosis of the right lower limb; 6. Chronic renal failure”. He was discharged from the hospital after treatment (the specific diagnosis and treatment process is unknown). Three days ago, the above symptoms recurred without obvious cause. The symptoms relapsed and worsened several times a day, and each time lasted for dozens of minutes. After taking "Jiusin Pills", the symptoms were slightly relieved, accompanied by chest tightness and discomfort, mainly located in the lower part of the sternum, no paroxysmal dyspnea at night, no pink foamy sputum, no chills and fever, no hot flashes and night sweats, no blackouts and syncope. Today, the patient did not show significant improvement after taking "Jiusin Pills". For further diagnosis and treatment, the emergency department admitted him to our department with "coronary atherosclerotic heart disease". Since the onset of the disease, the patient has been in poor spirits, has a general diet, poor sleep, decreased physical strength, normal urination and defecation, and no significant change in weight. " } New key-value pairs: { “Current medical history”: “It started to relapse 5 years ago…no significant changes.” }.
[0038] Step c, organize each processed element into training sample data respectively. If the element is an optimized element, then the output training sample data is two. If the element is a regular element, then the output training sample data is one. If the element is an optimized element, then the element has two training sample data, one of which corresponds to the original content text of the optimized element, and the other training sample data corresponds to the optimized content text of the optimized element. If the element is a regular element, then the element has one training sample data, and the training sample data corresponds to the original content text of the regular element.
[0039] This step requires organizing a training data for each element of the original key-value pair and the new key-value pair. The training data includes: prompt word, input, and output.
[0040] The prompt word for each element of the original key-value pair. For example, you are a medical expert and you need to extract the value of the element "history of current illness" from the following electronic medical record (admission record). The value must be a part of the medical record. Do not invent a value that is unrelated to the medical record.
[0041] The input of each element of the original key-value pair is the original electronic medical record text; The output of each element of the original key-value pair is the value of the element; The prompt word for each element of the new key-value pair, for example: You are a medical expert, and now you need to extract the value of the element "Current Medical History" from the following electronic medical record (admission record). The requirement is that the value is a part of the medical record, and do not make up a value that is irrelevant to the medical record. If the value content is too long, please use the ellipsis in the middle of the content to output it. For example: "5 years ago, there was no obvious change".
[0042] The input of each element of the new key-value pair is the original electronic medical record text; The output of each element of the new key-value pair is the value of the element in the new key-value pair.
[0043] Step d: train / fine-tune the large language model using training sample data.
[0044] When this step is executed, each element in step c is mapped to one or two values. For a regular element, it corresponds to an original content value, and for an optimized element, it corresponds to both an original content value and an optimized content value. For each value of the element, the corresponding prompt word, input, and output are used as a training / fine-tuning sample data, and the sample data is provided to the large language model for training.
[0045] like Figure 2 As shown, the model application includes the steps of: Step 01, receiving the electronic medical record text as input. This step allows the external input of the electronic medical record text that needs to be post-structured and its electronic medical record type through service mode or call mode, such as the "admission record" and other electronic medical record types mentioned in the previous model training.
[0046] Step 02, according to the type configuration corresponding to the received electronic medical record text, take out one of the elements in the type configuration, and identify the element to distinguish whether the element is a regular element or an optimized element. This step is based on the type configuration of the electronic medical record text, such as the "admission record" mentioned above. And according to the elements required to obtain the type configuration corresponding to this electronic medical record text, the prompt words and input parameters of the training model are organized separately. Among them, the input is the original text of the electronic medical record, and the prompt words are adjusted according to the different regular elements and optimized elements in the model training, and the prompt words should be consistent with the previous training.
[0047] Step 030, if the element obtained in step 02 is a regular element, the element name obtained in step 02 is used to organize a regular prompt word. For example, the prompt word of a regular element is: You are an expert in the medical field, and now you need to extract the value of the element "history of current illness" from the following original electronic medical record text (admission record). The requirement is that the value is a part of the original electronic medical record text, and do not make up a value that is irrelevant to the electronic medical record.
[0048] Step 040, calling the large language model for the regular prompt words in step 020 and the electronic medical record text provided in step 01, traversing the prompt words of each element and the original text input of the electronic medical record, and passing both as parameters to the trained / fine-tuned large language model to obtain the output content.
[0049] Step 050, verify whether the output corresponding to the conventional prompt word meets the requirements. If it meets the requirements, execute step 06, if it does not meet the requirements, execute step 030. Since this step is only for conventional prompt words, it is only necessary to verify whether it is a substring of the original text of the electronic medical record. If it is, the format is correct, otherwise the format is incorrect.
[0050] Step 031, if the element obtained in step 02 is an optimized element, the element name taken out in step 02 is used to organize the optimized prompt word. For example, the prompt word of the optimized element: You are an expert in the medical field, and now you need to extract the value of the element "current medical history" from the following electronic medical record (admission record). The requirement is that the value is a part of the original text of the electronic medical record, and do not make up a value that is unrelated to the electronic medical record. If the value content is too long, please use the middle part of the content to output it in the form of ellipsis, for example: "5 years ago, it began to...no obvious change".
[0051] Step 032, calling the large language model for the prompt words optimized in step 031 and the electronic medical record text provided in step 01.
[0052] Step 033, verify whether the output content of the large language model for the optimized prompt word meets the requirements. If the output content of the large language model for the optimized prompt word meets the requirements, execute step 034; if the output content of the large language model for the optimized prompt word does not meet the requirements, determine that the element obtained in step 02 is a regular element, and execute steps 030 to 07 with the element obtained in step 02 as the regular element.
[0053] When verifying the output of the optimized element, you need to verify whether the output contains ellipsis: If there is no ellipsis (as mentioned above, it can be replaced by other punctuation marks that are not frequently used in electronic medical records), then determine whether the output content is a substring in the original text of the electronic medical record. If so, it is determined to be in a correct format; if not, it is determined to be in an incorrect format.
[0054] If there is an ellipsis, whether the two parts before and after the ellipsis are both unique substrings in the original electronic medical record text, if so, it is judged that the format is correct, if not, it is judged that the format is incorrect.
[0055] For incorrect formats, the optimized prompt words provided with or without ellipsis do not appear in the original electronic medical record text: If it is a regular element, it returns to re-call the large language model generation (in the retry phase, different temperature and top k of the large model can be set to output different values).
[0056] If it is an optimized element, it is temporarily converted into a regular element (that is, using regular prompt words) and the large language model is called again to generate an output with regular elements and the original text of the electronic medical record as parameters.
[0057] Step 034, convert the output content of the large language model for the optimized prompt word into normal content, and execute steps 06 to 07. When this step is executed, if the output corresponding to the optimized element is in the correct format, and if there is no ellipsis in the output content, this output is used as the final output. If there is an ellipsis in the output content, find the position of the two parts before and after the ellipsis, and intercept the string in this range, and use this as the final output. For example: "5 years ago, I started to...no obvious changes" After this step is executed, the final output content is "5 years ago, I started to have repeated palpitations, chest tightness, fatigue, and shortness of breath. They are easy to occur after activities and can be relieved by rest. They can last for dozens of minutes each time. There is no blackout and syncope, no cough and sputum, no hemoptysis or blood in the sputum. The above symptoms have recurred for 4+ years. They have been diagnosed in our hospital as "1. Coronary heart disease; 2. Primary hypertension level 3 is very high risk; 3. Old cerebral infarction; 4. Type 2 diabetes; 5. Deep vein thrombosis of the right lower limb; 6. Chronic renal failure" and was discharged from the hospital after treatment (the specific diagnosis and treatment process is unknown). The above symptoms recurred without obvious cause 3 days ago The symptoms worsen, and may occur several times a day, each lasting dozens of minutes. After taking "Jiusin Pills", the symptoms can be slightly relieved, accompanied by chest tightness and discomfort, mainly located in the lower part of the sternum, no paroxysmal dyspnea at night, no pink foamy sputum, no chills and fever, no hot flashes and night sweats, no blackouts and syncope. Today, the patient did not show significant improvement after taking "Jiusin Pills". For further diagnosis and treatment, the emergency department admitted him to our department with "coronary atherosclerotic heart disease". Since the onset of the disease, the patient has been in poor spirits, has a general diet, poor sleep, decreased physical strength, no abnormal urination and defecation, and no significant change in weight. "That is, the content omitted by the ellipsis is supplemented with a complete information sentence readable by medical staff.
[0058] Step 06, judge whether there is a next element according to the type configuration corresponding to the received electronic medical record text. If the next element exists in the type configuration corresponding to the received electronic medical record text, iterate steps 030 to 06 with the next element. If the next element does not exist in the type configuration corresponding to the received electronic medical record text, execute step 07. For a received electronic medical record text, it can be known that it has multiple elements according to its type configuration. In order to fully understand the information contained in the received electronic medical record text, it is necessary to perform several iterations to achieve a comprehensive output of the received electronic medical record text, and distinguish the elements during output to provide different processing methods for different types of elements, so as to achieve the purpose of improving output efficiency.
[0059] Step 07: Integrate each element in the type configuration corresponding to the received electronic medical record text and return it in a response format. For example, in json format: { Name: Zhang XX Gender: X Age: XX years old History of present illness:...... Past history:...... Family History:...... ...... }.
[0060] In some other embodiments, an electronic device includes at least one processor and a memory, wherein the memory is used to store a computer program. The processor is used to execute the computer program stored in the memory, so that the processor executes a method for extracting post-structured information from electronic medical records based on a large language model.
[0061] Some other embodiments provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, controls a device where the storage medium is located to execute a method for extracting post-structured information from electronic medical records based on a large language model.
[0062] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for extracting post-structured information from electronic medical records based on a large language model, characterized in that: Including model training and model application; Model training is to fine-tune the general large language model for the electronic medical record post-structuring task through the large language model retraining method, and obtain the electronic medical record post-structuring model; The steps of model training are: Step a, post-structurally annotating the input electronic medical record text according to the elements of the medical record type; Step b, processing each element of the marked electronic medical record data separately; When processing each element of the marked electronic medical record data in step b, it includes classifying each element of the marked electronic medical record data and processing the original content of each element of the marked electronic medical record data according to the type of the element; Step c, organizing each processed element into training sample data; Step d, training / fine-tuning the large language model with training sample data; The model application is to use the fine-tuned / trained electronic medical record post-structured model for information extraction.
2. The method for extracting post-structured information from electronic medical records based on a large language model according to claim 1, characterized in that: When classifying and processing each element of the marked electronic medical record data in step b, the content length of the element of the marked electronic medical record data is used as a condition: If the content length of the marked electronic medical record element is greater than or equal to a predetermined value, the element is identified as an optimized element, and the original content text of the optimized element is intercepted to obtain the optimized content text of the optimized element; If the content length of the marked electronic medical record element is less than a predetermined value, the element is deemed to be a regular element, and the content of the element is not processed, so that the content of the regular element is the original content text of the corresponding element in the electronic medical record text.
3. The method for extracting post-structured information from electronic medical records based on a large language model according to claim 2, characterized in that: When intercepting the original content text of the optimized element: The first n characters in the original content text corresponding to the optimized element in the electronic medical record text are intercepted as the first part of the optimized content text; The last n characters of the original content text corresponding to the optimized element in the electronic medical record text are intercepted as the second part of the optimized content text; The format of the optimized content text of the optimized element is: "first part" + "punctuation" + "second part".
4. The method for extracting post-structured information from electronic medical records based on a large language model according to claim 3, characterized in that: In step c, each element after processing is organized into one or two training sample data according to whether the element is processed in step b; If the element is an optimized element, the element has two pieces of training sample data, one piece of training sample data corresponds to the original content text to which the optimized element belongs, and the other piece of training sample data corresponds to the optimized content text to which the optimized element belongs; If the element is a regular element, the element has a piece of training sample data, and the training sample data corresponds to the original content text to which the regular element belongs.
5. The method for extracting post-structured information from electronic medical records based on a large language model according to claim 1, characterized in that: The steps of model application include: Step 01, receiving electronic medical record text as input; Step 02, according to the type configuration corresponding to the received electronic medical record text, taking out one of the elements in the type configuration, and identifying the element to distinguish whether the element is a regular element or an optimized element; If the element obtained in step 02 is a normal element, then execute step 030, step 040, step 050, step 06, and step 07 in sequence; Step 030, using the names of the elements retrieved in step 02 to organize and form conventional prompt words; Step 040, calling a large language model for the conventional prompt words in step 020 and the electronic medical record text provided in step 01; Step 050, verifying whether the output corresponding to the conventional prompt word meets the requirements; If it meets the requirements, go to step 06; If it does not meet the requirements, execute step 030; Step 06, judging whether there is a next element according to the type configuration corresponding to the received electronic medical record text; If the type configuration corresponding to the received electronic medical record text has a next element, the next element is used as the element to be identified, and the process jumps to the identification step of step 02 to continue the process; If the next element does not exist in the type configuration corresponding to the received electronic medical record text, execute step 07; Step 07, integrate each element in the type configuration corresponding to the received electronic medical record text and return it in a response format.
6. The method for extracting post-structured information from electronic medical records based on a large language model according to claim 5, characterized in that: If the element obtained in step 02 is an optimized element, then execute steps 031, 032, 033, and 034; Step 031, using the names of the elements taken out in step 02 to organize and form optimized prompt words; Step 032, calling a large language model for the prompt words optimized in step 031 and the electronic medical record text provided in step 01; Step 033, verifying whether the output content of the large language model for the optimized prompt word meets the requirements; If the output content of the large language model for the optimized prompt word meets the requirements, step 034 is executed; If the output content of the large language model for the optimized prompt word does not meet the requirements, the element obtained in step 02 is determined to be a regular element, and steps 030 to 07 are executed with the element obtained in step 02 as the regular element; Step 034, convert the output content of the large language model for the optimized prompt word into a normal value, and execute steps 06 to 07.
7. An electronic device comprising at least one processor and a memory; the memory is used to store a computer program; characterized in that: The processor is used to execute the computer program stored in the memory so that the processor executes the method for extracting post-structured information from electronic medical records based on a large language model as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the device where the storage medium is located is controlled to execute the method for extracting post-structured information from electronic medical records based on a large language model as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Electronic medical record text named entity recognition method based on pre-trained language model
CN110705293A
Electronic medical record construction method and device
CN111415747A
Construction method of structured electronic medical record, electronic equipment and storage medium
CN115424692A
Patient medical record data screening method and device based on information extraction and medium
CN116994694A
Medical record data processing method and device, terminal equipment and storage medium
CN118571391A