Methods, devices, electronic equipment, and readable storage media for generating electronic medical records for follow-up visits

CN122575606APending Publication Date: 2026-08-14BEIJING JIETONG DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]目前,复诊电子病历主要依赖医护人员手动录入,不仅占用大量诊疗时间、降低工作效率,同时,还存在着既往就诊与复诊信息脱节、病情变化描述不准确等问题

Benefits of technology

[0010]在本申请实施例中,通过引入交叉注意力机制对本次复诊特征向量和既往就诊特征向量进行计算,使得本次复诊特征向量能够主动关注既往就诊特征向量中的关键信息,进而能够有效地复用既往就诊数据中的信息,以加强本次复诊数据与既往就诊数据之间的关联。同时,通过对既往就诊特征向量和融合特征向量进行差值计算,通过量化的方式表示患者病情的动态变化,进而能够精准捕捉病情变化的趋势,以提高病情变化描述的准确度。此外,通过复诊电子病历生成方法生成复诊电子病历,无需医护人员手动录入,能够有效缩短诊疗中的文书时间、提高工作效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122575606A_ABST
    Figure CN122575606A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, electronic device, and readable storage medium for generating electronic medical records for follow-up visits, belonging to the field of electronic medical record generation technology. The embodiments of this application introduce a cross-attention mechanism to calculate the feature vector of the current follow-up visit and the feature vector of previous visits. This allows the feature vector of the current follow-up visit to actively focus on key information in the feature vector of previous visits, thereby effectively reusing information from previous visit data and strengthening the correlation between the current follow-up visit data and previous visit data. Simultaneously, by calculating the difference between the feature vector of previous visits and the fused feature vector, the dynamic changes in the patient's condition are represented quantitatively, thereby accurately capturing the trend of condition changes and improving the accuracy of the description of condition changes. Furthermore, the method for generating electronic medical records for follow-up visits eliminates the need for manual data entry by medical staff, effectively shortening paperwork time during diagnosis and treatment and improving work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of electronic medical record generation technology, specifically relating to a method, apparatus, electronic device, and readable storage medium for generating follow-up electronic medical records. Background Technology

[0002] Outpatient follow-up visits are an important part of the medical process. The electronic medical record for follow-up visits needs to be based on the patient's previous medical records, as well as the doctor-patient dialogue and examination results of this follow-up visit. It should comprehensively record the changes in the patient's condition and the adjustments to the treatment. Its continuity and accuracy directly affect the treatment outcome.

[0003] Currently, electronic medical records for follow-up visits mainly rely on manual entry by medical staff, which not only consumes a lot of treatment time and reduces work efficiency, but also has problems such as a disconnect between previous medical visits and follow-up visits, and inaccurate descriptions of changes in the condition. Summary of the Invention

[0004] The purpose of this application is to provide a method, apparatus, electronic device, and readable storage medium for generating electronic medical records for follow-up visits. This not only strengthens the correlation between the data from the current follow-up visit and the data from previous visits, and improves the accuracy of the description of changes in the patient's condition, but also effectively shortens the paperwork time during diagnosis and treatment and improves work efficiency.

[0005] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide a method for generating electronic medical records for follow-up visits, the method comprising: The data from this follow-up visit is encoded to obtain the feature vector of this follow-up visit, and the data from previous visits is encoded to obtain the feature vector of previous visits. Cross-attention calculation is performed on the feature vector of the current follow-up visit and the feature vector of the previous visits to obtain a fused feature vector; The difference between the previous medical visit feature vector and the fused feature vector is calculated to obtain the disease change vector; The vector of changes in the patient's condition is decoded to obtain the target follow-up electronic medical record.

[0006] Secondly, embodiments of this application provide an apparatus for generating electronic medical records for follow-up visits, comprising: The input encoding module is used to encode the data from the current follow-up visit to obtain the feature vector of the current follow-up visit, and to encode the data from previous visits to obtain the feature vector of previous visits. The previous medical information reuse module is used to perform cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of the previous medical visits to obtain a fused feature vector; The disease condition change recognition module is used to calculate the difference between the previous medical visit feature vector and the fused feature vector to obtain the disease condition change vector; The medical record generation module is used to decode the disease change vector to obtain the target follow-up electronic medical record.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] Fifthly, embodiments of this application provide a computer program product, including a computer program for implementing the steps of the method described in the first aspect.

[0010] In this embodiment, a cross-attention mechanism is introduced to calculate the feature vector of the current follow-up visit and the feature vector of previous visits. This allows the feature vector of the current follow-up visit to actively focus on key information in the feature vector of previous visits, thereby effectively reusing information from previous visit data and strengthening the correlation between the current follow-up visit data and previous visit data. Simultaneously, by calculating the difference between the feature vector of previous visits and the fused feature vector, the dynamic changes in the patient's condition are represented quantitatively, thus accurately capturing the trend of condition changes and improving the accuracy of the description of condition changes. Furthermore, the follow-up visit electronic medical record generation method eliminates the need for manual data entry by medical staff, effectively reducing paperwork time and improving work efficiency during diagnosis and treatment. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating the method for generating electronic medical records for follow-up visits provided in an embodiment of this application; Figure 2 This is a schematic diagram of the process of calculating the fused feature vector by performing cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of previous visits in the method for generating electronic medical records for follow-up visits provided in this application embodiment; Figure 3 This is a flowchart illustrating the process of calculating the difference between the feature vector of previous visits and the fused feature vector to obtain the vector of changes in the condition in the method for generating electronic medical records for follow-up visits provided in this application embodiment; Figure 4 This is a flowchart illustrating the training process of the electronic medical record generation model for follow-up visits provided in this application embodiment; Figure 5 This is a flowchart illustrating the process of supervising and fine-tuning the electronic medical record generation model during the training of the model provided in this application embodiment. Figure 6 This is a flowchart illustrating the process of adjusting the parameters of the follow-up visit electronic medical record generation model by calling the follow-up visit-specific reward model during the training of the follow-up visit electronic medical record generation model provided in this application embodiment; Figure 7 This is a flowchart illustrating the training process of the follow-up visit-specific reward model provided in this application embodiment; Figure 8 This is a schematic diagram of the structure of the follow-up visit electronic medical record generation device provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0014] Outpatient follow-up visits are an important part of the medical process. The electronic medical record for follow-up visits needs to be based on the patient's previous medical records, as well as the doctor-patient dialogue and examination results of this follow-up visit. It should comprehensively record the changes in the patient's condition and the adjustments to the treatment. Its continuity and accuracy directly affect the treatment outcome.

[0015] Currently, electronic medical records for follow-up visits mainly rely on manual entry by medical staff, which not only consumes a lot of treatment time and reduces work efficiency, but also has problems such as a disconnect between previous medical visits and follow-up visits, and inaccurate descriptions of changes in the condition.

[0016] To address the aforementioned issues, this application provides a method, apparatus, electronic device, and readable storage medium for generating electronic medical records for follow-up visits. By introducing a cross-attention mechanism to calculate the feature vectors of the current follow-up visit and previous visits, the feature vector of the current follow-up visit can actively focus on key information in the feature vectors of previous visits, thereby effectively reusing information from previous visit data and strengthening the correlation between the current follow-up visit data and previous visit data. Simultaneously, by calculating the difference between the feature vectors of previous visits and the fused feature vector, the dynamic changes in the patient's condition are represented quantitatively, thereby accurately capturing the trend of condition changes and improving the accuracy of the description of condition changes. Furthermore, generating electronic medical records for follow-up visits eliminates the need for manual data entry by medical staff, effectively reducing paperwork time during diagnosis and treatment and improving work efficiency.

