An electronic prescription intelligent generation method based on deep learning

By constructing a relational graph and knowledge graph for TCM electronic prescriptions using deep learning technology, and combining graph convolutional networks and multilayer perceptron regression networks, the problem of insufficient deep correlation between symptoms and medicinal materials in TCM electronic prescriptions is solved. This enables personalized recommendations of medicinal material types and dosages, improving the safety and clinical applicability of prescriptions.

CN123182897APending Publication Date: 2026-11-27CHENGDU WENJIANG YUJUN FANG INTERNET HOSPITAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611317580.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies for generating electronic prescriptions in Traditional Chinese Medicine lack systematic modeling of the deep relationship between symptoms and medicinal materials and the overall structure, resulting in deficiencies in the clinical rationality and personalized recommendations of prescriptions.

Method used

A deep learning-based approach is adopted, using the BERT model to encode the semantic vectors of symptoms and medicinal materials, constructing association graphs and knowledge graphs, and combining graph convolutional networks and multilayer perceptron regression networks to achieve high-order semantic fusion of symptoms and medicinal materials and dosage prediction, while taking into account the differences in patients' physical conditions for personalized adjustments.

Benefits of technology

It improves the end-to-end prediction accuracy of TCM electronic prescriptions, enables personalized recommendations of medicinal materials and dosages, enhances the safety and clinical applicability of prescriptions, and ensures the matching degree and coverage of principal drugs with patient symptoms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123182897A_ABST
    Figure CN123182897A_ABST
Patent Text Reader

Abstract

The application discloses an electronic prescription intelligent generation method based on deep learning, and relates to the technical field of medical services.The electronic prescription intelligent generation method comprises the following steps: encoding a standardized new patient symptom text into a 256-dimensional semantic vector, inputting the semantic vector into a graph neural network, obtaining a dense feature vector of the new patient symptom, generating a prediction probability of each medicinal material, selecting a medicinal material set with a probability greater than a threshold value, and generating an electronic prescription containing medicinal material categories.The application realizes structured modeling of complex topological relationships and high-order semantic fusion between symptoms and medicinal materials by inputting a correlation graph and a knowledge graph into a graph convolution network, solves the problem that the prior art lacks understanding of deep-layer association and global structure of symptoms and medicinal materials in TCM syndrome differentiation and treatment, and improves end-to-end prediction accuracy of the model from symptoms to medicinal materials and recognition ability of low-frequency key medicinal materials.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical service technology, specifically to a method for intelligent generation of electronic prescriptions based on deep learning. Background Technology

[0002] Electronic prescriptions, as a core component of the medical process, play a crucial role in connecting diagnosis and treatment. In the field of Traditional Chinese Medicine (TCM), generating electronic prescriptions is particularly complex. It requires not only accurately extracting key information from the patient's symptom description but also selecting a combination of herbs from thousands of medicinal materials that match the symptoms, based on the TCM theory of syndrome differentiation and treatment, while simultaneously considering the incompatibilities and synergies between the herbs. Traditional TCM prescriptions rely heavily on the physician's personal experience and knowledge, which suffers from strong subjectivity, difficulties in passing on experience, and insufficient resources in primary healthcare settings.

[0003] Most existing methods only utilize the direct co-occurrence information between symptoms and medicinal materials, lacking a systematic model of the deep relationship between the two and the inherent knowledge structure among medicinal materials. This makes it difficult to fully capture the complex compatibility logic and holistic thinking in TCM syndrome differentiation and treatment, resulting in limitations in the clinical rationality of the generated prescriptions.

[0004] Patent CN114530226A discloses a method and apparatus for generating electronic prescriptions, an electronic device, and a storage medium. The above patent enables the identification of diagnostic information areas and medication information areas from paper prescription images, simplifies the electronic prescription generation process, and improves the accuracy and efficiency of digitizing paper prescriptions.

[0005] The aforementioned patent can perform targeted processing on the diagnostic information area and the medication information area, thereby obtaining diagnostic and medication information, and generating electronic prescriptions based on the integrated diagnostic and medication information, solving the problem of inconvenient operation in the process of generating electronic prescriptions, but there is still room for optimization in terms of the deep correlation between symptoms and medicinal materials.

[0006] To this end, this application proposes a deep learning-based intelligent generation method for electronic prescriptions that enables structured modeling of high-order semantic fusion. Summary of the Invention

[0007] The purpose of this invention is to provide a deep learning-based intelligent electronic prescription generation method to solve the technical problems mentioned in the background art, which rely only on text co-occurrence or shallow matching and lack a deep understanding of the relationship between symptoms and medicinal materials and the global structure in traditional Chinese medicine diagnosis and treatment.

[0008] To achieve the above objectives, the present invention provides the following technical solution: a method for intelligently generating electronic prescriptions based on deep learning, the method comprising the following steps:

[0009] S1. Perform symptom segmentation and herbal standardization on historical prescription texts. Use the BERT model to encode symptom texts and herbal names into 256-dimensional semantic vectors. Construct an association graph based on the co-occurrence frequency of symptoms and herbs in prescriptions. Construct a herbal knowledge graph based on traditional Chinese medicine theory.

[0010] S2. Count the frequency of each medicinal material, identify the minority class labels with low frequency, and resample the original dataset using a multi-label upsampling method to generate a balanced dataset;

[0011] S3. Input the association graph and knowledge graph into the graph convolutional network. Use the 256-dimensional semantic vectors of symptoms and medicinal materials as the initial node features. Aggregate the information of neighboring nodes through multiple convolutions to output dense feature vectors of symptoms and medicinal materials. Perform the inner product of the feature vectors of symptoms and medicinal materials and obtain the predicted probability of each medicinal material through the sigmoid function. Use the balanced dataset as the training set and the predicted probability as the output to train the model parameters of the graph neural network.

[0012] S4. Encode the standardized new patient symptom text into a 256-dimensional semantic vector, input it into the graph neural network trained in step S3, obtain the dense feature vector of the new patient symptoms, generate the predicted probability of each medicinal material, select the set of medicinal materials with a probability greater than the threshold, and generate an electronic prescription containing the types of medicinal materials.

[0013] Preferably, the electronic prescription intelligent generation method further includes the following steps:

[0014] S5. Normalize the recommended baseline dose of each medicinal material extracted from the Chinese Pharmacopoeia and copy it to 32 dimensions to form a 32-dimensional vector. Concatenate the 256-dimensional semantic vector of the medicinal material with the 32-dimensional vector to form the medicinal material embedding feature, resulting in a 288-dimensional medicinal material embedding feature vector.

