Repository: Rishabh42/HealthCare-Insurance-Ethereum
Branch: master
Commit: 88db3cef10fa
Files: 20
Total size: 27.3 KB
Directory structure:
gitextract_ks5s19nd/
├── .gitignore
├── LICENSE
├── README.md
├── Web-client/
│ ├── package.json
│ ├── public/
│ │ ├── index.html
│ │ └── manifest.json
│ └── src/
│ ├── HealthCare.js
│ ├── hadmin.js
│ ├── index.css
│ ├── index.js
│ ├── insurance.js
│ ├── ladmin.js
│ ├── patient.js
│ └── web3.js
├── contracts/
│ ├── HealthCare.sol
│ └── Migrations.sol
├── migrations/
│ ├── 1_initial_migration.js
│ └── 2_deploy_HealthCare.js
├── truffle-config.js
└── truffle.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Don't track content of these folders
node_modules/
build/
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2019 Rishabh Thaney
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Medical Insurance claiming DApp (for ConsenSys)
Problem statement:
1) Patient logs in, uploads medical/lab test bills and submits it for insurance. Notifications are sent to hospital and lab admin.
2) Hospital admin logs in, verifies and approves the bills. This approval is stored on the smart contract
3) Lab admin approves the lab test bills. This approval is also stored on the smart contract
4) Once both of them approve, notification are sent to insurance admin.
5) Insurance admin can check for approvals of hospital and lab after which he will calculate the claim amount and do the claim.
`HealthCare.sol` contract maintains the logic for this DApp.
The web pages found in the `Web-client` folder are used to communicate with the deployed smart contract and also allow logging in for each specific user
## Steps to deploy and interact with the contract:
1. Copy and paste the contract code on https://remix.ethereum.org/
2. Run an instance of ganache-cli on your local machine and connect your metamask wallet to it. Also, add the first 3 accounts from ganache to your metamask by importing their private keys and assign the following names to it:
account 1: Hospital admin
account 2: Lab admin
account 3: Patient
3. Pass the Lab Admin's address as an argument in the constructor while deploying the contract
4. Select `Injected Web3` in the `Environment` field and make sure your Metamask wallet is unlocked. This will connect Remix to the first account(Hospital admin) in your Metamask wallet.
5. Deploy the contract
6. Select Account 3(Patient) and created a new medical record by calling the `newRecord` function with the respective fields.
7. You can check if the record was created and it's details by calling the `_records` mapping with index 1.
8. To sign the record, switch back to account 1(Hospital admin) in Metamask, enter the record's `_ID` in the `signRecord` function and click on transact.
9. Repeat the same steps using account 2(Lab Admin) from metamask.
10. Now the record is approved and you can verify the same by calling the `_records` mapping again where you can see that the `signatureCount` has incremented.
Note that you can not sign the record using the patient's account from metamask and neither can the same account sign a record twice.
Update:
With Remix's new interface, you need to change the account address from the `ACCOUNT` drop down on the `Deploy and Run` tab (required in step 8):
## Known issues:
- The table on the React front end doesn't display the records created by the user (Issue #1).
The main focus of this project at the time of making was the smart contract logic, I just made the front end in a jiffy as I had some extra time left after implementing the contracts.
Contributions to fix the open issues are welcome, you'll receive some DOGE as well 😏
## Steps to contribute
1. Fork this repo.
2. Commit your changes.
3. Send a PR to this project's `master` branch and add me as a reviewer
================================================
FILE: Web-client/package.json
================================================
{
"name": "web",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.1",
"react-dom": "^16.6.1",
"react-router-dom": "^4.3.1",
"react-scripts": "5.0.1",
"web3": "^4.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
================================================
FILE: Web-client/public/index.html
================================================