Traditional Chinese medicine medical record structurization analysis method and system based on natural language processing

CN123013904APending Publication Date: 2026-10-30YIDAOYIDAO (BEIJING) INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611141232.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

针对现有技术的不足,本发明提供了基于自然语言处理的中医病历结构化解析方法及系统,解决了现有技术无法准确处理中医病历中跨字段术语复用、多片段字段支撑、否定边界语义识别不准确且解析结果缺乏全链路可追溯性的问题

Benefits of technology

(1)本发明,通过构建包含字段编码层、来源约束层和引用关系约束层的证候编码匹配模型,将跨字段引用编号和多片段承接编号作为结构化约束嵌入模型推理流程而非单纯输入特征,使模型在编码过程中保留原文语义关联和证据链关系。进而实现了证候编码匹配准确率与可解释性同步提升的效果,有效解决了现有技术中机器学习模型仅关注字段取值特征、忽略语义关联导致的匹配结果偏差大、推理过程不可解释的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013904A_ABST
    Figure CN123013904A_ABST
Patent Text Reader

Abstract

The application discloses a traditional Chinese medical record structured analysis method and system based on natural language processing and relates to the technical field of natural language processing. The traditional Chinese medical record structured analysis method based on natural language processing comprises the following steps: S1, collecting traditional Chinese medical record multi-source data and performing a preprocessing operation on the traditional Chinese medical record multi-source data; S2, reading original text fragments and field template data to construct a fragment field attribution matrix and carry out fragment attribution analysis; S3, calling field attribution records and structured input records to perform field fusion analysis; and S4, constructing a syndrome coding matching model and generating a syndrome coding matching result according to field characteristic input and traceable constraint input. The problems that the prior art cannot accurately process cross-field term reuse in traditional Chinese medical records, multi-fragment field support, inaccurate negative boundary semantic recognition and lack of full-link traceability of analysis results are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, specifically to a method and system for structured parsing of traditional Chinese medicine medical records based on natural language processing. Background Technology

[0002] With the application of electronic medical records, structured data entry pages, and interface-based data collection in TCM diagnosis and treatment informatization scenarios, fields such as chief complaint, present illness, past medical history, four diagnostic methods, tongue appearance, pulse appearance, symptom description, and syndrome-related fields in TCM medical records are gradually being stored in a way that combines text records and structured records. Natural language processing technology is often used to perform character cleaning, sentence segmentation, terminology recognition, synonym merging, negation semantic judgment, and standard field mapping on free text TCM medical records, thereby converting the descriptions of symptoms, tongue appearance, pulse appearance, and signs in the original text into searchable, statistically valid, and model-input structured fields. With the increasing demand for syndrome coding matching, syndrome element identification, and TCM medical record auxiliary analysis, structured fields are also frequently assembled as model input parameters to generate syndrome codes, field contribution results, and interface call results.

[0003] For example, the invention patent with announcement number CN116882496B discloses a method for constructing a medical knowledge base based on multi-level logical reasoning. The method includes: mapping preprocessed medical text data into character vectors, encoding potential medical terms in the medical text data, integrating the encoded information of potential medical terms into the character vectors, extracting local feature vectors of character sequences in the medical text data, and constructing a medical text feature vector sequence data with multi-feature fusion; generating a global semantic information matrix representing semantic encoding information, decoding the global semantic information matrix, and constructing a medical knowledge base.

[0004] For example, the invention patent with announcement number CN116680412B discloses a TCM prescription recommendation method based on knowledge graphs. It combines knowledge graph embedding models, multi-head attention mechanisms, and graph convolution with graph features and recommendation systems, comprehensively considering the patient's condition to recommend TCM prescriptions. Using TCM medical record descriptions as the research object, it integrates TCM knowledge graph information, draws on the clinical experience of renowned veteran TCM doctors in prescribing medication according to symptoms, and fully considers multiple personalized factors such as drug properties, efficacy, disease condition, and patient constitution. Based on the holistic principle and syndrome differentiation and treatment of TCM, it summarizes syndromes according to different symptoms and conditions of patients and selects different combinations of medicinal materials. It proposes a TCM prescription recommendation method integrating knowledge graphs, considering the complex relationship between individual signs and symptoms and drugs, and combining the specific analysis of local patterns for each prescription to recommend more reliable prescription materials for doctors and patients, providing auxiliary decision support for TCM clinical diagnosis and treatment.

[0005] However, TCM medical record texts are characterized by flexible expression, reusable words, numerous compound phrases, inconsistent distribution of negative expressions, and overlapping descriptions of tongue and pulse with symptom descriptions. The same standard term may have different meanings in different field groups, the same combined phrase may correspond to multiple standard field numbers, and the same standard field number may be supported by multiple original text fragments. If only field values ​​or syndrome codes are output, it is difficult to determine which original text fragment a field originates from, whether it is affected by negative boundaries, whether there are cross-field references, or whether there are multiple fragment succession relationships. Furthermore, TCM medical record data often originates simultaneously from free text, structured entry records, past medical history records, four diagnostic methods field records, and interface parameter records. Different sources may contain duplicate field values, conflicting field values, inconsistent field condition codes, different entry batches, and different template versions. Existing processing methods are prone to mixing up unrecorded case codes, unidentified case codes, and null values ​​during field fusion and model input parameter assembly. They are also prone to input parameter slot mismatch when the field template version number and the model version number are inconsistent, resulting in the same standard field number being assembled into different positions under different model versions, which affects the stability of subsequent syndrome coding matching results.

[0006] Therefore, in order to address the above problems, there is an urgent need for a structured parsing method and system for TCM medical records based on natural language processing. Summary of the Invention

[0007] Technical problems to be solved To address the shortcomings of existing technologies, this invention provides a structured parsing method and system for TCM medical records based on natural language processing. This solves the problems of existing technologies being unable to accurately handle cross-field terminology reuse, multi-segment field support, inaccurate recognition of negation boundary semantics in TCM medical records, and the lack of end-to-end traceability of parsing results.

[0008] Technical solution To achieve the above objectives, this invention provides the following technical solution: a structured parsing method for TCM medical records based on natural language processing, comprising: S1, collecting multi-source data of TCM medical records and performing preprocessing operations on the multi-source data; S2, reading original text fragments and field template data to construct a fragment field attribution matrix and conducting fragment attribution analysis, generating field attribution records and attribution failure markers based on the fragment attribution analysis results; S3, calling field attribution records and structured input records to perform field fusion analysis, and performing input parameter slot filling, input parameter slot rearrangement, and model input parameter table generation based on the field fusion analysis results; S4, constructing a syndrome code matching model and generating syndrome code matching results based on field feature input and traceable constraint input, and generating external call archive records and code rollback records for external call interfaces based on the syndrome code matching results.

[0009] Further, the specific steps for collecting multi-source data from TCM medical records are as follows: Collect TCM medical record text data: Read the medical record number, patient number, visit number, medical record version number, paragraph number, sentence number, original text, recording time, and modification time from the electronic medical record record; read the entry batch number, entry source code, standard field number, field value, field condition code, structured entry record, past medical history record, four diagnostic methods field record, and interface parameter record from the entry log; read the standard field number, field name, field group, and field template version number from the field template table; read the entry number, standard entry, synonym entry, combined phrase code, negation trigger word, and field group from the TCM terminology dictionary; read the syndrome model number, model version number, input parameter field order, standard field number, and syndrome code sample label from the syndrome model interface template.

[0010] Furthermore, the specific steps for preprocessing multi-source data of TCM medical records are as follows: Perform character cleaning, paragraph segmentation, sentence segmentation, and character offset numbering on the TCM medical record text data to generate original text segment numbers, character start offsets, character end offsets, and character offset ranges; generate hit mode codes according to the order of longest phrase matching, standard term precise matching, and synonym term merging matching corresponding to the combined phrase code; generate negative boundary record numbers based on negative trigger words and character offset ranges; associate standard terms with standard field numbers, field groups, and field template version numbers based on the field template table; and establish field source indexes for structured entry records, past medical history records, four diagnostic methods field records, and interface parameter records according to standard field numbers, field template version numbers, entry source codes, and entry batch numbers, respectively.

