A Chinese medicine prescription data parsing method and device based on OCR recognition and large models

Through the analysis method of Chinese medicine prescription data based on OCR identification and large model, the key information of Chinese medicine prescriptions is automatically extracted and the preset big model is used for judgment and analysis, which solves the problems of low efficiency and insufficient accuracy of Chinese medicine prescription data analysis, and achieves efficient and accurate analysis of Chinese medicine prescriptions and improves the safety of drug use.

CN119811698BActive Publication Date: 2025-06-20CONITECH (BEIJING) MANAGEMENT SOFTWARE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510288402.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-06-20
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, dependent on the personal level of the pharmacist, the audit accuracy is low, and it is difficult to comprehensively evaluate the rationality of the prescription.

Method used

Using the Chinese medicine prescription data analysis method based on OCR recognition and large model, the key information in the Chinese medicine prescription image is automatically extracted through OCR recognition technology, and a multi-dimensional structured prompt word is constructed, and a preset big model is used for judgment and analysis to generate comprehensive judgment results.

Benefits of technology

It improves the accuracy and efficiency of traditional Chinese medicine prescription evaluation, reduces the manual entry process, realizes automated and intelligent traditional Chinese medicine prescription analysis, and significantly improves the efficiency of traditional Chinese medicine adjustment and the safety of drug use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119811698B_ABST
    Figure CN119811698B_ABST
Patent Text Reader

Abstract

A method and device for parsing traditional Chinese medicine prescription data based on OCR recognition and large models, which relate to the field of data processing. In this method, a traditional Chinese medicine prescription image of a handwritten traditional Chinese medicine prescription is obtained; the traditional Chinese medicine prescription image is subjected to OCR recognition 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 for model input are constructed; the first prompt word, the second prompt word, and the third prompt word are concatenated to obtain a target prompt word; the target prompt word is input into a preset large model to obtain a result of conflicting herb categories, a result of herb dosage, and a result of judging medication advice; based on the result of conflicting herb categories, the result of herb dosage, and the result of judging medication advice, a comprehensive judgment result is generated. Implementing the technical solution provided by this application improves the accuracy of traditional Chinese medicine prescription evaluation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and particularly to a method and device for parsing 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 continuous improvement of the demand for traditional Chinese medicine diagnosis and treatment, the quantity of traditional Chinese medicine prescriptions issued and the frequency of use are increasing year by year. Traditional Chinese medicine prescriptions contain the diagnosis of the patient's condition and the treatment plan by the doctor, and are the core documents guiding the dispensing of traditional Chinese medicine and the patient's medication. Standardized and accurate data parsing and review of traditional Chinese medicine prescriptions are crucial for ensuring the safety of patient medication and improving the quality of traditional Chinese medicine services.

[0003] Currently, the parsing of traditional Chinese medicine prescription data mainly adopts the method of manual review and a small amount of information technology assistance. Pharmacists need to check the information in paper prescriptions or electronic input systems one by one, and analyze and judge the composition of medicinal materials, dosage and usage, compatibility taboos, etc. one by one based on personal experience, and give review opinions. This traditional parsing method is inefficient, overly dependent on the level of pharmacists themselves, and difficult to unify the review criteria, 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 still cannot make full use of the traditional Chinese medicine knowledge base and are difficult to accurately grasp the various elements of prescription rationality. Therefore, there are problems with low accuracy in evaluating traditional Chinese medicine prescriptions in related technologies.

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

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

[0006] In the first aspect of the present application, a method for parsing traditional Chinese medicine prescription data based on OCR recognition and large models is provided. The method includes: obtaining 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, constructing 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; 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 whether there is a conflict between medicinal material categories, a result of the dosage of medicinal materials, and a result of judging the medication advice; and generating a comprehensive judgment result based on the result of whether there is a conflict between medicinal material categories, the result of the dosage of medicinal materials, and the result of judging the medication advice.

