Write-protected ai agent medical appointment writing method

CN123030613APending Publication Date: 2026-11-03GUANGDONG BAIHUI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611053131.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-15
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

In multi-user concurrent reservation scenarios, the reservation write operation of the AI ​​agent is prone to data conflicts due to the inconsistency of resource status caused by the decision-execution gap. Traditional technologies are difficult to ensure the semantic consistency between the write operation and the decision basis in a high-concurrency environment.

Method used

A version identification mechanism for environment state snapshots and a write declaration isolation mechanism are constructed to decouple the write operation of the AI ​​agent into two independent links: declaration and execution. By intercepting the write operation of the AI ​​agent, a write declaration is generated, and the snapshot version identification is verified on the server side to ensure the consistency between the write decision and the system state.

Benefits of technology

It achieves semantic consistency and system reliability of AI agent write operations in high-concurrency environments, significantly improves data consistency and concurrent processing capabilities, and avoids write conflicts caused by decision-execution gaps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030613A_ABST
    Figure CN123030613A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of the cross of artificial intelligence and digital medical treatment, and provides an AI agent medical appointment writing method based on writing protection. In order to solve the problem of how to ensure that a medical appointment writing operation initiated by an AI agent is consistent with the current resource state of a target medical appointment system in semantics, the method maintains an environment state snapshot with a version identifier according to real-time data change records of the target medical appointment system, returns the current environment state snapshot and the snapshot version identifier when responding to an AI agent query, intercepts a reservation writing operation of the AI agent and extracts a snapshot version identifier carried in the reservation writing operation to generate a pseudo-writing declaration, compares and verifies the snapshot version identifier in the pseudo-writing declaration with the version identifier of the current environment state snapshot, and executes the reservation writing operation instead of the AI agent when the verification is passed, so that the data consistency and system reliability of the medical appointment writing under a high-concurrency environment are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the interdisciplinary field of artificial intelligence and digital healthcare, and particularly to the operational security and data writing control technology of AI agents, specifically to an AI agent medical appointment writing method based on write protection. Background Technology

[0002] AI agents (Artificial Intelligence Agents) are artificial intelligence entities capable of autonomously perceiving their environment, engaging in human-like cognition, making decisions and plans, and executing operations to complete specific tasks. In medical appointment scenarios, AI agents are used to automatically complete the query and writing operations for online registration, examination appointments, and other related matters based on user instructions. AI agent medical appointment writing refers to the process by which the AI ​​agent autonomously submits appointment requests to the medical appointment system and writes the appointment data into the system's database. With the development of large language models and intelligent agent technology, the application of AI agents in medical appointment scenarios is becoming increasingly widespread, effectively replacing manual operations and improving appointment efficiency.

[0003] Taking a multi-user concurrent appointment scenario as an example: Multiple users simultaneously initiate appointments for the same doctor's remaining slots at the same time through their respective AI agents. Each AI agent, upon making its decision, checks that the slot is "available" and then generates and sends out its own appointment write request. During this process, the medical appointment system needs to ensure that only one write request succeeds to prevent data conflicts caused by duplicate allocation of slots.

[0004] In traditional technologies, AI agents typically handle appointment writing in the following ways: First, the AI ​​agent directly calls the data write interface of the medical appointment system, submitting the appointment request to the system backend for persistent storage. Second, a transaction management mechanism based on database row-level locking or optimistic locking is introduced at the write interface layer. This mechanism uses version numbers or timestamps to verify whether the target record has been modified by other transactions since it was read when the data is submitted. Both methods rely on the AI ​​agent directly initiating and executing write operations to the target medical appointment system.

[0005] However, the inventors of this application discovered that in the aforementioned conventional technologies, there is a "decision-execution" time gap of seconds or even minutes between the AI ​​agent querying resource status, making decision-making plans, and finally generating and issuing write commands. During this time gap, the status of the target resource may be changed by other concurrent operations at any time, while the AI ​​agent's write decision is still based on outdated resource status information, leading to potentially conflicting write operations and easily causing data conflicts.

[0006] The core reason for this problem lies in the fact that traditional technologies follow a writing method where "AI agents directly write to the target medical appointment system." Under this method, there is only a momentary and non-continuous consistency relationship between the resource status relied upon by the AI ​​agent and the real-time resource status of the target medical appointment system. As a result, the writing operation of the AI ​​agent in traditional technology lacks the ability to verify the timeliness of its decision-making basis, making it difficult to ensure semantic consistency between the writing operation and the decision-making basis in a high-concurrency dynamic environment.

[0007] Therefore, ensuring that the medical appointment writing operation initiated by the AI ​​agent is semantically consistent with the current resource status of the target medical appointment system has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0008] To address the aforementioned technical issues, this invention provides an AI agent-based medical appointment writing method based on write protection. By constructing a version identification mechanism for environment state snapshots and a write declaration isolation mechanism, the write operation of the AI ​​agent is decoupled into two independent stages: "declaration" and "execution." This differs from the traditional architecture where the AI ​​agent directly initiates and executes writes to the target medical appointment system. It can fundamentally eliminate the problem of inconsistent write semantics caused by the gap between AI agent decision-making and execution, and significantly improve the data consistency and system reliability of medical appointment writing in high-concurrency environments.

[0009] To address the aforementioned technical problems, this invention provides the following technical solution: an AI agent-based medical appointment writing method with write protection, applied to the server side, comprising: maintaining an environment state snapshot reflecting the real-time resource status of the target medical appointment system based on real-time data change records from the target medical appointment system, the environment state snapshot having a version identifier; responding to the AI ​​agent's query for the current resource status of the target medical appointment system, returning the current environment state snapshot of the target medical appointment system and the corresponding snapshot version identifier to the AI ​​agent; intercepting the appointment writing operation initiated by the AI ​​agent targeting the target medical appointment system, and generating a proposed write declaration, the proposed write declaration containing the snapshot version identifier extracted from the appointment writing operation to isolate the direct write path of the AI ​​agent to the target medical appointment system, wherein the appointment writing operation carries the snapshot version identifier of the environment state snapshot on which the AI ​​agent makes its decision; verifying the snapshot version identifier carried in the proposed write declaration based on the current environment state snapshot to determine whether the environment state snapshot represented by the snapshot version identifier is consistent with the current environment state snapshot; when the consistency verification passes, replacing the AI ​​agent, executing the appointment writing operation to the target medical appointment system.

[0010] As a preferred embodiment of the AI ​​agent medical appointment writing method based on write protection described in this invention, the method intercepts the appointment writing operation initiated by the AI ​​agent targeting the target medical appointment system and generates a proposed write statement, including: identifying the target appointment resource identifier and appointment time parameter carried in the appointment writing operation; extracting the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes its decision from the parameters of the appointment writing operation; and encapsulating the target appointment resource identifier, the appointment time parameter, and the extracted snapshot version identifier into the proposed write statement.

[0011] Beneficial Effects: The solution implemented in this invention first achieves real-time mirroring and versioned management of the resource status of the target medical appointment system by maintaining an environment state snapshot with a version identifier based on real-time data change records from the target medical appointment system, providing an objective and reliable timeliness benchmark for subsequent verification. Based on this, by returning the current environment state snapshot and its snapshot version identifier along with the AI ​​agent query, an explicit association is established between the AI ​​agent's decision-making cognition and the system state snapshot version, enabling the AI ​​agent's write requests to carry the environment version information upon which its decision is based. Furthermore, by intercepting the AI ​​agent's direct write operations and generating a proposed write declaration containing the snapshot version identifier, the invention achieves... An operational isolation mechanism separates the AI ​​agent's writing intent from its execution actions, blocking the direct writing path of the AI ​​agent to the target medical appointment system. Furthermore, by comparing and verifying the snapshot version identifier carried in the intended write statement with the version identifier of the current environment state snapshot, proactive verification of the cognitive timeliness of the AI ​​agent's write operation is achieved. The write semantics are only considered valid when the environment state snapshot version on which the agent makes the decision is consistent with the current system environment state snapshot version. Finally, after the consistency verification is passed, the server takes over the AI ​​agent's role in executing the appointment write operation to the target medical appointment system, realizing the transfer of write decision-making power from the AI ​​agent with cognitive delay to the system side that is synchronized with the environment in real time.

[0012] By combining the above interconnected effects, a write protection mechanism was constructed that consists of "environment snapshot versioning, agent cognition binding, write operation isolation, version validity verification, and agent execution separation".