[0011] Further, the specific steps for reading original text fragments and field template data to construct fragment field attribution matrices and conduct fragment attribution analysis are as follows: construct fragment field attribution matrices using original text fragment numbers as row indexes and standard field numbers as column indexes. Matrix cells record hit mode codes, term numbers, standard terms, character start offsets, character end offsets, negation boundary record numbers, combined phrase codes, field groupings, field template version numbers, cross-field reference numbers, and multi-fragment continuation numbers. Negation boundary record numbers are generated based on the character interval between the negation trigger word and the standard term: when there are x negation trigger words, the one with the smallest character interval is selected as the negation starting point, and the sentence-ending punctuation or sentence-ending position that appears first in the same sentence is used as the negation ending point. If the negation trigger word is located at the end of the original text fragment corresponding to the previous original text fragment number, and the previous original text fragment number and the current original text fragment number belong to the same paragraph number, and there is no sentence-ending punctuation between them, then the current original text fragment number is included in the same negation boundary record number. When the same combined phrase code corresponds to multiple standard field numbers, matrix unit records are generated separately; when the same original text fragment number corresponds to multiple standard field numbers, cross-field reference numbers are generated; when the matrix units corresponding to i original text fragment numbers all point to the same standard field number, field grouping, and field template version number, and the character offset intervals do not overlap, the same multi-fragment continuation number is generated; non-empty matrix units in the fragment field attribution matrix are read row by row according to the original text fragment number. First, the hit attribution result of the matrix unit is determined based on the hit method code, term number, and standard term. Then, the structural attribution result of the matrix unit is determined based on the combined phrase code, field grouping, field template version number, cross-field reference number, and multi-fragment continuation number. Finally, the deduction attribution result of the matrix unit is determined based on the negative boundary record number, character start offset, and character end offset. The hit attribution result, structural attribution result, and deduction attribution result of each non-empty matrix unit in the same original text fragment number matrix row are summed within the row to obtain the fragment attribution value.

[0012] Further, the specific steps for generating field attribution records and attribution failure markers based on fragment attribution analysis results are as follows: By comparing fragment attribution values ​​and attribution thresholds in real time, when a fragment attribution value is less than the attribution threshold, the negative boundary record number is recalculated according to the character start offset and character end offset; the standard field number corresponding to the combined phrase code is rearranged according to the field grouping and field template version number; cross-field reference numbers are added to matrix units where the same original text fragment number points to multiple standard field numbers; and multi-fragment continuation numbers are generated for matrix units where multiple original text fragment numbers correspond to the same standard field number. If the fragment attribution value recalculated based on the corrected fragment field attribution matrix is ​​still less than the attribution threshold, an attribution failure marker is generated. When a fragment attribution value is greater than or equal to the attribution threshold, the original text fragment number, field case code, standard field number, field grouping, field template version number, field value, and multi-fragment continuation number are used to generate a field attribution record.

[0013] Further, the specific steps for field fusion analysis by calling field attribution records and structured entry records are as follows: A field comparison key is generated using the standard field number, field grouping, and field template version number. Field attribution records, structured entry records, historical records, four diagnostic field records, and interface parameter records are aggregated into field source records according to the field comparison key. If multiple source field values ​​under the same field comparison key are identical after merging synonym entries and the field condition codes are the same, a single field source record number is generated and written to the source set; otherwise, a source conflict record is generated. Field source record numbers are generated for unrecorded condition codes and unidentified condition codes, and they are not merged into the same null value record. The field source record includes the field comparison key, standard field number, field value, field condition code, entry source code, original text fragment number, entry batch number, field template version number, and source set. An entry parameter slot table is constructed based on the syndrome model number, model version number, input parameter field order, and standard field number. The deduplicated field source records are assembled into the corresponding entry parameter slots, and an entry parameter slot number is generated for each entry parameter slot.

[0014] Furthermore, based on the field fusion analysis results, the specific steps for filling input parameter slots, rearranging input parameter slots, and generating the model input parameter table are as follows: When a standard field number corresponds to multiple input parameter slots, input parameter reference records are formed respectively, constrained by the syndrome model number, model version number, and input parameter field order. The standard field number, field source record number, field case code, input parameter slot number, and field template version number are bound to the input parameter reference record. When an input parameter slot lacks a field source record number, the standard field number, field grouping, and field template version number are used as the basis for the process. The system performs slot filling from the field source record. If the input parameter slot is still missing the field source record number after filling, an input parameter gap record is generated. When the field template version number carried by the input parameter slot is inconsistent with the field template version number bound in the syndrome model interface template, a slot mapping table and a version inconsistency record are generated according to the syndrome model interface template. When there is no input parameter gap record and no version inconsistency record, a model input parameter table is generated. When there is a version inconsistency record, a model input parameter table is generated with the input parameter slot number as the association key after the input parameter slot rearrangement is completed.

[0015] Furthermore, based on the field feature inputs and traceability constraint inputs, the specific steps for constructing a syndrome code matching model and generating syndrome code matching results are as follows: Using standard field numbers, input source codes, field values, field situation codes, field source record numbers, field template version numbers, and model version numbers as field feature inputs, using cross-field reference numbers and multi-segment continuation numbers as traceability constraint inputs, and using syndrome code sample labels as training labels, a stratified random sampling method is used to construct the syndrome code matching model according to the syndrome code sample labels, field situation codes, and input source codes, and the model outputs a field contribution list and traceability constraint results. The tracing chain number, symptom code matching value, and symptom code are included. The field contribution list includes the input parameter slot number, standard field number, field contribution value, field situation code, and field source record number. The symptom code matching model includes a field coding layer, a source constraint layer, and a reference relationship constraint layer. The field coding layer is used to encode the standard field number, field value, and field situation code. The source constraint layer is used to compare the field template version number corresponding to the field source record number with the field template version number bound to the model version number. The reference relationship constraint layer is used to retain the evidence relationship corresponding to cross-field reference numbers and multi-segment continuation numbers.

[0016] Furthermore, the specific steps for generating external call archive records and code rollback records for external call interfaces based on symptom code matching results are as follows: By comparing the symptom code matching value and the matching threshold in real time, when the symptom code matching value is less than the matching threshold, the input parameter slots with field contribution values ​​less than the contribution threshold and field condition codes that are unrecognized condition codes are returned to the field source record for supplementation; the input parameter slots with field template version numbers inconsistent with the interface templates corresponding to the model version numbers are rearranged according to the order of the input parameter fields; the field features that correspond to n standard field numbers for the same original text fragment number but have empty cross-field reference numbers are removed from the sample set of this round of model update; and the multi-fragment inheritance numbers that are not empty and correspond to m original text fragment numbers, and Field features whose contribution values ​​are less than the contribution threshold are written into supplementary training samples, generating model update sample records and model update task records. Based on the supplemented field source records and rearranged input parameter slots, the model input parameter table is regenerated, and the syndrome code matching value is recalculated. If the recalculated syndrome code matching value is still less than the matching threshold, a code rollback record is generated, which includes the syndrome code, syndrome code matching value, field contribution list, and traceability chain number. When the syndrome code matching value is greater than or equal to the matching threshold, an external call verification instruction is generated, and the syndrome code, syndrome code matching value, field contribution list, traceability chain number, model version number, and field template version number are written into the external call archive record.

[0017] Furthermore, a second aspect of the present invention provides a TCM medical record structured parsing system based on natural language processing, applying a TCM medical record structured parsing method based on natural language processing, comprising: a data acquisition and preprocessing module for acquiring multi-source TCM medical record data and performing preprocessing operations on the multi-source TCM medical record data; a original text fragment field location and attribution module for reading original text fragments and field template data to construct a fragment field attribution matrix and conduct fragment attribution analysis, generating field attribution records and attribution failure markers based on the fragment attribution analysis results; a field source deduplication and input parameter assembly module for calling field attribution records and structured input records to perform field fusion analysis, performing input parameter slot filling, input parameter slot rearrangement, and model input parameter table generation based on the field fusion analysis results; and a traceable constraint syndrome code matching module for constructing a syndrome code matching model and generating syndrome code matching results based on field feature inputs and traceable constraint inputs, generating external call archive records and code rollback records for external call interfaces based on the syndrome code matching results.

[0018] The present invention has the following beneficial effects: (1) This invention constructs a syndrome coding matching model that includes a field coding layer, a source constraint layer, and a citation relationship constraint layer. Cross-field citation numbers and multi-segment continuation numbers are embedded as structured constraints into the model's reasoning process rather than simply as input features. This allows the model to retain the semantic associations and evidence chain relationships of the original text during the coding process. Consequently, it achieves a simultaneous improvement in the accuracy and interpretability of syndrome coding matching, effectively solving the problems in existing technologies where machine learning models only focus on field value features and ignore semantic associations, leading to large deviations in matching results and uninterpretable reasoning processes.

