Traditional Chinese medicine medical record sub-specialty classification method based on large language model and keyword arbitration
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-19
- Publication Date
- 2026-08-11
AI Technical Summary
然而,通用大语言模型直接应用于中医场景时,仍容易受到领域知识缺乏、输出格式不稳定以及幻觉现象等因素影响;即使采用监督微调,若仍采用单阶段多分类架构,也容易在科室边界样本上发生混淆
[0016] The beneficial effects of the method of this invention are as follows: This invention obtains synthetic medical case data by constructing a standardized medical case text set and a structured TCM knowledge base and performing knowledge enhancement processing. By introducing a structured TCM knowledge-driven synthetic medical case generation mechanism, it effectively alleviates the problem of uneven distribution of real medical case training samples, especially improving the training sufficiency of small sample specialty categories. Furthermore, by introducing a first-stage binary classification routing module and a second-stage multi-classification module, a TCM medical case specialty classification model is constructed, decomposing the TCM medical case classification task into a two-stage cascaded task. By combining "internal medicine/specialty" routing discrimination with subsequent fine classification, the risk of misjudgment caused by blurred departmental boundaries is significantly reduced. Finally, based on the TCM medical case specialty classification model, cascaded inference is performed on the TCM synthetic medical case data to obtain the TCM medical case specialty classification results. The model prediction results have both data-driven and knowledge-constrained capabilities, improving the discrimination accuracy and interpretability of complex boundary samples.
Smart Images

