Medical record classification method, system, terminal and storage medium

By performing text recognition and keyword detection on medical record images, combined with regular expression matching and object detection, the problem of low accuracy in classifying paper medical records has been solved, achieving efficient and accurate determination of medical record document categories.

CN116311316BActive Publication Date: 2026-06-30BEIJING UNISOUND INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING UNISOUND INFORMATION TECH CO LTD
Filing Date
2023-03-22
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing medical record classification methods are inaccurate and ineffective when processing paper medical records.

Method used

By performing text recognition on medical record images, detecting keywords, and performing keyword matching and regular expression matching, combined with document classification prediction and object detection, the document category of paper medical records can be determined.

Benefits of technology

It improves the accuracy and efficiency of medical record classification, and allows for the determination of document categories for paper medical records without the need for structured electronic medical records.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116311316B_ABST
    Figure CN116311316B_ABST
Patent Text Reader

Abstract

The application provides a medical record classification method, system, terminal and storage medium, the method comprises the following steps: carrying out text recognition on the medical record image of a medical record to be classified to obtain a medical record text, and carrying out keyword detection on the medical record image according to the medical record text; if the keyword detection of the medical record text is qualified, carrying out keyword matching on the medical record text to obtain a keyword matching result; if the keyword matching result does not satisfy a keyword classification condition, carrying out regular matching on the medical record text to obtain a text regular matching result; if the text regular matching result does not satisfy a regular matching classification condition, carrying out document classification prediction on the medical record text to obtain a document classification prediction result; if the document classification prediction result does not satisfy a preset classification condition, carrying out target detection on the medical record image, and determining the document category of the medical record to be classified according to the target detection result. The application can effectively determine the document category of a paper medical record to be classified, and improves the accuracy of medical record classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a medical record classification method, system, terminal, and storage medium. Background Technology

[0002] With the continuous advancement of science and technology and the continuous improvement of people's living standards, the existing medical system is constantly being enriched, such as provincial hospitals, municipal hospitals, district hospitals, and township hospitals. Each hospital system needs to process massive amounts of medical data during its operation. In the process of processing medical data, the classification of medical records is particularly important.

[0003] In existing medical record classification processes, electronic medical records are generally classified. Electronic medical records can directly obtain standard structured text. However, when it is necessary to classify paper medical records, the classification cannot be carried out effectively, which reduces the accuracy of medical record classification. Summary of the Invention

[0004] The purpose of this invention is to provide a medical record classification method, system, terminal, and storage medium, aiming to solve the problem of low accuracy in existing medical record classification.

[0005] This invention is implemented as follows: a medical record classification method, the method comprising:

[0006] Text recognition is performed on the images of medical records to be classified to obtain the medical record text, and keyword detection is performed on the medical record images based on the medical record text;

[0007] If the keyword detection of the medical record text is qualified, then keyword matching is performed on the medical record text to obtain the keyword matching result;

[0008] If the keyword matching result does not meet the keyword classification conditions, then regular expression matching is performed on the medical record text to obtain the text regular expression matching result;

[0009] If the text regular expression matching result does not meet the regular expression matching classification condition, then the medical record text is subjected to document classification prediction to obtain the document classification prediction result;

[0010] If the document classification prediction result does not meet the preset classification conditions, then target detection is performed on the medical record image, and the document category of the medical record to be classified is determined based on the target detection result.

[0011] Preferably, if the keyword detection of the medical record text is qualified, the method further includes:

[0012] Obtain the text information of the first preset number of lines in the medical record text to obtain the extracted text, and perform text box detection on the extracted text;

[0013] If the text box of the extracted text passes the detection, then regular expression matching is performed on the extracted text to obtain the text box regular expression matching result, and the document category of the medical record to be classified is determined based on the text box regular expression matching result.

[0014] Preferably, the step of performing text box detection on the extracted text includes:

[0015] Determine whether a centered text detection box exists in the extracted text;

[0016] If the extracted text contains the centered text detection box, then the gap distance between the centered text detection box and the adjacent text detection boxes is obtained, and the distance ratio between the gap distance and the image width of the medical record image is calculated.

[0017] If the distance ratio is greater than the preset ratio, the text box for extracting text is deemed to have passed the detection.

[0018] Preferably, the keyword matching of the medical record text includes:

[0019] Obtain text detection boxes from the medical record text, and determine the set of text keywords in the medical record text based on the text detection boxes;

[0020] The number of keywords in the intersection is obtained by combining the set of text keywords with the set of keywords in each preset category.

[0021] If the maximum number of keywords is less than the number threshold, then the keyword matching result is determined not to meet the keyword classification conditions.

