Traditional Chinese medicine prescription data analysis method and device based on OCR (Optical Character Recognition) and large model

Through OCR identification and large model-based methods, Chinese medicine prescription data are extracted and analyzed, and the problems of low efficiency and accuracy of traditional Chinese medicine prescription data analysis in the prior art are solved, and efficient and accurate Chinese medicine prescription evaluation and automatic problem identification are achieved.

CN119811698AActive Publication Date: 2025-04-11CONITECH (BEIJING) MANAGEMENT SOFTWARE CO LTD

Patent Information

Application Number
CN202510288402.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-04-11
Estimated Expiration
2045-03-12

AI Technical Summary

Technical Problem

The analysis of prescription data of traditional Chinese medicine in the prior art is low efficiency and low accuracy, making it difficult to comprehensively evaluate the rationality of the prescription.

Method used

Using the traditional Chinese medicine prescription data analysis method based on OCR recognition and large model, we obtain the Chinese medicine prescription images for OCR recognition, extract the prescription data, patient data and physician data, construct multiple prompt words and input the preset big model for judgment, and generate comprehensive judgment results.

Benefits of technology

It improves the accuracy and efficiency of traditional Chinese medicine prescription evaluation, can comprehensively and quickly check the rationality of traditional Chinese medicine prescriptions, automatically identify problems, and improves the efficiency of traditional Chinese medicine adjustment and the safety of medication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119811698A_ABST
    Figure CN119811698A_ABST
Patent Text Reader

Abstract

The invention discloses a traditional Chinese medicine prescription data analysis method and device based on OCR and a large model, and relates to the field of data processing. In the method, a traditional Chinese medicine prescription image of a handwritten traditional Chinese medicine prescription is acquired; performing OCR identification on the traditional Chinese medicine prescription image, and extracting prescription data, patient data and physician data; constructing a first cue word, a second cue word and a third cue word for model input based on the prescription data, the patient data and the doctor data; splicing the first cue word, the second cue word and the third cue word to obtain a target cue word; inputting the target cue word into a preset large model to obtain a medicinal material category congruent result, a medicinal material dosage result and a medicine taking suggestion judgment result; and generating a comprehensive judgment result based on the medicinal material category comparison result, the medicinal material dosage result and the medicine taking suggestion judgment result. By implementing the technical scheme provided by the invention, the accuracy of traditional Chinese medicine prescription evaluation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and specifically to a method and device for analyzing traditional Chinese medicine prescription data based on OCR recognition and large models. Background Art

[0002] With the rapid development of traditional Chinese medicine and the increasing demand for TCM diagnosis and treatment, the number and frequency of TCM prescriptions are also increasing year by year. TCM prescriptions contain the physician's diagnosis and treatment plan for the patient's condition, and are the core documents guiding the preparation of TCM and the use of TCM by patients. Standardized and accurate data analysis and review of TCM prescriptions are crucial to ensuring the safety of patients' medication and improving the quality of TCM services.

[0003] At present, the analysis of TCM prescription data mainly adopts manual review and a small amount of information assistance. Pharmacists need to check paper prescriptions or electronic input system information one by one, and analyze and judge the composition of medicinal materials, dosage, usage, and incompatibility taboos one by one based on personal experience, and give review opinions. This traditional analysis method is inefficient and overly dependent on the pharmacist's own level. It is difficult to unify the review standards, resulting in low accuracy. Some hospitals have introduced technologies such as character recognition and keyword matching, which have improved the efficiency of prescription entry and review to a certain extent, but they still cannot make full use of the TCM knowledge base and it is difficult to accurately grasp the various elements of the rationality of the prescription. Therefore, the relevant technologies all have the problem of low accuracy in the evaluation of TCM prescriptions.

[0004] Therefore, there is an urgent need for a method and device for analyzing Chinese medicine prescription data based on OCR recognition and large models. Summary of the invention

[0005] The present application provides a method and device for analyzing Chinese medicine prescription data based on OCR recognition and large models, which improves the accuracy of Chinese medicine prescription evaluation.

[0006] In a first aspect of the present application, a method for parsing Chinese medicine prescription data based on OCR recognition and a large model is provided, the method comprising: obtaining a Chinese medicine prescription image of a handwritten Chinese medicine prescription; performing OCR recognition on the Chinese medicine prescription image to extract prescription data, patient data and physician data; constructing a first prompt word, a second prompt word and a third prompt word for model input based on the prescription data, patient data and physician data; wherein the first prompt word is used to judge whether there is a conflict between medicinal material categories, the second prompt word is used to judge whether the medicinal material dosage is normal, and the third prompt word is used to judge whether the medication suggestion is reasonable; splicing the first prompt word, the second prompt word and the third prompt word to obtain a target prompt word; inputting the target prompt word into a preset large model to obtain a result of a conflict between medicinal material categories, a result of a medicinal material dosage and a result of a medication suggestion judgment; generating a comprehensive judgment result based on the result of a conflict between medicinal material categories, the result of a medicinal material dosage and the result of a medication suggestion judgment.

[0007] By adopting the above technical solution, the key information in the TCM prescription image, including prescription data, patient data and physician data, is automatically extracted through OCR recognition technology, without manual entry, which improves the efficiency and accuracy of data acquisition. Then, multiple prompt words are constructed based on the extracted data, and judgment and analysis are performed through the preset large model for the three aspects of conflicting medicinal material categories, medicinal material dosage and medication recommendations. This method combines the professional knowledge of traditional Chinese medicine with artificial intelligence technology, and can comprehensively and quickly check the rationality of TCM prescriptions, automatically identify the problems therein, and provide intelligent support for subsequent prescription review and adjustment. Finally, the method summarizes the results of various judgments and generates a comprehensive judgment result to intuitively and clearly evaluate the overall quality of the TCM prescription. The entire process is highly automated, using artificial intelligence to empower traditional Chinese medicine diagnosis and treatment, significantly improving the efficiency of TCM adjustment and the safety of medication. Through this method, key information of Chinese medicine prescriptions is automatically extracted through OCR technology, reducing the manual input process; constructing structured prompt words covering multiple dimensions such as medicinal material conflicts, medicinal material dosage, and medication recommendations to form a standardized analysis entry; introducing a preset large model that integrates theoretical knowledge of traditional Chinese medicine, giving the intelligent parsing engine professional field cognition; making a comprehensive judgment on the output results of the preset large model, giving an objective and standardized judgment on the rationality of the prescription, and improving the efficiency, accuracy and consistency of Chinese medicine prescription parsing from multiple angles.