[0017] The following description, in conjunction with the accompanying drawings, details the method, apparatus, electronic device, and readable storage medium for generating follow-up electronic medical records provided in this application, through specific embodiments and application scenarios.

[0018] Figure 1 This is a flowchart illustrating the method for generating electronic medical records for follow-up visits provided in an embodiment of this application. Figure 1 As shown in the figure, this application provides a method for generating electronic medical records for follow-up visits, the method including: S101. Encode the data from this follow-up visit to obtain the feature vector of this follow-up visit, and encode the data from previous visits to obtain the feature vector of previous visits.

[0019] In this embodiment, "current follow-up visit data" refers to multi-source medical data generated during the patient's current follow-up visit, including doctor-patient dialogue data and examination data. The "current follow-up visit feature vector" is a vector obtained by encoding the current follow-up visit data, used to represent the patient's medical information during this visit. "Past medical records" refers to electronic medical records generated during the patient's historical medical visits, including initial visit electronic medical record data and past follow-up visit records. The "past medical records feature vector" is a vector obtained by encoding the past medical records data, used to represent the patient's medical information during their past medical visits.

[0020] Specifically, the data from the follow-up visit doctor-patient dialogue was obtained by noise filtering and speech recognition-to-text conversion of the audio of the doctor-patient dialogue; the data from the follow-up visit examination was obtained by standardizing the format of the examination data from the follow-up visit based on the unified terminology of SNOMED CT medical terminology; the data from the initial visit electronic medical record was obtained by extracting the core information (chief complaint, diagnosis result, treatment plan, etc.) from the text summary of the initial visit electronic medical record; and the data from previous follow-up visit records was obtained by extracting the core information (chief complaint, diagnosis result, treatment plan, etc.) from the text summary of previous follow-up visit records.

[0021] It should be understood that SNOMED CT (Systematized Nomenclature of Medicine — Clinical Terms) is currently the most comprehensive and widely used clinical medical terminology standard in the world, and is regarded as one of the "common languages" in the global medical and health field.

[0022] In this embodiment, after inputting the data of the current follow-up visit and the data of previous visits, the encoder converts the text sequence into word vectors through the embedding layer, and then extracts contextual features through a multi-layer neural network (such as a Transformer encoder or a bidirectional LSTM encoder), and finally outputs the feature vectors of the current follow-up visit and the feature vectors of previous visits.

[0023] S102. Perform cross-attention calculation on the feature vector of this follow-up visit and the feature vector of previous visits to obtain the fused feature vector.

[0024] Cross-attention is an attention mechanism used to allow the feature vector of the current follow-up visit to actively query key information from the feature vectors of previous visits, thereby achieving a deep correlation between the data of the current follow-up visit and the data of previous visits. The fused feature vector is a new vector generated by fusing the feature vector of the current follow-up visit and the feature vectors of previous visits. It contains both the real-time diagnosis and treatment information of the current follow-up visit and the historical diagnosis and treatment information of previous visits.

[0025] Specifically, the feature vectors for the current follow-up visit and previous visits are linearly transformed using query, key, and value matrices. The feature vector for the current follow-up visit serves as the query vector, while the feature vectors for previous visits serve as the key and value vectors, respectively. By calculating the similarity between the query vector and the key vector, the most relevant parts of the feature vectors for the current follow-up visit and previous visits are determined, resulting in an attention weight matrix. The value vectors are then weighted and summed using the attention weight matrix to inject key information from the feature vectors for previous visits into the feature vector for the current follow-up visit.

[0026] Optionally, the specific process of performing cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of previous visits to obtain the fused feature vector is as shown in the embodiments in S201-S204, and will not be repeated here.

[0027] S103. Calculate the difference between the previous medical visit feature vector and the fused feature vector to obtain the disease condition change vector.

[0028] Specifically, the fused feature vector is subtracted element by element from the previous medical visit feature vector or a specific difference operation is performed.

[0029] Optionally, the specific process of calculating the difference between the previous medical visit feature vector and the fused feature vector to obtain the disease condition change vector is as shown in the embodiments in S301-S303, and will not be repeated here.

[0030] S104. Decode the vector of changes in the patient's condition to obtain the target follow-up electronic medical record.

[0031] In this embodiment, decoding is the process of restoring the vector of changes in the patient's condition into natural language text. The target follow-up electronic medical record is the final generated structured document, including modules such as a description of the changes in the patient's condition, the results of the examination during this follow-up visit, the proposed adjustments to the treatment plan, and the diagnosis for this follow-up visit.

[0032] Specifically, the decoder receives the vector of changes in the patient's condition and, in conjunction with a pre-set electronic medical record template for follow-up visits, generates a text sequence word by word, ultimately obtaining the target electronic medical record for follow-up visits.

[0033] As a possible embodiment of this application, the specific process of performing cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of previous visits in S102 above to obtain the fused feature vector can be implemented through the following S201-S204.

[0034] Figure 2 This is a schematic diagram illustrating the process of calculating a fused feature vector by performing cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of previous visits in the electronic medical record generation method provided in this application embodiment. Combined with... Figure 1 ,like Figure 2 As shown in step S102, cross-attention calculation is performed on the feature vector of this follow-up visit and the feature vector of previous visits to obtain a fused feature vector, including: S201. Perform a query linear transformation on the feature vector of this follow-up visit using a query linear transformation matrix to obtain a first query vector; perform a key linear transformation on the feature vector of previous visits using a key linear transformation matrix to obtain a first key vector; and perform a value linear transformation on the feature vector of previous visits using a value linear transformation matrix to obtain a first value vector.

[0035] In this embodiment, the first query vector, the first key vector, and the first value vector are the core components of cross-attention calculation. The first query vector is obtained by multiplying the current follow-up visit feature vector with the query linear transformation matrix; the first key vector is obtained by multiplying the previous visit feature vector with the key linear transformation matrix; and the first value vector is obtained by multiplying the previous visit feature vector with the value linear transformation matrix.

[0036] S202. Calculate the similarity between the first query vector and the first key vector to obtain the similarity matrix.

[0037] In this embodiment, the dot product or scaled dot product of the first query vector and the first key vector is calculated to obtain a similarity matrix. The similarity matrix represents the degree of association between the current first query vector and the corresponding position of each first key vector. Its value directly reflects the matching degree between the current follow-up visit data and a certain segment of previous visit data.

[0038] In other embodiments, the similarity between the first query vector and the first key vector can also be calculated using other similarity measurement methods such as cosine similarity.

[0039] S203. Normalize the similarity matrix to obtain the attention weights.

[0040] In this embodiment, the normalization process typically employs the Softmax function to operate on each row of the similarity matrix, transforming the original similarity scores into a probability distribution so that the sum of the weights of all key positions corresponding to the same query position is 1. This approach eliminates discrepancies in similarity values ​​between different samples, ensuring the stability of the cross-attention mechanism and preventing extremely large similarity values ​​from dominating the entire calculation process.

[0041] S204. Based on the attention weights, the first value vector is weighted and summed to obtain the fused feature vector.

[0042] In this embodiment, attention weights are used as coefficients to linearly combine the first value vector, and the final output is a fused feature vector. The fused feature vector can integrate information from previously visited medical records with high relevance into the current follow-up visit data, while removing previously visited medical records with low relevance.