[0022] Preferably, after obtaining the number of intersection keywords by intersecting the text keyword set with each preset category keyword set, the method further includes:

[0023] If the maximum number of keywords is greater than or equal to the number threshold, then the keyword matching result is determined to meet the keyword classification condition, and the preset category keyword set corresponding to the maximum number of keywords is determined as the target keyword set;

[0024] The document category corresponding to the target keyword set is determined as the document category of the medical record to be classified.

[0025] Preferably, determining the document category of the medical record to be classified based on the target detection result includes:

[0026] Obtain the bounding box score of each bounding box in the target detection result, and filter each bounding box according to the bounding box score to obtain candidate bounding boxes;

[0027] Non-maximum suppression is performed on each candidate bounding box to obtain the target bounding box, and the boundary parameters of the target bounding box are matched with each preset boundary parameter respectively;

[0028] If any of the preset boundary parameters matches the boundary parameters of the target bounding box, then the document category corresponding to the preset boundary parameter is determined as the document category of the medical record to be classified.

[0029] Preferably, the step of performing keyword detection on the medical record image based on the medical record text includes:

[0030] Match the text words in the medical record with pre-set blacklist keywords;

[0031] If none of the text words in the medical record text match the keywords in the blacklist, then the keyword detection of the medical record text is deemed to be qualified.

[0032] If any of the blacklisted keywords matches a word in the medical record text, then the keyword detection of the medical record text is deemed unqualified.

[0033] Another objective of this invention is to provide a medical record classification system, the system comprising:

[0034] The keyword detection module is used to perform text recognition on the medical record images of the medical records to be classified, obtain the medical record text, and perform keyword detection on the medical record images based on the medical record text;

[0035] The keyword matching module is used to perform keyword matching on the medical record text if the keyword detection of the medical record text is qualified, and to obtain the keyword matching result;

[0036] The regular expression matching module is used to perform regular expression matching on the medical record text if the keyword matching result does not meet the keyword classification conditions, so as to obtain the text regular expression matching result.

[0037] The document classification module is used to perform document classification prediction on the medical record text if the text regular expression matching result does not meet the regular expression matching classification condition, and obtain the document classification prediction result.

[0038] The target detection module is used to perform target detection on the medical record image if the document classification prediction result does not meet the preset classification conditions, and determine the document category of the medical record to be classified based on the target detection result.

[0039] Another objective of this invention is to provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0040] Another objective of this invention is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0041] This invention improves the efficiency of medical record classification by performing text recognition on the images of medical records to be classified, eliminating the need for structured electronic medical records required by traditional medical record classification. By performing keyword detection on medical record images, regular expression matching on medical record text, document classification prediction on medical record text, and target detection on medical record images, the document category of paper medical records to be classified can be effectively determined, thus improving the accuracy of medical record classification. Attached Figure Description

[0042] Figure 1 This is a flowchart of the medical record classification method provided in the first embodiment of the present invention;

[0043] Figure 2 This is a flowchart of the medical record classification method provided in the second embodiment of the present invention;

[0044] Figure 3 This is a schematic diagram of the medical record classification system provided in the third embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram illustrating the specific implementation steps of the medical record classification system provided in the fourth embodiment of the present invention;

[0046] Figure 5 This is a schematic diagram of the structure of the terminal device provided in the fifth embodiment of the present invention. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0048] To illustrate the technical solution described in this invention, specific embodiments are described below.

[0049] Example 1

[0050] Please see Figure 1 This is a flowchart of a medical record classification method provided in the first embodiment of the present invention. This medical record classification method can be applied to any terminal device or system, and includes the following steps:

[0051] Step S10: Perform text recognition on the medical record images of the medical records to be classified to obtain the medical record text, and perform keyword detection on the medical record images based on the medical record text;

[0052] In this process, images of medical records to be classified are acquired. These images can be acquired using any device with a camera function, such as a mobile phone, tablet, or wearable smart device. By performing text detection on the images, the parts of the images containing text are segmented to form detection boxes. The orientation of the detection boxes is then corrected, and finally, the text within the detection boxes is identified to obtain the medical record text. Based on step S10, user-uploaded medical record images can be effectively converted into medical record text.

[0053] Optionally, in this step, the keyword detection of the medical record image based on the medical record text includes:

[0054] Match the text words in the medical record with pre-set blacklist keywords;

[0055] The number and content of keywords in the blacklist can be set according to needs. For example, the blacklist keywords can be set to words such as "insurance" and "deposit".

[0056] If none of the text words in the medical record text match the keywords in the blacklist, then the keyword detection of the medical record text is deemed to be qualified.

