-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMedical.sol
54 lines (46 loc) · 1.44 KB
/
Medical.sol
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract MedicalHistory{
struct Patient{
string name;
uint age;
string[] conditions;
string[] allergies;
string[] medication;
string[] procedures;
}
mapping(address => Patient) public patients;
function addPatient(
string memory _name,
uint _age,
string[] memory _conditions,
string[] memory _allergies,
string[] memory _medication,
string[] memory _procedures
) public {
Patient memory patient = Patient(_name,_age,_conditions,_allergies,_medication,_procedures);
patients[msg.sender] = patient;
}
function updatePatient(
string[] memory _conditions,
string[] memory _allergies,
string[] memory _medication,
string[] memory _procedures
) public {
Patient memory patient = patients[msg.sender];
patient.conditions = _conditions;
patient.allergies = _allergies;
patient.procedures = _procedures;
}
function getPatient(address _patientAddress) public view returns(
string memory,
uint,
string[] memory,
string[] memory,
string[] memory,
string[] memory
) {
Patient memory patient = patients[_patientAddress];
return (patient.name, patient.age, patient.conditions,patient.allergies,patient.medication,patient.procedures);
}
}