A sub-specialty retrieval diagnosis and treatment auxiliary method, electronic equipment and storage medium
By performing a hybrid search combining vector retrieval and BM25 keyword retrieval within the independent knowledge index of the target department, diagnostic prompts are generated. This solves the problem of mismatch between department routing and knowledge retrieval scope in multi-department scenarios, and improves the relevance and accuracy of diagnostic results.
Patent Information
- Application Number
- CN202611341797.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-01
- Publication Date
- 2026-11-27
AI Technical Summary
In multi-departmental scenarios, when patient information involves multiple clinical dimensions, there is a continuous correlation between department identification, knowledge retrieval, and diagnosis generation. If there is a lack of correspondence between department routing and the scope of knowledge retrieval, it will affect the degree of correspondence between the retrieved evidence and the current clinical information.
By acquiring the patient's clinical information and supplementary diagnostic information, the target department is determined using departmental routing information. A hybrid search combining vector retrieval and BM25 keyword retrieval is performed in the independent knowledge index corresponding to the target department to generate diagnostic prompts. The large language model is then invoked to generate diagnostic results, integrating supplementary diagnostic information, departmental routing information, and medical evidence.
This reduces the incorporation of less relevant knowledge fragments from other departments into the diagnostic context, maintains the relevance of the medical evidence upon which the diagnosis is based, and ensures a clear correspondence between the diagnostic results and the patient's current clinical information.
Smart Images