[0013] Therefore, unlike the traditional architecture where the AI ​​agent directly initiates and executes writes to the target medical appointment system and relies on transaction locks for passive post-event verification, this invention decouples the AI ​​agent's write operation into two independent stages: "proposed write declaration" and "proxy execution." It uses the version identifier of the environment state snapshot as the verification benchmark for cognitive timeliness, transforming the traditional passive and lagging "transaction verification" mode into a proactive and real-time "cognitive timeliness verification" mode. This fundamentally eliminates the semantic inconsistency problem caused by the AI ​​agent's decision-making-execution time gap, ultimately achieving semantic consistency assurance for medical appointment writes by the AI ​​agent in a high-concurrency dynamic environment. This significantly improves the data consistency, system reliability, and concurrent processing capabilities of AI agent medical appointment writes. Attached Figure Description

[0014] Figure 1 A flowchart illustrating the AI-assisted medical appointment writing method based on write protection provided in an embodiment of the present invention; Figure 2 A schematic diagram of the first sub-process of the AI ​​agent medical appointment writing method based on write protection provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the second sub-process of the AI ​​agent medical appointment writing method based on write protection provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0015] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to specific examples. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. 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.

[0016] It should be noted that the AI ​​agent medical appointment writing method based on write protection involved in this embodiment of the invention is a data processing and write control technology solution for medical appointment business processes. It aims to improve data consistency and system reliability of AI agent write operations in medical appointment scenarios by performing real-time mirror maintenance of the resource status of the target medical appointment system and performing timeliness verification of AI agent write operations based on version identifiers of environment status snapshots. The data objects processed in this embodiment of the invention are resource status information and appointment write operation requests in the medical appointment business process. The output result is the execution status of the appointment write operation, without involving the collection, analysis, or judgment of any physiological or pathological parameters, nor outputting any medical conclusions constituting the basis for disease diagnosis or treatment. The information provided by this method is only used as a technical processing link in the medical appointment process. In actual applications, appointment decisions and medical service provision should be carried out by qualified medical institutions and professionals in accordance with relevant laws, regulations, and medical standards.

[0017] This invention provides an AI-powered agent-based medical appointment writing method based on write protection. This method can be a data processing and write control engine hosted on a server or cloud platform, capable of directly driving digital healthcare application scenarios including but not limited to the following multi-dimensional scenarios: First, in an intelligent appointment management platform, the timeliness of appointment writing operations initiated by the AI ​​agent is verified and executed by proxy through a version identification mechanism of the environment state snapshot, achieving conflict-free appointment writing in a high-concurrency environment; Second, in the hospital information system's external access gateway, serving as a unified security protection layer for AI agent appointment writing operations, the gateway side maintains an environment state snapshot and intercepts direct appointment writing by the AI ​​agent. The invention addresses several key aspects of AI healthcare. First, it addresses the issue of data consistency in AI agent appointment writing. First, it establishes a controlled data writing channel for third-party AI applications. Second, in a medical resource scheduling system, it maintains a versioned mirror of real-time status for medical resources such as appointment slots and examination resources based on environmental state snapshots, providing a consistent resource status view and write control mechanism for concurrent operations by multiple AI agents. Third, in an integrated intelligent triage and appointment system, it decouples the AI ​​agent's triage decisions from its appointment writing behavior, using the version identifier of the environmental state snapshot as the verification basis for the validity of the appointment writing operation, enabling refined management and audit traceability of the AI ​​agent's appointment writing behavior. This invention solves the semantic consistency problem of AI agent appointment writing operations in highly dynamic environments, providing a reusable core technology capability for secure AI agent writing in the digital healthcare field.

[0018] The following detailed description of some embodiments of the present invention is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0019] Example 1: AI agent medical appointment writing method based on write protection.

[0020] In this embodiment, please refer to Figure 1 , Figure 1 This is a flowchart illustrating the AI-assisted medical appointment writing method based on write protection provided in an embodiment of the present invention. Figure 1 As shown, in this embodiment, the method is applied to the server side and includes the following steps S11-S15: S11: Based on the real-time data change records from the target medical appointment system, maintain an environmental state snapshot that reflects the real-time resource status of the target medical appointment system, the environmental state snapshot having a version identifier.

[0021] An environment state snapshot is a data structure maintained in server-side memory or persistent storage to reflect the current state of various appointment resources in the target medical appointment system in real time. These resources include, but are not limited to, doctor appointment slots, examination equipment time slots, and clinic schedules. The version identifier of the environment state snapshot uniquely identifies the current version of the snapshot. When the snapshot content is updated due to data changes, the version identifier is updated synchronously. In this invention, the environment state snapshot serves as an objective benchmark for verifying the timeliness of AI agent write operations.

[0022] The specific implementation of this step is as follows: First, the server-side data synchronization module establishes a connection with the target medical appointment system to capture change data and continuously receives real-time data change records from the target medical appointment system. The method for obtaining real-time data change records will be detailed in the subsequent embodiment 2.

[0023] Secondly, the snapshot maintenance module on the server side parses each received data change record, extracts the change operation type (such as adding a new number source, modifying the status, deleting resources, etc.), the target reservation resource identifier, and the changed resource status information.

[0024] Then, based on the parsing results, the snapshot maintenance module synchronously updates the node status attributes of the corresponding target reserved resources in the environment status snapshot in the memory data structure, and updates the version identifier of the environment status snapshot. The method of generating the version identifier will be detailed in the subsequent embodiment 3.

[0025] It should be noted that the maintenance method for the aforementioned environmental state snapshots is not limited to memory-based data structures. In one example, a disk-based persistent storage method can be used, achieving efficient reading and writing of large-capacity snapshots through memory-mapped files; in another example, a distributed caching architecture can be used, distributing environmental state snapshots across multiple server nodes to support high-concurrency query scenarios. Any technical means capable of maintaining a data mirror causally consistent with the state of the target medical appointment system in real time falls within the protection scope of this invention.

[0026] For example, consider the scenario of online appointment booking in a hospital. The target medical appointment system is a hospital information system (HIS system), assuming it contains appointment slots for Doctor A on a certain morning. Initially, there are 10 available slots. The server-side data synchronization module subscribes to the HIS system's database change log. When a user successfully books one slot through another channel, the corresponding number of available slots in the HIS system database is updated to 9, and an UPDATE operation log is generated. The data synchronization module captures this change record, and the snapshot maintenance module updates the status attribute of the corresponding slot node in the environment state snapshot from "available slots 10" to "available slots 9", and updates the version identifier of the environment state snapshot from V1 to V2.

[0027] In step S11, by continuously maintaining an environment state snapshot with version identifier based on real-time data change records from the target medical appointment system, discrete state change events within the target medical appointment system are aggregated into a versioned unified state structure description that can be queried and verified externally. This provides an objective and traceable timeliness benchmark for the subsequent cognitive binding and write verification of the AI ​​agent, solving the problem that the timeliness of AI agent cognition cannot be objectively measured due to the lack of a unified and versioned system state reference system.

[0028] S12: In response to the AI ​​agent's query on the current resource status of the target medical appointment system, return a snapshot of the current environment status of the target medical appointment system and the corresponding snapshot version identifier to the AI ​​agent.

[0029] The specific implementation of this step is as follows: First, the server-side query interface module receives resource status query requests initiated by the AI ​​agent. These requests may include query conditions such as the target doctor's identifier, appointment date range, and department type. In this invention, the AI ​​agent undertakes the tasks of status query and appointment writing in medical appointment scenarios. This can be driven by a large language model or based on a preset rule engine. Before initiating the write operation, the AI ​​agent first queries the server for the currently available resource status as the basis for its subsequent appointment decision.

[0030] Secondly, the query interface module extracts matching resource status information from the currently maintained environment status snapshot based on the query conditions, forming a query result set.

[0031] Then, the query interface module obtains the version identifier of the current environment state snapshot (i.e., the snapshot version identifier), encapsulates the query result set and the corresponding snapshot version identifier together into a query response, and returns it to the AI ​​agent that initiated the query.

[0032] It should be noted that the encapsulation method of the above query response is not limited to returning the snapshot version identifier as a separate field. In one example, the snapshot version identifier can be embedded in the metadata header of the query result set; in another example, the snapshot version identifier can be returned as a custom field in the HTTP response header. Any technical means that can transmit the version identifier of the environment state snapshot along with the query results to the AI ​​agent is within the protection scope of this invention.

[0033] For example, continuing the previous example, before deciding to make an appointment, a user's AI agent queries the server for the availability of doctor A's appointments on a certain morning. Upon receiving the query request, the query interface module extracts the status attribute (9 available slots) of the appointment node from the current environment state snapshot and obtains the version identifier V2 of the current environment state snapshot. The query interface module encapsulates "9 available slots" and the version identifier "V2" together into a query response and returns it to the AI ​​agent. Based on this, the AI ​​agent learns that there are currently 9 available slots and that the environment snapshot version upon which its decision was based is V2.

