Let's write the smart contracts that will be responsible for registering the identity of patients and service providers, and for providing access control.
Here is the smart contract code:
pragma solidity ^0.4.22;contract Health { address owner; struct ServiceProvider { string publicKey; } struct Permission { bool read; bool write; string reEncKey; //Re-Encrypt Key } struct Token { int status; bool read; bool write; string reEncKey; //Re-Encrypt Key } struct EMR { string hash; address issuer; } struct Patient { string publicKey; mapping (address => Permission) permissions; mapping (bytes32 => Token) tokens; bool closed; EMR[] EMRs; } mapping (address => ServiceProvider) serviceProviders; mapping ...