[0019] (2) This invention constructs a fragment field attribution matrix with the original text fragment number as the row index and the standard field number as the column index. The matrix cells fully record all dimensions of information, including hit method, term information, negation boundaries, cross-field references, and multi-fragment continuation, thus accurately depicting the many-to-many mapping relationship between the original text fragments and the standard fields. This further reduces the loss of field mapping information when converting TCM medical record text to structured fields, effectively solving the problems of cross-field terminology reuse loss and multi-fragment field support breakage caused by the unidirectional text entity field mapping mode in existing technologies.

[0020] (3) This invention, by optimizing the negation boundary recognition rules and combining them with the dynamic correction mechanism of the fragment field attribution matrix, can accurately define the scope of negation words and automatically correct the field mapping relationship with attribution errors, adapting to the unique multi-fragment joint description semantics of TCM medical records. This achieves accurate parsing of negation semantics and complex many-to-many semantics in TCM medical records, effectively solving the problems of ambiguous negation boundary recognition and high error rate in structured results caused by the inability to handle the dispersed symptom descriptions in TCM in existing technologies.

[0021] (4) This invention generates a unified traceable identifier across the entire parsing process, linking the original text fragments, field attribution, input parameter assembly, and syndrome coding stages through a traceability chain number. Simultaneously, it generates external call archive records and coding rollback records, achieving full traceability of the parsing process. This results in full-chain traceability and verifiability of the structured parsing results for TCM medical records, effectively solving the problems of black-box parsing processes, unverifiable results, and inability to meet the requirements for medical data traceability and audit verification in existing technologies.

[0022] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0023] Figure 1 This is a flowchart of the TCM medical record structured parsing method based on natural language processing, as described in this invention. Figure 2 This is a structural diagram of the TCM medical record structure parsing system based on natural language processing, as described in this invention. Figure 3 This is a schematic diagram of the attribution matrix for the fragment fields of the present invention; Figure 4 This is a closed-loop verification diagram before and after the parameter slot rearrangement in this invention; Figure 5 This is a schematic diagram of the external call page for the syndrome code matching results of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention 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 skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] Please see Figures 1-5 This invention provides a technical solution: a structured parsing method for traditional Chinese medicine (TCM) medical records based on natural language processing, comprising: S1, collecting multi-source data of TCM medical records and performing preprocessing operations on the multi-source data; S2, reading original text fragments and field template data to construct a fragment field attribution matrix and conducting fragment attribution analysis, generating field attribution records and attribution failure markers based on the fragment attribution analysis results; S3, calling field attribution records and structured input records to perform field fusion analysis, and performing input parameter slot filling, input parameter slot rearrangement, and model input parameter table generation based on the field fusion analysis results; S4, constructing a syndrome code matching model and generating syndrome code matching results based on field feature input and traceable constraint input, and generating external call archive records and code rollback records for external call interfaces based on the syndrome code matching results.

[0026] Specifically, the steps for collecting multi-source data from TCM medical records are as follows: First, read the medical record number, patient number, visit number, medical record version number, paragraph number, sentence number, original text, recording time, and modification time from the electronic medical record. The original text includes the chief complaint, present illness, past medical history, tongue appearance, pulse appearance, symptom description, and descriptions of the four diagnostic methods. Second, read the entry batch number, entry source code, standard field number, field value, and field status code corresponding to the structured entry records, past medical history records, four diagnostic methods field records, and interface parameter records from the entry log. The field status code... Let P represent the record status code of the field value under the corresponding standard field number. The values ​​of P include P0, P1, P2, and P3. P0 indicates that the field value has been recorded and can be recognized by the standard field number; P1 indicates a recordless status code; P2 indicates an unrecognized status code; and P3 indicates a negative status code where the field value is constrained by the negative boundary record number. The standard field number, field name, field group, and field template version number are read from the field template table. The term number, standard term, synonym, combined phrase code, and negative trigger code are read from the Traditional Chinese Medicine terminology dictionary. The system groups keywords and fields; it reads the syndrome model number, model version number, input parameter field order, standard field number, and syndrome code sample label through the syndrome model interface template. The syndrome code sample label is represented by Y, which is the sample output label used to train the syndrome code matching model. The value of Y is the code within the syndrome code set registered in the syndrome model interface template. The sample output label is generated jointly from historical archived syndrome codes, syndrome element diagnostic scale results, structured syndrome records, and physician review records. During generation, the label uses the medical record number, patient number, visit number, and model number as parameters. The model version number and field template version number are used as sample association keys to align the original text, structured entry records, past medical history records, four diagnostic field records, and interface parameter records under the same medical visit number with the historical archived syndrome codes. When the standard field number is missing, the field condition code is an unrecognized condition code, or the field template version number is inconsistent with the field template version number bound to the model version number, the corresponding sample is written into the label waiting review queue. The output tag of the sample that passes the review is written into the syndrome code sample tag, and the output tag of the sample that fails the review is not included in the label set of this round of training.

[0027] This implementation plan, by collecting TCM medical record text data, structured data entry records, past medical history records, four diagnostic methods field records, interface parameter records, field template tables, TCM terminology dictionaries, and syndrome model interface templates, establishes a unified data foundation for medical record numbers, patient numbers, visit numbers, original text, standard field numbers, field values, field condition codes, field template version numbers, syndrome model numbers, model version numbers, input parameter field order, and syndrome code sample labels. By defining the meaning of the field condition code P, it is possible to distinguish between field values ​​that have been recorded and can be identified by the standard field number, and those that have not. This method records, identifies, and defines negative cases constrained by negative boundary record numbers, preventing the mixing of unrecorded, unidentified, and negative case codes in subsequent field fusion analysis. By limiting the source, association key, and verification method of the syndrome code sample label Y, it ensures that the syndrome code sample label corresponds to the medical record number, patient number, visit number, model version number, and field template version number. This provides data support with clear sources, separable states, and verifiable labels for subsequent hierarchical terminology matching, field source index establishment, model input parameter table generation, and the construction of a traceable constraint syndrome code matching model.

[0028] Specifically, the preprocessing steps for multi-source TCM medical record data are as follows: The TCM medical record text data undergoes character cleaning, paragraph segmentation, sentence segmentation, and character offset numbering to generate original text segment numbers, character start offsets, character end offsets, and character offset ranges. Hit method codes are generated according to the order of longest phrase matching, standard term precise matching, and synonym merging matching. When multiple hit results have overlapping character offset ranges, the hit result with the longer character span and consistent field grouping and field template version numbers is retained. Negation boundary record numbers are generated based on the negation trigger word and character offset range. The negation boundary record number starts with the negation trigger word with the smallest character interval before the standard term and ends with the first sentence-ending punctuation mark or sentence-ending position within the same sentence after the negation start word. The negation trigger word is located at the preceding original text segment number. When the original text segment ends and both belong to the same paragraph number and there is no sentence termination punctuation between them, the current original text segment number is included in the same negative boundary record number. Based on the template mapping relationship between standard terms, field groups, standard field numbers and field template version numbers in the field template table, the standard terms are associated with the standard field numbers, field groups and field template version numbers. When the same standard term or the same combined phrase code corresponds to multiple standard field numbers, the association results of multiple standard field numbers are retained and written into the same character offset range to provide a field mapping basis for the subsequent generation of cross-field reference numbers. The structured entry records, past history records, four diagnostic field records and interface parameter records establish field source indexes according to the standard field number, field template version number, entry source code and entry batch number, respectively, and bind field values ​​and field situation codes in the field source indexes.

[0029] In this implementation plan, character cleaning, paragraph segmentation, sentence segmentation, and character offset numbering are used to create a traceable text foundation for TCM medical record data, including original fragment numbers, character start offsets, character end offsets, and character offset ranges. By using longest phrase matching corresponding to combined phrase codes, precise matching of standard terms, and merging and matching of synonyms, errors in short word mismatches, repeated matching of synonymous expressions, and combined phrase splitting are reduced. Negation boundary record numbers are generated using negation trigger words, character offset ranges, negation start points, negation end points, and cross-fragment inclusion rules, ensuring accurate differentiation of standard terms affected by negation descriptions. The template mapping relationship in the field template table associates standard terms with standard field numbers, field groups, and field template version numbers, and retains the association results of multiple standard field numbers when a term has multiple fields, providing a basis for subsequent cross-field reference number generation. By unifying the source dimensions of structured entry records, historical records, four diagnostic field records, and interface parameter records through the field source index, the field values, field case codes, entry source codes, and entry batch numbers can correspond to standard field numbers and field template version numbers, thereby providing a stable data foundation for the construction of fragment field attribution matrices, field source fusion, and model input parameter table generation.