[0043] In some specific implementations, the fused feature vector is Attention(Q,K,V), and the formula for calculating the fused feature vector is defined as follows: Attention (Q, K, V) V Where Q is the first query vector, K is the first key vector, and V is the first value vector.

[0044] In this embodiment, the fusion feature vector calculated through the cross-attention mechanism can solve the problem of disconnection between previous medical information in traditional methods, thereby ensuring that the generated follow-up electronic medical record can be connected with previous medical information.

[0045] As a possible embodiment of this application, the specific process of calculating the difference between the previous medical visit feature vector and the fused feature vector in S103 above to obtain the disease change vector can be implemented through the following S301-S303.

[0046] Figure 3This is a flowchart illustrating the process of calculating the difference between the feature vector of previous medical visits and the fused feature vector in the method for generating electronic medical records for follow-up visits provided in this application embodiment. Combined with... Figure 1 ,like Figure 3 As shown in step S103, the difference between the previous medical visit feature vector and the fused feature vector is calculated to obtain the disease condition change vector, including: S301. Calculate the difference between the previous medical visit feature vector and the fused feature vector to obtain the difference feature vector.

[0047] The difference feature vector is obtained by subtracting the previous medical visit feature vector from the fused feature vector. It is used to describe the dynamic trend of the patient's condition from the previous visit to the current follow-up visit. Specifically, the value of each dimension in the fused feature vector is subtracted from the value of the corresponding dimension in the previous medical visit feature vector to obtain signals reflecting changes in symptoms such as relief / worsening / disappearance and rise / fall of test indicators.

[0048] For example, if the encoding value of the fever temperature dimension in the previous medical visit feature vector is 0.8, and the encoding value of the corresponding dimension in the fusion feature vector is 0.95, then the value of the corresponding dimension in the difference feature vector is 0.15. This positive value directly reflects the upward trend of the body temperature index.

[0049] In this embodiment, by subtracting the encoded values ​​corresponding to the vector dimensions, the dynamic trend of the disease can be represented more accurately, thereby avoiding the problem of inaccurate description of the disease changes in the generated follow-up electronic medical record.

[0050] S302. Concatenate the fused feature vector and the difference feature vector to obtain the concatenated feature vector.

[0051] In this embodiment, the spliced ​​feature vector is obtained by connecting the fused feature vector and the difference feature vector end to end along the length direction of the feature vector. The spliced ​​feature vector includes not only the patient's overall diagnosis and treatment information, but also the patient's condition change information, thereby ensuring that the generated follow-up electronic medical record can effectively reuse the patient's previous medical data and accurately describe the patient's condition change trend.

[0052] For example, the fused feature vector is A with a length of m; the difference feature vector is B with a length of n; and the concatenated feature vector is C=[A,B] with a length of m+n.

[0053] S303. The spliced ​​feature vector is processed by a multilayer perceptron to obtain the disease change vector.

[0054] It should be understood that a Multilayer Perceptron (MLP) is a fundamental and important artificial neural network model, composed of multiple neuron layers, including an input layer, one or more hidden layers, and an output layer. Each hidden layer has several neurons with activation functions (such as ReLU, GELU, Tanh, etc.). Neurons in each layer are fully connected to all neurons in the next layer, transmitting information through weights and biases. The processing flow of a MLP is: Output vector = Activation function (Weight matrix × Input vector + Bias).

[0055] Specifically, the spliced ​​feature vector is input into the multilayer perceptron. The spliced ​​feature vector undergoes multiple linear transformations and nonlinear activation function processing, enabling the multilayer perceptron to learn the complex nonlinear relationship between the spliced ​​feature vector and the disease change vector, and encode this relationship in the output disease change vector.

[0056] For example, when the spliced ​​feature vector includes information on a history of fever during previous medical visits (fusion feature vector) and information on elevated body temperature (difference feature vector), the multilayer perceptron can learn that the patient has a persistent fever and encode this relationship in the output condition change vector.

[0057] In this embodiment, by learning the complex nonlinear relationship between the spliced ​​feature vector and the disease change vector through a multilayer perceptron, the accuracy and logic of the generated follow-up electronic medical record can be improved, making it more suitable for actual follow-up scenarios.

[0058] In some specific implementations, the disease change vector is The formula for calculating the vector of changes in the patient's condition is defined as follows:

[0059] in, This represents the feature vector of previous medical visits. To fuse feature vectors, This is the difference eigenvector.

[0060] Figure 4 This is a flowchart illustrating the training process of the electronic medical record generation model for follow-up visits provided in this application embodiment. For example... Figure 4 As shown, the above method is implemented by a follow-up electronic medical record generation model. The training process of the follow-up electronic medical record generation model includes: S401. Obtain training data for this follow-up visit and training data for previous visits.

[0061] In this embodiment, the current follow-up visit training data refers to the multi-source medical data generated by the patient during the current follow-up visit for training the follow-up visit electronic medical record generation model, including training data on the doctor-patient dialogue during the current follow-up visit, training data on the examinations during the current follow-up visit, and training data on treatment adjustment opinions, etc. The previous medical visit training data refers to the electronic medical record records generated by the patient during their historical medical visits for training the follow-up visit electronic medical record generation model, including training data on the initial visit electronic medical record and training data on previous follow-up visit records, etc. Both the current follow-up visit training data and the previous medical visit training data have been anonymized and strictly comply with the "Personal Information Protection Law" and the "Electronic Medical Record Application Management Specifications" to ensure patient privacy and medical data security.

[0062] Among them, the training data for the doctor-patient dialogue during this follow-up visit was obtained by filtering noise and converting speech to text in the audio of the doctor-patient dialogue; the training data for the examinations during this follow-up visit was obtained by standardizing the format of the examination data during this follow-up visit based on the unified terminology of the SNOMED CT medical terminology standard; the training data for the treatment adjustment opinions was obtained by standardizing the format of the treatment adjustment opinions based on the unified terminology of the SNOMED CT medical terminology standard; the training data for the initial visit electronic medical record was obtained by extracting the core information (chief complaint, diagnosis result, treatment plan, etc.) from the text summary of the initial visit electronic medical record; and the training data for previous follow-up visit records was obtained by extracting the core information (chief complaint, diagnosis result, treatment plan, etc.) from the text summary of previous follow-up visit records.

[0063] S402. Based on the training data from this follow-up visit and the training data from previous visits, the electronic medical record generation model for follow-up visits is supervised and fine-tuned.

[0064] In this embodiment, the follow-up visit electronic medical record generation model is obtained by structural adjustment based on a pre-trained large language model (such as the Tongyi Qianwen series or the LLaMA series). The follow-up visit electronic medical record generation model adds a module for reusing past medical information and a module for recognizing changes in the patient's condition, thereby improving the ability of the follow-up visit electronic medical record generation model to connect past medical information and capture changes in the patient's condition, so as to adapt to the follow-up visit scenario.

[0065] Supervised fine-tuning refers to the process of initially optimizing the model parameters using the training data from the current follow-up visit and previous visits. Specifically, the training data from the current follow-up visit and previous visits are input into the follow-up electronic medical record generation model. The model outputs a preliminary follow-up electronic medical record. By calculating the cross-entropy loss between the preliminary follow-up electronic medical record and the preset standardized follow-up medical record, the parameters of the follow-up electronic medical record generation model are updated using the backpropagation algorithm until the loss value converges.