[0008] Optionally, before obtaining the TCM prescription image of the handwritten TCM prescription, the method also includes: obtaining TCM text data, and digitizing the TCM text data to obtain TCM text data; constructing a word vector model based on the TCM text data, and the word vector model is used to convert the TCM text data into a knowledge vector; inputting the TCM text data into an encoder of a RAG model, and inputting the knowledge vector into a knowledge retrieval module of the RAG model, and the RAG model includes an encoder, a decoder and a knowledge retrieval module; obtaining a TCM prescription database, and the TCM prescription database includes records of conflicting medicinal materials, records of medicinal material dosage and records of medication recommendations; and fusing the TCM prescription database and the RAG model to obtain the preset large model.

[0009] By adopting the above technical solutions, the TCM text materials are digitized, a word vector model is constructed, and the automatic conversion of TCM text to knowledge vector is realized. The TCM prescription database is integrated into the RAG model for pre-training to obtain a preset large model containing TCM professional knowledge and actual medication experience. This pre-training method can automatically learn and extract knowledge from massive TCM text materials, establish a comprehensive, accurate and efficient TCM intelligent system, and provide knowledge support for subsequent TCM prescription analysis. At the same time, the RAG model adopts the architecture design of encoder, decoder and knowledge retrieval module, which can automatically associate and match relevant knowledge in the reasoning process to generate more professional and reliable judgment results. This pre-training method encompasses the theoretical knowledge and practical experience in various fields of TCM, constructs a highly intelligent TCM knowledge base and a preset large model for reasoning, and lays a solid foundation for subsequent applications.

[0010] Optionally, the step of inputting the target prompt word into a preset large model to obtain a result of conflict between medicinal material categories, a result of medicinal material dosage, and a result of medication recommendation, specifically includes: inputting the target prompt word into an encoder of the preset large model to obtain a semantic representation vector corresponding to the target prompt word; according to the semantic representation vector, retrieving a corresponding knowledge representation vector from a traditional Chinese medicine prescription database of the preset large model; fusing the semantic representation vector and the knowledge representation vector to obtain a target vector, and inputting the target vector into a decoder of the preset large model to generate the result of conflict between medicinal material categories, the result of medicinal material dosage, and the result of medication recommendation.

[0011] By adopting the above technical solution, the constructed target prompt word is input into the encoder of the preset large model and converted into a semantic representation vector, realizing the mapping from natural language to vector space, which is convenient for subsequent similarity calculation and knowledge retrieval. Then, based on the semantic representation vector, the most relevant knowledge representation vector is matched from the Chinese medicine prescription knowledge base of the preset large model. This process can quickly and accurately find the Chinese medicine knowledge that best matches the target prompt word, and realize automatic and intelligent knowledge association. Finally, the semantic representation vector and the knowledge representation vector are fused and input into the decoder of the preset large model for generative reasoning, and the judgment results of three aspects of the conflict of medicinal material categories, medicinal material dosage and medication recommendations are obtained. This fusion reasoning method comprehensively utilizes the semantic information of the target prompt word and the domain knowledge in the matching Chinese medicine prescription database, and can generate comprehensive, professional and reliable Chinese medicine prescription analysis results.

[0012] Optionally, performing OCR recognition on the TCM prescription image to extract prescription data, patient data and physician data specifically includes: preprocessing the TCM prescription image to obtain a target TCM prescription image, the preprocessing including image denoising, tilt correction and binarization operations; performing text recognition on the target TCM prescription image using a preset OCR model to obtain the prescription data, the patient data and the physician data.

[0013] By adopting the above technical solution, a series of preprocessing operations are performed on the acquired Chinese medicine prescription images, including image denoising, tilt correction and binarization, which can significantly improve the image quality, remove background noise and interference, correct image tilt, and enhance the contrast between the text area and the background area, creating favorable conditions for subsequent text recognition. Then, the preset OCR model is used to perform text recognition on the preprocessed target Chinese medicine prescription image to extract key prescription data, patient data and physician data. The combination of image preprocessing and preset OCR model improves the extraction efficiency and recognition accuracy of key data of Chinese medicine prescriptions, laying a data foundation for subsequent prescription analysis.

[0014] Optionally, constructing the first prompt word, the second prompt word and the third prompt word for model input based on the prescription data, the patient data and the physician data specifically includes: extracting the key fields of the prescription data, the patient data and the physician data; inputting the key fields into the substitute filling fields in the preset field filling model to obtain the first prompt word, the second prompt word and the third prompt word, and the preset field filling model includes a first prompt word construction format, a second prompt word construction format and a third prompt word construction format.

[0015] By adopting the above technical solutions, key fields are extracted from prescription data, patient data, and physician data. These key fields cover the core elements required to judge the rationality of traditional Chinese medicine prescriptions. Then, the extracted key fields are filled into the preset field filling model to quickly generate structured and standardized prompt words. Three prompt word construction formats are used here, which are respectively aimed at the three judgment targets of conflicting medicinal material categories, medicinal material dosage, and medication recommendations. Prompt word texts with strong pertinence and complete information can be generated to prepare for subsequent model input. Using the prompt word construction format, the expression of prompt words can be unified, the complexity of prompt word generation can be reduced, and the construction efficiency can be improved.

[0016] Optionally, the comprehensive judgment result is qualified or unqualified. After the comprehensive judgment result is generated based on the conflict result of the medicinal material categories, the medicinal material dosage result and the medication recommendation judgment result, the method also includes: if it is determined that the comprehensive judgment result is qualified, a Chinese medicine prescription order instruction is generated, and a Chinese medicine prescription order operation is executed on an online e-commerce platform according to the Chinese medicine prescription order instruction.

