Electronic medical record generation method, device, apparatus and medium
By constructing structured data templates and medical rule knowledge bases for target departments, and fine-tuning the general medical language model using small sample medical records, the problems of data heterogeneity and interpretability in the generation of cross-departmental electronic medical records were solved. This enabled the efficient generation of electronic medical records for newly established departments and compliance with clinical standards, reducing costs and increasing trust.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- RUIJIN HOSPITAL AFFILIATED TO SHANGHAI JIAO TONG UNIV SCHOOL OF MEDICINE
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-05
AI Technical Summary
When expanding the electronic medical record generation system from established departments to new departments, problems such as increased cross-departmental data heterogeneity, high R&D costs, and lack of model interpretability are encountered, leading to difficulties in data integration, information omissions, and a widening clinical trust gap.
We construct a structured data template and medical rule knowledge base specific to the target department, generate prompt words, fine-tune the general medical language model, and adapt the model by combining small sample medical records to ensure that the generated electronic medical records comply with clinical standards.
It reduces the difficulty and R&D cost of cross-departmental data adaptation, improves the interpretability of the model and the accuracy of medical record generation, realizes the efficient and high-fidelity generation of electronic medical records for newly established departments, and supports the large-scale promotion of smart healthcare.
Smart Images

Figure CN122157931A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer processing technology, and in particular to methods, apparatus, equipment and media for generating electronic medical records. Background Technology
[0002] In the field of smart healthcare, EMR (Electronic Medical Record) is the core carrier for clinical diagnosis and treatment, scientific research, and hospital management. Utilizing LLM (Large Language Model) to achieve AI (Artificial Intelligence) for automatic generation of electronic medical records has become an important direction for reducing doctors' paperwork burden and standardizing medical record writing, and has been initially implemented in some mature departments. However, when expanding such systems to newly established or previously uncovered departments, multiple bottlenecks are currently faced: First, the heterogeneity of cross-departmental data is intensifying. Data from newly established departments comes from multiple heterogeneous systems with significant differences in field naming and units. Furthermore, their disease spectrum and treatment processes differ from those of the original departments, making it impossible to match the required core data from the original systems. This leads to information omissions and interpretation errors during data integration, making it difficult for AI models to adapt. Second, the "cold start" dilemma for newly established departments is prominent. Currently, it is necessary to re-collect, clean, label, and train models. Labeling consumes a significant amount of expert time, and the model cannot reuse original parameters due to differences in treatment logic. It is also necessary to address the issue of data and process dynamic adjustments leading to the invalidation of results, resulting in high R&D costs. Third, the model lacks interpretability. The "black box" nature of LLM means that doctors in newly established departments cannot know the basis for AI-generated medical records, and there is a lack of clinical verification mechanisms. This easily leads to situations where the "grammar is correct but the clinical results are incorrect," exacerbating the clinical trust gap and hindering the system's implementation.
[0003] In summary, when expanding electronic medical record generation systems from established departments to new departments, reducing the difficulty of adapting and compatibility of cross-departmental data, increasing R&D costs, and improving model interpretability are problems that need to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide an electronic medical record generation method, apparatus, device, and medium, which reduces the difficulty and development cost of cross-departmental data heterogeneity and adaptation, and improves model interpretability when expanding the electronic medical record generation system from mature departments to new departments. The specific solution is as follows: Firstly, this application discloses a method for generating electronic medical records, including: Construct a target structured data template corresponding to the target department; wherein, the target department is a newly established department in a medical institution; A medical rule knowledge base specific to the target department is constructed based on a set of clinical norms. Based on the target structured data template and the medical rule knowledge base, prompt words are generated, and the general medical language model is fine-tuned using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department. The current patient data, standardized by the target structured data template, is input into the target electronic medical record generation model to output the electronic medical record corresponding to the target department.
[0005] Optionally, the construction of the target structured data template corresponding to the target department includes: Configure the target fields required for the target department and the field attributes of each target field; Construct the medical record structure of the target department based on the target field and the field attributes; Establish a configuration file for the target department; the configuration file contains the mapping rules between the original fields in the medical institution and the target fields; Based on the medical record structure and the configuration file, a target structured data template corresponding to the target department is constructed.
[0006] Optionally, the step of establishing the configuration file for the target department includes: The system receives metadata from various data information systems within the medical institution through a pre-defined data interface; these data information systems include any one or more of the following systems: hospital information system, laboratory information system, image archiving and communication system, radiology information system, and clinical information system. Construct mapping rules between the original fields of the metadata and the target fields to obtain the configuration file for the target department.
[0007] Optionally, the prompt words include the roles of a preset general medical language model, constraints generated based on the medical rule knowledge base, target patient data after standardizing historical patient data using the target structured data template, and medical record output requirements corresponding to the medical record structure.
[0008] Optionally, the step of fine-tuning the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model for the target department includes: A low-rank matrix is introduced into the attention layer of the general medical language model, and the original parameters of the general medical language model other than the low-rank matrix are frozen. The parameters of the low-rank matrix in the general medical language model are fine-tuned using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department.
[0009] Optionally, after inputting the current patient data, standardized by the target structured data template, into the target electronic medical record generation model to output the electronic medical record corresponding to the target department, the method further includes: Feedback information from the electronic medical record is obtained through a preset information interface; wherein, the feedback information is generated when the electronic medical record is reviewed and corrected. Based on the feedback information, the medical rule knowledge base and the target electronic medical record generation model are optimized to obtain a new target electronic medical record generation model.
[0010] Optionally, the construction of the medical rule knowledge base specific to the target department based on the set of clinical norms includes: The original set of clinical guidelines is structured to obtain the final set of clinical guidelines; wherein, the set of clinical guidelines includes national treatment guidelines, departmental clinical pathways, drug instructions, and rules and regulations of medical institutions; Obtain the first set of the final clinical guidelines in natural language description form, and convert the final clinical guidelines into machine-executable logical expressions to obtain the second set; A medical rule knowledge base specific to the target department is constructed based on the first set and the second set; Accordingly, the step of generating prompt words based on the target structured data template and the medical rule knowledge base includes: The target knowledge rule is retrieved from the first set or the second set of the medical rule knowledge base, and prompt words are generated based on the target structured data template and the target knowledge rule.
[0011] Secondly, this application discloses an electronic medical record generation device, comprising: The template building module is used to build a target structured data template corresponding to the target department; wherein, the target department is a newly established department in a medical institution; The knowledge base building module is used to construct a medical rule knowledge base specific to the target department based on the set of clinical guidelines; The model acquisition module is used to generate prompt words based on the target structured data template and the medical rule knowledge base, and to fine-tune the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department. The medical record generation module is used to input the current patient data, which has been standardized by the target structured data template, into the target electronic medical record generation model to output the electronic medical record corresponding to the target department.
[0012] Thirdly, this application discloses an electronic device, including: Memory, used to store computer programs; A processor is configured to execute the computer program to implement the steps of the aforementioned disclosed electronic medical record generation method.
[0013] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed electronic medical record generation method.
[0014] The beneficial effects of this application are as follows: A target structured data template corresponding to a target department is constructed; wherein the target department is a newly established department in a medical institution; a medical rule knowledge base dedicated to the target department is constructed based on a set of clinical norms; prompt words are generated according to the target structured data template and the medical rule knowledge base, and a general medical language model is fine-tuned using the target small sample medical records of the target department and the prompt words to obtain a target electronic medical record generation model for the target department; current patient data standardized by the target structured data template is input into the target electronic medical record generation model to output the electronic medical record corresponding to the target department. Therefore, by constructing a target structured data template corresponding to the newly established target department, a unified data intermediate representation layer can be established for that department. Building a medical rule knowledge base specifically for the target department based on a set of clinical norms provides clear clinical constraints during the medical record generation process, ensuring that the generated electronic medical records meet clinical compliance requirements, reducing logical errors, factual deviations, and non-compliance with treatment guidelines that may occur with pure large language models, and improving the clinical accuracy and security of medical record content. Using the target structured data template and medical rule knowledge base to generate prompt words, and combining this with small sample medical records of the target department to fine-tune the general medical large language model, the small sample adaptive fine-tuning reduces the new department's dependence on large amounts of high-quality labeled data, alleviating the "cold start" problem for new departments. By guiding the model to learn the unique diagnostic and treatment logic, medical record writing style, and key indicator focus of the target department through rule constraints in prompts, only a few model parameters need to be updated to achieve rapid adaptation of the model to the new department, significantly reducing R&D and implementation costs and shortening the project deployment cycle. By inputting current patient data standardized by the target structured data template into the fine-tuned target electronic medical record generation model, it can directly use the standardized data and the adapted model to quickly generate electronic medical records that meet the needs of the target department, achieving efficient and high-fidelity generation of electronic medical records for the new department. Moreover, the entire solution has a high degree of flexibility and configurability, and can adapt to the needs of the new department without major changes to the core architecture, improving the technology reuse rate and providing support for the large-scale promotion of smart healthcare in medical institutions. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0016] Figure 1 This is a flowchart of an electronic medical record generation method disclosed in this application; Figure 2 This is a schematic diagram illustrating a specific optimization method for generating electronic medical records disclosed in this application; Figure 3 This is a schematic diagram illustrating a specific method of generating cross-departmental electronic medical records as disclosed in this application; Figure 4 This is a schematic diagram of the structure of an electronic medical record generation device disclosed in this application; Figure 5 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0017] 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 the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0018] In the field of smart healthcare, EMR (Electronic Medical Records) is a core component of clinical diagnosis, research, and hospital management. Utilizing LLM (Large Language Model) to automate electronic medical record generation through AI has become an important direction for reducing doctors' paperwork burden and standardizing medical record writing, and it has been initially implemented in some established departments. However, expanding such systems to newly established or previously uncovered departments currently faces multiple bottlenecks: First, the heterogeneity of cross-departmental data is intensifying. Data from newly established departments comes from multiple heterogeneous systems with significant differences in field naming and units. Furthermore, their disease spectrum and treatment processes differ from those of the original departments, making it impossible to match the required core data from the original systems. This leads to information omissions and interpretation errors during data integration, making it difficult for AI models to adapt. Second, the "cold start" dilemma for newly established departments is prominent. Currently, it is necessary to re-collect, clean, label, and train models. Labeling consumes a significant amount of expert time, and the model cannot reuse original parameters due to differences in treatment logic. It is also necessary to address the issue of data and process dynamic adjustments leading to the invalidation of results, resulting in high R&D costs. Third, the model lacks interpretability. The "black box" nature of LLM means that doctors in newly established departments cannot know the basis for AI-generated medical records, and there is a lack of clinical verification mechanisms. This easily leads to situations where the "grammar is correct but the clinical results are incorrect," exacerbating the clinical trust gap and hindering the system's implementation.
[0019] To this end, this application provides an electronic medical record generation solution that reduces the difficulty and development cost of cross-departmental data heterogeneity and adaptation when expanding the electronic medical record generation system from mature departments to new departments, and improves the interpretability of the model.
[0020] See Figure 1 As shown in the figure, this application discloses an electronic medical record generation method, including: Step S11: Construct a target structured data template corresponding to the target department; wherein, the target department is a newly established department in a medical institution.
[0021] In this embodiment, constructing a target structured data template corresponding to the target department includes: setting the target fields required by the target department and the field attributes of each target field; constructing the medical record structure of the target department based on the target fields and the field attributes; establishing a configuration file for the target department; the configuration file is a mapping rule between the original fields in the medical institution and the target fields; and constructing a target structured data template corresponding to the target department based on the medical record structure and the configuration file.
[0022] When a medical institution establishes a new target department, it first identifies the target fields required for generating structured medical records, based on the department's clinical business needs and data usage scenarios. These fields cover core modules such as patient basic information, laboratory test results, treatment plans, and narrative text paragraphs. Simultaneously, standardized field attributes are defined for each target field, including data type, unit, reference range, whether it is required, and semantic constraints. Then, based on the identified target fields and their corresponding attributes, a unified medical record structure is built, logically clear and adapted to the department's diagnostic and treatment processes and medical record writing habits. This structure is independent of any existing source systems within the medical institution, serving as a standard framework for data storage and interaction in the target department. Next, various original business processes within the medical institution are addressed. The system establishes configuration files (Profiles) corresponding to the target department. These configuration files record the mapping rules between the original fields and target fields in the original system using structured JSON format. They clearly define specific mapping relationships such as field name conversion, unit standardization, and data calculation logic (e.g., calculating drug dosage based on weight). If any original field is missing, the corresponding target field is explicitly left blank in the mapping rules. The system also supports updating the configuration file to adapt to new data sources or field changes without altering the core logic. Finally, the system integrates the constructed medical record structure and configuration files to form a target structured data template (Department-Specific Structured Template, or DSST) capable of standardizing heterogeneous original data. Examples of such templates are shown in Table 1. Table 1. DSST fragments from the Endocrinology Department
[0023] This template serves as a unified data intermediate representation layer. It can automatically convert unstructured or semi-structured raw data from different source systems into standardized structured data required by the target department by reading the configuration file, providing a solid data foundation for subsequent medical rule injection, model fine-tuning, and medical record generation.
[0024] In this embodiment, establishing the configuration file for the target department includes: receiving metadata from various data information systems in the medical institution through a preset data interface; the data information systems include any one or more systems such as hospital information system, laboratory information system, image archiving and communication system, radiology information system, and clinical information system; constructing mapping rules between the original fields of the metadata and the target fields to obtain the configuration file for the target department.
[0025] Through pre-defined data interfaces supporting HTML (HyperText Markup Language), JSON (JavaScript Object Notation), XML (eXtensible Markup Language) protocols and direct database connections, it receives data from various medical institutions, including Hospital Information System (HIS), Laboratory Information System (LIS), Picture Archiving and Communication Systems (PACS), Radiology Information System (RIS), and Clinical Information System (CIS). Metadata output from one or more data information systems, such as a CIS (Corporate Identity System), encompasses various original fields and corresponding attributes related to patient diagnosis and treatment within each system. Based on the target fields and their attributes defined in the target department's structured data template, and combined with clinical business needs and data usage scenarios, mapping rules between original fields and target fields in the metadata are constructed. These rules clarify the name correspondence between original and target fields, standardized unit criteria, and data calculation logic. Furthermore, rules for leaving target fields blank in cases of missing original fields are defined. All mapping rules are stored in structured JSON format, forming a configuration file bound to the target department and its corresponding data source. This configuration file supports flexible updates to adapt to new data sources or field changes without altering the core system logic, as shown in Table 2. Table 2 Examples of DSST conversion from different source systems
[0026] Each department or data source can have a corresponding configuration file that defines how to map specific fields and codes of the source system to standard department-specific structured data template properties. For example, a configuration file could specify: "Map the source system field PATIENT_ID to the template property Patient.resourceType; map the source system field LAB_RESULT_VALUE to the template property Observation.value[x], and map the unit to the template property Observation.unit." This approach avoids hard coding and achieves high flexibility and configurability.
[0027] Step S12: Construct a medical rule knowledge base specific to the target department based on the set of clinical norms.
[0028] In this embodiment, the step of constructing a medical rule knowledge base specific to the target department based on a set of clinical norms includes: performing structured processing on the original set of clinical norms to obtain a final set of clinical norms; wherein, the set of clinical norms includes national treatment guidelines, departmental clinical pathways, drug instructions, and regulations of medical institutions; obtaining a first set of the final set of clinical norms in natural language description form, and converting the final set of clinical norms into machine-executable logical expressions to obtain a second set; and constructing a medical rule knowledge base specific to the target department based on the first set and the second set.
[0029] First, we collect a set of original clinical guidelines, including national treatment guidelines, clinical pathways for the target department, drug instructions, and rules and regulations of medical institutions. Then, we combine these with the disease spectrum, treatment process, and medical record writing requirements of the target department to screen, refine, and organize the original clinical guidelines into a structured form. We remove content that is irrelevant or redundant to the target department and clarify the core clinical constraints in the guidelines, such as diagnostic criteria, treatment principles, drug contraindications, dosage restrictions, and mandatory indicators. This results in a final set of clinical guidelines that is adapted to the actual application scenario of the target department.
[0030] Subsequently, the content that clearly describes the clinical requirements, constraints, and execution standards in natural language from the final set of clinical guidelines is extracted to form the first set. At the same time, the quantifiable and logical core rules in the final set of clinical guidelines are converted into logical expressions in programming languages such as Python in a machine-recognizable and executable format, clarifying the rule triggering conditions, judgment logic, and output results, forming the second set. The natural language description of each rule is bound to a machine-executable logical expression one by one.
[0031] Finally, the first and second sets are organized and stored in a database to construct a medical rule knowledge base dedicated to the target department. This knowledge base supports full-text retrieval of the natural language description portion of the first set by keywords such as "insulin" and "diagnosis," quickly locating relevant rules and calling the corresponding machine-executable logical expressions of the second set. At the same time, it can reverse match the corresponding natural language description through quantitative indicators in DSST, providing accurate and usable medical rule support for context constraint injection before electronic medical record generation and compliance verification after generation, as shown in Table 3. Table 3 Examples of Medical Rule Knowledge Base
[0032] Step S13: Generate prompt words based on the target structured data template and the medical rule knowledge base, and fine-tune the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department.
[0033] In this embodiment, generating prompt words based on the target structured data template and the medical rule knowledge base includes: retrieving target knowledge rules from the first set or the second set of the medical rule knowledge base, and generating prompt words based on the target structured data template and the target knowledge rules.
[0034] Based on the diagnosis and treatment scenario of the target department and the preliminary information of the current patient after standardization through the target structured data template (such as diagnostic tendency, medication, test results, etc.), relevant target knowledge rules are located in the first set of the medical rule knowledge base (a set of clinical norms in the form of natural language description) by keyword full-text search, and prompt words are generated according to the target structured data template and the target knowledge rules.
[0035] In this embodiment, the prompt words include the roles of a preset general medical language model, constraints generated based on the medical rule knowledge base, target patient data after standardizing historical patient data using the target structured data template, and medical record output requirements corresponding to the medical record structure.
[0036] Based on a medical rule knowledge base, relevant medical rules are retrieved according to the target department's diagnosis and treatment scenario and the patient's preliminary information (such as diagnostic tendencies, medication history, and laboratory test results), and the resulting structured clinical constraints (such as the insulin starting dose not exceeding 0.3) are transformed into these constraints. The system uses U / kg / day and diagnostic criteria for specific indicators to be met, etc. After standardizing and transforming historical patient data using a target structured data template, it presents the patient's basic information, test results, treatment-related data, and other target patient data in natural language, along with explicit output requirements corresponding to the target department's medical record structure. These requirements include, for example, writing in the order of chief complaint, present illness, past medical history, physical examination, auxiliary examinations, diagnosis, and treatment plan. The treatment plan must clearly specify the drug type, dosage calculation process, and basis. The prompts include a pre-defined role in a general medical language model with professional clinical experience in the target department (e.g., an attending physician in endocrinology with 10 years of experience), the aforementioned constraints, the standardized target patient data, and the medical record output requirements. Through a combination of "role guidance + rule constraints + data-driven + structure control," the system ensures that the general medical language model can generate electronic medical records that conform to the target department's clinical standards, are accurate, and have a well-structured structure, as shown in Table 4. Table 4. Actual Prompt Examples
[0037] In this embodiment, the step of fine-tuning the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department includes: introducing a low-rank matrix into the attention layer of the general medical language model, freezing the original parameters of the general medical language model other than the low-rank matrix, and fine-tuning the parameters of the low-rank matrix in the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department.
[0038] For the "cold start" scenario where initial labeled data for the target department is scarce, a small number of high-quality medical records are selected from the limited historical medical records of that department as the target small sample medical records. After manual labeling, training data adapted to fine-tuning needs is formed. Based on a general medical large language model that focuses on the medical field, has been pre-trained with massive amounts of medical text and code, and has powerful natural language generation and understanding capabilities, LoRA (Low-Rank) is adopted. This adaptive parameter fine-tuning technique introduces a trainable low-rank decomposition matrix into the Transformer attention mechanism module of the model. Simultaneously, all original parameters in the general medical language model, except for this low-rank matrix, are frozen, with only the low-rank matrix used as an updatable parameter. Subsequently, prompts with characteristics of "role guidance + rule constraint + data-driven + structure control" generated from the target structured data template and medical rule knowledge base are matched and combined with a small sample of target medical records to construct fine-tuned samples. Through small-sample learning, the parameters of the low-rank matrix in the general medical language model are specifically fine-tuned, enabling the model to quickly learn the target department's unique narrative style, diagnostic logic, key indicators (such as specific test items, drug dosage calculation standards, etc.), and medical record writing requirements. This reduces confusion with terminology from other departments, ultimately resulting in a target electronic medical record generation model adapted to the clinical scenario of the target department and capable of generating high-quality, compliant electronic medical records. Furthermore, this fine-tuning method updates only about 0.1% of the trainable parameters, significantly reducing computational and storage overhead, while supporting rapid iteration and secure isolation between departmental models.
[0039] In a specific case of small-sample adaptive fine-tuning, 10 high-quality samples conforming to the department's diagnostic and treatment logic and medical record writing standards were selected from the department's only 200 unstructured historical medical records and used as small-sample fine-tuning data. LoRA (Low-Rank Adaptation) technology was employed to efficiently fine-tune the parameters of a basic medical language model focused on the medical field, pre-trained with massive amounts of medical text and code, and possessing powerful natural language generation and understanding capabilities. This technology, without altering the core model architecture, inserts a trainable low-rank decomposition matrix into the Transformer attention mechanism module of the general medical language model, while freezing all original parameters except for this low-rank matrix. Only the parameters of the low-rank matrix are updated. The total number of parameters in these low-rank matrices typically accounts for only about 0.1% of the original model parameters, significantly reducing the computational and storage overhead during fine-tuning. This fine-tuning method supports rapid iteration while ensuring safe isolation between departmental models (LoRA modules from different departments do not interfere with each other, avoiding model parameter confusion). The goals of this fine-tuning are clear, including enabling the model to learn the unique narrative style of the target department (such as endocrinology) (e.g., emphasizing exclusive recording modules such as "diet and exercise log"), improving the model's sensitivity to the identification and application of key indicators of the target department (such as glycated hemoglobin HbA1c, insulin dosage, etc.), and reducing the model's misuse of source department (such as cardiology) exclusive terminology (such as "cardiac function classification"), avoiding cross-departmental terminology confusion, and ensuring that the model can adapt to the clinical scenario needs of the target department.
[0040] Step S14: Input the current patient data, which has been standardized by the target structured data template, into the target electronic medical record generation model to output the electronic medical record corresponding to the target department.
[0041] The current patient data (including standardized content such as basic patient information, test results, and treatment-related data) standardized by the target structured data template (DSST) is input into the target electronic medical record generation model, which has been fine-tuned by the target department's small sample medical records and structured prompts. The model combines its learned narrative style, diagnosis and treatment logic, and sensitivity to key indicators of the target department with the clinical constraints in the medical rule knowledge base to output the corresponding electronic medical record that conforms to the clinical norms of the target department, is accurate, and has a regular structure.
[0042] In this embodiment, after inputting the current patient data standardized by the target structured data template into the target electronic medical record generation model to output the electronic medical record corresponding to the target department, the method further includes: obtaining feedback information of the electronic medical record through a preset information interface; wherein, the feedback information is information generated when reviewing and correcting the electronic medical record; and optimizing the medical rule knowledge base and the target electronic medical record generation model based on the feedback information to obtain a new target electronic medical record generation model.
[0043] For example Figure 2 As shown, after the step of outputting the electronic medical record for the target department, the process also includes obtaining feedback information generated by clinical experts when reviewing and correcting the electronic medical record through a preset information interface. The feedback information includes correction opinions and optimization suggestions on the accuracy, compliance, narrative completeness, and standardization of terminology in the clinical content of the medical record. Subsequently, based on the feedback information, the rule content (including natural language descriptions and corresponding machine-executable logical expressions) in the medical rule knowledge base is supplemented, corrected, and improved through small-sample learning. At the same time, the low-rank matrix parameters introduced by LoRA technology in the target electronic medical record generation model are iteratively updated to continuously optimize the model's adaptability to the target department's diagnosis and treatment scenarios and the quality of medical record generation. Finally, a new target electronic medical record generation model with better performance and stronger clinical applicability is obtained, forming a closed-loop iterative mechanism of "generation-review-feedback-optimization".
[0044] like Figure 3 As shown, the technical path adopted in this embodiment has high portability. When it is extended to other departments, only the operations shown in Table 5 need to be performed. The core large language model, rule architecture and generation-verification process do not need to be changed, truly realizing "build once and reuse in multiple departments", which significantly improves the deployment efficiency and economy of AI medical system.
[0045] Table 5 Examples of Key Rules for Transferring Between Different Departments
[0046] In summary, this embodiment effectively solves the core challenges of data heterogeneity, inconsistent standards, and scarce cold-start data in cross-departmental electronic medical record generation by constructing department-specific structured data templates, integrating explicit medical rules, and combining lightweight model fine-tuning and closed-loop verification mechanisms, without relying on external medical data standards. This method is low-cost, clinically safe, and fast to migrate, demonstrating outstanding practicality and broad application prospects.
[0047] The beneficial effects of this application are as follows: A target structured data template corresponding to a target department is constructed; wherein the target department is a newly established department in a medical institution; a medical rule knowledge base dedicated to the target department is constructed based on a set of clinical norms; prompt words are generated according to the target structured data template and the medical rule knowledge base, and a general medical language model is fine-tuned using the target small sample medical records of the target department and the prompt words to obtain a target electronic medical record generation model for the target department; current patient data standardized by the target structured data template is input into the target electronic medical record generation model to output the electronic medical record corresponding to the target department. Therefore, by constructing a target structured data template corresponding to the newly established target department, a unified data intermediate representation layer can be established for that department. Building a medical rule knowledge base specifically for the target department based on a set of clinical norms provides clear clinical constraints during the medical record generation process, ensuring that the generated electronic medical records meet clinical compliance requirements, reducing logical errors, factual deviations, and non-compliance with treatment guidelines that may occur with pure large language models, and improving the clinical accuracy and security of medical record content. Using the target structured data template and medical rule knowledge base to generate prompt words, and combining this with small sample medical records of the target department to fine-tune the general medical large language model, the small sample adaptive fine-tuning reduces the new department's dependence on large amounts of high-quality labeled data, alleviating the "cold start" problem for new departments. By guiding the model to learn the unique diagnostic and treatment logic, medical record writing style, and key indicator focus of the target department through rule constraints in prompts, only a few model parameters need to be updated to achieve rapid adaptation of the model to the new department, significantly reducing R&D and implementation costs and shortening the project deployment cycle. By inputting current patient data standardized by the target structured data template into the fine-tuned target electronic medical record generation model, it can directly use the standardized data and the adapted model to quickly generate electronic medical records that meet the needs of the target department, achieving efficient and high-fidelity generation of electronic medical records for the new department. Moreover, the entire solution has a high degree of flexibility and configurability, and can adapt to the needs of the new department without major changes to the core architecture, improving the technology reuse rate and providing support for the large-scale promotion of smart healthcare in medical institutions.
[0048] See Figure 4 As shown in the figure, this application discloses an electronic medical record generation device, including: Template construction module 11 is used to construct a target structured data template corresponding to the target department; wherein, the target department is a newly established department in a medical institution; The knowledge base building module 12 is used to construct a medical rule knowledge base specific to the target department based on the set of clinical norms. The model acquisition module 13 is used to generate prompt words based on the target structured data template and the medical rule knowledge base, and to fine-tune the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department. The medical record generation module 14 is used to input the current patient data, which has been standardized by the target structured data template, into the target electronic medical record generation model, so as to output the electronic medical record corresponding to the target department.
[0049] Furthermore, embodiments of this application also provide an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0050] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the electronic medical record generation method performed by the electronic device disclosed in any of the foregoing embodiments.
[0051] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0052] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0053] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.
[0054] The operating system 221 manages and controls the various hardware devices and computer programs 222 on the electronic device to enable the processor 21 to perform calculations and processing on the massive amounts of data 223 in the memory 22. The operating system can be Windows, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the electronic medical record generation method executed by the electronic device as disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the electronic device from external devices, as well as data collected by its own input / output interface 25.
[0055] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed electronic medical record generation method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0056] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0057] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly in hardware, software modules executed by a processor, or a combination of both. The software module may be located in random access memory (RAM), memory, read-only memory (ROM), electrically programmable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the art.
[0058] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 said element.
[0059] The present invention provides a detailed description of an electronic medical record generation method, apparatus, device, and medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating electronic medical records, characterized in that, include: Construct a target structured data template corresponding to the target department; wherein, the target department is a newly established department in a medical institution; A medical rule knowledge base specific to the target department is constructed based on a set of clinical norms. Based on the target structured data template and the medical rule knowledge base, prompt words are generated, and the general medical language model is fine-tuned using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department. The current patient data, standardized by the target structured data template, is input into the target electronic medical record generation model to output the electronic medical record corresponding to the target department.
2. The electronic medical record generation method according to claim 1, characterized in that, The construction of the target structured data template corresponding to the target department includes: Configure the target fields required for the target department and the field attributes of each target field; Construct the medical record structure of the target department based on the target field and the field attributes; Establish a configuration file for the target department; the configuration file contains the mapping rules between the original fields in the medical institution and the target fields; Based on the medical record structure and the configuration file, a target structured data template corresponding to the target department is constructed.
3. The electronic medical record generation method according to claim 2, characterized in that, The configuration file for establishing the target department includes: The system receives metadata from various data information systems within the medical institution through a pre-defined data interface; these data information systems include any one or more of the following systems: hospital information system, laboratory information system, image archiving and communication system, radiology information system, and clinical information system. Construct mapping rules between the original fields of the metadata and the target fields to obtain the configuration file for the target department.
4. The electronic medical record generation method according to claim 2, characterized in that, The prompts include the roles of the preset general medical language model, the constraints generated based on the medical rule knowledge base, the target patient data after standardizing the historical patient data using the target structured data template, and the medical record output requirements corresponding to the medical record structure.
5. The electronic medical record generation method according to claim 1, characterized in that, The step of fine-tuning the general medical language model using a small sample of medical records from the target department and the prompt words to obtain the target electronic medical record generation model for the target department includes: A low-rank matrix is introduced into the attention layer of the general medical language model, and the original parameters of the general medical language model other than the low-rank matrix are frozen. The parameters of the low-rank matrix in the general medical language model are fine-tuned using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department.
6. The electronic medical record generation method according to claim 1, characterized in that, After inputting the current patient data, standardized by the target structured data template, into the target electronic medical record generation model to output the electronic medical record corresponding to the target department, the process further includes: Feedback information from the electronic medical record is obtained through a preset information interface; wherein, the feedback information is generated when the electronic medical record is reviewed and corrected. Based on the feedback information, the medical rule knowledge base and the target electronic medical record generation model are optimized to obtain a new target electronic medical record generation model.
7. The electronic medical record generation method according to claim 1, characterized in that, The construction of a medical rule knowledge base specific to the target department based on a set of clinical norms includes: The original set of clinical guidelines is structured to obtain the final set of clinical guidelines; wherein, the set of clinical guidelines includes national treatment guidelines, departmental clinical pathways, drug instructions, and rules and regulations of medical institutions; Obtain the first set of the final clinical guidelines in natural language description form, and convert the final clinical guidelines into machine-executable logical expressions to obtain the second set; A medical rule knowledge base specific to the target department is constructed based on the first set and the second set; Accordingly, the step of generating prompt words based on the target structured data template and the medical rule knowledge base includes: The target knowledge rule is retrieved from the first set or the second set of the medical rule knowledge base, and prompt words are generated based on the target structured data template and the target knowledge rule.
8. An electronic medical record generation device, characterized in that, include: The template building module is used to build a target structured data template corresponding to the target department; wherein, the target department is a newly established department in a medical institution; The knowledge base building module is used to construct a medical rule knowledge base specific to the target department based on the set of clinical guidelines; The model acquisition module is used to generate prompt words based on the target structured data template and the medical rule knowledge base, and to fine-tune the general medical language model using the target small sample medical records of the target department and the prompt words to obtain the target electronic medical record generation model of the target department. The medical record generation module is used to input the current patient data, which has been standardized by the target structured data template, into the target electronic medical record generation model to output the electronic medical record corresponding to the target department.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the electronic medical record generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the electronic medical record generation method as described in any one of claims 1 to 7.