Figure CN122552174A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical information processing technology, and in particular to a method for classifying and categorizing traditional Chinese medicine medical records by specialty based on a large language model and keyword arbitration. Background Technology
[0002] Traditional Chinese medicine (TCM) medical records are comprehensive records of a patient's chief complaint, present medical history, symptoms and signs, tongue and pulse information, diagnostic conclusions, treatment methods, and prescriptions. With the popularization of medical records and the development of intelligent triage / diagnosis systems, the classification and categorization of TCM medical record texts by department has become a key foundational link in the intelligent triage chain. Its output often directly affects the recommendation of registration departments, the allocation of specialist resources, and the safety and efficiency of subsequent diagnosis and treatment processes.
[0003] Compared to general text classification tasks, TCM medical record texts typically exhibit the following characteristics: First, the text is highly unstructured, with inconsistent narrative styles and numerous omissions, synonyms, and cross-sentence references. Second, there are strong combinational patterns and implicit relationships between TCM disease names, syndromes, symptoms, treatments, and prescriptions, making accurate capture difficult solely through word-for-word matching. Third, some fields (such as tongue and pulse diagnosis, and key diagnostic points) are highly indicative of departmental classification, but may appear in various different forms in the original records, increasing the difficulty of model extraction and generalization. These factors necessitate that the model not only possess semantic understanding capabilities but also a certain level of knowledge and reasoning ability within the TCM domain.
[0004] Furthermore, there is often significant semantic overlap at the boundaries of TCM specialties. Clinically, the same symptom (such as pain, fever, cough, menstrual irregularities, sore throat, etc.) may appear in cases from multiple departments, and the same disease may present differentiated descriptions in different populations or at different stages, making it more difficult to distinguish samples at the departmental boundary level at the textual level. With such samples, models are prone to shortcut learning phenomena that rely on shallow cues, such as over-reliance on age, gender, or individual high-frequency words to trigger classification decisions, thereby producing misjudgments in boundary scenarios and affecting the reliability of the system.
[0005] For the problem of classifying TCM medical records by department, the relevant technologies mainly include the following approaches: One is traditional machine learning methods based on word frequency statistics and shallow features, such as TF-IDF combined with support vector machines, topic models, paragraph vectors, etc. These methods are simple to implement, but have limited ability to characterize semantic combinations, cross-sentence dependencies, and variations of TCM terminology. Another is end-to-end models based on deep learning, such as CNN, Bi-LSTM and their attention structures. These methods can learn certain contextual representations, but may still suffer from insufficient generalization or unstable identification of boundary samples when the size of labeled samples is limited, the class distribution is unbalanced, and domain knowledge is lacking. In addition, pre-trained language models (such as BERT and domain pre-trained models) can improve text representation capabilities, but their effectiveness usually depends on the quality of training data and the degree of domain adaptation, and there are still insufficient supports for explicit knowledge constraints and interpretable decisions.
[0006] In recent years, large language models have demonstrated strong capabilities in medical text understanding and generation tasks, with some works attempting to achieve classification using zero-shot / few-shot hints, retrieval augmentation, or supervised fine-tuning. However, when general-purpose large language models are directly applied to traditional Chinese medicine scenarios, they are still susceptible to factors such as a lack of domain knowledge, unstable output formats, and hallucination phenomena. Even with supervised fine-tuning, if a single-stage multi-classification architecture is still used, confusion can easily occur at departmental boundary samples.
[0007] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention
[0008] To address the aforementioned technical problems, the purpose of this invention is to provide a method for classifying TCM medical records by specialty based on a large language model and keyword arbitration. This method improves the accuracy of TCM medical record classification by specialty through data augmentation driven by structured TCM knowledge and two-stage cascaded reasoning.
[0009] The first technical solution adopted in this invention is: a method for classifying TCM medical records by specialty based on a large language model and keyword arbitration, comprising the following steps: A standardized medical record text set and a structured TCM knowledge base were constructed and knowledge enhancement processing was performed to obtain TCM synthetic medical record data; A first-stage binary classification routing module and a second-stage multi-classification module are introduced to construct a TCM medical record classification model by specialty. Based on the TCM medical record classification model, cascaded reasoning is performed on the TCM synthetic medical record data to obtain the TCM medical record classification results.
[0010] Furthermore, the step of constructing a standardized medical record text set and a structured TCM knowledge base, and performing knowledge enhancement processing to obtain TCM synthetic medical record data, specifically includes: Obtain original TCM medical record text data, which includes the target user's chief complaint, present medical history, symptoms, tongue and pulse information, syndrome differentiation information, treatment method information, and prescription information; The original TCM medical record text data were cleaned and standardized in sequence to obtain a set of standardized medical record texts; A structured TCM knowledge base is constructed, which includes the mapping relationship between disease entities, their respective departments, typical symptoms, syndrome characteristics, and related TCM terms. Based on a structured TCM knowledge base as a constraint, data knowledge enhancement and medical record generation processes are applied to a standardized medical record text set to obtain TCM synthetic medical record data.
[0011] Furthermore, the TCM medical record classification model specifically includes a first-stage binary classification routing module, a keyword mining module, and a second-stage multi-classification module, which are connected sequentially.
[0012] Furthermore, the step of performing cascaded reasoning on the synthesized TCM medical record data based on the TCM medical record classification model to obtain the TCM medical record classification results specifically includes: Input the TCM medical record data into the TCM medical record subject classification model; The first-stage binary classification routing module based on the TCM medical record classification model performs binary classification mapping on the TCM synthetic medical record data to obtain the first classification result, which includes specialty medical record data and internal medicine medical record classification results. The keyword mining module based on the TCM medical record classification model performs keyword arbitration on the specialty medical record data in the first classification result to obtain specialty feature keywords. The second-stage multi-classification module based on the TCM medical record classification model further classifies the specialty feature keywords to obtain the specialty medical record classification results. By combining the classification results of internal medicine medical records with the classification results of specialty medical records, the classification results of traditional Chinese medicine medical records by specialty were obtained.
[0013] Furthermore, the first-stage binary classification routing module based on the TCM medical record classification model, which performs binary classification mapping on the TCM synthetic medical record data to obtain the first classification result, specifically includes: Input the TCM synthetic medical record data into the first-stage binary classification routing module of the TCM medical record subject classification model; A binary classification mapping was performed on the synthetic medical record data of traditional Chinese medicine to obtain the classification results of internal medicine medical records and the medical record data of specialty medical records. The internal medicine medical record classification results are labeled with internal medicine tags and directly used as the output of the TCM medical record classification model. Specialty medical record data are used as the input of the keyword mining module.
[0014] Furthermore, the keyword mining module based on the TCM medical record classification model performs keyword arbitration on the specialty medical record data in the first classification result to obtain specialty feature keywords. This step specifically includes: Input the specialist medical case data from the first classification result into the keyword mining module of the TCM medical case classification model; Keyword mining was performed on the specialist medical record data in the first classification results to construct a specialist discrimination thesaurus. If the specialty discrimination thesaurus meets the preset keyword hitting rules, it will be directly output as the specialty medical record classification result; If the specialized subject discrimination terminology does not meet the preset keyword hitting rules, then the specialized subject discrimination terminology will be extracted to obtain specialized subject characteristic keywords.
[0015] Furthermore, the keyword mining step specifically includes: Based on specialized medical records, candidate keywords were statistically analyzed and screened based on inter-class differences. GPT-4o was used to perform semantic cleaning and refinement of candidate keywords, and a specialized discrimination thesaurus was constructed in conjunction with manual review.
[0016] The beneficial effects of the method of this invention are as follows: This invention obtains synthetic medical case data by constructing a standardized medical case text set and a structured TCM knowledge base and performing knowledge enhancement processing. By introducing a structured TCM knowledge-driven synthetic medical case generation mechanism, it effectively alleviates the problem of uneven distribution of real medical case training samples, especially improving the training sufficiency of small sample specialty categories. Furthermore, by introducing a first-stage binary classification routing module and a second-stage multi-classification module, a TCM medical case specialty classification model is constructed, decomposing the TCM medical case classification task into a two-stage cascaded task. By combining "internal medicine / specialty" routing discrimination with subsequent fine classification, the risk of misjudgment caused by blurred departmental boundaries is significantly reduced. Finally, based on the TCM medical case specialty classification model, cascaded inference is performed on the TCM synthetic medical case data to obtain the TCM medical case specialty classification results. The model prediction results have both data-driven and knowledge-constrained capabilities, improving the discrimination accuracy and interpretability of complex boundary samples. Attached Figure Description
[0017] Figure 1 This is a flowchart of the steps of the TCM medical record classification method based on large language model and keyword arbitration in this invention; Figure 2 This is a schematic diagram of the overall route of the TCM medical record classification method based on knowledge-enhanced large language model and keyword arbitration provided in a specific embodiment of the present invention; Figure 3 This is a schematic diagram of the intermediate cascade subject-based reasoning process provided in a specific embodiment of the present invention. Detailed Implementation
[0018] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. The step numbers in the following embodiments are only for ease of explanation and do not limit the order of the steps. The execution order of each step in the embodiments can be adapted according to the understanding of those skilled in the art.
[0019] In summary, the existing technology has the following problems, for example: 1) The sample distribution is severely unbalanced. In real TCM medical case data, the sample size varies greatly among different departments, which makes it easy for the model to be biased towards the majority class during training, making it difficult to take into account the small sample size of the specialty category.
[0020] 2) Significant semantic overlap between departments. There are many shared symptoms and descriptions among different departments, making it difficult to distinguish the actual department based solely on surface text features.
[0021] 3) The model is prone to shortcut learning bias. Some models rely excessively on superficial cues such as age, gender, or individual high-frequency words, rather than making judgments based on TCM syndrome differentiation and disease characteristics, thus affecting generalization ability.
[0022] 4) General-purpose language models lack constraints from TCM knowledge. Directly using general-purpose models makes it difficult to reliably handle the structured relationships between disease names, syndromes, symptoms, and departments, affecting the accuracy and reliability of classification.
[0023] 5) The robustness of the single-stage classification architecture is insufficient. Existing schemes often classify all departments as parallel categories at once, failing to make stratified decisions on "whether it belongs to a specialty" and "what specific specialty it belongs to", making it difficult to balance specialty recall and overall classification accuracy.
[0024] Based on this, this invention proposes a TCM medical record classification method based on a knowledge-enhanced large language model and keyword arbitration. This method aims to address technical problems in TCM medical record classification, such as extremely uneven sample distribution, severe feature overlap, and the tendency for models to exhibit shortcut learning bias. Through structured TCM knowledge-driven data enhancement, two-stage cascaded reasoning, and a keyword arbitration mechanism, the method improves the accuracy and macro-average F1 score of TCM medical record classification, while reducing the risk of misclassification and omissions in intelligent triage scenarios.
[0025] Reference Figure 1 This invention provides a method for classifying TCM medical records by specialty based on a large language model and keyword arbitration. The method includes the following steps: S100. Construct a standardized medical record text set and a structured TCM knowledge base, and perform knowledge enhancement processing to obtain TCM synthetic medical record data; S110. Obtain original TCM medical record text data, which includes the target user's chief complaint, present medical history, symptoms, tongue and pulse information, syndrome differentiation information, treatment method information, and prescription information. S120. The original TCM medical record text data is cleaned and standardized in sequence to obtain a set of standardized medical record texts. In this embodiment, original TCM medical record text data is obtained. The medical record text includes at least one or more of the following: chief complaint, present medical history, symptoms, tongue and pulse information, syndrome differentiation information, treatment method information, and prescription information. The original medical records are cleaned and standardized, including removing irrelevant symbols, standardizing terminology, handling missing fields, and retaining key information related to departmental identification, thereby obtaining a standardized medical record text set.
[0026] S130. Construct a structured TCM knowledge base, wherein the structured TCM knowledge base includes the mapping relationship between disease entities, their respective departments, typical symptoms, syndrome characteristics, and related TCM terms; In this embodiment, a structured TCM knowledge base is constructed based on TCM disease names, disease classification standards, syndrome knowledge, and clinical data. The knowledge base includes at least the mapping relationships between disease entities, their respective departments, typical symptoms, syndrome characteristics, and related TCM terms. In a preferred embodiment, the knowledge base contains 728 core disease and syndrome knowledge entries, used to provide domain constraints for subsequent data augmentation and classification reasoning.
[0027] S140. Based on the structured TCM knowledge base as a constraint, data knowledge enhancement and medical record generation processing are performed on the standardized medical record text set to obtain TCM synthetic medical record data.
[0028] In this embodiment, addressing the issue of a relative shortage of specialist samples in real medical case studies, structured TCM knowledge is used as a logical seed input into a large language model to generate clinically plausible TCM synthetic medical cases. The generation process includes: selecting disease entities and corresponding department information, constructing generation prompt templates, constraining the generation of symptom descriptions and key diagnostic points, filtering out duplicate or low-quality samples, and adding approved synthetic medical cases to the training data.
[0029] 5223 specialized synthetic medical records were generated for the first-stage routing model; an additional 510 high-quality synthetic medical records were generated for the second-stage multi-classification model to further enhance the training sufficiency of small sample categories.
[0030] S200: Introducing the first-stage binary classification routing module and the second-stage multi-classification module to construct a TCM medical record classification model by department; Specifically, the TCM medical record classification model includes a first-stage binary classification routing module, a keyword mining module, and a second-stage multi-classification module, which are connected sequentially.
[0031] S300: Based on the TCM medical record classification model, perform cascade reasoning on the TCM synthetic medical record data to obtain the TCM medical record classification results.
[0032] S310. Input the TCM synthetic medical record data into the TCM medical record subject classification model; S320. The first-stage binary classification routing module based on the TCM medical record classification model performs binary classification mapping on the TCM synthetic medical record data to obtain the first classification result, which includes specialty medical record data and internal medicine medical record classification results. Specifically, the synthesized TCM medical record data is input into the first-stage binary classification routing module of the TCM medical record classification model; binary classification mapping is performed on the synthesized TCM medical record data to obtain the internal medicine medical record classification results and specialty medical record data; the internal medicine medical record classification results are assigned an internal medicine label and directly used as the output of the TCM medical record classification model, while the specialty medical record data is used as the input of the keyword mining module.
[0033] In this embodiment, the problem of classifying TCM medical records by specialty is decomposed into a binary classification routing task of "internal medicine / specialty". Internal medicine samples are mapped to the negative class, such as pediatrics, gynecology, surgery, and otolaryngology; specialty samples are mapped to the positive class. Based on the enhanced training data, the large language model is subjected to supervised fine-tuning to obtain the first-stage binary classification routing model.
[0034] The first-stage model is trained using a parameter-efficient fine-tuning method, preferably LoRA tuning. This routing model prioritizes identifying medical cases with specialty biases, allowing subsequent processing to focus on samples at risk of confounding, thereby reducing the risk of missed specialty diagnoses.
[0035] S330. The keyword mining module based on the TCM medical record classification model performs keyword arbitration on the specialty medical record data in the first classification result to obtain specialty feature keywords. Specifically, the specialist medical case data in the first classification result is input into the keyword mining module of the TCM medical case classification model; keyword mining is performed on the specialist medical case data in the first classification result to construct a specialist discrimination terminology library; if the specialist discrimination terminology library meets the preset keyword hitting rules, it is directly output as the specialist medical case classification result; if the specialist discrimination terminology library does not meet the preset keyword hitting rules, the specialist discrimination terminology library is extracted to obtain specialist feature keywords.
[0036] In this embodiment, keyword mining is performed on the specialty samples in the training corpus to form a specialty discrimination lexicon. The mining process includes: statistical analysis of candidate keywords, screening based on inter-class differences, semantic cleaning and refinement of candidate words using GPT-4o, and manual review to form the final keyword lexicon.
[0037] During the reasoning process, when the first-stage routing model determines that a medical case to be classified has a specialty tendency, it first uses the keyword arbitration module for judgment. If the medical case to be classified meets the preset keyword hit rules, the corresponding specialty category is directly output; if no match is found or there is a conflict, it is handed over to the second-stage multi-classification model for further judgment. This process can combine domain knowledge with model reasoning, improving the interpretability and stability of boundary sample discrimination.
[0038] S340. The second-stage multi-classification module based on the TCM medical record classification model performs detailed classification of specialty feature keywords to obtain the specialty medical record classification results. In this embodiment, a second-stage multi-classification model is constructed for samples that are not stably classified by the keyword arbitration module. This second-stage model performs fine-grained classification of the medical cases to be classified among five departments: internal medicine, pediatrics, gynecology, surgery, and otolaryngology. The second stage also uses a large language model as the base model and completes training through supervised fine-tuning.
[0039] The second-stage model was trained using 4,903 training data sets consisting of real and enhanced medical cases to ensure that the classification model possesses both real-world distribution learning capabilities and domain knowledge expansion capabilities.
[0040] S350. Combining the classification results of internal medicine medical records with the classification results of specialty medical records, the classification results of traditional Chinese medicine medical records by specialty are obtained.
[0041] In this embodiment, for a TCM medical record to be classified, it is first input into the first-stage binary classification routing model. If it is determined to be internal medicine, the internal medicine classification result is directly output; if it is determined to be a specialty, it further enters the keyword arbitration module. If the keyword arbitration module can output a clear specialty category, then that category is used as the final result; if a stable judgment cannot be formed, then the medical record is input into the second-stage multi-classification model, and the classification result given by the second-stage model is output.
[0042] In addition to outputting the final classification label, the system can also output routing results and keyword hit information simultaneously to enhance the interpretability and auditability of the system.
[0043] like Figure 3As shown, this invention employs a cascaded reasoning process to process TCM medical records to be classified. The medical record to be classified is first input into the first-stage binary classification routing model; when the determination result is internal medicine, the system directly outputs the internal medicine label; when the determination result is a specialty, the system further calls the keyword arbitration module to perform rule-based discrimination based on the specialty feature keywords matched in the medical record to be classified; if the keyword arbitration can give a clear conclusion, the corresponding specialty result is directly output; if the keyword arbitration cannot form a stable judgment, the medical record to be classified is input into the second-stage multi-classification model for further differentiation among multiple specialty categories. Through the above cascaded reasoning mechanism, this invention can effectively reduce the risk of misjudgment of boundary samples and improve the classification reliability in complex scenarios.
[0044] Additionally, it should be noted that both the first and second stage models use open-source Chinese large language models as the base model, preferably the GLM-4-9B-Chat model or the Qwen3-8B series models. The preferred parameters for model training are as follows: learning rate... The training rounds consisted of 3 rounds, with a LoRA rank of 8. The experimental environment was preferably an NVIDIA L20 48G GPU server, and implemented using PyTorch version 2.0 or later and the LLaMA-Factory parameter fine-tuning framework.
[0045] like Figure 2 As shown, this embodiment of the invention first preprocesses the original TCM medical record texts and constructs a structured TCM disease and syndrome knowledge base. Then, using the structured knowledge as constraints, it drives a large language model to generate knowledge-enhanced medical record data to alleviate the problem of uneven distribution of real medical record samples. During the model training phase, a first-stage binary classification routing model and a second-stage multi-classification model are constructed respectively. In the inference phase, the medical records to be classified sequentially undergo the first-stage routing discrimination, keyword arbitration, and the second-stage fine classification process, ultimately outputting the corresponding departmental classification result. This overall technical approach organically combines domain knowledge constraints, data enhancement, and hierarchical decision-making mechanisms, thereby improving the accuracy and stability of TCM medical record departmental classification.
[0046] In summary, compared with the prior art, the embodiments of the present invention have the following advantages: 1) This invention effectively alleviates the problem of uneven distribution of real medical case training samples by introducing a structured TCM knowledge-driven synthetic medical case generation mechanism, especially improving the training sufficiency of small sample specialty categories.
[0047] 2) This invention breaks down the TCM medical record classification task into a two-stage cascaded task. By combining "internal medicine / specialty" routing discrimination with subsequent fine classification, it significantly reduces the risk of misjudgment caused by the ambiguity of departmental boundaries.
[0048] 3) This invention sets up a keyword arbitration module to explicitly introduce clinical specialty features into the classification process, so that the model prediction results have both data-driven and knowledge-constrained capabilities, improving the discrimination accuracy and interpretability of complex boundary samples.
[0049] 4) This invention focuses on optimizing the recall capability of specialty samples. In the embodiments of this invention, the first-stage binary classification routing model achieves a recall rate of 96.98% for specialty samples, which can effectively reduce the risk of specialty cases being misdiagnosed as internal medicine cases.
[0050] 5) In terms of overall performance, this invention outperforms the single-stage supervised fine-tuning baseline model. On the test set, the embodiment of this invention achieves an accuracy of 0.9328 and a macro-F1 score of 0.9311, which are significant improvements compared to the baseline model's accuracy of 0.9169 and macro-F1 score of 0.9129.
[0051] 6) This invention uses a parameter-efficient fine-tuning method to train large language models, which reduces training and deployment costs while ensuring classification performance, making it more suitable for deployment and application in practical systems such as intelligent triage, medical record circulation, and decision support.
[0052] Furthermore, to verify the effectiveness of the technical solution of this invention, comparative experiments were conducted on the single-stage supervised fine-tuning baseline scheme, the scheme after introducing knowledge-enhanced data, the scheme after introducing a cascaded structure, and the complete scheme after introducing keyword arbitration. The results are shown in Table 1. As can be seen from Table 1, after gradually introducing knowledge enhancement, cascaded discrimination, and keyword arbitration mechanisms, the model improved in both Accuracy and Macro-F1 scores, indicating that the multi-module collaborative mechanism proposed in this embodiment of the invention can effectively improve the performance of TCM medical record classification by specialty.
[0053] Table 1. Comparison of classification performance under different module combinations of the present invention To further illustrate the advantages of this invention in specialist sample identification, a statistical analysis was performed on the classification results of the first-stage binary classification routing model, as shown in Table 2. As can be seen from Table 2, the first-stage routing model has a high recall capability for specialist samples, and can identify specialist medical cases requiring further refined processing as much as possible in the pre-processing stage, thereby reducing the situation where specialist cases are directly misclassified as internal medicine cases and improving the reliability in intelligent triage scenarios.
[0054] Table 2. Confusion matrix results of the first-stage binary classification routing model. Finally, the embodiments of the present invention will be described in detail with reference to specific implementation scenarios: Specific Implementation Example 1: A method for classifying and categorizing medical records in Traditional Chinese Medicine (TCM) based on the GLM-4-9B-Chat large language model, the implementation process of which includes the following steps: 1) Data acquisition: 4,393 real TCM medical records, covering five departments: internal medicine, pediatrics, gynecology, surgery and otolaryngology; 2,155 independent test cases were set up for performance evaluation.
[0055] 2) Knowledge Construction: Based on TCM disease names, disease classification standards and syndrome knowledge, a structured TCM knowledge base was constructed, forming 728 core disease and syndrome knowledge entries. Each knowledge entry includes at least the disease name, the department to which it belongs, typical symptoms and related terminology information.
[0056] Structured knowledge entries can be organized according to "first-level directory - second-level directory - third-level directory" and accompanied by corresponding clinical explanations (such as excerpts from the original national standard text) to ensure the standardization and traceability of knowledge sources, as shown in Table 3: Table 3. Classification Results of Structured Knowledge Items 3) Data Augmentation: Structured knowledge is used as logical seeds input into the large language model to generate synthetic TCM medical record texts. Specifically, 5223 specialized augmented medical records are generated for the first-stage routing model; and 510 high-quality augmented medical records are generated to supplement the second-stage multi-classification model, as shown in Table 4. Table 4 Examples of knowledge-driven generative augmented data 4) First-stage model training: Internal medicine is mapped to the negative class, and pediatrics, gynecology, surgery, and otolaryngology are mapped to the positive class, constructing a "internal medicine / specialty" binary classification task. GLM-4-9B-Chat is used as the base model, and LoRA is used for supervised fine-tuning with a learning rate set to... The number of training epochs was set to 3, and the LoRA rank was set to 8. During fine-tuning, the training data was constructed using the following instruction template: Instruction: You are an experienced TCM triage expert. Please read the following TCM medical case and determine whether it belongs to "Internal Medicine" or "Specialty (including Surgery, Gynecology, Pediatrics, and Otolaryngology)". Please output only one word: "Internal Medicine" or "Specialty".
[0057] Input: [Original text of the medical record].
[0058] Output: [Prediction label: Internal Medicine / Specialty].
[0059] 5) Keyword Arbitration Module Construction: Candidate keywords are counted from the specialty training corpus. Combined with inter-class difference analysis, internal medicine corpus filtering, GPT-4o semantic refinement and manual review, a specialty keyword library is formed, and mapping rules between keywords and target departments are established.
[0060] 6) Second-stage model training: Using 4903 training samples, including real and augmented medical records, a five-class classification task was constructed, with classification labels including internal medicine, pediatrics, gynecology, surgery, and otolaryngology. The second stage also used GLM-4-9B-Chat for supervised fine-tuning. During fine-tuning, the following instruction template was used to construct the training data: Instruction: Given the following TCM medical case, please select one of the following as the tag for this medical case: (Internal Medicine | Surgery | Gynecology | Otolaryngology | Pediatrics).
[0061] Input: [Original text of the medical record].
[0062] Output: [Prediction label: one of the five major departments].
[0063] 7) Cascaded reasoning: First, use the first-stage model to perform "internal medicine / specialty" routing judgment on the medical cases to be classified; if the result is internal medicine, output internal medicine directly; if the result is specialty, execute keyword arbitration first; if arbitration cannot give a stable result, then further call the second-stage five-classification model for final classification.
[0064] 8) Results Output: On the test set, the first-stage model achieved a recall rate of 96.98% for specialist samples; the overall system achieved an accuracy of 0.9328 and a macro-F1 score of 0.9311. Compared with the single-stage SFT baseline model, this embodiment achieves improvements in both accuracy and macro-average F1 score, demonstrating the significant effectiveness of the technical solution of this invention. Specific Implementation Example 2: A method for classifying TCM medical records by department based on the Qwen large language model. The overall process of this embodiment is basically the same as that of the first specific embodiment. The difference is that the basic model used in the first and second stages is Qwen3-8B.
[0066] Its implementation process includes the following steps: 1) The same real medical case data, structured knowledge base, and data augmentation methods as in Specific Implementation Example 1 are used; 2) Based on GLM-4-9B-Chat, supervise and fine-tune the first phase of the "Internal Medicine / Specialty" binary classification task; 3) The same keyword arbitration strategy was used to perform rule-based discrimination on the specialized samples; 4) Supervised fine-tuning of the second-stage five-category task based on Qwen3-8B; 5) Perform the same cascading inference process on the test set.
[0067] Experimental results show that this embodiment achieves an accuracy of 0.9299 and a macro-F1 score of 0.9264 on the test set, which is also better than the corresponding single-stage baseline model. This indicates that the present invention does not depend on a single model architecture and has good model adaptability and transferability. Specific Implementation Example 3: To further illustrate the superiority of the present invention's technical solution in handling complex TCM medical cases, typical cases from the test set were selected for analysis. Table 4 below compares the judgment results and corresponding judgment mechanisms of the current system (based on the cascading mechanism of this invention) with the original single-stage model.
[0069] Table 4. Results of typical case studies on cascading classification mechanisms The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for classifying TCM medical records by specialty based on a large language model and keyword arbitration, characterized in that: Includes the following steps: A standardized medical record text set and a structured TCM knowledge base were constructed and knowledge enhancement processing was performed to obtain TCM synthetic medical record data; A first-stage binary classification routing module and a second-stage multi-classification module are introduced to construct a TCM medical record classification model by specialty. Based on the TCM medical record classification model, cascaded reasoning is performed on the TCM synthetic medical record data to obtain the TCM medical record classification results.
2. The method for classifying TCM medical records by specialty based on a large language model and keyword arbitration as described in claim 1, characterized in that, The step of constructing a standardized medical record text set and a structured TCM knowledge base, and performing knowledge enhancement processing to obtain TCM synthetic medical record data, specifically includes: Obtain original TCM medical record text data, which includes the target user's chief complaint, present medical history, symptoms, tongue and pulse information, syndrome differentiation information, treatment method information, and prescription information; The original TCM medical record text data were cleaned and standardized in sequence to obtain a set of standardized medical record texts; A structured TCM knowledge base is constructed, which includes the mapping relationship between disease entities, their respective departments, typical symptoms, syndrome characteristics, and related TCM terms. Based on a structured TCM knowledge base as a constraint, data knowledge enhancement and medical record generation processes are applied to a standardized medical record text set to obtain TCM synthetic medical record data.
3. The method for classifying TCM medical records by specialty based on a large language model and keyword arbitration as described in claim 2, is characterized in that... The TCM medical record classification model specifically includes a first-stage binary classification routing module, a keyword mining module, and a second-stage multi-classification module, which are connected sequentially.
4. The method for classifying TCM medical records by specialty based on a large language model and keyword arbitration as described in claim 3, is characterized in that... The step of performing cascaded reasoning on the synthetic medical record data based on the TCM medical record classification model to obtain the TCM medical record classification results specifically includes: Input the TCM medical record data into the TCM medical record subject classification model; The first-stage binary classification routing module based on the TCM medical record classification model performs binary classification mapping on the TCM synthetic medical record data to obtain the first classification result, which includes specialty medical record data and internal medicine medical record classification results. The keyword mining module based on the TCM medical record classification model performs keyword arbitration on the specialty medical record data in the first classification result to obtain specialty feature keywords. The second-stage multi-classification module based on the TCM medical record classification model further classifies the specialty feature keywords to obtain the specialty medical record classification results. By combining the classification results of internal medicine medical records with the classification results of specialty medical records, the classification results of traditional Chinese medicine medical records by specialty were obtained.
5. The method for classifying TCM medical records by specialty based on a large language model and keyword arbitration as described in claim 4, characterized in that, The first-stage binary classification routing module based on the TCM medical record classification model performs binary classification mapping on the TCM synthetic medical record data to obtain the first classification result. This step specifically includes: Input the TCM synthetic medical record data into the first-stage binary classification routing module of the TCM medical record subject classification model; A binary classification mapping was performed on the synthetic medical record data of traditional Chinese medicine to obtain the classification results of internal medicine medical records and the medical record data of specialty medical records. The internal medicine medical record classification results are labeled with internal medicine tags and directly used as the output of the TCM medical record classification model. Specialty medical record data are used as the input of the keyword mining module.
6. The method for classifying TCM medical records by specialty based on a large language model and keyword arbitration as described in claim 5, is characterized in that... The keyword mining module based on the TCM medical record classification model performs keyword arbitration on the specialty medical record data in the first classification result to obtain specialty feature keywords. This step specifically includes: Input the specialist medical case data from the first classification result into the keyword mining module of the TCM medical case classification model; Keyword mining was performed on the specialist medical record data in the first classification results to construct a specialist discrimination thesaurus. If the specialty discrimination thesaurus meets the preset keyword hitting rules, it will be directly output as the specialty medical record classification result; If the specialized subject discrimination terminology does not meet the preset keyword hitting rules, then the specialized subject discrimination terminology will be extracted to obtain specialized subject characteristic keywords.
7. The method for classifying TCM medical records by specialty based on a large language model and keyword arbitration as described in claim 6, characterized in that, The keyword mining step specifically includes: Based on specialized medical records, candidate keywords were statistically analyzed and screened based on inter-class differences. GPT-4o was used to perform semantic cleaning and refinement of candidate keywords, and a specialized discrimination thesaurus was constructed in conjunction with manual review.