[0066] Optionally, the specific process of supervising and fine-tuning the electronic medical record generation model based on the training data of this follow-up visit and the training data of previous visits can be referred to the embodiments shown in S501-S503, which will not be repeated here.

[0067] S403. Invoke the follow-up visit-specific reward model to adjust the parameters of the follow-up visit electronic medical record generation model; wherein, the follow-up visit-specific reward model includes at least one of the following reward items: coherence reward item, accuracy reward item for changes in condition, standardization reward item, and human feedback reward item. The coherence reward item is used to evaluate the degree of coherence between the training follow-up visit electronic medical record output by the follow-up visit electronic medical record generation model and the input previous medical visit training data. The accuracy reward item for changes in condition is used to evaluate the accuracy of the training follow-up visit electronic medical record in describing changes in condition. The standardization reward item is used to evaluate the standardization of the training follow-up visit electronic medical record. The human feedback reward item is used to instruct medical staff on the accuracy of their feedback on the training follow-up visit electronic medical record.

[0068] In this embodiment, the follow-up visit-specific reward model evaluates the follow-up visit electronic medical record (EMR) generated by the follow-up visit EMR generation model from multiple dimensions, including continuity, accuracy of disease progression, standardization, and human feedback, thus better meeting the actual needs of clinical diagnosis and treatment. The inclusion of rewards for continuity and accuracy of disease progression improves the continuity of past medical information and the accuracy of disease progression descriptions in the follow-up visit EMR; the standardization reward ensures that the follow-up visit EMR is more in line with medical standards; and the human feedback reward ensures that the follow-up visit EMR better reflects professional diagnostic and treatment thinking in real medical scenarios.

[0069] In this embodiment, the reinforcement learning environment includes a state space, an action space, and a feedback space. The state space consists of previous medical visit training data, current follow-up visit training data, the follow-up visit electronic medical record fragment generated in the previous step by the follow-up visit electronic medical record generation model, and the follow-up visit electronic medical record writing specifications. The action space consists of actions such as follow-up visit electronic medical record text generation, reuse of previous medical visit training data, selection of medical terminology, and logical adjustment. The feedback space consists of automatic evaluation feedback and manual evaluation feedback, including evaluation indicators such as coherence, accuracy of changes in the patient's condition, and standardization.

[0070] Specifically, the training data from this follow-up visit and previous visit training data are input into the supervised fine-tuning follow-up visit electronic medical record generation model. The supervised fine-tuning follow-up visit electronic medical record generation model outputs the follow-up visit electronic medical record. This follow-up visit electronic medical record is then input into the follow-up visit-specific reward model to calculate the reward value of each reward item and the total reward value. Based on reinforcement learning algorithms such as PPO, the parameters of the follow-up visit electronic medical record generation model are adjusted according to the total reward value.

[0071] It should be understood that Proximal Policy Optimization (PPO) is a policy-based, online reinforcement learning algorithm whose core objective is to improve the policy as efficiently as possible while ensuring stable policy updates.

[0072] Optionally, the specific process of adjusting the parameters of the follow-up visit electronic medical record generation model by calling the follow-up visit exclusive reward model is described in the embodiments shown in S601-S603, and will not be repeated here.

[0073] In this embodiment, the follow-up electronic medical record generation model is continuously optimized through a dual training mechanism that combines supervised fine-tuning and reinforcement learning. This makes the follow-up electronic medical record generation model more in line with the generation requirements of follow-up electronic medical records, which is conducive to improving the generalization ability of the follow-up electronic medical record generation model.

[0074] As a possible embodiment of this application, the specific process of supervising and fine-tuning the electronic medical record generation model based on the current follow-up visit training data and the previous visit training data in S402 can be implemented through the following S501-S505.

[0075] Figure 5 This is a flowchart illustrating the supervised fine-tuning process of the electronic medical record generation model for follow-up visits during the training process provided in this application embodiment. Combined with... Figure 4 ,like Figure 5 As shown in S402, supervised fine-tuning of the electronic medical record generation model for follow-up visits is performed based on the training data from this follow-up visit and previous visit training data, including: S501. The training data of this follow-up visit and the training data of previous visits are processed by the follow-up visit electronic medical record generation model to obtain the training vector of the change in condition and the first follow-up visit electronic medical record.

[0076] Specifically, the training data for this follow-up visit is encoded to obtain the training vector for this follow-up visit, and the training data for previous visits is encoded to obtain the training vector for previous visits; cross-attention calculation is performed on the training vector for this follow-up visit and the training vector for previous visits to obtain the first fusion training vector; the difference between the training vector for previous visits and the first fusion training vector is calculated to obtain the first condition change training vector; and the first condition change training vector is decoded to obtain the first follow-up electronic medical record.

[0077] S502. The classification head of the follow-up electronic medical record generation model is used to classify and predict the training vector of changes in the condition, and the probability of changes in the condition is obtained.

[0078] It should be understood that the classification head usually refers to the part of the network structure at the end of the model that is specifically used to perform classification tasks.

[0079] Specifically, the classification head can be an independent fully connected layer or a softmax classifier placed at the end of the disease change recognition module. The disease change training vector is input into the classification head, which can classify the patient's disease changes, typically including preset categories such as improvement, worsening, and disappearance, and finally outputs the probability of disease change.

[0080] For example, if the training vector of disease changes reflects the characteristics of a decrease in body temperature and relief of fever symptoms, then in the disease change probabilities output by the classification head, the probability value of the improved category may be 0.91, the probability value of the worsened category may be 0.07, and the probability value of the disappeared category may be 0.02.

[0081] It should be understood that during the training of the follow-up electronic medical record generation model, the classification head will classify and predict the probability of disease changes from the training vectors of disease changes. During the inference process of the follow-up electronic medical record generation model, the classification head will not output the probability of disease changes, but will only retain the learned disease change categories.

[0082] S503. Calculate the first loss value between the probability of disease change and the preset disease change label.

[0083] The preset disease change labels refer to the actual disease change results labeled by medical staff in the training data. The probability of the correct category in the preset disease change labels is 1, and the probability of other categories is 0. The first loss value is a numerical indicator used to measure the difference between the disease change probability predicted by the follow-up electronic medical record generation model and the preset disease change labels. It is usually calculated using the cross-entropy loss function.

[0084] Specifically, the probability value corresponding to the correct category in the probability of disease change is obtained, the logarithm of this probability value is calculated to obtain the logarithmic value, and finally the negative of this logarithmic value is calculated to obtain the first loss value. The closer the probability value of disease change in the correct category is to 1, the smaller the first loss value; conversely, the smaller it is, the larger it is.

[0085] For example, if the probability of disease change is [0.8, 0.1, 0.1], and the preset disease change label is [1, 0,0], then the correct category is the first category, and the first loss value is -log(0.8).

[0086] S504. Calculate the second loss value between the first follow-up electronic medical record and the preset standard follow-up medical record.

[0087] The pre-defined standardized follow-up medical record refers to a reference medical record text in the training data that has undergone standardization and conforms to clinical writing standards. This medical record text has accurate medical terminology, a complete logical structure, and complies with format requirements. The second loss value is a numerical indicator used to measure the differences in terminology, logic, and format between the first follow-up electronic medical record generated by the follow-up electronic medical record generation model and the pre-defined standardized follow-up medical record. It can be calculated using the cross-entropy loss function, the loss function corresponding to text similarity, or the loss function corresponding to semantic loss.

