Blockchain and llm combined medical data dynamic authorization system
Patent Information
- Application Number
- CN202610959720.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-10-09
AI Technical Summary
这种“字段识别+存证”的简单堆叠,既没有发挥LLM对上下文、意图、语义边界的深度理解能力,也没有将区块链智能合约从被动记录升级为主动的语义决策引擎
该区块链与LLM融合的医疗数据动态授权系统中,通过构建统一的多维语义向量空间,将医疗数据内容与访问请求均映射为语义向量,由区块链智能合约自动计算语义相似度并动态生成精细化授权令牌,从而实现了字段级、语义级的最小必要授权,彻底改变了传统角色权限模型的粗粒度授权模式。语义驱动的脱敏等级根据请求场景与数据敏感度的匹配程度自适应调整,无需人工审批,在急救等紧急场景下自动放宽权限,显著提升授权响应速度。行为语义监测模块持续采集操作行为序列并生成语义轨迹向量,实时校验行为与授权意图的一致性,一旦偏差超限即触发链上权限回收,形成从授权到审计的闭环合规体系,有效降低数据泄露与滥用风险。本发明将LLM的深度语义理解能力与区块链的确定性执行、不可篡改特性有机融合,从“规则驱动”升级为“语义驱动”,为医疗数据要素化流通提供了一种可动态适应法规变化、全程可追溯的安全信任基础设施。
Smart Images