[0007] By adopting the above technical solution, the key information in the traditional Chinese medicine prescription image, including prescription data, patient data, and physician data, is automatically extracted through OCR recognition technology without manual input, improving the data acquisition efficiency and accuracy. Then, based on the extracted data, multiple prompt words are constructed, respectively targeting three aspects: whether there is a conflict between medicinal material categories, the dosage of medicinal materials, and the medication advice, and judged and analyzed through a preset large model. This method combines traditional Chinese medicine professional knowledge and artificial intelligence technology, can comprehensively and quickly check the rationality of traditional Chinese medicine prescriptions, automatically identify existing problems, and provide intelligent support for subsequent prescription review and dispensing. Finally, the method summarizes the judgment results of each item to generate a comprehensive judgment result, intuitively and clearly evaluating the overall quality of the traditional Chinese medicine prescription. The whole process is highly automated, using artificial intelligence to empower traditional Chinese medicine diagnosis and treatment, significantly improving the efficiency of traditional Chinese medicine dispensing and medication safety. Through this method, the key information of traditional Chinese medicine prescriptions is automatically extracted by OCR technology, reducing the manual input link; constructing structured prompt words covering multiple dimensions such as medicinal material conflicts, medicinal material dosages, and medication advice to form a standardized analysis entry; introducing a preset large model integrating traditional Chinese medicine theory knowledge to endow the intelligent parsing engine with professional domain cognition; comprehensively judging the output results of the preset large model to give an objective and standardized judgment on the rationality of the prescription, improving the efficiency, accuracy, and consistency of traditional Chinese medicine prescription parsing from multiple angles.

[0008] Optionally, before obtaining the traditional Chinese medicine prescription image of the handwritten traditional Chinese medicine prescription, the method further includes: obtaining traditional Chinese medicine text materials, digitally processing the traditional Chinese medicine text materials to obtain traditional Chinese medicine text data; based on the traditional Chinese medicine text data, constructing a word vector model, which is used to convert the traditional Chinese medicine text data into knowledge vectors; inputting the traditional Chinese medicine text data into the encoder of the RAG model, and inputting the knowledge vectors into the knowledge retrieval module of the RAG model, where the RAG model includes an encoder, a decoder, and a knowledge retrieval module; obtaining a traditional Chinese medicine prescription database, where the traditional Chinese medicine prescription database includes records of incompatible medicinal materials, records of medicinal material dosages, and records of medication suggestions; fusing the traditional Chinese medicine prescription database and the RAG model to obtain the preset large model.

[0009] By adopting the above technical solution, the traditional Chinese medicine text materials are digitally processed, and a word vector model is constructed to realize the automatic conversion of traditional Chinese medicine texts into knowledge vectors. The traditional Chinese medicine prescription database is integrated into the RAG model for pre-training to obtain a preset large model containing traditional Chinese medicine professional knowledge and actual medication experience. This pre-training method can automatically learn and extract knowledge from a large amount of traditional Chinese medicine text materials, establish a comprehensive, accurate, and efficient traditional Chinese medicine intelligent system, and provide knowledge support for subsequent traditional Chinese medicine prescription analysis. At the same time, the RAG model adopts an architecture design of an encoder, a decoder, and a knowledge retrieval module, which can automatically associate and match relevant knowledge during 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 traditional Chinese medicine, constructs a highly intelligent traditional Chinese medicine 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 into the preset large model to obtain the results of incompatible medicinal material categories, medicinal material dosage results, and medication suggestion judgment results specifically includes: inputting the target prompt into the encoder of the preset large model to obtain the semantic representation vector corresponding to the target prompt; according to the semantic representation vector, retrieving the corresponding knowledge representation vector from the 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 the decoder of the preset large model to generate the results of incompatible medicinal material categories, the medicinal material dosage results, and the medication suggestion judgment results.

