APG settlement method and system based on outpatient disease group

By using interactive decoding of three-layer heterogeneous evidence graphs and graph Transformers, combined with probabilistic soft logic rules of policy versions, the accuracy and consistency issues of primary diagnosis and primary operation in outpatient disease grouping APG settlement are resolved, achieving policy compliance adaptation and an interpretable settlement process.

CN122067720APending Publication Date: 2026-05-19NANJING NON-LINE DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING NON-LINE DIGITAL TECHNOLOGY CO LTD
Filing Date
2025-12-12
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing technologies for APG settlement in outpatient disease grouping suffer from insufficient unified modeling of heterogeneous evidence and temporal causal constraints, leading to inaccurate identification of primary diagnoses and primary operations, poor temporal consistency, decoupling of policy rules from models, difficulty in adapting to version changes, and insufficient joint consistency and interpretability of diagnoses and operations.

Method used

A three-layer heterogeneous evidence graph is used, combined with a graph Transformer constrained by relation awareness and monotonic temporal attention mask, to perform diagnostic and operational interaction decoding. It also combines the probabilistic soft logic rules bound to policy versions to perform joint differentiable first K terms selection, and outputs the main diagnosis and main operation.

Benefits of technology

It improves the accuracy and consistency of identifying primary diagnoses and procedures, enhances policy compliance and adaptability, provides interpretable end-to-end settlement capabilities, and meets the needs of audit traceability and clinical review.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122067720A_ABST
    Figure CN122067720A_ABST
Patent Text Reader

Abstract

The invention discloses an APG settlement method and system based on outpatient disease category grouping, and aims to solve the problems of difficulty in automatic identification of outpatient main diagnosis and main operation and insufficient consistency with policy versions. The method comprises the following steps: constructing a heterogeneous evidence graph comprising a doctor-seeing inner layer, an individual longitudinal layer and an APG and policy layer, adopting a graph Transform constrained by relation perception and a monotonous time sequence attention mask, setting diagnosis and operation interactive decoding, introducing a probability soft logic rule bound with a policy version, and carrying out joint differentiable first K item selection, and main items are determined, and main group and additional group mapping and settlement calculation are completed, so that the technical effects of accurate main item identification, consistent time sequence, policy compliance and explainable end-to-end settlement are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical insurance settlement, and in particular to an APG settlement method based on outpatient disease grouping. Background Technology

[0002] Outpatient disease grouping (APG) settlement is widely used in refined medical insurance payment. With the development of medical informatization, hospital information systems have accumulated heterogeneous data from multiple sources, including diagnostic codes, operation codes, prescriptions, laboratory records, imaging records, anesthesia records, and their timestamps. Existing solutions typically rely on rule engines and knowledge bases for triggering and prioritization, and are gradually introducing machine learning and deep learning to automatically identify primary diagnoses and operations to support subsequent primary group mapping, supplementary item identification, and settlement amount calculation. Some studies have attempted to use sequence models or graph neural networks to utilize some temporal and relational information, but overall, these mainly focus on post-event rule verification, resulting in a relative disconnect between the model and policy rules.

[0003] However, existing technologies still have the following shortcomings:

[0004] 1. There is insufficient unified modeling of heterogeneous evidence and temporal causal constraints. Preoperative, operation and postoperative segments are often mixed up, which can easily lead to time backflow. The prerequisite dependence, mutual exclusion and inclusion relationship of anesthesia on operation is difficult to be consistently constrained in the same representation, resulting in poor stability of subject identification.

[0005] 2. The decoupling of policy rules and models makes it difficult to adapt to version changes. The common practice is to apply hard rule filtering after the model scores. There is a lack of measurable and adjustable soft and hard constraints that are tied to the policy version. Version upgrades require a lot of manual parameter tuning and are prone to inconsistency issues.

[0006] 3. Insufficient consistency and interpretability of diagnosis and operation. Existing methods often sort diagnosis and operation separately and then pair them, making it difficult to handle mutual exclusion and inclusion at the same selection level. They lack joint selection and traceable evidence for candidate pairs, resulting in weak consistency and interpretability of the final results.

[0007] Therefore, a method for APG settlement based on outpatient disease grouping that can overcome the shortcomings of the existing technology is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0008] One objective of this invention is to propose an APG (Advanced Patient Grouping) settlement method based on outpatient disease grouping. Addressing the problems of inaccurate automatic identification of primary diagnoses and primary operations, lack of temporal causal constraints, and poor policy version adaptability in existing technologies, this invention proposes a method that standardizes medical visits and segments them into pre-operative, operational, and post-operative phases. It constructs a three-layer heterogeneous evidence graph comprising an inner layer of the medical visit, an individual longitudinal layer, an APG layer, and a policy layer. A graph Transformer with relational awareness and monotonic temporal attention mask constraints is used for interactive decoding of diagnosis and operation. Combined with probabilistic soft logic rules bound to policy versions and a joint differentiable first K terms selection method, the method outputs the primary diagnosis and primary operation and completes the settlement calculation. This invention achieves high accuracy in primary item identification, temporal consistency, strong policy compliance adaptability, and interpretable results.

[0009] An APG settlement method based on outpatient disease grouping according to an embodiment of the present invention includes:

[0010] S1. Standardize the diagnosis, procedures, prescriptions, tests, imaging, and anesthesia events of this visit, generate a standardized visit event sequence, and extract patient age, patient gender, department visited, policy version, and recent medical history.

[0011] S2. Based on the timestamps of standardized medical visit event sequences, perform time-series segmentation to determine the start and end times of preoperative, operational, and postoperative segments, and generate time-series segment labels for each event;

[0012] S3. Based on the standardized medical visit event sequence, patient age, patient gender, department visited, policy version, recent medical history and course of illness records, as well as the time segment labels and segment start and end times, construct a three-layer heterogeneous evidence graph. Create time segment nodes in the medical visit inner layer and attach event nodes according to labels. Connect recent medical history and course of illness nodes in the individual vertical layer. Set APG trigger nodes and policy version nodes in the APG and policy layers. Generate time sequence edges, causal dependency edges, mutually exclusive edges, inclusion edges and prerequisite dependency edges, and mark the direction.

[0013] S4. Based on the edge type and direction of the heterogeneous evidence graph, as well as the temporal segment labels and segment start and end times, generate a relation-aware attention mask and a monotonic temporal attention mask.

[0014] S5. Under the constraints of relation-aware attention mask and monotonic temporal attention mask, perform graph Transformer encoding on the heterogeneous evidence graph, set the main diagnostic decoding head and the main operation decoding head and perform interactive attention between them, and calculate the diagnostic candidate score and the operation candidate score respectively.

[0015] S6. Based on the diagnostic candidate scores and operational candidate scores, and combined with the heterogeneous evidence graph, the candidate scores are constrained, corrected and combined according to the probability soft logic rule set loaded by the policy version, and a combined score matrix arranged by diagnosis and operation is generated.

[0016] S7. Perform joint differentiable Top-K selection on the combined scoring matrix. In the same selection layer, perform joint selection on candidate pairs of diagnosis and operation, and apply mutual exclusion penalty and inclusion penalty. Output the main diagnosis and main operation.

[0017] S8. Based on the main diagnosis and main operation and in combination with the policy version, determine the APG main group, map the supplementary items, read the benchmark rate and weight parameters from the clearing parameter library, calculate the settlement amount, and output the APG main group, supplementary group and settlement amount.

[0018] Optionally, step S1 specifically includes:

