neerajkalyank commited on
Commit
dbaff95
1 Parent(s): d19864a

Update billing.py

Browse files
Files changed (1) hide show
  1. billing.py +19 -2
billing.py CHANGED
@@ -1,8 +1,25 @@
 
 
1
  def fetch_billing(patient_id, data):
2
  if patient_id not in data:
3
  return "Invalid Patient ID. Please check the ID."
4
 
5
  patient_data = data[patient_id]
6
- test_list = ', '.join(patient_data["tests"])
 
 
 
 
 
 
 
 
 
7
  total_cost = patient_data["total_cost"]
8
- return f"Patient: {patient_data['name']}\nTests: {test_list}\nTotal Bill: ₹{total_cost}"
 
 
 
 
 
 
 
1
+ from test_selection import TEST_PRICES # Make sure TEST_PRICES is accessible
2
+
3
  def fetch_billing(patient_id, data):
4
  if patient_id not in data:
5
  return "Invalid Patient ID. Please check the ID."
6
 
7
  patient_data = data[patient_id]
8
+ tests_with_prices = []
9
+
10
+ # Loop through the tests and get their prices from TEST_PRICES
11
+ for category, tests in TEST_PRICES.items():
12
+ for test in patient_data["tests"]:
13
+ if test in tests:
14
+ price = tests[test]
15
+ tests_with_prices.append(f"- {test}: ₹{price}")
16
+
17
+ test_list = "\n".join(tests_with_prices) # Join all tests into a list format
18
  total_cost = patient_data["total_cost"]
19
+
20
+ billing_info = (
21
+ f"Patient: {patient_data['name']}\n"
22
+ f"Tests:\n{test_list}\n"
23
+ f"Total Bill: ₹{total_cost}"
24
+ )
25
+ return billing_info