[0034] In step S12, when responding to an AI agent query, the version identifier of the current environment state snapshot is actively returned along with the resource state information. This establishes an explicit version association between the AI ​​agent's cognitive environment and the current resource state of the target medical appointment system. This provides a traceable version basis for subsequent verification of the timeliness of the AI ​​agent's written intent, and solves the problem that the timeliness of its decision basis cannot be traced due to the lack of association between the AI ​​agent's cognitive environment and the resource state of the target medical appointment system.

[0035] S13: Intercept the appointment writing operation initiated by the AI ​​agent for the target medical appointment system, and generate a proposed writing statement. The proposed writing statement includes a snapshot version identifier extracted from the appointment writing operation to isolate the direct writing path of the AI ​​agent to the target medical appointment system. The appointment writing operation carries the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes the decision.

[0036] Appointment write operation: This refers to an appointment write operation request initiated by the AI ​​agent to the target medical appointment system based on its decision results, aimed at creating or modifying persistent appointment data records. The appointment write operation request is typically issued via HTTP API calls or remote procedure calls, and includes business data such as the target appointment resource identifier, appointment time parameters, and user information. In this invention, the appointment write operation also forcibly carries the snapshot version identifier of the environment state snapshot on which the AI ​​agent made its decision, and the snapshot version identifier is obtained from the query response in step S12.

[0037] A write intention statement is a structured data object generated by the server after intercepting the AI ​​agent's write operation. It encapsulates the AI ​​agent's write intent rather than directly executing the write operation. The write intention statement contains the target appointment resource identifier, appointment time parameters, and snapshot version identifier extracted from the write operation. The generation of the write intention statement signifies that the AI ​​agent's write path has been isolated—its write intent is captured and recorded, but no longer directly affects the target medical appointment system; instead, it serves as input for subsequent verification.

[0038] The specific implementation of this step is as follows: First, the server-side write interception module monitors all network requests sent by the AI ​​agent and identifies requests whose target address is the write interface of the target medical appointment system.

[0039] Secondly, when a booking write operation is detected, the write interception module intercepts the booking write operation request and prevents it from being directly sent to the target medical booking system. The interception can be implemented using reverse proxies, API gateway interception, or request middleware mechanisms, etc.

[0040] Then, the write interception module extracts the snapshot version identifier, the target reserved resource identifier, and the reserved time parameter from the request parameters of the scheduled write operation. The specific extraction process will be described in detail in the subsequent embodiment 5.

[0041] Finally, the write interception module encapsulates the extracted information into a write declaration object, thus completing write isolation.

[0042] It should be noted that the above-mentioned write interception implementation methods are not limited to reverse proxies. In one example, SDK instrumentation can be used to intercept the AI ​​agent's write interface calls through code injection; in another example, the service mesh's Sidecar proxy pattern can be used to transparently intercept all outgoing traffic through the sidecar container. Any technical means that can intercept the AI ​​agent's appointment write operation requests and prevent them from directly reaching the target medical appointment system falls within the protection scope of this invention.

[0043] For example, following the previous example, the AI ​​agent, based on the environment state of version V2 (9 available slots), decides to book an appointment with Doctor A for user on that morning and initiates a booking write operation. The booking write operation request can carry business parameters (target booking resource identifier = DR_LI_0715_AM, booking time period = 2026-04-15 08:00-12:00, user ID = P001), and also includes the snapshot version identifier "V2" in its request parameters. The server-side write interception module recognizes the booking write operation request, intercepts it, and prevents it from being forwarded to the HIS system. The write interception module extracts the snapshot version identifier "V2", the target booking resource identifier "DR_LI_0715_AM", and the booking time parameter "2026-04-15 08:00-12:00" from the request parameters, encapsulates this information into a write declaration object, and completes write isolation.

[0044] In step S13, by intercepting the direct write operation of the AI ​​agent and generating a proposed write declaration, the write behavior of the AI ​​agent is decoupled into two independent links: "intent declaration" and "execution action". This blocks the direct write path of the AI ​​agent to the target medical appointment system, laying the operational isolation foundation for subsequent timeliness verification and agent execution. It solves the problem that the inconsistent writing semantics caused by the AI ​​agent's cognitive lag due to its direct write to the target medical appointment system cannot be actively intercepted.

[0045] S14: Based on the current environment state snapshot, verify the snapshot version identifier carried in the statement to be written, so as to determine whether the environment state snapshot represented by the snapshot version identifier is consistent with the current environment state snapshot.

[0046] The specific implementation of this step is as follows: First, the server-side verification module obtains the version identifier of the current environment state snapshot.

[0047] Secondly, the verification module reads the snapshot version identifier carried in the statement to be written.

[0048] Then, the verification module compares the two snapshot version identifiers to determine if they are consistent. The specific comparison method will be detailed in the subsequent embodiment 4. If they are consistent, the verification is deemed successful, indicating that the environmental state on which the AI ​​agent made its decision is consistent with the current environmental state of the system, and its writing intent is still semantically valid; if they are inconsistent, the verification is deemed unsuccessful, indicating that the resource state of the target medical appointment system has changed during the decision-execution gap of the AI ​​agent, and the AI ​​agent's writing intent is based on outdated environmental cognition, resulting in a problem of inconsistent writing semantics caused by the AI ​​agent's decision-execution gap.

[0049] It should be noted that the above-mentioned snapshot version identification comparison and verification can be further performed with a dual verification mechanism after the comparison is consistent, to ensure write security. The specific dual verification process will be described in detail in the subsequent embodiment 10.

[0050] For example, following the previous example, the verification module obtains the version identifier of the current environment state snapshot. At the current moment, if the number of slots for this account has not been changed by other operations, the current version identifier is still V2. The verification module reads the snapshot version identifier "V2" from the declaration to be written, compares the two, and if they match, the consistency verification is deemed successful. If, at the current moment, this account has been reserved by another user through other channels, and the snapshot version identifier has been updated to V3, the verification module finds that "V2" and "V3" are inconsistent, and the consistency verification is deemed unsuccessful.

[0051] In step S14, the snapshot version identifier of the AI ​​agent decision-making process in the proposed declaration is compared and verified with the version identifier of the current environment state snapshot. This enables an objective assessment of the timeliness of the AI ​​agent's writing intent. It transforms the passive verification of the correctness of the writing operation in traditional technology into an active timeliness verification based on the environment version identifier. This solves the problem that the inconsistent writing semantics caused by the inability to determine whether the AI ​​agent's decision-making basis is outdated makes it difficult to identify.

[0052] S15: After the consistency verification is passed, the AI ​​agent is replaced to perform the appointment writing operation to the target medical appointment system.

[0053] The specific implementation of this step is as follows: First, after the consistency verification in step S14 is passed, the server-side write execution module extracts the target reservation resource identifier and reservation time parameter from the declaration to be written.

[0054] Secondly, the write execution module constructs a write request that conforms to the interface specification of the target medical appointment system based on the extracted information. The format and parameters of this write request are consistent with the original request that the AI ​​agent was going to send, but the initiator is changed to the server itself.

[0055] Then, the write execution module sends the write request to the target medical appointment system to perform the actual data persistence operation.

[0056] Finally, the execution module receives the execution result returned by the target medical appointment system and performs subsequent processing based on the result. If the execution is successful, a success response can be returned to the AI ​​agent; if the execution fails, a retry can be initiated based on the reason for the failure, or a failure message can be returned to the AI ​​agent.

[0057] It should be noted that the above-mentioned proxy method for write execution is not limited to the server directly constructing new requests. In one example, a request forwarding method can be used, where, after successful verification, the original AI proxy's request is unblocked, a system signature is added, and it is directly forwarded to the target medical appointment system. In another example, a transactional write method can be used, placing the update of the local environment state snapshot and the call to the external system for write in the same distributed transaction to ensure eventual consistency.

[0058] For example, following the previous example, after successful verification, the write execution module extracts the target appointment resource identifier "DR_LI_0715_AM", the appointment time slot "2026-04-15 08:00-12:00", and the user ID "P001" from the intended write declaration. Based on the HIS system's appointment interface specifications, the write execution module constructs an appointment write request and submits it to the HIS system as a server, completing the appointment for user P001 with doctor A for that time slot. After successful write, a success response is returned to the AI ​​agent.