[0019] The diagnostic codes, operation codes, prescription items, test results, imaging reports, anesthesia records, and their respective timestamps for this visit are standardized. The standardization process includes standard coding verification and mapping of diagnostic codes and operation codes, establishing a one-to-one correspondence between prescription items, test results, imaging reports, and anesthesia records and standard codes or item identifiers, and unifying the timestamps to a standard time format and correcting outliers.

[0020] The test results and image reports are standardized in terms of text and units, and a one-to-one correspondence is established with the corresponding standard codes or project identifiers.

[0021] Within the same medical visit, duplicate records are identified and merged based on standard codes or item identifiers and timestamps. Source system identifiers and quality identifiers are generated in the merged records, thereby forming a standardized medical visit event sequence that includes event type, standard code or item identifier, timestamp, source system identifier, and quality identifier.

[0022] Retrieve patient age, gender, and department visited from basic medical records;

[0023] Determine the policy version from the rule base;

[0024] During the pre-set observation period, the diagnostic codes in the standardized medical visit event sequence are used to match the same or similar diagnoses, and recent medical records with the same course of disease are extracted from historical medical records.

[0025] Output standardized medical visit event sequences, patient age, patient gender, department visited, policy version, and recent medical history.

[0026] Optionally, step S2 specifically includes:

[0027] Based on the timestamps of the standardized medical visit event sequence, time-series segmentation is performed to determine the start and end times of the preoperative segment, the operation segment, and the postoperative segment, and a corresponding time-series segment label is generated for each event in the standardized medical visit event sequence;

[0028] Specifically, the start and end times of an operation segment are determined by identifying the set of events corresponding to the operation code in a standardized medical event sequence. The start time of the operation segment is the earliest timestamp of the event set, and the end time of the operation segment is the latest timestamp of the event set. When anesthesia records exist, the start and end times of the anesthesia records are used to constrain the boundaries of the operation segment, so that the anesthesia start time is no later than the start time of the operation segment and the anesthesia end time is no earlier than the end time of the operation segment.

[0029] The start time of the preoperative segment is the earliest timestamp of the standardized medical visit event sequence, and the end time of the preoperative segment is the maximum timestamp that does not exceed the start time of the operation segment.

[0030] The start time of the postoperative segment is the earliest timestamp that is later than the end time of the operation segment, and the end time of the postoperative segment is the latest timestamp of the standardized medical event sequence.

[0031] When there is no event set corresponding to the operation code, the preoperative segment covers the entire time range of the standardized medical visit event sequence, and the operation segment and postoperative segment are not generated.

[0032] The time sequence segment label is assigned a value in the preoperative segment, operation segment, or postoperative segment based on the result that the event timestamp falls within the segment time range;

[0033] Output the time sequence segment labels and segment start and end times, which include the start and end times of the preoperative segment, the start and end times of the operation segment, and the start and end times of the postoperative segment.

[0034] Optionally, step S3 specifically includes:

[0035] Based on the time segment labels and segment start and end times, combined with standardized medical visit event sequences, patient age, patient gender, department visited, policy version, and recent medical history, a heterogeneous evidence graph is constructed, including an inner layer of medical visits, an individual longitudinal layer, and an APG and policy layer. Specifically, this includes: creating time segment nodes in the inner layer of medical visits, and attaching diagnostic events, operation events, prescription events, laboratory events, imaging events, and anesthesia events in the standardized medical visit event sequence to the corresponding time segment nodes according to the time segment labels, and generating event nodes.

[0036] Create nodes with recent medical history and disease course at the individual vertical layer, and establish connections between these nodes and relevant diagnostic event nodes in the inner layer of medical visits based on diagnostic codes and timestamps to reflect the continuity of the disease course.

[0037] Create APG trigger nodes and policy version nodes at the APG and policy layers, establish trigger relationships between APG trigger nodes and diagnosis event nodes and operation event nodes in the inner layer of medical treatment, and establish version binding relationships between policy version nodes and APG trigger nodes.

[0038] In the heterogeneous evidence graph, chronological edges, causal dependency edges, mutually exclusive edges, inclusion edges, and prerequisite dependency edges are generated according to the order of events and business relationships. The direction of each edge is marked, and the edge weight is calculated based on the time interval of events, source system identifier, and quality identifier. Among them, chronological edges are used to point from an earlier event node or an earlier time segment node to a later event node or a later time segment node; causal dependency edges are used to represent the causal relationship between diagnostic events and operational events, as well as between prescription events and testing events; mutually exclusive edges are used to represent event pairs that cannot be used as primary items simultaneously under policy version constraints; inclusion edges are used to represent a group of events that should be included in the calculation under policy version constraints; and prerequisite dependency edges are used to represent the prerequisite constraint of anesthesia events on operational events.

[0039] Output heterogeneous evidence graphs.

[0040] Optionally, step S4 specifically includes:

[0041] Based on the edge types, directions, and weights recorded in the heterogeneous evidence graph, a relation-aware attention mask for graph Transformer attention computation is constructed. Specifically, mask channels are generated for temporal edges, causal dependent edges, mutually exclusive edges, containing edges, and prerequisite dependent edges, and an independent attention parameter set is assigned to each edge type. The allowed attention directions are consistent with the edge directions. Mutually exclusive edges are masked in both directions. Prerequisite dependent edges retain only the attention from the prerequisite node to the target node. Bidirectional attention is allowed for containing edges. The edge weights are filtered according to a first threshold, so that connections below the first threshold are masked in the mask, and connections above or equal to the first threshold are retained using the edge weight as a scaling factor.

[0042] Simultaneously, a monotonic temporal attention mask is constructed based on the start and end times of the segments and the connection relationship between event nodes and temporal segment nodes in the heterogeneous evidence graph. Specifically, within the inner layer of the consultation, attention is only allowed to flow from event nodes or earlier temporal segment nodes to event nodes or later temporal segment nodes. Bidirectional attention is retained within the same temporal segment, while attention is prohibited from flowing from later to earlier times between different temporal segments. When there are no operation segments, the monotonic temporal attention mask degenerates into only allowing attention with timestamps no later than the target node timestamp. No monotonic temporal restrictions are imposed on the individual longitudinal layer, APG, and policy layer.

[0043] Output relation-aware attention mask and monotonic temporal attention mask.

[0044] Optionally, step S5 specifically includes:

[0045] An initial vector representation is constructed for each node in the heterogeneous evidence graph. The initial vector representation is obtained by concatenating event type embedding, standard encoding embedding, and time position encoding calculated based on the time segment labels and timestamps recorded in the heterogeneous evidence graph in a preset manner and then performing a linear transformation.

[0046] Multi-head attention and feedforward networks are executed in the graph Transformer layers with a preset number of layers. The multi-head attention masks and scales the attention weights in each layer through relation-aware attention masks and monotonic temporal attention masks. Independent attention projection parameters are configured for temporal edges, causal dependent edges, mutually exclusive edges, inclusion edges, and prerequisite dependent edges. The attention coefficients are scaled proportionally by combining the edge weights recorded in the heterogeneous evidence graph. The updated node representation is obtained by using residual connections and layer normalization.

[0047] Based on the updated node representation, a main diagnostic decoding head and a main operation decoding head are set up. The two share the backbone representation obtained by the aforementioned graph Transformer encoding and perform interactive attention between the diagnostic node set and the operation node set. Specifically, the main diagnostic decoding head calculates the interactive attention from diagnosis to operation using the diagnostic node representation as the query and the operation node representation as the key and value. The main operation decoding head calculates the interactive attention from operation to diagnosis using the operation node representation as the query and the diagnostic node representation as the key and value, so as to obtain the interactively corrected diagnostic node representation and operation node representation.