[0057] If any of the blacklisted keywords matches a word in the medical record text, then the keyword detection of the medical record text is deemed unqualified.

[0058] If none of the text words in the medical record text match the blacklist keywords, the document category of the medical record to be classified is determined to belong to the document category preset in the current scenario, and the keyword detection of the medical record text is qualified. If any blacklist keyword matches the text words in the medical record text, the document category of the medical record to be classified is determined to not belong to the document category preset in the current scenario, and the keyword detection of the medical record text is unqualified.

[0059] In this step, the pre-set document categories for the current scenario can be set according to needs. In this embodiment, the current scenario is an inpatient medical scenario. The pre-set document categories include medical expense records, resident ID cards, social security cards, general prescriptions, examination records, laboratory records, surgical records, anesthesia records, invasive diagnosis and treatment operation records, surgical risk assessment forms, surgical nursing records, body temperature records, discharge assessment and guidance records, surgical consent forms, critical illness (critical) notices, doctor-patient communication records, inpatient medical record cover sheet, admission records, daily progress notes, difficult case discussion records, transfer records, emergency records, consultation records, preoperative summaries, preoperative discussion records, discharge summaries, long-term medical orders, temporary medical orders, discharge records, and medical insurance fund settlement lists, etc.

[0060] Step S20: If the keyword detection of the medical record text is qualified, then perform keyword matching on the medical record text to obtain the keyword matching result;

[0061] Specifically, by matching keywords in the medical record text with keywords in each preset document category, it is determined whether there is a keyword association between the medical record text and each preset document category;

[0062] Optionally, in this step, keyword matching of the medical record text includes:

[0063] Obtain text detection boxes from the medical record text, and determine the set of text keywords in the medical record text based on the text detection boxes;

[0064] The number of keywords in the intersection is obtained by combining the set of text keywords with the set of keywords in each preset category.

[0065] If the maximum number of keywords is less than the number threshold, then the keyword matching result is determined not to meet the keyword classification conditions;

[0066] Here, the preset category keyword set is a set of keywords corresponding to a preset document category. For the preset category keyword set, keywords in the optical character recognition (OCR) bounding boxes corresponding to each preset document category are collected from the training set of preset values. Then, the number of medical record texts in the same document category that contain the keyword is calculated, and keywords that contain the word in at least 20 medical record texts in the same document category are selected and denoted as w. k .

[0067] Some keywords appear infrequently due to typos in the OCR recognition results, but these are still needed keywords. Therefore, to recall these special keywords, we first select the keywords with low frequency as candidate keywords, denoted as w. c Each of these keywords is compared with the previously selected keywords that appear frequently. k Calculate the similarity score, sim = 1 - edit distance / w k The string length is set such that when sim >= 0.65, the candidate keyword w is selected. c Classified as w k Filter out the keywords corresponding to each pre-set document category. k Next, it's necessary to filter out some distracting keywords. The filtering method is to detect keywords w k If a keyword appears in medical record texts of different document categories, it will be removed to obtain a set of preset category keywords for each document category.

[0068] In this step, the intersection of the text keyword set with each preset category keyword set is obtained to obtain the same keyword set between the medical record text and each preset document category. The number of keywords in each same keyword set is obtained to obtain the number of intersection keywords. The threshold of this number can be set according to the needs. Preferably, the threshold of this number is set to 4. If the maximum number of keywords is less than 4, it is determined that the keyword matching result does not meet the keyword classification conditions, that is, the document category of the medical record text is not determined based on keyword matching.

[0069] Furthermore, in this step, after obtaining the number of intersection keywords by intersecting the set of text keywords with each preset category keyword set, the method further includes:

[0070] If the maximum number of keywords is greater than or equal to the number threshold, then the keyword matching result is determined to meet the keyword classification condition, and the preset category keyword set corresponding to the maximum number of keywords is determined as the target keyword set;

[0071] The document categories corresponding to the target keyword set are determined as the document categories of the medical records to be classified.

[0072] If the maximum number of keywords is greater than or equal to 4, it is determined that the medical record text has a keyword association with the document category corresponding to the maximum number of keywords. By determining the preset category keyword set corresponding to the maximum number of keywords as the target keyword set, the document category of the medical record to be classified can be effectively determined based on the target keyword set.

[0073] Step S30: If the keyword matching result does not meet the keyword classification conditions, then perform regular expression matching on the medical record text to obtain the text regular expression matching result;

[0074] If the keyword matching result does not meet the keyword classification conditions, the document category of the medical record to be classified is queried by performing regular expression matching on all lines of information in the medical record text. If the medical record text matches a regular expression rule defined for a certain document category, then that document category is determined as the document category of the medical record to be classified.