[0030] Specifically, the steps for constructing a fragment field attribution matrix and conducting fragment attribution analysis by reading original text fragments and field template data are as follows: The fragment field attribution matrix is ​​constructed using the original text fragment number as the row index and the standard field number as the column index. Each matrix cell records the hit method code, term number, standard term, character start offset, character end offset, negation boundary record number, combined phrase code, field grouping, field template version number, cross-field reference number, and multi-fragment continuation number. The original text fragment number, standard field number, and character offset range corresponding to each matrix cell are used for subsequent attribution calculations. Basic positioning information; the negation boundary record number is generated based on the character interval between the negation trigger word and the standard term: when there are x negation trigger words, the one with the smallest character interval is selected as the negation starting point, where x is the number of negation trigger words within the same sentence number that are located before the standard term and whose character end offset is not greater than the character start offset of the standard term, x is an integer greater than or equal to 1, the character interval is the number of characters between the character end offset of the negation trigger word and the character start offset of the standard term, and the negation endpoint is the first punctuation mark or sentence end position that appears in the same sentence after it, including the period. When the character start offset and character end offset of a standard term fall within the character offset range formed by the negation start and end points, the corresponding matrix unit is written into the negation boundary record number. If the negation trigger word is located at the end of the original text segment corresponding to the previous original text segment number, and the previous original text segment number and the current original text segment number belong to the same paragraph number, and there is no sentence-ending punctuation between them, then the current original text segment number is included in the same negation boundary record number. When the same combined phrase code corresponds to multiple standard field numbers... When the term combination corresponding to the combined phrase code is entered into the attribution calculation of different standard field numbers, matrix unit records are generated respectively, so that the term combination corresponding to the combined phrase code can be entered into the attribution calculation of different standard field numbers respectively; when the same original text segment number corresponds to multiple standard field numbers, cross-field reference number is generated and written into the corresponding matrix unit; when the matrix units corresponding to i original text segment numbers all point to the same standard field number, field group and field template version number, and the character offset intervals do not overlap, the same multi-segment succession number is generated, where i is the number of original text segment numbers participating in the same multi-segment succession number, and i is an integer greater than or equal to 2;Read the non-empty matrix units in the attribution matrix of the fragment field line by line according to the original fragment number. First, determine the hit attribution result of the matrix unit based on the hit method code, term number, and standard term. The hit attribution result is a dimensionless numerical value, ranging from 0 to 1. It is obtained by adding the basic hit method result corresponding to the hit method code and the term mapping result corresponding to the term number, and then truncating it to the range of 0 to 1. The basic hit method result is obtained based on the records of the three hit methods corresponding to the combined phrase code, the longest phrase matching, the standard term exact matching, and the synonym term merge matching in the attribution parameter table. The term mapping result is obtained based on the proportion of the term number in the score of the corresponding syndrome element of the syndrome code sample label. Then, based on the combined phrase code and field grouping... The structural attribution result of the matrix unit is determined by the field template version number, cross-field reference number, and multi-segment continuation number. The structural attribution result is a dimensionless numerical value ranging from 0 to 1. It is obtained by adding the combined phrase structure result, field template consistency result, cross-field reference result, and multi-segment continuation result and then truncating it to the range of 0 to 1. Among them, the combined phrase structure result is determined by whether the combined phrase code is non-empty; the field template consistency result is determined by whether the field grouping and field template version number are consistent with the corresponding record of the standard field number in the field template table; the cross-field reference result is determined by whether the cross-field reference number is non-empty; and the multi-segment continuation result is determined by whether the multi-segment continuation number is non-empty. Furthermore, it is determined based on the negative boundary record number, character start offset, and character structure. The bundle offset determines the deduction attribution result of the matrix unit. The deduction attribution result is a dimensionless value ranging from 0 to 1. When the matrix unit has no negative boundary record number, the deduction attribution result is 0. When the matrix unit has a negative boundary record number, the negative start point and negative end point corresponding to the negative boundary record number are read. The number of overlapping characters between the character offset interval of the standard term and the character offset interval formed by the negative start point and negative end point is calculated. The number of overlapping characters is divided by the character length of the standard term to obtain the negative coverage ratio. The deduction attribution result is obtained according to the negative coverage ratio. If the negative coverage ratio is greater than 1, it is counted as 1. The hit attribution result, structural attribution result, and deduction attribution result of each non-empty matrix unit in the matrix row where the original text segment number is located are combined. When performing in-row summation, first calculate the matrix unit attribution contribution value for each non-empty matrix unit. The matrix unit attribution contribution value equals the sum of the hit attribution result and the structure attribution result, minus the deduction attribution result. If the matrix unit attribution contribution value is less than 0, it is counted as 0. The matrix unit attribution contribution value is denoted as R, with a value range of 0 to 1. The hit attribution result is denoted as A, with a value range of 0 to 1. The structure attribution result is denoted as B, with a value range of 0 to 1. The deduction attribution result is denoted as C, with a value range of 0 to 1. R is calculated as R = A + B - C. Then, sum the matrix unit attribution contribution values ​​of all non-empty matrix units within the same matrix row containing the original text segment number, and truncate the values ​​within the range of 0 to 1 to obtain the segment attribution value.

[0031] Table 1 shows the fragment field attribution matrix closure verification data table in this embodiment. In the table, P is the original fragment number, SF is the standard field number, M is the hit mode code, T is the term number, NB is the negative boundary record number, CR is the cross-field reference number, MC is the multi-fragment continuation number, and 0 indicates no corresponding record number was generated. The original fragment number of the first record is P001, the standard field number is SF001, the hit mode code is M01, the term number is T001, the negative boundary record number and the cross-field reference number are both 0, the multi-fragment continuation number is MC01, the hit attribution result is 0.40, the structure attribution result is 0.12, the deduction attribution result is 0.00, and the calculated matrix unit attribution contribution value is 0.52; the original fragment number of the second record is P001, the standard field number is SF001, the hit mode code is M01, the term number is T001, the negative boundary record number and the cross-field reference number are both 0, the multi-fragment continuation number is MC01, the hit attribution result is 0.40, the structure attribution result is 0.12, the deduction attribution result is 0.00, and the calculated matrix unit attribution contribution value is 0.52; The segment number is SF004, the hit method code is M03, the term number is T008, the cross-field reference number is CR01, the multi-segment continuation number is MC01, the hit attribution result is 0.22, the structure attribution result is 0.12, and the deduction attribution result is 0.00. The calculated matrix unit attribution contribution value is 0.34. The in-row summation of the attribution contribution values ​​of the two non-empty matrix units corresponding to P001, 0.52 and 0.34, yields a segment attribution value of 0.86. Records 3 and 4 both correspond to original text segment number P002, where the matrix unit attribution contribution value of P002-SF002 is 0.43, and the matrix unit attribution contribution value of P002-SF003 is 0.18. After in-row summation, the segment attribution value of P002 is 0.61. Records 5 and 6 both correspond to original text segment number P003, where the matrix unit attribution contribution value of P003-SF003 is 0. 47. The matrix unit attribution contribution value of P003-SF004 is 0.36, and the fragment attribution value of P003 is 0.83 after in-row summation; Records 7 and 8 both correspond to the original fragment number P004, where the matrix unit attribution contribution value of P004-SF001 is 0.28, the matrix unit attribution contribution value of P004-SF002 is 0.24, and the fragment attribution value of P004 is 0.52 after in-row summation.

[0032] Table 1. Fragment Field Attribution Matrix Closure Verification Data Table like Figure 3The diagram shows a fragment field attribution matrix provided in an embodiment of this application. The horizontal axis represents the standard field number, and the vertical axis represents the original fragment number. The matrix cells are used to display the hit method encoding, term number, negative boundary record number, cross-field reference number, and multi-fragment continuation number between the original fragment number and the standard field number. In the diagram, P represents the original fragment number, SF represents the standard field number, M represents the hit method encoding, T represents the term number, NB represents the negative boundary record number, CR represents the cross-field reference number, and MC represents the multi-fragment continuation number; 0 in the diagram indicates that no corresponding record number was generated. M01, M02, and M03 represent different hit method encodings, T001 to T012 represent different term numbers, NB01 and NB02 represent different negative boundary record numbers, CR01 to CR03 represent different cross-field reference numbers, and MC01 and MC02 represent different multi-fragment continuation numbers. (Refer to Table 1 and...) Figure 3 As can be seen, P001 forms two non-empty matrix units under SF001 and SF004. These two matrix units are supported by M01, T001, MC01 and M03, T008, CR01, MC01 respectively, with corresponding attribution contribution values ​​of 0.52 and 0.34. After in-row summation, the fragment attribution value is 0.86. P002 forms two non-empty matrix units under SF002 and SF003. Both matrix units carry the negative boundary record number NB01. P002-SF003 also carries the cross-field reference number CR02. The deduction attribution results are 0.07 and 0.27 respectively, and the summation within the row yields a fragment attribution value of 0.61. P003 forms two non-empty matrix units under SF003 and SF004, both of which carry multiple fragment inheritance numbers MC02. P003-SF004 also carries cross-field reference numbers CR03, and the summation within the row yields a fragment attribution value of 0.83. P004 forms two non-empty matrix units under SF001 and SF002, both of which carry negative boundary record numbers NB02, and the summation within the row yields a fragment attribution value of 0.52. Table 1 can simultaneously display the calculation relationship between hit attribution results, structural attribution results, deduction attribution results, matrix unit attribution contribution values, and fragment attribution values. It clearly reflects the attribution closure process from unit-level attribution contribution to row-level fragment attribution value in the fragment field attribution matrix, providing data support for subsequent comparison of fragment attribution values ​​with attribution thresholds, generation of field attribution records, and generation of attribution failure markers.