[0015] S6. The dense feature vector of symptoms output in step S3 is concatenated with the 288-dimensional herbal embedding feature vector to form the MLP input vector. The MLP input vector is then input into the multilayer perceptron regression network. Forward propagation is performed to obtain the predicted dose. The actual dose in the historical prescription is used as the regression target. After calculating the mean squared error loss, backpropagation is performed to update the weight parameters and save the trained MLP model.

[0016] S7. The 256-dimensional semantic vector and 32-dimensional baseline dose vector corresponding to the selected medicinal materials in the electronic prescription of step S4 are concatenated to form the medicinal material embedding feature vector of the prescription. The medicinal material embedding feature vector of the prescription is concatenated with the symptom dense feature vector output in step S4, and input into the trained MLP model to generate the predicted dose of the medicinal materials. The output is an electronic prescription containing the type of medicinal materials and the corresponding dose.

[0017] Preferably, the electronic prescription intelligent generation method further includes the following steps:

[0018] S8. Based on the "Classification and Judgment of Traditional Chinese Medicine Constitutions" standard, patients' constitutions are divided into nine types: balanced constitution, qi deficiency constitution, yang deficiency constitution, yin deficiency constitution, phlegm-dampness constitution, damp-heat constitution, blood stasis constitution, qi stagnation constitution, and special constitution. A list of medicinal materials that are suitable and unsuitable for patients' constitutions is compiled to form a constitution-medicinal material matching rule library.

[0019] S9. Compare each herb in the electronic prescription generated in step S4 with the constitution-herb matching rule library. When a herb is a contraindicated herb for the new patient's constitution type, replace the contraindicated herb in the original electronic prescription with a substitute herb that has similar effects to the contraindicated herb and does not fall within the scope of contraindications.

[0020] S10. Query the constitution-dosage adjustment coefficient table according to the new patient's constitution type, multiply the obtained adjustment coefficient by the predicted dose of the medicinal materials generated in step S7, and obtain the final dose after constitution adjustment to form a personalized electronic prescription adapted to the new patient's constitution.

[0021] Preferably, step S4 further includes the following step:

[0022] S4.1 Select the 1-2 herbs with the highest predicted probability from the generated electronic prescription as candidate principal herbs. Calculate the cosine similarity between the 256-dimensional semantic vector of the principal herbs and the 256-dimensional semantic vector of all symptoms of the new patient one by one, and take the average of all similarities as the principal herb-symptom matching degree.

[0023] S4.2 Count the number of symptoms in new patients whose similarity to the principal drug is higher than the threshold, and calculate the proportion of the number of symptoms higher than the threshold to the total number of symptoms in new patients as the coverage of the principal drug;

[0024] S4.3 When the principal drug-symptom matching degree is higher than 0.5 and the principal drug coverage is higher than 60%, the prescription is determined to be effective in addressing the symptoms, and the original electronic prescription is output as the final prescription.

[0025] Preferably, the association diagrams in step S1 include: symptom-symptom association diagrams, symptom-medicinal herb association diagrams, and medicinal herb-medicinal herb association diagrams.

[0026] Preferably, the process of constructing the medicinal material knowledge graph in step S1 is as follows:

[0027] Based on authoritative TCM classics, specific attribute values ​​of each medicinal material are extracted from five categories: Five Elements, Meridian Tropism, Flavor, Classification, and Temperament. Directed relationship edges are established between each medicinal material and its corresponding attribute value, forming five categories of medicinal material-attribute relationship edges.

[0028] Calculate the similarity between two medicinal herbs across all attribute dimensions to obtain a comprehensive similarity value across five dimensions. Set a similarity threshold and add undirected edges between medicinal herb pairs that exceed the threshold. The weight of each edge is the comprehensive similarity value. Construct similarity edges between medicinal herbs and generate a medicinal herb knowledge graph containing both medicinal herb-attribute edges and medicinal herb-medicine edges.

[0029] Preferably, step S4.1 further includes: when the matching degree between the candidate principal drug and the new patient's symptoms is less than 0.5, selecting 1-2 medicinal materials with the second highest predicted probability from the generated electronic prescription as new candidate principal drugs, and recalculating the matching degree between the principal drug and symptoms until the matching degree is higher than 0.5.

[0030] Preferably, step S10 further includes: comparing the final dose after body constitution adjustment with the recommended baseline dose range of medicinal materials extracted from the Chinese Pharmacopoeia; and when the final dose after adjustment exceeds the recommended baseline dose range, adjusting the dose to the nearest boundary value within the recommended baseline dose range.

[0031] Preferably, step S4.3 further includes: when no candidate principal drug meets the conditions of principal drug-symptom matching degree higher than 0.5 and principal drug coverage higher than 60% after traversing all the medicinal materials in the electronic prescription, return to step S4 to regenerate the prescription.

[0032] Preferably, the new patient constitution type in step S9 is generated by using a rule-based scoring method on the new patient's constitution questionnaire information.

[0033] Compared with the prior art, the beneficial effects of the present invention are:

[0034] 1. This invention inputs a convolutional graph network with an association graph and a knowledge graph, using 256-dimensional semantic vectors of symptoms and medicinal materials as initial node features. Through multi-layer convolution, it aggregates neighbor node information and outputs dense feature vectors of symptoms and medicinal materials. This achieves structured modeling of the complex topological relationship and high-order semantic fusion between symptoms and medicinal materials. It solves the problems of existing technologies that rely only on text co-occurrence or shallow matching and lack understanding of the deep relationship and global structure between symptoms and medicinal materials in TCM syndrome differentiation and treatment. This improves the end-to-end prediction accuracy of the model from symptoms to medicinal materials and the ability to identify low-frequency key medicinal materials.

[0035] 2. This invention uses a multilayer perceptron regression network for dose prediction, achieving end-to-end extension from recommending medicinal materials to generating medicinal dosage. This solves the shortcomings of existing technologies that can only generate medicinal material types and cannot provide specific dosages, as well as the problem of dosage mismatch between the patient's symptoms due to relying solely on fixed dosages or manual experience.

[0036] 3. This invention adjusts the predicted dose based on the dose adjustment coefficient queried according to the patient's constitution type, realizing the upgrade of prescription from general recommendation to individualized constitution adaptation. It solves the problem in the prior art that ignores the differences in the patient's constitution, which may lead to adverse reactions or reduced efficacy due to the contradiction between the drug properties and the constitution. It improves the safety and clinical applicability of prescription.