[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 solution, key fields are extracted from the prescription data, patient data, and physician data, and these key fields cover the core elements required for judging the rationality of traditional Chinese medicine prescriptions. Then, the extracted key fields are filled into a preset field filling model to quickly generate structured and standardized prompt words. Here, three prompt word construction formats are adopted, which are respectively targeted at three judgment objectives: incompatibility of medicinal material categories, dosage of medicinal materials, and medication advice. It is possible to generate prompt word texts with strong pertinence and complete information, preparing for the subsequent model input. Using the prompt word construction format can unify the expression of prompt words, reduce the complexity of prompt word generation, and improve the construction efficiency.

[0016] Optionally, the comprehensive judgment result is qualified or unqualified. After generating the comprehensive judgment result based on the incompatibility result of medicinal material categories, the dosage result of medicinal materials, and the medication advice judgment result, the method further includes: if it is determined that the comprehensive judgment result is qualified, a traditional Chinese medicine prescription ordering instruction is generated, and the traditional Chinese medicine prescription ordering operation is performed on the online e-commerce platform according to the traditional Chinese medicine prescription ordering instruction.

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

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

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

[0020] In the second aspect of the present application, a traditional Chinese medicine prescription data parsing device based on OCR recognition and large models is provided. The device includes an acquisition module and a processing module, where: The acquisition module is used to acquire the traditional Chinese medicine prescription image of the handwritten traditional Chinese medicine prescription; The processing module is used to perform OCR recognition on the traditional Chinese medicine prescription image to extract prescription data, patient data, and doctor data; The processing module 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, patient data, and doctor data; where 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 dosage of medicinal materials is normal, and the third prompt word is used to judge whether the medication advice is reasonable; The processing module is further used to splice the first prompt word, the second prompt word, and the third prompt word to obtain a target prompt word; The processing module is further used to input the target prompt word into a preset large model to obtain a medicinal material category conflict result, a medicinal material dosage result, and a medication advice judgment result; The processing module is further used to generate a comprehensive judgment result based on the medicinal material category conflict result, the medicinal material dosage result, and the medication advice judgment result.

[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. Both the user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory to enable the electronic device to execute the method described in any one of the above.

[0022] In the fourth aspect of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions that, when executed, execute the method described in any one of the above.

[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:

[0024] 1. Automatically extract the key information in the traditional Chinese medicine prescription image through OCR recognition technology, including prescription data, patient data, and physician data, without manual entry, improving the efficiency and accuracy of data acquisition. Then, based on the extracted data, construct multiple prompt words for the three aspects of herb category incompatibility, herb dosage, and medication advice, and conduct judgment and analysis through a preset large model. This approach combines traditional Chinese medicine professional knowledge and artificial intelligence technology, enabling comprehensive and rapid rationality checks of traditional Chinese medicine prescriptions, automatically identifying existing problems, and providing intelligent support for subsequent prescription review and dispensing. Finally, the method summarizes the judgment results of each item to generate a comprehensive judgment result, intuitively evaluating the overall quality of the traditional Chinese medicine prescription. The entire process is highly automated, using artificial intelligence to empower traditional Chinese medicine diagnosis and treatment, significantly improving the efficiency of traditional Chinese medicine dispensing and medication safety. By using OCR technology to automatically extract the key information of traditional Chinese medicine prescriptions, this method reduces the manual entry link; constructs structured prompt words covering multiple dimensions such as herb incompatibility, herb dosage, and medication advice to form a standardized analysis entry; introduces a preset large model integrating traditional Chinese medicine theoretical knowledge to endow the intelligent parsing engine with professional domain cognition; comprehensively determines the output results of the preset large model to give an objective and standardized judgment on the rationality of the prescription, improving the efficiency, accuracy, and consistency of traditional Chinese medicine prescription parsing from multiple perspectives.

[0025] 2. Digitally process traditional Chinese medicine text materials, construct a word vector model, and realize the automatic conversion of traditional Chinese medicine texts into knowledge vectors. Integrate the traditional Chinese medicine prescription database into the RAG model for pre-training to obtain a preset large model containing traditional Chinese medicine professional knowledge and actual medication experience. This pre-training method can automatically learn and extract knowledge from a large amount of traditional Chinese medicine text materials, establishing a comprehensive, accurate, and efficient traditional Chinese medicine intelligent system to provide knowledge support for subsequent traditional Chinese medicine prescription parsing. At the same time, the RAG model adopts an architecture design of an encoder, a decoder, and a knowledge retrieval module, which can automatically associate and match relevant knowledge during 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 traditional Chinese medicine, constructs a highly intelligent traditional Chinese medicine knowledge base and a preset large model for reasoning, laying a solid foundation for subsequent applications.

[0026] 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

[0027] 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;

[0028] 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;

[0029] Figure 3 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.

[0030] 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

[0031] 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.

[0032] 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.

[0033] In the description of the embodiments of the present application, the term "a plurality" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0034] The present application provides a method for parsing traditional Chinese medicine prescription data based on OCR recognition and large models. Refer to Figure 1 , Figure 1 is a schematic flowchart of a method for parsing traditional Chinese medicine prescription data based on OCR recognition and large models provided by an embodiment of the present application. This method is applied to a server, which is a server for processing a program for parsing traditional Chinese medicine prescription data based on OCR recognition and large models. The server can be a single server, a server cluster composed of multiple servers, or a cloud computing service center. This method includes steps S101 to S105, and the above steps are as follows:

[0035] Step S101: Obtain a traditional Chinese medicine prescription image of a handwritten traditional Chinese medicine prescription.

[0036] In a possible implementation manner, before step S101, this method further includes: obtaining traditional Chinese medicine text materials, and performing digital processing on the traditional Chinese medicine text materials to obtain traditional Chinese medicine text data; based on the traditional Chinese medicine text data, constructing a word vector model, and the word vector model is used to convert the traditional Chinese medicine text data into knowledge vectors; inputting the traditional Chinese medicine text data into the encoder of the RAG model, and inputting the knowledge vectors into the knowledge retrieval module of the RAG model, and the RAG model includes an encoder, a decoder, and a knowledge retrieval module; obtaining a traditional Chinese medicine prescription database, and the traditional Chinese medicine prescription database includes records of incompatible traditional Chinese medicine materials, records of the dosages of traditional Chinese medicine materials, and records of medication suggestions; fusing the traditional Chinese medicine prescription database and the RAG model to obtain the preset large model.

[0037] Specifically, the server also needs to complete the construction and training of a 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 performs digital processing on 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 a computer. Based on the above traditional Chinese medicine text data, the server trains a word vector model. The word vector model can map each word in the text data to a vector space of a fixed dimension, so that words with similar semantics are closer in the vector space. In the embodiment of the present application, the word vector model is the Word2Vec model. Through the word vector model, the server can convert the traditional Chinese medicine text data into knowledge vectors that are easy for a computer to understand and process.

[0038] 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 the output text according to 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 traditional Chinese medicine 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 the knowledge in the field of traditional Chinese medicine to assist text generation.

[0039] On the other hand, the server also obtains a structured traditional Chinese medicine prescription database, which contains information such as records of incompatible medicinal materials, records of medicinal material dosages, and records of medication suggestions. The records of incompatible medicinal materials indicate which medicinal materials cannot be used simultaneously; the records of medicinal material dosages indicate the common dosage ranges of various medicinal materials; the records of medication suggestions indicate precautions such as the taking time and method of various medicinal materials. These structured data serve as a knowledge base to provide more accurate domain knowledge for the RAG model.

[0040] Finally, the server fuses the above traditional Chinese medicine prescription database and the RAG model to obtain a preset large model. The fusion method can be to fine-tune the RAG model using the traditional Chinese medicine prescription database. For example, taking the records of incompatible medicinal materials as negative samples and the normal compatibility of medicinal materials as positive samples, fine-tuning the knowledge retrieval module of the RAG model so that it can judge whether the medicinal materials are incompatible; similarly, fine-tuning the RAG model using the records of medicinal material dosages and medication suggestions so that it can judge whether the medicinal material dosage is reasonable and whether the medication suggestion is correct.

[0041] In step S101, the server obtains the traditional Chinese medicine prescription image of the handwritten traditional Chinese medicine prescription. Specifically, in implementation, the server can provide multiple upload methods to facilitate the user 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 side. 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 the photographed or scanned traditional Chinese medicine prescription picture from a local device such as a mobile phone or a computer, and then click the upload button to upload the picture to the server. After receiving the upload request, the server will save the picture in the storage system of the server for subsequent processing.

[0042] Another upload method is to upload through the mobile APP. The server internally develops a mobile application, and the user downloads and installs the application from the app store. The application provides functions of shooting and uploading. The user can directly use the mobile phone camera to shoot the traditional Chinese medicine prescription, or select the previously photographed traditional Chinese medicine prescription picture 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 picture in the storage system of the server.

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

[0044] In step S102, performing OCR recognition on the traditional Chinese medicine prescription image to extract prescription data, patient data, and physician data specifically includes: preprocessing the traditional Chinese medicine prescription image to obtain a target traditional Chinese medicine prescription image, where the preprocessing includes image denoising, skew correction, and binarization operations; using a preset OCR model to perform character recognition on the target traditional Chinese medicine prescription image to obtain the prescription data, the patient data, and the physician data.

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

[0046] After completing the image preprocessing, the server uses the preset OCR model to perform text recognition on the target traditional Chinese medicine prescription image. In the embodiment of the present application, the preset OCR model is a deep learning-based model obtained by training with a large amount of labeled data. The preset OCR model can convert the text in the image into a computer-editable text format. The server inputs the preprocessed target traditional Chinese medicine prescription image into the preset OCR model. The preset OCR model performs feature extraction and sequence learning operations on the target traditional Chinese medicine prescription image and outputs the text content in the image. The recognition result of the preset OCR model is a string that contains all the text in the target traditional Chinese medicine prescription image. The server performs semantic understanding on the obtained text to determine which parts belong to the prescription data, patient data, and physician data. This step can utilize natural language processing techniques, such as named entity recognition, relation extraction. Finally, the server extracts key information from each part, such as drug names, drug dosages, patient names, physician names, etc., and organizes them into structured prescription data, patient data, and physician data.

[0047] 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.

[0048] 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 keyword fields of the prescription data, the patient data, and the physician data; inputting the keyword fields into the fields to be filled 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.

[0049] 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. Among them, the first prompt word is used to determine whether there is a conflict between the medicinal material categories, 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.

[0050] Specifically, the server extracts the keyword fields from the prescription data, patient data, and physician data. For the prescription data, the keyword fields include the name of the medicinal material, the dosage of the medicinal material, and the medication advice; for the patient data, the keyword fields include the patient's name, gender, and age; for the physician data, the keyword fields include the physician's name, gender, and professional title. The server fills the extracted keyword fields into the preset field filling model for input 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 predefined sentence templates that contain fields to be filled. The server fills the corresponding keyword fields into the fields to be filled to obtain the complete prompt word.

[0051] For the first prompt word, the server uses the first prompt word construction format "Determine whether there are conflicting categories among the following medicinal material categories: Each medicinal material category is A, B, C, D...", where A, B, C, D are the fields for filling in the names of the medicinal materials. The server extracts the names of all the medicinal materials from the prescription data and then fills four of them into the positions of A, B, C, D in sequence. For example, if the prescription contains four medicinal materials, namely "Bupleurum chinense", "Scutellaria baicalensis", "White peony root", and "Licorice", the first prompt word generated by the server is "Determine whether there are conflicting categories among the following medicinal material categories: Each medicinal material category is Bupleurum chinense, Scutellaria baicalensis, White peony root, Licorice". If there are less than four medicinal materials, the server will fill the vacant positions with special characters such as "none" to ensure the integrity of the prompt word format.

[0052] For the second prompt, the server constructs the format "Determine whether the following medicinal material dosages are normal: The dosage of medicinal material A is a, and the dosage of medicinal material B is b" using the second prompt, 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 two medicinal materials from the prescription data and then fills them into the positions of A, a, B, and b in sequence. For example, if the prescription contains "15 grams of Bupleurum" and "9 grams of Scutellaria", the second prompt generated by the server is "Determine whether the following medicinal material dosages are normal: The dosage of Bupleurum is 15 grams, and the dosage of Scutellaria is 9 grams".

[0053] For the third prompt, the server constructs the format "Determine whether the following medication advice is reasonable: The recommended usage is c, the recommended dosage is d, and the recommended administration time is e" using the second prompt, where c, d, and e are the medication advice fields to be filled. The server extracts the medication advice information such as usage, dosage, and administration time from the prescription data and then fills them into the positions of c, d, and e in sequence. For example, if the advice in the prescription is "Decoct in water for oral administration, 200 ml each time, 2 times a day, once in the morning and once in the evening", the third prompt generated by the server is "Determine whether the following medication advice is reasonable: The recommended usage is decoct in water for oral administration, the recommended dosage is 200 ml each time, and the recommended administration time is 2 times a day, once in the morning and once in the evening".

[0054] Step S104: Concatenate the first prompt, the second prompt, and the third prompt to obtain the target prompt.

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

[0056] Specifically, when implementing, the server first arranges the first prompt, the second prompt, and the third prompt in an ordered sequence according to a predetermined order. The predetermined order is determined according to the logical relationship and causal dependence between the prompts. Generally, the judgment of medicinal material incompatibility should be carried out before the judgment of medicinal material dosage and medication advice, because if there is incompatibility between medicinal materials, then even if the medicinal material dosage and medication advice are reasonable, the entire traditional Chinese medicine prescription is unreasonable. Therefore, the server places the first prompt at the front of the sequence, followed by the second prompt, and finally the third prompt. Next, the server uses the preset concatenation rule to connect these three prompts into a complete target prompt. The preset concatenation rule defines the connection method between the prompts, the use of punctuation marks, and the handling of some special characters. The preset concatenation rule can be simple concatenation, serial number concatenation, or keyword concatenation.

[0057] Among them, for simple concatenation, the prompt words are directly concatenated in order, separated by spaces or line breaks in the middle, without adding any other characters. For example, "First prompt word Second prompt word Third prompt word". For serial number concatenation, a serial number is added 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". For keyword concatenation, a keyword indicating its category or usage is added in front of each prompt word to help the model better understand the meaning of the prompt word. For example, "Judgment of incompatible medicinal materials: First prompt word Judgment of medicinal material dosage: Second prompt word Judgment of medication advice: Third prompt word".

[0058] Step S105: Input the target prompt word into a preset large model to obtain the result of incompatible medicinal material categories, the result of medicinal material dosage, and the result of judgment on medication advice.

[0059] In step S105, inputting the target prompt word into the preset large model to obtain the result of incompatible medicinal material categories, the result of medicinal material dosage, and the result of judgment on medication advice 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; retrieving the corresponding knowledge representation vector from the traditional Chinese medicine prescription database of the preset large model according to the semantic representation vector; fusing the semantic representation vector and the knowledge representation vector to obtain a target vector, and inputting the target vector into the decoder of the preset large model to generate the result of incompatible medicinal material categories, the result of medicinal material dosage, and the result of judgment on medication advice. Based on the result of incompatible medicinal material categories, the result of medicinal material dosage, and the result of judgment on medication advice, a comprehensive judgment result is generated.

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

[0061] 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 digital vectors that can be understood and processed by a computer. In the preset large model in the embodiment of the present application, the encoder adopts a neural network structure based on Transformer, and through the self-attention mechanism and the feed-forward neural network, maps the input target prompt word into a high-dimensional semantic space. In this process, the encoder will consider the context information of each word in the text, capture the dependency relationship and semantic connection between words, and generate a semantic representation vector.

[0062] After obtaining the semantic representation vector of the target prompt, the server retrieves relevant knowledge from the traditional Chinese medicine prescription database of the preset large model. The traditional Chinese medicine prescription database is another component of the preset large model, which stores a large amount of structured knowledge about traditional Chinese medicine prescriptions, such as the properties, efficacy, taboos, 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 in the knowledge graph.

[0063] Next, the server fuses the semantic representation vector and the knowledge representation vector to obtain a comprehensive target vector. There are various fusion methods, such as concatenation and weighted average. Concatenation means connecting the two vectors head to tail to form a longer vector; weighted average means performing a weighted sum on the two vectors to obtain a new vector; the fused target vector contains both the semantic information of the target prompt and the relevant traditional Chinese medicine prescription knowledge.

[0064] 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 neural network based on Transformer, and its role 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 to generate words or characters one by one, and finally forms a complete text.

[0065] According to different parts of the target prompt, the decoder will generate three judgment results: the result of the conflict between the categories of medicinal materials, the result of the dosage of medicinal materials, and the judgment result of the medication advice. The result of the conflict between the categories of medicinal materials refers to judging whether there is mutual inhibition or conflict between the categories of each medicinal material in the traditional Chinese medicine prescription; the result of the dosage of medicinal materials refers to judging whether the dosage of each medicinal material is within the safe and effective range; the judgment result of the medication advice refers to judging whether the advice on the usage, dosage, and taking time given in the traditional Chinese medicine prescription is reasonable and feasible. Among them, the result of the conflict between the categories of medicinal materials is represented as 0 or 1, where 0 means there is no conflict between the categories of medicinal materials in the prescription, and 1 means there is a conflict; the result of the dosage of medicinal materials is represented as 0 or 1, where 0 means the dosage of each medicinal material in the prescription is normal, and 1 means there is an abnormal dosage; the judgment result of the medication advice is represented as 0 or 1, where 0 means the medication advice in the prescription is reasonable, and 1 means it is unreasonable. For example, the server can parse "Using Bupleurum and Scutellaria baicalensis together will produce an antagonistic effect and reduce the efficacy" as "Result of the conflict between the categories of medicinal materials: 1", parse "The dosage of Angelica sinensis is 15g, which does not exceed the common dosage range" as "Result of the dosage of medicinal materials: 0", and parse "It is recommended to decoct with water, 200ml each time, 2 times a day" as "Judgment result of the medication advice: 0".

[0066] For example, assume that the target prompt received by the server is "Shengmai San is composed of ginseng, Ophiopogon japonicus, and Schisandra chinensis. 15 grams of ginseng, 10 grams of Ophiopogon japonicus, and 6 grams of Schisandra chinensis. Decoct with water, 100 ml each time, twice a day.". After being processed through the above steps, the judgment results output by the server may be as follows: Result of the conflict of medicinal material categories: 0. There is no obvious conflict or harm among the three medicinal materials of ginseng, Ophiopogon japonicus, and Schisandra chinensis, and they can be used together. Result of the dosage of medicinal materials: 0. 15 grams of ginseng, 10 grams of Ophiopogon japonicus, and 6 grams of Schisandra chinensis are all within the common dosage range, and no abnormality is seen. Result of the judgment on the medication advice: 0. Decoct with water, 100 ml each time, twice a day. The administration method and dosage are relatively reasonable and conform to the clinical usage habits. In this way, the server analyzes and judges the target prompt through the preset large model, generates the structured results of the conflict of medicinal material categories, the dosage of medicinal materials, and the judgment result of the medication advice, providing a basis for subsequent comprehensive judgment.

[0067] Step S106: Generate a comprehensive judgment result based on the result of the conflict of medicinal material categories, the result of the dosage of medicinal materials, and the result of the judgment on the medication advice.

[0068] In step S106, if it is determined that the result of the conflict of medicinal material categories is 0, and the result of the dosage of medicinal materials is 0, and the result of the judgment on the medication advice is 0, that is, it is determined that there is no conflict among the medicinal material categories in the prescription, and the dosage of each medicinal material in the prescription is normal, and the medication advice in the prescription is reasonable, then it is determined that the comprehensive judgment result is qualified. Otherwise, if any one item does not meet the requirements, it is determined that the medication advice in the pharmacy is unreasonable.

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

[0070] Specifically, the server generates corresponding instructions or information according to the comprehensive judgment result. If the comprehensive judgment result is "qualified", the server generates a Chinese medicine prescription ordering instruction and performs the Chinese medicine prescription ordering 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 names of medicinal materials, dosage, administration method, etc.) to the online e-commerce platform and trigger the ordering 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 directly make an online payment and wait for the delivery of the medicinal materials. If the comprehensive judgment result is "unqualified", the server will generate a warning message to prompt the user that there is a problem with the Chinese medicine prescription and it is not recommended to use.

[0071] Refer to Figure 2, the present application also provides a traditional Chinese medicine prescription data parsing device based on OCR recognition and large models. The device is a server, and the server includes an acquisition module 201 and a processing module 202, where: The acquisition module 201 is used to acquire the traditional Chinese medicine prescription image of the handwritten traditional 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 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; Among them, 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 dosage of medicinal materials is normal, and the third prompt word is used to judge whether the medication advice 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 a target prompt word; The processing module 202 is also used to input the target prompt word into a preset large model to obtain a medicinal material category conflict result, a medicinal material dosage result, and a medication advice 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 advice judgment result.

[0072] In a possible implementation manner, before the acquisition module 201 acquires the traditional Chinese medicine prescription image of the handwritten traditional Chinese medicine prescription, it further includes: The acquisition module 201 acquires traditional Chinese medicine text materials and performs digital processing on the traditional Chinese medicine text materials to obtain traditional Chinese medicine text data; The processing module 202 constructs a word vector model based on the traditional Chinese medicine text data, and the word vector model is used to convert the traditional Chinese medicine text data into knowledge vectors; The processing module 202 inputs the traditional Chinese medicine text data into the encoder of the RAG model and inputs the knowledge vectors into the knowledge retrieval module of the RAG model. The RAG model includes an encoder, a decoder, and a knowledge retrieval module; The acquisition module 201 acquires a traditional Chinese medicine prescription database, and the traditional Chinese medicine prescription database includes records of medicinal material conflicts, records of medicinal material dosages, and records of medication advice; The processing module 202 fuses the traditional Chinese medicine prescription database and the RAG model to obtain a preset large model.

[0073] In a possible implementation manner, when the processing module 202 inputs the target prompt word into the preset large model to obtain a medicinal material category conflict result, a medicinal material dosage result, and a medication advice judgment result, it specifically includes: The processing module 202 inputs the target prompt word into the encoder of the preset large model to obtain a semantic representation vector corresponding to the target prompt word; The processing module 202 retrieves the corresponding knowledge representation vector from the traditional 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 a target vector, and inputs the target vector into the decoder of the preset large model to generate a medicinal material category conflict result, a medicinal material dosage result, and a medication advice judgment result.

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

[0075] In a possible implementation, based on the prescription data, patient data, and physician data, the processing module 202 constructs a first prompt word, a second prompt word, and a third prompt word for model input, specifically including: the processing module 202 extracts the keyword fields of the prescription data, patient data, and physician data; the processing module 202 inputs the keyword fields into the fields to be filled 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.

[0076] 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 medicinal material category conflict result, the medicinal material dosage result, and the medication advice judgment result, it further includes: if the processing module 202 determines that the comprehensive judgment result is qualified, it generates a traditional Chinese medicine prescription ordering instruction and performs the traditional Chinese medicine prescription ordering operation on the online e-commerce platform according to the traditional Chinese medicine prescription ordering instruction.

[0077] In a possible implementation, after the processing module 202 generates the comprehensive judgment result based on the medicinal material category conflict result, the medicinal material dosage result, and the medication advice judgment result, it further 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.

[0078] It should be noted that: when the device provided in the above embodiments realizes its functions, only the above-mentioned division of each functional module is used for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, 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 embodiments belong to the same concept, and the specific implementation process can be seen in the method embodiments, which will not be repeated here.

[0079] This application also provides an electronic device. Refer to Figure 3 , Figure 3It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The 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.

[0080] Among them, the communication bus 302 is used to realize the connection and communication between these components.

[0081] Among them, the user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may further include a standard wired interface and a wireless interface.

[0082] Among them, the network interface 304 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

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

[0084] Among them, the memory 305 may include a Random Access Memory (RAM), or may also include a 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. Among them, the program storage area can store instructions for implementing the operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area can store the data involved in the above-mentioned method embodiments. Optionally, the memory 305 may also be at least one storage device located far from the aforementioned processor 301. Refer to Figure 3 In the memory 305, as a computer storage medium, an operating system, a network communication module, a user interface module, and an application program of a traditional Chinese medicine prescription data parsing method based on OCR recognition and a large model may be included.

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

[0086] This application also provides a computer-readable storage medium storing instructions. When executed by one or more processors 301, the electronic device 300 is caused to execute one or more of the methods as described in the above embodiments.

[0087] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0088] In several implementation manners provided by this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, 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 displayed or discussed coupling or direct coupling or communication connection between each other can be through some service interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.

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