[0033] In this implementation plan, a fragment field attribution matrix is ​​constructed, which integrates original fragment numbers, standard field numbers, hit mode codes, negation boundary record numbers, cross-field reference numbers, and multi-fragment continuation numbers into the same matrix unit for unified recording. This enables the formation of traceable data links for terminology hits, negation semantics, field template associations, cross-field references, and multi-fragment continuation relationships in TCM medical record texts. By performing dimensionless numerical processing on the hit attribution results, structural attribution results, and deduction attribution results, and summarizing the attribution contribution values ​​according to the matrix unit, fragment attribution values ​​are obtained. This provides a clear calculation basis for the attribution relationship between original fragments and standard fields, reducing field attribution bias caused by negation descriptions, combined phrases, multi-field shared fragments, and multi-fragment co-expressions. This provides a verifiable data foundation for subsequent field attribution record generation, attribution failure marker generation, field source fusion analysis, and syndrome code matching.

[0034] Specifically, the steps for generating field attribution records and attribution failure markers based on fragment attribution analysis results are as follows: By comparing fragment attribution values ​​and attribution thresholds in real time, when a fragment attribution value is less than the attribution threshold, the negative boundary record number is recalculated according to the character start offset and character end offset. The standard field numbers corresponding to the combined phrase code are rearranged according to the field grouping and field template version number. During the rearrangement, the sorting keys are consistent field template version number, consistent field grouping, priority of hit mode coding, and number of overlapping character offset intervals. The standard field numbers that are sorted first are retained as the field numbers to which the combined phrase code belongs. The remaining standard field numbers are retained in the matrix cells corresponding to the cross-field reference numbers. Cross-field reference numbers are added to matrix units where the same original text fragment number points to multiple standard field numbers, and multi-fragment continuation numbers are generated for matrix units where multiple original text fragment numbers correspond to the same standard field number. In this embodiment, the attribution threshold ranges from 0 to 1 and is determined by the distribution of fragment attribution values ​​in the reviewed field attribution samples. If the fragment attribution value recalculated based on the corrected fragment field attribution matrix is ​​still less than the attribution threshold, an attribution failure flag is generated. When the fragment attribution value is greater than or equal to the attribution threshold, a field attribution record is generated by combining the original text fragment number, field case code, standard field number, field group, field template version number, field value, and multi-fragment continuation number.

[0035] In this implementation plan, fragments with insufficient attribution credibility are reassigned and re-associated by comparing fragment attribution values ​​with attribution thresholds in real time. The allocation relationship of standard field numbers is optimized by combining information such as character offset, field grouping, field template version number, and hit method. At the same time, cross-field references and multi-fragment inheritance relationships are supplemented to improve the consistency and accuracy of field attribution in complex scenarios. Subsequently, fragment attribution values ​​are recalculated based on hit status, structural association features, and negative information. Fragments that still do not meet the threshold requirements are marked as attribution failures, and fragments that meet the threshold requirements are output as complete field attribution records. This achieves the screening, correction, and solidification of field attribution results, improving the reliability and traceability of the final attribution results.

[0036] Specifically, the steps for performing field fusion analysis by calling field attribution records and structured entry records are as follows: A field comparison key is generated using standard field numbers, field groupings, and field template version numbers. Field attribution records, structured entry records, historical records, four diagnostic field records, and interface parameter records are aggregated into field source records according to the field comparison key. The field source record retains the field value, field condition code, entry source code, original text fragment number, entry batch number, field template version number, and source set. When multiple source field values ​​under the same field comparison key are identical after merging synonym entries and have the same field condition code, a field source record number is generated and written to the record. If the source set is not specified, a source conflict record will be generated. When the corresponding standard field number exists in structured data entry records, historical data, four diagnostic field records, and interface parameter records, but the field value is empty, and the original text fragment number does not match any standard term in the corresponding original text fragment, the field condition code will be written as an unrecorded condition code. When the original text fragment number corresponds to a candidate term in the original text fragment or field value, but the candidate term cannot be associated with the standard field number, field group, and field template version number after merging synonyms, the field condition code will be written as an unrecognized condition code. When the field value is "no such symptom," it will be treated as a clearly entered field value and will not be written as an unrecorded condition code. When parsing fails, an unrecognized condition code is written. Unrecorded condition codes and unrecognized condition codes are mutually exclusive under the same field source record number. For field source records corresponding to source conflict records, the order in which they enter the input parameter assembly is determined by: field template version number matching the syndrome model interface template; field condition code not being an unrecorded condition code and not an unrecognized condition code; and the largest input batch number. Source conflict records that do not meet the above conditions are not included in the deduplicated field source record. The field source record includes the field comparison key, standard field number, field value, field condition code, input source code, original text fragment number, input batch number, field template version number, and... Source set; construct the input parameter slot table based on the syndrome model number, model version number, input parameter field order, and standard field number. Assemble the deduplicated field source records into the corresponding input parameter slots according to the mapping relationship between the standard field number and the input parameter field order in the syndrome model interface template. When a standard field number corresponds to multiple input parameter slots, generate input parameter reference records for the same field source record. When there are multiple candidate field source records for an input parameter slot, select the field source record in the following order: consistent field template version number, available field condition code, the largest number of sources in the source set, and the largest input batch number value. Generate an input parameter slot number for each input parameter slot.

[0037] In this implementation plan, field attribution records, structured entry records, past medical history records, four diagnostic field records, and interface parameter records are aggregated into a unified field source record using field comparison keys. This allows multiple source fields under the same standard field number, field group, and field template version number to be compared according to field value, field condition code, entry source code, and entry batch number. By distinguishing between field values ​​corresponding to unrecorded condition codes, unidentified condition codes, and no such symptom, null values, parsing failures, and explicit negative entries are prevented from being merged into the same result. Furthermore, by using source conflict records and deduplicated field source records… The system implements filtering rules to resolve conflicts between fields with inconsistent values ​​from multiple sources before they are included in the input parameter assembly. It establishes a mapping relationship between field source records and input parameter slots through the symptom model interface template, standard field numbers, and the order of input parameter fields. This ensures that when one standard field number corresponds to multiple input parameter slots, the input parameter reference relationship is preserved. When multiple candidate field source records exist for one input parameter slot, selection is made based on version consistency, field case code, source set, and batch number. This improves the data consistency, source traceability, and stability of subsequent symptom code matching in the model input parameter table.