[0037] 4. This invention verifies the effectiveness of prescriptions by setting dual thresholds, thereby enabling self-checking of the quality of prescriptions generated by the model. It solves the problem of insufficient matching between the principal drug and the patient's main symptoms in the existing technology, realizes the quantitative assessment of the coverage of the principal drug for the patient's symptoms, and improves the prescription's ability to cover the patient's overall condition. Attached Figure Description

[0038] Figure 1 This is a schematic diagram of the electronic prescription generation process that includes the types of medicinal materials of the present invention;

[0039] Figure 2 This is a schematic diagram of the process for generating the predicted dosage of medicinal materials according to the present invention;

[0040] Figure 3 This is a schematic diagram of the personalized electronic prescription generation process of the present invention;

[0041] Figure 4 This is a schematic diagram of the electronic prescription verification process of the present invention;

[0042] Figure 5 This is a schematic diagram of the process for constructing a medicinal material knowledge graph according to the present invention;

[0043] Figure 6 This is a schematic diagram of the association of the present invention. Detailed Implementation

[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0045] Example 1, please refer to Figure 1 and Figure 6 A deep learning-based intelligent electronic prescription generation method includes the following steps:

[0046] S1. Perform symptom segmentation and herbal standardization on historical prescription texts. Use the BERT model to encode symptom texts and herbal names into 256-dimensional semantic vectors. Construct an association graph based on the co-occurrence frequency of symptoms and herbs in prescriptions. Construct a herbal knowledge graph based on traditional Chinese medicine theory.

[0047] S2. Count the frequency of each medicinal material, identify the minority class labels with low frequency, and resample the original dataset using a multi-label upsampling method to generate a balanced dataset;

[0048] S3. Input the association graph and knowledge graph into the graph convolutional network. Use the 256-dimensional semantic vectors of symptoms and medicinal materials as the initial node features. Aggregate the information of neighboring nodes through multiple convolutions to output dense feature vectors of symptoms and medicinal materials. Perform the inner product of the feature vectors of symptoms and medicinal materials and obtain the predicted probability of each medicinal material through the sigmoid function. Use the balanced dataset as the training set and the predicted probability as the output to train the model parameters of the graph neural network.

[0049] S4. Encode the standardized new patient symptom text into a 256-dimensional semantic vector, input it into the graph neural network trained in step S3, obtain the dense feature vector of the new patient symptoms, generate the predicted probability of each medicinal material, select the set of medicinal materials with a probability greater than the threshold, and generate an electronic prescription containing the types of medicinal materials.

[0050] Furthermore, in step S1, relevant prescriptions are extracted from ancient and modern TCM classics and online TCM clinical classic diagnosis and treatment cases, including patient symptom descriptions and medicinal material information. Punctuation marks, dosage units, and irrelevant descriptions in the prescriptions are removed. A domain-specific word segmentation model, fine-tuned for ancient TCM books and modern medical record corpora, is used, such as the TCM domain word segmentation model based on the BERT-base architecture. This model has been pre-trained and fine-tuned multiple times on classic ancient books such as the *Huangdi Neijing* and *Shanghan Zabing Lun*, as well as a massive amount of modern TCM outpatient medical record corpora, to segment the symptom text in the prescriptions, dividing continuous text into independent symptom words. For example, the word segmentation result for "cough with phlegm and chest tightness" is "cough" and "phlegm". The term "chest tightness" was used, and synonymous symptoms were standardized into standard terms. For example, "headache" was standardized into "headache." The standardization of synonymous symptoms was based on authoritative industry standards such as the "Classification and Code of Diseases and Syndromes in Traditional Chinese Medicine" and the "Standardization of Terminology for Symptoms in Traditional Chinese Medicine," as well as clinical consensus in traditional Chinese medicine. A symptom term mapping dictionary was constructed to normalize the same symptom expressed differently. The names of each medicinal material were extracted from historical prescription texts, and according to the medicinal material naming standards in the "Chinese Pharmacopoeia," the identified alternative names and variant names were standardized into standard names. For example, all instances of "shuanghua" and "erhua" in the prescription were standardized into "jinyinhua." BERT-TCM (Traditional Chinese Medicine) was selected after secondary pre-training on traditional Chinese medicine clinical corpora. The Chinese Medicine model adds [CLS] and [SEP] tags to symptom texts or herbal names. The text of a single symptom or herbal name is input into the BERT model. The 768-dimensional vector corresponding to the [CLS] tag output by the last layer of BERT is taken and reduced to 256 dimensions through a linear transformation layer as the final semantic vector of the symptom. For compound symptoms composed of multiple words, such as thin white tongue coating, the average of all its token vectors is taken as the representation of the symptom, and the 256-dimensional semantic vector corresponding to the symptom text or herbal name is output.

[0051] In step S2, the frequency of medicinal materials used in real historical prescription data exhibits a typical long-tail distribution. High-frequency materials such as licorice, angelica, and astragalus appear in a large number of prescriptions, while low-frequency materials such as strychnine, tripterygium wilfordii, and antelope horn appear only in a very small number of prescriptions. This class imbalance causes the trained model to tend to predict common materials while ignoring rare materials that are crucial for specific symptoms, thus reducing the effectiveness of the prescription. By traversing all historical prescriptions and counting the total number of occurrences of each standardized medicinal material, the median method or a custom percentile method is used to determine the threshold for classifying the minority class. For example, the median frequency of all medicinal materials is calculated, and materials with frequencies below the median are classified as minority class. The dataset is divided into minority class labels, or an absolute threshold is set (e.g., occurrence count < 50 times). Labels below this value are considered minority class labels. The process of resampling the original dataset using a multi-label upsampling method is as follows: For each minority class label (medicinal material), all historical prescriptions containing that medicinal material are collected to form a corresponding subset. Based on the frequency difference between minority and majority class medicinal materials, a sampling multiplier k is set (e.g., k=2), which aims to double the number of minority class samples. Then, each minority class prescription subset is repeatedly sampled and added to the original dataset, finally generating a balanced dataset. In this dataset, the number of prescription samples containing low-frequency medicinal materials is significantly increased, and the distribution of medicinal materials in each category is more uniform.