[0048] Scalar values ​​are calculated for the interactively corrected diagnostic node representation and operational node representation respectively using linear mapping and activation function, and these values ​​are used as diagnostic candidate scores and operational candidate scores.

[0049] Output diagnostic candidate scores and operation candidate scores.

[0050] Optionally, step S6 specifically includes:

[0051] Based on the diagnostic candidate scores and operational candidate scores, row indices arranged by diagnosis and column indices arranged by operation are established according to the diagnostic node set and operational node set in the heterogeneous evidence graph to generate an initial scoring matrix for candidate pairs, where each element is a weighted combination of the corresponding diagnostic candidate score and operational candidate score.

[0052] According to the policy version, load the probabilistic soft logic rule set from the rule base, and set the weight and constraint type for each rule. The constraint type includes hard constraints and soft constraints.

[0053] The elements of the initial scoring matrix are corrected according to the timing rules, mutual exclusion rules, inclusion rules and prerequisite dependency rules. Specifically, the satisfaction of the timing rules is calculated based on the timing segment labels and the start and end times of the segments. The relationship that the anesthesia start time is earlier than the operation start time and the operation end time is earlier than the postoperative examination time is set as a hard constraint. The prohibition of using postoperative examination abnormalities as preoperative evidence is set as a hard constraint. Elements that do not meet the rules are set as invalid or reduced to a preset low value.

[0054] Penalize relevant elements based on the mutual exclusion relationships defined in the policy version, and invalidate them when the mutual exclusion threshold is exceeded;

[0055] Rewards are applied to relevant elements that meet the packaging conditions based on the inclusion relationships determined in the policy version;

[0056] Based on the prerequisite dependency of the anesthesia event on the operation event, relevant elements are retained or rewarded when the prerequisite is met, and penalized or invalidated when the prerequisite is missing;

[0057] The satisfaction of each rule is mapped to a continuous correction coefficient and then superimposed on the element value according to the weight to form a constraint-corrected scoring matrix.

[0058] Normalization and smoothing are performed on the constrained and corrected scoring matrix to obtain a combined scoring matrix arranged by diagnosis and operation;

[0059] Output the combined scoring matrix.

[0060] Optionally, step S7 specifically includes:

[0061] Candidate pair indexes are constructed based on the combined scoring matrix, arranged by diagnosis and operation, and the elements of the combined scoring matrix are used as the joint scores of the candidate pairs.

[0062] Based on the mutually exclusive edges and included edges marked in the heterogeneous evidence graph, a penalty mask for the selection layer is generated. The candidate pairs corresponding to the mutually exclusive edges are given a negative penalty coefficient in the penalty mask, and the candidate pairs corresponding to the included edges are given a positive reward coefficient in the penalty mask.

[0063] The penalty mask is superimposed on the joint score of the candidate pair to obtain the penalty-adjusted joint score;

[0064] For the penalized joint scores, perform joint differentiable Top-K selection, and use a continuous relaxation function with temperature parameter to generate the selection weight matrix, such that the sum of the non-negative elements of the selection weight matrix is ​​equal to K and can be used for backpropagation;

[0065] The primary diagnosis and primary operation are determined based on the candidate pair corresponding to the largest element in the selection weight matrix. When there are ties, the penalized joint score is used as the secondary sorting criterion to determine the primary diagnosis and primary operation.

[0066] Where K is a preset positive integer;

[0067] Output the main diagnostics and main operations.

[0068] Optionally, step S8 specifically includes:

[0069] The APG master group is determined based on the main diagnosis and main operation, combined with the policy version. Specifically, the master group triggering conditions are matched with the main diagnosis and main operation according to the master group mapping rules defined in the policy version. When there are multiple matches, a unique APG master group is determined according to the priority set in the policy version. When there is no match, no APG master group is generated and the settlement amount is set to zero.

[0070] According to the policy version, additional items are mapped. Specifically, referring to the diagnostic events, operation events, prescription events, test events, imaging events and anesthesia events in the standardized medical event sequence, the set of events that meet the conditions is identified according to the additional item conditions defined in the policy version and additional groups are generated. Then, the additional groups are merged and removed according to the deduplication rules and mutual exclusion rules of the policy version.

[0071] The benchmark rate and weight parameters corresponding to the policy version are read from the clearing parameter library. The weight parameters include the APG main group weight and the supplementary group weight. The supplementary group weights are aggregated into a combined weight according to the combination rules defined in the policy version.

[0072] The settlement amount is calculated based on the benchmark rate, APG main group weight and portfolio weight, and rounded to the smallest unit of currency according to the rounding rules recorded in the clearing parameter library.

[0073] Output the APG main group, supplementary group, and settlement amount.

[0074] On the other hand, the present invention also proposes an APG settlement system based on outpatient disease grouping, comprising:

[0075] The data standardization module is used to generate standardized medical visit event sequences;

[0076] The time-series segmentation module is used to divide the event sequence into preoperative, operational, and postoperative segments according to timestamps and generate segment labels.

[0077] The heterogeneous evidence graph module is used to construct a three-layer heterogeneous evidence graph based on the sequence, patient information, and policy version.

[0078] The mask generation module is used to generate relationship-aware attention masks and monotonic temporal attention masks based on edge type, direction and segment time.

[0079] The graph encoding and decoding module is used to perform graph Transformer encoding under the mask constraint, set the main diagnostic and main operation decoding heads and pay attention to each other to obtain diagnostic candidate scores and operation candidate scores;

[0080] The constraint and combined scoring module is used to load probabilistic soft logic rules according to policy version, perform constraint correction on the candidate scores, and generate a combined scoring matrix arranged by diagnosis and operation.

[0081] The joint selection module is used to perform joint differentiable Top-K selection on the combined scoring matrix, superimpose mutually exclusive penalties and inclusion rewards, and output the main diagnosis and main operation.

[0082] The group settlement module is used to determine the APG main group based on the main diagnosis, main operation and policy version, map the supplementary group, and read the benchmark rate and weight to calculate the settlement amount.

[0083] The beneficial effects of this invention are:

[0084] 1. Improve the accuracy and consistency of primary diagnosis and primary operation identification: By using a three-layer heterogeneous evidence graph, relation-aware attention masking, and monotonic temporal attention, the order of preoperative, operation, and postoperative procedures is strictly constrained to meet business relationships such as anesthesia prerequisite, mutual exclusion, and inclusion; by combining interactive decoding of diagnosis and operation and joint differentiable pre-K terms selection, collaborative decision-making is achieved at the same selection level, and the robustness to noise and missing data is enhanced by using source and quality labels;

[0085] 2. Strengthen policy compliance and version adaptation: Explicitly model policy versions and trigger nodes in the diagram, and use probabilistic soft logic to apply rules such as timing, mutual exclusion, inclusion and prerequisites to the candidate pair scoring in a combination of soft and hard methods. When the version changes, it can be quickly adapted by switching rule sets and parameters, reducing manual modification and improving settlement consistency and stability.

[0086] 3. Provides interpretable end-to-end settlement capabilities: It connects the entire process of event standardization, main item identification, main group determination, supplementary group mapping and amount calculation, and can output evidence subgraphs of selected main items, hit rules and penalty and reward decomposition to meet the needs of audit traceability and clinical and medical insurance review. Attached Figure Description

[0087] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0088] Figure 1 This is a flowchart of an APG settlement method and system based on outpatient disease grouping proposed in this invention. Detailed Implementation