[0017] By adopting the above technical solution, when the comprehensive judgment result is qualified, the online order process of the Chinese medicine prescription is automatically triggered. A standardized Chinese medicine prescription order instruction is generated and transmitted to the docking e-commerce platform. This automatic ordering method greatly simplifies the user's drug purchasing process.

[0018] Optionally, after generating a comprehensive judgment result based on the conflicting results of the medicinal material categories, the medicinal material dosage results and the medication recommendation judgment results, the method further includes: if it is determined that the comprehensive judgment result is unqualified, generating a warning message and sending the warning message to the user.

[0019] By adopting the above technical solution, when the comprehensive judgment result is unqualified, an early warning message is automatically generated and sent to the relevant users, which can remind them of prescription abnormalities in the first time and prevent medication risks.

[0020] In the second aspect of the present application, a device for parsing Chinese medicine prescription data based on OCR recognition and large models is provided, and the device includes: an acquisition module and a processing module, wherein: the acquisition module is used to acquire a Chinese medicine prescription image of a handwritten Chinese medicine prescription; the processing module is used to perform OCR recognition on the Chinese medicine prescription image to extract prescription data, patient data and physician data; the processing module is also used to construct a first prompt word, a second prompt word and a third prompt word for model input based on the prescription data, patient data and physician data; wherein the first prompt word is used to judge the category of medicinal materials The processing module is further used to combine the first prompt word, the second prompt word and the third prompt word to obtain the target prompt word; the processing module is further used to input the target prompt word into a preset large model to obtain the conflicting results of the medicinal material categories, the medicinal material dosage results and the judgment results of the medication suggestions; the processing module is further used to generate a comprehensive judgment result based on the conflicting results of the medicinal material categories, the medicinal material dosage results and the judgment results of the medication suggestions.

[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.

[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.

[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Automatically extract key information from TCM prescription images through OCR recognition technology, including prescription data, patient data, and physician data, without manual entry, which improves data acquisition efficiency and accuracy. Then, multiple prompt words are constructed based on the extracted data, and judgment and analysis are performed through a preset large model for three aspects: conflicting categories of medicinal materials, dosage of medicinal materials, and medication recommendations. This method combines TCM expertise with artificial intelligence technology, and can comprehensively and quickly check the rationality of TCM prescriptions, automatically identify problems therein, and provide intelligent support for subsequent prescription review and adjustment. Finally, the method summarizes the results of various judgments and generates a comprehensive judgment result to intuitively and clearly evaluate the overall quality of the TCM prescription. The entire process is highly automated, using artificial intelligence to empower traditional Chinese medicine diagnosis and treatment, significantly improving the efficiency of TCM adjustment and the safety of medication. Through this method, key information of Chinese medicine prescriptions is automatically extracted through OCR technology, reducing the manual input process; constructing structured prompt words covering multiple dimensions such as medicinal material conflicts, medicinal material dosage, and medication recommendations to form a standardized analysis entry; introducing a preset large model that integrates theoretical knowledge of traditional Chinese medicine, giving the intelligent parsing engine professional field cognition; making a comprehensive judgment on the output results of the preset large model, giving an objective and standardized judgment on the rationality of the prescription, and improving the efficiency, accuracy and consistency of Chinese medicine prescription parsing from multiple angles.

[0024] 2. Digitally process TCM text materials, construct a word vector model, and realize the automatic conversion of TCM text to knowledge vector. Integrate the TCM prescription database into the RAG model for pre-training to obtain a preset large model that contains TCM professional knowledge and actual medication experience. This pre-training method can automatically learn and extract knowledge from massive TCM text materials, establish a comprehensive, accurate, and efficient TCM intelligent system, and provide knowledge support for subsequent TCM prescription analysis. At the same time, the RAG model adopts the architecture design of encoders, decoders, and knowledge retrieval modules, which can automatically associate and match related knowledge during the reasoning process to generate more professional and reliable judgment results. This pre-training method encompasses theoretical knowledge and practical experience in various fields of TCM, builds a highly intelligent TCM knowledge base and a preset large model for reasoning, and lays a solid foundation for subsequent applications.

[0025] 3. Input the constructed target prompt word into the encoder of the preset large model and convert it into a semantic representation vector, realizing the mapping from natural language to vector space, which is convenient for subsequent similarity calculation and knowledge retrieval. Then, based on the semantic representation vector, match the most relevant knowledge representation vector from the TCM prescription knowledge base of the preset large model. This process can quickly and accurately find the TCM knowledge that best matches the target prompt word and realize automatic and intelligent knowledge association. Finally, the semantic representation vector and the knowledge representation vector are fused and input into the decoder of the preset large model for generative reasoning to obtain the judgment results of three aspects: conflicting medicinal material categories, medicinal material dosage and medication recommendations. This fusion reasoning method comprehensively utilizes the semantic information of the target prompt word and the domain knowledge in the matching TCM prescription database, and can generate comprehensive, professional and reliable TCM prescription analysis results. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flow chart of a method for analyzing Chinese medicine prescription data based on OCR recognition and large models disclosed in an embodiment of the present application; Figure 2 It is a module schematic diagram of a Chinese medicine prescription data parsing device based on OCR recognition and large model disclosed in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.

[0027] Explanation of the reference numerals: 201, acquisition module; 202, processing module; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION

[0028] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0029] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0030] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0031] This application provides a method for analyzing Chinese medicine prescription data based on OCR recognition and large models. Figure 1 , Figure 1 1 is a flow chart of a method for parsing Chinese medicine prescription data based on OCR recognition and large models provided in an embodiment of the present application. The method is applied to a server, which is a server for processing a Chinese medicine prescription data parsing program based on OCR recognition and large models. The server can be a single server, or a server cluster composed of multiple servers, or a cloud computing service center. The method includes steps S101 to S105, which are as follows: Step S101: Acquire a traditional Chinese medicine prescription image of a handwritten traditional Chinese medicine prescription.