[0075] Step S40: If the text regular expression matching result does not meet the regular expression matching classification condition, then perform document classification prediction on the medical record text to obtain the document classification prediction result;

[0076] In this step, if the text regular expression matching result does not meet the regular expression matching classification condition, then the OCR result information of all lines in the medical record text is used to predict the document classification based on the FastText document classification model.

[0077] The FastText document classification model is very similar to the CBOW model in Word2Vec. The difference is that the FastText model is trained to predict text labels, while the CBOW model is trained to predict intermediate words. The FastText model is mainly divided into three layers: input layer, hidden layer, and output layer. First, based on the words contained in the text and their corresponding n-gram indices, the corresponding word vectors are obtained through an embedding matrix table. Then, these vectors are stacked and averaged in the hidden layer. The output layer is a layered softmax. Finally, the model is trained using a multi-class cross-entropy loss function.

[0078] Step S50: If the document classification prediction result does not meet the preset classification conditions, then target detection is performed on the medical record image, and the document category of the medical record to be classified is determined according to the target detection result.

[0079] The preset classification conditions can be set according to needs. Preferably, the preset classification conditions are set such that if the predicted document category is "other" or the score is <0.6, the document classification prediction result is determined not to meet the preset classification conditions. If the predicted document category is not "other" and the score is >=0.6, the document classification prediction result is determined to meet the preset classification conditions, and the predicted document category is directly output.

[0080] In this step, object detection is performed on the medical record image. Based on the object detection results, the document category of the medical record to be classified can be effectively determined. In this step, the YOLOv3 object detection model can be used to perform object detection on the medical record image. The YOLOv3 object detection model is mainly used to identify the document categories of resident ID cards and social security cards. In the field of medical insurance, the identification of resident ID cards and social security cards is a very important link for identity authentication and to prevent insurance fraud.

[0081] Optionally, in this step, determining the document category of the medical record to be classified based on the target detection result includes:

[0082] Obtain the bounding box score of each bounding box in the target detection result, and filter each bounding box according to the bounding box score to obtain candidate bounding boxes;

[0083] Non-maximum suppression is performed on each candidate bounding box to obtain the target bounding box, and the boundary parameters of the target bounding box are matched with each preset boundary parameter respectively;

[0084] If any of the preset boundary parameters matches the boundary parameters of the target bounding box, then the document category corresponding to the preset boundary parameter is determined as the document category of the medical record to be classified.

[0085] The recognition of resident ID cards and social security cards integrates a YoloV3 object detection model. The YoloV3 model extracts multi-layer features from images for object detection, then decodes the prediction results to obtain multiple bounding boxes. Finally, bounding boxes with scores below 0.8 are filtered out to obtain candidate bounding boxes, and non-maximum suppression is used to select the final target bounding boxes. If a bounding box corresponding to an ID card is found after filtering, the system considers the photo to contain an ID card; if a bounding box corresponding to a social security card is found, the system considers the photo to contain a social security card.

[0086] In this embodiment, by performing keyword detection on medical record images, regular expression matching on medical record text, and object detection on medical record images, the document category of paper-based medical records to be classified can be effectively determined, improving the accuracy of medical record classification. At the same time, it integrates OCR, keyword retrieval, document classification model, and object detection model, enabling the direct identification of the corresponding document category from uploading a medical record image. This medical record classification method can be widely used as a basic task in various tasks in medical insurance and other related fields. By using OCR technology to convert medical record images into text, the document classification system eliminates the need for structured electronic medical records required by traditional document classification techniques. Users can obtain document classification results simply by taking a picture of the medical record with their mobile phone, making it more convenient and flexible in practical applications. This embodiment also integrates keyword retrieval, the FastText document classification model, and the YOLOv3 object detection model. These models complement each other. Keyword retrieval allows for manual customization of regular expressions for each document category, as well as the creation of separate regular expressions for specific hospitals. The system can also automatically filter keywords for each document category, offering great flexibility and facilitating rapid iteration of document classification based on actual needs. The FastText document classification model addresses document categories with low discriminative power and difficult-to-find keywords, allowing the model to adaptively learn and find potential differences between document categories. The YOLOv3 object detection model is specifically designed to detect ID cards or social security cards in medical record images for identity authentication in the medical insurance field. This embodiment supports the classification of multiple medical record document categories and also supports custom medical record document categories. As a basic task, it can be widely applied to various tasks in the medical insurance field.

[0087] Example 2