[0089] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0090] refer to Figure 1 An APG settlement method based on outpatient disease grouping includes:

[0091] S1. Standardize the diagnosis, procedures, prescriptions, tests, imaging, and anesthesia events of this visit, generate a standardized visit event sequence, and extract patient age, patient gender, department visited, policy version, and recent medical history.

[0092] S2. Based on the timestamps of standardized medical visit event sequences, perform time-series segmentation to determine the start and end times of preoperative, operational, and postoperative segments, and generate time-series segment labels for each event;

[0093] S3. Based on the standardized medical visit event sequence, patient age, patient gender, department visited, policy version, recent medical history and course of illness records, as well as the time segment labels and segment start and end times, construct a three-layer heterogeneous evidence graph. Create time segment nodes in the medical visit inner layer and attach event nodes according to labels. Connect recent medical history and course of illness nodes in the individual vertical layer. Set APG trigger nodes and policy version nodes in the APG and policy layers. Generate time sequence edges, causal dependency edges, mutually exclusive edges, inclusion edges and prerequisite dependency edges, and mark the direction.

[0094] S4. Based on the edge type and direction of the heterogeneous evidence graph, as well as the temporal segment labels and segment start and end times, generate a relation-aware attention mask and a monotonic temporal attention mask.

[0095] S5. Under the constraints of relation-aware attention mask and monotonic temporal attention mask, perform graph Transformer encoding on the heterogeneous evidence graph, set the main diagnostic decoding head and the main operation decoding head and perform interactive attention between them, and calculate the diagnostic candidate score and the operation candidate score respectively.

[0096] S6. Based on the diagnostic candidate scores and operational candidate scores, and combined with the heterogeneous evidence graph, the candidate scores are constrained, corrected and combined according to the probability soft logic rule set loaded by the policy version, and a combined score matrix arranged by diagnosis and operation is generated.

[0097] S7. Perform joint differentiable Top-K selection on the combined scoring matrix. In the same selection layer, perform joint selection on candidate pairs of diagnosis and operation, and apply mutual exclusion penalty and inclusion penalty. Output the main diagnosis and main operation.

[0098] S8. Based on the main diagnosis and main operation and in combination with the policy version, determine the APG main group, map the supplementary items, read the benchmark rate and weight parameters from the clearing parameter library, calculate the settlement amount, and output the APG main group, supplementary group and settlement amount.

[0099] In this specific embodiment, S1 specifically refers to:

[0100] The diagnostic codes, operation codes, prescription items, test results, imaging reports, anesthesia records, and their respective timestamps for this visit were standardized in sequence. Specifically, the diagnostic codes and operation codes were verified and mapped to form a unified standard coding domain. The test results and imaging reports were normalized in terms of text and units and a one-to-one correspondence with the standard codes or item identifiers was established to ensure semantic consistency. The timestamps were standardized to a standard time format and outlier correction was performed to ensure the availability and comparability of time information.

[0101] Within the same medical visit, duplicate records are identified and merged based on standard codes or project identifiers and timestamps. Source system identifiers and quality identifiers are generated in the merged records to reflect the source of the records and the reliability of the data.

[0102] After standardization at the event level is completed, patient age, gender and department of visit are retrieved from basic records, and policy version is determined from the rule base to ensure that subsequent settlement follows the current policy guidelines;

[0103] Meanwhile, during the pre-set observation period, matching of the same or similar diagnoses is performed with reference to the diagnostic codes in the standardized medical visit event sequence, and recent medical records with the same course of disease are extracted from historical medical records to supplement individual longitudinal information;

[0104] To facilitate consistent terminology and subsequent processing, the standardized medical visit event sequence is defined as follows:

[0105] ;

[0106] in Represents a standardized sequence of medical visit events. Indicates the number of events contained in the sequence. Indicates the first A standardized event, This is the index of the event in the sequence. Indicate the event type (one of diagnosis, procedure, prescription, test, imaging, or anesthesia). This indicates the standard code or project identifier (a unique identifier obtained by code verification and mapping or project normalization). Represents the event timestamp (standard time after time zone and format standardization and outlier correction). Indicates the source system identifier (used to indicate sources such as HIS, LIS, PACS, or anesthesia system). This indicates a quality rating (used to assess the overall quality level of text normalization, unit normalization, deduplication and merging, and source reliability).

[0107] Output standardized medical visit event sequence The accompanying information, including patient age, patient gender, department visited, policy version, and recent medical history, is used for subsequent time-series segmentation and heterogeneous evidence map construction.

[0108] In this specific embodiment, S2 specifically refers to:

[0109] Based on standardized medical visit event sequences The time sequence within the consultation is segmented by the timestamp of each event. First, the start and end times of the operation segment are determined by identifying the event set corresponding to the operation code. Then, the boundary of the operation segment is constrained by the start and end times of the anesthesia record, so that the anesthesia start time is no later than the start time of the operation segment and the anesthesia end time is no earlier than the end time of the operation segment.

[0110] Therefore in Defined under the premise of non-emptiness:

[0111] ;

[0112] in Represents a standardized sequence of medical visit events. Indicates the event is in Index in Indicates an event Standard timestamp, Indicates by The event type is an index set of operations. Indicates by The set of indexes for events of type anesthesia. and These represent taking the minimum and maximum timestamps from the set, respectively. Represents the empty set. Indicates the start time of the operation segment. Indicates the end time of the operation segment;

[0113] After determining the operative segment, the start time of the preoperative segment is taken as... The earliest timestamp, the end time of the preoperative segment is no more than [time not specified]. The maximum timestamp, the start time of the postoperative fragment is taken later than The earliest timestamp, the end time of the postoperative segment is taken as Latest timestamp;

[0114] When no event set corresponding to the operation code exists, only the preoperative segment is generated, and its time range covers [the relevant information]. All timestamps are generated; operation segments and postoperative segments are not generated.

[0115] For each event in the standardized medical visit event sequence, generate a corresponding time segment label according to whether its timestamp falls within the time range of preoperative, operation, or postoperative segments, and output the time segment label and the segment start and end time.

[0116] In this specific embodiment, S3 specifically refers to:

[0117] Based on standardized medical visit event sequences The patient's age, gender, department visited, policy version, and recent medical history are considered. Combined with time-series segment labels and segment start and end times, a heterogeneous evidence map is constructed at three levels: the inner layer of the medical visit, the individual longitudinal layer, and the APG and policy layers. Specifically, time-series segment nodes are created in the inner layer for preoperative, operative, and postoperative segments, and then categorized according to the time-series segment labels. Diagnostic events, operational events, prescription events, laboratory events, imaging events, and anesthesia events are linked as event nodes and belong to the corresponding time-series segment nodes. At the individual vertical layer, nodes with recent medical history and disease course are created and connected to the relevant diagnostic event nodes in the inner layer of medical visits based on diagnostic codes and timestamps to reflect the continuity of the disease course. At the APG and policy layers, APG trigger nodes are created and established trigger relationships with diagnostic event nodes and operational event nodes. At the same time, policy version nodes are created and established version binding relationships with APG trigger nodes.

[0118] Regarding edge relationships, time sequence edges, causal dependency edges, mutually exclusive edges, inclusion edges, and prerequisite dependency edges are generated according to the order of events and business rules, and the direction of each edge is marked. Among them, time sequence edges point from earlier event nodes or earlier time segment nodes to later event nodes or later time segment nodes. Causal dependency edges are used to point from diagnosis event nodes to operation event nodes that are causally related to them, and from prescription event nodes to test event nodes that they trigger. Mutually exclusive edges are used to establish pairwise bidirectional constraints on event pairs that cannot be used as primary items at the same time under policy version constraints. Inclusion edges are used to establish bidirectional inclusion relationships on a group of events that should be included in the package. Prerequisite dependency edges are used to point from anesthesia event nodes to the operation event nodes that they constrain.