[0038] Specifically, the steps for filling input parameter slots, rearranging input parameter slots, and generating the model input parameter table based on the field fusion analysis results are as follows: When a standard field number corresponds to multiple input parameter slots, input parameter reference records are formed respectively, constrained by the syndrome model number, model version number, and input parameter field order. The standard field number, field source record number, field case code, input parameter slot number, and field template version number are bound to the input parameter reference record, enabling the same standard field number to enter the input parameter slot corresponding to the syndrome model interface template according to different input parameter field orders. When an input parameter slot lacks a field source record number, the input parameter is retrieved from the field source record based on the standard field number, field grouping, and field template version number. When filling in slots, first exclude field source records that have already generated source conflict records. Then, select field source records whose field comparison key matches the standard field number, field group, and field template version number corresponding to the input parameter slot as candidate field source records. If there is only one candidate field source record, write its field source record number into the input parameter slot. If there are multiple candidate field source records, select a unique field source record number and write it into the input parameter slot in the following order: priority is given to fields whose condition code is not an unrecognized condition code, priority is given to those with larger entry batch numbers, and priority is given to those whose field source record numbers are earlier in the order. Unselected candidate field source records are then written into the source set for retention. If multiple candidate field source records are present... If the values ​​of the corresponding fields in the source records are still inconsistent after merging synonym entries, a source conflict record is generated. Candidate field source records with source conflict records cannot be used for slot filling. For input parameter slots that still lack a field source record number after filling, an input parameter gap record is generated. Supplementary entry positioning information is formed based on the syndrome model number, model version number, input parameter slot number, standard field number, field grouping, and field template version number. This supplementary entry positioning information is written back to the field source record supplementary entry process. If the input parameter gap record's corresponding input parameter slot is marked as a required input parameter slot in the syndrome model interface template, a callable model input parameter table is not generated temporarily. For non-mandatory input parameter slots, the input parameter slot number is retained in the model input parameter table, and a non-recorded case code is written. When the field template version number carried by the input parameter slot is inconsistent with the field template version number bound in the syndrome model interface template, a slot mapping table and a version inconsistency record are generated according to the syndrome model interface template. The slot mapping table records the original input parameter slot number, the mapped input parameter slot number, the original field template version number, the mapped field template version number, the standard field number, and the input parameter field order. When there is no input parameter gap record and no version inconsistency record, the model input parameter table is generated. When there is a version inconsistency record, the model input parameter table is generated with the input parameter slot number as the association key after the input parameter slot rearrangement has been completed.If there are missing input parameter records and the source record number of the field is still not obtained after supplementation, a table of input parameters to be supplemented and a list of missing input parameter records are generated. These are then passed to the code rollback record generation process. For example; Figure 4 The diagram shown is a closed-loop verification diagram before and after the rearrangement of input parameter slots according to an embodiment of this application. The horizontal axis represents the input parameter slot number, where SLOT001 to SLOT006 represent different input parameter slots, and SLOT is the prefix for the input parameter slot number. The diagram verifies three items for each input parameter slot: consistent standard field number, existence of field source record number, and consistency between the field template version number and the interface template corresponding to the model version number. The total number of verification items is 3. Combined with... Figure 4 As can be seen, before rearrangement, SLOT003 and SLOT006 had 1 passed verification item, while SLOT001, SLOT004, and SLOT005 had 2 passed verification items, indicating that there were version inconsistency records or input parameter gap records in the corresponding input parameter slots. After rearranging the input parameter slots according to the slot mapping table and the order of the input parameter fields, the number of passed verification items for each input parameter slot reached 3. After rearrangement, the number of version inconsistency records and the number of input parameter gap records were both 0, indicating that the rearrangement of input parameter slots can eliminate the assembly deviation caused by the inconsistency between the field template version number and the corresponding interface template of the model version number, and provide data support for the generation of the model input parameter table.

[0039] In this implementation plan, by uniformly processing cases of missing field source record numbers, inconsistent field template version numbers, and the coexistence of multiple candidate field source records, the field source records can be accurately assembled into the corresponding input parameter slots according to the standard field number, field group, field template version number, and input parameter field order. Through candidate field source record filtering, source conflict record exclusion, field condition code priority, entry batch number priority, and field source record number sorting rules, the uniqueness and traceability of slot filling results are ensured. Through the generation of input parameter gap records, supplementary location information, slot mapping tables, version inconsistency records, the model input parameter table to be supplemented, and the branching of the model input parameter table, missing fields, version inconsistency fields, and rearranged fields are directed to their respective processing paths, preventing source conflict fields from being mistakenly entered into the model input parameter table. This provides a complete and stable input parameter data foundation for subsequent syndrome code matching, code rollback record generation, and external archive record generation.

[0040] Specifically, the steps for constructing a syndrome code matching model and generating syndrome code matching results based on field feature inputs and traceability constraint inputs are as follows: Standard field number, input source code, field value, field situation code, field source record number, field template version number, and model version number are used as field feature inputs; cross-field reference number and multi-segment continuation number are used as traceability constraint inputs; syndrome code sample labels are used as training labels; training samples are divided using a hierarchical random sampling method according to the syndrome code sample labels, field situation codes, and input source codes; and the training samples are input into a syndrome code matching model based on embedding coding and attention fusion. The model uses the cross-entropy loss corresponding to the symptom code sample label as the primary training objective, and employs consistency penalties (binding field template version number to model version number), penalties (maintaining the correspondence between cross-field reference numbers and multi-segment continuation numbers), and other constraints as constraint objectives. It updates the model parameters of the field encoding layer, source constraint layer, and reference relationship constraint layer through backpropagation, and outputs a field contribution list, a tracing chain number, a symptom code matching value, and a symptom code. The field contribution list includes the input parameter slot number, standard field number, field contribution value, field condition code, and field source record number. The field contribution value is calculated by combining the attention weights output by the field encoding layer with the symptom code matching value. The gradient absolute values ​​of the corresponding field feature inputs are multiplied and normalized, with values ​​ranging from 0 to 1. The field contribution value represents the degree of contribution of the corresponding field feature input to the syndrome code matching value. The syndrome code matching model includes a field encoding layer, a source constraint layer, and a reference relationship constraint layer. The field encoding layer is used to encode the standard field number, field value, and field case code. The source constraint layer is used to compare the field template version number corresponding to the field source record number with the field template version number bound to the model version number. The reference relationship constraint layer is used to convert cross-field reference numbers and multi-segment inheritance numbers into relational adjacency matrices and attention masks, so that cross-field reference numbers or multi-segment inheritance numbers exist. The field feature input of the succession number retains the evidence relationship in the attention calculation; after the reference relationship constraint layer, a syndrome code matching output end, a field contribution output end, and a tracing output end are set. The syndrome code matching output end outputs the candidate matching results corresponding to each candidate syndrome code, and determines the candidate syndrome code with the largest candidate matching result as the syndrome code, and determines the corresponding candidate matching result as the syndrome code matching value; the tracing output end generates a tracing chain number based on the syndrome code, input parameter slot number, field source record number, original text fragment number, cross-field reference number, and multi-fragment succession number. The tracing chain number is used to associate the syndrome code, input parameter slot, field source record, and original text fragment.

[0041] In this implementation plan, by incorporating field feature inputs and traceability constraint inputs into the syndrome coding matching model, standard field numbers, input source codes, field values, field situation codes, field source record numbers, field template version numbers, and model version numbers can participate in syndrome coding matching calculations. Furthermore, the evidentiary relationships corresponding to cross-field reference numbers and multi-segment continuation numbers are preserved during model training and inference. Through stratified random sampling, cross-entropy loss, consistency penalty terms, and relationship preservation penalty terms, training samples can take into account differences in syndrome coding sample labels, field situation codes, and input source codes, reducing the impact of inconsistent sources, inconsistent versions, and broken evidentiary relationships on syndrome coding matching values. Through the field contribution list, field contribution values, traceability chain numbers, syndrome coding matching values, and syndrome coding outputs, each syndrome coding result can be traced back to the input parameter slot number, standard field number, field source record number, and original text segment number, thereby improving the source traceability, version verifiability, and external call verification stability of the syndrome coding matching results.

