Traditional Chinese medicine case text automatic extraction method and system, electronic equipment and storage medium
By analyzing and extracting HTML documents from medical papers, and using large models to analyze and verify, efficient and automatic extraction of traditional Chinese medicine medical document text is achieved, solving the problems of low efficiency and insufficient accuracy of information extraction in the existing technology.
Patent Information
- Application Number
- CN202510079245.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-05-06
AI Technical Summary
It is difficult for the prior art to efficiently and automatically extract traditional Chinese medicine medical texts, especially in medical literature, where there are problems with the accuracy and efficiency of information extraction.
By obtaining medical paper documents in HTML format, analyzing and extracting key information, analyzing the text using a large model, generating the initial extraction results of the medical case, and performing integrity checks and authenticity checks to ensure the authenticity and integrity of the extraction results.
It realizes efficient automatic extraction of traditional Chinese medicine medical texts, solves the problem of low manual extraction efficiency, and ensures the accuracy and completeness of the extraction results through the verification mechanism, avoiding error messages caused by the "illusion" of the big model.
Smart Images

Figure CN119938886A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, system, electronic device and storage medium for automatically extracting traditional Chinese medicine medical case texts. Background Art
[0002] As an important carrier of clinical practice and theoretical research, TCM medical records record in detail the diagnostic thinking and treatment process of different doctors when facing diseases. Its content covers a comprehensive review of the patient's medical history, an accurate description of the current condition, and a detailed description of the treatment plan, including but not limited to the treatment methods used, the prescriptions issued, the specific medication conditions, and the previous medication history. In the academic inheritance and clinical practice of TCM, medical records are not only the accumulation and summary of medical experience, but also a valuable resource for later scholars to learn and study. Through in-depth analysis of medical records, we can gain insight into the diagnosis and treatment thinking of doctors, understand the subtlety of their syndrome differentiation and treatment, analyze the rules of medication, and the rules of acupuncture point selection, providing theoretical and practical dual guidance for the prevention, diagnosis and treatment of diseases. For example, Chen Shuguang and other researchers conducted data mining and analysis on a large number of TCM medical records, clarified the TCM diagnostic characteristics of neurodermatitis, analyzed the mechanism of the disease, and summarized the internal rules of treatment and medication, providing a more accurate reference for clinical practice. However, due to the protection of patient privacy, it is difficult for researchers to directly obtain medical case data from outpatient or hospital databases. This situation has led many scholars to turn their attention to published journal articles to collect medical information related to the target disease. However, this process is like looking for a needle in a haystack. It is not only time-consuming but also inefficient to accurately extract the target medical case from the vast literature.
[0003] The currently popular large language models have been applied to various fields including medicine due to their powerful natural language processing capabilities. The most popular large model product, chatGPT, attracted more than 100 million users within two months of its launch, and the average weekly visits reached 200 million in September 2024. With the continuous development of large language models, their application potential in many fields has gradually emerged, especially in the fields of medical, education and cultural research. In addition, large language models are also used to automate system evaluation to help researchers improve their work efficiency, although the technology is still in its early stages and requires further development and verification. Although large model products are widely sought after, their effectiveness and reliability issues cannot be ignored, especially in medical information extraction, due to the complexity and diversity of medical literature information, which makes the accuracy of information extraction an urgent problem to be solved. Specifically, large models sometimes generate texts that seem to be true and logically coherent, but in fact hide factual errors or misleading information. This phenomenon is called "hallucination". This "hallucination" is not limited to deviations in factual details, but may also involve the lack of logical self-consistency, thereby affecting the authenticity of its processing results on the text. Summary of the invention
[0004] Based on this, it is necessary to provide a method, system, electronic device and storage medium for automatically extracting traditional Chinese medicine medical case texts in response to the above technical problems.
[0005] A method for automatically extracting TCM medical records, the method comprising: Get the medical paper document in HTML format.
[0006] Medical paper documents are parsed and extracted, and the extracted paper titles, abstracts, texts, and citation data are stored in the title, abstract, content, and citation columns of the paper table in the database, respectively.
[0007] Generate prompts for medical record extraction based on the data in the content column and the instruction template.
[0008] The large model is used to analyze and process the current paper text in the content column, and output it according to the structure set by the prompt to obtain the initial extraction result of the medical case.
[0009] If the initial extraction result of the medical record is not empty, the initial extraction result of the medical record is checked for integrity to obtain the medical record result after the integrity check.
[0010] If the medical record result after integrity verification is not empty, the medical record result after integrity verification is verified for authenticity to obtain the verified extraction result.
[0011] If the verified extraction result is not empty, the extraction round count value is set to zero, the verified extraction result is stored in the database, and the verified extraction result is removed from the current paper text, and the next round of extraction is continued for the current paper text.
[0012] If the initial extraction result of the medical record is empty, the medical record result after integrity verification is empty, or the extraction result after verification is empty, the current paper text will be extracted again until the extraction round count reaches the preset threshold, and then the next paper text in the content column will be processed.
[0013] In one embodiment, the medical paper document is parsed and extracted, and the extracted paper title, abstract, text and citation data are stored in the title, abstract, content and citation columns of the paper table in the database, respectively, including: Construct an XPath parsing expression based on the structure of medical paper documents.
[0014] XPath parsing is used to parse medical paper documents, and the paper title, abstract, text and citation data are extracted from the parsing results.
[0015] Store the paper title, abstract, main text and citation data in the title, abstract, content and citation columns of the paper table in the database respectively.
[0016] In one embodiment, a prompt for extracting medical records is generated based on the data in the content column and the instruction template, including: According to the results of the preliminary experiment, a command template for medical case extraction was constructed, and the command template and the data in the content column were merged to generate prompts for medical case extraction. The command template is: analyze the text content in the following {}, and output "null" if there is no medical case or no complete medical case; if there is a complete medical case, copy the complete medical case information that meets the requirements in the following {} text; the requirements include: ensure that all lists, indents, line breaks and bullet points in the original text are included; all copied content must match the original text exactly, and ensure that every word output is consistent with the original text; if there are multiple medical cases in the text, only the first complete medical case including any proper nouns and technical details and press or notes is extracted; the complete medical case is a continuous text and must contain patient information. It should also include all relevant symptom descriptions, diagnoses, treatment plans, prescription drugs and dosages, treatment processes and results, and use "press" or "notes" as a sign of the end of the medical case; strictly follow the requirements to output, only output the medical case text that meets the requirements, and do not output any other explanatory text and non-medical case text.
[0017] In one embodiment, a large model is used to analyze and process the current paper text in the content column, and output it according to the structure set by the prompt to obtain the initial extraction result of the medical case, including: The large model is used to analyze and process the current paper text in the content column. If the medical case text is recognized, the recognized medical case text is output in JSON format according to the structure set by the prompt, and the recognized medical case text is used as the initial medical case extraction result; if the current paper text does not contain medical case content, the initial medical case extraction result is empty and is output in JSON format {"data": null}.
[0018] In one embodiment, if the initial medical record extraction result is not empty, the initial medical record extraction result is checked for integrity, and the medical record result after the integrity check is obtained, including: Four variables were defined to quantify the accuracy and completeness of medical record extraction; the four variables included front redundancy, front missingness, back redundancy, and back missingness.
[0019] The paragraph mark is used as a separator to convert the original current paper text and the initial extraction results of medical records into a text list W_list and a medical record list Y_list.
[0020] Match the index values of the beginning and ending positions of the medical case in the medical case list to obtain the beginning index and the ending index of the medical case.
[0021] The medical case integrity is judged based on the medical case start index, medical case end position index and the preset judgment formula; the preset judgment formula is:
[0022] Among them, result1 is the medical record result after integrity verification, result r_m The result is missing at the back. r_r For rear redundancy, result f_m The front part is missing, result f_r is the front redundancy, result0 is the initial extraction result of the medical records, Y i For the beginning index of medical records, Y j It is the index of the end position of the medical record, and null means it is empty.
[0023] If no medical record is matched, the medical record result after integrity verification is empty.
[0024] If the matched medical record is an incomplete medical record, the initial extraction result of the medical record is processed by completing the missing information and eliminating redundant content to obtain the medical record result after integrity verification.
[0025] If the matched medical record is a complete medical record, the initial extraction result of the medical record will be used as the medical record result after integrity verification.
[0026] In one embodiment, if the matched medical record is an incomplete medical record, the initial extraction result of the medical record is processed by completing the missing information and removing the redundant content to obtain the medical record result after integrity verification, including: If the initial extraction result of the medical record has front redundancy or back redundancy, the medical record list Y_list is sliced to eliminate the redundancy and retain the complete medical record text, thereby obtaining the medical record result after integrity verification.
[0027] If the initial extraction results of medical records are both missing and redundant, first match the missing parts in the text list W_list through the missing edges, and then splice the matched missing parts with the slices of the medical record list Y_list to obtain the medical record results after integrity verification.
[0028] If there is a unilateral missing in the initial extraction result of the medical record, the missing part is matched in the corresponding direction according to the position of the missing edge in the text list W_list, and then the matched missing part is spliced with the original medical record list to obtain the medical record result after integrity verification; unilateral missing refers to front missing or back missing.
[0029] In one embodiment, if the verified extraction result is not empty, the extraction round count value is set to zero, the verified extraction result is stored in the database, and the verified extraction result is removed from the current paper text, and the next round of extraction is continued for the current paper text, including: If the extracted result after verification is not empty: Set the draw round count value to zero.
[0030] The current paper text and the medical case results after integrity verification are deeply cleaned, all Chinese and English punctuation marks and line breaks are removed, and converted into strings in plain text form to obtain the paper text string and the medical case result string.
[0031] If the medical record result string is a continuous subset of the paper text string, the medical record result after integrity verification is used as the verified extraction result; otherwise, null is used as the verified extraction result.
[0032] A system for automatically extracting medical records from traditional Chinese medicine, the system comprising: The medical paper document acquisition module is used to obtain medical paper documents in HTML format.
[0033] The HTML parsing module is used to parse and extract medical paper documents, and store the extracted paper title, abstract, text and citation data into the title, abstract, content and citation columns of the paper table in the database respectively.
[0034] The automatic extraction module of medical case text is used to generate prompts for medical case extraction based on the data and instruction templates in the content column; a large model is used to analyze and process the current paper text in the content column, and output it according to the structure set by the prompt to obtain the initial extraction result of the medical case.
[0035] The medical record integrity verification module is used to perform integrity verification on the initial medical record extraction result if the initial medical record extraction result is not empty, and obtain the medical record result after integrity verification.
[0036] The medical record authenticity verification module is used to verify the authenticity of the medical record result after the integrity verification if it is not empty, and obtain the verified extraction result.
[0037] The medical record extraction progress control module is used to set the extraction round count value to zero if the extracted result after verification is not empty, store the verified extraction result in the database, and remove the verified extraction result from the current paper text, and continue to perform the next round of extraction on the current paper text; if the initial extraction result of the medical record is empty, the medical record result after integrity verification is empty, or the extracted result after verification is empty, the current paper text is extracted again until the extraction round count value reaches the preset threshold, and then start processing the next paper text in the content column.
[0038] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for automatically extracting traditional Chinese medical case texts when executing the computer program.
[0039] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for automatically extracting traditional Chinese medical case texts.
[0040] The above-mentioned method, system, electronic device and storage medium for automatic extraction of TCM medical case texts include: obtaining a medical paper document in HTML format; parsing the medical paper document to extract the initial extraction result of the medical case, and then verifying the integrity and real existence of the initial extraction result of the medical case to obtain the verified extraction result. This method solves the problems of difficulty in obtaining medical cases and low efficiency of manual extraction; in addition, the method uses medical case integrity verification and extraction result real existence verification to ensure the authenticity and integrity of the extraction result, effectively avoiding the generation of erroneous or false medical case information due to the "illusion" factor of the large model, and ensuring that the extracted result is the medical case text that actually exists in the journal paper text. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A schematic diagram of a process of automatically extracting TCM medical case texts in one embodiment; Figure 2 A flowchart of automatic data extraction process of TCM medical case texts in one embodiment; Figure 3 This is a schematic diagram of a process flow for controlling the progress of extracting Chinese medical records in an embodiment; Figure 4 is a comparison chart of accuracy, recall and F1 parameters of different models under the influence of result verification strategies in another embodiment; Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] In one embodiment, Figure 1 , Figure 2 As shown, a method for automatically extracting TCM medical case texts is provided, the method comprising the following steps: Step 100: Obtain a medical paper document in HTML format.
[0044] Specifically, the journal article file in HTML format uploaded by the user is obtained, the HTML document is automatically parsed, and the complete TCM medical case text contained therein is extracted and batch output as the processing result.
[0045] This method focuses on journal text data in HTML format as the core research object, aiming to explore and optimize the method of automatic extraction of TCM medical case information using large models. In view of this, this method selects the SuperStar Journal Full-text Database as the main source of data acquisition, which has rich resources and wide coverage. On this basis, we further screened out journal data that contains medical cases and can provide HTML full-text format to ensure the accuracy and applicability of the research materials, laying the foundation for subsequent in-depth analysis and model training.
[0046] Step 102: parse and extract the medical paper document, and store the extracted paper title, abstract, text and citation data into the title, abstract, content and citation columns of the paper table in the database respectively.
[0047] Step 104: Generate prompts for medical record extraction based on the data in the content column and the instruction template.
[0048] Specifically, after completing the data preparation, the program calls the data in the content column and combines it with the preset instruction template framework to jointly generate a prompt for extracting medical records.
[0049] Step 106: Use the large model to analyze and process the current paper text in the content column, and output it according to the structure set by the prompt to obtain the initial extraction result of the medical case.
[0050] Specifically, after the prompt is submitted to the big model, the big model analyzes and processes the text content according to the template requirements, and outputs it according to the structure set by the prompt.
[0051] Step 108: If the initial extraction result of the medical records is not empty, the initial extraction result of the medical records is integrity checked to obtain the medical records result after integrity check.
[0052] Specifically, if the initial extraction result of the medical record is not empty, then check whether the initial extraction result of the medical record is a medical record and whether there is any missing or redundancy, and perform operations such as eliminating redundancy and supplementing missing information based on the judgment result, so as to ensure that the medical record result result1 after integrity verification is a complete medical record text.
[0053] Step 110: If the medical record result after integrity verification is not empty, then the medical record result after integrity verification is verified for authenticity to obtain a verified extraction result.
[0054] Specifically, a fuzzy matching algorithm of a string is used to determine whether the medical record result result1 after integrity verification is truly derived from the processed text.
[0055] Step 112: If the verified extraction result is not empty, the extraction round count value is set to zero, the verified extraction result is stored in the database, and the verified extraction result is removed from the current paper text, and the next round of extraction is continued for the current paper text.
[0056] Specifically, if the extracted result after verification is not empty, the final result and the citation information corresponding to the text generating the result are stored in the case column and citation column of the MedicalCase table in the database, otherwise the extracted result is discarded.
[0057] Step 114: If the initial extraction result of the medical record is empty, the medical record result after integrity verification is empty, or the extraction result after verification is empty, the current paper text is extracted again until the extraction round count reaches the preset threshold, and then the next paper text in the content column is processed.
[0058] Specifically, based on the extraction result, it is decided to remove the extraction result from the original document to proceed to the next extraction task or to end the processing of the document and proceed to the processing of the next document data until all the data is processed.
[0059] The purpose of controlling the progress of medical case extraction is to control the progress of medical case text extraction and the reading of the original text content being processed, ensuring that each algorithm module cooperates efficiently to extract all medical case texts in the processed text without duplication or omission.
[0060] In order to ensure that the medical records contained in the content text will not be extracted repeatedly, thereby causing a waste of computing resources, this method proposes: when an extraction result is confirmed as a complete medical record text after being processed and verified by the "medical record integrity verification algorithm" and the "medical record authenticity verification algorithm", the extraction result result will be removed from the processed text content, and the removed text will be used as the new content value for a new round of extraction. When the extraction result is null, it means that the complete medical case text was not extracted after being processed by the large model during the previous round of extraction. The possible reasons are as follows: ① The medical case text no longer exists in the processed text; ② The medical case text exists in the processed text, but the large model has processing errors and fails to identify and extract the medical case; ③ Because the large model omits the output of the extraction result to ensure output efficiency, the medical case authenticity verification algorithm determines it as null. Among the above three reasons, except ① all the medical cases contained in the content have been completely extracted, the other two situations do not truly extract all the medical cases contained in the content. Therefore, in order to extract all the medical cases contained in the content as much as possible and avoid low recall rates due to model processing errors, the medical case extraction progress control process is as follows. Figure 3 shown.
[0061] In the above-mentioned method for automatic extraction of TCM medical case text, the method includes: obtaining a medical paper document in HTML format; parsing the medical paper document, extracting the initial extraction result of the medical case, and then verifying the integrity and real existence of the initial extraction result of the medical case to obtain the verified extraction result. This method solves the problem of difficulty in obtaining medical cases and low efficiency of manual extraction; in addition, the method uses medical case integrity verification and extraction result real existence verification to ensure the authenticity and integrity of the extraction result, effectively avoiding the generation of erroneous or false medical case information due to the "illusion" factor of the large model, and ensuring that the extracted result is the medical case text that actually exists in the journal paper text.
[0062] In one embodiment, step 102 includes: constructing an XPath parsing expression according to the structure of the medical paper document; parsing the medical paper document using the XPath parsing expression, and extracting the paper title, abstract, main text and citation data from the parsing result; and storing the paper title, abstract, main text and citation data in the title, abstract, content and citation columns of the paper table in the database respectively.
[0063] Specifically, this method uses Python's Xpath library to parse HTML paper documents that may contain medical records. An Xpath parsing expression is written based on the paper title, abstract, paragraph structure, etc. in the processed HTML. The text content of "paper title", "abstract", "main text" and "citation data" are parsed and extracted from the HTML and stored in the title, abstract, content and citation columns of the paper table in the database respectively for subsequent use.
[0064] In one embodiment, step 104 includes: constructing an instruction template for medical case extraction according to the preliminary experimental results, merging the instruction template with the data in the content column, and generating a prompt for medical case extraction. The instruction template is: analyzing the text content in the following {}, outputting "null" if there is no medical case or no complete medical case; if there is a complete medical case, copying the complete medical case information that meets the requirements in the following {} text; the requirements include: ensuring that all lists, indents, line breaks and bullet points in the original text are included; all the copied content must completely match the original text, ensuring that every word output is consistent with the original text; if there are multiple medical cases in the text, only the first complete medical case including any proper nouns and technical details and press or notes is extracted; the complete medical case is a continuous text and must contain patient information and should also include all relevant symptom descriptions, diagnoses, treatment plans, prescription drugs and dosages, treatment processes and results, and other detailed information, and use "press" or "notes" as a sign of the end of the medical case; output strictly in accordance with the requirements, only output the medical case text that meets the requirements, and do not output any other explanatory text and non-medical case text.
[0065] Specifically, based on the results of the preliminary experiment, a command template was pre-designed to help the big model accurately extract medical case information from the text. When the text content to be processed is input into the algorithm module, the module will fuse the command template with the text information to construct a prompt, which is then submitted to the big model.
[0066] In one of the embodiments, step 106 includes: using a large model to analyze and process the current paper text in the content column; if a medical case text is identified, the identified medical case text is output in JSON format according to the structure set by the prompt, and the identified medical case text is used as the initial extraction result of the medical case; if the current paper text does not contain medical case content, the initial extraction result of the medical case is empty, and {"data": null} is output in JSON format.
[0067] Specifically, after receiving the prompt, the big model analyzes and processes the text content according to the template requirements and outputs it according to the structure set by the prompt. Specifically, once the big model recognizes the medical case text, it will output the extracted medical case information in JSON format; if the processed text does not contain medical case content, it will output {"data": null} in JSON format. Finally, the module parses the response result of the big model and obtains the extraction result result0 to ensure the integrity and efficiency of the information extraction process. The pseudo code of the automatic extraction algorithm of medical case text is: Input: paper text; Output: initial extraction result of medical records result0; 1 Based on the results of the preliminary experiment, the instruction template for medical record extraction is constructed as follows: The text in the following identifier {} may contain TCM medical records. Please analyze the text content. If there is a complete medical record, copy the complete medical record information in the text in the following identifier {} that meets the following requirements; 1) Make sure to include all lists, indents, line breaks, and bullet points from the original text; 2) All the copied content must completely match the original text, ensuring that every word in the output is consistent with the original text, can be found in the original text and is the content of the medical record; 3) If there are multiple medical records in the text, only the first complete medical record including any proper nouns and technical details as well as notes or annotations was extracted; 4) A complete medical record is a continuous text and must contain patient information. It should also include all relevant symptom descriptions, diagnoses, treatment plans, prescription drugs and dosages, treatment processes and results, and other detailed information. "by" or "by" is used as a sign of the end of the medical record. If there is no medical record or no complete medical record, "null" is output. The output structure is as follows {'data':' '}; Please strictly follow the above requirements for output, and only output the medical case texts that meet the requirements. Do not output any other explanatory texts or non-medical case texts.
[0068] 2 Prompt = instruction template + content; 3 response = LLM (Prompt); 4 result0= json.loads(response)["data"]; 5 return result0.
[0069] In one embodiment, step 108 includes: defining four variables for quantifying the accuracy and completeness of the medical case extraction process; wherein the four variables include: front redundancy, front deletion, rear redundancy and rear deletion; using paragraph markers as separators, converting the original current paper text and the initial extraction results of the medical case into a text list W_list and a medical case list Y_list; matching the index values of the beginning and ending positions of the medical case in the medical case list to obtain the beginning index of the medical case and the ending position index of the medical case; judging the completeness of the medical case according to the beginning index of the medical case, the ending position index of the medical case and a preset discriminant formula; wherein the preset discriminant formula is:
[0070] Among them, result1 is the medical record result after integrity verification, result r_m The result is missing at the back.r_r For rear redundancy, result f_m The front part is missing, result f_r is the front redundancy, result0 is the initial extraction result of the medical records, Y i For the beginning index of medical records, Y j It is the index of the end position of the medical record, and null means it is empty.
[0071] If no medical record is matched, the medical record result after integrity verification is empty; if the matched medical record is an incomplete medical record, the initial extraction result of the medical record is processed by completing the missing information and eliminating redundant content to obtain the medical record result after integrity verification; if the matched medical record is a complete medical record, the initial extraction result of the medical record is used as the medical record result after integrity verification.
[0072] Specifically, front redundancy, denoted as (result f_r )): refers to the additional content that does not belong to the medical case text and is included at the beginning of the extraction result. Front missing, denoted as ( result f_m )): It means that at the beginning of the extraction results, there are fragments belonging to the medical case text that cannot be correctly identified and extracted, reflecting the potential omission of medical case information at the starting point. Rear redundancy, denoted as (result r_r )): refers to the end part of the extraction result, that is, after the medical case text, such as after the comment or note, which contains additional text that does not belong to the specific medical case, reflecting the accuracy of the algorithm in determining the end point of the medical case.
[0073] Rear missing, denoted as ( result r_m )): At the end of the indicator extraction results, some text that should belong to the medical record was not completely extracted, revealing the potential omission of medical record information at the end point.
[0074] When the HTML format medical paper document parsing algorithm module parses and stores the text content into the database, and when the medical case text automatic extraction algorithm module uses the large model to extract possible medical cases, the text is extracted and stored together with the paragraph mark. Therefore, the paragraph mark is used as a separator to convert the original text content and the extraction result result0 into a text list W_list and a medical case list Y_list. Then, regular expression technology is used to accurately identify whether Y_list contains the start mark (i.e., the patient's basic information) and the end mark (i.e., the comment) of the medical record, and determine the specific position of these elements in Y_list, i.e., the index Y i and Y j Then, according to Y i and Y j The algorithm combines the value of and the preset discriminant formula to determine whether the extracted text constitutes a complete medical record. If the text is found to be incomplete, the algorithm completes it into a complete medical record text by completing the missing information and removing redundant content.
[0075] The pseudo code of the medical record integrity verification algorithm is: Input: the original medical record result list Y_list extracted by the large model; Output: medical record result result1 after integrity check; 1. Match the index values of the beginning and end of the medical case in the medical case list; 2. Get the maximum index value of the medical record list; 3if the case starts with the first element of Y_list and ends with the last element of Y_list: result1= result0; 4 elif the beginning and end of the medical case are not matched: times = times + 1; 5 elif there is front redundancy or rear redundancy: result1=slice Y_list; 6 elif There is redundancy in the front part and missing in the back part: Y_list=slice Y_list; Get the index value of the last element of the medical record list Y_list in the text list W_list; Match the missing part in the text list W_list by index value: result1= Y_list is concatenated with the matched rear deletion; 7 elif There is a trailing deletion: Get the index value of the last element of the medical record list Y_list in the text list W_list; Match the missing part in the text list W_list by index value: result1= Y_list is concatenated with the matched rear deletion; 8 elif there is a leading deletion: Get the index value of the first element of the medical record list Y_list in the text list W_list; Match the leading missing part in the text list W_list by index value: result1=the matched front missing part is concatenated with Y_list; 9 elif There is a leading deletion and trailing redundancy: Get the index value of the first element of the medical record list Y_list in the text list W_list; Match the leading missing part in the text list W_list by index value: result1=the matched front missing part is concatenated with the slice of Y_list; 10 return result1.
[0076] In the 3rd line of the medical case integrity verification algorithm, if the extraction result is that the beginning of the medical case is the first element of the medical case list Y_list and the end of the medical case is the last element of the medical case list Y_list, that is, the extraction result starts with the patient information description and ends with a note or a comment, according to the complete medical case structure proposed by Li Panfei et al., the extraction result is considered to be a complete medical case. In the 4th line of the algorithm, if the extraction result does not match the beginning of the medical case or the end of the medical case, it is considered that the extraction result is not a medical case text and is directly discarded. In the 5th line of the algorithm, if the extraction result has front redundancy or rear redundancy, the extraction result is sliced to eliminate redundancy and retain the complete medical case text. In the 7th and 8th lines of the algorithm, if there is a unilateral missing in the medical case, the missing part is matched forward or backward according to the position of the missing edge in the text list W_list, and then spliced with the original medical case list to obtain a complete medical case. In lines 6 and 9 of the algorithm, if the extraction results are both missing and redundant, the missing parts are first matched in the text list W_list through the missing edges and then spliced with the slices of the medical record list Y_list.
[0077] In one of the embodiments, if the matched medical case is an incomplete medical case, the initial extraction result of the medical case is processed by completing the missing information and eliminating redundant content to obtain the medical case result after integrity verification, including: if the initial extraction result of the medical case has front redundancy or back redundancy, the medical case list Y_list is sliced to eliminate redundancy and retain the complete medical case text to obtain the medical case result after integrity verification; if the initial extraction result of the medical case has both missing and redundancy, the missing part is first matched in the text list W_list through the missing edge, and then the matched missing part is spliced with the slice of the medical case list Y_list to obtain the medical case result after integrity verification; if the initial extraction result of the medical case has a unilateral missing, the missing part is matched in the corresponding direction according to the position of the missing edge in the text list W_list, and then the matched missing part is spliced with the slice of the medical case list Y_list to obtain the medical case result after integrity verification; the unilateral missing is the front missing or the back missing.
[0078] In one embodiment, step 112 includes: if the extracted result after verification is not empty: setting the extraction round count value to zero; performing deep cleaning on the current paper text and the medical case result after integrity verification, removing all Chinese and English punctuation marks and line breaks, converting them into strings in plain text form, and obtaining a paper text string and a medical case result string; if the medical case result string is a continuous subset of the paper text string, then using the medical case result after integrity verification as the extracted result after verification; otherwise, using null as the extracted result after verification.
[0079] Specifically, the verification of the true existence of medical records refers to whether the medical record result result1 after the integrity check undoubtedly exists in the processed original text, so as to ensure that the final extraction result is not only truly derived from the processed text, but also has not been erroneously tampered with by the model. At the same time, it is also committed to ensuring the integrity of the extraction results, avoiding unnecessary cutting or omission of the original medical record information due to the pursuit of model output efficiency, thereby ensuring the authenticity and integrity of the medical record information extraction, and effectively avoiding the risk of the model generating false or incomplete information. In order to achieve the above requirements, this method innovatively proposes a verification algorithm based on string fuzzy matching, which is used to accurately determine whether the extraction result result1 is a continuous character in the processed text content, thereby ensuring the accuracy and completeness of the extracted information.
[0080] Considering that due to the model's understanding bias, line breaks may be lost and Chinese and English punctuation marks may be changed when the extraction results are output, in order to ensure that the algorithm module can accurately determine whether the extraction results are truly derived from the processed text, this method takes the following preprocessing measures: deep cleaning of the original text content and the extraction result result1, removing all Chinese and English punctuation marks and line breaks, and converting them into plain text strings clear_content and clear_result. Then, by determining whether the string clear_result is a continuous subset of the string clear_content, it is determined whether the extraction result actually exists in the processed text. The pseudo code of the medical record authenticity verification algorithm is: Input: medical record result result1 after integrity check; Output: The extracted result after verification; 1 def string deep cleaning (string): return Remove all Chinese and English punctuation marks and line breaks from string; 2 clear_content=string deep cleaning (paper text content string) clear_result=string deep cleaning (extract result result1 string) 3 ifclear_resultin clear_content: result = result1; else: result=null 4 return result.
[0081] In the medical case authenticity verification algorithm, when it is determined that the plain text string clear_result is a continuous subset of the string clear_content, the extraction result is considered to be a continuous and complete text in the processed text, that is, the medical case text to be extracted is the extraction result result1 of the above process; otherwise, it is considered that the above process has not extracted the complete medical case text, that is, the extraction result is null. It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0082] In a verification example, in order to more effectively evaluate the performance of the algorithm, this example uses three models, yi-large, Llama-3.1-70BInstruct, and glm4-9b-chat, as test models, and sets up an experimental group and a control group for comparative study. A result verification strategy is added to the experimental group to perform integrity and true existence judgments on the extraction results, and the extraction results are reviewed and corrected before being stored in the result database. The control group only uses the model for extraction without verifying the results and directly stores them in the result database, and then manually judges the extraction results of each group uniformly according to the result judgment criteria.
[0083] yi-large is a closed-source large-scale language model developed by 01.AI, designed to support multi-scenario applications in both Chinese and English. The model uses a modified Transformer architecture and introduces a grouped-query attention mechanism to optimize processing speed and reduce computing costs. In addition, yi-large's training data includes a large amount of high-quality Chinese and English bilingual corpora, which have been strictly deduplicated and quality filtered to ensure that the model's language generation has high accuracy and coherence.
[0084] Llama 3.1 is an open source large model released by Meta, which shows great advantages in common sense, mathematics, tool use and multilingual translation. The model uses synthetic data generation and model distillation to achieve the improvement and training of smaller models. Llama 3.1 supports longer context length (128K) and has stronger overall reasoning capabilities.
[0085] glm4-9b-chat is an open source version of the GLM-4 series of pre-trained models launched by Zhipu AI. The model performs well in semantics, mathematics, reasoning, code, and knowledge. It supports advanced features such as multi-round dialogue and long text reasoning up to 128K, and also supports 26 languages including Chinese, English, Japanese, Korean, and German. As a high-quality pre-trained language model with 9 billion parameters, it is designed for generating and understanding natural language.
[0086] like Figure 4As shown in the figure, this example compares the performance changes of three large models (yi-large, Llama-3.1-70BInstruct, glm4-9b-chat) in the medical record extraction task before and after using the result verification strategy. By comparing the experimental data, it can be seen that the same model has significantly improved in all indicators after using the result verification strategy.
[0087] (1) The experimental group of the yi-large model performed significantly better than the control group. After adding the result verification strategy, the accuracy increased from 84.7% to 98.8%, the recall increased from 81.9% to 84.4%, and the F1 value increased from 83.2% to 91.5%. Due to the introduction of the result verification strategy, the accuracy of the model has been particularly improved, which shows that the result verification strategy can effectively reduce the extraction error of the yi-large model, thereby improving the accuracy and consistency of information extraction.
[0088] (2) The overall performance of the Llama-3.1-70B-Instruct model was significantly improved after the result verification strategy was added. The accuracy rate increased significantly from 47.62% to 93.44%, the recall rate increased from 50.63% to 65.96%, and the F1 value increased from 49.11% to 77.44%. This result shows that after using the result verification strategy, the Llama-3.1-70B-Instruct model significantly reduced the occurrence of inaccurate extraction results due to model hallucinations during the medical record extraction process, thereby improving the accuracy of information extraction and overall performance. (3) After the result verification strategy was introduced, the accuracy of the glm4-9b-chat model jumped from 34.3% to 83%, the recall rate increased from 47.2% to 71.5%, and the F1 parameter increased from 39.8% to 77%. Although the baseline performance of the model was low, the result verification strategy significantly improved all indicators of the model, especially in terms of accuracy. The result verification strategy effectively suppressed the model's erroneous extraction phenomenon and improved the reliability of the extraction results.
[0089] In summary, the result verification strategy can significantly improve the accuracy, recall and F1 value of each model in the medical record extraction task, thereby reducing the erroneous information caused by model hallucination. The result verification strategy not only effectively improves the quality of information extraction, but also significantly enhances the reliability of the model in practical applications, proving its wide application potential in the field of TCM medical record extraction. In one embodiment, a system for automatically extracting TCM medical case texts is provided, comprising: a medical paper document acquisition module, an HTML parsing module, a medical case text automatic extraction module, a medical case integrity verification module, a medical case authenticity verification module, and a medical case extraction progress control module, wherein: The medical paper document acquisition module is used to obtain medical paper documents in HTML format.
[0090] The HTML parsing module is used to parse and extract medical paper documents, and store the extracted paper title, abstract, text and citation data into the title, abstract, content and citation columns of the paper table in the database respectively.
[0091] The automatic extraction module of medical case text is used to generate prompts for medical case extraction based on the data and instruction templates in the content column; a large model is used to analyze and process the current paper text in the content column, and output it according to the structure set by the prompt to obtain the initial extraction result of the medical case.
[0092] The medical record integrity verification module is used to perform integrity verification on the initial medical record extraction result if the initial medical record extraction result is not empty, and obtain the medical record result after integrity verification.
[0093] The medical record authenticity verification module is used to verify the authenticity of the medical record result after the integrity verification if it is not empty, and obtain the verified extraction result.
[0094] The medical record extraction progress control module is used to set the extraction round count value to zero if the extracted result after verification is not empty, store the verified extraction result in the database, and remove the verified extraction result from the current paper text, and continue to perform the next round of extraction on the current paper text; if the initial extraction result of the medical record is empty, the medical record result after integrity verification is empty, or the extracted result after verification is empty, the current paper text is extracted again until the extraction round count value reaches the preset threshold, and then start processing the next paper text in the content column.
[0095] In one of the embodiments, the HTML parsing module is also used to construct an XPath parsing expression according to the structure of the medical paper document; use the XPath parsing expression to parse the medical paper document, and extract the paper title, abstract, text and citation data from the parsing results; store the paper title, abstract, text and citation data in the title, abstract, content and citation columns of the paper table in the database respectively.
[0096] In one of the embodiments, the medical case text automatic extraction module is also used to construct an instruction template for medical case extraction based on preliminary experimental results, merge the instruction template with the data in the content column, and generate a prompt for medical case extraction. The instruction template is: analyze the text content in the following {}, and output "null" if there is no medical case or no complete medical case; if there is a complete medical case, copy the complete medical case information that meets the requirements in the following {} text; requirements include: ensure that all lists, indents, line breaks and bullet points in the original text are included; all copied content must match the original text exactly, and ensure that every word output is consistent with the original text; if there are multiple medical cases in the text, only extract the first complete medical case including any proper nouns and technical details as well as press or notes; the complete medical case is a continuous text and must contain patient information. It should also include all relevant symptom descriptions, diagnoses, treatment plans, prescription drugs and dosages, treatment processes and results, and use "press" or "notes" as a sign of the end of the medical case; output strictly in accordance with the requirements, only output the medical case text that meets the requirements, and do not output any other explanatory text and non-medical case text.
[0097] In one of the embodiments, the medical case integrity verification module is also used to use a large model to analyze and process the current paper text in the content column. If the medical case text is recognized, the recognized medical case text is output in JSON format according to the structure set by the prompt, and the recognized medical case text is used as the initial medical case extraction result; if the current paper text does not contain medical case content, the initial medical case extraction result is empty, and {"data": null} is output in JSON format.
[0098] In one of the embodiments, the medical case authenticity verification module is also used to define four variables for quantifying the accuracy and completeness of the medical case extraction process; the four variables include: front redundancy, front deletion, rear redundancy and rear deletion; using paragraph marks as delimiters, the original current paper text and the initial extraction results of the medical case are converted into a text list W_list and a medical case list Y_list; matching the index values of the beginning and end positions of the medical case in the medical case list to obtain the beginning index of the medical case and the end position index of the medical case; judging the integrity of the medical case according to the beginning index of the medical case, the end position index of the medical case and the preset judgment formula as described above; if the medical case is not matched, the medical case result after the integrity verification is empty; if the matched medical case is an incomplete medical case, the initial extraction result of the medical case is processed by completing the missing information and eliminating the redundant content to obtain the medical case result after the integrity verification; if the matched medical case is a complete medical case, the initial extraction result of the medical case is used as the medical case result after the integrity verification.
[0099] In one of the embodiments, the medical case authenticity verification module is also used to slice the medical case list Y_list if there is front redundancy or back redundancy in the initial extraction result of the medical case, so as to eliminate redundancy and retain the complete medical case text to obtain the medical case result after integrity verification; if there is both missing and redundancy in the initial extraction result of the medical case, first match the missing part in the text list W_list through the missing edge, and then splice the matched missing part with the slice of the medical case list Y_list to obtain the medical case result after integrity verification; if there is a unilateral missing in the initial extraction result of the medical case, match the missing part in the corresponding direction according to the position of the missing edge in the text list W_list, and then splice the matched missing part with the slice of the medical case list Y_list to obtain the medical case result after integrity verification; the unilateral missing is the front missing or the back missing.
[0100] In one of the embodiments, the medical record extraction progress control module is also used to: if the extracted result after verification is not empty, set the extraction round count value to zero; perform deep cleaning on the current paper text and the medical record result after integrity verification, remove all Chinese and English punctuation marks and line breaks, and convert them into strings in plain text form to obtain a paper text string and a medical record result string; if the medical record result string is a continuous subset of the paper text string, then use the medical record result after integrity verification as the extracted result after verification; otherwise, use null as the extracted result after verification.
[0101] The specific limitations of the automatic extraction system of TCM medical case texts can be found in the limitations of the automatic extraction method of TCM medical case texts in the above text, which will not be repeated here. Each module in the above-mentioned automatic extraction system of TCM medical case texts can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0102] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for automatically extracting medical case texts of traditional Chinese medicine is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0103] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method embodiment when executing the computer program.
[0105] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0106] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0107] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0108] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for automatically extracting TCM medical records, characterized in that: The method comprises: Get medical paper documents in HTML format; Parsing and extracting the medical paper document, and storing the extracted paper title, abstract, text and citation data into the title, abstract, content and citation columns of the paper table in the database respectively; Generate a prompt for medical record extraction based on the data in the content column and the instruction template; The large model is used to analyze and process the current paper text in the content column, and output according to the structure set by the prompt to obtain the initial extraction result of the medical case; If the initial extraction result of the medical records is not empty, the initial extraction result of the medical records is integrity checked to obtain a medical record result after integrity check; If the medical record result after the integrity check is not empty, then the medical record result after the integrity check is verified for authenticity to obtain a verified extraction result; If the verified extraction result is not empty, the extraction round count value is set to zero, the verified extraction result is stored in the database, and the verified extraction result is removed from the current paper text, and the next round of extraction is continued for the current paper text; If the initial extraction result of the medical record is empty, the medical record result after the integrity check is empty, or the extraction result after the check is empty, the current paper text is extracted again until the extraction round count reaches the preset threshold, and then the next paper text in the content column is processed.
2. The method for automatically extracting TCM medical records according to claim 1, characterized in that: The medical paper document is parsed and extracted, and the extracted paper title, abstract, text and citation data are stored in the title, abstract, content and citation columns of the paper table in the database, including: According to the structure of the medical paper document, construct an XPath parsing expression; Parsing the medical paper document using the XPath parsing formula, and extracting the paper title, abstract, text and citation data from the parsing result; Store the paper title, abstract, main text and citation data in the title, abstract, content and citation columns of the paper table in the database respectively.
3. The method for automatically extracting TCM medical records according to claim 1, characterized in that: Generate prompts for medical record extraction based on the data in the content column and the instruction template, including: According to the preliminary experimental results, an instruction template for medical case extraction is constructed, and the instruction template and the data in the content column are merged to generate a prompt for medical case extraction; wherein the instruction template is: analyze the text content in the following {}, and output "null" if there is no medical case or no complete medical case; if there is a complete medical case, copy the complete medical case information that meets the requirements in the following {} text; the requirements include: ensure that all lists, indents, line breaks and bullet points in the original text are included; all copied content must completely match the original text, and ensure that every word output is consistent with the original text; if there are multiple medical cases in the text, only the first complete medical case including any proper nouns and technical details and press or notes is extracted; the complete medical case is a continuous text and must contain patient information and should also include all relevant symptom descriptions, diagnoses, treatment plans, prescription drugs and dosages, treatment processes and results and other detailed information, and use "press" or "notes" as a sign of the end of the medical case; output is strictly in accordance with the requirements, only the medical case text that meets the requirements is output, and no other explanatory text and non-medical case text is output.
4. The method for automatically extracting TCM medical records according to claim 1, characterized in that: The large model is used to analyze and process the current paper text in the content column, and output according to the structure set by the prompt to obtain the initial extraction results of the medical records, including: The large model is used to analyze and process the current paper text in the content column. If the medical case text is recognized, the recognized medical case text is output in JSON format according to the structure set by the prompt, and the recognized medical case text is used as the initial medical case extraction result; if the current paper text does not contain medical case content, the initial medical case extraction result is empty, and {"data": null} is output in JSON format.
5. The method for automatically extracting TCM medical records according to claim 1, characterized in that: If the initial medical record extraction result is not empty, the initial medical record extraction result is subjected to integrity check to obtain the medical record result after integrity check, including: Four variables were defined to quantify the accuracy and completeness of medical record extraction; the four variables included front redundancy, front missingness, back redundancy, and back missingness; Using paragraph marks as separators, the original current paper text and the initial extraction results of medical records are converted into a text list W_list and a medical record list Y_list; Match the index values of the start and end positions of the medical case in the medical case list to obtain the start index and the end position index of the medical case; The medical case integrity is judged according to the medical case start index, the medical case end position index and a preset judgment formula; wherein the preset judgment formula is: Among them, result1 is the medical record result after integrity verification, result r_m The result is missing at the back. r_r For rear redundancy, result f_m The front part is missing, result f_r is the front redundancy, result0 is the initial extraction result of the medical records, Y i For the beginning index of medical records, Y j It is the index of the end position of the medical record, null means empty; If no medical records are matched, the medical records result after integrity check is empty; If the matched medical record is an incomplete medical record, the initial extraction result of the medical record is processed by completing the missing information and removing the redundant content to obtain the medical record result after integrity verification; If the matched medical record is a complete medical record, the initial extraction result of the medical record will be used as the medical record result after integrity verification.
6. The method for automatically extracting TCM medical records according to claim 5, characterized in that: If the matched medical record is an incomplete medical record, the initial extraction result of the medical record is processed by completing the missing information and removing the redundant content to obtain the medical record result after integrity verification, including: If the initial extraction result of the medical records has front redundancy or back redundancy, the medical record list Y_list is sliced to remove redundancy and retain the complete medical record text, thereby obtaining the medical record result after integrity verification; If the initial extraction result of the medical records has both missing and redundant parts, first match the missing parts in the text list W_list through the missing edges, and then splice the matched missing parts with the slices of the medical record list Y_list to obtain the medical record results after integrity verification; If there is a unilateral missing in the initial extraction result of the medical record, the missing part is matched in the corresponding direction according to the position of the missing edge in the text list W_list, and then the matched missing part is spliced with the original medical record list to obtain the medical record result after integrity verification; the unilateral missing is the front missing or the back missing.
7. The method for automatically extracting TCM medical records according to claim 1, characterized in that: If the verified extraction result is not empty, the extraction round count value is set to zero, the verified extraction result is stored in the database, and the verified extraction result is removed from the current paper text, and the next round of extraction is continued for the current paper text, including: If the extracted result after the verification is not empty: Set the draw round count value to zero; Perform deep cleaning on the current paper text and the medical record results after the integrity check, remove all Chinese and English punctuation marks and line breaks, convert them into strings in plain text form, and obtain the paper text string and the medical record result string; If the medical record result character string is a continuous subset of the paper text character string, the medical record result after integrity verification is used as the verified extraction result; otherwise, null is used as the verified extraction result.
8. A system for automatically extracting TCM medical records, characterized in that: The system comprises: Medical paper document acquisition module, used to obtain medical paper documents in HTML format; HTML parsing module, used for parsing and extracting the medical paper document, and storing the extracted paper title, abstract, text and citation data into the title, abstract, content and citation columns of the paper table in the database respectively; The medical case text automatic extraction module is used to generate prompts for medical case extraction based on the data and instruction templates in the content column; the large model is used to analyze and process the current paper text in the content column, and output it according to the structure set by the prompt to obtain the initial extraction result of the medical case; A medical record integrity verification module, used for, if the medical record initial extraction result is not empty, performing integrity verification on the medical record initial extraction result to obtain the medical record result after integrity verification; A medical record authenticity verification module, used to verify the authenticity of the medical record result after the integrity verification if the medical record result after the integrity verification is not empty, and obtain the verified extraction result; The medical record extraction progress control module is used to set the extraction round count value to zero if the extracted result after verification is not empty, store the extracted result after verification in the database, and remove the extracted result after verification from the current paper text, and continue to perform the next round of extraction on the current paper text; if the initial extraction result of the medical record is empty, the medical record result after the integrity verification is empty, or the extracted result after verification is empty, the current paper text is extracted again until the extraction round count value reaches a preset threshold, and then start processing the next paper text in the content column.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method for automatically extracting TCM medical case texts according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for automatically extracting TCM medical case texts according to any one of claims 1 to 7 is implemented.