[0088] Please see Figure 2 This is a flowchart of a medical record classification method provided in the second embodiment of the present invention. This embodiment is used to further refine the steps after step S10 in the first embodiment, including the following steps:

[0089] Step S50: Obtain the text information of the first preset number of lines in the medical record text to obtain the extracted text, and perform text box detection on the extracted text.

[0090] The preset number of rows can be set according to requirements. In this step, the first 3 lines of OCR results in the medical record text are selected to obtain the extracted text. Text box detection is performed on the extracted text to obtain the position of each text detection box in the extracted text and to determine whether there is a page title in the extracted text.

[0091] Optionally, in this step, the text box detection of the extracted text includes:

[0092] Determine whether a centered text detection box exists in the extracted text;

[0093] If the extracted text contains the centered text detection box, then the gap distance between the centered text detection box and the adjacent text detection boxes is obtained, and the distance ratio between the gap distance and the image width of the medical record image is calculated.

[0094] If the distance ratio is greater than the preset ratio, the text box for extracting text is deemed to have passed the detection.

[0095] The preset ratio can be set according to requirements. In this step, the presence of a page title in the extracted text is determined by whether there is a centered text detection box and the ratio of the gap between the centered text detection box and the adjacent text detection boxes to the image width. That is, if the distance ratio is greater than the preset ratio, it is determined that there is a page title in the extracted text, and the text box detection of the extracted text is qualified.

[0096] Step S60: If the text box of the extracted text is qualified, then perform regular expression matching on the extracted text to obtain the text box regular expression matching result, and determine the document category of the medical record to be classified based on the text box regular expression matching result.

[0097] If a page title exists in the extracted text, regular expression matching is performed on the extracted text. If the extracted text matches a regular expression rule defined for a document category, that document category is determined as the document category of the medical records to be classified.

[0098] In this embodiment, by obtaining the text information of the first preset number of lines in the medical record text, the text extraction effect of the medical record text can be effectively achieved. By performing text box detection on the extracted text, the position of each text detection box in the extracted text is obtained, and it is determined whether there is a page title in the extracted text. If there is a page title in the extracted text, the document category of the medical record to be classified is determined by performing regular expression matching on the extracted text.

[0099] Example 3

[0100] Please see Figure 3 This is a schematic diagram of the structure of a medical record classification system 100 provided in the third embodiment of the present invention, including: a keyword detection module 10, a keyword matching module 11, a regular expression matching module 12, a document classification module 13, and a target detection module 14, wherein:

[0101] The keyword detection module 10 is used to perform text recognition on the medical record images of the medical records to be classified, obtain the medical record text, and perform keyword detection on the medical record images based on the medical record text.

[0102] Optionally, the keyword detection module 10 is also used to: match the text words in the medical record text with pre-set blacklist keywords;

[0103] If none of the text words in the medical record text match the keywords in the blacklist, then the keyword detection of the medical record text is deemed to be qualified.

[0104] If any of the blacklisted keywords matches a word in the medical record text, then the keyword detection of the medical record text is deemed unqualified.

[0105] The keyword matching module 11 is used to perform keyword matching on the medical record text if the keyword detection of the medical record text is qualified, and obtain the keyword matching result.

[0106] Optionally, the keyword matching module 11 is further configured to: obtain the text information of the first preset number of lines in the medical record text, obtain the extracted text, and perform text box detection on the extracted text;

[0107] If the text box of the extracted text passes the detection, then regular expression matching is performed on the extracted text to obtain the text box regular expression matching result, and the document category of the medical record to be classified is determined based on the text box regular expression matching result.

[0108] Furthermore, the keyword matching module 11 is also used to: determine whether there is a centered text detection box in the extracted text;

[0109] If the extracted text contains the centered text detection box, then the gap distance between the centered text detection box and the adjacent text detection boxes is obtained, and the distance ratio between the gap distance and the image width of the medical record image is calculated.

[0110] If the distance ratio is greater than the preset ratio, the text box for extracting text is deemed to have passed the detection.

[0111] Furthermore, the keyword matching module 11 is also used to: obtain text detection boxes in the medical record text, and determine the set of text keywords in the medical record text based on the text detection boxes;

[0112] The number of keywords in the intersection is obtained by combining the set of text keywords with the set of keywords in each preset category.

[0113] If the maximum number of keywords is less than the number threshold, then the keyword matching result is determined not to meet the keyword classification conditions.

[0114] Preferably, the keyword matching module 11 is further configured to: if the maximum number of keywords is greater than or equal to the number threshold, determine that the keyword matching result satisfies the keyword classification condition, and determine the preset category keyword set corresponding to the maximum number of keywords as the target keyword set;