[0052] In step S3, the association graph and medicinal herb knowledge graph constructed in step S1 are combined with the balanced dataset generated in step S2. A graph convolutional network is used to perform message passing and feature aggregation on the graph, learning a dense node representation that integrates topological structure and semantic information, achieving end-to-end prediction from symptoms to medicinal herbs. The symptom-symptom association graph, symptom-medicinal herb association graph, and medicinal herb association graph constructed in step S1, along with the medicinal herb knowledge graph built based on traditional Chinese medicine theory, are then fused. Specifically, all symptom nodes are extracted from the symptom-symptom association graph, and all medicinal herb nodes are extracted from the medicinal herb association graph. These two types of nodes are merged to form a heterogeneous graph with a complete set of nodes. Edges between symptom nodes are extracted from the symptom-symptom association graph, with the edge weight being the co-occurrence frequency of the two symptoms in the prescription. Edges between medicinal herb nodes are extracted from the medicinal herb association graph, with the edge weight being the co-occurrence frequency of the two medicinal herbs in the prescription. Co-occurrence frequency; extract edges between symptom nodes and medicinal material nodes from the symptom-medicinal material association graph, with the edge weight being the co-occurrence frequency of symptoms and medicinal materials in the prescription; assign a unified numerical number to all symptom nodes and medicinal material nodes, and store all extracted edges in the format of start number, end number, edge weight, and edge type (e.g., symptom-symptom edge, medicinal material-medicinal material edge, symptom-medicinal material edge, medicinal material-attribute edge) as an adjacency list or adjacency matrix; use the 256-dimensional semantic vector of symptoms output by the BERT model in step S1 as the initial feature vector of symptom nodes, and use the 256-dimensional semantic vector of medicinal materials output by the BERT model as the initial feature vector of medicinal material nodes; output a heterogeneous graph containing symptom nodes, medicinal material nodes, and various types of edges; input the fused heterogeneous graph into a graph convolutional network; for each node, aggregate the feature information of all its neighboring nodes; for node i, its first layer updated feature vector h i (1) Calculation formula: Where node i is the central node currently updating features, node j is a neighboring node of node i, N(i) represents the set of neighboring nodes of node i (including symptom neighbors and herb neighbors), and d i and d j W represents the degree of node i and node j, respectively, which is the total number of edges connecting nodes i and j in the fused heterogeneous graph. (1) h is the first layer's learnable weight matrix. j (0) Let h be the initial feature vector of node j, and σ be the ReLU activation function; then the feature vector h output from the first layer is... i (1) As the input to the second layer of graph convolution, the aggregation process is repeated. After the l-th layer of convolution, the feature vector h of node i is obtained. i (l)It includes the structural and feature information of its l-th order neighbors; after multiple convolutions, each node fuses the features of its higher-order topological neighbors to obtain the final dense feature vector; the feature vectors of all symptom nodes in the patient symptom set are taken, averaged or summed to obtain the symptom aggregate representation; for each herb, its inner product with the symptom aggregate representation is calculated, and the prediction probability is obtained through the sigmoid function, outputting the prediction probability of each herb, with a probability value between 0 and 1, indicating the likelihood that the herb is recommended for the current symptom; the difference between the predicted probability and the true label is calculated using the binary cross-entropy loss function, and the loss value is calculated using the following formula: Where: M is the total number of medicinal materials, y t For the true label of the tth medicinal material (0 or 1), p t Let t be the predicted probability of the t-th medicinal material. The smaller the loss value, the closer the model prediction result is to the actual prescription. The calculated loss value is used to calculate the gradient of all weight parameters in the graph convolutional network layer by layer through the backpropagation algorithm. The Adam optimizer is used to update the network parameters according to the gradient value. Multiple rounds of iterative training are performed on the sample data in the balanced dataset. After training is completed, the optimal weight parameters of the network are saved.

[0053] In step S4, the TCM domain word segmentation model from S1 is used to extract standardized symptom entities from the patient's chief complaint. These extracted symptom entities are then mapped to a standard symptom vocabulary. For example, the input text: "Patient has chills and fever for three days, accompanied by headache, body aches, no sweating, thin white tongue coating, and a floating, tight pulse." Its standardized symptom set is ["chills", "fever", "headache", "body aches", "no sweating", "thin white tongue coating", "floating, tight pulse"]. Each standardized symptom text is input into the BERT model used in S1 to obtain its 768-dimensional hidden layer representation. This is then reduced to 256 dimensions through a linear transformation layer to obtain the semantic vector for each symptom. If a symptom has appeared in the training set, its encoding result remains consistent with the encoding space during training. The 256-dimensional semantic vector v of the new patient's symptoms is then used. new Input the graph neural network trained in step S3, and the graph neural network will v newAs the initial features for new symptom nodes, the feature information of neighboring nodes in the association graph and knowledge graph is aggregated through trained multi-layer graph convolution operations to output a dense feature vector of the new patient's symptoms. The dense feature vector of the new patient's symptoms output by the graph neural network is then subjected to inner product operation with the dense feature vectors of all medicinal materials output by the graph neural network one by one to obtain the matching score between the new patient's symptoms and each medicinal material. The inner product result is input into the sigmoid function for normalization to generate the predicted probability of each medicinal material. The probability value is between 0 and 1. A probability threshold θ (e.g., 0.5) is set, and the predicted probabilities of all medicinal materials are traversed. Medicinal materials with predicted probabilities greater than the threshold θ are selected. If there are too many candidate medicinal materials (e.g., more than 20), the 10-15 medicinal materials with the highest probabilities can be selected to form a recommended medicinal material set. The selected medicinal material set is output as an electronic prescription containing the types of medicinal materials. If the predicted probabilities of all candidate medicinal materials are lower than 0.3, it indicates that the model has a very low grasp of the current symptoms. At this time, the prompt "Confidence is too low, manual prescription is recommended" is directly output.

[0054] Example 2, please refer to Figure 2 A deep learning-based intelligent electronic prescription generation method, which further includes the following steps:

[0055] S5. Normalize the recommended baseline dose of each medicinal material extracted from the Chinese Pharmacopoeia and copy it to 32 dimensions to form a 32-dimensional vector. Concatenate the 256-dimensional semantic vector of the medicinal material with the 32-dimensional vector to form the medicinal material embedding feature, resulting in a 288-dimensional medicinal material embedding feature vector.

[0056] S6. The dense feature vector of symptoms output in step S3 is concatenated with the 288-dimensional herbal embedding feature vector to form the MLP input vector. The MLP input vector is then input into the multilayer perceptron regression network. Forward propagation is performed to obtain the predicted dose. The actual dose in the historical prescription is used as the regression target. After calculating the mean squared error loss, backpropagation is performed to update the weight parameters and save the trained MLP model.

