I am making a dapp using web3 1.0. I have a contract that stores medical data for every patient (represented by account). Their medical data can be set by doctor (account address) using the set function. I want that before the set function is called, a notification should be sent to the patient whose data is modified. Only if the patient approves, the function should be called and the data should be set, else, the request should be discarded. How can I achieve this with web3 1.0 ? Here is my smart contract -
pragma solidity ^0.5.4;
pragma experimental ABIEncoderV2;
contract MedicalHistory {
struct medicalData {
address provider_address;
string date;
string[] medicine_name;
uint[] quantity;
}
mapping (address=>medicalData[]) medicalDataHistory;
function getData() public view returns(medicalData[] memory) {
return medicalDataHistory[msg.sender];
}
function setData(address a,string memory d, string[] memory s, uint[] memory u) public {
medicalData memory m = medicalData(a, d, s, u);
medicalDataHistory[msg.sender].push(m);
}
}