[0090] In addition, each functional unit in various embodiments of this application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0091] 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 such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of this application. And the aforementioned memory includes: various media such as USB flash drives, mobile hard disks, magnetic disks, or optical discs that can store program codes.

[0092] The above are only exemplary embodiments of the present disclosure and should not be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure still fall within the scope covered by the present disclosure. Those skilled in the art will easily think of other implementation schemes of the present disclosure after considering the specification and the disclosed practice truth.

[0093] This application aims to cover any variations, uses, or adaptive changes of the present disclosure. These variations, uses, or adaptive changes follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not recorded in the present disclosure. The specification and the embodiments are only regarded as exemplary, 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; 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; 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; Merging the traditional Chinese medicine prescription database and the RAG model to obtain the preset large model; 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.

2. 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.

3. 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.

4. 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.

5. 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.

6. A Chinese medicine prescription data analysis device based on OCR recognition and large model, characterized in that: The device is used to execute the method according to any one of claims 1 to 5, and 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.

7. 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 5.

8. 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 5 is performed.

Citation Information

Patent Citations

  • Medication rationality identification method and device, storage medium and electronic equipment

    CN119170192A

  • User question information response method and device, equipment, medium and program product

    CN119415661A

  • Traditional Chinese medicine clinical research scheme generation method and system

    CN119580904A