Safe and efficient outpatient service data authority control scheme
By combining the blockchain network and smart contracts with the Docker container engine and C4.5 decision tree model, the problem of data leakage and non-compliance in outpatient data permission control is solved, and efficient and secure permission management and transparent data access are achieved.
Patent Information
- Application Number
- CN202410757918.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-17
AI Technical Summary
Existing outpatient data permission control solutions can easily lead to data leakage or non-compliance in configuration and management, and cannot effectively prevent risks caused by manual errors and poor management.
It is built using a blockchain network, combined with Docker container engine and smart contracts, ensuring the non-tamperability of the data chain through the Merkle tree structure and SHA256 hash algorithm, defining AccessRole permission levels and permission access control lists, and using smart contracts and C4.5 decision-making The tree model is used for dynamic permission management and prediction, and RocketMQ middleware is introduced to improve the stability of data interaction.
It achieves data transparency, security and efficient permission control, prevents data leakage and non-compliance risks, improves system stability and transparency, and reduces manual configuration and management costs.
Smart Images

Figure CN118659905A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of outpatient data control, and particularly to a safe and efficient outpatient data permission control solution. Background Art
[0002] As is well known, medical data usually contains sensitive information of patients. With the continuous progress of cyberattack means, the data security threats faced by medical institutions are also increasing. Although existing data permission controls can protect data privacy and meet compliance requirements, in actual operation, there may be risks of data leakage or non-compliance due to configuration errors or poor management. Summary of the Invention
[0003] (I) Technical Problems to be Solved Aiming at the deficiencies of the prior art, the present invention provides a safe and efficient outpatient data permission control solution.
[0004] (II) Technical Solutions To achieve the above object, the present invention provides the following technical solution: A safe and efficient outpatient data permission control solution, including the following steps: Step 1: Build a blockchain network. Select the application container engine of Docker v19.03.8 version and match it with Docker-Compose v2.1.1 recommended by Docker official as the management tool for Docker engine containers. The Docker container engine can isolate the internal environment from the server environment to ensure that application containers do not affect each other; Step 2: The blockchain network constructs a blockchain network service through the Docker-Compose engine container management tool; Step 3: Deploy the information of the smart contract to the tree-shaped nodes of the blockchain storage structure Merkle tree. Each node is the data access permission information of an employee. Use an algorithm to ensure the consistency of the contract state and execution results of all nodes in the blockchain network, prevent problems such as double-spending attacks and forks. Use SHA256(SHA256(block_header)) <TARGET, where block_header includes fields such as version, hash of the previous block, Merkle root, timestamp, permission level, etc. TARGET is an adjustable permission target value, that is, obtain the SHA hash calculation result of the previous block header, perform two SHA hash function calculations to obtain a 32-bit unique digital identifier representing the content of the block header. Through the block header after this hash calculation, it can be verified whether the data is tampered with during transmission and storage. The generation of each block is less than TARGET, so that each block contains the hash value of the previous block, thereby forming an immutable data chain; Step 4: All the patient information of departments and doctors is stored in the database through MD5 symmetric encryption. The salt used for encryption is generated by a fixed system key value and the patient registration department code. When the authority authentication is passed, the corresponding decryption key can be used to obtain the plain text data; Step 5. Define an AccessRole (enumeration type) to represent the operation permission level. Define admin (administrator), reader (read-only), write (write-only), and none (no permission) as basic permissions. Admin (administrator) can grant and revoke permissions. Step 6. The data structure of the block header uses a mapping and an object array structure to store the employee's permission information. The mapping stores the employee's work number information, i.e., the key value is the employee's work number. The corresponding value is the object array, which is the access permission level of the employee and the unique ID value for accessing special data. Based on the enumeration type in point 1.4, an access control list (ACL) is constructed to check the employee's access rights to the patient data of different departments and doctors. Step 7. Using the data structure defined in step 5, initialize the permission status of each employee through the initialization constructor of the smart contract, and define the employee permission application, employee permission review, and employee permission change. The smart contract is mainly used to control the access rights of employees when they request to access patient data through client devices, and only return patient data visible within the scope of the employee's permission, to prevent employees from unauthorized viewing of sensitive information; Step 8. When an employee accesses data, the smart contract first obtains the employee ID and the department or doctor information to be accessed from the request, obtains the access permission information of the employee ID in the block header, verifies whether the employee identity exists, and determines whether the employee has the permission to access the patient data of the specified department or doctor according to the employee's ACL permission control list maintained in the employee block header structure. If there is no access permission (reader, admin), the current request is rejected and an unauthorized error is returned; Step 9: After the employee's access request passes the authority verification, if the employee has the access rights (reader, admin), the MD5 decryption key is obtained from the system and returned. The external data source decrypts the patient's ciphertext information according to the key to obtain the plaintext content. If the patient information of the department and doctor needs to be modified or added, the employee needs to have read and write permissions (admin, reader, write). After the verification is passed, the key value of the system can be obtained to decrypt, update and encrypt the modified data for storage; Step 10: Update the access rights value (admin, reader, write, none) of each department in the access control list (ACL) corresponding to the employee ID in step 6, and use the block header generation method in step 3 to add the permission change node to the blockchain for subsequent auditing and tracking; Step 11. Intercept the request for the entrance of the smart contract service, and make a permission judgment for each operation request through the custom AccessPermissions function. Get the block header information from the blockchain according to the employee ID in the request information. If the employee ID block header information does not exist, the verification fails with "employee information does not exist". If the employee's block header information exists, get the permission access control list (ACL) in the block header. According to the department doctor information in the request information, traverse the permission access control list (ACL) to find out whether the department or doctor has the permission. If the department or doctor permission information does not exist, return the verification failure "The department or doctor permission is not assigned". If it exists, determine whether it has the corresponding permission according to the requested operation type. The access permission needs to be for reader or admin permission level, and the update permission requires reader and write or admin permission level. Adding permission requires write or admin permission level. If there is no corresponding permission for the operation, the verification fails with "Insufficient permission, unable to operate". Step 12: Introduce the RequestStatus enumeration to indicate the status of permission applications (Pending, Approved, Rejected), and the RoleRequest structure to store the specific information of each application, including the employee ID and the permission level of the corresponding department or doctor. The roleRequestsLink mapping is used to track the process of all permission applications and generate a unique application ID for each application. Step 13: Define the approveRoleRequest function for the administrator (admin) to process the pending approval of permission applications and obtain the specific information of the RoleRequest application in step 12; Step 14: The approveRoleRequest function in step 13 first determines whether the approver has admin privileges and whether the approval is in the pending status. If the application is approved, the employee ID and the authority level list of the corresponding department or doctor are generated into a block header structure according to the definition of the block header in step 6, and maintained to the blockchain in the same way as in step 3. Step 15. Define the rejectRoleRequest function for the admin to reject a pending permission request and record the reason for the rejection. Step 16: After the permission application is processed by the approveRoleRequest function in step 13 and the rejectRoleRequest function in step 15, the RoleRequest application information and the application result are recorded in the roleRequestsLink mapping object in step 12, so as to facilitate the subsequent tracking of the permission application; Step 17: Use the decision tree model as the machine learning model, which can handle both continuous attributes and missing values, and has good performance in selecting attributes; Step 18: Data feature labeling process: According to the C4.5 model training features, the employee permission information of all block header nodes of the blockchain is obtained and labeled. The user role, operation history, department, login frequency, and access resource type are used as feature sets, and the permissions owned by the employee are used as target values. The employee's operation is labeled with binary "allow" and "forbidden" to predict whether the employee allows a certain operation; Step 19: The C4.5 model constructs the splitting node of the decision tree to obtain accurate prediction results, obtain the splitting threshold, and use cross-validation to divide the data set into a training set and a validation set. For different splitting thresholds, the model is trained on the training set and the performance of the model is evaluated on the validation set to improve the accuracy of the prediction; Step 20: Before the employee applies for permission and performs change operations to access the C4.5 decision tree model to obtain the predicted value, the employee must first pass the identity authentication of the smart contract, that is, whether the block header information of the employee exists in the blockchain. After identity authentication, the permission access control list (ACL) and employee information of the smart contract authentication result are obtained as input parameters for calling the C4.5 decision tree model to obtain the employee's extensible department or doctor permission level, so as to supplement and adjust the permission levels of other departments or doctors that the employee may need to use according to the employee's job scenario, thereby improving the efficiency of permission application; Step 21: When an employee accesses and operates patient data through the triage desk or call terminal, a request is sent to the smart contract service defined in step 7. The smart contract service first authenticates the employee's identity and the legitimacy of the request, and extracts relevant feature data from the employee's request, namely the access type and information such as department, doctor, and employee number, which are used as inputs for permission prediction; Step 22, C4.5 decision tree model prediction: After the permission application and change operation of the smart contract, call the deployed C4.5 decision tree model, pass in the employee's permission information, that is, the RoleRequest object information in step 12 of the block header information as the relevant data feature input, and obtain the prediction result of the C4.5 decision tree model on the employee's permissions; Step 23: The smart contract uses the extracted employee feature data to construct an HTTPS request, including setting the request header and request body to send to the C4.5 decision tree model to obtain the prediction results. Combined with the preset permission control rules in step 5, the smart contract determines whether the employee has the permission to access the data based on the employee's permission level predicted by the model and the preset permission control rules. If the employee has the permission, the smart contract allows the employee to access the patient data; otherwise, the access request is rejected and the relevant information is recorded in the blockchain; Step 24: Ensure that the communication between the smart contract service and the C4.5 decision model is secure, use the protocol for encrypted communication, and ensure that the message will not be captured and cracked during the transmission process, resulting in information leakage; Step 25: In order to improve the stable interaction of message communication between the smart contract service and the C4.5 decision model and avoid permission verification failure, an intermediate layer is introduced. All permission authentication requests pass through the intermediate layer as consumption messages. The message loss retry mechanism prevents the loss of messages requested by the smart contract to the C4.5 decision model, and prevents the failure of obtaining the prediction results of the C4.5 decision tree model, which leads to permission authentication failure and inability to access patient data.
[0005] In order to improve the use effect, the present invention has the following improvements: the blockchain network adopts the open source service package of Hyperledger Fabric 2.0 version.
[0006] In order to improve the use effect, the present invention has the following improvements: in step three, a consensus algorithm is used to ensure the consistency of the contract status and execution results of all nodes in the blockchain network.
[0007] In order to improve the use effect, the present invention has the following improvements: the decision tree model in step seventeen adopts the C4.5 model.
[0008] In order to improve the use effect, the present invention has the following improvements: in step twenty-four, HTTPS protocol is used for encrypted communication.
[0009] In order to improve the use effect, the present invention has the following improvements: the middle layer in step 25 adopts RocketMQ middle layer.
[0010] (III) Beneficial effects Compared with the prior art, the present invention provides a safe and efficient outpatient data authority control solution, which has the following beneficial effects: This is a safe and efficient outpatient data permission control solution. The smart contract in this solution inherits the decentralized and tamper-proof characteristics of the blockchain. All permission requests will be permanently recorded in the blockchain, and the execution status and modification records of the contract can be viewed at any time, which enhances the transparency of the request and data security. The C4.5 decision tree model is used to dynamically empower employees, which can effectively prevent the risk of data leakage or non-compliance caused by manual configuration errors or poor management. The RocketMQ middleware is used to improve the execution efficiency and stability of the data interaction between the smart contract service and the C4.5 decision tree model. Each employee is configured with corresponding permissions, and the permission information is maintained in the database. When accessing data, the corresponding permissions of the employee are obtained from the database to determine whether the data can be accessed and the request is sent. The data is recorded in the database, and the approval process and approval success and failure processing methods defined in the smart contract's department and doctor-patient data permission change processing rules record changes in data access rights to ensure the transparency of permission access information and be able to trace the information of employees who access the data. The C4.5 decision tree model annotates and extracts feature sets from the data in the smart contract permission application record chain as data sampling sets for training. The data set is divided into training sets and validation sets using a cross-validation approach to improve the model's training efficiency and reduce the time cost of manual data entry. The smart contract service and the C4.5 decision tree model introduce RocketMQ middleware as an interaction hub to ensure the reliability of message communication, avoid the loss of permission access request information, and improve the stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0013] See also Figure 1 , a safe and efficient outpatient data permission control scheme, including the following steps: Step 1: Build a blockchain network. Use the Docker v19.03.8 application container engine and Docker-Compose v2.1.1 officially recommended by Docker as the management tool for the Docker engine container. The Docker container engine can isolate the internal environment from the server environment to ensure that the application containers do not affect each other. Step 2: The blockchain network constructs a blockchain network service through the Docker-Compose engine container management tool; Step 3: The information of the smart contract is deployed to the tree nodes of the blockchain storage structure in the form of a Merkle tree. Each node is the data access permission information of an employee. An algorithm is used to ensure the consistency of the contract state and execution results among all nodes in the blockchain network, preventing problems such as double-spending attacks and forks. Use SHA256(SHA256(block_header)) <TARGET, where block_header contains fields such as version, hash of the previous block, Merkle root, timestamp, permission level, etc. TARGET is the continuously adjusted permission target value, that is, obtain the SHA hash calculation result of the previous block header, perform two SHA hash function calculations to obtain a 32-bit unique digital identifier representing the content of the block header. Through the block header after this hash calculation, it can be verified whether the data has been tampered with during transmission and storage. The generation of each block is less than TARGET, so that each block contains the hash value of the previous block, thus forming an immutable data chain; Step 4: The patient information of all departments and doctors is symmetrically encrypted using MD5 and stored in the database. The salt used for encryption is generated by combining a fixed system key value and the patient registration department code. When the permission authentication passes, the corresponding decryption key can be used to obtain the plaintext data; Step 5: Define an AccessRole (enumeration type) to represent the operation permission level, and define admin (administrator), reader (read-only), write (write-only), none (no permission) as the basic permissions. The admin (administrator) can grant and revoke permissions; Step 6: The data structure of the block header stores the permission information of employees in the form of a mapping and an object array. The employee ID information is stored in the mapping, that is, the key value is the employee ID, and the corresponding value is an object array containing the access permission level content of the employee and the unique ID value for accessing special data. A permission access control list (ACL) is constructed according to the enumeration type in point 1.4 to check the access permissions of employees to the patient data of different departments and doctors; Step 7: Using the data structure defined in Step 5, initialize the permission status of each employee through the constructor of the smart contract. Define the employee permission application, employee permission review, and employee permission change respectively. The smart contract is mainly used to control the access permissions of employees when they request to access patient data through the client device, and only return the patient data visible within the employee's permission range to prevent employees from viewing sensitive information beyond their authority; Step 8. When an employee accesses data, the smart contract first obtains the employee ID and the department or doctor information to be accessed from the request, obtains the access permission information of the employee ID in the block header, verifies whether the employee identity exists, and determines whether the employee has the permission to access the patient data of the specified department or doctor according to the employee's ACL permission control list maintained in the employee block header structure. If there is no access permission (reader, admin), the current request is rejected and an unauthorized error is returned; Step 9: After the employee's access request passes the authority verification, if the employee has the access rights (reader, admin), the MD5 decryption key is obtained from the system and returned. The external data source decrypts the patient's ciphertext information according to the key to obtain the plaintext content. If the patient information of the department and doctor needs to be modified or added, the employee needs to have read and write permissions (admin, reader, write). After the verification is passed, the key value of the system can be obtained to decrypt, update and encrypt the modified data for storage; Step 10: Update the access rights value (admin, reader, write, none) of each department in the access control list (ACL) corresponding to the employee ID in step 6, and use the block header generation method in step 3 to add the permission change node to the blockchain for subsequent auditing and tracking; Step 11. Intercept the request for the entrance of the smart contract service, and make a permission judgment for each operation request through the custom AccessPermissions function. Get the block header information from the blockchain according to the employee ID in the request information. If the employee ID block header information does not exist, the verification fails with "employee information does not exist". If the employee's block header information exists, get the permission access control list (ACL) in the block header. According to the department doctor information in the request information, traverse the permission access control list (ACL) to find out whether the department or doctor has the permission. If the department or doctor permission information does not exist, return the verification failure "The department or doctor permission is not assigned". If it exists, determine whether it has the corresponding permission according to the requested operation type. The access permission needs to be for reader or admin permission level, and the update permission requires reader and write or admin permission level. Adding permission requires write or admin permission level. If there is no corresponding permission for the operation, the verification fails with "Insufficient permission, unable to operate". Step 12: Introduce the RequestStatus enumeration to indicate the status of permission applications (Pending, Approved, Rejected), and the RoleRequest structure to store the specific information of each application, including the employee ID and the permission level of the corresponding department or doctor. The roleRequestsLink mapping is used to track the process of all permission applications and generate a unique application ID for each application. Step 13: Define the approveRoleRequest function for the administrator (admin) to process the pending approval of permission applications and obtain the specific information of the RoleRequest application in step 12; Step 14: The approveRoleRequest function in step 13 first determines whether the approver has admin privileges and whether the approval is in the pending status. If the application is approved, the employee ID and the authority level list of the corresponding department or doctor are generated into a block header structure according to the definition of the block header in step 6, and maintained to the blockchain in the same way as in step 3. Step 15. Define the rejectRoleRequest function for the admin to reject a pending permission request and record the reason for the rejection. Step 16: After the permission application is processed by the approveRoleRequest function in step 13 and the rejectRoleRequest function in step 15, the RoleRequest application information and the application result are recorded in the roleRequestsLink mapping object in step 12, so as to facilitate the subsequent tracking of the permission application; Step 17: Use the decision tree model as the machine learning model, which can handle both continuous attributes and missing values, and has good performance in selecting attributes; Step 18: Data feature labeling process: According to the C4.5 model training features, the employee permission information of all block header nodes of the blockchain is obtained and labeled. The user role, operation history, department, login frequency, and access resource type are used as feature sets, and the permissions owned by the employee are used as target values. The employee's operation is labeled with binary "allow" and "forbidden" to predict whether the employee allows a certain operation; Step 19: The C4.5 model constructs the splitting node of the decision tree to obtain accurate prediction results, obtain the splitting threshold, and use cross-validation to divide the data set into a training set and a validation set. For different splitting thresholds, the model is trained on the training set and the performance of the model is evaluated on the validation set to improve the accuracy of the prediction; Step 20: Before the employee applies for permission and performs change operations to access the C4.5 decision tree model to obtain the predicted value, the employee must first pass the identity authentication of the smart contract, that is, whether the block header information of the employee exists in the blockchain. After identity authentication, the permission access control list (ACL) and employee information of the smart contract authentication result are obtained as input parameters for calling the C4.5 decision tree model to obtain the employee's extensible department or doctor permission level, so as to supplement and adjust the permission levels of other departments or doctors that the employee may need to use according to the employee's job scenario, thereby improving the efficiency of permission application; Step 21: When an employee accesses and operates patient data through the triage desk or call terminal, a request is sent to the smart contract service defined in step 7. The smart contract service first authenticates the employee's identity and the legitimacy of the request, and extracts relevant feature data from the employee's request, namely the access type and information such as department, doctor, and employee number, which are used as inputs for permission prediction; Step 22, C4.5 decision tree model prediction: After the permission application and change operation of the smart contract, call the deployed C4.5 decision tree model, pass in the employee's permission information, that is, the RoleRequest object information in step 12 of the block header information as the relevant data feature input, and obtain the prediction result of the C4.5 decision tree model on the employee's permissions; Step 23: The smart contract uses the extracted employee feature data to construct an HTTPS request, including setting the request header and request body to send to the C4.5 decision tree model to obtain the prediction results. Combined with the preset permission control rules in step 5, the smart contract determines whether the employee has the permission to access the data based on the employee's permission level predicted by the model and the preset permission control rules. If the employee has the permission, the smart contract allows the employee to access the patient data; otherwise, the access request is rejected and the relevant information is recorded in the blockchain; Step 24: Ensure that the communication between the smart contract service and the C4.5 decision model is secure, use the protocol for encrypted communication, and ensure that the message will not be captured and cracked during the transmission process, resulting in information leakage; Step 25: In order to improve the stable interaction of message communication between the smart contract service and the C4.5 decision model and avoid permission verification failure, an intermediate layer is introduced. All permission authentication requests pass through the intermediate layer as consumption messages. The message loss retry mechanism prevents the loss of messages requested by the smart contract to the C4.5 decision model, and prevents the failure of obtaining the prediction results of the C4.5 decision tree model, which leads to permission authentication failure and inability to access patient data.
[0014] The blockchain network adopts the open source service package of Hyperledger Fabric 2.0 version.
[0015] In step three, a consensus algorithm is used to ensure the consistency of contract status and execution results among all nodes in the blockchain network.
[0016] The decision tree model in step 17 adopts the C4.5 model.
[0017] In step 24, HTTPS protocol is used for encrypted communication.
[0018] The middle layer in step 25 uses RocketMQ middle layer.
[0019] In summary, the working principle and process of this safe and efficient outpatient data permission control solution are as follows: blockchain network construction, using Docker v19.03.8 version of the application container engine and Docker-Compose v2.1.1 officially recommended by Docker as the management tool for Docker engine containers. The Docker container engine can isolate the internal environment from the server environment to ensure that application containers do not affect each other; the blockchain network builds blockchain network services through the Docker-Compose engine container management tool; the information of the smart contract is deployed to the tree node of the blockchain storage structure, which is a Merkle tree. Each node is the data access permission information of an employee. The algorithm is used to ensure the consistency of the contract status and execution results of all nodes in the blockchain network to prevent double-spending attacks and forks. SHA256 (SHA256 (block_header)) < TARGET, where block_header contains fields such as version, hash of the previous block, Merkle root, timestamp, permission level, etc. TARGET is the constantly adjusted permission target value, that is, obtain the SHA hash calculation result of the previous block header, perform two SHA hash function calculations to obtain a 32-bit unique digital identifier representing the content of the block header. Through this block header after hash calculation, it can be verified whether the data has been tampered with during transmission and storage. The generation of each block is smaller than TARGET, so that each block contains the hash value of the previous block, thereby forming a data chain that cannot be tampered with; all department and doctor patient information is stored in the database through MD5 symmetric encryption. The salt used for encryption is generated by a fixed system key value and the patient registration department code. The permission authentication is passed When the corresponding decryption key is used, the plaintext data can be obtained; define an AccessRole (enumeration type) to represent the operation permission level, define admin (administrator), reader (read-only), write (write-only), and none (no permission) as basic permissions, and admin (administrator) can grant and revoke permissions; the data structure of the block header uses mapping and object array structures to store employee permission information. The mapping stores the employee's work number information, that is, the key value is the employee's work number, and the corresponding value is the object array for the access permission level content owned by the employee, and the unique ID value for accessing special data. According to the enumeration type in point 1.4, a permission access control list (ACL) is constructed to check the employee's access rights to the patient data of different departments and doctors;Using the data structure defined in step 5, the permission status of each employee is initialized through the initialization constructor of the smart contract, and the employee permission application, employee permission review and employee permission change are defined respectively. The smart contract is mainly used to control the access rights of employees when they request to access patient data through client devices, and only returns the patient data visible within the scope of the employee's permission to prevent employees from unauthorized viewing of sensitive information. When an employee accesses data, the smart contract first obtains the employee's work number and the department or doctor information to be accessed from the request, obtains the access right information of the work number in the block header, and verifies whether the employee identity exists. According to the maintenance in the employee block header structure, the smart contract verifies the employee's identity. The ACL permission control list of the staff to be protected is used to determine whether the staff has the permission to access the patient data of the specified department or doctor. If there is no access permission (reader, admin), the current request is rejected and an unauthorized error is returned. After the staff access request passes the permission verification, if the staff has the access permission (reader, admin), the MD5 decryption key is obtained from the system and returned. The external data source decrypts the patient's ciphertext information according to the key to obtain the plaintext content. If the patient information of the department and doctor needs to be modified or added, the staff needs to have read and write permissions (admin, reader, write). After verification, the key value of the system can be obtained to modify the data. Decryption update and encryption storage operations; update the access rights value (admin, reader, write, none) of each department in the access control access list (ACL) corresponding to the employee ID in step 6, and use the block header generation method in step 3 to add the permission change node to the blockchain for subsequent auditing and tracking; intercept the request to the entrance of the smart contract service, make permission judgment for each operation request through the custom AccessPermissions function, and obtain the block header information from the blockchain according to the employee ID in the request information. If the employee ID block header information does not exist, the verification fails "employee information does not exist". If the employee ID block header information exists, the verification fails "employee information does not exist". Block header information, get the permission access control list (ACL) in the block header, according to the department doctor information in the request information, traverse the permission access control list (ACL) to find whether the department or doctor has the permission. If the department or doctor permission information does not exist, return the verification failure "the department or doctor permission is not assigned". If it exists, determine whether the corresponding permission is available according to the requested operation type. The access permission needs to be for the reader or admin permission level, the update permission needs the reader and write or admin permission level, and the new permission needs the write or admin permission level. If the operation does not have the corresponding permission, the verification fails "insufficient permission, unable to operate".The RequestStatus enumeration is introduced to indicate the status of permission applications (Pending, Approved, Rejected), and the RoleRequest structure is used to store the specific information of each application, including the employee ID and the permission level of the corresponding department or doctor. The roleRequestsLink mapping is used to track the process of all permission applications and generate a unique application ID for each application. The approveRoleRequest function is defined for the administrator (admin) to perform pending approval of permission applications and obtain the specific information of the RoleRequest application in step 12. The approveRoleRequest function in step 13 first determines whether the approver has admin permissions and whether the approval is in the pending approval status. If the application is approved, the employee ID and the permission level of the corresponding department or doctor are listed, and a block header structure is generated according to the definition of the block header in step 6, and maintained to the blockchain in the same way as in step 3. The rejectRoleRequest function is defined for the admin to reject a pending permission application , and the reason for rejection is recorded at the same time; after the permission application is processed by the approveRoleRequest function in step 13 and the rejectRoleRequest function in step 15, the RoleRequest application information and application results are recorded in the roleRequestsLink mapping object in step 12, which is convenient for subsequent tracking of permission applications; the decision tree model is used as a machine learning model, which can handle both continuous attributes and missing values, and has good performance in selecting attributes; in the data feature labeling process, according to the C4.5 model training features, the employee permission information of all block header nodes of the blockchain is obtained for labeling, and the user role, operation history, department, login frequency, and access resource type are used as feature sets, and the permissions owned by the employee are used as target values. The employee's operation is binary labeled "allowed" and "prohibited" to predict whether the employee allows a certain operation; the C4.5 model constructs the split node of the decision tree to obtain accurate prediction results, obtains the split threshold, and uses cross-validation to divide the data set into a training set and a validation set. For different split thresholds, the model is trained on the training set, and the performance of the model is evaluated on the validation set to improve the accuracy of the prediction;Before employees apply for permissions and make changes to access the C4.5 decision tree model to obtain prediction values, they first need to pass the identity authentication of the smart contract, that is, whether the block header information of the employee exists in the blockchain. After identity authentication, the permission access control list (ACL) and employee information of the smart contract authentication result are obtained as input parameters for calling the C4.5 decision tree model to obtain the employee's extensible department or doctor permission level, so as to supplement and adjust the permission levels of other departments or doctors that the employee may need to use according to the employee's job scenario, thereby improving the efficiency of permission application; when employees access and operate patient data through the triage desk and call terminal, they send a request to the smart contract service defined in step seven. The smart contract service first authenticates the employee's identity and the legitimacy of the request, and extracts relevant feature data from the employee's request, that is, the access type and department, doctor, and employee number information, which are used as the input required for permission prediction; C4.5 decision tree model prediction: through the smart contract After the permission application and change operation, the deployed C4.5 decision tree model is called, and the employee's permission information, that is, the RoleRequest object information in step 12 of the block header information, is passed in as the relevant data feature input to obtain the prediction result of the C4.5 decision tree model on the employee's permissions; the smart contract uses the extracted employee feature data to construct an HTTPS request, including setting the request header and the request body to send to the C4.5 decision tree model to obtain the prediction result. Combined with the preset permission control rules in step 5, the smart contract determines whether the employee has the permission to access the data based on the employee's permission level predicted by the model and the preset permission control rules. If the employee has the permission, the smart contract allows the employee to access the patient data; otherwise, the access request is rejected and the relevant information is recorded in the blockchain; ensure that the communication between the smart contract service and the C4.5 decision model is secure, use the protocol for encrypted communication, and ensure that the message will not be captured and cracked during the transmission process, resulting in information leakage;In order to improve the stable interaction of message communication between smart contract service and C4.5 decision model and avoid permission verification failure, an intermediate layer is introduced. All permission authentication requests pass through the intermediate layer as consumption messages. The message loss retry mechanism prevents the loss of messages requested by smart contract to C4.5 decision model, and the failure to obtain the prediction results of C4.5 decision tree model, resulting in permission authentication failure and inability to access patient data. Smart contracts also inherit the decentralized and tamper-proof characteristics of blockchain. All permission requests will be permanently recorded in the blockchain, and the execution status and modification records of the contract can be viewed at any time, which enhances the transparency of the request and data security. Dynamic empowerment of employees through C4.5 decision tree model can effectively prevent the risk of data leakage or non-compliance caused by manual configuration errors or poor management. RocketMQ middleware is used to improve the execution efficiency and stability of data interaction between smart contract service and C4.5 decision tree model. Each employee is configured with corresponding permissions, and the permission information is maintained in the database. When accessing data, the corresponding permissions of the employee are obtained from the database to determine whether the data can be accessed, and the request is recorded in the database. ;
[0020] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A safe and efficient outpatient data authority control scheme, characterized by: It includes the following steps: Step 1: Build a blockchain network. Select the application container engine of Docker v19.03.8 and use Docker-Compose v2.1.1 recommended by Docker officially as the management tool for Docker engine containers. The Docker container engine can isolate the internal environment from the server environment to ensure that application containers do not affect each other; Step 2: The blockchain network constructs a blockchain network service through the Docker-Compose engine container management tool; Step 3: Deploy the information of the smart contract to the tree-shaped nodes of the blockchain storage structure Merkle tree. Each node is the data access permission information of an employee. Use algorithms to ensure the consistency of the contract status and execution results among all nodes in the blockchain network, prevent problems such as double-spending attacks and forks. Use SHA256(SHA256(block_header)) <TARGET, where block_header includes fields such as version, hash of the previous block, Merkle root, timestamp, permission level, etc. TARGET is an adjustable permission target value, that is, obtain the SHA hash calculation result of the previous block header, perform two SHA hash function calculations to obtain a 32-bit unique digital identifier representing the content of the block header. Through the block header after this hash calculation, it can be verified whether the data has been tampered with during transmission and storage. The generation of each block is less than TARGET, so that each block contains the hash value of the previous block, thus forming an immutable data chain; Step 4: Store the patient information of all departments and doctors in the database through MD5 symmetric encryption. The salt used for encryption is generated by combining a fixed system key value and the patient registration department code. When the permission authentication passes, the corresponding decryption key can be used to obtain the plaintext data; Step 5: Define an AccessRole (enumeration type) to represent the operation permission level, and define admin (administrator), reader (read-only), write (write-only), none (no permission) as the basic permissions. The admin (administrator) can grant and revoke permissions; Step 6: The data structure of the block header stores the permission information of employees in the form of a mapping and an object array. The employee ID information is stored in the mapping, that is, the key value is the employee ID, and the corresponding value is an object array containing the access permission level content of the employee and the unique ID value for accessing special data. Build a permission access control list (ACL) according to the enumeration type in point 1.4 to check the access permissions of employees to the patient data of different departments and doctors; Step 7. Using the data structure defined in step 5, initialize the permission status of each employee through the initialization constructor of the smart contract, and define the employee permission application, employee permission review, and employee permission change. The smart contract is mainly used to control the access rights of employees when they request to access patient data through client devices, and only return patient data visible within the scope of the employee's permission, to prevent employees from unauthorized viewing of sensitive information; Step 8. When an employee accesses data, the smart contract first obtains the employee ID and the department or doctor information to be accessed from the request, obtains the access permission information of the employee ID in the block header, verifies whether the employee identity exists, and determines whether the employee has the permission to access the patient data of the specified department or doctor according to the employee's ACL permission control list maintained in the employee block header structure. If there is no access permission (reader, admin), the current request is rejected and an unauthorized error is returned; Step 9: After the employee's access request passes the authority verification, if the employee has the access rights (reader, admin), the MD5 decryption key is obtained from the system and returned. The external data source decrypts the patient's ciphertext information according to the key to obtain the plaintext content. If the patient information of the department and doctor needs to be modified or added, the employee needs to have read and write permissions (admin, reader, write). After the verification is passed, the key value of the system can be obtained to decrypt, update and encrypt the modified data for storage; Step 10: Update the access rights value (admin, reader, write, none) of each department in the access control list (ACL) corresponding to the employee ID in step 6, and use the block header generation method in step 3 to add the permission change node to the blockchain for subsequent auditing and tracking; Step 11. Intercept the request for the entrance of the smart contract service, and make a permission judgment for each operation request through the custom AccessPermissions function. Get the block header information from the blockchain according to the employee ID in the request information. If the employee ID block header information does not exist, the verification fails and "employee information does not exist". If the employee's block header information exists, get the permission access control list (ACL) in the block header. According to the department doctor information in the request information, traverse the permission access control list (ACL) to find out whether the department or doctor has the permission. If the department or doctor permission information does not exist, return the verification failure "the department or doctor permission is not assigned". If it exists, determine whether it has the corresponding permission according to the requested operation type. The access permission needs to be for reader or admin permission level, update permission requires reader and write or admin permission level, and add permission requires write or admin permission level. If there is no corresponding permission for the operation, the verification fails and "insufficient permission, unable to operate"; Step 12: Introduce the RequestStatus enumeration to indicate the status of permission applications (Pending, Approved, Rejected), and the RoleRequest structure to store the specific information of each application, including the employee ID and the permission level of the corresponding department or doctor. The roleRequestsLink mapping is used to track the process of all permission applications and generate a unique application ID for each application. Step 13: Define the approveRoleRequest function for the administrator (admin) to process the pending approval of permission applications and obtain the specific information of the RoleRequest application in step 12; Step 14: The approveRoleRequest function in step 13 first determines whether the approver has admin privileges and whether the approval is in the pending status. If the application is approved, the employee ID and the authority level list of the corresponding department or doctor are generated into a block header structure according to the definition of the block header in step 6, and maintained to the blockchain in the same way as in step 3. Step 15. Define the rejectRoleRequest function for the admin to reject a pending permission request and record the reason for the rejection. Step 16: After the permission application is processed by the approveRoleRequest function in step 13 and the rejectRoleRequest function in step 15, the RoleRequest application information and the application result are recorded in the roleRequestsLink mapping object in step 12, so as to facilitate the subsequent tracking of the permission application; Step 17: Use the decision tree model as the machine learning model, which can handle both continuous attributes and missing values, and has good performance in selecting attributes; Step 18: Data feature labeling process: According to the C4.5 model training features, the employee permission information of all block header nodes of the blockchain is obtained and labeled. The user role, operation history, department, login frequency, and access resource type are used as feature sets, and the permissions owned by the employee are used as target values. The employee's operation is labeled with binary "allow" and "forbidden" to predict whether the employee allows a certain operation; Step 19: The C4.5 model constructs the splitting node of the decision tree to obtain accurate prediction results, obtain the splitting threshold, and use cross-validation to divide the data set into a training set and a validation set. For different splitting thresholds, the model is trained on the training set and the performance of the model is evaluated on the validation set to improve the accuracy of the prediction; Step 20: Before the employee applies for permission and performs change operations to access the C4.5 decision tree model to obtain the predicted value, the employee must first pass the identity authentication of the smart contract, that is, whether the block header information of the employee exists in the blockchain. After identity authentication, the permission access control list (ACL) and employee information of the smart contract authentication result are obtained as input parameters for calling the C4.5 decision tree model to obtain the employee's extensible department or doctor permission level, so as to supplement and adjust the permission levels of other departments or doctors that the employee may need to use according to the employee's job scenario, thereby improving the efficiency of permission application; Step 21: When an employee accesses and operates patient data through the triage desk or call terminal, a request is sent to the smart contract service defined in step 7. The smart contract service first authenticates the employee's identity and the legitimacy of the request, and extracts relevant feature data from the employee's request, namely the access type and information such as department, doctor, and employee number, which are used as inputs for permission prediction; Step 22, C4.5 decision tree model prediction: After the permission application and change operation of the smart contract, call the deployed C4.5 decision tree model, pass in the employee's permission information, that is, the RoleRequest object information in step 12 of the block header information as the relevant data feature input, and obtain the prediction result of the C4.5 decision tree model on the employee's permissions; Step 23: The smart contract uses the extracted employee feature data to construct an HTTPS request, including setting the request header and request body to send to the C4.5 decision tree model to obtain the prediction results. Combined with the preset permission control rules in step 5, the smart contract determines whether the employee has the permission to access the data based on the employee's permission level predicted by the model and the preset permission control rules. If the employee has the permission, the smart contract allows the employee to access the patient data; otherwise, the access request is rejected and the relevant information is recorded in the blockchain; Step 24: Ensure that the communication between the smart contract service and the C4.5 decision model is secure, use the protocol for encrypted communication, and ensure that the message will not be captured and cracked during the transmission process, resulting in information leakage; Step 25: In order to improve the stable interaction of message communication between the smart contract service and the C4.5 decision model and avoid permission verification failure, an intermediate layer is introduced. All permission authentication requests pass through the intermediate layer as consumption messages. The message loss retry mechanism prevents the loss of messages requested by the smart contract to the C4.5 decision model, and prevents the failure of obtaining the prediction results of the C4.5 decision tree model, which leads to permission authentication failure and inability to access patient data.
2. A safe and efficient outpatient data authority control scheme according to claim 1, characterized in that: The blockchain network adopts the open source service package of Hyperledger Fabric 2.0 version.
3. A safe and efficient outpatient data authority control scheme according to claim 2, characterized in that: In step three, a consensus algorithm is used to ensure the consistency of contract status and execution results among all nodes in the blockchain network.
4. A safe and efficient outpatient data authority control scheme according to claim 3, characterized in that: The decision tree model in step 17 adopts the C4.5 model.
5. A safe and efficient outpatient data authority control scheme according to claim 4, characterized in that: In step 24, HTTPS protocol is used for encrypted communication.
6. A safe and efficient outpatient data authority control scheme according to claim 5, characterized in that: The middle layer in step 25 uses RocketMQ middle layer.
