File size: 721 Bytes
494486d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Define costs for tests in each category
TEST_PRICES = {
    "Hematology": {"CBC": 200, "ESR": 100},
    "Biochemistry": {"LFT": 300, "KFT": 400}
}

def select_tests(patient_id, categories, selected_tests, data):
    if patient_id not in data:
        return "Invalid Patient ID. Please register the patient first."

    total_cost = 0
    for category in categories:
        for test in selected_tests:
            if test in TEST_PRICES.get(category, {}):
                total_cost += TEST_PRICES[category][test]
                data[patient_id]["tests"].append(test)
                
    data[patient_id]["total_cost"] = total_cost
    return f"Tests Selected: {', '.join(selected_tests)}. Total Cost: {total_cost}"