Figure CN123182944A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical artificial intelligence and clinical decision support technology, specifically to a method for assisting diagnosis and treatment by subject retrieval, an electronic device, and a storage medium. Background Technology
[0002] In multidisciplinary settings, the scope of diseases and diagnostic criteria differ across departments, requiring a combination of patient clinical presentations to determine the appropriate range of medical knowledge.
[0003] When patient information involves multiple clinical dimensions, department identification, knowledge retrieval, and diagnosis generation are continuously linked. If there is a lack of correspondence between department routing and the scope of knowledge retrieval, knowledge from other departments may enter the diagnostic context, affecting the degree of correspondence between the retrieved evidence and the current clinical information. Therefore, it is necessary to address the problem of how to determine the target department based on patient information and obtain the corresponding medical evidence. Summary of the Invention
[0004] The purpose of this invention is to provide a method for assisting diagnosis and treatment by subject-specific retrieval, an electronic device, and a storage medium.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for assisting in diagnosis and treatment by specialty search, the method comprising: Obtain the patient's clinical information and supplemental diagnostic information; Clinical information is used as departmental routing information to determine the target department. A hybrid search of vector retrieval and BM25 keyword retrieval is performed in the independent knowledge index corresponding to the target department to obtain medical evidence. Diagnostic supplementary information, departmental routing information and medical evidence are integrated to generate diagnostic prompt information. Based on the diagnostic prompts, the large language model is invoked to generate and output diagnostic results, which include candidate diagnoses and their corresponding diagnostic criteria.
[0006] Further preferred methods include searching for medical evidence, including: Departmental routing information is converted into query vectors, and vector similarity retrieval and BM25 keyword retrieval are performed in parallel in an independent knowledge index. The two sets of retrieval scores are normalized and weighted to obtain a mixed score. The mixed scores are sorted and a preset number of knowledge fragments are extracted as medical evidence.
[0007] In a further preferred embodiment, diagnostic prompts are used to instruct the large language model to generate candidate diagnoses, and to generate diagnostic criteria and suggestions for further examination for each candidate diagnosis.
[0008] In a further preferred embodiment, when the department routing information does not match the department keywords in the department registry, the department selection information is output, and the received department selection result is determined as the target department.
[0009] In a further preferred embodiment, the department routing information includes the chief complaint and symptoms, and the target department is determined by matching the department registration form with the department routing information.
[0010] Further preferred diagnostic supplementary information includes laboratory tests, imaging results, and past medical history.
[0011] Further preferred medical evidence includes knowledge fragments from clinical guidelines and medical literature, with each knowledge fragment associated with its source document and location.
[0012] In a further preferred embodiment, before retrieving medical evidence, the system receives imported medical knowledge, processes the medical knowledge to obtain knowledge fragments and vectors, and writes the obtained knowledge fragments and vectors into the independent knowledge index of the corresponding department.
[0013] The technical effects and advantages provided by the present invention in the above technical solution are as follows: Compared to diagnostic aids that directly retrieve medical information without specifying the departmental knowledge scope, this application first obtains the patient's clinical information, then uses this clinical information as departmental routing information to determine the target department. Next, a hybrid search combining vector retrieval and BM25 keyword retrieval is performed in the independent knowledge index corresponding to the target department to obtain medical evidence. Then, the clinical information, departmental routing information, and medical evidence are fused to form diagnostic suggestions. Finally, a large language model is invoked to generate and output the diagnostic results. Because the scope of medical evidence retrieval is determined by the target department, a clear departmental correspondence is established between the knowledge content used for diagnostic generation and the patient's current clinical information. This reduces the entry of knowledge fragments with low relevance to other departments into the diagnostic context, which helps maintain the relevance of the medical evidence upon which subsequent diagnostic generation is based. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0015] Figure 1 This is a schematic diagram of the procedure for the subject-specific retrieval and diagnosis assistance method in this invention.
[0016] Figure 2 This is a schematic diagram of the structured differential diagnosis patient information input interface in this invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0019] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0020] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0021] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0022] Example 1 This embodiment provides a method for assisting in diagnosis and treatment by categorizing information by department. This method can be executed by an electronic device with data processing capabilities, or by a server and a terminal working together. For ease of explanation, this embodiment distinguishes the information used by patients during the diagnostic and treatment assistance process into clinical information and supplementary diagnostic information. Clinical information primarily characterizes the patient's current complaint and symptoms, while supplementary diagnostic information primarily characterizes laboratory test results, imaging findings, and past medical history. The complaint may include the main discomfort and its duration; symptoms can be selected from a preset symptom list or input by the user using natural language; past medical history may include disease history, surgical history, medication history, and allergy history. Clinical information and supplementary diagnostic information together form a patient information set used for subsequent diagnostic processing.
[0023] Specifically, patient information can be entered item by item through a front-end form, or retrieved by an authorized electronic medical record interface according to preset fields. Chief complaint, symptoms, laboratory tests, imaging results, and past medical history are stored in separate fields, and the content of each field comes from the user's actual input or the original records that have been accessed; items that are not obtained are marked as "not provided," and missing values should not be automatically interpreted as normal examination, absence of symptoms, or negative medical history.
[0024] When generating departmental routing information, only the chief complaint and symptom fields are extracted. Synonyms, separators, and repetitive expressions are standardized, while negative words, location, duration, and severity information are retained. Laboratory tests, imaging results, past medical history, and other auxiliary examination information are retained in the diagnostic supplementary information. These are then incorporated into the diagnostic suggestion information construction after the target department is determined, thus clarifying the data source and processing sequence for departmental selection and subsequent diagnostic supplementation.
[0025] like Figure 1 As shown, the method in this embodiment includes: obtaining the patient's clinical information and supplementary diagnostic information; using the clinical information as departmental routing information to determine the target department, and performing a hybrid search of vector retrieval and BM25 keyword retrieval in the independent knowledge index corresponding to the target department to obtain medical evidence; integrating the supplementary diagnostic information, departmental routing information, and medical evidence to generate diagnostic prompt information; and calling a large language model based on the diagnostic prompt information to generate and output diagnostic results, wherein the diagnostic results include candidate diagnoses and corresponding diagnostic criteria.
[0026] The department routing information is used to limit the scope of departments corresponding to this medical knowledge retrieval. In one implementation, the chief complaint and symptoms are read from clinical information. The text of disease name, organ name, symptom name, symptom location, and duration in the chief complaint and symptoms is standardized, and the standardized text is matched with department keywords configured in the department registry. The department registry is used to maintain the association between the department identifier, department name, matching keywords, and corresponding independent knowledge index of each clinical department. The system can set up 41 clinical departments and classify them according to 7 major systems. Each department shares the same retrieval and generation processing framework, while maintaining its own independent knowledge index.
[0027] As a directly implementable configuration method, each record in the department registry includes a department identifier, department name, set of department keywords, independent knowledge index identifier, and index availability status; the department identifier and independent knowledge index identifier are pre-established with a correspondence. Department keywords are configured from existing department names, related organ names, common chief complaints, and symptom names. Medical synonyms are merged into the same standard term through a preset thesaurus. The registry configuration content is entered and saved by system maintenance personnel.
[0028] The standardized department routing information is divided into m valid terms, and the matching score for the d-th department is calculated as: R d =[∑ j=1 m w j ·I(t) j ∈A d )] / [∑ j=1 m w j Where d is the department number currently participating in the matching in the department registry, m is the number of valid terms extracted from the chief complaint and symptoms, and t is the number of valid terms extracted from the chief complaint and symptoms. j For the j-th valid term, A d The pre-configured set of department keywords for the d-th department, w j I is the matching weight of the j-th valid term, and I(·) is the indicator function, which takes the value 1 when the term belongs to the corresponding keyword set, and 0 otherwise.
[0029] The above m and t j A was obtained by segmenting and standardizing synonyms based on the current patient's chief complaints and symptoms. d Read from the department registry, w j The keyword configuration is provided by the department or the system default rules, and w j >0; When no differentiated weights are configured, each w j The value is uniformly set to 1. R is calculated only when m > 0 and the denominator is greater than 0. d Therefore, 0 ≤ R d ≤1; When both the chief complaint and symptoms are empty, prompt for supplementary information or output department selection information, instead of performing division on the empty term set.
[0030] When a unique, highest-scoring, and greater-than-zero available department exists, that department is designated as the target department. If multiple departments have the same highest score, or if the matching results are insufficient to distinguish the target department, the corresponding candidate departments are displayed to the user for confirmation. When all department scores are 0, department selection information is output. For example, if three valid terms all match in the cardiovascular medicine keyword set and only one match in the keyword set of another department, and each term has a weight of 1, then the matching scores for the two departments are 1 and 1 / 3, respectively, and cardiovascular medicine is selected accordingly.
[0031] For example, a patient enters their chief complaint as "chest tightness and shortness of breath for 3 days," with symptoms including "chest tightness, shortness of breath, and worsening after activity." The system can obtain departmental routing information such as "chest tightness," "shortness of breath," and "worsening after activity" from the chief complaint and symptoms, and use this information to match the departmental registry. When the matching result points to cardiology, cardiology is identified as the target department, and the subsequent search for medical evidence is limited to the independent knowledge index corresponding to cardiology. Information such as blood pressure, heart rate, electrocardiogram results, and history of hypertension entered by the patient is retained as supplementary diagnostic information and participates in the construction of diagnostic prompts after the target department is determined.
[0032] Once the target department is determined, the system reads the independent knowledge index corresponding to that department. This independent knowledge index stores clinical guidelines, medical literature, and knowledge fragments derived from the corresponding documents related to that department. Each knowledge fragment can simultaneously store text content, vectors, source document identifiers, and its position within the source document. By maintaining separate knowledge indexes for each department, the same diagnostic and treatment support program can select the appropriate knowledge range based on departmental routing results, eliminating the need to add medical knowledge from all departments to the candidate set for each search.
[0033] Independent knowledge indexes can be implemented by setting up separate data files, index sets, or logical namespaces for each department. Each knowledge record in the index must store at least the department identifier, knowledge fragment identifier, fragment text, fragment vector, source document identifier, and source location; the vector model identifier, vector dimension, and index version can also be stored as index metadata. The knowledge fragment identifier is formed by the document identifier and fragment number at the time of import, and the source location is obtained from the page number, paragraph number, or character range during text extraction or chunking.
[0034] The backend queries the department registry based on the target department identifier, opens only the independent knowledge index associated with that identifier, and verifies that the department identifier in the index metadata matches the target department identifier. If the target department index does not exist, is not loaded, has no available knowledge fragments, or the department identifier is inconsistent, it returns a message indicating that the index is unavailable or the evidence is insufficient, and the user must reselect a department with an available index; it does not automatically switch to a combined search of all departments, nor does it mix fragments from other departments into the current candidate set.
[0035] After retrieving medical evidence, the departmental routing information, supplementary diagnostic information, and medical evidence are organized into diagnostic prompts according to a predetermined prompt template. The diagnostic prompts can be divided into a patient information area, a medical evidence area, and an output requirement area. The patient information area records the chief complaint, symptoms, laboratory tests, imaging results, and past medical history; the medical evidence area records relevant guideline excerpts or literature excerpts retrieved from the target department's independent knowledge index; the output requirement area instructs the large language model to generate candidate diagnoses and the corresponding diagnostic criteria for each candidate diagnose, and can further provide diseases requiring differentiation, key differentiation points, and suggested further examinations.
[0036] To ensure a defined data correspondence during the fusion process, a structured prompt template can be constructed according to a fixed sequence: "Target Department—Department Routing Information—Supplementary Diagnostic Information—Medical Evidence—Output Requirements." The department routing information retains the original chief complaint and symptoms. Supplementary diagnostic information is listed separately for laboratory tests, imaging results, past medical history, and other auxiliary examinations. Each piece of medical evidence includes a knowledge fragment identifier, the fragment text, the source document identifier, and the source location. Empty fields are clearly marked "Not Provided," and the actual patient examination results are not supplemented based on the medical evidence.
[0037] The output requirements instruct the large language model to return the candidate diagnosis name, patient information, medical evidence identifiers, and suggested further checks for each candidate diagnosis. The model's returned results are parsed by the backend, which checks whether the cited medical evidence identifiers belong to the knowledge fragment set retrieved for the target department and whether the patient information exists in the input field. Content that cannot be mapped to the current patient information or the current evidence set is marked as insufficient evidence and is not output as verified diagnostic evidence.
[0038] In one exemplary implementation, the diagnostic prompt information also includes evidence constraint information to instruct the large language model to prioritize responses based on the provided medical evidence. When the retrieved medical evidence lacks content directly related to the current question, the prompt information can request the large language model to explicitly acknowledge the lack of current knowledge context, rather than using medical knowledge with low relevance to the current patient information as a definitive basis. This approach ensures a clear data connection between the generated content and the medical evidence obtained in this retrieval.
[0039] When the target department index is empty, the query vector cannot be generated, the vector dimensions are inconsistent, or no usable medical evidence is obtained, the backend returns the message "The current department knowledge context is insufficient. Please supplement patient information, select an available department, or update the corresponding knowledge base." In this case, guideline content that has not been retrieved is not considered as obtained evidence, nor is unverified content generated within the large language model labeled as a definitive diagnostic conclusion with a clear literature source.
[0040] After receiving diagnostic prompts, the large language model generates a diagnostic result. The result includes at least candidate diagnoses and their corresponding diagnostic criteria, and may also include key differentiating factors and recommendations for further examination if necessary. The system returns the diagnostic result to the front end for display, along with the supporting medical evidence. The diagnostic result is considered auxiliary diagnostic information, and the front end may simultaneously display a message stating, "The diagnostic suggestions provided by this system are for reference only and cannot replace professional medical diagnosis."
[0041] Through the above processing, patient clinical information is first used to determine the scope of departmental knowledge. Once the target department is determined, medical evidence is retrieved from the corresponding independent knowledge index, and supplementary diagnostic information is used together with this medical evidence to generate diagnostic suggestions. Thus, a continuous data correspondence is formed between patient information, departmental scope, and medical evidence. This helps reduce the incorporation of less relevant knowledge fragments from other departments into the current diagnostic context, while preserving the reference value of laboratory tests, imaging results, and past medical history for judging candidate diagnoses.
[0042] Example 2 This embodiment, based on Embodiment 1, further explains the medical evidence retrieval, department matching, diagnostic prompt information generation, and evidence source association methods. Here, RAG stands for Retrieval-Augmented Generation, which refers to a processing method that first retrieves knowledge fragments relevant to the current input from the medical knowledge index, and then provides these knowledge fragments as context to the large language model.
[0043] In one exemplary implementation, medical evidence retrieval employs a hybrid retrieval method that combines vector retrieval and BM25 keyword retrieval in parallel, and outputs the results after being rearranged according to medical rules. The hybrid retrieval takes into account both semantic relevance and literal keyword matching, while the medical rule rearrangement further adjusts the ranking based on the metadata of the knowledge fragments and their relevance to the query.
[0044] Specifically, after receiving the department routing information, the backend simultaneously invokes a vector embedding model and the BM25 index to perform a search within the target department's independent knowledge index. The vector embedding model uses embedding-2 to convert the department routing information into a query vector; the BM25 index calculates keyword matching scores based on the term frequency and inverse document frequency of the medical knowledge fragment text. Both search methods retrieve the top N candidate results from the index, where N is an integer greater than or equal to a preset number K.
[0045] For candidate results returned by vector retrieval, min-max normalization is performed based on the cosine similarity score to obtain the normalized vector score for each candidate. For candidate results returned by BM25 retrieval, min-max normalization is performed based on the BM25 score to obtain the normalized BM25 score for each candidate. For candidates that appear only in one retrieval method, their missing score in the other retrieval method is set to 0 before being included in subsequent fusion.
[0046] Let v_i be the normalized vector score of the i-th knowledge fragment, b_i be the normalized BM25 score of the i-th knowledge fragment, wv be the vector retrieval weight, and wb be the BM25 weight. Then the mixed score h_i of the i-th knowledge fragment is h_i = wv·v_i + wb·b_i. As an feasible configuration, wv is set to 0.55, and wb is set to 0.45; all weights are greater than 0 and wv + wb = 1, to ensure that both retrieval methods contribute to the final ranking.
[0047] After sorting candidate knowledge fragments by their mixed scores from highest to lowest, a medical rule re-ranking model is invoked to further adjust the scores. Medical rule re-ranking includes: calculating the hit rate of query terms in the knowledge fragment text and applying a bonus accordingly; applying a synonym bonus when both the query and the knowledge fragment text hit any term in a preset medical synonym group; applying a topic bonus when the disease topic labeled in the knowledge fragment matches the query intent; applying a metadata bonus when the knowledge fragment has an A or B level of evidence, a strong recommendation level, or a publication year no earlier than a preset threshold; and applying a table content bonus when the query contains dosage-related terms and the knowledge fragment is presented in tabular form.
[0048] After the medical rules are rearranged, a predetermined number K knowledge fragments are extracted as medical evidence based on the rearrangement scores, from highest to lowest. A maximum of a predetermined number of documents from the same source are retained in the final medical evidence to avoid excessive concentration from a single source. The final medical evidence carries metadata such as source document identifier, source location, chapter path, evidence level, recommendation level, and year, used to construct traceable diagnostic prompts.
[0049] In one exemplary implementation, the vector retrieval branch in the hybrid retrieval includes: converting departmental routing information into query vectors, calculating the similarity between the query vectors and each knowledge fragment vector in an independent knowledge index, and obtaining candidate knowledge fragments for the vector retrieval branch.
[0050] Specifically, after receiving the department routing information, the backend can call a vector embedding model to convert the text-based department routing information into query vectors. One possible implementation is to use the embedding-2 model to generate vector embeddings. Vectors of each knowledge fragment are pre-stored in the independent knowledge index corresponding to the target department. Therefore, the cosine similarity between the query vector and each knowledge fragment vector can be calculated, and the results can be sorted from high to low similarity to obtain the top N candidate results for the vector retrieval branch. This candidate set can be denoted as the Top-K retrieval results, and the preset number K can be configured according to the knowledge base size and the contextual hints capacity. In a specific example, K is set to 5, meaning that the top 5 knowledge fragments in the similarity ranking are selected as candidate results for the vector retrieval branch.
[0051] Let E(·) be the text vector embedding model used to construct the target department knowledge index, T be the department routing text formed by standardizing the chief complaint and symptoms and concatenating them in a preset order, and C be the text of the department route. d,i For the i-th knowledge fragment in the target department d, the query vector q = E(T) and the knowledge fragment vector v d,i =E(C) d,i Both query vectors and knowledge fragment vectors are obtained from the same model identifier, the same model version, and the same vectorization configuration, and have the same vector dimension n.
[0052] The cosine similarity between the query vector and the knowledge fragment vector can be expressed as: s d,i =[∑ k=1 n q k v d,i,k ] / [√(∑ k=1 n q k 2 )·√(∑ k=1 n v d,i,k 2 [ ] . Among them, s d,i To query the cosine similarity between a vector and the i-th knowledge fragment vector of the target department, where i is the knowledge fragment index of the department, k is the vector component index, n is the total number of components output by the vector embedding model, and q... k For the k-th component of the query vector, v d,i,k It is the k-th component of the i-th knowledge fragment vector.
[0053] q in the formula k By inputting the current department's route text into a configured vector embedding model, v d,i,kAfter importing medical documents and completing text segmentation, the corresponding segments are processed using the same vector embedding model to obtain n, which is obtained by reading the actual output length of the model and the target department index metadata; d is obtained from the department routing result or user confirmation result; and i is determined by the knowledge record order or segment identifier in the target department index, without relying on undisclosed manually estimated parameters.
[0054] Before calculation, check that the model identifier, model version, and dimensions of the query vector and the fragment vector are consistent, and check that each vector component has a finite value. Cosine similarity is calculated only when the norms of both vectors are greater than 0, in which case -1 ≤ s. d,i ≤1; In the event of a zero vector, invalid component, inconsistent model version, or different vector dimension, regenerate the vector for the corresponding text or mark the record as unavailable, do not perform operations with a denominator of 0, and do not directly compare vectors in different vector spaces.
[0055] Let Nd be the number of usable knowledge fragments in the target department index that have passed the above verification, and K be the pre-set planned number of retrievals. Then, the actual number of extracted records Keff = min(K, Nd). Here, Nd is obtained by counting the valid records in the current target department index, and K is an integer greater than 0, determined by the system configuration and the allowed context length and individual knowledge fragment length of the model. In the original example, K = 5, when Nd = 3, only 3 usable candidate results are returned, and when Nd = 0, an insufficient evidence prompt is returned.
[0056] For Nd valid knowledge fragments, sort them from largest to smallest by sd,i. If the similarity is the same, sort them by knowledge fragment identifier to obtain repeatable sorting results. Extract the top N results as candidate results for the vector retrieval branch. For ease of illustration, if the illustrative three-dimensional query vector is (1,1,0), and two knowledge fragment vectors of the same dimension are (1,1,0) and (1,0,1), then the corresponding cosine similarities are 1 and 0.5, respectively, with the former knowledge fragment ranking higher than the latter. The actual vector dimension is still based on the output of the embedding model used.
[0057] When vectorizing departmental routing information, the chief complaint and symptoms can be concatenated into the search text in a fixed order, or duplicate symptoms, meaningless symbols, and blank characters can be cleaned up before generating the query vector. For example, if a patient's chief complaint is "acute exacerbation of COPD," and the symptoms include "increased sputum volume, purulent sputum, and worsening dyspnea," the search text can be formed by combining the above information. The purpose of vectorization is to enable the patient's description in natural language form to be compared for similarity with vectorized clinical guidelines or medical literature knowledge fragments in an independent knowledge index.
[0058] In one exemplary implementation, the department routing information includes the chief complaint and symptoms. The target department is determined by matching the department routing information against a department registry. Each department in the registry records symptom keywords or semantic tags related to that department. When the chief complaint or symptoms match one or more department keywords, candidate departments can be determined based on the match, and then the target department is selected according to the degree of matching. When multiple matching results exist, the front end can display the candidate departments for the user to confirm.
[0059] Department keyword matching and knowledge fragment similarity retrieval are two interconnected processes that deal with different objects: the former uses the chief complaint and symptoms to match the department registry to determine the target department identifier, while the latter uses the same department routing information within the already determined target department index to form a query vector to determine medical evidence. Supplemental diagnostic information does not replace the department routing information before the target department is determined; after the target department is determined, it is entered into the diagnostic suggestion template along with the retrieved medical evidence.
[0060] When the department routing information does not match the department keywords in the department registry, the system outputs department selection information and identifies the received department selection result as the target department. The department selection information may include department categories and a list of department names. After the user selects a department from the list, the system reads the corresponding department identifier and locates the corresponding independent knowledge index based on the identifier. This process can be used when patient descriptions are limited, symptom expression is atypical, or the department registry has not yet configured the corresponding keywords.
[0061] When outputting department selection information for user confirmation, only departments that have been registered in the department registry and whose corresponding independent knowledge indexes are available are listed. The backend performs another validation of the legality and index correspondence of the received department identifiers. If no valid selection is received, the system remains in a pending state and does not access the default index based on an empty department identifier, thus providing a clear follow-up processing path for both no-match and multi-department matching scenarios.
[0062] In the knowledge-based question-and-answer mode, users can also directly select a department and enter a medical question. The front-end sends the department identifier and medical question to the back-end's ` / api / chat` endpoint via a POST request. The back-end calls the embedding-2 model to convert the medical question into a vector embedding and performs a hybrid search of vector retrieval and BM25 keyword retrieval in the independent knowledge index corresponding to the selected department, which is serialized and saved in Pickle format. Taking K equals 5 as an example, the back-end obtains five highly relevant knowledge fragments after sorting by mixed scores and rearranging according to medical rules. These knowledge fragments are used as the search context to construct the prompt word together with the medical question.
[0063] Prompts can include the current department, user question, search context, and answer rules. Answer rules can require the large language model to answer the question based on the provided search context, and explicitly state that the current search results are insufficient if relevant information is not found in the context. As a specific implementation, the large language model can use GLM-4-Plus. After the model generates the answer, SSE (Server-Sent Events) can be used. The server sends events, continuously pushing the generated content to the front end according to the event flow, allowing the front end to gradually display the returned content before the model has completed generating all the text.
[0064] Medical evidence includes knowledge fragments from clinical guidelines and medical literature, each fragment associated with its source document and location. When constructing a model to provide an answer, the system saves the correspondence between the cited knowledge fragments and their source information, and displays the source document name, document identifier, or location within the document as citation information when outputting the answer or diagnosis. This allows users to trace the source of the knowledge fragments generated from the generated content, without needing to rely solely on the output text of a large language model to determine the source.
[0065] The source document identifier is generated during the import of medical knowledge and is saved along with the document name, import source, and corresponding department identifier. The source location is recorded during document text extraction and segmentation. For documents with page numbers, the page number and the start and end positions of the segment are saved; for web pages or plain text without fixed page numbers, the paragraph number or the start and end positions of characters are saved. The knowledge segment identifier associates the segment text, segment vector, and the aforementioned source metadata into the same index record.
[0066] During retrieval, the backend simultaneously retrieves the knowledge fragment identifier, the main text, and the source metadata, and establishes a correspondence of "candidate diagnosis - diagnostic basis - knowledge fragment identifier - source document and location" for the current request. In the output stage, the system retrieves the current search records based on the knowledge fragment identifier returned by the model and displays the document name and corresponding location; fragment identifiers not included in the current search set are not used as reference sources, thereby ensuring that the diagnostic basis can be traced back to the specific knowledge fragment in the target department.
[0067] Taking a respiratory medicine knowledge Q&A platform as an example, a user selects respiratory medicine on the front end and enters "What are the indications for antibiotic use in acute exacerbations of COPD?". The system converts the question into a query vector and retrieves relevant knowledge fragments from the independent knowledge index for respiratory medicine. In a specific example, the search results include five relevant fragments from the GOLD guidelines and the guidelines of the Chinese Society of Respiratory Diseases. The system combines these guideline fragments with the user's question to construct prompts and calls GLM-4-Plus to generate an answer. The answer can list reference information on antibiotic use related to clinical manifestations such as increased sputum volume, purulent sputum, and worsening dyspnea, while also linking the source of the corresponding knowledge fragment.
[0068] In this example, the front-end displays the answer in a streaming manner, with a list of cited sources shown below the answer text; for example, it can display three cited sources actually used in the answer content. Streaming output only changes the timing of content arrival at the front-end, without altering the correspondence between medical evidence and generated content. By limiting the search scope to the target department, using highly similar knowledge fragments as context, and retaining source information, the materials upon which medical question-and-answer or diagnosis is based can have a clearer search path and source.
[0069] Example 3 This embodiment, based on the aforementioned embodiments, illustrates the process of structured differential diagnosis and individualized treatment plan recommendation.
[0070] like Figure 2 As shown, in the structured differential diagnosis mode, the front end provides a five-dimensional structured information input area. The five dimensions are: chief complaint, used to record the patient's main symptoms and duration; symptoms, used to select from a preset symptom list or by user-defined input; laboratory tests, used to record laboratory test results; imaging results, used to record imaging or other auxiliary examination results; and past medical history, used to record medical history, surgical history, medication history, and allergy history. The chief complaint and symptoms constitute clinical information and are used for departmental routing, while laboratory tests, imaging results, and past medical history constitute supplementary diagnostic information.
[0071] It should be noted that blood pressure and heart rate are vital signs or physical examination information, not laboratory test results; electrocardiogram (ECG) is electrophysiological or other auxiliary examination information, not imaging examination results. The front-end can set extended fields for vital signs and other auxiliary examinations outside the existing five-dimensional input areas, or set independent subfields for them in the diagnostic supplementary information; these extended fields, like laboratory tests, imaging results, and past medical history, are used to supplement the diagnosis, but must not be misclassified.
[0072] For example, blood pressure is recorded in systolic / diastolic pressure and millimeters of mercury, heart rate is recorded in beats per minute, and electrocardiogram results are recorded according to the actual report text; blood routine tests, biochemical tests, or myocardial marker tests are recorded in the laboratory test field, and ultrasound, CT, or MRI results are recorded in the imaging results field. The system retains the correspondence between each test type, value, and unit and the original input, and does not generate test indicators that are not provided out of thin air.
[0073] The system reads keywords from the chief complaint and symptoms and matches them with the department registry to automatically detect the corresponding department. When no available matching results are found, the front end prompts the user to manually select a department. Once the target department is determined, the system performs enhanced search generation processing in the independent knowledge index corresponding to that department to obtain clinical guidelines and medical literature knowledge fragments related to the patient's symptoms.
[0074] After completing the medical evidence retrieval, the patient's five-dimensional structured information is integrated with the retrieval results to form differential diagnosis suggestions. These suggestions can instruct the large language model to generate a list of possible diagnoses in a structured format, providing diagnostic justification for each candidate diagnosis. Simultaneously, they can generate diseases requiring further differentiation and key differentiation points, along with suggested further examinations. The model returns the generated results as structured data to the front end, which can then use a card-based layout to present different candidate diagnoses, diagnostic justifications, key differentiation points, and further examination information.
[0075] In the structured results, each candidate diagnosis is associated with at least one patient information reference and a corresponding medical evidence identifier; suggested further examinations are listed separately as information to be completed and cannot be mixed with the already obtained examination results. For past medical history, vital signs, or electrocardiogram findings, only the corresponding fields actually entered by the user can be referenced; for guideline applicability conditions, only the knowledge fragments of the target department obtained in this search can be referenced.
[0076] Taking differential diagnosis in cardiology as an example, the patient inputs the chief complaint "chest tightness and shortness of breath for 3 days," symptoms "chest tightness, shortness of breath, worsening after activity," vital signs record "blood pressure 150 / 95 mmHg, heart rate 92 bpm," electrocardiogram (ECG) result record "ST segment depression," and past medical history record "hypertension for 5 years." The system matches the department registry based on the chief complaint and symptoms such as "chest tightness," "shortness of breath," and "worsening after activity," identifying cardiology as the target department. Blood pressure, heart rate, ECG results, and history of hypertension continue to serve as supplementary diagnostic information in the construction of subsequent diagnostic prompts.
[0077] Subsequently, the system retrieves relevant clinical guidelines or medical literature excerpts related to coronary artery disease and heart failure from the independent knowledge index of cardiovascular medicine, and combines this medical evidence with the five-dimensional patient information. In a specific example, the candidate diagnoses generated by the large language model may include unstable angina, acute heart failure, and hypertensive heart disease; for each candidate diagnosis, the system provides diagnostic criteria and differential diagnosis points corresponding to the patient's current information, and may suggest further examinations of troponin and BNP. The above candidate diagnoses are only used to illustrate the system's data processing and output format and do not constitute a determination of the specific patient's disease status.
[0078] In this example, troponin and BNP are only suggested laboratory tests for further investigation. They should not be described as elevated or decreased before the actual test results are entered into the system. Chest tightness, shortness of breath, worsening after activity, blood pressure, heart rate, electrocardiogram findings, and history of hypertension retain their original field attributes. Candidate diagnoses and ranking results are only auxiliary suggestions based on the entered information and retrieved evidence.
[0079] After the diagnosis results are generated, the front end can continuously display a disclaimer below the results area stating "The diagnostic suggestions provided by this system are for reference only and cannot replace professional medical diagnosis" to distinguish between auxiliary diagnostic information and professional medical diagnosis.
[0080] In one exemplary implementation, the system can also proceed to the treatment plan recommendation process after the user confirms the diagnosis based on the differential diagnosis results. The system receives individual patient information, which may include age, gender, weight, comorbidities, and allergy history; based on the confirmed diagnosis and target department, it retrieves relevant treatment guidelines and research evidence from the corresponding department's independent knowledge index; and then integrates the diagnostic results, individual patient information, and retrieved evidence to form treatment plan suggestion information.
[0081] Treatment plan suggestions can be used to instruct the large language model to generate first-line treatment plans, alternative treatment plans, medication recommendations, non-pharmacological treatment recommendations, and follow-up plans. Medication recommendations may include dosage, treatment duration, and precautions. When the system outputs treatment plan suggestions, it simultaneously displays the clinical guidelines and medical literature sources used, ensuring that the treatment plan recommendations are linked to the corresponding search evidence. Treatment plan recommendations can reuse the aforementioned knowledge index of the target department, thereby maintaining consistency in the scope of departmental knowledge used in the diagnostic and treatment phases.
[0082] Through a five-dimensional structured input, information used for departmental routing and information used for diagnostic supplementation can be organized separately, and then combined during the diagnostic suggestion information formation stage. This data processing method establishes a clear data connection between departmental identification, medical evidence retrieval, complete patient information fusion, and diagnostic result generation, facilitating the selection of the appropriate knowledge scope based on the patient's current clinical presentation in multi-departmental scenarios.
[0083] Example 4 This embodiment describes the establishment and updating of independent knowledge indexes and the unified operation architecture across multiple departments. Before retrieving medical evidence, imported medical knowledge is received, processed to obtain knowledge fragments and vectors, and then written into the independent knowledge index of the corresponding department.
[0084] Medical knowledge can enter the knowledge base processing flow through three methods: document upload, URL webpage import, and direct text input. Document uploads support PDF, Word, Markdown, and plain text formats; for document uploads, the system identifies the file format and extracts the main text. For URL webpage imports, the system obtains the webpage content and extracts the main text. For direct text input, the system directly uses the input text as the content to be processed. All text from these different sources undergo the same cleaning and segmentation process before vectorization.
[0085] When importing medical knowledge, the target department is first specified, and the system verifies that the department already exists in the department registry and has a corresponding independent knowledge index. The system assigns a document identifier to the source document, records the document name, import method, and department identifier, and then extracts the main text from the document, webpage, or directly entered text. Data that cannot be parsed, has empty main text, or does not specify a valid department is not written into the index to avoid uncertainty about the source and department.
[0086] Text cleaning can include removing meaningless whitespace, duplicate content in headers and footers, and control characters that do not form medical semantics. The cleaned text is then chunked according to continuous semantic ranges. In one implementation, each text chunk is approximately 500 to 1000 characters in size, with adjacent chunks overlapping by about 100 characters. Setting overlapping regions allows sentences or medical semantics that cross chunk boundaries to retain some context within adjacent knowledge segments.
[0087] The total number of characters in the cleaned document is denoted as L. doc Let L be the maximum number of characters in a single knowledge fragment, and O be the number of overlapping characters between adjacent fragments. Then, the block movement step size Δ = L - O, where L > 0 and 0 ≤ O < L. The starting character position b of the i-th fragment... i = (i-1)·Δ, end character position e i =min(b) i +L,L doc When the end position of a certain segment reaches L); doc Stop further segmentation when the time comes.
[0088] The above L doc The data is obtained from the actual extracted and cleaned document text. L and O are provided by the knowledge base management configuration. i starts from 1 and increments in the order of generation. i and e i It is calculated from the document character position. For example, when L is 800 characters and O is 100 characters, Δ is 700 characters, and adjacent segments retain 100 characters of overlap; L can be selected from 500 to 1000 characters according to the original configuration, and O can be 100 characters, but O must always be satisfied < L to avoid step size of 0 or negative number.
[0089] When segmenting, prioritize adjusting segment boundaries at periods, paragraph boundaries, or locations where medical semantics remain intact, and simultaneously record the original page number, paragraph number, and character position for each segment. Maintain the original correspondence for negation words, drug contraindications, units, numerical ranges, and conditional qualifiers to avoid cleaning or segmentation that alters the actual meaning of medical knowledge segments.
[0090] After segmentation, the embedding-2 model is used to generate vector embeddings for each text block. The vector embeddings, corresponding text blocks, and source document information are then saved together in an independent vector index serialized in Pickle format for each department. Each department maintains an independent vector index. The independent knowledge index is not limited to Pickle format; other data storage methods capable of storing knowledge fragments and vector mapping relationships can also be used while ensuring that knowledge data in each department can be independently located and retrieved.
[0091] It's important to note that Pickle is an object serialization format, not an independent vector database or similarity retrieval algorithm. When using Pickle, a list of knowledge fragments for a specific department, its corresponding vector array, source metadata, vector model identifier, and vector dimensions can be serialized and saved as a data file for that department. During retrieval, the backend loads the department file, calculates and sorts it in memory according to the cosine similarity formula, or writes similar data into a dedicated index component with vector retrieval capabilities.
[0092] Before writing each knowledge record, check that the fragment department identifier matches the target index department identifier, and confirm that the model identifier, model version, and dimensions of the generated fragment vector are consistent with the current index configuration. When medical knowledge is added, deleted, or re-imported, only the data file or index set of the corresponding department is updated, and the index version in the department registry is updated after the new version passes the record integrity check; already started search requests continue to use the index version they read, preventing the mixing of different versions of data in the same search.
[0093] Taking the construction of a gastroenterology knowledge base as an example, a user uploads a 200-page PDF document titled "Guidelines for the Diagnosis and Treatment of Digestive System Diseases." After the system extracts the document text and performs cleaning and segmentation, approximately 300 text blocks are obtained. Subsequently, the embedding-2 model is used to generate approximately 300 vector embeddings, and the text blocks, vectors, and source information are written into a separate knowledge index corresponding to gastroenterology. Afterward, when the target department is determined to be gastroenterology, the search operation only needs to access this separate knowledge index.
[0094] The aforementioned 200-page document and approximately 300 text blocks are merely illustrative examples. The actual number of knowledge fragments is determined by the total number of characters extracted from the document, the block length, and the overlap length. The actual number of fragments is based on the block results and is not directly estimated from the number of pages.
[0095] When operating across multiple departments, 41 clinical departments can be configured with corresponding departmental registration information and independent vector indexes according to the seven major systems, sharing a unified retrieval and generation processing logic. When adding a new department, the corresponding departmental identifier, keywords, and knowledge index association information can be added to the departmental registration form, and the department's independent knowledge index can be loaded, without changing the common processing flow for knowledge question answering, differential diagnosis, and treatment plan generation. This approach enables a hot-swappable departmental expansion process, allowing new departments to primarily access the existing processing framework through registration information and knowledge indexes.
[0096] When adding a new department, first establish the department's identifier, name, and keyword set, then create an independent knowledge index corresponding to the department's identifier and write medical knowledge fragments with clear sources. Only after completing the model identifier, vector dimension, and index availability checks are completed is the department allowed to participate in automatic routing or manual selection by the user. Even if different departments use the same vector embedding model, they still save the index identifier and the identifier of the department to maintain the isolation of the search scope.
[0097] In terms of software architecture, the diagnostic and treatment assistance system can be divided into a user interaction layer, a business logic layer, and a data service layer. The user interaction layer can use a web front-end interface implemented with HTML5, CSS3, and JavaScript to receive department selections, medical questions, and structured patient information, as well as display knowledge-based Q&A, differential diagnoses, treatment plans, and knowledge base management results. The business logic layer can use a FastAPI back-end application, including knowledge-based Q&A modules, differential diagnosis modules, treatment plan recommendation modules, and knowledge base management modules. The data service layer includes a large language model API, an embedding-2 vector embedding model, independent vector indexes serialized and stored separately for each department using Pickle format, and a departmental registry.
[0098] The knowledge-based question-answering module handles department selection, question vectorization, medical evidence retrieval, prompt information construction, and answer output. The differential diagnosis module receives five-dimensional structured patient information, performs department matching, retrieves medical evidence, and generates structured diagnostic prompts. The treatment plan recommendation module retrieves treatment guidelines based on diagnostic results and individual patient information and generates treatment plan prompts. The knowledge base management module performs document or webpage import, text cleaning, chunking, vectorization, and independent knowledge index writing. These modules can be deployed in the same server process or in different services via interfaces.
[0099] The front-end interface can adopt a layout with a left-side navigation area and a right-side main content area. The top left displays the system logo and the title "AI-Assisted Diagnosis," below which are a department category selector and a department selection dropdown. The navigation area includes four navigation items: "Knowledge Q&A," "Differential Diagnosis," "Treatment Plan," and "Knowledge Base Management." The currently selected navigation item can be highlighted. The bottom sidebar displays the knowledge base loading status. The top of the right-side main content area displays the current page name and current department information.
[0100] Taking the Q&A page as an example, the right-hand dialogue area can display user questions and system replies using message cards. User questions can be displayed as blue bubbles, while system replies can be displayed as white cards. The system replies display structured content such as key points of treatment guidelines and recommendations based on medical evidence, with the citation sources indicated in the appropriate locations. A question input box and a send button are located at the bottom of the page, with the message "AI-generated based on a medical knowledge base, for reference only" displayed below the input box. By jointly displaying the knowledge base loading status, current department information, and citation sources, users can identify the departmental knowledge scope corresponding to the current question and answer and retrieve the evidence sources.
[0101] The aforementioned knowledge base management method ensures that medical knowledge from different sources undergoes unified text processing and vectorization before being indexed into the corresponding departments, allowing different departments to share the same software processing chain. When departmental knowledge is updated, documents can be re-imported or added for the corresponding department, and the departmental index can be updated accordingly. Other departmental indexes do not need to be rebuilt synchronously, thus facilitating the separate maintenance of knowledge data from multiple departments.
[0102] Example 5 This embodiment describes the electronic device, storage medium, and complete operation process. The electronic device may include a processor and a memory, in which a computer program is stored. When the processor executes the computer program, it performs the aforementioned departmental retrieval and diagnosis assistance method. The electronic device may be a server, workstation, personal computer, or other device with corresponding computing and network communication capabilities. When a terminal-server collaboration method is adopted, the terminal mainly undertakes information input and result display, while the server undertakes departmental routing, vector retrieval, prompt information construction, and large language model invocation.
[0103] The memory can be used to store computer programs, departmental registry entries, medical knowledge fragments, vector index configurations, and temporary data generated during diagnostic and treatment assistance. The processor can execute computer programs to sequentially complete patient information retrieval, target department determination, independent knowledge index access, medical evidence retrieval, diagnostic prompt information construction, and diagnostic result output. Electronic devices can also access large language model services and vector embedding model services via network interfaces, or deploy the corresponding models locally and have them directly invoked by the processor.
[0104] A computer-readable storage medium may store a computer program for implementing the above methods. The storage medium may be a non-volatile storage medium capable of storing program instructions or other computer-readable media. When the computer program is loaded and executed by a processor, the electronic device completes the subject-specific retrieval and diagnostic assistance processing according to the data processing order specified in the program.
[0105] In a complete operational scenario, the user first enters the structured differential diagnosis page, inputting their chief complaint, symptoms, laboratory tests, imaging results, and past medical history. The server reads the chief complaint and symptoms to generate departmental routing information and matches it against the departmental registry to determine the target department. If no department is matched, the department list is returned to the front end for the user to manually select. After the target department is determined, the server converts the departmental routing information into a query vector. A hybrid search combining vector retrieval and BM25 keyword retrieval is then performed in the target department's independent knowledge index. After mixed score sorting and medical rule rearrangement, a preset number of knowledge fragments are extracted.
[0106] For example, for the chief complaint of "chest tightness and shortness of breath for 3 days" and the symptoms of "chest tightness, shortness of breath, and worsening after activity," the cardiology department is first identified based on the keyword matching score in the department registry, and a corresponding independent knowledge index is loaded using the department identifier. Then, a query vector is formed using the same chief complaint and symptoms, and a BM25 keyword search expression is constructed. After executing the two search methods in parallel, the search scores are normalized and weighted to obtain a mixed score, which is then rearranged according to medical rules. When K=5 and the number of valid fragments is 3, 3 pieces of medical evidence from the cardiology department are actually returned, without supplementing the remaining number with fragments from other departments.
[0107] The server further reads the source documents and locations corresponding to the knowledge fragments, and organizes the retrieved medical evidence, laboratory tests, imaging results, past medical history, and departmental routing information into diagnostic suggestions. Then, it calls a large language model to obtain candidate diagnoses and corresponding diagnostic criteria. When further auxiliary identification is needed, the output can also include key identification points and suggestions for further examination. The front end receives the results and displays them in a structured card format, with the source of evidence and a disclaimer displayed below the results.
[0108] During the above process, blood pressure, heart rate, electrocardiogram findings, and history of hypertension are included as supplementary diagnostic information for their respective types, along with departmental routing information and medical evidence from the target department, and are written into the prompt template. Candidate diagnoses are associated with the actual patient presentations entered and the knowledge fragment identifiers obtained in this search. The source of evidence is displayed based on the index records, showing the source document and corresponding location. Laboratory test results that are not provided remain "Not Provided," and items recommended for further testing remain in the pending testing status.
[0109] When a user switches to the knowledge Q&A page, they can directly select a department and enter a medical question. The front-end sends the department identifier and question to the ` / api / chat` endpoint via POST; the server performs question vectorization, target department index retrieval, and prompt word construction, calls a large language model, and generates content through SSE streaming output, displaying the citation source after the answer is completed. When a user enters the knowledge base management page, they can upload PDF, Word, Markdown, or plain text documents, enter a URL, or directly enter text; the server performs text extraction and cleaning, segmentation, vectorization, and writes it into the selected department's independent knowledge index.
[0110] Within the same system, knowledge-based question answering, structured differential diagnosis, treatment plan recommendation, and knowledge base management can share access mechanisms for departmental registry entries and independent knowledge indexes. Different business functions, after organizing patient information or user questions accordingly, can all limit the scope of knowledge retrieval by target department. This allows multi-departmental functions to operate within a unified processing framework while preserving the independence of each department's knowledge data.
[0111] It should be noted that the terms embedding-2, GLM-4-Plus, Pickle, FastAPI, HTML5, CSS3, JavaScript, and SSE mentioned above are used to illustrate feasible technical implementations and do not imply that the corresponding products or frameworks must be used. Other implementations with the same functionality can be used if text vectorization, similarity retrieval, model inference, data storage, network interface, and front-end display functions can be completed. The preset quantity K, text block size, and number of overlapping characters can also be configured based on the knowledge base size, model context capacity, and actual deployment resources.
[0112] All formulas and configuration items can be obtained directly from actual inputs, registry configurations, knowledge index metadata, or model outputs: m and t j Based on the current chief complaint and symptoms, A d and w j Sourced from the department's registry, n, q k and v d,i,k Derived from the same vector embedding model and target department index, N d The data comes from statistics of valid knowledge records. K, L, and O are derived from system configuration. doc The length is derived from the actual text length of the imported document. When differential weights are not configured, w... j =1; If an empty input, no available department, empty index, zero vector, inconsistent dimensions, or O≥L occurs, return the corresponding prompt and stop the corresponding calculation to ensure that each processing step and parameter has a clear source and applicable boundaries.
[0113] Through the five embodiments described above, departmental routing, independent knowledge indexing, medical evidence retrieval, patient information fusion, diagnostic prompt information construction, large language model output, source association, knowledge base import and update, and electronic device execution processes all have achievable data input, processing, and output relationships. Those skilled in the art can establish corresponding software programs and data storage structures according to the described processing relationships to implement a departmental retrieval and diagnostic assistance process.
[0114] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for assisting in diagnosis and treatment by subject-specific retrieval, characterized in that, The method includes: Obtain the patient's clinical information and supplemental diagnostic information; The clinical information is used as department routing information to determine the target department, and medical evidence is retrieved from the independent knowledge index corresponding to the target department. The diagnostic supplementary information, department routing information and medical evidence are integrated to generate diagnostic prompt information. Based on the diagnostic prompts, a large language model is invoked to generate and output diagnostic results, wherein the diagnostic results include candidate diagnoses and corresponding diagnostic criteria.
2. The subject-specific retrieval and diagnosis assistance method as described in claim 1, characterized in that, The search for medical evidence includes: The departmental routing information is converted into query vectors, and vector similarity retrieval and BM25 keyword retrieval are performed in parallel in the independent knowledge index. The vector retrieval scores and BM25 scores are normalized and then weighted and fused to obtain a mixed score. The mixed scores are then sorted and a preset number of knowledge fragments are extracted as the medical evidence.
3. The subject-specific retrieval and diagnosis assistance method as described in claim 2, characterized in that, The diagnostic prompts are used to instruct the large language model to generate candidate diagnoses and to generate diagnostic criteria and suggestions for further examination for each candidate diagnosis.
4. The subject-specific retrieval and diagnostic assistance method as described in claim 3, characterized in that, When the department routing information does not match the department keywords in the department registry, the department selection information is output, and the received department selection result is determined as the target department.
5. The subject-specific retrieval and diagnostic assistance method as described in claim 4, characterized in that, The department routing information includes the chief complaint and symptoms. The target department is determined by matching the department registration form with the department routing information.
6. The subject-specific retrieval and diagnostic assistance method as described in any one of claims 1 to 5, characterized in that, The supplemental diagnostic information includes laboratory tests, imaging results, and past medical history.
7. The subject-specific retrieval and diagnostic assistance method as described in claim 6, characterized in that, The medical evidence includes knowledge fragments from clinical guidelines and medical literature, with each knowledge fragment associated with its source document and location.
8. The subject-specific retrieval and diagnostic assistance method as described in any one of claims 1 to 5, characterized in that, Before retrieving the medical evidence, imported medical knowledge is received, the medical knowledge is processed to obtain knowledge fragments and vectors, and the obtained knowledge fragments and vectors are written into the independent knowledge index of the corresponding department.
9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the subject-specific retrieval and diagnosis assistance method as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the subject-specific retrieval and diagnosis assistance method as described in any one of claims 1 to 8.