[0088] Optionally, the first follow-up electronic medical record is encoded to obtain a first medical record vector; the preset standardized follow-up medical record is encoded to obtain a second medical record vector; the mean square error of the first medical record vector and the second medical record vector is calculated to obtain a second loss value.

[0089] It should be understood that mean squared error is one of the most commonly used error metrics in statistics, machine learning, and data analysis, used to measure the degree of difference between predicted and true values.

[0090] S505. Adjust the parameters of the follow-up electronic medical record generation model based on the first loss value and the second loss value.

[0091] Specifically, the parameters of the follow-up electronic medical record generation model can be processed using the gradient descent algorithm. The first and second loss values ​​are used together as the optimization objective; during backpropagation, the parameters of the follow-up electronic medical record generation model are simultaneously constrained by the two loss gradients.

[0092] In this embodiment, after the training device for the follow-up electronic medical record generation model trains the follow-up electronic medical record generation model in the manner described in steps S501-S505, it brings the updated parameters into a new round of training and repeats steps S501-S505 until the first loss value and the second loss value reach the convergence condition.

[0093] It should be understood that the convergence condition may be that the first loss value and the second loss value no longer change, or that both the first loss value and the second loss value are less than a preset loss value. This application embodiment does not limit this.

[0094] In other embodiments, the first loss value and the second loss value can be weighted and summed to obtain a first total loss value; the parameters of the follow-up electronic medical record generation model are adjusted according to the first total loss value. The training device for the follow-up electronic medical record generation model stops training when the first total loss value reaches the convergence condition.

[0095] It should be understood that the convergence condition may be that the first total loss value no longer changes, or that the first total loss value is less than the preset total loss value. This application embodiment does not limit this.

[0096] In this embodiment, the parameters of the follow-up electronic medical record generation model are adjusted by using a first loss value and a second loss value together. This enables the follow-up electronic medical record generation model to not only more accurately identify key signals of changes in the patient's condition, but also to generate more standardized follow-up electronic medical records, thereby improving the quality of the follow-up electronic medical records.

[0097] As a possible embodiment of this application, the specific process of calling the follow-up visit exclusive reward model to adjust the parameters of the follow-up visit electronic medical record generation model in S403 above can be implemented through the following S601-S603.

[0098] Figure 6 This is a flowchart illustrating the process of adjusting the parameters of the follow-up visit electronic medical record generation model by calling the follow-up visit-specific reward model during the training process provided in this application embodiment. Combined with... Figure 4 ,like Figure 6 As shown, the parameters of the follow-up visit electronic medical record generation model are adjusted by calling the follow-up visit-specific reward model, including: S601. The training data for this follow-up visit and the training data for previous visits are processed by the follow-up electronic medical record generation model to obtain the second follow-up electronic medical record.

[0099] Specifically, the training data for this follow-up visit is encoded to obtain the training vector for this follow-up visit, and the training data for previous visits is encoded to obtain the training vector for previous visits; cross-attention calculation is performed on the training vector for this follow-up visit and the training vector for previous visits to obtain a second fusion training vector; the difference between the training vector for previous visits and the second fusion training vector is calculated to obtain a second condition change training vector; and the second condition change training vector is decoded to obtain a second follow-up electronic medical record.

[0100] S602. Calculate the total reward value of the second follow-up electronic medical record using the follow-up visit-specific reward model. The total reward value is obtained by weighted summation of the reward values ​​output by at least one reward item according to the weight of each reward item. The continuity and coherence reward item is used to obtain the reward value by performing semantic analysis on the second follow-up electronic medical record and previous medical training data. The accuracy of disease change reward item is used to obtain the reward value by performing semantic analysis on the second follow-up electronic medical record and current medical training data. The standardization reward item is used to obtain the reward value by semantically analyzing the matching degree between the second follow-up electronic medical record and the preset electronic medical record template. The human feedback reward item is used to obtain the reward value by performing semantic analysis on the human feedback opinions of the second follow-up electronic medical record.

[0101] Specifically, a natural language model can be used to perform semantic analysis and comparison between the second follow-up electronic medical record and the previous medical training data. If there is no information gap and the connection between the second follow-up electronic medical record and the previous medical training data is natural, the connection and coherence reward item is positive; otherwise, it is negative.

[0102] Specifically, a natural language model can be used to perform semantic analysis and comparison between the second follow-up electronic medical record and the training data of the current visit. If the training follow-up electronic medical record accurately and realistically describes the changes in the patient's condition, the reward for the accuracy of the changes in the patient's condition will be positive; otherwise, it will be negative.

[0103] Specifically, a natural language model can be used to perform semantic analysis and comparison between the second follow-up electronic medical record and the preset electronic medical record template. If the writing standards and medical terminology standards of the follow-up electronic medical record are trained, the standardization reward will be positive; otherwise, it will be negative.

[0104] Specifically, a natural language model can be used to perform semantic analysis and comparison between the second follow-up electronic medical record and the human feedback. If the medical staff provide good feedback on the training follow-up electronic medical record, the human feedback reward will be positive; otherwise, it will be negative.

[0105] In some specific implementations, the total reward value is The formula for calculating the total reward value is defined as follows:

[0106] in, To ensure consistency in the weighting of reward items, To ensure the continuity of the reward items, The weight of the reward item for the accuracy of changes in the patient's condition. The reward value for the accuracy of changes in the patient's condition. The weight of the standardization reward items, The reward value for the standardization reward item. The weight of the reward items for manual feedback, The reward value for the manually provided reward item. As a weight for other reward items, This represents the reward value for other reward items.

[0107] It should be understood that the reward values ​​of each reward item need to be normalized before the weighted summation.

[0108] S603. Adjust the parameters of the follow-up visit electronic medical record generation model according to the total reward value.

[0109] Specifically, the parameters of the follow-up electronic medical record generation model can be processed using the gradient descent algorithm. After the training device for the follow-up electronic medical record generation model trains the model in the manner described in steps S601-S603, the updated parameters are fed into a new round of training, and steps S601-S603 are repeated until the total reward value reaches the convergence condition.

[0110] It should be understood that the convergence condition may be that the total reward value no longer changes, or that the total reward value reaches a preset value, or that the reward value of each reward item reaches a preset value. This application embodiment does not limit this.

[0111] In this embodiment, the total reward value is obtained by weighted summation of the reward values ​​of the multi-dimensional reward items. The total reward value is used as the basis for adjusting the parameters of the follow-up electronic medical record generation model, so that the iterative optimization of the follow-up electronic medical record generation model can be achieved without a large amount of manual annotation.

[0112] In other embodiments, when performing step S403 and calling the follow-up visit-specific reward model to adjust the parameters of the follow-up visit electronic medical record generation model, the total reward value of the first follow-up visit electronic medical record can be calculated directly through the follow-up visit-specific reward model for training. There is no need to perform step S601 and process the current follow-up visit training data and the previous visit training data through the follow-up visit electronic medical record generation model to obtain the second follow-up visit electronic medical record.

[0113] Figure 7 This is a flowchart illustrating the training process of the follow-up visit-specific reward model provided in this application embodiment. For example... Figure 7 As shown, the training process of the follow-up visit-specific reward model includes: S701. The training data of this follow-up visit and the training data of previous visits are processed by the follow-up visit electronic medical record generation model to obtain the third follow-up visit electronic medical record.