[0032] In a possible implementation, before step S101, the method further includes: acquiring TCM text data, and digitizing the TCM text data to obtain TCM text data; constructing a word vector model based on the TCM text data, wherein the word vector model is used to convert the TCM text data into a knowledge vector; inputting the TCM text data into an encoder of a RAG model, and inputting the knowledge vector into a knowledge retrieval module of the RAG model, wherein the RAG model includes an encoder, a decoder, and a knowledge retrieval module; acquiring a TCM prescription database, wherein the TCM prescription database includes records of conflicts between medicinal materials, records of medicinal material dosage, and records of medication recommendations; and fusing the TCM prescription database with the RAG model to obtain the preset large model.

[0033] Specifically, the server also needs to complete the construction and training of the preset large model. Specifically, the server first obtains a large amount of traditional Chinese medicine text materials, such as traditional Chinese medicine books, medical records, pharmacopoeias, etc. Then, the server digitizes these unstructured traditional Chinese medicine text materials, such as text scanning, OCR recognition, text format conversion, etc., and finally obtains traditional Chinese medicine text data that can be processed by computers. The server trains a word vector model based on the above-mentioned traditional Chinese medicine text data. The word vector model can map each word in the text data to a vector space of a fixed dimension, so that semantically similar words are closer in the vector space. In an embodiment of the present application, the word vector model is a Word2Vec model. Through the word vector model, the server can convert the traditional Chinese medicine text data into knowledge vectors that are easy for computers to understand and process.

[0034] Then, the server builds a RAG (Retrieval-Augmented Generation) model, which consists of an encoder, a decoder, and a knowledge retrieval module. The encoder is responsible for converting the input text into a semantic representation vector, the decoder is responsible for generating output text based on the semantic representation vector, and the knowledge retrieval module is responsible for retrieving knowledge related to the input from an external knowledge base. The server inputs the above-mentioned TCM text data into the encoder of the RAG model, and at the same time inputs the knowledge vector into the knowledge retrieval module of the RAG model, so that the RAG model can use TCM field knowledge to assist text generation.

[0035] On the other hand, the server also obtains a structured Chinese medicine prescription database, which contains information such as records of drug conflicts, drug dosages, and medication recommendations. The drug conflict records indicate which drugs cannot be used at the same time; the drug dosage records indicate the common dosage ranges of various drugs; and the medication recommendations indicate the time and method of taking various drugs. These structured data serve as a knowledge base to provide more accurate domain knowledge for the RAG model.

[0036] Finally, the server fuses the above-mentioned Chinese medicine prescription database and the RAG model to obtain a preset large model. The fusion method can be to use the Chinese medicine prescription database to fine-tune the RAG model. For example, the records of conflicting medicinal materials are used as negative samples, and the normal compatibility of medicinal materials is used as positive samples to fine-tune the knowledge retrieval module of the RAG model so that it can determine whether the medicinal materials conflict with each other; similarly, the records of medicinal material dosage and medication recommendation are used to fine-tune the RAG model so that it can determine whether the medicinal material dosage is reasonable and whether the medication recommendation is correct.

[0037] In step S101, the server obtains a traditional Chinese medicine prescription image of a handwritten traditional Chinese medicine prescription. In specific implementation, the server can provide a variety of upload methods to facilitate users to upload the traditional Chinese medicine prescription image of the handwritten traditional Chinese medicine prescription to the server. One way is to upload through the Web terminal. The server builds a Web application, and the user accesses the application through a browser. The Web application provides an upload page, which contains a file selection control and an upload button. The user can click the selection button to select a photographed or scanned traditional Chinese medicine prescription image from a local device such as a mobile phone, computer, etc., and then click the upload button to upload the image to the server. After receiving the upload request, the server will save the image in the server's storage system for subsequent processing.

[0038] Another way to upload is to upload via a mobile APP. A mobile application is developed within the server, and users download and install the application through the application store. The application provides shooting and uploading functions. Users can directly use the mobile phone camera to shoot the Chinese medicine prescription, or select previously taken pictures of the Chinese medicine prescription from the mobile phone album. Then, the user clicks the upload button, and the application will upload the picture to the server. The server will also store the received pictures in the server's storage system.

[0039] Step S102: performing OCR recognition on the traditional Chinese medicine prescription image to extract prescription data, patient data and physician data.

[0040] In step S102, OCR recognition is performed on the Chinese medicine prescription image to extract prescription data, patient data and physician data, specifically including: preprocessing the Chinese medicine prescription image to obtain a target Chinese medicine prescription image, the preprocessing including image denoising, tilt correction and binarization operations; using a preset OCR model to perform text recognition on the target Chinese medicine prescription image to obtain the prescription data, the patient data and the physician data.

[0041] Specifically, the server performs OCR recognition on the acquired TCM prescription image, and extracts prescription data, patient data, and physician data from the TCM prescription image. Specifically, the server first performs a series of preprocessing operations on the TCM prescription image, and then uses the preset OCR model for text recognition. The preprocessing stage mainly includes image denoising, tilt correction, and binarization operations. Image denoising refers to removing noise interference in the image, such as salt and pepper noise, Gaussian noise, etc. The denoising algorithms include median filtering and Gaussian filtering. Tilt correction refers to rotating the image to the correct direction so that the text in the image is placed horizontally. Tilt correction can be achieved through algorithms such as Hough transform and Fourier transform. Binarization operation refers to converting the image into black and white, with black representing text and white representing background. Binarization algorithms include Otsu algorithm and adaptive threshold algorithm. By performing denoising, tilt correction, and binarization operations on the TCM prescription image in sequence, the server can obtain a target TCM prescription image with higher quality, correct direction, and clear black and white, preparing for subsequent OCR recognition.

[0042] After completing the image preprocessing, the server uses a preset OCR model to perform text recognition on the target Chinese medicine prescription image. In an embodiment of the present application, the preset OCR model is a model based on deep learning, which is obtained through training with a large amount of annotated data. The preset OCR model can convert the text in the image into a computer-editable text format. The server inputs the preprocessed target Chinese medicine prescription image into the preset OCR model, and the preset OCR model outputs the text content in the image by performing feature extraction and sequence learning operations on the target Chinese medicine prescription image. The recognition result of the preset OCR model is a string, which contains all the text in the target Chinese medicine prescription image. The server performs semantic understanding on the obtained text and determines which parts belong to prescription data, patient data and physician data. This step can use natural language processing technology, such as named entity recognition and relationship extraction. Finally, the server extracts key information from each part, such as drug name, drug dosage, patient name, physician name, etc., and organizes it into structured prescription data, patient data and physician data.