[0059] In step S15, after verification, the server takes over the actual scheduled write operation from the AI ​​agent, which has cognitive delays, and transfers the write decision-making power from the AI ​​agent to the server that is synchronized with the environment in real time. This fundamentally eliminates the impact of the AI ​​agent's decision-making-execution gap on the semantic consistency of writes and solves the problem of inconsistent write semantics caused by the AI ​​agent's cognitive lag.

[0060] In this embodiment, through sequential processing of S11-S15, an environment state snapshot with a version identifier is constructed. When the AI ​​agent queries, the snapshot version identifier is bound, and its write operation is intercepted to generate a proposed write declaration to achieve operation isolation. Based on the snapshot version identifier comparison, timeliness verification is performed. After the verification is passed, the appointment write operation is executed by proxy. The complete implementation of the AI ​​agent medical appointment writing method based on write protection is achieved. Its core lies in: decoupling the appointment write operation of the AI ​​agent into two independent links, "proposed write declaration" and "proxy execution". Using the version identifier of the environment state snapshot as the verification benchmark, the traditional "transaction verification" mode is transformed into a proactive "cognitive timeliness verification" mode, providing a core technical solution for secure writing of AI agents in the field of digital healthcare.

[0061] Example 2: Specific implementation of CDC-based environmental state snapshot maintenance.

[0062] In this embodiment, based on real-time data change records from the target medical appointment system, an environmental state snapshot reflecting the real-time resource status of the target medical appointment system is maintained, including: Based on the change data capture mechanism, subscribe to the database operation logs of the target medical appointment system; Parse the insert, update, and delete operation records in the database operation log; Based on the parsing results, the status attributes of each reserved resource node in the environment status snapshot and the version identifier of the environment status snapshot are synchronously updated in the memory data structure.

[0063] Change Data Capture (CDC) is a technical mechanism that monitors database transaction logs to identify and capture data change events (such as INSERT, UPDATE, DELETE, etc.) and transmits these events to downstream systems for processing in real time. Its general working principle can be found in well-known CDC technologies and will not be elaborated upon here. In this invention, CDC is chosen instead of periodic polling as the synchronization mechanism for environment state snapshots based on the following technical considerations: First, CDC can capture atomic change events at the database level, achieving millisecond-level synchronization latency between the data source and the environment state snapshot. In contrast, with polling, the synchronization latency is affected by the polling cycle, potentially reaching seconds or even minutes in high-frequency change scenarios, failing to meet the real-time requirements of AI agent write timeliness verification. Second, CDC performs incremental synchronization based on database logs, transmitting only change records rather than the entire dataset, significantly reducing data transmission overhead and server load in scenarios with frequent changes in the database source. Third, CDC's change events carry precise transaction commit timestamps, providing an accurate time reference for generating version identifiers for environment state snapshots and subsequent timeliness comparisons.

[0064] A reservation resource node is a data unit in an environment state snapshot that represents a single reservation resource. Each reservation resource node includes, but is not limited to, the following attributes: a unique resource identifier (such as a combination of doctor ID, date, and time period), the current status of the resource (such as available, occupied, locked, expired, etc.), the time window for available reservations (including start and end times), and the last update timestamp. Reservation resource nodes are the basic building blocks of an environment state snapshot, and real-time updates to their status attributes are the direct trigger for changes in the snapshot version identifier.

[0065] The specific implementation of this embodiment is as follows: First, the server-side data synchronization module configures the CDC connection parameters, including the database type of the target medical appointment system, the connection address, authentication credentials, and the range of database tables to be subscribed to (at least including the appointment resource table and the appointment record table). After configuration, the data synchronization module establishes a subscription connection through the CDC interface provided by the database (such as MySQL's binlog subscription interface or PostgreSQL's logical replication slots) and begins receiving database operation log streams.

[0066] Secondly, the event parser of the data synchronization module parses each received log record, extracting the operation type (such as INSERT, UPDATE, DELETE, etc.), the operation object (such as table name, row identifier, etc.), and the changed field values. Specifically, an INSERT operation indicates the addition of a reservable resource; an UPDATE operation indicates a change in the status attributes of an existing resource; and a DELETE operation indicates the removal of an existing resource.

[0067] Then, the snapshot maintenance module performs the corresponding in-memory data structure update operation based on the parsing results. Specifically, for the INSERT operation, a new reservation resource node is created in the in-memory data structure, and its status attributes are initialized; for the UPDATE operation, the corresponding node is located based on the row identifier, and its status attributes are updated; for the DELETE operation, the corresponding node is marked for deletion or directly removed from the in-memory data structure. After each successful update, the snapshot maintenance module synchronously updates the version identifier of the environment state snapshot; the specific update method will be detailed in the subsequent embodiment 3.

[0068] It should be noted that the scope of the database operation logs subscribed to by the CDC is not limited to the appointment resource table. In one example, the subscription scope can be expanded to include the scheduling table, resource relationship table, etc., to build a more comprehensive view of the environmental status snapshot; in another example, the received operation logs can be filtered to process only change records related to the current active appointment period, thereby reducing unnecessary update overhead for the environmental status snapshot. Any technical means that can achieve incremental synchronization of environmental status snapshots based on database change logs is within the protection scope of this invention.

[0069] For example, continuing the previous example, the target medical appointment system is a hospital's HIS system, and its database is assumed to be MySQL, with the appointment resource table being `appointment_slots`. The data synchronization module is configured to connect to the binlog subscription interface of this database and subscribe to the change log of the `appointment_slots` table. When an UPDATE operation occurs in this table, updating the `available_count` field of the record `slot_id="DR_LI_0715_AM"` from 10 to 9, the event parser of the data synchronization module parses the record from the binlog, extracting the operation type UPDATE, the row identifier `slot_id="DR_LI_0715_AM"`, and the changed field `available_count=9`. Based on this, the snapshot maintenance module locates the node "DR_LI_0715_AM" in the in-memory data structure, updates its `available_count` attribute to 9, updates `last_update_time` to the current timestamp, and triggers a version identifier update.

[0070] In this embodiment, by subscribing to database operation logs based on the CDC mechanism, the state changes of the target medical appointment system are synchronized to the environment state snapshot in memory in an incremental and real-time manner. This transforms the passive and delayed synchronization mode that relies on timed polling in traditional technology into an active and real-time synchronization mode based on log driving. Thus, based on the snapshot maintenance achieved in Embodiment 1 above, it further realizes millisecond-level synchronization between the environment state snapshot and the state of the target medical appointment system, solving the problem of delayed updates to the environment state snapshot caused by the polling cycle, and significantly improving the real-time performance and synchronization efficiency of the environment state snapshot.

[0071] Example 3: Specific implementation of version identifier generation based on hash value.

[0072] In this embodiment, based on the parsing results, the status attributes of each reserved resource node in the environment state snapshot and the version identifier of the environment state snapshot are synchronously updated in the memory data structure, including: Perform a hash operation on the complete content of the updated environment state snapshot to obtain a hash value; Use the hash value as the identifier for the updated version.

[0073] The specific implementation of this embodiment is as follows: First, after completing the update operation on the status attributes of the reserved resource nodes in the memory data structure, the snapshot maintenance module obtains the complete content of the entire environment status snapshot. The complete content includes the identifiers, status attribute values ​​and topology of all nodes (if a graph data structure is used, edge information is also included).

[0074] Secondly, the snapshot maintenance module calls a preset hash function, serializing the complete content of the environment state snapshot into a byte stream as input to the hash function, and calculates a fixed-length hash value. The preset hash function refers to a pre-selected cryptographic hash algorithm used to map input data of arbitrary length to a fixed-length digest. In this invention, SHA-256 is chosen as the preset hash function based on the following technical considerations: First, SHA-256 has strong collision resistance; the probability of different environment state snapshot contents generating the same hash value is computationally infeasible, ensuring the uniqueness and anti-counterfeiting properties of the version identifier. Second, SHA-256 outputs a fixed 256-bit digest, ensuring a constant version identifier length, which facilitates storage and comparison. Third, SHA-256 is widely standardized and has mature hardware acceleration support, with controllable computational overhead, and the real-time performance of environment state snapshot updates is not significantly reduced by hash operations.

[0075] Then, the snapshot maintenance module uses the calculated hash value as the updated version identifier to replace the old version identifier. The version identifier can be stored as a string in the metadata area of ​​the environment state snapshot and returned to the querying party along with the content of the environment state snapshot.

[0076] It should be noted that the generation method of the above version identifier is not limited to the SHA-256 hash algorithm. In one example, the MD5 hash algorithm can be used, which is suitable for scenarios with strict limitations on the length of the version identifier; in another example, an incremental version number combined with a hash value can be used, with the version number part used for fast sorting and the hash value part used for integrity verification. Any technical means that can uniquely and deterministically identify the version of the environmental state snapshot content is within the protection scope of this invention.