[0114] Specifically, the training data for this follow-up visit is encoded to obtain the training vector for this follow-up visit, and the training data for previous visits is encoded to obtain the training vector for previous visits; cross-attention calculation is performed on the training vector for this follow-up visit and the training vector for previous visits to obtain a third fusion training vector; the difference between the training vector for previous visits and the third fusion training vector is calculated to obtain a third condition change training vector; and the third condition change training vector is decoded to obtain the third follow-up electronic medical record.

[0115] S702. Calculate the total reward value of the third follow-up electronic medical record through the follow-up visit exclusive reward model, and calculate the mean square error between the total reward value and the preset standard value to obtain the third loss value.

[0116] It should be understood that the calculation of the total reward value of the third follow-up visit electronic medical record through the follow-up visit exclusive reward model can be performed with reference to step S602, and will not be repeated here.

[0117] The preset standard value refers to the target value set by medical staff for the standard follow-up electronic medical record.

[0118] Specifically, the total reward value of the third follow-up electronic medical record is mapped to a value within a preset range through a mapping function. The difference between the total reward value and the preset standard value is calculated using a mean squared error algorithm to obtain the third loss value. The third loss value is used to measure the accuracy of the overall score of the follow-up exclusive reward model.

[0119] S703. If the weight of at least one reward item is greater than the benchmark weight, the difference between the weight of each reward item and the benchmark weight shall be calculated to obtain the weight difference of each reward item. The benchmark weight is the minimum weight between the weight of the continuity reward item and the weight of the accuracy of disease change reward item.

[0120] Specifically, the weights of the continuity and coherence reward items and the accuracy of disease progression reward items are compared, and the minimum weight between the two is taken as the benchmark weight. The weights of each reward item are compared with the benchmark weights. If one or more reward items have a weight greater than the benchmark weight, the difference between the weight of each reward item and the benchmark weight is calculated.

[0121] It should be understood that when calculating the difference between the weight of each reward item and the baseline weight, the weight of each reward item is the minuend, and the baseline weight is the subtrahend.

[0122] For example, if the weight of the continuity and coherence reward item is 0.2 and the weight of the accuracy of disease change reward item is 0.3, then the baseline weight is 0.2; if the weight of the standardization reward item is 0.4, then the weight difference of the standardization reward item is 0.2; if the weight of the human feedback reward item is 0.1, then the weight difference of the human feedback reward item is -0.1.

[0123] S704. If the weight difference of each reward item is greater than 0, then sum the weight differences of each reward item to obtain the fourth loss value.

[0124] Specifically, the weight difference of each reward item is compared with 0 one by one. If the weight difference of a reward item is greater than 0, the reward items with weight differences greater than 0 are summed to obtain the fourth loss value. If no reward item has a weight greater than the baseline weight, then there is no need to calculate the fourth loss value.

[0125] For example, if the weight of the continuity and coherence reward item is 0.2 and the weight of the accuracy of disease change reward item is 0.3, then the baseline weight is 0.2; if the weight of the standardization reward item is 0.4, then the weight difference of the standardization reward item is 0.2, and the weight difference of the standardization reward item is greater than 0; if the weight of the human feedback reward item is 0.1, then the weight difference of the human feedback reward item is -0.1, and the weight difference of the human feedback reward item is less than 0; finally, the fourth loss value is 0.2.

[0126] In this embodiment, the fourth loss value is set to ensure that the weight of the continuity reward item and the accuracy reward item for changes in the condition are both higher than the weight of other reward items, thereby ensuring that the follow-up visit-specific reward model is more in line with the actual clinical needs of follow-up visits.

[0127] In some specific implementations, the fourth loss value is The formula for calculating the fourth loss value is defined as follows:

[0128] in, To ensure consistency in the weighting of reward items, The weight of the reward item for the accuracy of changes in the patient's condition. This is the weighting for other reward items.

[0129] S705. Under preset constraints, adjust the weights of each reward item according to the third and fourth loss values. The preset constraints include: the weight of the continuity and coherence reward item is greater than or equal to the first preset value, the weight of the accuracy of disease change reward item is greater than or equal to the second preset value, and the sum of the weights of each reward item is 1.

[0130] Specifically, the weights of the reward items can be processed using the gradient descent algorithm. The third and fourth loss values ​​are used together as the optimization objective. During backpropagation, the weights of the reward items are simultaneously constrained by both loss gradients. After adjusting the weights of each reward item, it is necessary to determine whether the constraints are met.

[0131] In this embodiment, regardless of how the weights of each reward item are adjusted, the weights of the continuity and coherence reward item and the accuracy of disease progression reward item must always remain within an effective range to avoid over-optimization affecting the weights of the core reward items. The sum of the weights of all reward items is 1 to ensure the standardization and rationality of the probability distribution.

[0132] In this embodiment of the application, after the training device of the follow-up visit-specific reward model trains the follow-up visit-specific reward model in the manner described in steps S701-S705, it brings the updated weights of each reward item into a new round of training and repeats steps S701-S705 until the third loss value and the fourth loss value reach the convergence condition.

[0133] It should be understood that the convergence condition may be that the third and fourth loss values ​​no longer change, or that the first and second loss values ​​are both less than a preset loss value. This application embodiment does not limit this.

[0134] In this embodiment, the weights of each reward item in the model are adjusted based on the third and fourth loss values ​​obtained when the third and fourth loss values ​​meet the convergence conditions. The follow-up visit-specific reward model adjusted by the weights of each reward item provides a more accurate and professional evaluation of the follow-up visit electronic medical record. This makes the follow-up visit electronic medical record generation model adjusted by the follow-up visit-specific reward model more in line with the generation requirements of follow-up visit electronic medical records, which is conducive to improving the generalization ability of the follow-up visit electronic medical record generation model.

[0135] In other embodiments, the third and fourth loss values ​​can be weighted and summed to obtain a second total loss value; the weights of each reward item are then adjusted based on the second total loss value. The training device for the follow-up visit-specific reward model stops training when the second total loss value reaches the convergence condition.

[0136] It should be understood that the convergence condition may be that the second total loss value no longer changes, or that the second total loss value is less than the preset total loss value. This application embodiment does not limit this.

[0137] In some specific implementations, the second total loss value is The formula for calculating the second total loss value is defined as follows:

[0138] in, For the validation set, To validate a single sample in the set. For mapping functions, The preset standard value, This is the third loss value. This is the fourth loss value. This is the penalty coefficient.

[0139] Specifically, the penalty coefficient Used to balance the third and fourth loss values.

[0140] Optionally, It can be 0.1.

[0141] In this embodiment, the training data for the current follow-up visit and the training data for previous visits are derived from a dataset. The dataset includes a training set, a validation set, a test set, and a feedback dataset. The training set contains preprocessed pairs of previous visit training data and current follow-up visit training data, along with standardized follow-up visit medical records. The training set is used for supervised fine-tuning and reinforcement learning training of the follow-up visit electronic medical record generation model. The validation set is used to adjust the parameters of the follow-up visit electronic medical record generation model and the weights of each reward item in the follow-up visit-specific reward model. The test set is used to evaluate the generation effect of the follow-up visit electronic medical record generation model. The feedback dataset is used to collect feedback and scores from medical staff on the follow-up visit electronic medical records generated by the follow-up visit electronic medical record generation model. Specifically, the current follow-up visit training data and the training data for previous visits in steps S401-S403 are derived from the training set of the dataset; the current follow-up visit training data and the training data for previous visits in step S601 are derived from the validation set of the dataset.