[0043] Step S103: Based on the prescription data, patient data and physician data, construct a first prompt word, a second prompt word and a third prompt word for model input; wherein the first prompt word is used to determine whether there is a conflict between medicinal material categories, the second prompt word is used to determine whether the dosage of medicinal materials is normal, and the third prompt word is used to determine whether the medication advice is reasonable.

[0044] In step S103, based on the prescription data, patient data and physician data, the first prompt word, the second prompt word and the third prompt word for model input are constructed, specifically including: extracting the key fields of the prescription data, the patient data and the physician data; inputting the key fields into the substitute filling fields in the preset field filling model to obtain the first prompt word, the second prompt word and the third prompt word, and the preset field filling model includes a first prompt word construction format, a second prompt word construction format and a third prompt word construction format.

[0045] Specifically, the server constructs the first prompt word, the second prompt word, and the third prompt word for model input based on the prescription data, patient data, and physician data extracted from the traditional Chinese medicine prescription image. The first prompt word is used to determine whether there is a conflict between the types of medicinal materials, the second prompt word is used to determine whether the dosage of the medicinal materials is normal, and the third prompt word is used to determine whether the medication advice is reasonable.

[0046] Specifically, the server extracts key fields from prescription data, patient data, and physician data. For prescription data, key fields include medicinal material name, medicinal material dosage, and medication recommendations; for patient data, key fields include patient name, gender, and age; for physician data, key fields include physician name, gender, and title. The server fills the extracted key fields into the input preset field filling model to obtain the first prompt word, the second prompt word, and the third prompt word. The preset field filling model includes the first prompt word construction format, the second prompt word construction format, and the third prompt word construction format; the prompt word construction format is some pre-defined sentence templates, which contain fields to be filled. The server fills the corresponding key fields into the fields to be filled, and the complete prompt word can be obtained.

[0047] For the first prompt word, the server uses the first prompt word to construct the format "Judge whether there are conflicting categories between the following medicinal material categories: each medicinal material category is A, B, C, D...", where A, B, C, and D are the medicinal material name fields to be filled. The server extracts the names of all medicinal materials from the prescription data, and then fills four of them into the A, B, C, and D positions in turn. For example, if the prescription contains four medicinal materials, "Bupleurum", "Scutellaria", "White Peony", and "Glycyrrhiza", the first prompt word generated by the server is "Judge whether there are conflicting categories between the following medicinal material categories: each medicinal material category is Bupleurum, Scutellaria, White Peony, and Glycyrrhiza". If there are less than four medicinal materials, the server will fill the empty positions with special characters such as "none" to ensure the integrity of the prompt word format.

[0048] For the second prompt word, the server uses the second prompt word to construct the format "Judge whether the following medicinal material dosage is normal: the dosage of medicinal material A is a, and the dosage of medicinal material B is b", where A and B are the medicinal material name fields to be filled, and a and b are the medicinal material dosage fields to be filled. The server extracts the names and corresponding dosages of the two medicinal materials from the prescription data, and then fills them into the A, a, B, and b positions in sequence. For example, if the prescription contains "15 grams of Bupleurum" and "9 grams of Scutellaria", the second prompt word generated by the server is "Judge whether the following medicinal material dosage is normal: the dosage of Bupleurum is 15 grams, and the dosage of Scutellaria is 9 grams".

[0049] For the third prompt word, the server uses the second prompt word to construct the format "Judge whether the following medication suggestions are reasonable: the recommended usage is c, the recommended dosage is d, and the recommended taking time is e", where c, d, and e are medication suggestion fields to be filled in. The server extracts medication suggestion information such as usage, dosage, and taking time from the prescription data, and then fills it into positions c, d, and e in sequence. For example, if the suggestion in the prescription is "decoction in water, 200 ml each time, twice a day, once in the morning and once in the evening", the third prompt word generated by the server is "Judge whether the following medication suggestions are reasonable: the recommended usage is decoction in water, the recommended dosage is 200 ml each time, and the recommended taking time is twice a day, once in the morning and once in the evening".

[0050] Step S104: concatenate the first prompt word, the second prompt word and the third prompt word to obtain a target prompt word.

[0051] In step S104, the server needs to splice the first prompt word, the second prompt word and the third prompt word generated in step S103 to obtain a complete target prompt word. The target prompt word is the final prompt word input into the preset large model for reasoning, which contains all the information required to determine whether the Chinese medicine prescription is reasonable.

[0052] During specific implementation, the server first arranges the first prompt word, the second prompt word and the third prompt word into an ordered sequence according to a predetermined order. The predetermined order is determined based on the logical relationship and causal dependence between the prompt words. Generally speaking, the judgment of the conflict between medicinal materials should be made before the judgment of the dosage of medicinal materials and the medication recommendations, because if there is a conflict between the medicinal materials, then even if the dosage of medicinal materials and the medication recommendations are reasonable, the entire Chinese medicine prescription is unreasonable. Therefore, the server puts the first prompt word at the front of the sequence, followed by the second prompt word, and finally the third prompt word. Next, the server uses the preset splicing rules to connect these three prompt words into a complete target prompt word. The preset splicing rules define the connection method between the prompt words, the use of punctuation marks, and the processing of some special characters. The preset splicing rules can be simple splicing, sequence number splicing, and keyword splicing.

[0053] Among them, simple splicing directly splices the prompt words in order, separated by spaces or line breaks, without adding any other characters. For example, "first prompt word second prompt word third prompt word". Serial number splicing adds a serial number in front of each prompt word to indicate its position in the target prompt word. For example, "1. First prompt word 2. Second prompt word 3. Third prompt word". Keyword splicing adds keywords indicating its category or use in front of each prompt word to help the model better understand the meaning of the prompt word. For example, "Judgment of medicinal material conflict: first prompt word Judgment of medicinal material dosage: second prompt word Judgment of medication recommendation: third prompt word".

