I am trying to write HealthCare contract by taking the reference from this Link. Where Doctor can only update the details of the Patient when Patient sends the address.
File: Patient.sol
pragma solidity ^0.4.21;
contract Patient {
string public name = "";
string public dateOfBirth;
mapping (address => uint) public balances;
function () payable{
balances[msg.sender] = 40;
}
function getContractAddress() public view returns(address) {
return address(this);
}
// ############### Get Functions Begin ######################
function getName() external view returns (string) {
return name; // First_Name Last_Name
}
function getDateOfBirth() external view returns (string) {
return dateOfBirth; // YYYYMMDD
}
}
File: Doctor.sol
pragma solidity ^0.4.21;
import './Patient.sol';
contract Doctor{
// the address of the owner (the patient)
address public owner;
string public name;
string public dateOfBirth;
string public patient_problem;
modifier isOwnerPatient {
require(msg.sender == owner);
_;
}
// constructor that sets the owner to the address creating
// this smart contract
function Doctor() {
owner = msg.sender;
}
// allows physician to add an allergy
function AddProblem(string _allergie) public isOwnerPatient {
patient_problem = _allergie;
}
}
But when I am running the function AddProblem()
of Doctor contract
. It is not going inside the loop. It seems that the owner != msg.sender
. I am using remix IDE and inputting Patient's contract Address into Doctors At Address
input area.