[0142] Optionally, after the follow-up visit electronic medical record generation model generates the follow-up visit electronic medical record, the generated follow-up visit electronic medical record can be verified in real time through the evaluation indicators of the follow-up visit exclusive reward model; then, medical staff will review it and feed back modification suggestions and scores to the dataset for training the follow-up visit electronic medical record generation model; after the medical staff approves it, a timestamp and the medical staff's electronic signature will be automatically added to obtain a follow-up visit electronic medical record with time and signature.

[0143] It should be noted that the execution entity of the method for generating follow-up electronic medical records provided in this application embodiment can be a follow-up electronic medical record generating device, or a control module in the follow-up electronic medical record generating device for executing the method of loading and generating follow-up electronic medical records. This application embodiment uses the follow-up electronic medical record generating device executing the method of loading and generating follow-up electronic medical records as an example to illustrate the method for generating follow-up electronic medical records provided in this application embodiment.

[0144] Figure 8 This is a schematic diagram of the structure of the electronic medical record generation device for follow-up visits provided in an embodiment of this application. Figure 8 As shown in the figure, this application provides an electronic medical record generation device for follow-up visits, including: The input encoding module 801 is used to encode the data of the current follow-up visit to obtain the feature vector of the current follow-up visit, and to encode the data of previous visits to obtain the feature vector of previous visits.

[0145] The previous medical information reuse module 802 is used to perform cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of previous medical visits to obtain a fused feature vector.

[0146] The disease condition change recognition module 803 is used to calculate the difference between the feature vector of previous medical visits and the fused feature vector to obtain the disease condition change vector.

[0147] The medical record generation module 804 is used to decode the vector of changes in the patient's condition to obtain the target follow-up electronic medical record.

[0148] In one possible implementation, the previous medical information reuse module 802 is specifically used to: perform a query linear transformation on the current follow-up visit feature vector using a query linear transformation matrix to obtain a first query vector; perform a key linear transformation on the previous medical visit feature vector using a key linear transformation matrix to obtain a first key vector; and perform a value linear transformation on the previous medical visit feature vector using a value linear transformation matrix to obtain a first value vector; calculate the similarity between the first query vector and the first key vector to obtain a similarity matrix; normalize the similarity matrix to obtain attention weights; and perform a weighted summation of the first value vectors based on the attention weights to obtain a fused feature vector.

[0149] In one possible implementation, the disease condition change recognition module 803 is specifically used to: calculate the difference between the previous medical visit feature vector and the fused feature vector to obtain the difference feature vector; concatenate the fused feature vector and the difference feature vector to obtain the concatenated feature vector; and process the concatenated feature vector through a multilayer perceptron to obtain the disease condition change vector.

[0150] In one possible implementation, a follow-up electronic medical record generation device further includes a first training module 805, which is used to: acquire current follow-up training data and previous medical training data; perform supervised fine-tuning of the follow-up electronic medical record generation model based on the current follow-up training data and previous medical training data; and call a follow-up-specific reward model to adjust the parameters of the follow-up electronic medical record generation model. The follow-up-specific reward model includes at least one of the following reward items: a continuity and coherence reward item, a disease change accuracy reward item, a standardization reward item, and a human feedback reward item. The continuity and coherence reward item is used to evaluate the continuity and coherence between the training follow-up electronic medical record output by the follow-up electronic medical record generation model and the input previous medical training data. The disease change accuracy reward item is used to evaluate the accuracy of the description of disease changes in the training follow-up electronic medical record. The standardization reward item is used to evaluate the standardization of the training follow-up electronic medical record. The human feedback reward item is used to instruct medical staff on the accuracy of their feedback to the training follow-up electronic medical record.

[0151] In one possible implementation, the first training module 805 is specifically used for: processing the current follow-up visit training data and previous visit training data through the follow-up electronic medical record generation model to obtain a disease condition change training vector and a first follow-up electronic medical record; classifying and predicting the disease condition change training vector through the classification head of the follow-up electronic medical record generation model to obtain the disease condition change probability; calculating a first loss value between the disease condition change probability and a preset disease condition change label; calculating a second loss value between the first follow-up electronic medical record and a preset standardized follow-up medical record; and adjusting the parameters of the follow-up electronic medical record generation model based on the first loss value and the second loss value.

[0152] In one possible implementation, the first training module 805 is specifically used for: processing the current follow-up visit training data and previous visit training data through the follow-up visit electronic medical record generation model to obtain a second follow-up visit electronic medical record; calculating the total reward value of the second follow-up visit electronic medical record through a follow-up visit-specific reward model, wherein the total reward value is obtained by weighted summation of the reward values ​​output by at least one reward item according to the weight of each reward item; the coherence reward item is used to obtain a reward value by performing semantic analysis on the second follow-up visit electronic medical record and previous visit training data; the accuracy of disease change reward item is used to obtain a reward value by performing semantic analysis on the second follow-up visit electronic medical record and current visit training data; the standardization reward item is used to obtain a reward value by semantically analyzing the matching degree between the second follow-up visit electronic medical record and the preset electronic medical record template; and the human feedback reward item is used to obtain a reward value by performing semantic analysis on the human feedback opinions of the second follow-up visit electronic medical record; and adjusting the parameters of the follow-up visit electronic medical record generation model according to the total reward value.

[0153] In one possible implementation, a follow-up electronic medical record generation device further includes a second training module 806. The first training module 806 is used to: process the current follow-up training data and previous medical training data through a follow-up electronic medical record generation model to obtain a third follow-up electronic medical record; calculate the total reward value of the third follow-up electronic medical record through a follow-up-specific reward model, and calculate the mean square error between the total reward value and a preset standard value to obtain a third loss value; if the weight of at least one reward item is greater than the benchmark weight, then calculate the difference between the weight of each reward item and the benchmark weight. The weight difference of each reward item is obtained, where the baseline weight is the minimum weight between the weight of the continuity and coherence reward item and the weight of the accuracy of disease change reward item. If the weight difference of each reward item is greater than 0, the weight differences of each reward item are summed to obtain the fourth loss value. Under preset constraints, the weights of each reward item are adjusted according to the third and fourth loss values. The preset constraints include: the weight of the continuity and coherence reward item is greater than or equal to the first preset value, the weight of the accuracy of disease change reward item is greater than or equal to the second preset value, and the sum of the weights of each reward item is 1.

[0154] The device for generating electronic medical records for follow-up visits in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.

[0155] The follow-up electronic medical record generation device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.

[0156] The electronic medical record generation device for follow-up visits provided in this application embodiment can achieve... Figures 1 to 7 The various processes implemented by the follow-up electronic medical record generation device in the method embodiment will not be described again here to avoid repetition.

[0157] In this embodiment, the previous medical information reuse module 802 calculates the feature vector of the current follow-up visit and the feature vector of previous medical visits through a cross-attention mechanism. This allows the feature vector of the current follow-up visit to actively focus on key information in the feature vector of previous medical visits, thereby effectively reusing information from previous medical data and strengthening the correlation between the current follow-up visit data and previous medical data. Simultaneously, the condition change recognition module 803 calculates the difference between the feature vector of previous medical visits and the fused feature vector, representing the dynamic changes in the patient's condition in a quantitative way. This allows for accurate capture of the trend of condition changes, improving the accuracy of the description of condition changes. Furthermore, the follow-up visit electronic medical record generation device generates follow-up visit electronic medical records using a follow-up visit electronic medical record generation method, eliminating the need for manual data entry by medical staff, effectively shortening paperwork time during diagnosis and treatment and improving work efficiency.