[0054] Step S105: input the target prompt word into a preset macro model to obtain the results of the conflict between medicinal material categories, the results of the medicinal material dosage, and the results of the medication recommendation.

[0055] In step S105, the target prompt word is input into the preset large model to obtain the results of the conflict between medicinal material categories, the results of medicinal material dosage, and the results of the judgment of medication advice, which specifically includes: inputting the target prompt word into the encoder of the preset large model to obtain the semantic representation vector corresponding to the target prompt word; according to the semantic representation vector, retrieving the corresponding knowledge representation vector from the Chinese medicine prescription database of the preset large model; fusing the semantic representation vector and the knowledge representation vector to obtain the target vector, and inputting the target vector into the decoder of the preset large model to generate the results of the conflict between medicinal material categories, the results of medicinal material dosage, and the results of the judgment of medication advice. Based on the results of the conflict between medicinal material categories, the results of medicinal material dosage, and the results of the judgment of medication advice, a comprehensive judgment result is generated.

[0056] Specifically, the server inputs the target prompt word generated in step S104 into the preset large model, obtains the results of the conflict of medicinal material categories, the results of the medicinal material dosage, and the results of the medication recommendation judgment through the reasoning and calculation of the preset large model, and generates a comprehensive judgment result based on these results.

[0057] Specifically, the server first inputs the target prompt word into the encoder of the preset large model. The encoder is a component of the preset large model, and its function is to convert natural language text into a digital vector that can be understood and processed by the computer. In the preset large model in the embodiment of the present application, the encoder adopts a Transformer-based neural network structure, and maps the input target prompt word to a high-dimensional semantic space through a self-attention mechanism and a feedforward neural network. In this process, the encoder will consider the contextual information of each word in the text, capture the dependency and semantic connection between words, and generate a semantic representation vector.

[0058] After obtaining the semantic representation vector of the target prompt word, the server retrieves the relevant knowledge from the TCM prescription database of the preset large model. The TCM prescription database is another component of the preset large model, which stores a large amount of structured knowledge about TCM prescriptions, such as the properties, efficacy, contraindications, and compatibility rules of medicinal materials. The server uses the semantic representation vector as the retrieval condition to find the knowledge representation vector corresponding to the target prompt word in the knowledge graph.

[0059] Next, the server fuses the semantic representation vector and the knowledge representation vector to obtain a comprehensive target vector. There are many ways to fuse, such as concatenation and weighted averaging. Concatenation means connecting two vectors end to end to form a longer vector; weighted averaging means taking a weighted sum of two vectors to obtain a new vector; the fused target vector contains both the semantic information of the target prompt word and the related Chinese medicine prescription knowledge.

[0060] Finally, the server inputs the target vector into the decoder of the preset large model to generate the final judgment result. The decoder is also a Transformer-based neural network, and its function is to convert the target vector into natural language text. Specifically, the decoder gradually decodes the information in the target vector through the self-attention mechanism and the cross-attention mechanism, generates words or characters one by one, and finally forms a complete text.

[0061] According to different parts of the target prompt word, the decoder will generate three judgment results: the result of the conflict between medicinal material categories, the result of the medicinal material dosage, and the result of the medication recommendation. The result of the conflict between medicinal material categories refers to the judgment of whether there is mutual inhibition or conflict between the categories of various medicinal materials in the Chinese medicine prescription; the result of the medicinal material dosage refers to the judgment of whether the dosage of each medicinal material is within the safe and effective range; the result of the medication recommendation refers to the judgment of whether the usage, dosage, and time of administration given by the Chinese medicine prescription are reasonable and feasible. Among them, the result of the conflict between medicinal material categories is expressed as 0 or 1, 0 means that there is no conflict between the categories of medicinal materials in the prescription, and 1 means that there is a conflict; the result of the medicinal material dosage is expressed as 0 or 1, 0 means that the dosage of each medicinal material in the prescription is normal, and 1 means that there is an abnormal dosage; the result of the medication recommendation is expressed as 0 or 1, 0 means that the medication recommendation in the prescription is reasonable, and 1 means that it is unreasonable. For example, the server can interpret "using Bupleurum and Scutellaria together will produce antagonistic effects and reduce the efficacy" as "the result of conflicting medicinal material categories: 1", "the dosage of Angelica is 15g, which does not exceed the commonly used dosage range" as "the result of medicinal material dosage: 0", and "it is recommended to decoct in water, 200ml each time, twice a day" as "the result of medication recommendation judgment: 0".

[0062] For example, suppose the target prompt word received by the server is "Shengmai Powder is composed of ginseng, Ophiopogon japonicus, and Schisandra chinensis. Ginseng 15g, Ophiopogon japonicus 10g, Schisandra chinensis 6g. Take it decocted in water, 100ml each time, twice a day." After the above steps, the judgment result output by the server may be: Result of conflict between medicinal materials: 0, ginseng, Ophiopogon japonicus, and Schisandra chinensis have no obvious conflict or harm, and can be used together. Result of medicinal material dosage: 0, 15g ginseng, 10g Ophiopogon japonicus, and 6g Schisandra chinensis are all within the commonly used dosage range, and no abnormality is found. Result of medication recommendation: 0, take it decocted in water, 100ml each time, twice a day, the method of taking and dosage are relatively reasonable and in line with clinical usage habits. In this way, the server analyzes and judges the target prompt word through the preset large model, generates structured results of conflict between medicinal materials, medicinal material dosage, and medication recommendation judgment, and provides a basis for subsequent comprehensive judgment.

[0063] Step S106: Generate a comprehensive judgment result based on the conflicting results of the medicinal material categories, the medicinal material dosage results and the medication suggestion judgment result.

[0064] In step S106, if it is determined that the result of the conflict between medicinal material categories is 0, the result of the medicinal material dosage is 0, and the result of the medication suggestion judgment is 0, that is, it is determined that there is no conflict between the medicinal material categories in the prescription, and the dosage of each medicinal material in the prescription is normal, and the medication suggestion in the prescription is reasonable, then the comprehensive judgment result is determined to be qualified. Otherwise, if any one of the items is not met, it is determined that the medication suggestion in the pharmacy is unreasonable.