[0042] Specifically, the steps for generating external call archive records and code rollback records based on symptom code matching results for external call interfaces are as follows: By comparing the symptom code matching value and the matching threshold in real time, when the symptom code matching value is less than the matching threshold, the input parameter slots with field contribution values ​​less than the contribution threshold and field condition codes that are unrecognized condition codes are returned to the field source record for supplementation. The field source record supplementation is executed by the field source record supplementation process. The field source record supplementation process generates supplementation task records based on the input parameter slot number, standard field number, field grouping, field template version number, field source record number, original text fragment number, traceability chain number, and field contribution list, and extracts supplementation task records from field attribution records, structured entry records, and historical records. Extract candidate field values ​​from the four diagnostic field records, interface parameter records, and original text fragments corresponding to the original text fragment numbers; when the candidate field value matches the standard field number, field group, and field template version number, and the field condition code is not an unrecognized condition code, write the candidate field value back to the field source record and generate a completion mark; when the candidate field value is missing, the candidate field values ​​are still inconsistent after merging synonym entries, or the field condition code corresponding to the candidate field value is still an unrecognized condition code, generate a failure mark and retain the input parameter gap record; rearrange the input parameter slots where the field template version number does not match the interface template corresponding to the model version number according to the input parameter field order, and rearrange the slots for the same original text fragment number. Field features corresponding to n standard field numbers but with empty cross-field reference numbers are removed from the current model update sample set, where n is the number of standard field numbers corresponding to the same original text segment number and is an integer greater than or equal to 2. Field features with non-empty multi-segment continuation numbers, corresponding to m original text segment numbers, and whose field contribution value is less than the contribution threshold are written into the supplementary training samples, where m is the number of original text segment numbers corresponding to the same multi-segment continuation number and is an integer greater than or equal to 2. Model update sample records and model update task records are generated; the model update task record is used to trigger the model training process. The model training process uses supplementary training samples, the model input parameter table already written to the external call archive record, syndrome code sample labels, and characters. The contribution list and traceability chain number constitute the training data set, and candidate model version numbers are generated based on the syndrome model number. When the syndrome code matching value corresponding to the candidate model version number passes the model update verification condition, and the field template version number is consistent with the field template version number bound in the syndrome model interface template, the candidate model version number is written into the model update task record and used as the model version number for recalculating the syndrome code matching value. When the candidate model version number fails the model update verification condition, the original model version number is retained and the model update task record is written to the pending review status. The model input parameter table is regenerated based on the supplemented field source record and the rearranged input parameter slots, and the syndrome code matching value is recalculated based on the currently available model version number.If the recalculated syndrome code matching value is still less than the matching threshold, a code rollback record is generated. The code rollback record includes the syndrome code, the syndrome code matching value, a field contribution list, and a traceability chain number. The syndrome code in the code rollback record is the rollback syndrome code, preferentially selected from the syndrome code in the most recent external call archive record under the same patient number, same visit number, same syndrome model number, and same model version number. If no referable external call archive record exists, the syndrome code with the highest field contribution value in the current round's field contribution list, and not covered by the supplementary entry failure marker, is used as a low-confidence candidate syndrome code, and a low-confidence candidate marker is written into the code rollback record. When the syndrome code matching value is greater than or equal to the matching threshold, an external call verification instruction is generated. The external call verification instruction calls the external call interface corresponding to the syndrome model interface template, and carries the syndrome model number, model version number, field template version number, and... The system includes a model input parameter table, input parameter slot number, standard field number, field value, field condition code, syndrome code, syndrome code matching value, field contribution list, and traceability chain number. It receives the interface response code, response model version number, response field template version number, and response syndrome code returned by the external call interface. When the interface response code indicates call success, the response model version number matches the model version number, the response field template version number matches the field template version number, and the response syndrome code matches the syndrome code, the system writes the syndrome code, syndrome code matching value, field contribution list, traceability chain number, model version number, field template version number, and interface response code to the external call archive record. When the interface response code does not indicate call success, or any of the response model version number, response field template version number, or response syndrome code is inconsistent with the content carried by the external call verification instruction, an external call failure record is generated, and the model input parameter table, external call verification instruction, and external call failure record are passed to the code rollback record generation process. For example; Figure 5 The diagram shown is a schematic of the external call page for syndrome code matching results in this embodiment. It displays the medical record content input area, the syndrome code matching result display area, and the external call result display area. The medical record content input area is used to input or display the data content corresponding to the original text, structured input records, past medical history records, four diagnostic field records, and interface parameter records. The syndrome code matching result display area displays the syndrome code, syndrome code matching value, field contribution list, and traceability chain number. The external call result display area displays the interface response code, response model version number, response field template version number, and response syndrome code returned by the external call interface. Figure 5 The page shown can visually display the model input parameter table, field template version number, model version number, syndrome code matching results, external call archive records, and code rollback records, thereby facilitating source verification, version consistency verification, and rollback reason tracing of syndrome code matching results.

[0043] In this implementation plan, the matching value of the syndrome code is compared with the matching threshold. When the matching value of the syndrome code is less than the matching threshold, the following actions are taken: supplementing the field source record, rearranging the input parameter slots, filtering the sample set for this round of model update, writing supplementary training samples, generating model update task records, and recalculating the matching value of the syndrome code. This allows low matching results to be traced back to the field source record, model input parameter table, and model version number along the input parameter slot number, standard field number, field source record number, original text segment number, field contribution list, and traceability chain number. Furthermore, a code rollback record is generated when supplementation fails, the version is inconsistent, or the recalculation still fails to meet the matching requirements. This avoids unidentified case codes, inconsistent field template version numbers, missing cross-field reference numbers, and insufficient contribution from multi-segment continuation numbers directly entering external call archiving. When the symptom code matching value is greater than or equal to the matching threshold, an external call verification instruction is generated. The symptom model number, model version number, field template version number, model input parameter table, field value, field condition code, symptom code, field contribution list, and traceability chain number are checked against the interface response code, response model version number, response field template version number, and response symptom code returned by the external call interface. This ensures that the external call archive record is written only when the interface response content matches the symptom code matching result of this round. This achieves a closed-loop verification effect for the symptom code matching result from field supplementation, input parameter rearrangement, model update, code rollback to external call archiving, effectively reducing the impact of missing field sources, inconsistent template versions, failed model updates, and inconsistent external interface responses on the traceability of the symptom code matching result.

[0044] Specifically, this embodiment provides a TCM medical record structured parsing system based on natural language processing, applied to a TCM medical record structured parsing method based on natural language processing. It includes: a data acquisition and preprocessing module, used to acquire multi-source TCM medical record data and perform preprocessing operations on the multi-source data to generate original text fragment numbers, character offset ranges, hit mode encodings, negation boundary record numbers, and field source indexes; and an original text fragment field location and attribution module, used to read original text fragments and field template data to construct a fragment field attribution matrix and conduct fragment attribution analysis. It determines the field source based on standard terms, field groupings, field template version numbers, cross-field reference numbers, and multi-fragment continuation numbers, and generates field attribution records based on the fragment attribution analysis results. The module includes: a field source deduplication and input parameter assembly module, used to call field attribution records and structured input records for field fusion analysis, collect field source records according to standard field numbers, field groups, and field template version numbers, and perform input parameter slot filling, input parameter slot rearrangement, and model input parameter table generation based on the field fusion analysis results; and a traceable constraint syndrome code matching module, used to construct a syndrome code matching model and generate syndrome code matching results based on field feature inputs and traceable constraint inputs, associate syndrome codes, input parameter slot numbers, field source record numbers, and original text fragment numbers based on the field contribution list and traceability chain number, and generate external call archive records and code rollback records for external call interfaces based on the syndrome code matching results.

[0045] In this implementation plan, through the collaborative processing of the data acquisition and preprocessing module, the original text fragment field location and attribution module, the field source deduplication and input parameter assembly module, and the traceable constraint syndrome code matching module, the multi-source data of TCM medical records is transformed from raw text and structured records into traceable, fusionable, and assemblable model input data. The source basis of fields is preserved by using original text fragment numbers, character offset intervals, field attribution records, and field source records. Input parameter slot filling, input parameter slot rearrangement, and model input parameter table generation ensure the consistency of input order and version of the syndrome code matching model. The syndrome code matching results are back-linked to input parameter slots, field source records, and original text fragments by using field contribution lists and traceability chain numbers. This improves the field consistency, source traceability, and external call verification reliability of the TCM medical record structured parsing results.

[0046] 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 process, method, article, or apparatus.

[0047] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for structured parsing of TCM medical records based on natural language processing, characterized in that, Includes the following steps: S1: Collect multi-source data of TCM medical records and perform preprocessing operations on the multi-source data of TCM medical records; S2: Read the original text fragments and field template data to construct the fragment field attribution matrix and conduct fragment attribution analysis. Generate field attribution records and attribution failure markers based on the fragment attribution analysis results. S3 calls the field attribution records and structured entry records to perform field fusion analysis, and performs input parameter slot filling, input parameter slot rearrangement and model input parameter table generation based on the field fusion analysis results; S4. Based on the field feature input and traceability constraint input, construct the syndrome code matching model and generate the syndrome code matching result. Based on the syndrome code matching result, generate external call archive records and code rollback records for external call interfaces.

2. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for collecting multi-source data from traditional Chinese medicine medical records are as follows: Collect TCM medical record text data: Read medical record number, patient number, visit number, medical record version number, paragraph number, sentence number, original text, record time and modification time through electronic medical record records; Read entry batch number, entry source code, standard field number, field value, field status code, structured entry record, past medical history record, four diagnostic methods field record and interface parameter record through entry log; The standard field number, field name, field group, and field template version number are read from the field template table; the entry number, standard entry, synonym entry, combined phrase code, negation trigger word, and field group are read from the TCM terminology dictionary; and the syndrome model number, model version number, input parameter field order, standard field number, and syndrome code sample label are read from the syndrome model interface template.

3. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for performing preprocessing on multi-source data of traditional Chinese medicine medical records are as follows: The system performs character cleaning, paragraph segmentation, sentence segmentation, and character offset numbering on TCM medical record text data to generate original text segment numbers, character start offsets, character end offsets, and character offset ranges; it generates hit mode codes in the order of longest phrase matching, standard term exact matching, and synonym term merging matching corresponding to combined phrase codes; and it generates negative boundary record numbers based on negative trigger words and character offset ranges. Based on the field template table, the standard terms are associated with the standard field number, field group, and field template version number; the structured entry records, past history records, four diagnostic field records, and interface parameter records are respectively indexed by the standard field number, field template version number, entry source code, and entry batch number.

4. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for constructing a fragment field attribution matrix and conducting fragment attribution analysis by reading original text fragments and field template data are as follows: A fragment field attribution matrix is ​​constructed using the original text fragment number as the row index and the standard field number as the column index. Matrix cells record the hit method code, term number, standard term, character start offset, character end offset, negation boundary record number, combined phrase code, field grouping, field template version number, cross-field reference number, and multi-fragment continuation number. The negation boundary record number is generated based on the character interval between the negation trigger word and the standard term: when x negation trigger words exist, the one with the smallest character interval is selected as the negation starting point, and the first sentence-ending punctuation mark or sentence-ending position in the same sentence is used as the negation ending point. If the negation trigger word is located at the end of the original text fragment corresponding to the previous original text fragment number, and the previous original text fragment number and the current original text fragment number belong to the same paragraph number, and there is no sentence-ending punctuation mark between them, then the current original text fragment number is included in the same negation boundary record number. When the same combined phrase code corresponds to multiple standard field numbers, the distribution is... Do not generate matrix cell records; when the same original text fragment number corresponds to multiple standard field numbers, generate cross-field reference numbers; when the matrix cells corresponding to i original text fragment numbers all point to the same standard field number, field grouping, and field template version number, and the character offset intervals do not overlap, generate the same multi-fragment continuation number; read the non-empty matrix cells in the fragment field attribution matrix line by line according to the original text fragment number, first determine the hit attribution result of the matrix cell based on the hit method encoding, term number, and standard term, then determine the structural attribution result of the matrix cell based on the combined phrase encoding, field grouping, field template version number, cross-field reference number, and multi-fragment continuation number, and determine the deduction attribution result of the matrix cell based on the negative boundary record number, character start offset, and character end offset; sum the hit attribution result, structural attribution result, and deduction attribution result of each non-empty matrix cell in the matrix row where the same original text fragment number is located to obtain the fragment attribution value.

5. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for generating field attribution records and attribution failure markers based on fragment attribution analysis results are as follows: By comparing fragment attribution values ​​and attribution thresholds in real time, when a fragment attribution value is less than the attribution threshold, the negative boundary record number is recalculated according to the character start offset and character end offset, the standard field number corresponding to the combined phrase code is rearranged according to the field grouping and field template version number, cross-field reference numbers are added for matrix units where the same original text fragment number points to multiple standard field numbers, and multi-fragment succession numbers are generated for matrix units where multiple original text fragment numbers correspond to the same standard field number. If the fragment attribution value recalculated based on the corrected fragment field attribution matrix is ​​still less than the attribution threshold, an attribution failure mark is generated. When the fragment attribution value is greater than or equal to the attribution threshold, a field attribution record is generated by taking the original fragment number, field case code, standard field number, field group, field template version number, field value, and multi-fragment continuation number.

6. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for performing field fusion analysis on the called field attribution records and structured entry records are as follows: Field comparison keys are generated using standard field numbers, field groupings, and field template version numbers. Field attribution records, structured entry records, historical records, four diagnostic field records, and interface parameter records are aggregated into field source records according to the field comparison keys. If multiple source field values ​​under the same field comparison key are identical after merging synonym entries and the field condition codes are the same, a single field source record number is generated and written to the source set; otherwise, a source conflict record is generated. Field source record numbers are generated separately for unrecorded condition codes and unidentified condition codes, and they are not merged into the same null value record. The field source record includes the field comparison key, standard field number, field value, field condition code, entry source code, original text fragment number, entry batch number, field template version number, and source set. An entry parameter slot table is constructed based on the syndrome model number, model version number, input parameter field order, and standard field number. The deduplicated field source records are assembled into the corresponding entry parameter slots, and an entry parameter slot number is generated for each entry parameter slot.

7. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for performing input parameter slot filling, input parameter slot rearrangement, and model input parameter table generation based on the field fusion analysis results are as follows: When a standard field number corresponds to multiple input parameter slots, input parameter reference records are formed respectively, with the syndrome model number, model version number and input parameter field order as constraints. The standard field number, field source record number, field case code, input parameter slot number and field template version number are bound in the input parameter reference record. When an input parameter slot is missing a field source record number, slot filling is performed from the field source record based on the standard field number, field group, and field template version number. Input parameter slots that are still missing a field source record number after filling are generated as input parameter gap records. When the field template version number carried by the input parameter slot is inconsistent with the field template version number bound in the syndrome model interface template, a slot mapping table and version inconsistency records are generated according to the syndrome model interface template. When there are no missing input parameter records and no version inconsistency records, generate the model input parameter table; when there are version inconsistency records, generate the model input parameter table with the input parameter slot number as the association key after the input parameter slots have been rearranged.

8. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for constructing a syndrome code matching model and generating syndrome code matching results based on field feature inputs and traceability constraint inputs are as follows: The standard field number, input source code, field value, field situation code, field source record number, field template version number, and model version number are used as field feature inputs. Cross-field reference number and multi-segment inheritance number are used as traceability constraint inputs. The syndrome code sample label is used as the training label. A stratified random sampling method is used to construct a syndrome code matching model according to the syndrome code sample label, field situation code, and input source code. The model outputs a field contribution list, traceability chain number, syndrome code matching value, and syndrome code. The field contribution list includes the input parameter slot number, standard field number, field contribution value, field situation code, and field source record number. The syndrome code matching model includes a field encoding layer, a source constraint layer, and a reference relationship constraint layer. The field encoding layer is used to encode the standard field number, field value, and field situation code. The source constraint layer is used to compare the field template version number corresponding to the field source record number with the field template version number bound to the model version number. The reference relationship constraint layer is used to retain the evidence relationship corresponding to the cross-field reference number and multi-segment inheritance number.

9. The method for structured parsing of TCM medical records based on natural language processing according to claim 1, characterized in that: The specific steps for generating external call archive records and code rollback records based on the syndrome coding matching results for external call interfaces are as follows: By comparing the symptom code matching value and the matching threshold in real time, when the symptom code matching value is less than the matching threshold, the input parameter slots with field contribution values ​​less than the contribution threshold and field condition codes that are unrecognized are returned to the field source record for supplementation. Input parameter slots with field template version numbers that are inconsistent with the interface templates corresponding to model version numbers are rearranged according to the order of input parameter fields. Field features that correspond to n standard field numbers for the same original text fragment number but have empty cross-field reference numbers are removed from the current model update sample set. Field features with non-empty multi-fragment continuation numbers that correspond to m original text fragment numbers and whose field contribution values ​​are less than the contribution threshold are written into the supplementary training samples, generating model update sample records and model update task records. Based on the supplemented field source records and rearranged input parameter slots, the model input parameter table is regenerated, and the symptom code matching value is recalculated. If the recalculated symptom code matching value is still less than the matching threshold, a code rollback record is generated. The code rollback record includes the symptom code, the symptom code matching value, the field contribution list, and the traceability chain number. When the symptom code matching value is greater than or equal to the matching threshold, an external call verification instruction is generated, and the symptom code, symptom code matching value, field contribution list, traceability chain number, model version number, and field template version number are written to the external call archive record.

10. A structured parsing system for traditional Chinese medicine medical records based on natural language processing, employing the structured parsing method for traditional Chinese medicine medical records based on natural language processing as described in any one of claims 1-9, characterized in that... include: The data acquisition and preprocessing module is used to acquire multi-source data of TCM medical records and perform preprocessing operations on the multi-source data of TCM medical records. The original text fragment field location and attribution module is used to read the original text fragment and field template data to construct the fragment field attribution matrix and conduct fragment attribution analysis. Based on the fragment attribution analysis results, it generates field attribution records and attribution failure markers. The Field Source Deduplication and Input Parameter Assembly module is used to call field attribution records and structured entry records for field fusion analysis, and perform input parameter slot filling, input parameter slot rearrangement and model input parameter table generation based on the field fusion analysis results; The traceable constraint syndrome coding matching module is used to construct a syndrome coding matching model and generate syndrome coding matching results based on field feature inputs and traceable constraint inputs. Based on the syndrome coding matching results, it generates external call archive records and coding rollback records for external call interfaces.

Citation Information

Patent Citations

  • A Traditional Chinese Medicine Prescription Recommendation Method Based on Knowledge Graph

    CN116680412B

  • A Method for Constructing a Medical Knowledge Base Based on Multi-Level Logical Reasoning

    CN116882496B