[0057] S7. The 256-dimensional semantic vector and 32-dimensional baseline dose vector corresponding to the selected medicinal materials in the electronic prescription of step S4 are concatenated to form the medicinal material embedding feature vector of the prescription. The medicinal material embedding feature vector of the prescription is concatenated with the symptom dense feature vector output in step S4, and input into the trained MLP model to generate the predicted dose of the medicinal materials. The output is an electronic prescription containing the type of medicinal materials and the corresponding dose.

[0058] Furthermore, in step S5, for each medicinal material recorded in the Chinese Pharmacopoeia, the recommended dosage for internal decoction is adopted. For medicinal materials not included in the Pharmacopoeia, the conventional dosage in the Chinese Materia Medica or Chinese Materia Medica textbooks is referenced. For each medicinal material, the lower limit d of its dosage range is extracted. min and upper limit d maxMin-Max normalization is used to compress the dose values ​​to the [0, 1] interval, and the lower limit of normalization d norm_min =(d min -D min ) / (D max -D min ), normalized upper limit d norm_max =(d max -D min ) / (D max -D min ), where D min D represents the minimum lower limit of dosage for all medicinal materials. max To find the maximum upper limit of dosage for all medicinal materials, the normalized lower and upper limits of dosage are replicated and extended to 32 dimensions, with the first 16 dimensions filled with d. min Fill in d for the last 16 dimensions. max The 256-dimensional semantic vector of the medicinal material and the 32-dimensional dose vector are concatenated along the channel dimension. The resulting 288-dimensional embedded feature vector carries the semantic information of the medicinal material in the first 256 dimensions and the quantitative information of the medicinal material in the last 32 dimensions.

[0059] In step S6, the dense symptom feature vector output by the convolutional network in step S3 is obtained. This dense symptom feature vector is concatenated with the 288-dimensional embedded feature vector to form the MLP input vector. A multilayer perceptron regression network is then constructed. The input layer has the same dimension as the concatenated layer. Hidden layer 1 has 128 neurons, using the ReLU activation function with a dropout rate of 0.3. Hidden layer 2 has 64 neurons, using the ReLU activation function. The output layer has one neuron, using a linear activation function (no activation function), and outputs the predicted dose value. The MLP input vector is input into the multilayer perceptron regression network. After linear transformation and nonlinear activation in each hidden layer, the final output layer outputs the predicted dose of the herb. The median of the baseline dose range of the herb is used as the regression target. The mean squared error loss function is used to calculate the difference between the predicted dose and the actual dose. Where N is the total number of training samples, d p,a Let d be the predicted dose for the a-th sample. t,a Let the true dose of the a-th sample be the median of the baseline dose range of the medicinal material. The calculated loss value is used to calculate the gradient of all weight parameters in the multilayer perceptron layer by layer through the backpropagation algorithm. The Adam optimizer is selected to update the network parameters and perform multiple rounds of iterative training. After training is completed, the optimal weight parameters of the multilayer perceptron regression network are saved.

[0060] In step S7, each selected herb is traversed from the electronic prescription generated in step S4 to obtain a 256-dimensional semantic vector, which is encoded by the BERT model in step S1. A 32-dimensional baseline dose vector is also obtained, which is obtained by normalizing the baseline dose extracted from the Chinese Pharmacopoeia and copying it to 32 dimensions in step S5. The 256-dimensional semantic vector and the 32-dimensional baseline dose vector are concatenated to form a 288-dimensional embedding feature vector for the herb. The new patient symptom density feature vector output in step S4 is concatenated with the 288-dimensional embedding feature vector for the herb constructed in this step to form a new MLP input vector. This MLP input vector is then input into the multilayer LP trained in step S6. The perceptron regression network outputs the predicted dose value of the medicinal material, which is in grams and represents the recommended dosage of the medicinal material under the current patient symptoms. For all the medicinal materials selected in the electronic prescription in step S4, the predicted dose value of each medicinal material is calculated one by one to obtain the predicted dose set corresponding to each medicinal material. The predicted dose of each medicinal material is compared with the recommended dose range of the medicinal material in the Chinese Pharmacopoeia. If the predicted dose exceeds the recommended range, the dose is adjusted to the nearest boundary value within the recommended range. The medicinal material type generated in step S4 is combined with the predicted dose verified in step S7 to output a complete electronic prescription containing the medicinal material type and corresponding dose, for example: medicinal material name: licorice, dosage: 6 grams, etc.

[0061] Example 3, please refer to Figure 3 A deep learning-based intelligent electronic prescription generation method, which further includes the following steps:

[0062] S8. Based on the "Classification and Judgment of Traditional Chinese Medicine Constitutions" standard, patients' constitutions are divided into nine types: balanced constitution, qi deficiency constitution, yang deficiency constitution, yin deficiency constitution, phlegm-dampness constitution, damp-heat constitution, blood stasis constitution, qi stagnation constitution, and special constitution. A list of medicinal materials that are suitable and unsuitable for patients' constitutions is compiled to form a constitution-medicinal material matching rule library.

[0063] S9. Compare each herb in the electronic prescription generated in step S4 with the constitution-herb matching rule library. When a herb is a contraindicated herb for the new patient's constitution type, replace the contraindicated herb in the original electronic prescription with a substitute herb that has similar effects to the contraindicated herb and does not fall within the scope of contraindications.

[0064] S10. Query the constitution-dosage adjustment coefficient table according to the new patient's constitution type, multiply the obtained adjustment coefficient by the predicted dose of the medicinal materials generated in step S7, and obtain the final dose after constitution adjustment to form a personalized electronic prescription adapted to the new patient's constitution.

[0065] Furthermore, in step S8, for each constitution type, based on basic TCM theory and clinical experience, its constitution characteristics and corresponding medication principles are summarized. For example, the balanced constitution is characterized by harmonious Yin and Yang, moderate physique, and rosy complexion. The medication principle is to use mild tonification and purgation, and it is not advisable to use excessively strong cold or hot herbs. For each constitution type, a list of suitable medicinal materials is compiled. Suitable medicinal materials refer to those whose medicinal properties and effects are compatible with the patient's constitution and can improve the imbalance of the constitution or treat related diseases. For example, suitable medicinal materials for the Yang deficiency constitution include cinnamon, aconite, dried ginger, and deer antler. At the same time, for each constitution type, a list of incompatible medicinal materials is compiled. Incompatible medicinal materials refer to those whose properties and effects are compatible with the patient's constitution and can improve the imbalance of the constitution or treat related diseases. The properties of certain medicines may conflict with a patient's constitution, potentially exacerbating the imbalance or triggering adverse reactions. For example, those with a Yang deficiency constitution should avoid herbs such as Coptis chinensis, Scutellaria baicalensis, Gypsum fibrosum, Anemarrhena asphodeloides, and Rheum palmatum. The nine constitution types and their corresponding lists of suitable and incompatible herbs are structured and stored to form a constitution-herb matching rule library. Traditional Chinese medicine experts are invited to review and verify this library to ensure that the lists of suitable and incompatible herbs conform to TCM theory and clinical practice. Furthermore, the rule library is updated every six months based on the latest clinical research and pharmacopoeia revisions, and the relevant rules are updated whenever the National Medical Products Administration issues a new adverse reaction report for traditional Chinese medicine.

