Here's the smart contract.

pragma solidity ^0.4.8;

contract RecordCreation {

uint public count;
mapping (address => string) public usertype;
struct Patientdetails{

Patientdetails[] public patientdetails;

mapping (address => uint[]) public PatientDocuments;
function RecordCreation(){

//Function user type definition
function userDefinition(string utype1) payable returns(bool result) {

 //Data Submission Function
 function patientDataSubmission() payable returns (bool result){

 //Documents Count Retrieval Function for  a Patient
 function countOfDataSubmission(address patientaddress) payable returns (uint result){

 function getPatientsCount(address patientaddress)
    constant returns (uint count) {



How can I define the contract for usecase -Patient holds any number of documents?

  • I can sort it out but it calls for a data restructure and I need some clarity about what we're trying to achieve. Does each patient have a document with basic info, PLUS a series of related documents, or is it JUST a series of documents related to patient ID? – Rob Hitchens - B9lab Jul 12 '17 at 15:35
  • A series of documents related to patient Id @Rob Hitchens – Crissi Mariam Robert Jul 12 '17 at 15:57
  • @Rob Hitchens How can I restructure it?? – Crissi Mariam Robert Jul 12 '17 at 16:08
  • It sounds like you're aiming for this: medium.com/@robhitchens/…. – Rob Hitchens - B9lab Jul 12 '17 at 18:17
  • @RobHitchens I have followed your writeup..It worked perfectly.....It's good article to follow...Thank you once again – Crissi Mariam Robert Jul 14 '17 at 4:53

It sounds like you're aiming for this: https://medium.com/@robhitchens/enforcing-referential-integrity-in-ethereum-smart-contracts-a9ab1427ff42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.