Spaces:
Running
Running
# 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}" | |