Hello everyone please kindly help me out. I have researched on the error above associated with this block of code. But please is there a way to revise this code so that i can get all the data of a patient from a single struct. How would you advice I approach this

pragma solidity >=0.4.21 <0.7.0;

contract Patients {
    uint256 public count = 0;
    struct Patient {
        bytes16 patientID;
        bytes16 title;
        bytes16 fullName;
        bytes16 dob;
        bytes16 gender;
        bytes16 contact;
        bytes16 residentialAddress;
        bytes16 relativeNumber;
        uint256 NHIS;
        uint256 temperature;
        uint256 bloodPressure;
        uint256 pulse;
        uint256 respiration;
        uint256 weight;
        uint256 bmi;
        bool appointment;

event created(string message);

mapping(uint256 => Patient) public patient;

  function setBio(bytes16  patientID, bytes16  title, bytes16  fullName, bytes16  dob, bytes16  gender, bytes16  contact, bytes16  residentialAddress, bytes16  relativeNumber, uint256 NHIS) public {
    patient[count].patientID = patientID;
    patient[count].title = title;
    patient[count].fullName = fullName;
    patient[count].dob = dob;
    patient[count].gender = gender;
    patient[count].contact = contact;
    patient[count].residentialAddress = residentialAddress;
    patient[count].relativeNumber = relativeNumber;
    patient[count].NHIS = NHIS;
    emit created('New Patient folder created');

  function getBio(uint256 index) public view returns(bytes16  patientID, bytes16  title, bytes16  fullName, bytes16  dob,bytes16  gender, bytes16  contact, bytes16  residentialAddress,bytes16  relativeNumber, uint256 NHIS){
    Patient memory p = patient[index];
    return(p.patientID, p.title, p.fullName, p.dob, p.gender, p.contact, p.residentialAddress, p.relativeNumber, p.NHIS);

  function setVitalSigns(uint _id, uint256 temperature, uint256 bloodPressure, uint256 pulse, uint256 respiration, uint256 weight, uint256 bmi, bool)public {
    Patient memory _patient = patient[_id];
    _patient.temperature = temperature;
    _patient.bloodPressure = bloodPressure;
    _patient.pulse = pulse;
    _patient.respiration = respiration;
    _patient.weight = weight;
    _patient.bmi = bmi;
    _patient.appointment = !_patient.appointment;
    emit created('Vital Signs Checked');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.