[0077] For example, following the previous example, after updating the available_count of node "DR_LI_0715_AM" from 10 to 9, the snapshot maintenance module obtains the complete content of the entire environment state snapshot (including the state attributes of all source nodes) and calls the SHA-256 hash function to calculate the hash value "a3b2c1d4e5f6..." (256 bits). The snapshot maintenance module uses this hash value as the new version identifier, replacing the original version identifier V2. Thereafter, any AI agent query will obtain resource status information carrying this new hash value.

[0078] In this embodiment, a version identifier is generated by hashing the complete content of the updated environment state snapshot. A unique and deterministic mapping relationship is established between the version identifier and the snapshot content in a cryptographic sense. Based on the incremental synchronization of snapshots in Embodiment 2 above, the anti-counterfeiting, uniqueness and content integrity of the version identifier are further realized. This further solves the problem that the content change cannot be accurately judged due to the decoupling of the version identifier and the snapshot content, and significantly improves the reliability and traceability of the version identifier.

[0079] Example 4: Specific implementation of version identifier verification based on bit-by-bit comparison.

[0080] In this embodiment, based on the current environment state snapshot, the snapshot version identifier carried in the declaration to be written is verified to determine whether the environment state snapshot represented by the snapshot version identifier is consistent with the current environment state snapshot, including: The snapshot version identifier to be written into the declaration is compared bit by bit with the version identifier of the current environment state snapshot; When the bitwise comparison results are completely identical, the consistency verification is deemed to have passed; If the bitwise comparison results are different, the consistency verification is deemed to have failed.

[0081] The specific implementation of this embodiment is as follows: First, the verification module extracts the snapshot version identifier string from the declaration to be written, and obtains the current environment state snapshot version identifier string from the metadata area of ​​the current environment state snapshot.

[0082] Secondly, the verification module compares the two version identifier strings character by character. This character-by-character comparison means starting from the first character of each string and comparing each corresponding character to see if they are the same, until all characters have been compared. Since the version identifier in Example 3 is a fixed-length hash value, the time complexity of this character-by-character comparison is O(1), a constant, making the comparison extremely fast.

[0083] Then, the verification module outputs the verification conclusion based on the character-by-character comparison results. If all corresponding characters in the two strings are exactly the same, the consistency verification is deemed to have passed, indicating that the environment state at the time of AI agent decision-making is consistent with the environment state of the current target medical appointment system; if at least one character is different, the consistency verification is deemed to have failed, indicating that the environment state has changed after the AI ​​agent made the decision.

[0084] It should be noted that the comparison method for the version identifiers mentioned above is not limited to bit-by-bit comparison. In one example, a direct string equivalence comparison can be used, utilizing the built-in string comparison functions of the programming language; in another example, the lengths of the two version identifiers can be compared first. If the lengths are different, they are directly determined to be inconsistent; if the lengths are the same, then a bit-by-bit or overall comparison can be performed. Any technical means that can accurately determine whether two version identifiers are consistent falls within the protection scope of this invention.

[0085] For example, following the previous example, the verification module extracts the snapshot version identifier "a3b2c1d4e5f6..." from the declaration to be written, and obtains the current version identifier from the current environment state snapshot, which is also "a3b2c1d4e5f6...". The verification module compares the two strings character by character; if all characters are the same, the consistency verification is deemed successful. If, after the AI ​​agent's decision, the environment state snapshot has been updated again due to other write operations, and the current version identifier becomes "b4c3d2e1f6a5...", then the comparison result is different, and the consistency verification is deemed unsuccessful.

[0086] In this embodiment, by comparing the snapshot version identifier to be written in the declaration with the version identifier of the current environment state snapshot bit by bit, the determinism and efficiency of version identifier consistency verification are achieved. Thus, based on the hash version identifier implemented in the above embodiment 3, the O(1) time complexity of the verification process is further realized, which further solves the problem that the verification step may become a performance bottleneck in the scenario of massive write requests, and significantly improves the verification efficiency.

[0087] Example 5: Specific implementation of the proposed declaration generation.

[0088] In this embodiment, please refer to Figure 2 , Figure 2 This is a schematic diagram of the first sub-process of the AI ​​agent medical appointment writing method based on write protection provided in an embodiment of the present invention. Figure 2 As shown, in this embodiment, the AI ​​agent's attempt to write an appointment to the target medical appointment system is intercepted, and a written declaration is generated, including: S21: Identify the target reservation resource identifier and reservation time parameter carried in the reservation writing operation; S22: Extract the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes its decision from the parameters of the reservation write operation; S23: Encapsulate the target reservation resource identifier, the reservation time parameter, and the extracted snapshot version identifier into the statement to be written.

[0089] Target Appointment Resource Identifier: This is an information field used to uniquely identify the target resource for this appointment during the appointment write operation. The format of the Target Appointment Resource Identifier depends on the interface design of the target medical appointment system. It can be a combined string composed of a doctor identifier, department identifier, and time slot identifier, or it can be the primary key ID or UUID of the appointment resource table. The Target Appointment Resource Identifier is used to locate the corresponding appointment resource node in the environment state snapshot for subsequent verification and write operations.

[0090] Appointment time parameters: These are a set of information fields used to specify the appointment time range in an appointment write operation. Appointment time parameters typically include the appointment start time and end time, and may also include auxiliary fields such as appointment date and time period type. Appointment time parameters are used to verify whether the time window of the appointment resource matches the request in the environment state snapshot, and to provide necessary business parameters for the final write operation.

[0091] The specific implementation of this embodiment is as follows: First, the write interception module parses the intercepted appointment write operation request, identifying the target appointment resource identifier field and appointment time parameter field carried in the request. The field identification method can be based on preset field mapping rules, which define the standard names of each field in the target medical appointment system interface specification and their positions within the appointment write operation request body.

[0092] Secondly, the write interception module extracts the value of the snapshot version identifier field from the scheduled write operation request parameters. The standard name of the snapshot version identifier field can be pre-defined as "snapshot_version_id" or "env_state_version", etc., and is passed by the AI ​​agent as part of the request parameters when initiating the scheduled write operation request.

[0093] Then, the write interception module encapsulates the extracted target reservation resource identifier, reservation time parameter, and snapshot version identifier into a structured write declaration object. The encapsulation process may include: creating a write declaration data structure instance and assigning the three extracted values ​​to the corresponding fields of that data structure instance. The write declaration data structure can be implemented using a JSON object, a protocol buffer message, or a key-value pair collection in memory.

[0094] It should be noted that the implementation of the above field extraction and encapsulation is not limited to predefined mapping rules. In one example, a dynamic parameter extraction method based on reflection can be used to automatically traverse the set of parameters for the reservation write operation request and extract the target fields based on parameter name pattern matching. In another example, a parameter validation mechanism can be introduced to verify the format validity of the target reservation resource identifier and the logical rationality of the reservation time parameter after extraction. Any technical means that can extract key parameters from the AI ​​proxy write request and construct the proposed write statement falls within the protection scope of this invention.

[0095] For example, following the previous example, the write interception module intercepts the HTTP POST request initiated by the AI ​​agent. The request body is in JSON format: {"slot_id": "DR_LI_0715_AM", "start_time": "2026-04-15 08:00", "end_time": "2026-04-15 12:00", "patient_id": "P001", "snapshot_version_id": "a3b2c1d4e5f6..."}. Based on preset field mapping rules, the write interception module identifies slot_id as the target appointment resource identifier, and start_time and end_time as appointment time parameters. It then extracts the value of the snapshot_version_id field from the request parameters. The extracted slot_id=DR_LI_0715_AM, the reservation time parameter 2026-04-15 08:00 to 12:00, and the snapshot version identifier a3b2c1d4e5f6... are encapsulated into a write declaration object.

[0096] In this embodiment, the original write request of the AI ​​agent is transformed into a standardized write declaration data object through three steps: identification, extraction and encapsulation. This further realizes the structured expression and standardized encapsulation of the write intent based on the write isolation achieved in Embodiment 1 above. It further solves the problem of difficulty in parameter parsing in the subsequent verification process caused by the difference in write request formats of different AI agents, and significantly improves the system's compatibility and the standardization of the processing flow.

[0097] Example 6: Specific implementation of exception handling for missing and invalid snapshot version identifiers.

[0098] In this embodiment, after extracting the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes its decision from the parameters of the scheduled write operation, the method further includes: If the parameters of the scheduled write operation do not carry a snapshot version identifier, or if the snapshot version identifier does not conform to the preset identifier format, the scheduled write operation is rejected and an error response is returned to the AI ​​agent. The error response is used to indicate that the scheduled write operation lacks a valid snapshot version identifier.

