This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doctorSign(address _pid) public{ | |
require(doctorList[msg.sender]); | |
patientList[_pid].doctorSignature = true; | |
patientList[_pid].doctorAddress = msg.sender; | |
patientList[_pid].doctorName = doctorDetailList[msg.sender].docName; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract HealthCareStore is Ownable{ | |
uint public pidCount; | |
uint public withdrawCount; | |
uint public doctorCount; | |
uint public donorCount; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Patient{ | |
uint256 time; | |
uint256 insuranceAmount; | |
uint256 donatedAmount; | |
string name; | |
string disease; | |
string doctorName; | |
string ipfsHash; | |
address doctorAddress; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.0; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; | |
contract HealthCareStore is Ownable{ | |
uint public pidCount; | |
uint public withdrawCount; | |
uint public doctorCount; | |
uint public donorCount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapping( address => bool) public doctorList; | |
mapping(address => uint256) public donorList; | |
mapping(uint => address) public pidList; | |
mapping(address => Patient) public patientList; | |
mapping(address => Doctor) public doctorDetailList; | |
mapping(uint => donationHistory) public donationHistoryList; | |
mapping(uint => withdrawHistory) public withdrawHistoryList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a New DOCTOR | |
function setDoctor(address _docAddress,string memory _name, string memory _spec) public onlyOwner{ | |
require(!doctorList[_docAddress]); | |
doctorList[_docAddress] = true; | |
doctorDetailList[_docAddress].docAdress = _docAddress; | |
doctorDetailList[_docAddress].docName = _name; | |
doctorDetailList[_docAddress].docSpecialization = _spec; | |
doctorCount++; | |
docAddressList[doctorCount] = _docAddress; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Withdrawing Funds from Patient | |
function withdrawInsurance(address _pid, uint256 _amountRequired) public{ | |
// Checkpoints Before execution | |
require(doctorList[msg.sender]); | |
require(patientList[_pid].doctorAddress == msg.sender); | |
require(patientList[_pid].insuranceAmount >= _amountRequired); | |
// If all Conditions are satisfied, Funds are transferred to the assigned doctor | |
address payable recepientDoctor = msg.sender; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DONATING FUNDS TO PATIENTS | |
function donateAmount(address _pid) public payable{ | |
require((msg.sender).balance >= msg.value); | |
patientList[_pid].donatedAmount = msg.value; | |
donorList[msg.sender] = msg.value; | |
donorCount++; | |
donationHistoryList[donorCount] = donationHistory(_pid, msg.sender,now,msg.value,patientList[_pid].name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.2; | |
import "../../introspection/IERC165.sol"; | |
interface IERC721 is IERC165 { | |
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); |
OlderNewer