[0065] After step S106, the method further includes: if it is determined that the comprehensive judgment result is qualified, generating a Chinese medicine prescription order instruction, and executing a Chinese medicine prescription order operation on the online e-commerce platform according to the Chinese medicine prescription order instruction. If it is determined that the comprehensive judgment result is unqualified, generating a warning message, and sending the warning message to the user.

[0066] Specifically, the server generates corresponding instructions or information based on the comprehensive judgment result. If the comprehensive judgment result is "qualified", the server generates a Chinese medicine prescription order instruction, and executes the Chinese medicine prescription order operation on the online e-commerce platform according to this instruction. This process is usually automated. The server will transmit the detailed information of the Chinese medicine prescription (such as the name of the medicinal material, dosage, method of taking, etc.) to the online e-commerce platform and trigger the order process of the online e-commerce platform. After receiving the instruction, the online e-commerce platform will automatically generate a Chinese medicine prescription order containing all the medicinal materials for the user. The user can pay directly online and wait for the delivery of the medicinal materials. If the comprehensive judgment result is "unqualified", the server will generate an early warning message to remind the user that there is a problem with the Chinese medicine prescription and it is not recommended to use it.

[0067] Reference Figure 2The present application also provides a Chinese medicine prescription data parsing device based on OCR recognition and large models, the device is a server, the server includes an acquisition module 201 and a processing module 202, wherein: the acquisition module 201 is used to acquire a Chinese medicine prescription image of a handwritten Chinese medicine prescription; the processing module 202 is used to perform OCR recognition on the Chinese medicine prescription image to extract prescription data, patient data and physician data; the processing module 202 is also used to construct a first prompt word, a second prompt word and a third prompt word for model input based on the prescription data, patient data and physician data; wherein the first prompt word The prompt word is used to judge whether there is a conflict between medicinal material categories, the second prompt word is used to judge whether the medicinal material dosage is normal, and the third prompt word is used to judge whether the medication suggestion is reasonable; the processing module 202 is also used to splice the first prompt word, the second prompt word and the third prompt word to obtain the target prompt word; the processing module 202 is also used to input the target prompt word into the preset large model to obtain the medicinal material category conflict result, the medicinal material dosage result and the medication suggestion judgment result; the processing module 202 is also used to generate a comprehensive judgment result based on the medicinal material category conflict result, the medicinal material dosage result and the medication suggestion judgment result.

[0068] In a possible implementation, before the acquisition module 201 acquires the TCM prescription image of the handwritten TCM prescription, it also includes: the acquisition module 201 acquires TCM text data, and digitizes the TCM text data to obtain TCM text data; the processing module 202 constructs a word vector model based on the TCM text data, and the word vector model is used to convert the TCM text data into a knowledge vector; the processing module 202 inputs the TCM text data into the encoder of the RAG model, and inputs the knowledge vector into the knowledge retrieval module of the RAG model, and the RAG model includes an encoder, a decoder and a knowledge retrieval module; the acquisition module 201 acquires a TCM prescription database, and the TCM prescription database includes records of conflicting medicinal materials, records of medicinal material dosage and records of medication recommendations; the processing module 202 merges the TCM prescription database and the RAG model to obtain a preset large model.

[0069] In a possible implementation, the processing module 202 inputs the target prompt word into a preset large model to obtain the results of the conflict between medicinal material categories, the results of the medicinal material dosage, and the results of the medication recommendation judgment, specifically including: the processing module 202 inputs the target prompt word into the encoder of the preset large model to obtain the semantic representation vector corresponding to the target prompt word; the processing module 202 retrieves the corresponding knowledge representation vector from the Chinese medicine prescription database of the preset large model according to the semantic representation vector; the processing module 202 fuses the semantic representation vector and the knowledge representation vector to obtain the target vector, and inputs the target vector into the decoder of the preset large model to generate the results of the conflict between medicinal material categories, the results of the medicinal material dosage, and the results of the medication recommendation judgment.

[0070] In a possible implementation, the processing module 202 performs OCR recognition on the TCM prescription image to extract prescription data, patient data and physician data, specifically including: the processing module 202 preprocesses the TCM prescription image to obtain a target TCM prescription image, the preprocessing includes image denoising, tilt correction and binarization operations; the processing module 202 uses a preset OCR model to perform text recognition on the target TCM prescription image to obtain prescription data, patient data and physician data.

[0071] In a possible implementation, the processing module 202 constructs a first prompt word, a second prompt word, and a third prompt word for model input based on prescription data, patient data, and physician data, specifically including: the processing module 202 extracts key fields of prescription data, patient data, and physician data; the processing module 202 inputs the key fields into the substitute filling fields in the preset field filling model to obtain the first prompt word, the second prompt word, and the third prompt word, and the preset field filling model includes a first prompt word construction format, a second prompt word construction format, and a third prompt word construction format.

[0072] In a possible implementation, the comprehensive judgment result is qualified or unqualified. After the processing module 202 generates the comprehensive judgment result based on the conflict results of medicinal material categories, the results of medicinal material dosage, and the judgment results of medication recommendations, it also includes: if the processing module 202 determines that the comprehensive judgment result is qualified, it generates a Chinese medicine prescription order instruction, and executes the Chinese medicine prescription order operation on the online e-commerce platform according to the Chinese medicine prescription order instruction.

[0073] In a possible implementation, after the processing module 202 generates a comprehensive judgment result based on the conflicting results of medicinal material categories, the medicinal material dosage results, and the medication recommendation judgment results, it also includes: if the processing module 202 determines that the comprehensive judgment result is unqualified, it generates a warning message and sends the warning message to the user.

[0074] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0075] The present application also provides an electronic device. Figure 3 , Figure 3The electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .

[0076] The communication bus 302 is used to realize the connection and communication between these components.

[0077] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0078] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0079] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.

[0080] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally also be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program of a method for parsing Chinese medicine prescription data based on OCR recognition and a large model.

[0081] exist Figure 3 In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the application program stored in the memory 305 for a method for parsing Chinese medicine prescription data based on OCR recognition and large models. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0082] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments.

[0083] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0084] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0086] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.