[0115] The document category corresponding to the target keyword set is determined as the document category of the medical record to be classified.

[0116] The regular expression matching module 12 is used to perform regular expression matching on the medical record text if the keyword matching result does not meet the keyword classification conditions, so as to obtain the text regular expression matching result.

[0117] The document classification module 13 is used to perform document classification prediction on the medical record text if the text regular expression matching result does not meet the regular expression matching classification conditions, and obtain the document classification prediction result.

[0118] If the text regular expression matching result does not meet the regular expression matching classification condition, then the OCR result information of all lines in the medical record text is used to predict the document classification based on the FastText document classification model.

[0119] The FastText document classification model is very similar to the CBOW model in Word2Vec. The difference is that the FastText model is trained to predict text labels, while the CBOW model is trained to predict intermediate words. The FastText model is mainly divided into three layers: input layer, hidden layer, and output layer. First, based on the words contained in the text and their corresponding n-gram indices, the corresponding word vectors are obtained through an embedding matrix table. Then, these vectors are stacked and averaged in the hidden layer. The output layer is a layered softmax. Finally, the model is trained using a multi-class cross-entropy loss function.

[0120] The target detection module 14 is used to perform target detection on the medical record image if the document classification prediction result does not meet the preset classification conditions, and determine the document category of the medical record to be classified based on the target detection result.

[0121] Optionally, the target detection module 14 is further configured to: obtain the bounding box score of each bounding box in the target detection result, and filter each bounding box according to the bounding box score to obtain candidate bounding boxes;

[0122] Non-maximum suppression is performed on each candidate bounding box to obtain the target bounding box, and the boundary parameters of the target bounding box are matched with each preset boundary parameter respectively;

[0123] If any of the preset boundary parameters matches the boundary parameters of the target bounding box, then the document category corresponding to the preset boundary parameter is determined as the document category of the medical record to be classified.

[0124] In this embodiment, text recognition of medical record images eliminates the need for structured electronic medical records required by traditional medical record classification, thus improving the efficiency of medical record classification. By performing keyword detection on medical record images, regular expression matching on medical record text, document classification prediction on medical record text, and target detection on medical record images, the document category of paper medical records to be classified can be effectively determined, thereby improving the accuracy of medical record classification.

[0125] Example 4

[0126] The fourth embodiment of the present invention provides a medical record classification system, including: an Ocr module, a keyword retrieval module, a document classification module, and a target detection module, wherein:

[0127] In the Ocr module, text detection is performed on medical record photos based on the PaddleOcr system. The parts of the image containing text are segmented and processed to form detection boxes. Then, the orientation of the detection boxes is corrected, and finally, the text in the detection boxes is recognized. The Ocr module can convert user-uploaded medical record photos into medical record text.

[0128] The keyword retrieval module mainly consists of two parts. The first part involves manually defining regular expressions for highly distinguishable medical record document categories. These regular expressions are then used to match and determine the category of each document. The second part automatically finds keywords for each document category. This is done by collecting keywords from the OCR detection boxes corresponding to each document category in the training set, calculating how many medical records within the same category contain that keyword, and then filtering out keywords that appear in at least 20 medical records within the same category, denoted as w. k Some keywords appeared infrequently due to typos in the OCR recognition results, but these are still needed keywords. Therefore, to recall these special keywords, this system first uses keywords with low frequency as candidate keywords, denoted as w. c Each of these keywords is compared with the previously selected keywords that appear frequently. k Calculate the similarity score, sim = 1 - edit distance / wk (string length). If sim >= 0.65, then the candidate keyword wk is selected. c Also classified as w k Filter out the keywords corresponding to each category of medical record documents. kNext, some distracting keywords need to be filtered out. The filtering method is to detect the keyword "w" in the system. k If a keyword appears in medical record texts across different document categories, it is removed. After filtering out interfering keywords, the system automatically selects a keyword list corresponding to each document category. During the document classification stage, the system collects the keyword set from all text detection boxes in the predicted medical record text, and then calculates the intersection with the keyword set corresponding to each document category to obtain the number of intersection keywords, ni. Finally, the system finds the largest ni, denoted as ni_max. When ni_max >= 4, the corresponding document category is the prediction result. If ni_max < 4, this module does not make a prediction and proceeds to the next prediction module.

[0129] In the document classification module, the FastText document classification model is used to predict document types. The FastText model is very similar to the CBOW model in Word2Vec, the difference being that the FastText model is trained to predict text labels, while the CBOW model is trained to predict intermediate words. The FastText model mainly consists of three layers: an input layer, a hidden layer, and an output layer. First, based on the words contained in the text and their corresponding n-gram indices, the corresponding word vectors are obtained through an embedding matrix table. Then, these vectors are stacked and averaged in the hidden layer. The output layer uses a hierarchical softmax method, and finally, the model is trained using a multi-class cross-entropy loss function.