Figure CN122885887A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical data technology, and more specifically, to a dynamic authorization system for medical data that integrates blockchain and LLM. Background Technology
[0002] Medical data, as a highly sensitive and unique asset, has long faced three core challenges in its sharing and utilization. First, at the level of authorization granularity, existing medical information systems mostly employ a coarse-grained role-based access control model, such as a one-size-fits-all approach based on departments. This model cannot achieve fine-grained control at the "field level" or even the "semantic level." When a consulting physician only needs to view a patient's recent infection-related test indicators, the system often packages and opens the entire medical record, all imaging data, and test reports, resulting in the excessive exposure of a large amount of irrelevant and sensitive information.
[0003] Secondly, regarding response speed, traditional approval-based authorization processes have fatal flaws in highly time-sensitive scenarios such as emergency resuscitation and multidisciplinary consultations. A cross-departmental data access request often requires offline signatures, department head approval, and manual permission configuration by the IT department, a process that can take hours or even days. Furthermore, static, pre-defined anonymization rules cannot adapt to clinical urgency—the same blood routine data should have different visibility granularities in routine outpatient settings and ICU resuscitation, but existing systems cannot dynamically adjust the anonymization intensity based on the urgency of the scenario. This results in doctors receiving overly vague information in emergency situations, leading to delayed decisions, or exposing too much information in routine scenarios, increasing the risk of leakage.
[0004] Secondly, regarding compliance internalization, regulations governing the flow of medical data exhibit multi-layered and highly dynamic characteristics. Existing systems heavily rely on manual interpretation of regulations followed by manual modification of security policies; this "plug-in" compliance approach suffers from significant delays and the risk of misinterpretation. Operational audits also largely remain at the level of IP logs and timestamp records, failing to determine the legitimacy of access from the semantic level of "behavioral intent," making post-event tracing difficult to uncover deeper compliance elements such as "why the access was made" and "whether the access deviated from its original purpose."
[0005] Currently, attempts to combine large language models (LLMs) with blockchain for medical data governance generally suffer from superficial technological integration. LLMs are typically only used to identify sensitive fields in medical records, such as names and ID numbers, with the blockchain then performing simple field replacement and notarization. This simplistic stacking of "field identification + notarization" fails to leverage LLMs' deep understanding of context, intent, and semantic boundaries, nor does it upgrade blockchain smart contracts from passive recording to proactive semantic decision-making engines. Its essence remains rule-driven automation, rather than semantically driven adaptive intelligence.
[0006] Therefore, there is an urgent need for a dynamic authorization system for medical data that integrates blockchain and LLM. Summary of the Invention
[0007] The purpose of this invention is to provide a dynamic authorization system for medical data that integrates blockchain and LLM, thereby solving the problems mentioned in the background art.
[0008] To achieve the above objectives, the blockchain-LLM integrated medical data dynamic authorization system includes a data semantic encoding module, a request semantic encoding module, a semantic authorization contract module, a data access control module, and a behavioral semantic monitoring module. The data semantic encoding module is used to call the first LLM to generate a data semantic vector for each data item in the medical data. The data semantic vector represents the semantic attributes and sensitivity attributes of the data item in a preset multidimensional semantic space. The request semantic encoding module is used to call the second LLM to perform semantic parsing on the received data access request and generate a request semantic vector. The request semantic vector represents the identity attribute, purpose intention and time constraint of the request in the same multi-dimensional semantic space. The semantic authorization contract module is deployed on the blockchain and is used to receive the data semantic vector and the request semantic vector, calculate the semantic similarity between the two in the multidimensional semantic space, and dynamically generate an authorization token when the semantic similarity meets the preset authorization conditions. The authorization token contains an access constraint vector, which limits the range of accessible data fields, the level of desensitization, and the validity period. The data access control module is used to provide medical data that conforms to the anonymization level and data field range to the data requester based on the access constraint vector in the authorization token; The behavioral semantic monitoring module is used to continuously collect the sequence of operational behaviors during data access, call the third LLM to generate a behavioral semantic trajectory vector, calculate the consistency deviation between the behavioral semantic trajectory vector and the access constraint vector of the authorization token, and send a permission revocation instruction to the semantic authorization contract module when the deviation exceeds a set threshold.
[0009] In the above technical solution, the method for representing the semantic attributes and sensitivity attributes of data items in the data semantic encoding module includes the following steps: S10, based on Semantic encoders in pre-trained language models for the medical field construct multidimensional semantic spaces; S11. Introduce a sensitivity attribute decoding branch in the upper layer of the pre-trained language model and adopt an adversarial training strategy to embed sensitivity information in the geometric structure of the vector in a distributed and implicit manner. S12. Perform whitespace normalization, full-width / half-width conversion, and medical terminology spelling correction on the original field to obtain standardized text; S13. Calculate the distance between the vector of the standard text and the prototype of each sensitivity category, and embed semantic attributes.
[0010] 3. The medical data dynamic authorization system integrating blockchain and LLM according to claim 2, characterized in that the method for generating the request semantic vector in the request semantic encoding module includes the following steps: S20. The data access request is received in the form of a structured message, containing natural language description fields. With captured metadata tags; S21. Convert the metadata into short natural language phrases, and concatenate them with the original request text according to a preset template to form a standardized encoder input sequence. ; S22. Format the sequence The semantic encoder, which is reused from the input and data semantic encoding modules, takes the summation vector of the sequence after forward propagation as the request semantic vector.
[0011] Based on this, the method for calculating the weighted semantic similarity between the data semantic vector and the request semantic vector in the semantic authorization contract module includes the following steps: S30. Set parameters for the initial smart contract; S31. The decoding process uses linear transformation and element-wise logistic activation to obtain the sensitivity weight vector; S32. Modulate the data semantic vector and the request semantic vector using the sensitivity weight vector; S33. Based on the adjustment results of the data semantic vector and the request semantic vector, calculate the cosine similarity between the two and mark it as the weighted semantic similarity.
[0012] Furthermore, the method for generating an authorization token in the semantic authorization contract module includes the following steps: S300. Adjust the dynamic authorization threshold based on the urgency of the request scenario. The urgency of the scenario is negatively correlated with the dynamic authorization threshold. S301. Determine the weighted semantic similarity based on the dynamic authorization threshold; When the weighted semantic similarity exceeds the dynamic authorization threshold, the data item is included in the accessible scope of this authorization; Access is denied if the weighted semantic similarity does not exceed the dynamic authorization threshold; S302. Extract data items that meet the authorization requirements and generate an accessible field index set; S303. Determine the accessible field index set; If the set of accessible field indexes is empty, the entire authorization request is rejected, the contract does not generate an authorization token, and returns a semantic mismatch status code; If the accessible field index set is not empty, proceed to step S304; S304. Calculate the desensitization level of each authorized data item and construct an access constraint vector based on the calculation results. S305. Generate an authorization token based on the access constraint vector, wherein the authorization token contains the access constraint vector, the token issuance timestamp, and the contract address, and digitally sign the authorization token using the contract private key.
[0013] Furthermore, the method in the data access control module for providing medical data to the data requester that conforms to the anonymization level and data field range includes the following steps: S40. The data access control module listens for authorization events sent from the semantic authorization contract module, obtains the authorization token, and verifies the validity of the signature. If the current timestamp is greater than the issuance timestamp plus the validity period, the authorization token has expired. The data access control module will then refuse this data access and return an error code. The authorization token is valid if the current timestamp is less than or equal to the issuance timestamp plus the validity period. S41. The data access control module extracts the three elements of the access constraint vector from a valid authorization token; S42. The data access control module initiates a query to the medical data storage layer to request the set of original data records related to this access, retains the data items that meet the access constraint vector elements to form a dataset to be processed, and discards the data items that do not meet the access constraint vector elements. S43. The semantic dynamic desensitization engine built into the data access control module receives the dataset to be processed and the corresponding desensitization level mapping table, and divides it into direct identifier class, quasi-identifier class and medical sensitive field class. S44. Perform pseudonym replacement on data items that belong to the direct identifier class; S45. For data items belonging to the quasi-identifier class, perform range generalization processing based on the desensitization level; S46. Perform semantic transformation on data items belonging to the category of medical sensitive fields according to the level of desensitization; S47. Based on the above steps, formalize the data items after processing in different ways to obtain medical data that meets the desensitization level and data field range.
[0014] Finally, the method for calculating the consistency deviation between the behavioral semantic trajectory vector and the access constraint vector of the authorization token in the behavioral semantic monitoring module includes the following steps: S50. The behavior semantic monitoring module continuously receives fine-grained operation event streams through the audit log interface. Each operation event is defined as a quadruple, which includes operation type, operation object identifier, event timestamp, and operation duration. S51. The behavior semantic monitoring module inputs the real-time growing sequence into the semantic encoder of the third LLM and takes the summation vector of the sequence as the behavior semantic trajectory vector. S52. Convert the access constraint vector into a baseline constraint vector; S53. Calculate the directional deviation and magnitude deviation between the semantic trajectory vector and the reference constraint vector, and mark them as the consistency deviation between the semantic trajectory vector and the access constraint vector of the authorization token; S54. Set the direction deviation threshold and amplitude deviation threshold; When any deviation exceeds its threshold, the consistency deviation is determined to exceed the set threshold.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: This blockchain-LLM integrated dynamic authorization system for medical data maps medical data content and access requests to semantic vectors by constructing a unified multi-dimensional semantic vector space. Blockchain smart contracts automatically calculate semantic similarity and dynamically generate refined authorization tokens, achieving minimum necessary authorization at the field and semantic levels. This fundamentally changes the coarse-grained authorization mode of traditional role-based access control models. The semantically driven anonymization level adaptively adjusts based on the matching degree between the request scenario and data sensitivity, eliminating the need for manual approval. In emergency scenarios such as first aid, permissions are automatically relaxed, significantly improving authorization response speed. The behavioral semantic monitoring module continuously collects operational behavior sequences and generates semantic trajectory vectors, verifying the consistency between behavior and authorization intent in real time. If deviations exceed limits, on-chain permission revocation is triggered, forming a closed-loop compliance system from authorization to auditing, effectively reducing the risk of data leakage and abuse. This invention organically integrates the deep semantic understanding capabilities of LLM with the deterministic execution and immutability of blockchain, upgrading from "rule-driven" to "semantic-driven," providing a secure and trustworthy infrastructure that can dynamically adapt to regulatory changes and is fully traceable for the element-based circulation of medical data. Attached Figure Description
[0016] Figure 1 This is a diagram illustrating the overall method steps of the present invention. Detailed Implementation
[0017] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0019] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0020] Please see Figure 1 As shown, a dynamic authorization system for medical data integrating blockchain and LLM is provided, including a data semantic encoding module, a request semantic encoding module, a semantic authorization contract module, a data access control module, and a behavioral semantic monitoring module; The data semantic encoding module is used to call the first LLM to generate a data semantic vector for each data item in the medical data. The data semantic vector represents the semantic attributes and sensitivity attributes of the data item in a preset multidimensional semantic space. The request semantic encoding module is used to call the second LLM to perform semantic parsing on the received data access request and generate a request semantic vector. The request semantic vector represents the identity attributes, purpose intent and time constraints of the request in the same multi-dimensional semantic space. The semantic authorization contract module is deployed on the blockchain to receive data semantic vectors and request semantic vectors, calculate the semantic similarity between the two in the multidimensional semantic space, and dynamically generate an authorization token when the semantic similarity meets the preset authorization conditions. The authorization token contains an access constraint vector, which limits the range of accessible data fields, the level of anonymization, and the validity period. The data access control module is used to provide medical data that meets the anonymization level and data field range to the data requester based on the access constraint vector in the authorization token; The behavioral semantic monitoring module is used to continuously collect the sequence of operational behaviors during data access, call the third LLM to generate behavioral semantic trajectory vectors, calculate the consistency deviation between the behavioral semantic trajectory vectors and the access constraint vectors of the authorization token, and send a permission revocation instruction to the semantic authorization contract module when the deviation exceeds the set threshold.
[0021] The specific plan is as follows: First, in order to ensure the normal operation of medical data acquisition and access, this solution uses a configured data semantic encoding module to call the first LLM to generate a data semantic vector for each data item in the medical data. The data semantic vector represents the semantic attributes and sensitivity attributes of the data item in a preset multidimensional semantic space.
[0022] The core function of the data semantic encoding module is to transform unstructured medical data items into fixed-dimensional real-number vectors. These vectors simultaneously encode two orthogonal attributes in the same multidimensional semantic space: semantic attributes and sensitivity attributes. Semantic attributes refer to the medical meaning expressed by the data item, such as "white blood cell count 12.3 × 10⁻⁶". 9 " / L" describes the test item and its numerical result; the sensitivity attribute refers to the sensitivity level of the data item in the context of privacy protection, such as direct identifiers, quasi-identifiers, medical privacy fields, etc.
[0023] In the process of constructing the corresponding multidimensional semantic space, we first assume that the multidimensional semantic space is... The starting dimension d is 512, and this space is based on The pre-trained language model for the medical domain, after fine-tuning, was finalized. Its semantic encoder implemented the mapping function, the specific expression of which is as follows: ; in A collection of text for medical data items, each element For a given field text in a medical record, laboratory report, or imaging finding, the text t is encoded into a semantic vector using a mapping function. .
[0024] In addition, in order to make semantic vectors The system spontaneously incorporates sensitivity information (embedding of sensitivity attributes), introduces a sensitivity attribute decoding branch into the upper layer of the pre-trained language model, and employs an adversarial training strategy. set up For the sensitivity classifier, C is the number of sensitivity categories, for example, C=3, corresponding to direct identifiers, quasi-identifiers, and medical sensitivity fields, respectively. During training, in the encoder... With classifier Insert gradient inversion layers between each training sample. y represents the sensitivity label, and the total loss function is defined as: ; in The adversarial sensitivity classification loss is defined as cross-entropy. During backpropagation, the gradient inversion layer makes the encoder... Update direction and minimization The opposite direction forces The output vector is difficult to directly identify in terms of sensitivity category, so sensitivity information is embedded in the vector's geometric structure in a distributed, implicit manner. The coefficient is set to 0.1 based on experiments.
[0025] After adversarial training, vector Instead of displaying sensitivity scores that can be directly separated, data items with the same sensitivity will naturally cluster in the vector space, while data items with different sensitivities will form distinguishable subspaces on the high-dimensional manifold.
[0026] To imbue the data semantic vector with semantic attributes, the following process is executed: First, the original field is normalized for whitespace, converted to full-width and half-width characters, and corrected for medical terminology spelling to obtain the standardized text t. The canonical text t is then passed to the encoder. Forward propagation yields a vector of fixed length, expressed as follows: ; To facilitate the semantic authorization contract module's rapid evaluation of sensitivity matching, the distance between this vector and the prototypes of each sensitivity category needs to be pre-calculated. The prototype of a sensitivity category is defined as the geometric center of all training sample vectors within that category. The specific algorithm formula is as follows: ; in This is the set of sample indices belonging to category c. Indicates the number of samples. For the generated data semantic vector... Its Euclidean distance to category c As a compact sensitivity scalar.
[0027] Finally, the mapping of data items is completed according to the above steps, that is: ; Where t represents the input medical data item text. This indicates a semantic encoder that has undergone adversarial fine-tuning. The output data semantic vector, in The vector, which encodes semantic and sensitivity attributes in the space, serves as a semantic representation of the data and participates in authorization decisions.
[0028] Furthermore, after completing the data item transformation, the request semantic encoding module is used to call the second LLM to perform semantic parsing on the received data access request, generating a request semantic vector. The request semantic vector represents the identity attributes, purpose intent, and timeliness constraints of the request in the same multi-dimensional semantic space. The specific implementation method is as follows: First, the request semantic encoding module is used to transform the received data access request into a fixed-dimensional request semantic vector, which is located in a multi-dimensional semantic space. The semantic authorization contract module uniformly represents the request's identity attributes, intended purpose, and time constraints. Identity attributes include the requester's role, department, and access level; intended purpose describes the purpose of the request, such as consultation, research statistics, or patient access; and time constraints define the reasonable time boundaries for this authorization. By embedding these multi-dimensional access contexts into the same vector space, the semantic authorization contract module can calculate the semantic matching degree between the request and the data within a unified geometric framework.
[0029] The data access request is received in the form of a structured message, which includes a natural language description field. Metadata tags automatically captured by the system.
[0030] Metadata tags should include at least: requester identification. ,Role Department Emergency level indicators Application type Expected timeframe And the current timestamp.
[0031] The aforementioned metadata is converted into concise natural language phrases, which are then concatenated with the original request text according to a preset template to form a standardized encoder input sequence. ,For example: ; in This is the original request description, such as "request all test results of patient Zhang San within the past week." This standardization process ensures that all contextual information is expressed uniformly in natural language, which is beneficial for the semantic encoder to capture all elements at once.
[0032] Then the formatted sequence A semantic encoder that reuses the input and data semantic coding modules After forward propagation, the summation vector of the sequence is taken as the request semantic vector, as shown in the following expression: ; The same encoder is reused here. Guarantee the semantic vector of data With request semantic vector They are directly comparable in isomorphic semantic spaces, requiring no additional alignment or projection. Furthermore, they request semantic vectors. It implicitly integrates all contextual semantics, such as identity and purpose, in a distributed manner.
[0033] Although request semantic vector The distributed representation already contains information on timeliness and urgency. However, to meet the requirements of blockchain smart contracts for lightweight computation in a deterministic environment, this solution uses a set of publicly available linear readout parameters from the request semantic vector. Explicit decoding effective duration and scene urgency score The specific calculation method is as follows: Let the readout weight vector be... Bias vector And read out the weight vector Bias vector The decoding process is accomplished through linear projection and a nonlinear activation function, i.e., the effective duration. The calculation formula is as follows: ; in Represents the logical stith function, and These are the minimum and maximum valid durations set by the system, respectively. Generally... Take 300 seconds. Take 30 days; Corresponding scenario urgency score The calculation formula is as follows: ; in The range of values is The closer the value is to 1, the more urgent the scenario in which the request is made.
[0034] The above linear readout parameters are obtained through supervised learning: in the encoder After fine-tuning, freeze its weights and use labeled access request samples to test it. , , , Regression training is performed, with mean squared error and cross-entropy used as loss functions to optimize the decoded data. Consistent with the reasonable authorization duration for manual annotation, Consistent with the urgency level label.
[0035] Furthermore, the acquired data semantic vector Request semantic vector Valid duration and scene urgency score The input is fed into the semantic authorization contract module, which is a smart contract deployed on the blockchain. This smart contract operates in a multi-dimensional semantic space. The system performs semantic similarity calculation, dynamic authorization decision-making, access constraint construction, and authorization token generation, all deterministically completed on-chain. Its core operations include: from the request semantic vector... Decoding sensitivity weight vector Calculate the corresponding weighted semantic similarity S, and set the dynamic authorization threshold accordingly. The data is compared with a weighted semantic similarity S to determine authorization, and a desensitization level is generated for each accessible data item. The process involves outputting an access constraint vector that includes field range, anonymization level, and validity period. The specific steps are as follows: First, set the parameters for the initial smart contract: Semantic space dimension d=512; The sensitivity subspace dimension k=64; Sensitivity weight readout matrix and bias vector ; Basic authorization threshold In this plan ; Urgency coefficient In this plan ; Upper limit of desensitization level In this plan ; The desensitization distance normalization constant D is set to 2.0. Data item identifier set and the corresponding data semantic vector set .
[0036] Each time an authorization request is triggered, the smart contract receives a request semantic vector. Valid duration and scene urgency score .
[0037] The smart contract then requests the semantic vector. Read the sensitivity weight vector The decoding employs linear transformation and element-wise logical stearic activation, as shown in the following expression: ; Subsequently, for each data item The weighted semantic similarity S is calculated using smart contracts, and a sensitivity weight vector is introduced. After that, data semantic vector and request semantic vector They were modulated as follows: ; ; in This represents element-wise multiplication, calculated based on the modulation result. and Cosine similarity to obtain data items Weighted semantic similarity The specific algorithm formula is as follows: ; in This represents the Euclidean norm.
[0038] Corresponding dynamic authorization threshold Based on the urgency of the request scenario The threshold is dynamically adjusted; the higher the urgency, the lower the threshold, thus automatically relaxing the authorization conditions in scenarios such as emergency rescue. ; For each data item i, when the weighted semantic similarity ≥ If the accessibility condition is met, the data item is included in the scope of this authorization; otherwise, access is denied. This forms the accessible field index set, with the specific expression as follows: ; like If empty, the entire authorization request is rejected, the contract does not generate an authorization token, and returns a semantic mismatch status code.
[0039] To further improve the authorization effect, for each authorized data item, i.e. The contract further calculates the applicable desensitization level. The desensitization level is determined by the distance between the data semantic vector and the request semantic vector in the sensitivity subspace. and Projecting each component onto the sensitivity subspace, i.e., taking the first k dimensions, the specific algorithm formula is as follows: ; ; Calculate the Euclidean distance between the two: ; The Euclidean distance described above quantifies the degree of mismatch between the request context and the data item in the sensitivity latent space. A smaller distance indicates higher compatibility between the request's purpose and the data sensitivity, allowing for a lower level of desensitization. Final Desensitization Level The result is obtained through linear compression and rounding, and the specific expression is as follows: ; The desensitization levels mentioned above The constraint range is That is, when When it approaches 0, =0 indicates the highest visibility, when When the distance approaches or exceeds the desensitization distance normalization constant D, then = Then the strongest desensitization treatment needs to be applied.
[0040] Based on the above calculation results, the smart contract constructs an access constraint vector. Formalized as triples: ; in For accessible field bitmaps, the bit width is equal to The i-th bit is 1 if and only if , For the desensitization level mapping table, each Mapped to the corresponding middle, Indicates the effective duration.
[0041] Finally, the smart contract generates an authorization token. Authorization token Includes access constraint vector Token issuance timestamp and the contract address, and the authorization token. Digital signatures are performed using the contract's private key. Authorization tokens are also used. hash value With request semantic vector , Weighted similarity list (The weighted similarity of each data item is used to form the scenario urgency score) and dynamic authorization threshold They are packaged together as an authorization semantic record and written into the blockchain ledger to form an immutable authorization certificate, thereby ensuring the certainty, auditability and tamper-proofness of authorization decisions.
[0042] Specifically, the data access control module listens for authorization events emitted by the semantic authorization contract module and obtains authorization tokens. The data access control module, located at the data gateway layer, is responsible for enforcing access control based on the issued authorization token when receiving an actual data retrieval operation initiated by a data requester. This module securely communicates with the semantic authorization contract module via an off-chain message queue, retrieves tokens from the queue, and performs field pruning, dynamic semantic desensitization, and watermark embedding on the medical data based on the access constraint vector in the token. Finally, the processed data is returned to the requester. The entire process ensures data traceability while adhering to the minimum necessary principle. The specific solution is as follows: First, the module listens for authorization events emitted by the semantic authorization contract module and obtains the authorization token. First, verify the validity of the signature, when the current timestamp... >Issuance timestamp +Valid Duration If the token has expired, the module will refuse the data access and return an error code.
[0043] When the current timestamp ≤Issuance Timestamp +Valid Duration If the signature is valid, the process will proceed only if the signature is valid and the token has not expired.
[0044] The data access control module then parses the three elements of the access constraint vector C from the token: Accessible field bitmap The bit width is equal to the total number of data items in the system. This indicates that access to the i-th data item is permitted; Desensitization Level Mapping Table Store the desensitization level corresponding to each accessible data item i. ,and ; Valid duration .
[0045] At the same time, the data access control module sends a query to the medical data storage layer, requesting to retrieve the set of original data records related to this access. Each data item Carrying a globally unique data item identifier, the data access control module maps the identifier to an internal system index i, retaining only those that satisfy the criteria. The data items form the dataset to be processed. .for Data items that are not processed are discarded and will not proceed to further processing.
[0046] It is worth noting that the data access control module has a built-in semantic dynamic de-identification engine, which is used to receive the dataset to be processed. and the corresponding desensitization level mapping table For each data item Based on its field type and desensitization level Perform semantic-level processing. Field types are pre-marked by metadata and are divided into direct identifier classes. (such as name, ID number), Quasi-identifier class (such as age, residential district) and medically sensitive fields (e.g., diagnostic text, test values, image descriptions). Desensitization operations consist of a family of type-related functions. The specific desensitization methods are defined as follows: For direct identifier classes Desensitization methods: For Regardless of the anonymization level, pseudonym replacement is performed. Pseudonymization function. A keyed hash algorithm is used, and the specific algorithm formula is as follows: ; in This is a pseudonym key built into the data access control module. Before truncation Each character is used as a pseudonym identifier to ensure that the same original identifier is always mapped to the same pseudonym, thus supporting association analysis across accesses.
[0047] For quasi-identifier classes Desensitization methods: For Furthermore, the test results are numerical, and the desensitization function is based on interval generalization. A set of discrete step sizes is defined. : hour, No generalization is performed; L represents the level of desensitization. hour, The width of the tenths of the reference range for the population in this field is obtained from historical data statistics and is fixed in the data access control module configuration. At this time, only a binary indication of whether the value exceeds the normal range is retained, and the specific value is not retained.
[0048] The specific generalization function expression is as follows: ; in Indicates an indicator function, when If the value exceeds the preset normal range, a "normal" flag is returned; otherwise, a "normal" flag is returned.
[0049] For medical sensitive fields Desensitization methods: For Furthermore, for unstructured text such as diagnostic texts and imaging findings, the desensitization engine embeds a lightweight medical named entity recognition model. This model outputs entity references to their categories (diseases, symptoms, anatomical locations, examination procedures, etc.). The following semantic transformations are performed based on the desensitization level: At this time, the text retains its original expression, replacing only direct identifiers embedded in the text (such as names); When identifying disease entities, replace them with their higher-level concepts in the medical knowledge graph (e.g., "patchy high-density shadow" in "patchy high-density shadow in the right lower lung" is generalized to "high-density shadow in the lung"). Perform interval generalization consistent with Section 4.2 on numerical entities and replace the numerical values in the original text. At that time, all disease and symptom entities are deleted, and only anatomical descriptions (such as "right lower lung") and examination operation terms are retained. Furthermore, the anatomical descriptions are generalized to organ categories (such as "lung"), suppressing the entire text to a structured minimum necessary template.
[0050] Based on the above content, formal processing is performed for... Let the set of entities be Each entity has a category and surface form The corresponding desensitization transformation is: ; in Return the original word, hypernym, or remove placeholders based on entity category and level. The function re-inserts these transformed entities into the original sentence structure while maintaining grammatical coherence.
[0051] Furthermore, after completing the corresponding desensitization work according to different types, the data access control module performs watermark embedding on all data items to be returned for subsequent traceability. This scheme uses a watermarking algorithm to perform watermark embedding, and the specific algorithm steps are as follows: First, using the token hash value As a seed for generating a pseudo-random sequence, the carrier to be embedded with the watermark is the desensitized data. The bytes of a text or numerical stream are represented as . Generate watermark signal sequence Each of them , by token hash The controlled pseudo-random number generator is determined. For embedding strength, in this solution The value is 1 (modifies the least significant bit or the number of text spaces to the minimum perceptible difference), and the embedded carrier is: ; For text fields, changes are applied to the frequency of occurrence of invisible characters (such as zero-width spaces) or paragraph indentation; for numeric fields, changes are applied to the least significant digit or the number of decimal places retained, ensuring that clinical readability is not affected. Complete the anonymization of the data. Watermark embedding work.
[0052] After the watermark is embedded, the data access control module will process the final dataset, which has undergone desensitization and watermarking. The encrypted message is returned to the data requester. Simultaneously, the data access control module writes the operation summary of this access (including token hash, access time, number of returned fields, and anonymization level of each field) to the local audit log and asynchronously pushes it to the event queue of the behavior semantic monitoring module for subsequent behavior consistency analysis.
[0053] Through the above process, the data access control module transforms semantic-driven desensitization decisions into deterministic data transformations based on fine-grained analysis of authorization constraints. It also binds static authorization tokens to dynamic data streams inseparably through a watermarking mechanism, forming a fully controllable closed loop from authorization to delivery.
[0054] Finally, the behavioral semantic monitoring module is accessed in a bypass manner through the audit log stream between the data gateway and the application server. This module is responsible for continuously collecting the operational behavior sequences of data requesters during authorized access sessions, mapping these sequences to semantic trajectory vectors, and evaluating the semantic consistency between these vectors and the access constraint vectors in the authorization token in real time within a unified semantic space. When the deviation exceeds a preset threshold, permission revocation is immediately triggered. This module is a key component in extending the system from "static authorization" to "dynamic compliance," and the specific method is as follows: First, the behavioral semantic monitoring module continuously receives a stream of fine-grained operation events through the audit log interface. Each operation event... Defined as a quadruple: ; in Indicates the operation type, taken from a finite set. ,in This indicates a data query operation. This indicates a field or page click operation. This indicates a page dwell time action, followed by the dwell time. This indicates a file download operation. This indicates a content copy operation. This indicates a print operation. The ellipsis indicates that the set can be expanded according to system auditing needs to include new operation types, such as EXPORT and SCREENSHOT. This is an identifier for the operation object, pointing to the data item index or page identifier. For event timestamps, Indicates the duration of the operation.
[0055] Within the lifecycle of a single authorized session, a time-ordered sequence of operation events is maintained through the behavior semantic monitoring module. This sequence continues to grow until the session ends or permissions are revoked. To transform heterogeneous event sequences into a unified format suitable for language model processing, the module introduces an event serialization function that maps each event to a short sentence in natural language form and concatenates them in chronological order. The specific expression is as follows: ; For example =" White blood cell count This serialization process preserves the operation type, operation object, and temporal rhythm, allowing the behavioral semantics to be captured by subsequent language models.
[0056] Subsequently, the behavior semantic monitoring module calls the third LLM to generate behavior semantic trajectory vectors. The third LLM employs a Transformer sequence model with the same architecture as the data semantic encoding module and the request semantic encoding module, but it is specialized in its training objective. This model is pre-trained and fine-tuned for the semantic representation task of operational behavior sequences, transforming variable-length event sequences... Mapped to a fixed-dimensional trajectory vector It resides in the same multidimensional semantic space as the data semantic vector and the request semantic vector. The specific implementation method is as follows: During the pre-training phase, the model uses large-scale simulated access behavior sequences as unlabeled data and employs a sequence contrastive learning paradigm. Given a pair of behavior sequence samples, two variants are constructed: two different local order perturbations of the same sequence are considered positive sample pairs, and arbitrary segments from different sequences are considered negative sample pairs. This is achieved by minimizing the contrastive loss. ; in, and Given a pair of positive sample semantic vectors, derived from two local order perturbations of the same behavioral sequence, Representing vectors and cosine similarity, This represents all candidate vectors in the batch. The temperature coefficient is used to adjust the sharpness of the similarity distribution. In the fine-tuning stage, the model is trained by binary classification using behavioral sequences labeled "normal / abnormal" to further enhance the model's sensitivity to behavioral patterns that deviate from the authorized intent, without changing the geometric structure of the vector space.
[0057] During the reasoning phase, the behavioral semantic monitoring module will monitor the real-time increasing sequence. Input to the semantic encoder of the third LLM The summation vector of the sequence is taken as the behavioral semantic trajectory vector: ; To capture the dynamic evolution of behavior, the module recalculates each new action event that arrives. ,therefore It is actually a time series , where t corresponds to the arrival time of the event.
[0058] To determine the degree of deviation between the current behavioral semantic trajectory and the access constraints specified in the authorization token, this scheme defines a consistency deviation by calculating the access constraint vector. The semantic authorization contract module generates the access constraint vector during authorization. To perform bias calculations within the semantic space, this scheme will... Convert to a baseline constraint vector For the baseline constraint vector The construction method is as follows: Where the benchmark constraint vector It is composed of two parts of information: one is the request semantic vector. First, it represents the intended use permitted by this authorization; second, it is an aggregate semantic representation of the accessible fields. When generating the token, the contract has already calculated the semantic vector of each authorized data item and the request. Weighted semantic similarity and desensitization level Using the above data, construct a baseline constraint vector. The specific expression is as follows: ; in The weights are related to the anonymization level; the lower the anonymization level, the closer the data is to the original semantics. The scaling factor, representing the intended purpose of the request, is set to 0.2 to ensure that the constraint vector retains some of its original intended direction. Through weighted summation, the quasi-constraint vector... It becomes a benchmark representing the semantic trajectory that data access should have under this authorization constraint.
[0059] Subsequently, the behavioral semantic trajectory vector was analyzed. With reference constraint vector The inconsistency is quantified using two complementary measures: directional deviation and amplitude deviation. Firstly, the direction deviation. Defined as the angular deviation between two vectors, using cosine distance, the specific expression is as follows: ; in The range of values is The smaller the value, the more consistent the behavior is with the authorization intent; Amplitude deviation Defined as the ratio of the deviation between the projected length in the direction of the constraint vector and the length of the constraint vector itself, the specific expression is as follows: ; in express exist Orthogonal projection on, amplitude deviation This reflects whether the amount of information involved in the behavior significantly exceeds the authorized scope. For example, downloading a large number of unauthorized fields can cause the projection length to increase or decrease abnormally.
[0060] Meanwhile, the behavioral semantic monitoring module sets directional deviation thresholds for both directional and amplitude deviations. Amplitude deviation threshold In this scheme, the directional deviation threshold The value is 0.5, which is the amplitude deviation threshold. The value is 1.2. When any deviation exceeds its threshold, it is determined that the consistency deviation exceeds the set threshold.
[0061] When the determination result indicates that the consistency deviation exceeds the set threshold, the behavioral semantic monitoring module immediately performs the following operations: First, generate a permission revocation command message, which includes the target token hash value. Current directional deviation Amplitude deviation and a snapshot of the behavior at the trigger moment .
[0062] Second, the semantic authorization contract module is invoked to mark the corresponding target token as invalid and write it into the blockchain state storage. Any subsequent access attempts using this token will be rejected by the data access control module.
[0063] Third, the deviation calculation results are compared with the behavioral semantic trajectory vector. The data is packaged into a behavior audit record, written to the blockchain ledger through on-chain transactions, and indexed and associated with previously stored authorization semantic records to form a complete closed-loop audit trajectory from authorization and access to abnormal recovery.
[0064] After completing the above operations, the behavioral semantics are incorporated into the same vector space and consistency is continuously verified. The behavioral semantics monitoring module enables dynamic authorization to evolve from "one-time granting" to "full-process monitoring", upgrading the lifecycle management of permissions from a fixed duration to semantic-driven closed-loop adaptive management.
[0065] This invention constructs a unified multi-dimensional semantic vector space, mapping both medical data content and access requests to semantic vectors. A blockchain smart contract automatically calculates semantic similarity and dynamically generates refined authorization tokens, achieving minimum necessary authorization at the field and semantic levels. This fundamentally changes the coarse-grained authorization mode of traditional role-based access control models. The semantically driven anonymization level adaptively adjusts based on the matching degree between the request scenario and data sensitivity, eliminating the need for manual approval. In emergency scenarios such as first aid, permissions are automatically relaxed, significantly improving authorization response speed. The behavioral semantic monitoring module continuously collects operational behavior sequences and generates semantic trajectory vectors, verifying the consistency between behavior and authorization intent in real time. If deviations exceed limits, on-chain permission revocation is triggered, forming a closed-loop compliance system from authorization to auditing, effectively reducing the risk of data leakage and abuse. This invention organically integrates the deep semantic understanding capabilities of LLM with the deterministic execution and immutability of blockchain, upgrading from "rule-driven" to "semantic-driven," providing a secure and trustworthy infrastructure for the element-based circulation of medical data that can dynamically adapt to regulatory changes and is fully traceable.
[0066] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A dynamic authorization system for medical data integrating blockchain and LLM, characterized in that, It includes a data semantic encoding module, a request semantic encoding module, a semantic authorization contract module, a data access control module, and a behavior semantic monitoring module; The data semantic encoding module is used to call the first LLM to generate a data semantic vector for each data item in the medical data. The data semantic vector represents the semantic attributes and sensitivity attributes of the data item in a preset multidimensional semantic space. The request semantic encoding module is used to call the second LLM to perform semantic parsing on the received data access request and generate a request semantic vector. The request semantic vector represents the identity attribute, purpose intention and time constraint of the request in the same multi-dimensional semantic space. The semantic authorization contract module is deployed on the blockchain and is used to receive the data semantic vector and the request semantic vector, calculate the semantic similarity between the two in the multidimensional semantic space, and dynamically generate an authorization token when the semantic similarity meets the preset authorization conditions. The authorization token contains an access constraint vector, which limits the range of accessible data fields, the level of desensitization, and the validity period. The data access control module is used to provide medical data that conforms to the anonymization level and data field range to the data requester based on the access constraint vector in the authorization token; The behavioral semantic monitoring module is used to continuously collect the sequence of operational behaviors during data access, call the third LLM to generate a behavioral semantic trajectory vector, calculate the consistency deviation between the behavioral semantic trajectory vector and the access constraint vector of the authorization token, and send a permission revocation instruction to the semantic authorization contract module when the deviation exceeds a set threshold.
2. The medical data dynamic authorization system integrating blockchain and LLM as described in claim 1, characterized in that, The method for representing the semantic attributes and sensitivity attributes of data items in the data semantic encoding module includes the following steps: S10, based on Semantic encoders in pre-trained language models for the medical field construct multidimensional semantic spaces; S11. Introduce a sensitivity attribute decoding branch in the upper layer of the pre-trained language model and adopt an adversarial training strategy to embed sensitivity information in the geometric structure of the vector in a distributed and implicit manner. S12. Perform whitespace normalization, full-width / half-width conversion, and medical terminology spelling correction on the original field to obtain standardized text; S13. Calculate the distance between the vector of the standard text and the prototype of each sensitivity category, and embed semantic attributes.
3. The medical data dynamic authorization system integrating blockchain and LLM as described in claim 2, characterized in that, The method for generating request semantic vectors in the request semantic encoding module includes the following steps: S20. The data access request is received in the form of a structured message, containing natural language description fields. With captured metadata tags; S21. Convert the metadata into short natural language phrases, and concatenate them with the original request text according to a preset template to form a standardized encoder input sequence. ; S22. Format the sequence The semantic encoder, which is reused from the input and data semantic encoding modules, takes the summation vector of the sequence after forward propagation as the request semantic vector.
4. The medical data dynamic authorization system integrating blockchain and LLM as described in claim 3, characterized in that, The metadata tag in S20 includes at least: requester identity identifier. ,Role Department Emergency level indicators Application type Expected timeframe And the current timestamp.
5. The medical data dynamic authorization system integrating blockchain and LLM as described in claim 3, characterized in that, The request semantic encoding module also configures the request semantic vector with an explicit decoding validity period and a scenario urgency score.
6. The medical data dynamic authorization system integrating blockchain and LLM as described in claim 1, characterized in that, The method for calculating the weighted semantic similarity between the data semantic vector and the request semantic vector in the semantic authorization contract module includes the following steps: S30. Set parameters for the initial smart contract; S31. The decoding process uses linear transformation and element-wise logistic activation to obtain the sensitivity weight vector; S32. Modulate the data semantic vector and the request semantic vector using the sensitivity weight vector; S33. Based on the adjustment results of the data semantic vector and the request semantic vector, calculate the cosine similarity between the two and mark it as the weighted semantic similarity.
7. The medical data dynamic authorization system integrating blockchain and LLM as described in claim 6, characterized in that, The parameters of the smart contract in S30 include: semantic space dimension, sensitivity subspace dimension, sensitivity weight readout matrix, basic authorization threshold, urgency coefficient, upper limit of desensitization level, desensitization distance normalization constant, and data item identifier set and corresponding data semantic vector set.
8. The medical data dynamic authorization system integrating blockchain and LLM according to claim 7, characterized in that, The method for generating authorization tokens in the semantic authorization contract module includes the following steps: S300. Adjust the dynamic authorization threshold based on the urgency of the request scenario. The urgency of the scenario is negatively correlated with the dynamic authorization threshold. S301. Determine the weighted semantic similarity based on the dynamic authorization threshold; When the weighted semantic similarity exceeds the dynamic authorization threshold, the data item is included in the accessible scope of this authorization; Access is denied if the weighted semantic similarity does not exceed the dynamic authorization threshold; S302. Extract data items that meet the authorization requirements and generate an accessible field index set; S303. Determine the accessible field index set; If the set of accessible field indexes is empty, the entire authorization request is rejected, the contract does not generate an authorization token, and returns a semantic mismatch status code; If the accessible field index set is not empty, proceed to step S304; S304. Calculate the desensitization level of each authorized data item and construct an access constraint vector based on the calculation results. S305. Generate an authorization token based on the access constraint vector, wherein the authorization token contains the access constraint vector, the token issuance timestamp, and the contract address, and digitally sign the authorization token using the contract private key.
9. The medical data dynamic authorization system integrating blockchain and LLM according to claim 8, characterized in that, The method for providing medical data that conforms to the anonymization level and data field range to the data requester in the data access control module includes the following steps: S40. The data access control module listens for authorization events sent from the semantic authorization contract module, obtains the authorization token, and verifies the validity of the signature. If the current timestamp is greater than the issuance timestamp plus the validity period, the authorization token has expired. The data access control module will then refuse this data access and return an error code. The authorization token is valid if the current timestamp is less than or equal to the issuance timestamp plus the validity period. S41. The data access control module extracts the three elements of the access constraint vector from a valid authorization token; S42. The data access control module initiates a query to the medical data storage layer to request the set of original data records related to this access, retains the data items that meet the access constraint vector elements to form a dataset to be processed, and discards the data items that do not meet the access constraint vector elements. S43. The semantic dynamic desensitization engine built into the data access control module receives the dataset to be processed and the corresponding desensitization level mapping table, and divides it into direct identifier class, quasi-identifier class and medical sensitive field class. S44. Perform pseudonym replacement on data items that belong to the direct identifier class; S45. For data items belonging to the quasi-identifier class, perform range generalization processing based on the desensitization level; S46. Perform semantic transformation on data items belonging to the category of medical sensitive fields according to the level of desensitization; S47. Based on the above steps, formalize the data items after processing in different ways to obtain medical data that meets the desensitization level and data field range.
10. The medical data dynamic authorization system integrating blockchain and LLM according to claim 1, characterized in that, The method for calculating the consistency deviation between the behavioral semantic trajectory vector and the access constraint vector of the authorization token in the behavioral semantic monitoring module includes the following steps: S50. The behavior semantic monitoring module continuously receives fine-grained operation event streams through the audit log interface. Each operation event is defined as a quadruple, which includes operation type, operation object identifier, event timestamp, and operation duration. S51. The behavior semantic monitoring module inputs the real-time growing sequence into the semantic encoder of the third LLM and takes the summation vector of the sequence as the behavior semantic trajectory vector. S52. Convert the access constraint vector into a baseline constraint vector; S53. Calculate the directional deviation and magnitude deviation between the semantic trajectory vector and the reference constraint vector, and mark them as the consistency deviation between the semantic trajectory vector and the access constraint vector of the authorization token; S54. Set the direction deviation threshold and amplitude deviation threshold; When any deviation exceeds its threshold, the consistency deviation is determined to exceed the set threshold.