[0119] To ensure a consistent representation and support for subsequent calculations, the heterogeneous evidence diagram is notated as follows:

[0120] ;

[0121] in This represents the overall heterogeneous evidence diagram. This represents a set of nodes that includes time-series segment nodes, event nodes, nodes with recent history of the same disease course, APG trigger nodes, and policy version nodes. This represents a set of directed edges that covers temporal edges, causal dependent edges, mutually exclusive edges, containing edges, and prerequisite dependent edges. The node type mapping is used to represent the node type mapping. Each node in the hierarchy is mapped to its corresponding node type or level. The edge type mapping is used to represent the edge type mapping. Each edge in the graph is mapped to its corresponding edge type. The edge weight function is used to quantify the importance of an edge by combining the time interval of node association, source system identifier, and quality identifier.

[0122] The calculation of edge weights follows the principle that when an edge connects two event nodes, the time interval and quality indicators of the events at both ends are combined to enhance robustness to noise. When an edge involves a time segment node, the weights are smoothed using the statistical information of the events within the segment.

[0123] The final output is a heterogeneous evidence graph containing node, edge, type, and weight information for subsequent mask generation and graph Transformer encoding.

[0124] In this specific embodiment, S4 specifically refers to:

[0125] Based on heterogeneous evidence diagram The edge type, edge direction, and edge weight are recorded in the data, and combined with the temporal segment label and segment start and end time, a relation-aware attention mask and a monotonic temporal attention mask are generated. Specifically, in the relation-aware attention mask, mask channels are established and independent attention parameter groups are assigned for temporal edges, causal dependent edges, mutually exclusive edges, containing edges, and prerequisite dependent edges, so that the allowed attention direction is consistent with the edge direction. Mutually exclusive edges are masked in both directions, prerequisite dependent edges retain only the attention from the prerequisite node to the target node, and containing edges allow bidirectional attention. The edge weights are filtered according to a first threshold, so that connections below the first threshold are masked in the mask, and connections above or equal to the first threshold are retained using the edge weight as a scaling factor.

[0126] To unify the representation and subsequent calculations, the relation-aware attention mask is denoted as . And using node pairs and edge channels as indices, it is defined as follows:

[0127] ;