[0130] In the object detection module, the YOLOv3 object detection model is used for object detection. In this system, the YOLOv3 model is primarily used to identify resident ID cards and social security cards. In practice, the previous three modules showed only moderate performance in identifying these documents. However, in the medical insurance field, the identification of resident ID cards and social security cards is a crucial step for identity verification and to prevent insurance fraud. Therefore, this system integrates the YOLOv3 object detection model for resident ID card and social security card identification. The YOLOv3 model extracts multi-layer features from the image for object detection, then decodes the prediction results to obtain multiple candidate bounding boxes. Finally, bounding boxes with scores below 0.8 are filtered out, and non-maximum suppression is used to select the final bounding boxes. If a bounding box corresponding to an ID card is found after filtering, the system considers the photo to contain an ID card; if a bounding box corresponding to a social security card is found, the system considers the photo to contain a social security card.

[0131] Please see Figure 4This diagram illustrates the specific implementation steps of the medical record classification system provided in this embodiment. The system first converts medical record photos into text using OCR, then performs blacklist keyword detection on the text. If a blacklist keyword is detected, the document category is determined not to belong to the previously defined 30 document categories. If no blacklist keyword is detected, the process continues. The next step selects the first three lines of OCR results and determines whether a page title exists based on the presence of a centered text detection box and the ratio of the gap between the centered text detection box and adjacent text detection boxes to the width of the photo. If a page title exists, the first three lines of information are sent to the regular expression matching module in the keyword retrieval module for regular expression matching. If a regular expression rule defined for a document category is matched, that document category is used as the prediction result and returned; otherwise, the process proceeds to the next step. The next step directly obtains the OCR results of all lines and sends the text information to the keyword retrieval module. If this module can return a specific prediction result, the predicted document category is returned directly; if the module cannot provide a prediction result, the process proceeds to the next step. The next step uses the FastText model to predict document category based on the OCR results of all rows. If the predicted document category is not "Other" and the score is greater than or equal to 0.6, the prediction result is returned directly. If the predicted document category is "Other" or the score is less than 0.6, the process proceeds to the next step. The next step uses the YOLOv3 object detection model to detect whether the medical record photo belongs to an ID card or social security card. If, after multiple screenings, a bounding box corresponding to an ID card or social security card is found in the image, the corresponding document category is returned; otherwise, the medical record photo is determined not to belong to one of the 30 defined document categories.

[0132] In this embodiment, OCR technology is used to convert medical record photos into text. This eliminates the need for structured electronic medical records required by traditional document classification technologies. Users can simply take a photo of the medical record with their mobile phone and upload it to the document classification system to obtain the classification results. This is more convenient and flexible in practical applications. This patented technology also integrates a keyword retrieval module, the FastText document classification model, and the YoloV3 object detection model, with these models complementing each other. The keyword retrieval module allows for manual customization of regular expressions for each document category, as well as the creation of separate regular expressions for specific hospitals. It also allows the system to automatically filter keywords for each document category, offering great flexibility and facilitating rapid iteration of the document classification system based on actual needs. The FastText document classification model addresses document categories with low discriminative power and difficult-to-find keywords, allowing the model to adaptively learn and identify potential differences between document categories. The YoloV3 object detection model is specifically designed to detect ID cards or social security cards in medical record photos for identity authentication in the medical insurance field. This embodiment supports the classification of multiple medical record document categories and also supports custom medical record document categories. As a basic task, it can be widely applied to various tasks in the medical insurance field.

[0133] Example 5

[0134] Figure 5 This is a structural block diagram of a terminal device 2 provided in the fifth embodiment of this application. For example... Figure 5 As shown, the terminal device 2 in this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program for a medical record classification method. When the processor 20 executes the computer program 22, it implements the steps in the various embodiments of the above-described medical record classification methods.

[0135] For example, the computer program 22 may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 20 to complete this application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, the processor 20 and the memory 21.

[0136] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0137] The memory 21 can be an internal storage unit of the terminal device 2, such as a hard disk or memory of the terminal device 2. The memory 21 can also be an external storage device of the terminal device 2, such as a plug-in hard disk, SmartMediaCard (SMC), SecureDigital (SD) card, or FlashCard equipped on the terminal device 2. Furthermore, the memory 21 can include both internal and external storage units of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 can also be used to temporarily store data that has been output or will be output.

