|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract RegistroMedico { struct Historial { string hashDocumento; // referencia al documento (ej: IPFS o hash) uint fecha; address doctor; } mapping(address => Historial[]) historiales; function añadirHistorial(string memory _hash) public { historiales[msg.sender].push(Historial({ hashDocumento: _hash, fecha: block.timestamp, doctor: msg.sender })); } function verHistorial(address paciente) public view returns (Historial[] memory) { return historiales[paciente]; } } |