Skip to content

Instantly share code, notes, and snippets.

@zaryab2000
Last active June 14, 2020 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaryab2000/4ae1de26fc7a9cb0696cf96567af8ee1 to your computer and use it in GitHub Desktop.
Save zaryab2000/4ae1de26fc7a9cb0696cf96567af8ee1 to your computer and use it in GitHub Desktop.
//Function to add a New Patient
function setPatientData(string memory _name, string memory _disease,string memory _ipfsHash) public payable onlyOwner{
//GENERATING a UNIQUE ID for Patient
address pid = address(bytes20(keccak256(abi.encodePacked(msg.sender,now))));
patientList[pid] = Patient(now,0,0,_name,_disease,' ',_ipfsHash,0x0000000000000000000000000000000000000000,pid,true,false);
// Adding Insurance Amount
patientList[pid].insuranceAmount = msg.value;
//Increasing Patient Count by 1
pidCount++;
pidList[pidCount] = pid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment