File size: 953 Bytes
dbaff95
 
f8e4f5e
 
 
 
 
dbaff95
 
 
 
 
 
 
 
 
 
f8e4f5e
dbaff95
 
36eef5c
dbaff95
36eef5c
dbaff95
 
 
 
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
from test_selection import TEST_PRICES  # Make sure TEST_PRICES is accessible

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 = []
    
    # Loop through the tests and get their prices from TEST_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)  # Join all tests into a list format
    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