[0128] in Indicates at node With nodes Between, with edge type channels ( The relation-aware attention mask value is obtained by indexing a set of edge types (including time sequence, causal dependency, mutual exclusion, inclusion, and prerequisite dependency). express One of the directed edges in the middle, Represents edge type mapping, used to map edges Mapped to its edge type For direction consistency indicator function, if and only if edge direction and from arrive Take 1 if the attention directions are consistent; otherwise, take 1. For type-level allowed functions, according to The corresponding edge type determines whether attention flow is allowed in that direction (e.g., mutually exclusive edges are 0 in both directions, time-sequence edges are only allowed to be 1 from earlier to later, prerequisite-dependent edges are only allowed to be 1 from prerequisite node to target node, and included edges can be 1 in both directions). The importance of edges is quantified by using an edge weight function, combining event time intervals, source system identifiers, and quality identifiers. The first threshold is used to shield low-weight connections to reduce the impact of noise.

[0129] On the other hand, monotonic temporal attention mask Within the inner layer of the attention span, attention is only allowed to flow from an earlier event node or an earlier temporal segment node to a later event node or a later temporal segment node. Bidirectional attention is maintained within the same temporal segment, while attention is prohibited from flowing from a later time segment to an earlier time segment between different temporal segments. When no operational segment exists, [further action is required]. The attention constraint degenerates into one that only allows target node timestamps to be not too late, without imposing monotonic temporal restrictions on the individual vertical layer, APG, and policy layer, ultimately outputting a relationship-aware attention mask. With monotonic temporal attention mask .

[0130] In this specific embodiment, S5 specifically includes:

[0131] Based on heterogeneous evidence graphs Relationship-aware attention mask and monotonic temporal attention mask The graph is encoded using a Transformer and then decoded and interactively corrected. First, an initial vector representation is constructed for each node. The initial vector of an event node is obtained by aligning the event type embedding, standard encoding embedding, and time position encoding calculated based on the time segment label and timestamp through the same linear transformation. Time segment nodes, nodes with recent history and similar disease course, APG trigger nodes, and policy version nodes are embedded using type embedding and their attribute encoding and uniformly mapped to the backbone representation space so that they can interact in the same attention mechanism.

[0132] Subsequently, a multi-head attention and feedforward network is implemented in a graph Transformer with a preset number of layers, and the attention calculation is performed in... and It is performed under dual constraints, and independent attention projection parameters are configured for edge types such as temporal order, causal dependency, mutual exclusion, inclusion, and prerequisite dependency, combined with the edge weight function. Attention coefficients are scaled proportionally to achieve structured information propagation, and residual connections and layer normalization are used within layers to stabilize training and improve representation capabilities.

[0133] After encoding, the main diagnostic decoding head and the main operation decoding head are set. Interactive attention is performed between the set of diagnostic nodes and the set of operation nodes to enable the semantic information in both directions from diagnosis to operation and from operation to diagnosis to be mutually corrected, thereby forming the interactively corrected diagnostic node representation and operation node representation.

[0134] Finally, candidate scores are calculated using linear mapping and activation functions, and unified as follows:

[0135] To represent the candidate scores;

[0136] in The type is candidate nodes scalar scoring, express Choose either diagnosis D or procedure O. Indicates belonging to type Node set Any node in, This represents the nodes after being encoded by the graph Transformer and corrected by the corresponding decoder head and interactive attention. The vector representation of , Indicates the type The candidate scores are linearly mapped to a weight vector, and the parameters are shared among nodes of the same type. This indicates that the result of a linear mapping is compressed into... The interval's monotonic activation function is used to combine with the probabilistic soft logic rule of step S6;

[0137] Output diagnostic candidate scores and operation candidate scores for subsequent constraint and combination scoring.

[0138] In this specific embodiment, S6 specifically refers to:

[0139] Based on the diagnostic candidate scoring and the operational candidate scoring, firstly, row indexes and column indexes are established according to the diagnostic node set and operational node set in the heterogeneous evidence graph, respectively, and an initial scoring matrix of candidate pairs arranged by diagnosis and operation is constructed, where each element corresponds to a pairing of a diagnostic node and an operational node.

[0140] Subsequently, based on the policy version, a set of probabilistic soft logic rules is loaded from the rule base. Weights and constraint types are assigned to each rule. The satisfaction of candidate pairs is calculated separately for time-series rules, mutual exclusion rules, inclusion rules, and prerequisite dependency rules. The satisfaction is then mapped to a continuous correction term. Elements that do not meet hard constraints are set to a minimum value before normalization to reflect invalidity. Mutual exclusion relationships are set to invalidity or reduced to a minimum value when the satisfaction exceeds the mutual exclusion threshold. Inclusion relationships are given a positive reward when the packaging condition is met. Prerequisite dependency relationships are retained or rewarded when the prerequisite is met, and penalized when the prerequisite is missing.

[0141] Finally, the constrained and corrected matrix is ​​normalized and smoothed to suppress noise and scaling bias, resulting in a combined scoring matrix arranged by diagnosis and operation. Its core calculation can be uniformly represented as follows:

[0142] ;

[0143] in Represents the diagnostic nodes in the combined scoring matrix. With operation node The final combination score of the corresponding elements. Represents any node in the set of diagnostic nodes. This represents any node in the set of operation nodes. and These represent the diagnostic candidate scores and operation candidate scores obtained in step S5, respectively. and This indicates that the diagnosis and the operation have non-negative weights in the initial weighted combination to balance their relative importance. This represents the set of probabilistic soft logic rules loaded by the policy version. This represents any one of the rules. Representation rules The non-negative weights are used to measure the strength of the rule's influence on the combined score. Indicates the rule For candidate pairs The continuous correction term obtained by mapping the satisfaction level to the constraint type takes a positive value to represent a reward and a negative value to represent a penalty. This indicates that the monotonic normalization and smoothing operators applied to the scores of all candidate pairs are used to map real-valued scores to... The range is guaranteed to be stable.

[0144] In the above process, the mutual exclusion threshold Used to determine whether the strength of a mutual exclusion relationship exceeds a threshold that invalidates an element; minimum value. Used to replace the score of the element when hard constraints are not satisfied or strong mutual exclusion is hit, thus effectively suppressing it during the normalization stage;

[0145] The final output is a combined scoring matrix containing the above elements, which is used for the selection of the first K terms of joint differentiability in step S7.

[0146] In this specific embodiment, S7 specifically refers to:

[0147] Based on the combined scoring matrix arranged by diagnosis and operation, a joint differentiable Top-K selection is performed on the candidate pairs. First, a candidate pair index is constructed using the set of diagnosis nodes and the set of operation nodes to form a candidate pair set, such that each candidate pair corresponds to an element in the combined scoring matrix.

[0148] Subsequently, a penalty mask for the selection layer is generated based on the mutually exclusive edges and inclusion edges in the heterogeneous evidence graph. Negative penalty coefficients are assigned to candidate pairs with mutual exclusion relationships and positive reward coefficients are assigned to candidate pairs with inclusion relationships. The penalty mask is then superimposed on the combined scoring matrix to obtain a penalty-adjusted joint score, thereby reflecting the joint consistency of mutual exclusion and inclusion in the same selection layer.

[0149] Based on this, a continuous relaxation function with a temperature parameter is used to generate a selection weight matrix that can be used for backpropagation, ensuring that the weights are non-negative and their sum is a preset positive integer K, uniformly defined as:

[0150] This indicates the calculation of the selection weights;

[0151] in This indicates the selection of the weight matrix in the diagnostic node. With operation node The non-negative weights at the corresponding positions Represents any node in the set of diagnostic nodes. This represents any node in the set of operation nodes. This indicates that the combined scoring matrix obtained in step S6 is in the candidate pair Scoring at the location This represents the candidate pairs obtained by the selection layer penalty mask mapping. The penalty and reward bias term is a weighted effect of mutually exclusive penalties and included rewards on the candidate pair. This indicates that the temperature parameter is used to control the smoothness of continuous relaxation and affects the sharpness of the weight distribution. This represents the normalization operator applied to all candidate pairs to ensure that the weights are non-negative and multiplied by . Then, summing over all candidate pairs yields... ;

[0152] Ultimately based on The candidate pair corresponding to the largest element in the middle determines the primary diagnosis and primary operation. When there are ties, the penalized joint score is used as the secondary sorting criterion to select the primary diagnosis and primary operation and output the result.

[0153] In this specific embodiment, S8 specifically refers to:

[0154] Based on the primary diagnosis With the main operation The main group mapping rules are matched according to the policy version to determine a unique APG main group. When multiple matches exist, one is selected according to the priority set by the policy version. If no match is found, no APG main group is generated and the settlement amount is set to zero.

[0155] Regarding the mapping of additional items, standardized medical visit event sequences are referenced. Conditional identification is performed on diagnostic events, operational events, prescription events, laboratory events, imaging events, and anesthesia events to generate additional set sets. These additional set sets are then merged and eliminated according to the deduplication and mutual exclusion rules of the policy version to form the final additional set set.

[0156] Next, the benchmark rates and weight parameters bound to the policy version are read from the clearing parameter database, including the APG main group weight and the weights of each supplementary group. At the same time, the rounding rules are read to ensure that the settlement amount is retained to the smallest unit of currency. In the case of the APG main group, the settlement amount is calculated using the following formula:

[0157] ;

[0158] in This indicates the final settlement amount. This is a rounding function that rounds the input value to the smallest unit of currency according to the rounding rules recorded in the clearing parameter library. This indicates the benchmark rate tied to the current policy version. This refers to the APG main group as defined by the current policy version. The principal group weights, This represents the set of additional groups after deduplication and mutual exclusion merging. express Any additional group in, Indicates additional group Additional group weights, The summation operator is represented on a set, and the doublet (•) represents the multiplication operator.

[0159] When no APG master group is matched To maintain consistency in settlement standards, the final output of the APG master group is as follows. Additional Group With settlement amount .

[0160] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

[0161] This invention constructs a heterogeneous evidence graph by using standardized medical visit events and pre-operative / operational / post-operative segments as input. This graph comprises an inner layer of medical visits, an individual longitudinal layer, and an APG and policy layer. Under the dual constraints of relation-aware attention masking and monotonic temporal attention, graph Transformer encoding is performed, and interactive decoding occurs between diagnosis and operation. Subsequently, probabilistic soft logic bound to the policy version is loaded to continuously correct candidate pairs using both soft and hard rules. Finally, a joint differentiable Top-K algorithm is used to collaboratively determine the primary diagnosis and primary operation at the same selection layer, completing the main group mapping and settlement calculation. This combination ensures that information propagation strictly follows temporal order, causality, and prerequisite dependencies, avoiding time backflow and uniformly reflecting mutual exclusion and inclusion relationships during the training and inference phases. Simultaneously, policy rules are internalized as measurable and fine-tunable constraints, allowing for rapid adaptation to policy version changes and reducing manual intervention. This achieves improved accuracy and stability of primary item identification, enhanced policy consistency, and traceable and interpretable technical effects for evidence subgraphs and rule hits, forming an end-to-end closed loop from primary item identification to amount calculation.

[0162] This invention makes targeted improvements to the algorithm structure: a three-layer heterogeneous evidence graph explicitly models the time sequence and longitudinal course of the disease within the patient's visit using business edges such as chronological order, causality, mutual exclusion, inclusion, and anesthesia prerequisites, and injects source and quality labels with edge weights to enhance robustness to noise and missing data; a relation-aware mask and a monotonic temporal mask are superimposed on multi-head attention, with independent projection parameters configured for different edge types and scaled according to edge weights, making the attention channel structurally constrained by business requirements; interactive decoding links diagnosis and operation at the representation layer and directly scores candidate pairs; continuous correction is performed by combining probabilistic soft logic bound to policy versions, and a differentiable Top-K superimposed mutual exclusion penalty and inclusion reward are used at the selection layer to achieve joint selection of candidate pairs. The above closed-loop structure reduces inconsistencies caused by post-rule placement, improves the global optimality and interpretability of joint decision-making, and maintains consistency in settlement criteria by only replacing the rule set and parameters when upgrading policy versions.

Claims

1. An APG settlement method based on outpatient disease grouping, characterized in that, include: S1. Standardize the diagnosis, procedures, prescriptions, tests, imaging, and anesthesia events of this visit, generate a standardized visit event sequence, and extract patient age, patient gender, department visited, policy version, and recent medical history. S2. Based on the timestamps of standardized medical visit event sequences, perform time-series segmentation to determine the start and end times of preoperative, operational, and postoperative segments, and generate time-series segment labels for each event; S3. Based on the standardized medical visit event sequence, patient age, patient gender, department visited, policy version, recent medical history and course of illness records, as well as the time segment labels and segment start and end times, construct a three-layer heterogeneous evidence graph. Create time segment nodes in the medical visit inner layer and attach event nodes according to labels. Connect recent medical history and course of illness nodes in the individual vertical layer. Set APG trigger nodes and policy version nodes in the APG and policy layers. Generate time sequence edges, causal dependency edges, mutually exclusive edges, inclusion edges and prerequisite dependency edges, and mark the direction. S4. Based on the edge type and direction of the heterogeneous evidence graph, as well as the temporal segment labels and segment start and end times, generate a relation-aware attention mask and a monotonic temporal attention mask. S5. Under the constraints of relation-aware attention mask and monotonic temporal attention mask, perform graph Transformer encoding on the heterogeneous evidence graph, set the main diagnostic decoding head and the main operation decoding head and perform interactive attention between them, and calculate the diagnostic candidate score and the operation candidate score respectively. S6. Based on the diagnostic candidate scores and operational candidate scores, and combined with the heterogeneous evidence graph, the candidate scores are constrained, corrected and combined according to the probability soft logic rule set loaded by the policy version, and a combined score matrix arranged by diagnosis and operation is generated. S7. Perform joint differentiable Top-K selection on the combined scoring matrix. In the same selection layer, perform joint selection on candidate pairs of diagnosis and operation, and apply mutual exclusion penalty and inclusion penalty. Output the main diagnosis and main operation. S8. Based on the main diagnosis and main operation and in combination with the policy version, determine the APG main group, map the supplementary items, read the benchmark rate and weight parameters from the clearing parameter library, calculate the settlement amount, and output the APG main group, supplementary group and settlement amount.

2. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S1 specifically refers to: The diagnostic codes, operation codes, prescription items, test results, imaging reports, anesthesia records, and their respective timestamps for this visit are standardized. The standardization process includes standard coding verification and mapping of diagnostic codes and operation codes, establishing a one-to-one correspondence between prescription items, test results, imaging reports, and anesthesia records and standard codes or item identifiers, and unifying the timestamps to a standard time format and correcting outliers. The test results and image reports are standardized in terms of text and units, and a one-to-one correspondence is established with the corresponding standard codes or project identifiers. Within the same medical visit, duplicate records are identified and merged based on standard codes or item identifiers and timestamps. Source system identifiers and quality identifiers are generated in the merged records, thereby forming a standardized medical visit event sequence that includes event type, standard code or item identifier, timestamp, source system identifier, and quality identifier. Retrieve patient age, gender, and department visited from basic medical records; Determine the policy version from the rule base; During the pre-set observation period, the diagnostic codes in the standardized medical visit event sequence are used to match the same or similar diagnoses, and recent medical records with the same course of disease are extracted from historical medical records. Output standardized medical visit event sequences, patient age, patient gender, department visited, policy version, and recent medical history.

3. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S2 specifically refers to: Based on the timestamps of the standardized medical visit event sequence, time-series segmentation is performed to determine the start and end times of the preoperative segment, the operation segment, and the postoperative segment, and a corresponding time-series segment label is generated for each event in the standardized medical visit event sequence; Specifically, the start and end times of an operation segment are determined by identifying the set of events corresponding to the operation code in a standardized medical event sequence. The start time of the operation segment is the earliest timestamp of the event set, and the end time of the operation segment is the latest timestamp of the event set. When anesthesia records exist, the start and end times of the anesthesia records are used to constrain the boundaries of the operation segment, so that the anesthesia start time is no later than the start time of the operation segment and the anesthesia end time is no earlier than the end time of the operation segment. The start time of the preoperative segment is the earliest timestamp of the standardized medical visit event sequence, and the end time of the preoperative segment is the maximum timestamp that does not exceed the start time of the operation segment. The start time of the postoperative segment is the earliest timestamp that is later than the end time of the operation segment, and the end time of the postoperative segment is the latest timestamp of the standardized medical event sequence. When there is no event set corresponding to the operation code, the preoperative segment covers the entire time range of the standardized medical visit event sequence, and the operation segment and postoperative segment are not generated. The time sequence segment label is assigned a value in the preoperative segment, operation segment, or postoperative segment based on the result that the event timestamp falls within the segment time range; Output the time sequence segment labels and segment start and end times, which include the start and end times of the preoperative segment, the start and end times of the operation segment, and the start and end times of the postoperative segment.

4. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S3 specifically refers to: Based on the time segment labels and segment start and end times, combined with standardized medical visit event sequences, patient age, patient gender, department visited, policy version, and recent medical history, a heterogeneous evidence graph is constructed, including an inner layer of medical visits, an individual longitudinal layer, and an APG and policy layer. Specifically, this includes: creating time segment nodes in the inner layer of medical visits, and attaching diagnostic events, operation events, prescription events, laboratory events, imaging events, and anesthesia events in the standardized medical visit event sequence to the corresponding time segment nodes according to the time segment labels, and generating event nodes. Create nodes with recent medical history and disease course at the individual vertical layer, and establish connections between these nodes and relevant diagnostic event nodes in the inner layer of medical visits based on diagnostic codes and timestamps to reflect the continuity of the disease course. Create APG trigger nodes and policy version nodes at the APG and policy layers, establish trigger relationships between APG trigger nodes and diagnosis event nodes and operation event nodes in the inner layer of medical treatment, and establish version binding relationships between policy version nodes and APG trigger nodes. In the heterogeneous evidence graph, chronological edges, causal dependency edges, mutually exclusive edges, inclusion edges, and prerequisite dependency edges are generated according to the order of events and business relationships. The direction of each edge is marked, and the edge weight is calculated based on the time interval of events, source system identifier, and quality identifier. Among them, chronological edges are used to point from an earlier event node or an earlier time segment node to a later event node or a later time segment node; causal dependency edges are used to represent the causal relationship between diagnostic events and operational events, as well as between prescription events and testing events; mutually exclusive edges are used to represent event pairs that cannot be used as primary items simultaneously under policy version constraints; inclusion edges are used to represent a group of events that should be included in the calculation under policy version constraints; and prerequisite dependency edges are used to represent the prerequisite constraint of anesthesia events on operational events. Output heterogeneous evidence graphs.

5. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S4 specifically refers to: Based on the edge types, directions, and weights recorded in the heterogeneous evidence graph, a relation-aware attention mask for graph Transformer attention computation is constructed. Specifically, mask channels are generated for temporal edges, causal dependent edges, mutually exclusive edges, containing edges, and prerequisite dependent edges, and an independent attention parameter set is assigned to each edge type. The allowed attention directions are consistent with the edge directions. Mutually exclusive edges are masked in both directions. Prerequisite dependent edges retain only the attention from the prerequisite node to the target node. Bidirectional attention is allowed for containing edges. The edge weights are filtered according to a first threshold, so that connections below the first threshold are masked in the mask, and connections above or equal to the first threshold are retained using the edge weight as a scaling factor. Simultaneously, a monotonic temporal attention mask is constructed based on the start and end times of the segments and the connection relationship between event nodes and temporal segment nodes in the heterogeneous evidence graph. Specifically, within the inner layer of the consultation, attention is only allowed to flow from event nodes or earlier temporal segment nodes to event nodes or later temporal segment nodes. Bidirectional attention is retained within the same temporal segment, while attention is prohibited from flowing from later to earlier times between different temporal segments. When there are no operation segments, the monotonic temporal attention mask degenerates into only allowing attention with timestamps no later than the target node timestamp. No monotonic temporal restrictions are imposed on the individual longitudinal layer, APG, and policy layer. Output relation-aware attention mask and monotonic temporal attention mask.

6. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S5 specifically refers to: An initial vector representation is constructed for each node in the heterogeneous evidence graph. The initial vector representation is obtained by concatenating event type embedding, standard encoding embedding, and time position encoding calculated based on the time segment labels and timestamps recorded in the heterogeneous evidence graph in a preset manner and then performing a linear transformation. Multi-head attention and feedforward networks are executed in the graph Transformer layers with a preset number of layers. The multi-head attention masks and scales the attention weights in each layer through relation-aware attention masks and monotonic temporal attention masks. Independent attention projection parameters are configured for temporal edges, causal dependent edges, mutually exclusive edges, inclusion edges, and prerequisite dependent edges. The attention coefficients are scaled proportionally by combining the edge weights recorded in the heterogeneous evidence graph. The updated node representation is obtained by using residual connections and layer normalization. Based on the updated node representation, a main diagnostic decoding head and a main operation decoding head are set up. The two share the backbone representation obtained by the aforementioned graph Transformer encoding and perform interactive attention between the diagnostic node set and the operation node set. Specifically, the main diagnostic decoding head calculates the interactive attention from diagnosis to operation using the diagnostic node representation as the query and the operation node representation as the key and value. The main operation decoding head calculates the interactive attention from operation to diagnosis using the operation node representation as the query and the diagnostic node representation as the key and value, so as to obtain the interactively corrected diagnostic node representation and operation node representation. Scalar values ​​are calculated for the interactively corrected diagnostic node representation and operational node representation respectively using linear mapping and activation function, and these values ​​are used as diagnostic candidate scores and operational candidate scores. Output diagnostic candidate scores and operation candidate scores.

7. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S6 specifically refers to: Based on the diagnostic candidate scores and operational candidate scores, row indices arranged by diagnosis and column indices arranged by operation are established according to the diagnostic node set and operational node set in the heterogeneous evidence graph to generate an initial scoring matrix for candidate pairs, where each element is a weighted combination of the corresponding diagnostic candidate score and operational candidate score. According to the policy version, load the probabilistic soft logic rule set from the rule base, and set the weight and constraint type for each rule. The constraint type includes hard constraints and soft constraints. The elements of the initial scoring matrix are corrected according to the timing rules, mutual exclusion rules, inclusion rules and prerequisite dependency rules. Specifically, the satisfaction of the timing rules is calculated based on the timing segment labels and the start and end times of the segments. The relationship that the anesthesia start time is earlier than the operation start time and the operation end time is earlier than the postoperative examination time is set as a hard constraint. The prohibition of using postoperative examination abnormalities as preoperative evidence is set as a hard constraint. Elements that do not meet the rules are set as invalid or reduced to a preset low value. Penalize relevant elements based on the mutual exclusion relationships defined in the policy version, and invalidate them when the mutual exclusion threshold is exceeded; Rewards are applied to relevant elements that meet the packaging conditions based on the inclusion relationships determined in the policy version; Based on the prerequisite dependency of the anesthesia event on the operation event, relevant elements are retained or rewarded when the prerequisite is met, and penalized or invalidated when the prerequisite is missing; The satisfaction of each rule is mapped to a continuous correction coefficient and then superimposed on the element value according to the weight to form a constraint-corrected scoring matrix. Normalization and smoothing are performed on the constrained and corrected scoring matrix to obtain a combined scoring matrix arranged by diagnosis and operation; Output the combined scoring matrix.

8. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S7 specifically refers to: Candidate pair indexes are constructed based on the combined scoring matrix, arranged by diagnosis and operation, and the elements of the combined scoring matrix are used as the joint scores of the candidate pairs. Based on the mutually exclusive edges and included edges marked in the heterogeneous evidence graph, a penalty mask for the selection layer is generated. The candidate pairs corresponding to the mutually exclusive edges are given a negative penalty coefficient in the penalty mask, and the candidate pairs corresponding to the included edges are given a positive reward coefficient in the penalty mask. The penalty mask is superimposed on the joint score of the candidate pair to obtain the penalty-adjusted joint score; For the penalized joint scores, perform joint differentiable Top-K selection, and use a continuous relaxation function with temperature parameter to generate the selection weight matrix, such that the sum of the non-negative elements of the selection weight matrix is ​​equal to K and can be used for backpropagation; The primary diagnosis and primary operation are determined based on the candidate pair corresponding to the largest element in the selection weight matrix. When there are ties, the penalized joint score is used as the secondary sorting criterion to determine the primary diagnosis and primary operation. Where K is a preset positive integer; Output the main diagnostics and main operations.

9. The APG settlement method based on outpatient disease grouping according to claim 1, characterized in that, S8 specifically refers to: The APG master group is determined based on the main diagnosis and main operation, combined with the policy version. Specifically, the master group triggering conditions are matched with the main diagnosis and main operation according to the master group mapping rules defined in the policy version. When there are multiple matches, a unique APG master group is determined according to the priority set in the policy version. When there is no match, no APG master group is generated and the settlement amount is set to zero. According to the policy version, additional items are mapped. Specifically, referring to the diagnostic events, operation events, prescription events, test events, imaging events and anesthesia events in the standardized medical event sequence, the set of events that meet the conditions is identified according to the additional item conditions defined in the policy version and additional groups are generated. Then, the additional groups are merged and removed according to the deduplication rules and mutual exclusion rules of the policy version. The benchmark rate and weight parameters corresponding to the policy version are read from the clearing parameter library. The weight parameters include the APG main group weight and the supplementary group weight. The supplementary group weights are aggregated into a combined weight according to the combination rules defined in the policy version. The settlement amount is calculated based on the benchmark rate, APG main group weight and portfolio weight, and rounded to the smallest unit of currency according to the rounding rules recorded in the clearing parameter library. Output the APG main group, supplementary group, and settlement amount.

10. An APG settlement system based on outpatient disease grouping, used to execute any one of the APG settlement methods based on outpatient disease grouping as described in claims 1 to 9, comprising: The data standardization module is used to generate standardized medical visit event sequences; The time-series segmentation module is used to divide the event sequence into preoperative, operational, and postoperative segments according to timestamps and generate segment labels. The heterogeneous evidence graph module is used to construct a three-layer heterogeneous evidence graph based on the sequence, patient information, and policy version. The mask generation module is used to generate relationship-aware attention masks and monotonic temporal attention masks based on edge type, direction and segment time. The graph encoding and decoding module is used to perform graph Transformer encoding under the mask constraint, set the main diagnostic and main operation decoding heads and pay attention to each other to obtain diagnostic candidate scores and operation candidate scores; The constraint and combined scoring module is used to load probabilistic soft logic rules according to policy version, perform constraint correction on the candidate scores, and generate a combined scoring matrix arranged by diagnosis and operation. The joint selection module is used to perform joint differentiable Top-K selection on the combined scoring matrix, superimpose mutually exclusive penalties and inclusion rewards, and output the main diagnosis and main operation. The group settlement module is used to determine the APG main group based on the main diagnosis, main operation and policy version, map the supplementary group, and read the benchmark rate and weight to calculate the settlement amount.