[0099] The preset identifier format refers to a predefined set of rules used to verify the validity of the snapshot version identifier field format. In this invention, since the version identifier can be generated by the SHA-256 hash algorithm, the preset identifier format can be defined as a 64-character hexadecimal string (i.e., a hexadecimal representation of a 256-bit hash value), containing only the characters 0-9 and af. The preset identifier format can be stored in a configuration file or rule engine on the server side for the verification module to call during the parameter verification phase.

[0100] The specific implementation of this embodiment is as follows: First, after extracting the snapshot version identifier, the write interception module performs a validity check, which includes two steps: existence check and format check. The existence check determines whether the extracted snapshot version identifier field is empty or null; the format check determines whether the value of the extracted snapshot version identifier field conforms to the preset identifier format.

[0101] Secondly, if either the existence check or the format verification fails, the write interception module rejects the scheduled write operation and does not execute the subsequent write declaration encapsulation steps.

[0102] Then, the write interception module constructs an error response object, which contains an error code (such as "ERR_MISSING_VERSION_ID" or "ERR_INVALID_VERSION_ID") and an error description (such as "The scheduled write operation lacks a valid snapshot version identifier"). The write interception module returns the error response object to the AI ​​agent that initiated the write operation.

[0103] Finally, when the existence check and format verification both pass, the write interception module continues to execute the subsequent write declaration encapsulation steps according to the normal process described in Example 5 above.

[0104] It should be noted that the error response method described above is not limited to a JSON object containing an error code and description. In one example, the error response may include retry guidance information, prompting the AI ​​agent to re-initiate the resource status query to obtain a valid snapshot version identifier; in another example, the error response may include a log tracking identifier, used to associate with the server's error log records, facilitating subsequent troubleshooting. Any technical means that can return valid error information to the AI ​​agent when version identifier verification fails is within the scope of protection of this invention.

[0105] For example, continuing from the previous example, when the write interception module extracts the snapshot version identifier field from the scheduled write operation request parameters of the AI ​​agent, it finds that the field does not exist, that is, the request parameters do not carry snapshot_version_id. Based on this, the write interception module rejects the scheduled write operation, constructs an error response object: {"error_code": "ERR_MISSING_VERSION_ID", "error_message": "Scheduled write operation lacks a valid snapshot version identifier"}, and returns it to the AI ​​agent.

[0106] In this embodiment, by adding a validity verification step after the version identifier is extracted, missing or invalid version identifiers are actively intercepted and a clear error response is returned. Thus, based on the declaration generation implemented in Embodiment 5 above, early detection and deterministic processing of abnormal write requests are further realized. This further solves the problem of abnormal internal processing logic or silent failure of write operation caused by the AI ​​agent not carrying the version identifier according to the specification, and significantly improves the robustness and observability of the system.

[0107] Example 7: Specific implementation of snapshot maintenance based on graph data structure.

[0108] In this embodiment, the environmental state snapshot is maintained using a graph data structure. The nodes in the graph data structure represent appointment resources in the target medical appointment system. The attributes of the nodes include the identifier of the appointment resource, its current status, and the available appointment time. The edges in the graph data structure represent the association and constraint relationships between the appointment resources.

[0109] Reservation resources: In this invention, these refer to medical service units available for user reservation in the target medical reservation system, including but not limited to doctor appointment slots, examination equipment time slots, clinic schedules, and treatment bed time slots. Each reservation resource corresponds to an independent graph node in the environment state snapshot, and the node's attribute set fully describes the current availability status of the resource.

[0110] The specific implementation of this embodiment is as follows: First, the snapshot maintenance module constructs and maintains environment state snapshots in memory in the form of a graph data structure. Here, a graph data structure refers to an abstract data type composed of a set of nodes and a set of edges. Its general mathematical definition and storage method can be found in well-known graph theory knowledge in this field, and will not be elaborated upon here.

[0111] Secondly, the snapshot maintenance module creates a node for each reserved resource. The node's attributes may include: resource identifier (a unique identifier for the reserved resource, such as a string concatenated from resource type, resource ID, and time period identifier), current status (enumerated values, including available, occupied, locked, expired, etc.), available time period (a time interval including start and end times), and last update timestamp.

[0112] Then, the snapshot maintenance module establishes edges between corresponding nodes based on the business relationships between each appointment resource. These relationships include, but are not limited to: mutual exclusion between appointment slots for the same doctor at different times (if a user has booked an appointment with the same doctor for a specific time slot, they cannot book another time slot with that doctor), occupancy relationships between different time slots in the same consultation room, and dependency relationships between doctor appointment slots and consultation room schedules (appointment allocation must be based on availability in the corresponding consultation room). Edges may have a type attribute to identify the type of relationship constraint.

[0113] It should be noted that the storage method of the above graph data structure is not limited to an in-memory implementation based on adjacency lists. In one example, a graph database can be used for persistent storage, and a graph query language can be used for efficient association queries and constraint validation. In another example, weight attributes can be attached to nodes and edges to express the priority or strictness of constraints. Any technical means that can use graph structures to express reserved resources and their relationships are within the scope of protection of this invention.

[0114] For example, following the previous example, the environmental state snapshot is maintained using a graph data structure. Taking the appointment resources for Doctor A on April 15, 2026 as an example, the snapshot maintenance module creates two nodes: Node A represents the morning appointment slot (DR_LI_0715_AM), with the attributes {Status: Available, Available Appointment Time: 08:00-12:00}; Node B represents the afternoon appointment slot (DR_LI_0715_PM), with the attributes {Status: Available, Available Appointment Time: 13:00-17:00}. Since the same user cannot book both the morning and afternoon appointments with the same doctor simultaneously, an undirected edge of type "mutual exclusion constraint" is established between Node A and Node B. When the AI ​​agent queries, it can obtain not only the status of individual nodes but also the associated constraint information.

[0115] In this embodiment, by maintaining the environmental state snapshot using a graph data structure, nodes are used to express resource status and edges are used to express the association and constraint relationships between resources. Based on the snapshot maintenance implemented in Embodiment 1 above, this embodiment further realizes the structured modeling of complex business constraints in the environmental state of the target medical appointment system. This further solves the problem that traditional key-value pairs or relational table structures are difficult to intuitively express and efficiently query the constraint relationships between resources, and significantly improves the information expression capability of the environmental state snapshot and the efficiency of subsequent constraint verification.

[0116] Example 8: Specific implementation of environment change notification after verification failure.

[0117] In this embodiment, please refer to Figure 3 , Figure 3 This is a schematic diagram of the second sub-process of the AI ​​agent medical appointment writing method based on write protection provided in an embodiment of the present invention. Figure 3 As shown, in this embodiment, after verifying the snapshot version identifier carried in the statement to be written, the method further includes: S31: When the consistency verification fails, extract the latest resource status corresponding to the target reserved resource identifier in the declaration to be written from the current environment state snapshot; S32: Generate an environment change notification containing resource status change information based on the latest resource status; S33: Send the environment change notification to the AI ​​agent to trigger the AI ​​agent to re-make the reservation decision based on the resource status change information.

[0118] Environment Change Notification: This refers to a structured message proactively pushed by the server to the AI ​​agent when its scheduled write operation is rejected due to timeliness verification failure. The message contains the latest resource status information. The environment change notification includes: the resource identifier involved in the change, the latest status attributes after the change, the timestamp of the change, and a description of the change type. The format of the environment change notification can be pre-defined, such as using a JSON structure. Compared to simply returning an error code, the environment change notification proactively provides the AI ​​agent with the information needed for its cognitive update, enabling it to re-make decisions based on the latest status, rather than blindly retrying.

[0119] The specific implementation of this embodiment is as follows: First, when the consistency verification in step S14 fails, the verification module triggers the environment change notification generation process.

[0120] Secondly, the server-side notification module extracts the latest status attributes of the target reservation resource from the current environment state snapshot, using the target reservation resource identifier carried in the declaration as an index. This includes, but is not limited to, the current status (such as occupied), available reservation time slots, and remaining slots.

[0121] The notification module then compares the latest extracted resource status information with the status before the change (which can be inferred from verification differences or obtained from snapshot change history) to generate a structured environment change notification. The environment change notification contains a complete description of the resource change information.

[0122] Finally, the notification module sends the generated environment change notification to the AI ​​agent through a preset communication channel, which can be a WebSocket long connection, HTTP callback, or message queue subscription. After receiving the environment change notification, the AI ​​agent can parse the latest resource status information contained therein, update its internal environment perception, and accordingly re-plan its appointment strategy, such as selecting other time slots or other doctors.

