CN117649913A - Electronic medical record generation method based on large language model - Google Patents
Electronic medical record generation method based on large language model Download PDFInfo
- Publication number
- CN117649913A CN117649913A CN202311701514.5A CN202311701514A CN117649913A CN 117649913 A CN117649913 A CN 117649913A CN 202311701514 A CN202311701514 A CN 202311701514A CN 117649913 A CN117649913 A CN 117649913A
- Authority
- CN
- China
- Prior art keywords
- language model
- large language
- medical
- data
- medical record
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 24
- 238000012549 training Methods 0.000 claims abstract description 27
- 238000012545 processing Methods 0.000 claims description 10
- 238000012360 testing method Methods 0.000 claims description 9
- 238000013507 mapping Methods 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 claims description 5
- 238000012795 verification Methods 0.000 claims description 5
- 238000004140 cleaning Methods 0.000 claims description 4
- 238000010276 construction Methods 0.000 claims description 4
- 230000000694 effects Effects 0.000 claims description 4
- 238000000605 extraction Methods 0.000 claims description 3
- 230000006870 function Effects 0.000 claims description 3
- 230000003993 interaction Effects 0.000 claims description 3
- 238000013450 outlier detection Methods 0.000 claims description 3
- 230000011218 segmentation Effects 0.000 claims description 3
- 230000009849 deactivation Effects 0.000 claims description 2
- 230000007246 mechanism Effects 0.000 claims description 2
- 238000003745 diagnosis Methods 0.000 abstract description 5
- 239000011159 matrix material Substances 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000007721 medicinal effect Effects 0.000 description 3
- 239000008186 active pharmaceutical agent Substances 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 229940079593 drug Drugs 0.000 description 2
- 239000003814 drug Substances 0.000 description 2
- 238000002372 labelling Methods 0.000 description 2
- 208000024891 symptom Diseases 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 201000010099 disease Diseases 0.000 description 1
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000002265 prevention Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
Landscapes
- Medical Treatment And Welfare Office Work (AREA)
Abstract
The invention provides a large-scale language model-based electronic medical record generation method, which relates to the technical field of medical record generation and comprises the following steps: s1, constructing a large language model and a vector database; s2, storing and retrieving a large language model training set by using a vector database; step S3, adapting the large language model to the environment of the electronic medical record; step S4, applying the trained large language model to new and unseen cases; by constructing a vector database and a large language model, the text in the medical field can be accurately understood and generated, so that the text of the electronic medical record meeting the requirements can be automatically generated according to keywords and diagnosis key points input by doctors, the tedious and repeated labor of inputting a large amount in the traditional filling manner is avoided, and related history medical records can be automatically and rapidly searched and matched, so that more comprehensive medical information and reference basis can be provided for medical staff.
Description
Technical Field
The invention relates to the technical field of medical record generation, in particular to an electronic medical record generation method based on a large language model.
Background
Medical records are records of medical activities such as occurrence, development and transformation of diseases of patients by medical staff and examination, diagnosis and treatment of patients. The collected data is also summarized, arranged and comprehensively analyzed, and the medical health file of the patient is written according to a specified format and requirements. Has important effects on medical treatment, prevention, teaching, scientific research, hospital management and the like.
With the development of electronic information technology, electronic medical records are increasingly applied to the medical activity process. However, the current electronic medical record only provides an electronic medical record template for a certain medical link in the process of medical activity, and medical staff of each medical link inputs medical data in the electronic medical record template to generate a final electronic medical record for the medical link.
However, the electronic medical record generating method in the general technology has the following disadvantages: the traditional electronic medical record requires medical staff to input a large amount of medical data to generate a final electronic medical record aiming at the medical link, the filling mode is complex, a large amount of repeated labor is provided, the working efficiency is low, and the medical staff cannot refer to the relevant historical medical record because the basic information of the patient and the characteristics of the medical record are automatically matched, so that the medical staff is inconvenient to use.
Disclosure of Invention
The invention aims to provide an electronic medical record generating method based on a large language model, which aims to solve the problems that the electronic medical record generating method in the prior art is low in working efficiency and inconvenient to use.
In order to achieve the above purpose, the invention adopts the following technical scheme: the electronic medical record generating method based on the large language model comprises the following steps:
s1, constructing a large language model and a vector database;
s2, storing and retrieving a large language model training set by using a vector database, and training a large language model;
step S3, adapting the large language model to the environment of the electronic medical record, transmitting the key medical data of the patient to the large language model by taking the key medical data of the patient as input, then acquiring the medical record generated by the large language model, and automatically matching similar cases to medical staff for reference;
and S4, applying the trained large language model to new and unseen cases to generate a new medical record report.
The beneficial effects are that: through constructing a vector database and a large language model and training the large language model, the text in the medical field can be accurately understood and generated, so that the text can automatically generate electronic medical record text meeting the requirements according to keywords and diagnosis points input by doctors, the complicated and repeated labor of inputting a large amount in the traditional filling mode is avoided, the working efficiency of the doctors is greatly improved, and related historical medical records can be automatically and rapidly searched and matched according to the basic information and medical record characteristics of patients, so that more comprehensive medical information and reference basis are provided for medical staff.
The further technical scheme of the present invention is that after the step S4, the method further includes:
s5, comparing the newly generated medical record report with an actual medical record report, and continuously improving the generation strategy and parameter values of the large language model;
and S6, deploying the large language model on a server, providing an API interface service for a user, developing a user interface, facilitating interaction between the user and the large language model, and displaying the effect of the large language model in practical application.
The further technical scheme of the invention is that the construction of the vector database in the step S1 comprises the following steps:
step S11, data acquisition, namely acquiring medical text data to a database and sorting the medical text data;
step S12, data cleaning, namely carrying out data merging, outlier detection, missing value processing, duplicate removal and text processing on the data collected in the database;
step S13, data annotation, namely mapping text data to a low-dimensional vector space, wherein each vocabulary is mapped to a low-dimensional continuous vector space, so that a large language model has the capability of deeply understanding texts and carrying out advanced text analysis;
and S14, dividing the data, namely dividing the cleaned and marked data into a training set, a verification set and a test set.
The beneficial effects are that: by labeling the text data, the large language model can deeply understand the text and perform advanced text analysis, so that the large language model is not only limited to surface understanding of the data, but also can deeply analyze symptoms, medicines and dosage, realize highly accurate text generation, and provide reliable text support for medical practitioners in the aspects of generating medical record reports, assisting medical decisions and the like.
In a further technical solution of the present invention, in the step S11, the medical text data includes a medical record system, a textbook, clinical test data, and the like.
In the step S12, the text processing includes word segmentation, word deactivation, word stem extraction, and the like.
In a further technical scheme of the invention, in the step S2, the large language model training set includes medical terms and medical record formats.
The further technical scheme of the invention is that the training of the large language model in the step S2 comprises the following steps:
step S21, constructing a vocabulary, mapping each word in the vocabulary to a high-dimensional vector space, and adding position information to capture word sequence so that a large language model can understand the word sequence;
step S22, calculating the dependency relationship among words, capturing the long-distance dependency relationship, and providing the deep text understanding capability for the large language model;
step S23, converting the output of the large language model into the probability distribution of the required label or the next word to construct the basic structure of the large language model;
step S24, training and optimizing the large language model, calculating the loss between the predicted output and the actual output of the large language model, updating the parameters of the large language model according to the gradient of the loss function, and verifying and adjusting the learning rate, the batch size and the hidden layer size parameters;
and S25, testing and predicting error conditions of the large language model by calculating mean square error between the predicted result and the real result of the large language model.
Drawings
Fig. 1 is a flow chart of the present invention.
FIG. 2 is a flow chart of database construction in an embodiment of the invention.
FIG. 3 is a flow chart of large language model training in an embodiment of the invention.
Detailed Description
The following describes the embodiments of the present invention further with reference to the drawings.
As shown in fig. 1, the electronic medical record generating method based on the large language model includes the following steps:
s1, constructing a large language model and a vector database;
s2, storing and retrieving a large language model training set by using a vector database, training a large language model, and referencing and calling when the large language model generates a medical record text so as to make up the problem of insufficient memory of the large language model, wherein the large language model training set comprises medical terms and medical record formats;
step S3, adapting the large language model to the environment of the electronic medical record, transmitting the key medical data of the patient to the large language model by taking the key medical data of the patient as input, then acquiring the medical record generated by the large language model, and automatically matching similar cases to medical staff for reference;
step S4, applying the trained large language model to new and unseen cases to generate a new medical record report;
s5, comparing the newly generated medical record report with an actual medical record report, and continuously improving the generation strategy and parameter values of the large language model so as to improve the accuracy of generating the medical record report;
step S6, deploying the large language model to a server to provide an API interface service for a user; and developing a user interface, facilitating interaction between a user and the large language model, and displaying the effect of the large language model in practical application.
In the embodiment, through the natural language processing capability of the large language model, the electronic medical record text meeting the requirements can be automatically generated according to the keywords and the diagnosis key points input by doctors, so that the tedious and repeated labor in the traditional filling manner is avoided, the quality and the accuracy of the text can be improved, and the generated electronic medical record text is more standard and specialized.
As shown in fig. 2, the construction of the vector database in step S1 includes the following steps:
step S11, data acquisition, namely acquiring and sorting medical text data into a database, wherein the medical text data comprise a medical record system, textbooks, clinical test data and the like, the comprehensive data acquisition mode gathers knowledge in the medical field into one database, comprehensive and deep learning materials are provided for a large language model, the comprehensive data acquisition work builds a basis of a training set, and a rich corpus is provided for training of a subsequent large language model;
step S12, data cleaning, namely performing data merging, outlier detection, missing value processing, duplication removal and text processing on the data collected from the database, wherein the text processing comprises word segmentation, stop word removal, stem extraction and the like so as to ensure high quality and usability of training data;
step S13, data annotation, namely mapping text data to a low-dimensional vector space, wherein each vocabulary is mapped to a low-dimensional continuous vector space, so that a computer can better understand and process the text through the distance calculation of the vector space, and a large language model has the capability of deeply understanding the text and carrying out advanced text analysis;
in step S14, the data after cleaning and labeling is divided into a training set, a verification set and a test set, where in this embodiment, the ratio of the training set, the verification set and the test set is 4:1:1.
In step S13, the large language model is enabled to deeply understand the text and perform advanced text analysis, so that the large language model is not only limited to surface understanding of data, but also can deeply analyze symptoms, medicines and dosages, thereby realizing highly accurate text generation and providing reliable text support for medical practitioners in the aspects of generating medical record reports, assisting medical decisions and the like.
As shown in fig. 3, the training of the large language model in step S2 includes the following steps:
step S21, constructing a vocabulary, wherein the vocabulary contains all different words of medical texts, mapping each word in the vocabulary to a high-dimensional vector space through the technologies of word embedding, position coding, self-attention mechanism and the like, and adding position information to capture the word sequence so that a large language model can understand the word sequence;
step S22, calculating the dependency relationship among words, capturing the long-distance dependency relationship, and providing the deep text understanding capability for the large language model;
step S23, converting the output of the large language model into the probability distribution of the required label or the next word to construct the basic structure of the large language model;
step S24, training and optimizing a large language model, and randomly initializing parameters of a model word embedding matrix, a position coding matrix, a self-attention weight matrix and an FFN weight matrix; calculating the loss between the predicted output and the actual output of the large language model; updating parameters of the large language model according to the gradient of the loss function; verifying and adjusting the learning rate, batch size and hidden layer size parameters; stopping training when performance on the validation set begins to drop;
step S25, testing and predicting error conditions of the large language model by calculating mean square error between a predicted result and a real result of the large language model; evaluating the fitting degree of the large language model by comparing the difference between the predicted result and the real result of the large language model; evaluating the stability of the large language model by comparing the prediction results of the large language model at different times and different data; measuring the time required by the large language model to process a batch of data, dividing the time by the size of the batch of data, and evaluating the processing speed of the large language model; and measuring the consumption of CPU, memory and GPU resources used when the large language model runs, and dividing the consumption by the running time of the large language model to obtain the consumption of the computing resources of the large language model.
In the specific embodiment, the vector database and the large language model are constructed, and the large language model is trained, so that the large language model can accurately understand and generate texts in the medical field, and can automatically generate electronic medical record texts meeting requirements according to keywords and diagnosis key points input by doctors, so that complicated and repeated labor for inputting a large amount in a traditional filling manner is avoided, the working efficiency of the doctors is greatly improved, and related historical medical records can be automatically and rapidly searched and matched according to basic information and medical record characteristics of patients, so that more comprehensive medical information and reference basis are provided for medical staff.
Claims (10)
1. The electronic medical record generating method based on the large language model is characterized by comprising the following steps of:
s1, constructing a large language model and a vector database;
s2, storing and retrieving a large language model training set by using a vector database, and training a large language model;
step S3, adapting the large language model to the environment of the electronic medical record, transmitting the key medical data of the patient to the large language model by taking the key medical data of the patient as input, then acquiring the medical record generated by the large language model, and automatically matching similar cases to medical staff for reference;
and S4, applying the trained large language model to new and unseen cases to generate a new medical record report.
2. The method for generating electronic medical records based on large-scale language model according to claim 1, wherein the step S4 further comprises:
s5, comparing the newly generated medical record report with an actual medical record report, and continuously improving the generation strategy and parameter values of the large language model;
and S6, deploying the large language model on a server, providing an API interface service for a user, developing a user interface, facilitating interaction between the user and the large language model, and displaying the effect of the large language model in practical application.
3. The method for generating electronic medical records based on large-scale language model according to claim 1, wherein the construction of the vector database in step S1 comprises the following steps:
step S11, data acquisition, namely acquiring medical text data to a database and sorting the medical text data;
step S12, data cleaning, namely carrying out data merging, outlier detection, missing value processing, duplicate removal and text processing on the data collected in the database;
step S13, data annotation, namely mapping text data to a low-dimensional vector space, wherein each vocabulary is mapped to a low-dimensional continuous vector space, so that a large language model has the capability of deeply understanding texts and carrying out advanced text analysis;
and S14, dividing the data, namely dividing the cleaned and marked data into a training set, a verification set and a test set.
4. A method of generating electronic medical records based on a large language model according to claim 3, wherein in said step S11, the medical text data includes a medical record system, textbook, clinical trial data, and the like.
5. The method according to claim 3, wherein in the step S12, the text processing includes word segmentation, word deactivation, word stem extraction, and the like.
6. The method for generating electronic medical records based on large language models according to claim 1, wherein in the step S2, the large language model training set includes medical terms and medical record formats.
7. The method for generating electronic medical records based on large language models according to claim 1, wherein the training of the large language models in step S2 comprises the following steps:
step S21, constructing a vocabulary, mapping each word in the vocabulary to a high-dimensional vector space, and adding position information to capture word sequence so that a large language model can understand the word sequence;
step S22, calculating the dependency relationship among words, capturing the long-distance dependency relationship, and providing the deep text understanding capability for the large language model;
step S23, converting the output of the large language model into the probability distribution of the required label or the next word to construct the basic structure of the large language model;
step S24, training and optimizing the large language model, calculating the loss between the predicted output and the actual output of the large language model, updating the parameters of the large language model according to the gradient of the loss function, and verifying and adjusting the learning rate, the batch size and the hidden layer size parameters;
and S25, testing and predicting error conditions of the large language model by calculating mean square error between the predicted result and the real result of the large language model.
8. The method according to claim 7, wherein in the step S21, the vocabulary contains all the different words of the medical text, and each word in the vocabulary is mapped to the high-dimensional vector space by means of word embedding, position coding, and self-attention mechanism.
9. The method according to claim 7, wherein in the step S24, training is stopped when performance on the verification set starts to decrease.
10. The electronic medical record generating method based on the large language model according to claim 7, wherein in the step S25, the stability of the large language model is evaluated by comparing the prediction results of the large language model at different times and different data.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311701514.5A CN117649913A (en) | 2023-12-12 | 2023-12-12 | Electronic medical record generation method based on large language model |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311701514.5A CN117649913A (en) | 2023-12-12 | 2023-12-12 | Electronic medical record generation method based on large language model |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117649913A true CN117649913A (en) | 2024-03-05 |
Family
ID=90049310
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311701514.5A Pending CN117649913A (en) | 2023-12-12 | 2023-12-12 | Electronic medical record generation method based on large language model |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN117649913A (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118940833A (en) * | 2024-07-15 | 2024-11-12 | 北京星续科技有限公司 | Scientific research assistance system and method based on large language model |
| CN121096508A (en) * | 2025-11-13 | 2025-12-09 | 浙江和仁科技股份有限公司 | Large language model intelligent body construction method and system for personalized medical document |
| CN121122548A (en) * | 2025-11-12 | 2025-12-12 | 上海医米信息技术有限公司 | A general method, system and storage medium for generating medical records |
| CN121352041A (en) * | 2025-12-18 | 2026-01-16 | 国家心血管病中心 | Methods, apparatus and equipment for generating medical record texts |
-
2023
- 2023-12-12 CN CN202311701514.5A patent/CN117649913A/en active Pending
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118940833A (en) * | 2024-07-15 | 2024-11-12 | 北京星续科技有限公司 | Scientific research assistance system and method based on large language model |
| CN121122548A (en) * | 2025-11-12 | 2025-12-12 | 上海医米信息技术有限公司 | A general method, system and storage medium for generating medical records |
| CN121096508A (en) * | 2025-11-13 | 2025-12-09 | 浙江和仁科技股份有限公司 | Large language model intelligent body construction method and system for personalized medical document |
| CN121096508B (en) * | 2025-11-13 | 2026-02-13 | 浙江和仁科技股份有限公司 | Large language model intelligent body construction method and system for personalized medical document |
| CN121352041A (en) * | 2025-12-18 | 2026-01-16 | 国家心血管病中心 | Methods, apparatus and equipment for generating medical record texts |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN117649913A (en) | Electronic medical record generation method based on large language model | |
| CN109599185B (en) | Disease data processing method and device, electronic equipment and computer readable medium | |
| CN111370122A (en) | Knowledge guidance-based time sequence data risk prediction method and system and application thereof | |
| CN119621875B (en) | Automatic nursing corpus creating method based on knowledge graph | |
| CN117809798A (en) | Inspection report interpretation methods, systems, equipment and media based on large models | |
| CN116069946A (en) | A biomedical knowledge map construction method based on deep learning | |
| CN118430820B (en) | A method for constructing a depression risk prediction model | |
| CN117637175A (en) | Large model medical training data generation method and system based on multi-level semantics | |
| CN107944846A (en) | A kind of management of science and technology plan and service system based on innovation chain | |
| CN114840684A (en) | Map construction method, device and equipment based on medical entity and storage medium | |
| CN117893295A (en) | A method, system, device and storage medium for intelligent preparation of bidding documents | |
| CN113377962B (en) | Intelligent process simulation method based on image recognition and natural language processing | |
| CN112530582B (en) | Intelligent system for assisting classified coding of death cause | |
| CN114997263A (en) | Training rate analysis method, device, equipment and storage medium based on machine learning | |
| Wu et al. | Psychological Health Prediction Based on the Fusion of Structured and Unstructured Data in EHR: a Case Study of Low-Income Populations | |
| CN121306388A (en) | Multi-agent Real-World Clinical Efficacy Evaluation and Precision Decision-Making System | |
| CN121092894A (en) | Multi-mode data enhancement-based industrial Internet of things sensor data prediction method | |
| CN120872999A (en) | Large-model-driven efficient NL2SQL conversion system and method based on big data training | |
| CN119669403A (en) | Power grid marketing data annotation method based on perplexity-driven large language model | |
| CN116364309B (en) | Clinical trial risk assessment method and system based on neural network | |
| CN118197517A (en) | Automatic annotation system and method for electronic medical records of cerebral palsy based on cooperative learning | |
| CN118711731A (en) | AI-based clinical patient recruitment method and system | |
| CN117973901A (en) | A multi-protocol carbon measurement and accounting method based on knowledge graph | |
| Jiang et al. | Enhancing 48-hour mortality prediction through irregular multimodal clinical data with integrated icd code | |
| CN114464283A (en) | Manual labeling processing method, device, processor and storage medium based on ICD-10 depression diagnosis and treatment standard interview text |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |