Spaces:
Sleeping
Sleeping
from test_selection import TEST_PRICES | |
def fetch_billing(patient_id, data): | |
if patient_id not in data: | |
return "Invalid Patient ID. Please check the ID." | |
patient_data = data[patient_id] | |
tests_with_prices = [] | |
for category, tests in TEST_PRICES.items(): | |
for test in patient_data["tests"]: | |
if test in tests: | |
price = tests[test] | |
tests_with_prices.append(f"- {test}: ₹{price}") | |
test_list = "\n".join(tests_with_prices) | |
total_cost = patient_data["total_cost"] | |
billing_info = ( | |
f"Patient ID: {patient_id}\n" | |
f"Patient: {patient_data['name']}\n" | |
f"Phone Number: {patient_data['phone']}\n" | |
f"Tests:\n{test_list}\n" | |
f"Total Bill: ₹{total_cost}" | |
) | |
return billing_info | |