[0158] Optionally, this application embodiment also provides an electronic device 9, including a processor 901, a memory 902, and a program or instructions stored in the memory 902 and executable on the processor 901. When the program or instructions are executed by the processor 901, they implement the various processes of the above-described method embodiment for generating electronic medical records for follow-up visits and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0159] Optionally, the electronic device 9 also includes a communication component 903. The processor 901, memory 902, and communication component 903 are connected via a bus 904.

[0160] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0161] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described method for generating electronic medical records for follow-up visits and achieve the same technical effect. To avoid repetition, these will not be described again here.

[0162] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0163] This application also provides a computer program product, including a computer program for implementing the steps of the above-described method for generating electronic medical records for follow-up visits.

[0164] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0165] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0166] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for generating electronic medical records for follow-up visits, characterized in that, The method includes: The data from this follow-up visit is encoded to obtain the feature vector of this follow-up visit, and the data from previous visits is encoded to obtain the feature vector of previous visits. Cross-attention calculation is performed on the feature vector of the current follow-up visit and the feature vector of the previous visits to obtain a fused feature vector; The difference between the previous medical visit feature vector and the fused feature vector is calculated to obtain the disease change vector; The vector of changes in the patient's condition is decoded to obtain the target follow-up electronic medical record.

2. The method according to claim 1, characterized in that, The step of performing cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of previous visits to obtain a fused feature vector includes: The first query vector is obtained by performing a query linear transformation on the feature vector of the current follow-up visit using a query linear transformation matrix, and the first key vector is obtained by performing a key linear transformation on the feature vector of the previous visits using a key linear transformation matrix, and the first value vector is obtained by performing a value linear transformation on the feature vector of the previous visits using a value linear transformation matrix. Calculate the similarity between the first query vector and the first key vector to obtain a similarity matrix; The similarity matrix is ​​normalized to obtain the attention weights; Based on the attention weights, the first value vector is weighted and summed to obtain the fused feature vector.

3. The method according to claim 1, characterized in that, The step of calculating the difference between the previous medical visit feature vector and the fused feature vector to obtain the disease condition change vector includes: Calculate the difference between the previous medical visit feature vector and the fused feature vector to obtain the difference feature vector; The fused feature vector and the difference feature vector are concatenated to obtain the concatenated feature vector; The spliced ​​feature vector is processed by a multilayer perceptron to obtain the disease change vector.

4. The method according to any one of claims 1 to 3, characterized in that, The method is implemented by a follow-up electronic medical record generation model, and the training process of the follow-up electronic medical record generation model includes: Obtain training data from this follow-up visit and previous medical visits; The electronic medical record generation model for follow-up visits is supervised and fine-tuned based on the training data from the current follow-up visit and the training data from previous visits. The parameters of the follow-up visit electronic medical record generation model are adjusted by invoking a follow-up visit-specific reward model. This follow-up visit-specific reward model includes at least one of the following reward items: a coherence and continuity reward item, a disease change accuracy reward item, a standardization reward item, and a human feedback reward item. The coherence and continuity reward item is used to evaluate the degree of coherence and continuity between the training follow-up visit electronic medical record output by the follow-up visit electronic medical record generation model and the input previous medical visit training data. The disease change accuracy reward item is used to evaluate the accuracy of the description of disease changes in the training follow-up visit electronic medical record. The standardization reward item is used to evaluate the standardization of the training follow-up visit electronic medical record. The human feedback reward item is used to instruct medical staff on the accuracy of their feedback to the training follow-up visit electronic medical record.

5. The method according to claim 4, characterized in that, The supervised fine-tuning of the electronic medical record generation model for follow-up visits based on the current follow-up visit training data and the previous visit training data includes: The training data for the current follow-up visit and the training data for previous visits are processed by the follow-up electronic medical record generation model to obtain the training vector for changes in the condition and the first follow-up electronic medical record. The classification head of the electronic medical record generation model for follow-up visits is used to classify and predict the training vector of the change in the condition, so as to obtain the probability of the change in the condition. Calculate the first loss value between the probability of the change in the condition and the preset label of the change in the condition; Calculate the second loss value between the first follow-up electronic medical record and the preset standard follow-up medical record; The parameters of the follow-up electronic medical record generation model are adjusted based on the first loss value and the second loss value.

6. The method according to claim 4, characterized in that, The step of invoking the follow-up visit-specific reward model to adjust the parameters of the follow-up visit electronic medical record generation model includes: The training data for the current follow-up visit and the training data for previous visits are processed by the follow-up visit electronic medical record generation model to obtain the second follow-up visit electronic medical record; The total reward value of the second follow-up electronic medical record is calculated using the follow-up visit-specific reward model. The total reward value is obtained by weighted summation of the reward values ​​output by at least one reward item according to the weight of each reward item. The coherence reward item is used to obtain a reward value by performing semantic analysis on the second follow-up electronic medical record and the previous medical training data. The accuracy of the change in condition reward item is used to obtain a reward value by performing semantic analysis on the second follow-up electronic medical record and the current medical training data. The standardization reward item is used to obtain a reward value by semantically analyzing the matching degree between the second follow-up electronic medical record and the preset electronic medical record template. The human feedback reward item is used to obtain a reward value by performing semantic analysis on the human feedback opinions of the second follow-up electronic medical record. The parameters of the follow-up electronic medical record generation model are adjusted based on the total reward value.

7. The method according to claim 6, characterized in that, The training process of the follow-up visit-specific reward model includes: The training data for the current follow-up visit and the training data for previous visits are processed by the follow-up visit electronic medical record generation model to obtain the third follow-up visit electronic medical record. The total reward value of the third follow-up visit electronic medical record is calculated using the follow-up visit-specific reward model, and the mean square error of the total reward value and the preset standard value is calculated to obtain the third loss value. If the weight of at least one of the reward items is greater than the benchmark weight, the difference between the weight of each reward item and the benchmark weight is calculated to obtain the weight difference of each reward item, wherein the benchmark weight is the minimum weight between the weight of the continuity reward item and the weight of the accuracy of disease change reward item. If the weight difference of each reward item is greater than 0, then the weight differences of each reward item are summed to obtain the fourth loss value. Under preset constraints, the weights of each reward item are adjusted according to the third loss value and the fourth loss value. The preset constraints include: the weight of the continuity and coherence reward item is greater than or equal to a first preset value, the weight of the accuracy of disease change reward item is greater than or equal to a second preset value, and the sum of the weights of each reward item is 1.

8. A device for generating electronic medical records for follow-up visits, characterized in that, include: The input encoding module is used to encode the data from the current follow-up visit to obtain the feature vector of the current follow-up visit, and to encode the data from previous visits to obtain the feature vector of previous visits. The previous medical information reuse module is used to perform cross-attention calculation on the feature vector of the current follow-up visit and the feature vector of the previous medical visits to obtain a fused feature vector; The disease condition change recognition module is used to calculate the difference between the previous medical visit feature vector and the fused feature vector to obtain the disease condition change vector; The medical record generation module is used to decode the disease change vector to obtain the target follow-up electronic medical record.

9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for generating electronic medical records for follow-up visits as described in any one of claims 1 to 7.

10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method for generating electronic medical records for follow-up visits as described in any one of claims 1 to 7.