Disease diagnosis method and system
By using BERT model and vector database to extract and match the similarity of disease symptoms, and combining knowledge graphs to match the symptoms, the problem of lengthy and inefficient diagnosis of complex diseases in the prior art is solved, and rapid and accurate disease diagnosis is achieved.
Patent Information
- Application Number
- CN202411583293.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-18
AI Technical Summary
Existing disease diagnosis methods are prone to missed diagnosis and misdiagnosis when dealing with complex diseases, and the diagnosis process is lengthy and inefficient, making it difficult for patients to understand professional terms.
The BERT model and vector database are used to extract the feature vectors and match the similarity of disease symptoms, and combine the knowledge graph to match the symptoms to achieve rapid and accurate disease diagnosis.
By introducing vector databases and knowledge graphs, symptoms that are most similar to patients' descriptions can be quickly matched, the accuracy and efficiency of diagnosis can be improved, and missed diagnosis and misdiagnosis can be reduced.
Smart Images

Figure CN119480079A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of medical information technology, and in particular to a disease diagnosis method and system. Background Art
[0002] Disease diagnosis is a critical part of the disease diagnosis and treatment process. Clinicians can conduct comprehensive analysis and reasoning based on information such as interviews, laboratory tests, and physical signs, and then provide a list of suspected diseases of the patient. However, due to the complexity and variety of patient disease conditions, many patients suffer from multiple diseases, and some diseases have a low incidence rate. Doctors may lack the corresponding diagnosis and treatment experience, so under the actual high-intensity working conditions, missed diagnosis and misdiagnosis are prone to occur.
[0003] The current method of diagnosing diseases usually involves giving patients a series of symptom labels, and then having them perform multiple rounds of selection operations based on their own conditions, so as to gradually narrow the scope of the disease and achieve the purpose of disease diagnosis.
[0004] However, since the recommended symptom labels are not easy to hit the symptoms that patients want to express, the diagnosis process becomes lengthy and inefficient. In addition, the recommended symptom terms are too professional and difficult for patients to understand, which leads to the inability to accurately diagnose complex diseases. Summary of the invention
[0005] Based on the above-mentioned deficiencies of the prior art, the present application provides a disease diagnosis method and system to solve the problem of being unable to accurately diagnose complex diseases.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] The first aspect of the present application provides a method for diagnosing a disease, comprising:
[0008] Acquiring disease symptoms of the patient, and pre-processing the disease symptoms to obtain target disease symptoms;
[0009] Inputting the target disease symptom into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptom;
[0010] Inputting the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector;
[0011] Determining whether the score corresponding to the symptom is greater than a preset threshold;
[0012] If the score corresponding to the symptom is greater than a preset threshold, the symptom is input into a pre-constructed knowledge graph for matching to obtain a matching result corresponding to the symptom; wherein the matching result includes at least the number of matches;
[0013] Determining whether the number of matches corresponding to the symptom is greater than a preset number;
[0014] If the number of matches corresponding to the symptom is not greater than a preset number, the matching result is fed back to the front end.
[0015] Optionally, in the above-mentioned disease diagnosis method, the method for constructing the knowledge graph includes:
[0016] Access to multiple clinic medical records;
[0017] For each of the outpatient medical records, extract the diagnosis field and the medical history field of the outpatient medical record from the outpatient medical record;
[0018] Using the content corresponding to the diagnosis field as the disease name, and using the content corresponding to the medical history field as the symptom;
[0019] Input the symptom into a pre-trained medical model to obtain multiple symptom items corresponding to the symptom;
[0020] Input each of the symptom items into a pre-trained BERT model to perform similarity calculation to obtain the similarity corresponding to each of the symptom items;
[0021] Filter out target similarities greater than a preset threshold from all similarities, and merge target symptom items corresponding to the target similarities to obtain target symptom items;
[0022] A symptom relationship is constructed based on each of the target symptom items and the disease name, and a knowledge graph is constructed based on all the symptom relationships.
[0023] Optionally, in the above-mentioned disease diagnosis method, the method for constructing the vector database includes:
[0024] Acquire a plurality of the target symptom items, and pre-process each of the target symptom items;
[0025] Input each of the target symptom items after preprocessing into a pre-trained BERT model for processing to obtain a target feature vector corresponding to each of the target symptom items;
[0026] Selecting a vector database and creating a vector space in the vector database;
[0027] The target feature vector corresponding to each target symptom item is stored in the vector space to obtain a constructed vector database.
[0028] Optionally, in the above-mentioned disease diagnosis method, the step of inputting the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector includes:
[0029] Acquire a feature vector through a pre-built vector database, and use an approximate nearest neighbor search algorithm to calculate the similarity between the feature vector and each target feature vector in the vector database;
[0030] The maximum similarity is selected from all similarities, and the symptom corresponding to the maximum similarity is determined as the symptom corresponding to the feature vector.
[0031] Optionally, in the above-mentioned method for diagnosing a disease, the method further comprises:
[0032] If the score corresponding to the symptom is not greater than a preset threshold, a prompt message is fed back to the patient.
[0033] Optionally, in the above-mentioned method for diagnosing a disease, the method further comprises:
[0034] If the number of matches corresponding to the symptom is greater than a preset number, the matching results and target prompt information are fed back to the patient; wherein the target prompt information is used to prompt the patient to screen the matching results.
[0035] The second aspect of the present application provides a disease diagnosis system, comprising:
[0036] A symptom acquisition unit, used to acquire the patient's disease symptoms and pre-process the disease symptoms to obtain target disease symptoms;
[0037] A first input unit, used to input the target disease symptom into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptom;
[0038] A second input unit is used to input the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector;
[0039] A first judging unit, used to judge whether the score corresponding to the symptom is greater than a preset threshold;
[0040] A third input unit is used to input the symptom into a pre-constructed knowledge graph for matching if the score corresponding to the symptom is greater than a preset threshold, so as to obtain a matching result corresponding to the symptom; wherein the matching result at least includes the number of matches;
[0041] A second judgment unit is used to judge whether the matching number corresponding to the symptom is greater than a preset number;
[0042] A result feedback unit is used to feed back the matching result to the front end if the number of matches corresponding to the symptom is not greater than a preset number.
[0043] Optionally, the above-mentioned disease diagnosis system further includes:
[0044] A medical record acquisition unit, used to acquire multiple outpatient medical records;
[0045] A field extraction unit, for extracting the diagnosis field and the medical history field of each outpatient medical record from the outpatient medical record;
[0046] As a unit, used to use the content corresponding to the diagnosis field as the disease name, and the content corresponding to the medical history field as the symptom;
[0047] A fourth input unit, used to input the symptom into a pre-trained medical model to obtain a plurality of symptom items corresponding to the symptom;
[0048] A calculation unit, used for inputting each of the symptom items into a pre-trained BERT model to perform similarity calculation to obtain the similarity corresponding to each of the symptom items;
[0049] A merging unit, used to filter out each target similarity greater than a preset threshold from all similarities, and merge the target symptom items corresponding to each target similarity to obtain each target symptom item;
[0050] A construction unit is used to construct symptom relationships based on each of the target symptom items and the disease name, and to construct a knowledge graph based on all symptom relationships.
[0051] Optionally, the above-mentioned disease diagnosis system further includes:
[0052] A processing unit, used for acquiring a plurality of the target symptom items and preprocessing each of the target symptom items;
[0053] A fifth input unit is used to input each of the preprocessed target symptom items into a pre-trained BERT model for processing to obtain a target feature vector corresponding to each of the target symptom items;
[0054] A creating unit, used for selecting a vector database and creating a vector space in the vector database;
[0055] A storage unit is used to store the target feature vector corresponding to each target symptom item in the vector space to obtain a constructed vector database.
[0056] Optionally, in the above-mentioned disease diagnosis system, the second input unit includes:
[0057] A similarity calculation unit is used to obtain a feature vector through a pre-built vector database, and calculate the similarity between the feature vector and each target feature vector in the vector database using an approximate nearest neighbor search algorithm;
[0058] A selection unit is used to select a maximum similarity from all similarities, and determine the symptom corresponding to the maximum similarity as the symptom corresponding to the feature vector.
[0059] Optionally, the above-mentioned disease diagnosis system further includes:
[0060] The first feedback unit is used to feed back prompt information to the patient if the score corresponding to the symptom is not greater than a preset threshold.
[0061] Optionally, the above-mentioned disease diagnosis system further includes:
[0062] The second feedback unit is used to feed back the matching results and target prompt information to the patient if the number of matches corresponding to the symptom is greater than a preset number; wherein the target prompt information is used to prompt the patient to screen the matching results.
[0063] The present application provides a method for diagnosing a disease, which obtains the disease symptoms of the patient and pre-processes the disease symptoms to obtain the target disease symptoms, then inputs the target disease symptoms into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptoms, then inputs the feature vector into a pre-built vector database for symptom similarity matching, determines the symptom corresponding to the feature vector, and then determines whether the symptom score corresponding to the feature vector is greater than a preset threshold. If the score corresponding to the symptom is greater than the preset threshold, the symptom is input into a pre-built knowledge graph for matching to obtain a matching result corresponding to the symptom, wherein the matching result at least includes the number of matches, and finally determines whether the number of matches corresponding to the symptom is greater than a preset number. If the number of matches corresponding to the symptom is not greater than the preset number, the matching result is fed back to the front end. Thus, by introducing a vector database, the symptoms most similar to the patient's description can be matched therefrom, and then the matched symptoms are input into the knowledge graph for symptom matching to achieve accurate diagnosis, thereby effectively coping with the diagnosis of complex diseases. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0065] Figure 1 A schematic diagram of a method for diagnosing a disease provided in an embodiment of the present application;
[0066] Figure 2 A schematic diagram of a process for constructing a vector database provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of a method for determining a symptom provided in an embodiment of the present application;
[0068] Figure 4 A schematic diagram of a process for constructing a knowledge graph provided in an embodiment of the present application;
[0069] Figure 5 A schematic diagram of the structure of an outpatient medical record content provided in an embodiment of the present application;
[0070] Figure 6 A schematic diagram of the structure of a knowledge graph provided in an embodiment of the present application;
[0071] Figure 7 A schematic diagram of the structure of a disease diagnosis system provided in another embodiment of the present application. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0073] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0074] The present application embodiment provides a method for diagnosing a disease, such as Figure 1 As shown, the specific steps include:
[0075] S101. Obtain the patient's disease symptoms, and pre-process the disease symptoms to obtain target disease symptoms.
[0076] Optionally, the front end can display the disease upload page to the patient. When the patient uploads the disease symptoms on the disease upload page, the front end is triggered to send the disease symptoms entered by the patient on the page to the system. Therefore, when the patient's disease symptoms are received, the disease symptoms need to be pre-processed to ensure the accuracy of the subsequent process.
[0077] Specifically, the preprocessing operation on the disease symptoms may include removing stop words and punctuation marks, thereby achieving the effect of reducing noise.
[0078] S102. Input the target disease symptoms into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptoms.
[0079] Specifically, the tokenizer in the BERT model is used to convert the preprocessed text into a token sequence. The purpose of this step is to segment the text into basic units that the model can understand, and then convert the token sequence into the input format required by BERT, including the input token ID, attention mask, and possible segment ID. The prepared input data is then passed into the pre-trained BERT model for forward propagation calculation, and finally the feature vector is extracted from the output of the model. The vector corresponding to the [CLS] tag, that is, the embedding vector (feature vector) is usually taken as the representation of the target disease symptom.
[0080] S103: Input the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector.
[0081] It is understandable that the vector database will calculate the similarity based on the input feature vector and the existing symptom feature vector, and will also control the returned result to be only one piece of data, so as to obtain the most similar symptoms and their scores.
[0082] For example, the symptom similarity matching content shown in Table 1 is:
[0083] Table 1
[0084]
[0085] Therefore, according to the example shown in Table 1, the feature vector is a few small bumps felt around the neck. There are four symptoms in the vector database that are most similar to a few small bumps felt around the neck and their scores are superficial lymph node enlargement (0.592476487159729), increased white blood cell count (0.019254469871521), bilateral cervical lymph node enlargement with stippled blood flow signals (0.7628660202026367) and bilateral axillary, inguinal and submental lymph node enlargement (0.7424334287643433). Therefore, when “a few small bumps felt around the neck” is returned, the symptom is “bilateral cervical lymph node enlargement with stippled blood flow signals”.
[0086] Optionally, the present application embodiment provides a method for constructing a vector database, such as Figure 2 As shown, the following steps are included:
[0087] S201. Obtain multiple target symptom items, and pre-process each target symptom item.
[0088] It should be noted that the target symptom item refers to the symptom items remaining after merging similar symptoms in the process of constructing the knowledge graph.
[0089] Specifically, after obtaining multiple target symptom items, each target symptom item needs to be preprocessed to reduce noise and ensure the accuracy of the vectorization process.
[0090] S202. Input each target symptom item after preprocessing into a pre-trained BERT model for processing to obtain a target feature vector corresponding to each target symptom item.
[0091] It should be noted that the specific implementation of step S202 may refer to step S101 in the above method embodiment, and will not be described in detail here.
[0092] S203: Select a vector database, and create a vector space in the vector database.
[0093] Specifically, after obtaining the target feature vector corresponding to each target symptom item, you need to create a vector database for efficient similarity matching. Therefore, you can choose AISS: Facebook AI Similarity Search, suitable for large-scale vector retrieval; Milvus: open source vector database, supporting efficient vector retrieval and management; Pinecone: cloud service focusing on vector database, easy to integrate; Weaviate: vector database combined with knowledge graph, supporting rich query capabilities, etc. vector database, and then configure the environment according to the selected database. Install the necessary dependent libraries and tools, and then create the vector space: First, you need to define the vector dimension: set the vector space according to the dimension of the feature vector output by BERT, and initialize the vector database: create a new vector collection in the selected database, specify the name and related attributes. The effectiveness and accuracy of the retrieval results.
[0094] S204. Store the target feature vector corresponding to each target symptom item in the vector space to obtain a constructed vector database.
[0095] It can be understood that after the vector space is created, the target feature vector corresponding to each target symptom item can be inserted into the vector database containing the vector space, usually in batches.
[0096] Optionally, in another embodiment of the present application, a specific implementation of step S103 is as follows: Figure 3 As shown, the following steps are included:
[0097] S301, obtaining a feature vector through a pre-built vector database, and using an approximate nearest neighbor search algorithm to calculate the similarity between the feature vector and each target feature vector in the vector database.
[0098] Specifically, the feature vector output by the BERT model is obtained through the vector database, and then the vector database uses the approximate nearest neighbor search algorithm (ANN algorithm) to calculate the similarity between the feature vector corresponding to the disease symptoms and each feature vector in the database one by one, thereby obtaining the similarity between each feature vector in the database and the feature vector corresponding to the disease symptoms.
[0099] For example, similarity can be calculated in a logical way:
[0100] Python
[0101] #Query nearest neighbor
[0102] k=5#Return the first 5 nearest neighbors
[0103] D, I = index.search(np.array(symptom_embeddings), k) #D is the distance, I is the index.
[0104] Output similarity:
[0105] Python
[0106] for i,symptomin enumerate(symptoms):
[0107] print(f"Nearest neighbors for symptom '{symptom}':")
[0108] forj in range(k):
[0109] print(f"Nearest neighbor {j+1}: index {I[i][j]}, distance {D[i][j]}").
[0110] S302. Select the maximum similarity from all similarities, and determine the symptom corresponding to the maximum similarity as the symptom corresponding to the feature vector.
[0111] It can be understood that in order to select the feature vector that is most similar to the feature vector corresponding to the disease symptoms from the vector database, the maximum similarity can be selected from all similarities. By selecting the maximum similarity, the disease or related information that is closest to the specific symptom description can be identified, so that the patient can better understand the condition.
[0112] S104. Determine whether the score corresponding to the symptom is greater than a preset threshold.
[0113] It should be noted that in order for the symptoms of the disease to be correctly understood and matched effectively by the knowledge graph, the vector database will output the score of the symptom while outputting the symptoms, so as to judge whether the symptoms output by the vector database are valid based on the score. Therefore, in the embodiment of the present application, a threshold is set for effective judgment, that is, to judge whether the score corresponding to the symptom is greater than the preset threshold. If the score corresponding to the symptom is greater than the preset threshold, it means that the vector database is valid in outputting the symptoms, so step S105 is executed.
[0114] Optionally, the preset threshold is 0, and of course it can also be other thresholds, which can be specifically set according to requirements.
[0115] Optionally, in another embodiment of the present application, after executing step S104, the following further steps are included:
[0116] If the score corresponding to the symptom is not greater than the preset threshold, feedback information will be given to the patient.
[0117] It is understandable that when the score corresponding to the symptom is not greater than the preset threshold, it means that the vector database is invalid in outputting the symptom, and the correct matching result will not be obtained in the subsequent knowledge graph matching. Therefore, at this time, you can give feedback to the patient, and the content of the prompt message can be "The input content cannot be correctly understood, please re-enter", that is, the patient needs to re-change the description of the disease symptoms through the upload page provided by the system, and upload it again until the score corresponding to the symptom is greater than the preset threshold.
[0118] S105. Input the symptoms into a pre-built knowledge graph for matching, and obtain matching results corresponding to the symptoms.
[0119] The matching result may include the matching quantity.
[0120] Specifically, when the score corresponding to a symptom is greater than a preset threshold, it means that the symptom can be correctly matched by the knowledge graph. Therefore, a query can be constructed by using the query language of the graph database (such as SPARQL or Cypher) to obtain nodes and edges related to the symptom from the knowledge graph.
[0121] For example, Python
[0122] #Example: Assuming using Neo4j
[0123] query=f"""
[0124] MATCH(s:Symptom{{name:'{symptom}'}})
[0125] RETURN s
[0126] """
[0127] 3. Execute the query
[0128] Execute a query in the knowledge graph to obtain matching results:
[0129] Python
[0130] #Execute the query using the Neo4j Python client
[0131] results = graph.run(query)
[0132] matched_results=[result forresult inresults]
[0133] 4. Processing matching results
[0134] Process the matching results and extract relevant information (such as disease):
[0135] Python
[0136] forresult in matched_results:
[0137] print(f"Matching symptoms:{result['s'].name},Related diseases:{result['disease']}")
[0138] 5. Output the matching results.
[0139] Optionally, the present application embodiment provides a method for constructing a knowledge graph, such as Figure 4 As shown, the following steps are included:
[0140] S401. Obtain multiple outpatient medical records.
[0141] It is understandable that historical outpatient medical records can be used as the basis for constructing a knowledge graph, so multiple outpatient medical records can be obtained from the database. Among them, outpatient medical records generally contain data such as chief complaint, past history, family history, allergy history, current medical history, and diagnosis. Typical outpatient medical record content can be found in Figure 5 The content shown.
[0142] S402: For each outpatient medical record, extract the diagnosis field and medical history field of the outpatient medical record from the outpatient medical record.
[0143] Specifically, considering that not every field in the outpatient medical record corresponds to content that is suitable for constructing a knowledge graph, in order for the constructed knowledge graph to match the patient's disease, the diagnosis field and medical history field of the outpatient medical record can be extracted from the outpatient medical record, because the diagnosis field is the medical history reason diagnosed by the doctor, and the medical history field is the patient's disease information.
[0144] S403. Use the content corresponding to the diagnosis field as the disease name, and use the content corresponding to the medical history field as the symptom.
[0145] For example, according to Figure 5 The content shown is that the disease name is superficial lymphadenopathy, symptoms: superficial lymphadenopathy for 2 years, today's blood routine: white blood cells 10.12*10^9 / L, hemoglobin 152g / L, platelets 175*10^9 / L, superficial lymph node ultrasound: bilateral cervical lymph node enlargement (pointillary blood flow signals can be seen), bilateral axillary, inguinal and submental lymph nodes can be seen. Abdominal ultrasound: no abnormality was found.
[0146] S404. Input the symptoms into a pre-trained medical big model to obtain multiple symptom items corresponding to the symptoms.
[0147] It should be noted that in order to extract effective medical record information from symptoms, the symptoms can be input into a pre-trained medical big model to extract medical record information, thereby obtaining multiple symptom items corresponding to the symptoms.
[0148] For example, based on the example of step S403, if the following symptoms are input into the medical model: superficial lymph node enlargement for 2 years, today's blood routine test: white blood cell count 10.12*10^9 / L, hemoglobin 152g / L, platelet count 175*10^9 / L, superficial lymph node ultrasound: bilateral cervical lymph node enlargement (visible stippled blood flow signals), bilateral axillary, inguinal and submental lymph nodes visible, abdominal ultrasound: no abnormalities found, then the following four symptom items will be obtained: (1) superficial lymph node enlargement, (2) elevated white blood cell count, (3) bilateral cervical lymph node enlargement (visible stippled blood flow signals), and (4) bilateral axillary, inguinal and submental lymph node enlargement.
[0149] S405. Input each symptom item into a pre-trained BERT model to perform similarity calculation to obtain the similarity corresponding to each symptom item.
[0150] Specifically, after processing the symptoms to obtain multiple symptom items, considering that these symptom items may have different expressions with the same meaning, if a knowledge graph is constructed based on these symptom items, it may cause duplicate records in the knowledge graph, increase the complexity and storage requirements of the knowledge graph, and different expressions may cause ambiguity in the knowledge graph, resulting in misunderstandings during query and reasoning. At the same time, redundant and confusing information may reduce the efficiency of the reasoning algorithm and affect the response speed and accuracy of the knowledge graph.
[0151] Therefore, in order to solve the above-mentioned problem, in an embodiment of the present application, each symptom item is input into a pre-trained BERT model for similarity calculation, wherein a cosine similarity algorithm is used in the BERT model to calculate the similarity between each symptom item and output it.
[0152] S406: Filter out target similarities greater than a preset threshold from all similarities, and merge target symptom items corresponding to target similarities to obtain target symptom items.
[0153] It is understandable that in order to effectively reduce repeated and similar symptom descriptions and ensure the clarity and accuracy of knowledge, it is possible to screen out all target similarities that are greater than a preset threshold from all similarities, then classify the screened symptom items, and finally find similar symptom items from the classified symptom items and merge them.
[0154] For example, the symptom items can be abdominal pain, nausea, diarrhea, diarrhea, and stomach ache, and their corresponding similarities are 0.95, 0.8, 0.95, 0.93, and 094 respectively. At this time, the cosine similarity of the two symptoms of abdominal pain and diarrhea is 0.95, indicating that the two symptoms have almost the same meaning and can be merged, that is, one can be removed. The cosine similarities of the two symptoms of diarrhea and stomach ache are close, indicating that the two symptoms almost represent the same meaning and can also be merged, that is, one can be removed. Therefore, the target symptom items left at the end are abdominal pain, nausea, and diarrhea.
[0155] S407. Construct symptom relationships based on each target symptom item and disease name, and construct a knowledge graph based on all symptom relationships.
[0156] It can be understood that in the embodiment of the present application, the knowledge graph is constructed to include two nodes: disease and symptom, and a relationship: (has_symptom), which points from disease to symptom. At this time, it is only necessary to insert each target symptom item and disease name into the knowledge graph to form a knowledge graph network, which can be seen in Figure 6 Schematic diagram of the structure of the knowledge graph shown.
[0157] S106. Determine whether the number of matches corresponding to the symptom is greater than a preset number.
[0158] It should be noted that when it is determined that the disease symptoms entered by the patient are valid, the matched symptoms in the vector database will be sent to the knowledge graph for matching query to obtain matching results. If the amount of matched disease data is large, it needs to be fed back to the patient for further screening. Therefore, it is necessary to first determine whether the number of matches corresponding to the symptoms in the matching results is greater than the preset number. If the number of matches corresponding to the symptoms in the matching results is not greater than the preset number, it means that the disease diagnosis is completed, so step S107 is executed.
[0159] Optionally, the preset number is 3, and of course it can be other number thresholds, which can be specifically set according to needs.
[0160] Optionally, in another embodiment of the present application, after executing step S106, the following further steps are included:
[0161] If the number of matches corresponding to the symptoms is greater than the preset number, the matching results and target prompt information will be fed back to the patient.
[0162] It is understandable that when the number of matches corresponding to a symptom is greater than a preset number, it means that the patient needs to make further selections or inputs on the matching results, so the matching results and target prompt information will be fed back to the patient at this time. Among them, the target prompt information is used to prompt the patient to screen the matching results, and the matching results may also include multiple symptoms matched by the knowledge graph.
[0163] S107: Feedback the matching result to the front end.
[0164] Specifically, when the number of matches corresponding to the symptoms is not greater than a preset number, the diagnosis process can be terminated and the matching results can be fed back to the patient so that the patient can be aware of his or her own condition.
[0165] The present application provides a method for diagnosing a disease, which obtains the disease symptoms of the patient and pre-processes the disease symptoms to obtain the target disease symptoms, then inputs the target disease symptoms into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptoms, then inputs the feature vector into a pre-built vector database for symptom similarity matching, determines the symptom corresponding to the feature vector, and then determines whether the symptom score corresponding to the feature vector is greater than a preset threshold. If the score corresponding to the symptom is greater than the preset threshold, the symptom is input into a pre-built knowledge graph for matching to obtain a matching result corresponding to the symptom, wherein the matching result at least includes the number of matches, and finally determines whether the number of matches corresponding to the symptom is greater than a preset number. If the number of matches corresponding to the symptom is not greater than the preset number, the matching result is fed back to the front end. Thus, by introducing a vector database, the symptoms most similar to the patient's description can be matched therefrom, and then the matched symptoms are input into the knowledge graph for symptom matching to achieve accurate diagnosis, thereby effectively coping with the diagnosis of complex diseases.
[0166] Another embodiment of the present application provides a disease diagnosis system, such as Figure 7 As shown, it includes the following units:
[0167] The symptom acquisition unit 701 is used to acquire the patient's disease symptoms and pre-process the disease symptoms to obtain target disease symptoms.
[0168] The first input unit 702 is used to input the target disease symptoms into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptoms.
[0169] The second input unit 703 is used to input the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector.
[0170] The first judgment unit 704 is used to judge whether the score corresponding to the symptom is greater than a preset threshold.
[0171] The third input unit 705 is used to input the symptom into a pre-built knowledge graph for matching if the score corresponding to the symptom is greater than a preset threshold, and obtain a matching result corresponding to the symptom, wherein the matching result at least includes the number of matches.
[0172] The second judgment unit 706 is used to judge whether the matching number corresponding to the symptom is greater than a preset number.
[0173] The result feedback unit 707 is used to feed back the matching result to the front end if the matching number corresponding to the symptom is not greater than a preset number.
[0174] It should be noted that the specific working process of the above-mentioned units in the embodiment of the present application can refer to steps S101 to S107 in the above-mentioned method embodiment, and will not be repeated here.
[0175] Optionally, a disease diagnosis system provided in another embodiment of the present application further includes:
[0176] The medical record acquisition unit is used to acquire multiple outpatient medical records.
[0177] The field extraction unit is used to extract the diagnosis field and medical history field of the outpatient medical record from each outpatient medical record.
[0178] As a unit, it is used to use the content corresponding to the diagnosis field as the disease name and the content corresponding to the medical history field as the symptom.
[0179] The fourth input unit is used to input the symptoms into a pre-trained medical model to obtain multiple symptom items corresponding to the symptoms.
[0180] The calculation unit is used to input each symptom item into a pre-trained BERT model to perform similarity calculation to obtain the similarity corresponding to each symptom item.
[0181] The merging unit is used to filter out target similarities greater than a preset threshold from all similarities, and merge target symptom items corresponding to the target similarities to obtain target symptom items.
[0182] A construction unit is used to construct symptom relationships based on each target symptom item and disease name, and to construct a knowledge graph based on all symptom relationships.
[0183] Optionally, a disease diagnosis system provided in another embodiment of the present application further includes:
[0184] The processing unit is used to obtain multiple target symptom items and pre-process each target symptom item.
[0185] The fifth input unit is used to input each preprocessed target symptom item into a pre-trained BERT model for processing to obtain a target feature vector corresponding to each target symptom item.
[0186] The creation unit is used to select a vector database and create a vector space in the vector database.
[0187] The storage unit is used to store the target feature vector corresponding to each target symptom item in the vector space to obtain a constructed vector database.
[0188] Optionally, in a disease diagnosis system provided by another embodiment of the present application, the second input unit 703 includes:
[0189] The similarity calculation unit is used to obtain a feature vector through a pre-built vector database, and use an approximate nearest neighbor search algorithm to calculate the similarity between the feature vector and each target feature vector in the vector database.
[0190] The selection unit is used to select the maximum similarity from all similarities, and determine the symptom corresponding to the maximum similarity as the symptom corresponding to the feature vector.
[0191] Optionally, a disease diagnosis system provided in another embodiment of the present application further includes:
[0192] The first feedback unit is used to feedback prompt information to the patient if the score corresponding to the symptom is not greater than a preset threshold.
[0193] Optionally, a disease diagnosis system provided in another embodiment of the present application further includes:
[0194] The second feedback unit is used to feed back the matching result and target prompt information to the patient if the matching number corresponding to the symptom is greater than a preset number. The target prompt information is used to prompt the patient to screen the matching results.
[0195] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.
[0196] It should also be noted that the disease diagnosis system provided in the embodiment of the present application has the technical effects of any of the above embodiments, and the embodiment of the present application will not be described in detail here.
[0197] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0198] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for diagnosing a disease, characterized in that: include: Acquiring disease symptoms of the patient, and pre-processing the disease symptoms to obtain target disease symptoms; Inputting the target disease symptom into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptom; Inputting the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector; Determining whether the score corresponding to the symptom is greater than a preset threshold; If the score corresponding to the symptom is greater than a preset threshold, the symptom is input into a pre-constructed knowledge graph for matching to obtain a matching result corresponding to the symptom; wherein the matching result includes at least the number of matches; Determining whether the number of matches corresponding to the symptom is greater than a preset number; If the number of matches corresponding to the symptom is not greater than a preset number, the matching result is fed back to the front end.
2. The method according to claim 1, characterized in that The method for constructing the knowledge graph includes: Access to multiple clinic medical records; For each of the outpatient medical records, extract the diagnosis field and the medical history field of the outpatient medical record from the outpatient medical record; Using the content corresponding to the diagnosis field as the disease name, and using the content corresponding to the medical history field as the symptom; Input the symptom into a pre-trained medical model to obtain multiple symptom items corresponding to the symptom; Input each of the symptom items into a pre-trained BERT model to perform similarity calculation to obtain the similarity corresponding to each of the symptom items; Filter out target similarities greater than a preset threshold from all similarities, and merge target symptom items corresponding to the target similarities to obtain target symptom items; A symptom relationship is constructed based on each of the target symptom items and the disease name, and a knowledge graph is constructed based on all the symptom relationships.
3. The method according to claim 2, characterized in that The method for constructing the vector database comprises: Acquire a plurality of the target symptom items, and pre-process each of the target symptom items; Input each of the target symptom items after preprocessing into a pre-trained BERT model for processing to obtain a target feature vector corresponding to each of the target symptom items; Selecting a vector database and creating a vector space in the vector database; The target feature vector corresponding to each target symptom item is stored in the vector space to obtain a constructed vector database.
4. The method according to claim 1, characterized in that: The step of inputting the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector includes: Acquire a feature vector through a pre-built vector database, and use an approximate nearest neighbor search algorithm to calculate the similarity between the feature vector and each target feature vector in the vector database; The maximum similarity is selected from all similarities, and the symptom corresponding to the maximum similarity is determined as the symptom corresponding to the feature vector.
5. The method according to claim 1, characterized in that: Also includes: If the score corresponding to the symptom is not greater than a preset threshold, a prompt message is fed back to the patient.
6. The method according to claim 1, characterized in that Also includes: If the number of matches corresponding to the symptom is greater than a preset number, the matching results and target prompt information are fed back to the patient; wherein the target prompt information is used to prompt the patient to screen the matching results.
7. A disease diagnosis system, characterized in that: include: A symptom acquisition unit, used to acquire the patient's disease symptoms and pre-process the disease symptoms to obtain target disease symptoms; A first input unit, used to input the target disease symptom into a pre-trained BERT model to obtain a feature vector corresponding to the target disease symptom; A second input unit is used to input the feature vector into a pre-built vector database for symptom similarity matching to determine the symptom corresponding to the feature vector; A first judging unit, used to judge whether the score corresponding to the symptom is greater than a preset threshold; A third input unit is used to input the symptom into a pre-constructed knowledge graph for matching if the score corresponding to the symptom is greater than a preset threshold, so as to obtain a matching result corresponding to the symptom; wherein the matching result at least includes the number of matches; A second judgment unit is used to judge whether the matching number corresponding to the symptom is greater than a preset number; A result feedback unit is used to feed back the matching result to the front end if the number of matches corresponding to the symptom is not greater than a preset number.
8. The system according to claim 7, characterized in that Also includes: A medical record acquisition unit, used for acquiring multiple outpatient medical records; A field extraction unit, for extracting the diagnosis field and the medical history field of each outpatient medical record from the outpatient medical record; As a unit, used to use the content corresponding to the diagnosis field as the disease name, and the content corresponding to the medical history field as the symptom; A fourth input unit, used to input the symptom into a pre-trained medical model to obtain a plurality of symptom items corresponding to the symptom; A calculation unit, used for inputting each of the symptom items into a pre-trained BERT model to perform similarity calculation to obtain the similarity corresponding to each of the symptom items; A merging unit, used to filter out each target similarity greater than a preset threshold from all similarities, and merge the target symptom items corresponding to each target similarity to obtain each target symptom item; A construction unit is used to construct symptom relationships based on each of the target symptom items and the disease name, and to construct a knowledge graph based on all symptom relationships.
9. The system according to claim 8, characterized in that Also includes: A processing unit, used for acquiring a plurality of the target symptom items and preprocessing each of the target symptom items; A fifth input unit is used to input each of the target symptom items after preprocessing into a pre-trained BERT model for processing, so as to obtain a target feature vector corresponding to each of the target symptom items; A creating unit, used for selecting a vector database and creating a vector space in the vector database; A storage unit is used to store the target feature vector corresponding to each target symptom item in the vector space to obtain a constructed vector database.
10. The system according to claim 7, characterized in that The second input unit comprises: A similarity calculation unit, used to obtain a feature vector through a pre-built vector database, and calculate the similarity between the feature vector and each target feature vector in the vector database using an approximate nearest neighbor search algorithm; A selection unit is used to select a maximum similarity from all similarities, and determine the symptom corresponding to the maximum similarity as the symptom corresponding to the feature vector.
Citation Information
Patent Citations
Disease reasoning method, device and equipment based on knowledge graph and storage medium
CN112017740A
Primary diagnosis and treatment method for symptoms based on mapping knowledge domain
CN115083599A
Standard symptom text matching method and device, equipment and storage medium
CN116542255A
Intelligent hospital guide method and system based on deep learning and knowledge graph
CN116936058A
Symptom data processing method and apparatus, and computer device and storage medium
WO2021151328A1