[0066] In step S9, the constitution questionnaire information of new patients is collected (such as the scoring items in the "Classification and Judgment Table of Traditional Chinese Medicine Constitution"). Using a rule-based scoring method, the new patient is determined to be one or a combination of nine constitution types, and a constitution type label is output. For example, the patient's constitution is determined to be Yang deficiency. Each herb in the electronic prescription generated in step S4 is iterated through, and each herb is compared with the constitution-herb matching rule library constructed in step S8. The list of incompatible herbs corresponding to the new patient's constitution type is queried in the rule library to determine whether the herbs in the prescription fall within the incompatible range. For example, if the patient's constitution is Yang deficiency and the prescription contains Coptis chinensis, an incompatible herb warning is triggered. When a herb is determined to be an incompatible herb for the patient's constitution type, the list of suitable herbs corresponding to the patient's constitution type is queried from the constitution-herb matching rule library. In the list of medicinal materials, alternative medicinal materials with similar effects to the incompatible medicinal materials are searched. The cosine similarity between the 256-dimensional semantic vector of the incompatible medicinal material and the 256-dimensional semantic vector of each compatible medicinal material is calculated. The compatible medicinal material with the highest cosine similarity that is not in the incompatible category is selected as the alternative medicinal material. For example, if a patient has a Yang deficiency constitution, and the incompatible medicinal material is Coptis chinensis, alternative medicinal materials with similar effects to Coptis chinensis are searched from the compatible medicinal materials for Yang deficiency. If the semantic vector of Cinnamomum cassia has a high cosine similarity to Coptis chinensis, Cinnamomum cassia is selected as the alternative medicinal material. The incompatible medicinal material in the original electronic prescription is replaced with the searched alternative medicinal material, the medicinal material categories in the prescription are updated, and a replacement log is recorded after the replacement, including the original medicinal material name, the alternative medicinal material name, and the reason for the replacement. The electronic prescription after constitution matching verification and replacement is output. If there is no incompatible medicinal material in the prescription, the original prescription is output directly.

[0067] In step S10, based on the "Classification and Determination of Traditional Chinese Medicine Constitution" standard and clinical experience in TCM medication, a constitution-dose adjustment coefficient table is constructed, defining the dose adjustment coefficients for different types of medicinal materials. These adjustment coefficients reflect the differences in tolerance and sensitivity of patients with different constitutions to various medicinal materials. The constitution-dose adjustment coefficients are expressed as follows:

[0068]

[0069] If the patient has a combined constitution (such as Qi deficiency and Yang deficiency), the weighted average of the adjustment coefficients for each constitution type is taken as the final adjustment coefficient. Based on the medicinal knowledge graph constructed in step S1, the medicinal property classification of each medicinal material is queried. Based on the medicinal property classification of each medicinal material, the adjustment coefficient corresponding to the medicinal material is matched from the constitution-dose adjustment coefficient table. The predicted dose of the medicinal material generated in step S7 is multiplied by the adjustment coefficient matched in step S7 to obtain the final dose after constitution adjustment. The final dose after constitution adjustment is compared with the recommended dose range of the medicinal material in the Chinese Pharmacopoeia. If the adjusted dose exceeds the recommended range, the dose is adjusted to the nearest boundary value within the recommended range.

[0070] Example 4, please refer to Figure 4 A deep learning-based intelligent electronic prescription generation method, S4 further includes the following steps:

[0071] S4.1 Select the 1-2 herbs with the highest predicted probability from the generated electronic prescription as candidate principal herbs. Calculate the cosine similarity between the 256-dimensional semantic vector of the principal herbs and the 256-dimensional semantic vector of all symptoms of the new patient one by one, and take the average of all similarities as the principal herb-symptom matching degree.

[0072] S4.2 Count the number of symptoms in new patients whose similarity to the principal drug is higher than the threshold, and calculate the proportion of the number of symptoms higher than the threshold to the total number of symptoms in new patients as the coverage of the principal drug;

[0073] S4.3 When the principal drug-symptom matching degree is higher than 0.5 and the principal drug coverage is higher than 60%, the prescription is determined to be effective in addressing the symptoms, and the original electronic prescription is output as the final prescription.

[0074] Furthermore, from the electronic prescription generated in step S4, each medicinal herb is sorted from highest to lowest predicted probability. The 1-2 herbs with the highest predicted probabilities are selected as candidate principal herbs. The principal herb is the drug in the prescription that plays the main therapeutic role against the primary symptom; its highest predicted probability indicates that the model considers it to be the strongest match between the herb and the patient's symptoms. From step S4, a 256-dimensional semantic vector set of all standardized symptoms of the new patient is obtained, and the 256-dimensional semantic vector v of the principal herb is... m With each patient's symptom, a 256-dimensional semantic vector v s Calculate the cosine similarity for each case. , where ||v m ||and||v s || represents the magnitude of the two vectors. The cosine similarity value ranges from -1 to 1. The average cosine similarity between the principal drug and all symptoms is taken as the principal drug-symptom matching degree. The higher the matching degree, the closer the semantics of the principal drug is to the semantics of the patient's overall symptoms. The more directly the principal drug can target the patient's core symptoms. If two candidate principal drugs are selected, the principal drug-symptom matching degree of each principal drug is calculated separately, and the average of the two is taken as the principal drug-symptom matching degree.

[0075] Set a semantic similarity threshold (e.g., 0.6), obtain a set of cosine similarity values, iterate through the cosine similarity values ​​of all symptoms, count the number of symptoms with similarity higher than the threshold, and calculate the coverage of the principal drug, which is the proportion of the number of symptoms with similarity higher than the threshold to the total number of symptoms of new patients. The closer the coverage is to 1, the more patient symptoms the principal drug can cover, and the higher the degree of matching between the principal drug and the patient's overall symptoms; the closer the coverage is to 0, the more patient symptoms the principal drug can cover, and the lower the degree of matching between the principal drug and the patient's overall symptoms.