[0088] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.

[0089] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A method for analyzing Chinese medicine prescription data based on OCR recognition and large models, characterized in that: The method comprises: Acquire a traditional Chinese medicine prescription image of a handwritten traditional Chinese medicine prescription; Performing OCR recognition on the traditional Chinese medicine prescription image to extract prescription data, patient data, and physician data; Based on the prescription data, patient data and physician data, a first prompt word, a second prompt word and a third prompt word are constructed for model input; wherein the first prompt word is used to judge whether there is a conflict between medicinal material categories, the second prompt word is used to judge whether the amount of medicinal materials is normal, and the third prompt word is used to judge whether the medication suggestion is reasonable; concatenating the first prompt word, the second prompt word and the third prompt word to obtain a target prompt word; Input the target prompt word into a preset macro model to obtain the results of the conflict between medicinal material categories, the results of the medicinal material dosage, and the results of the medication recommendation; Based on the conflicting results of the medicinal material categories, the medicinal material dosage results and the medication recommendation judgment results, a comprehensive judgment result is generated.

2. The method according to claim 1, characterized in that Before obtaining the traditional Chinese medicine prescription image of the handwritten traditional Chinese medicine prescription, the method further includes: Acquiring traditional Chinese medicine text materials, and digitizing the traditional Chinese medicine text materials to obtain traditional Chinese medicine text data; Based on the TCM text data, construct a word vector model, wherein the word vector model is used to convert the TCM text data into a knowledge vector; Inputting the TCM text data into an encoder of a RAG model, and inputting the knowledge vector into a knowledge retrieval module of the RAG model, wherein the RAG model includes an encoder, a decoder and a knowledge retrieval module; Acquire a traditional Chinese medicine prescription database, wherein the traditional Chinese medicine prescription database includes records of conflicts between medicinal materials, records of medicinal material dosage, and records of medication recommendations; The traditional Chinese medicine prescription database and the RAG model are integrated to obtain the preset large model.

3. The method according to claim 2, characterized in that The target prompt word is input into a preset macro model to obtain the conflicting results of medicinal material categories, the dosage results of medicinal materials, and the judgment results of medication suggestions, specifically including: Inputting the target prompt word into the encoder of the preset large model to obtain a semantic representation vector corresponding to the target prompt word; According to the semantic representation vector, a corresponding knowledge representation vector is retrieved from the Chinese medicine prescription database of the preset large model; The semantic representation vector and the knowledge representation vector are fused to obtain a target vector, and the target vector is input into the decoder of the preset large model to generate the medicinal material category conflict result, the medicinal material dosage result and the medication recommendation judgment result.

4. The method according to claim 1, characterized in that: The OCR recognition of the traditional Chinese medicine prescription image is performed to extract prescription data, patient data and physician data, specifically including: Preprocessing the traditional Chinese medicine prescription image to obtain a target traditional Chinese medicine prescription image, wherein the preprocessing includes image denoising, tilt correction, and binarization operations; The preset OCR model is used to perform text recognition on the target Chinese medicine prescription image to obtain the prescription data, the patient data and the physician data.

5. The method according to claim 1, characterized in that The constructing of a first prompt word, a second prompt word and a third prompt word for model input based on the prescription data, the patient data and the physician data specifically includes: Extracting key fields of the prescription data, the patient data, and the physician data; The key field is input into the substitute filling field in the preset field filling model to obtain the first prompt word, the second prompt word and the third prompt word. The preset field filling model includes the first prompt word construction format, the second prompt word construction format and the third prompt word construction format.

6. The method according to claim 1, characterized in that The comprehensive judgment result is qualified or unqualified. After the comprehensive judgment result is generated based on the conflict result of the medicinal material categories, the medicinal material dosage result and the medication suggestion judgment result, the method further includes: If it is determined that the comprehensive judgment result is qualified, a Chinese medicine prescription order instruction is generated, and the Chinese medicine prescription order operation is executed on the online e-commerce platform according to the Chinese medicine prescription order instruction.

7. The method according to claim 1, characterized in that After generating a comprehensive judgment result based on the conflicting results of the medicinal material categories, the medicinal material dosage results and the medication suggestion judgment result, the method further includes: If it is determined that the comprehensive judgment result is unqualified, a warning message is generated and sent to the user.

8. A Chinese medicine prescription data analysis device based on OCR recognition and large models, characterized in that: The device comprises an acquisition module (201) and a processing module (202), wherein: The acquisition module (201) is used to acquire a Chinese medicine prescription image of a handwritten Chinese medicine prescription; The processing module (202) is used to perform OCR recognition on the traditional Chinese medicine prescription image to extract prescription data, patient data and physician data; The processing module (202) is further used to construct a first prompt word, a second prompt word and a third prompt word for model input based on the prescription data, the patient data and the physician data; wherein the first prompt word is used to judge whether there is a conflict between the types of medicinal materials, the second prompt word is used to judge whether the dosage of the medicinal materials is normal, and the third prompt word is used to judge whether the medication suggestion is reasonable; The processing module (202) is further used to concatenate the first prompt word, the second prompt word and the third prompt word to obtain a target prompt word; The processing module (202) is also used to input the target prompt word into a preset large model to obtain the results of the conflict between medicinal material categories, the results of the medicinal material dosage, and the results of the medication recommendation judgment; The processing module (202) is also used to generate a comprehensive judgment result based on the medicinal material category conflict result, the medicinal material dosage result and the medication recommendation judgment result.

9. An electronic device, characterized in that: The electronic device (300) comprises a processor (301), a memory (305), a user interface (303) and a network interface (304), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • Text structured processing system and method for medical pathological report pictures

    CN112185520A

  • Therapeutic scheme generation method and device based on large model

    CN117690545A

  • Multitask time sequence analysis method and system driven by knowledge-enhanced large model

    CN118535747A

  • Medication path decision reasoning system

    CN118737368A

  • Prompt word optimization method and device, storage medium and program product

    CN119088936A

Cited By

  • Neurological disease rehabilitation period medication intelligent management system and digital prescription generation method

    CN120564952A

  • Bill identification method, apparatus and device, and computer program product

    CN122200713A