[0123] It should be noted that the generation method of the above-mentioned environment change notification is not limited to containing only the change information of a single resource. In one example, the environment change notification may include the status change information of multiple related resources related to the AI ​​agent's current reservation task, in order to provide more comprehensive cognitive update data; in another example, information recommending alternative resources may be attached to the environment change notification to guide the AI ​​agent to make reservations for available resources. Any technical means that can proactively push the latest status information to the AI ​​agent after verification failure to assist it in re-decision-making is within the protection scope of this invention.

[0124] For example, continuing from the previous example, if the AI ​​agent initiates a write operation with version identifier V2, but the current environment state snapshot version has been updated to V3 (e.g., due to other operations taking up the last available slot), the consistency verification fails. The notification module extracts the latest status of the target appointment resource "DR_LI_0715_AM" from the current environment state snapshot: status = occupied, remaining slots = 0. Based on this, the notification module generates an environment change notification: {"resource_id": "DR_LI_0715_AM", "new_status": "occupied", "available_count": 0, "change_timestamp": "2026-04-15 09:05:23", "change_type": "slots full"}. This environment change notification is pushed to the AI ​​agent, which learns that there are no available slots for this appointment and can adjust the appointment target to an appointment for the same doctor on the same afternoon.

[0125] In this embodiment, by actively extracting the latest resource status and generating an environment change notification to push to the AI ​​agent when verification fails, a closed-loop mechanism of "verification failure → information feedback → cognitive refresh → re-decision" is constructed. Thus, based on the write protection achieved in Embodiment 1 above, it further realizes the proactive repair and decision guidance of the AI ​​agent's cognitive state, solves the problem that the AI ​​agent cannot recover autonomously due to simple write rejection, and significantly improves the system's intelligence level and user experience.

[0126] Example 9: Specific Implementation of Writing Audit Logs In this embodiment, after performing the appointment writing operation on the target medical appointment system in place of the AI ​​agent, the method further includes: Generate a write audit record corresponding to the scheduled write operation. The write audit record includes the intended write statement, the result of the consistency verification, the execution timestamp of the scheduled write operation, and the execution result. The written audit records are stored in a preset audit log database.

[0127] The specific implementation of this embodiment is as follows: First, after the write operation in step S15 is completed, the audit module on the server side collects the complete context information of this write operation. The context information may include: the object to be written (including the target appointment resource identifier, appointment time parameter, snapshot version identifier), the result of consistency verification (such as the pass time and the verification method used), the execution timestamp (such as the exact time when the write operation was initiated), and the execution result (such as success / failure, status code and message returned by the target medical appointment system, etc.).

[0128] Secondly, the audit module assembles the collected context information into an audit log object. The structure of the audit log object can be predefined, containing all the fields mentioned above, and can be supplemented with auxiliary fields such as operation serial number and AI agent identifier.

[0129] Then, the audit module serializes the written audit record objects and stores them in a pre-configured audit log database. This pre-configured audit log database is a data storage system pre-configured for persistently storing audit records. It can be an independent relational database (such as a dedicated audit database instance), a time-series database (suitable for massive log storage and retrieval), or a distributed log storage system. Choosing an audit log database independent of the business database ensures the integrity and immutability of the audit records.

[0130] It should be noted that the storage method for the aforementioned audit records is not limited to single-entry writing. In one example, a batch writing method can be used to aggregate audit records within a preset time window or a preset quantity threshold and write them in batches to improve storage throughput. In another example, audit records can be digitally signed, and the signature value can be stored together to enhance the tamper-proof nature and legal validity of the audit records. Any technical means that can completely record the writing operation context information and persistently store it falls within the protection scope of this invention.

[0131] For example, following the previous example, after the execution module successfully completes the reservation write operation to the HIS system, the audit module collects complete information about this reservation write operation: the content to be written (target reservation resource = DR_LI_0715_AM, time period = 08:00-12:00, version identifier = a3b2c1...), verification result (passed, verification method = bit-by-bit comparison), execution timestamp (2026-04-15 09:05:24.123), and execution result (successful, HIS return code = 200). The audit module assembles this information into a write audit record and stores it in the preset audit log database.

[0132] In this embodiment, a complete write operation traceability mechanism is constructed by automatically generating and storing a write audit record containing the full operation context after the scheduled write operation is completed. This further realizes the traceability of the entire lifecycle of the scheduled write operation on the basis of the write protection achieved in Embodiment 1 above, solves the problem that the details of the scheduled write operation cannot be verified afterward due to the lack of operation records, and significantly improves the system's security audit capability and accountability traceability capability.

[0133] Example 10: Specific implementation of write security based on dual verification.

[0134] In this embodiment, before performing the appointment writing operation on the target medical appointment system in place of the AI ​​agent after the consistency verification is passed, the method further includes: Read the current state of the target reserved resource to which the statement to be written is intended from the current environment state snapshot; Verify whether the current status of the target reserved resource meets the preset writable conditions; When the consistency verification passes and the current state of the target appointment resource meets the preset writable condition, the step of replacing the AI ​​agent and performing the appointment writing operation to the target medical appointment system is executed.

[0135] Predefined writable conditions refer to a predefined set of rules used to determine whether the current status of the target reservation resource allows a reservation write operation. Predefined writable conditions may include, but are not limited to, at least one of the following: the current status of the target reservation resource is "available"; the remaining slots for the target reservation resource are greater than zero; the available reservation time period of the target reservation resource covers the reservation time parameter of the request; the target reservation resource is not locked or reserved by other transactions. Predefined writable conditions are stored in the form of rule expressions in the server-side configuration file or rule engine, and can be configured and updated by operations and maintenance personnel according to business needs.

[0136] The specific implementation of this embodiment is as follows: First, after the consistency verification in step S14 passes, the dual verification module on the server side reads the current status attributes of the target reservation resource node from the current environment state snapshot, using the target reservation resource identifier to be written in the declaration as an index.

[0137] Secondly, the dual verification module compares the current status attribute it reads with the preset writable conditions one by one. The comparison process is as follows: iterate through the preset set of writable condition rules and check whether the current status attribute meets the rule requirements for each rule.

[0138] Then, the dual verification module integrates the consistency verification result and the writable condition verification result. Only when the consistency verification passes and the current state of the target reserved resource meets all preset writable conditions will the write execution process in step S15 begin. If any verification fails, the write operation for the reservation is rejected, and a response containing the rejection reason can be returned to the AI ​​agent. The rejection reason may include specific information such as the state not meeting the write conditions or the target reserved resource being preempted.

[0139] It should be noted that the timing of the aforementioned dual verification is not limited to after consistency verification. In one example, writability verification and consistency verification can be performed in parallel to reduce end-to-end latency; in another example, writability verification can be performed before consistency verification as a first-stage fast filter, with the computationally expensive version identifier comparison only performed after the fast filter passes. Any technical means that can perform additional verification of the target reserved resource status before write execution falls within the protection scope of this invention.

[0140] For example, following the previous example, the consistency verification passes (both version identifiers are V2). The dual verification module reads the current status of the target reserved resource "DR_LI_0715_AM" from the current environment state snapshot: status = available, remaining slots = 9. The preset writable conditions include: the current status must be "available" and the remaining slots must be greater than 0. The dual verification module verifies that the current status meets the above conditions and determines that the verification passes. Since both the consistency verification and the writable condition verification pass, the process proceeds to step S15 to perform the write operation. If, during this process, the slot is preempted by other concurrent operations and the status changes to "occupied", then the writable condition verification fails, and the write operation is rejected.

[0141] In this embodiment, by adding a verification of the writable condition of the current state of the target reserved resource after the version identifier consistency verification is passed and before the scheduled write operation is executed, a dual protection mechanism of "version verification + state verification" is constructed. Thus, based on the timeliness verification achieved in the above embodiment 1, the defense against resource state changes at the last moment of scheduled write operation execution is further realized, solving the problem of resource state being concurrently preempted due to the micro-gap between version identifier verification and write execution, and significantly improving the security of write operation.

[0142] Example 11: An integrated example of combining multiple technical features.

[0143] The AI ​​agent medical appointment writing method based on write protection described in the above embodiments can be recombined with the technical features included in different embodiments as needed to obtain a combined implementation scheme, but all are within the protection scope claimed by this invention.