[0076] The system determines whether the principal drug-symptom matching degree > 0.5 and the principal drug coverage > 60% are simultaneously met. If both conditions are met, the current prescription is deemed to effectively address the patient's symptoms, and the electronic prescription generated in step S4 is directly output. If neither condition is met, 1-2 herbs with the second-highest predicted probability are selected from the electronic prescription generated in step S4 as new candidate principal drugs. The principal drug-symptom matching degree and the principal drug coverage of the new candidate principal drugs are recalculated, and the double threshold condition is applied again. After traversing all herbs in the electronic prescription, if no candidate principal drug simultaneously meets the conditions of matching degree > 0.5 and coverage > 60%, the prescription is regenerated through step S4. To prevent infinite loop optimization, the maximum number of iterations is set to 3. If the validation still fails after 3 optimizations, the prescription with the highest matching degree and principal drug coverage is output along with a detailed risk warning. In addition, if the number of symptoms is ≤ 2, the coverage threshold is lowered to 50%; if there is only 1 symptom, a matching degree greater than 0.5 is considered acceptable.

[0077] Example 5, please refer to Figure 1 and Figure 5 A method for intelligent generation of electronic prescriptions based on deep learning, the process of constructing a medicinal herb knowledge graph in step S1 is as follows:

[0078] Based on authoritative TCM classics, specific attribute values ​​of each medicinal material are extracted from five categories: Five Elements, Meridian Tropism, Flavor, Classification, and Temperament. Directed relationship edges are established between each medicinal material and its corresponding attribute value, forming five categories of medicinal material-attribute relationship edges.

[0079] Calculate the similarity between two medicinal herbs across all attribute dimensions to obtain a comprehensive similarity value across five dimensions. Set a similarity threshold and add undirected edges between medicinal herb pairs that exceed the threshold. The weight of each edge is the comprehensive similarity value. Construct similarity edges between medicinal herbs and generate a medicinal herb knowledge graph containing both medicinal herb-attribute edges and medicinal herb-medicine edges.

[0080] Furthermore, specific attribute values ​​for each medicinal material in five dimensions—the Five Elements (Wood, Fire, Earth, Metal, Water), the Twelve Meridians (Lung, Heart, Spleen, Liver, Kidney, etc.), the Flavor (Pungent, Sweet, Sour, Bitter, Salty, Bland), the Classification (Exterior-releasing herbs, Heat-clearing herbs, Tonifying herbs, etc.), and the Nature (Cold, Hot, Warm, Cool, Neutral)—are extracted from authoritative classics such as the Compendium of Materia Medica and the Chinese Materia Medica. For example, the attributes of Ephedra can be represented as: belonging to Wood in the Five Elements, entering the Lung and Bladder Meridians, having a pungent flavor, a warm nature, and being classified as an exterior-releasing herb. Directed relation edges are established between each medicinal material and its corresponding five types of attribute values. The direction of the directed edge is from the medicinal material to the attribute value, indicating that the medicinal material possesses that attribute characteristic. Each directed relation edge carries an edge type label, such as Five Elements attribute, Meridian tropism attribute, etc., to distinguish different attribute dimensions.

[0081] For each medicinal herb, one-hot or multi-hot encoding is performed on its five attributes to form an attribute feature vector. The vector dimension is the total number of all attribute values, and each dimension corresponds to a specific attribute value. When the medicinal herb has the attribute value, the corresponding position is 1, otherwise it is 0. The cosine similarity between the attribute feature vectors of two medicinal herbs is calculated. The similarity of the five dimensions is weighted and averaged to obtain a comprehensive similarity score. A similarity threshold (e.g., 0.3) is set, and the similarity values ​​of all medicinal herb pairs are filtered. Only medicinal herb pairs with similarity higher than the threshold are retained, and medicinal herb pairs with low similarity are removed. Undirected edges are added between the retained medicinal herb pairs. The constructed medicinal herb-attribute directed relationship edges and medicinal herb-medicinal herb undirected similarity edges are merged to form a complete medicinal herb knowledge graph.

[0082] Working principle: During the model training phase, symptom segmentation and herbal standardization are performed on historical prescription texts. The BERT model is used to encode symptoms and herbs into 256-dimensional semantic vectors. An association graph is constructed based on co-occurrence frequency, and a herbal knowledge graph is constructed based on traditional Chinese medicine theory. After counting the frequency of herbs, multi-label upsampling is used to generate a balanced dataset. The association graph and knowledge graph are input into a graph convolutional network. Multi-layer convolutional aggregation is performed with semantic vectors as initial node features to output dense feature vectors of symptoms and herbs. The prediction probability is obtained through inner product and sigmoid function. The parameters of the graph neural network model are trained using the balanced dataset as the training set.

[0083] In the prescription generation and dosage prediction stage, the standardized new patient symptom text is encoded into a 256-dimensional semantic vector, which is then input into a trained graph neural network to obtain a dense feature vector of symptoms and generate a predicted probability for each herb. A set of herbs with probabilities greater than a threshold is selected, and the 256-dimensional semantic vector of the herbs is concatenated with a 32-dimensional vector normalized to the baseline dose in the Chinese Pharmacopoeia to form a 288-dimensional embedding feature. This feature is then concatenated with the dense feature vector of symptoms and input into a multilayer perceptron regression network to predict the dosage of each herb. The output is a complete electronic prescription containing the herb type and corresponding dosage.

[0084] In the constitution matching and principal drug verification stage, a constitution-medicinal herb matching rule library is constructed based on the "Classification and Judgment of Traditional Chinese Medicine Constitution". The medicinal herbs in the prescription are compared with the rule library. Incompatible medicinal herbs are replaced with suitable medicinal herbs with similar effects. The dosage adjustment coefficient table is consulted according to the patient's constitution type to adjust the predicted dosage. At the same time, the medicinal herb with the highest predicted probability is selected from the prescription as the candidate principal drug. The cosine similarity between the principal drug and all symptoms is calculated as the matching degree. The proportion of symptoms with similarity higher than the threshold is counted as the coverage.