[0138] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0139] If an integrated module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. This computer-readable storage medium can be non-volatile or volatile. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the contents of a computer-readable storage medium may be appropriately added to or subtracted from the contents as required by the legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, a computer-readable storage medium may not include electrical carrier signals and telecommunication signals.

[0140] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A medical record classification method characterized by, The method includes: Text recognition is performed on the images of medical records to be classified to obtain the medical record text, and keyword detection is performed on the medical record images based on the medical record text; If the keyword detection of the medical record text is qualified, then keyword matching is performed on the medical record text to obtain the keyword matching result; If the keyword matching result does not meet the keyword classification conditions, then regular expression matching is performed on the medical record text to obtain the text regular expression matching result; If the text regular expression matching result does not meet the regular expression matching classification condition, then the medical record text is subjected to document classification prediction to obtain the document classification prediction result; If the document classification prediction result does not meet the preset classification conditions, then target detection is performed on the medical record image, and the document category of the medical record to be classified is determined based on the target detection result. The keyword matching of the medical record text includes: Obtain text detection boxes from the medical record text, and determine the set of text keywords in the medical record text based on the text detection boxes; The number of keywords in the intersection is obtained by combining the set of text keywords with the set of keywords in each preset category. If the maximum number of keywords is less than the number threshold, then the keyword matching result is determined not to meet the keyword classification conditions; The step of determining the document category of the medical record to be classified based on the target detection result includes: Obtain the bounding box score of each bounding box in the target detection result, and filter each bounding box according to the bounding box score to obtain candidate bounding boxes; Non-maximum suppression is performed on each candidate bounding box to obtain the target bounding box, and the boundary parameters of the target bounding box are matched with each preset boundary parameter respectively; If any of the preset boundary parameters matches the boundary parameters of the target bounding box, then the document category corresponding to the preset boundary parameter is determined as the document category of the medical record to be classified. The step of performing keyword detection on the medical record image based on the medical record text includes: Match the text words in the medical record with pre-set blacklist keywords; If none of the text words in the medical record text match the keywords in the blacklist, then the keyword detection of the medical record text is deemed to be qualified. If any of the blacklisted keywords matches a word in the medical record text, then the keyword detection of the medical record text is deemed unqualified. The step of performing document classification prediction on the medical record text to obtain document classification prediction results includes: If the text regular expression matching result does not meet the regular expression matching classification condition, then the document classification prediction is performed on the OCR result information of all lines in the medical record text based on the FastText document classification model.

2. The medical record categorization method of claim 1, wherein, If the keyword detection of the medical record text is qualified, the method further includes: Obtain the text information of the first preset number of lines in the medical record text to obtain the extracted text, and perform text box detection on the extracted text; If the text box of the extracted text passes the detection, then regular expression matching is performed on the extracted text to obtain the text box regular expression matching result, and the document category of the medical record to be classified is determined based on the text box regular expression matching result.

3. The medical record categorization method of claim 2, wherein, The step of performing text box detection on the extracted text includes: Determine whether a centered text detection box exists in the extracted text; If the extracted text contains the centered text detection box, then the gap distance between the centered text detection box and the adjacent text detection boxes is obtained, and the distance ratio between the gap distance and the image width of the medical record image is calculated. If the distance ratio is greater than the preset ratio, the text box for extracting text is deemed to have passed the detection.

4. The medical record categorization method of claim 1, wherein, After obtaining the number of intersection keywords by intersecting the text keyword set with each preset category keyword set, the method further includes: If the maximum number of keywords is greater than or equal to the number threshold, then the keyword matching result is determined to meet the keyword classification condition, and the preset category keyword set corresponding to the maximum number of keywords is determined as the target keyword set; The document category corresponding to the target keyword set is determined as the document category of the medical record to be classified.

5. A medical record classification system employing the medical record classification method according to any one of claims 1 to 4, characterized by, The system includes: The keyword detection module is used to perform text recognition on the medical record images of the medical records to be classified, obtain the medical record text, and perform keyword detection on the medical record images based on the medical record text; The keyword matching module is used to perform keyword matching on the medical record text if the keyword detection of the medical record text is qualified, and to obtain the keyword matching result; The regular expression matching module is used to perform regular expression matching on the medical record text if the keyword matching result does not meet the keyword classification conditions, so as to obtain the text regular expression matching result. The document classification module is used to perform document classification prediction on the medical record text if the text regular expression matching result does not meet the regular expression matching classification condition, and obtain the document classification prediction result. The target detection module is used to perform target detection on the medical record image if the document classification prediction result does not meet the preset classification conditions, and determine the document category of the medical record to be classified based on the target detection result.

6. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 4.

7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.