[0144] For example, combining the basic scheme of Example 1 with the graph data structure snapshot scheme of Example 7 and the hash version identifier scheme of Example 3 can constitute an enhanced write protection system that possesses both the ability to express complex business constraints in a structured manner and the cryptographically strong version identifier anti-counterfeiting capability. In this combined scheme, the environment state snapshot maintains the reserved resource nodes and their associated constraint relationships using a graph data structure. After each environment state snapshot update, a version identifier is generated through SHA-256 hash operation, so that the version identifier not only reflects the integrity of the content but also covers changes in the constraint relationships between resources.

[0145] For example, combining the basic solution of Example 1 with the anomaly handling solution of Example 6 and the environment change notification solution of Example 8 can constitute a closed-loop write protection system with anomaly self-healing capabilities. In this combined solution, when the AI ​​agent's scheduled write operation request is rejected due to the lack of a valid version identifier, the system returns a clear error response; when the scheduled write operation request is rejected due to timeliness verification failure, the system proactively pushes an environment change notification containing the latest resource status, triggering the AI ​​agent to re-query and make a decision, thereby forming a complete closed loop of "anomaly detection → information feedback → cognitive refresh → re-decision".

[0146] For example, combining the CDC snapshot maintenance scheme of Example 2, the bit-by-bit comparison verification scheme of Example 4, and the dual verification scheme of Example 10 can constitute a real-time write protection system with end-to-end low latency and high security. In this combined scheme, the CDC mechanism ensures that the environmental state snapshot and the target medical appointment system are synchronized at the millisecond level, the bit-by-bit comparison verification provides efficient timeliness verification with O(1) time complexity, and the dual verification performs the final defense of the target medical appointment system's resource status before the appointment write operation is executed. The three work together to achieve full-link security protection from data synchronization, timeliness verification to write execution.

[0147] For example, combining the write declaration generation scheme of Example 5, the audit log scheme of Example 9, and the exception handling scheme of Example 6 can constitute a compliant write protection system with full lifecycle traceability. In this combined scheme, each scheduled write operation, from request interception, write declaration generation, version verification to final execution or rejection, generates a complete audit log and persists it. In case of exceptions, a standardized error response is returned, meeting the strict requirements of medical information systems for operational compliance and post-event auditing.

[0148] The above combinations are merely illustrative and do not constitute a limitation on the scope of protection of this invention. Those skilled in the art can flexibly select and combine technical features from different embodiments according to the needs of actual application scenarios to obtain the optimal technical solution adapted to a specific scenario.

[0149] In one embodiment, a computer device is provided, which may be a server or a cloud platform, and its internal structure diagram may be as follows. Figure 4As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When executed by the processor, the computer program implements the functions or steps of a write-protected AI-assisted medical appointment writing method.

[0150] Those skilled in the art will understand that the methods provided in the embodiments of the present invention can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. The methods can also be implemented as a computer program product stored in one or more computer-readable storage media, including but not limited to: disks, optical disks, read-only memory (ROM), random access memory (RAM), flash memory, etc. When the computer program product is executed by one or more data processing devices (such as computers), the devices perform the steps as described in any of the foregoing method embodiments.

[0151] The software tools, components, or models not belonging to our company that appear in the embodiments of this invention are merely illustrative examples and do not represent actual use.

[0152] The data collection in this embodiment of the invention complies with the requirements of relevant laws and regulations, such as the Data Security Law of the People's Republic of China, the Personal Information Protection Law of the People's Republic of China, GDPR (General Data Protection Regulation of the European Union), or information security standards of other countries and regions.

[0153] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A write-protection-based AI agent medical appointment writing method, applied on the server side, characterized in that, include: Based on real-time data change records from the target medical appointment system, maintain an environment status snapshot that reflects the real-time resource status of the target medical appointment system, and the environment status snapshot has a version identifier; In response to the AI ​​agent's query on the current resource status of the target medical appointment system, a snapshot of the current environment status of the target medical appointment system and the corresponding snapshot version identifier are returned to the AI ​​agent; Intercept the appointment writing operation initiated by the AI ​​agent for the target medical appointment system, and generate a proposed write statement. The proposed write statement includes a snapshot version identifier extracted from the appointment writing operation to isolate the direct write path of the AI ​​agent to the target medical appointment system. The appointment writing operation carries the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes the decision. Based on the current environment state snapshot, the snapshot version identifier carried in the statement to be written is verified to determine whether the environment state snapshot represented by the snapshot version identifier is consistent with the current environment state snapshot. Once the consistency verification is successful, the AI ​​agent will replace the AI ​​agent to perform the appointment writing operation to the target medical appointment system.

2. The AI-assisted medical appointment writing method based on write protection as described in claim 1, characterized in that, Based on real-time data change records from the target medical appointment system, maintain an environmental state snapshot reflecting the real-time resource status of the target medical appointment system, including: Based on the change data capture mechanism, subscribe to the database operation logs of the target medical appointment system; Parse the insert, update, and delete operation records in the database operation log; Based on the parsing results, the status attributes of each reserved resource node in the environment status snapshot and the version identifier of the environment status snapshot are synchronously updated in the memory data structure.

3. The AI-assisted medical appointment writing method based on write protection as described in claim 2, characterized in that, Based on the parsing results, the status attributes of each reserved resource node in the environment state snapshot and the version identifier of the environment state snapshot are synchronously updated in the memory data structure, including: Perform a hash operation on the complete content of the updated environment state snapshot to obtain a hash value; Use the hash value as the identifier for the updated version.

4. The AI-assisted medical appointment writing method based on write protection as described in claim 3, characterized in that, Based on the current environment state snapshot, the snapshot version identifier carried in the declaration to be written is verified to determine whether the environment state snapshot represented by the snapshot version identifier is consistent with the current environment state snapshot, including: The snapshot version identifier to be written into the declaration is compared bit by bit with the version identifier of the current environment state snapshot; When the bit-by-bit comparison results are completely identical, the consistency verification is deemed to have passed; If the bitwise comparison results are different, the consistency verification is deemed to have failed.

5. The AI-assisted medical appointment writing method based on write protection as described in claim 1, characterized in that, Intercept the appointment write operation initiated by the AI ​​agent targeting the target medical appointment system, and generate a write declaration, including: Identify the target reservation resource identifier and reservation time parameter carried in the reservation writing operation; Extract the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes its decision from the parameters of the reservation write operation; The target reservation resource identifier, the reservation time parameter, and the extracted snapshot version identifier are encapsulated into the declaration to be written.

6. The AI-assisted medical appointment writing method based on write protection as described in claim 5, characterized in that, After extracting the snapshot version identifier of the environmental state snapshot on which the AI ​​agent makes its decision from the parameters of the scheduled write operation, the method further includes: If the parameters of the scheduled write operation do not carry a snapshot version identifier, or if the snapshot version identifier does not conform to the preset identifier format, the scheduled write operation is rejected, and an error response is returned to the AI ​​agent. The error response is used to indicate that the scheduled write operation lacks a valid snapshot version identifier.

7. The AI-assisted medical appointment writing method based on write protection as described in any one of claims 1-6, characterized in that, The environmental state snapshot is maintained using a graph data structure. Nodes in the graph data structure represent appointment resources in the target medical appointment system. The attributes of each node include the identifier of the appointment resource, its current status, and the available appointment time. The edges in the graph data structure represent the association and constraint relationships between the appointment resources.

8. The AI-assisted medical appointment writing method based on write protection as described in any one of claims 1-6, characterized in that, After verifying the snapshot version identifier carried in the statement to be written, the method further includes: When the consistency verification fails, the latest resource status corresponding to the target reserved resource identifier in the declaration to be written is extracted from the current environment state snapshot; Based on the latest resource status, generate an environment change notification containing information on the resource status change; The environmental change notification is sent to the AI ​​agent to trigger the AI ​​agent to re-make the reservation decision based on the resource status change information.

9. The AI-assisted medical appointment writing method based on write protection as described in any one of claims 1-6, characterized in that, After performing the appointment writing operation on the target medical appointment system in place of the AI ​​agent, the method further includes: Generate a write audit record corresponding to the scheduled write operation. The write audit record includes the intended write declaration, the result of the consistency verification, the execution timestamp of the scheduled write operation, and the execution result. The written audit records are stored in a preset audit log database.

10. The AI-assisted medical appointment writing method based on write protection as described in any one of claims 1-6, characterized in that, After the consistency verification passes, before performing the appointment writing operation on the target medical appointment system in place of the AI ​​agent, the process further includes: Read the current state of the target reserved resource to which the statement to be written is intended from the current environment state snapshot; Verify whether the current status of the target reserved resource meets the preset writable conditions; When the consistency verification passes and the current state of the target appointment resource meets the preset writable condition, the step of replacing the AI ​​agent and performing the appointment writing operation to the target medical appointment system is executed.