[0085] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A method for intelligent generation of electronic prescriptions based on deep learning, characterized in that: The intelligent electronic prescription generation method includes the following steps: S1. Perform symptom segmentation and herbal standardization on historical prescription texts. Use the BERT model to encode symptom texts and herbal names into 256-dimensional semantic vectors. Construct an association graph based on the co-occurrence frequency of symptoms and herbs in prescriptions. Construct a herbal knowledge graph based on traditional Chinese medicine theory. S2. Count the frequency of each medicinal material, identify the minority class labels with low frequency, and resample the original dataset using a multi-label upsampling method to generate a balanced dataset; S3. Input the association graph and knowledge graph into the graph convolutional network. Use the 256-dimensional semantic vectors of symptoms and medicinal materials as the initial node features. Aggregate the information of neighboring nodes through multiple convolutions to output dense feature vectors of symptoms and medicinal materials. Perform the inner product of the feature vectors of symptoms and medicinal materials and obtain the predicted probability of each medicinal material through the sigmoid function. Use the balanced dataset as the training set and the predicted probability as the output to train the model parameters of the graph neural network. S4. Encode the standardized new patient symptom text into a 256-dimensional semantic vector, input it into the graph neural network trained in step S3, obtain the dense feature vector of the new patient symptoms, generate the predicted probability of each medicinal material, select the set of medicinal materials with a probability greater than the threshold, and generate an electronic prescription containing the types of medicinal materials.

2. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 1, characterized in that: The intelligent electronic prescription generation method further includes the following steps: S5. Normalize the recommended baseline dose of each medicinal material extracted from the Chinese Pharmacopoeia and copy it to 32 dimensions to form a 32-dimensional vector. Concatenate the 256-dimensional semantic vector of the medicinal material with the 32-dimensional vector to form the medicinal material embedding feature, resulting in a 288-dimensional medicinal material embedding feature vector. S6. The dense feature vector of symptoms output in step S3 is concatenated with the 288-dimensional herbal embedding feature vector to form the MLP input vector. The MLP input vector is then input into the multilayer perceptron regression network. Forward propagation is performed to obtain the predicted dose. The actual dose in the historical prescription is used as the regression target. After calculating the mean squared error loss, backpropagation is performed to update the weight parameters and save the trained MLP model. S7. The 256-dimensional semantic vector and 32-dimensional baseline dose vector corresponding to the selected medicinal materials in the electronic prescription of step S4 are concatenated to form the medicinal material embedding feature vector of the prescription. The medicinal material embedding feature vector of the prescription is concatenated with the symptom dense feature vector output in step S4, and input into the trained MLP model to generate the predicted dose of the medicinal materials. The output is an electronic prescription containing the type of medicinal materials and the corresponding dose.

3. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 2, characterized in that: The intelligent electronic prescription generation method further includes the following steps: S8. Based on the "Classification and Judgment of Traditional Chinese Medicine Constitutions" standard, patients' constitutions are divided into nine types: balanced constitution, qi deficiency constitution, yang deficiency constitution, yin deficiency constitution, phlegm-dampness constitution, damp-heat constitution, blood stasis constitution, qi stagnation constitution, and special constitution. A list of medicinal materials that are suitable and unsuitable for patients' constitutions is compiled to form a constitution-medicinal material matching rule library. S9. Compare each herb in the electronic prescription generated in step S4 with the constitution-herb matching rule library. When a herb is a contraindicated herb for the new patient's constitution type, replace the contraindicated herb in the original electronic prescription with a substitute herb that has similar effects to the contraindicated herb and does not fall within the scope of contraindications. S10. Query the constitution-dosage adjustment coefficient table according to the new patient's constitution type, multiply the obtained adjustment coefficient by the predicted dose of the medicinal materials generated in step S7, and obtain the final dose after constitution adjustment to form a personalized electronic prescription adapted to the new patient's constitution.

4. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 1, characterized in that: S4 further includes the following steps: S4.1 Select the 1-2 herbs with the highest predicted probability from the generated electronic prescription as candidate principal herbs. Calculate the cosine similarity between the 256-dimensional semantic vector of the principal herbs and the 256-dimensional semantic vector of all symptoms of the new patient one by one, and take the average of all similarities as the principal herb-symptom matching degree. S4.2 Count the number of symptoms in new patients whose similarity to the principal drug is higher than the threshold, and calculate the proportion of the number of symptoms higher than the threshold to the total number of symptoms in new patients as the coverage of the principal drug; S4.3 When the principal drug-symptom matching degree is higher than 0.5 and the principal drug coverage is higher than 60%, the prescription is determined to be effective in treating the symptoms, and the original electronic prescription is output as the final prescription.

5. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 1, characterized in that: The association diagrams in step S1 include: symptom-symptom association diagram, symptom-medicinal herb association diagram, and medicinal herb-medicinal herb association diagram.

6. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 1, characterized in that: The process of constructing the medicinal herb knowledge graph in step S1 is as follows: Based on authoritative TCM classics, specific attribute values ​​of each medicinal material are extracted from five categories: Five Elements, Meridian Tropism, Flavor, Classification, and Temperament. Directed relationship edges are established between each medicinal material and its corresponding attribute value, forming five categories of medicinal material-attribute relationship edges. Calculate the similarity between two medicinal herbs across all attribute dimensions to obtain a comprehensive similarity value across five dimensions. Set a similarity threshold and add undirected edges between medicinal herb pairs that exceed the threshold. The weight of each edge is the comprehensive similarity value. Construct similarity edges between medicinal herbs and generate a medicinal herb knowledge graph containing both medicinal herb-attribute edges and medicinal herb-medicine edges.

7. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 4, characterized in that: Step S4.1 further includes: when the matching degree between the candidate principal drug and the new patient's symptoms is less than 0.5, selecting 1-2 medicinal materials with the second highest predicted probability from the generated electronic prescription as new candidate principal drugs, and recalculating the matching degree between the principal drug and symptoms until the matching degree is higher than 0.

5.

8. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 3, characterized in that: Step S10 further includes: comparing the final dose after body constitution adjustment with the recommended baseline dose range of medicinal materials extracted from the Chinese Pharmacopoeia; and when the final dose after adjustment exceeds the recommended baseline dose range, adjusting the dose to the nearest boundary value within the recommended baseline dose range.

9. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 4, characterized in that: Step S4.3 further includes: when no candidate principal drug meets the conditions of principal drug-symptom matching degree higher than 0.5 and principal drug coverage higher than 60% after traversing all the medicinal materials in the electronic prescription, return to step S4 to regenerate the prescription.

10. The method for intelligent generation of electronic prescriptions based on deep learning according to claim 3, characterized in that: The new patient constitution type in step S9 is generated by using a rule-based scoring method on the new patient's constitution questionnaire information.