File size: 2,095 Bytes
494486d
 
787094b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494486d
 
787094b
 
 
 
 
 
 
 
 
494486d
 
 
 
787094b
 
 
 
 
 
 
 
 
494486d
787094b
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Define costs for tests in each category
TEST_PRICES = {
    "Haematology": {
        "Haemoglobin estimation": 50,
        "RBC count": 80,
        "Platelet count": 60,
        "ESR": 40
    },
    "Clinical Pathology": {
        "Urine albumin and sugar test": 70,
        "Urine microscopy": 50,
        "Pap smear": 200
    },
    "Biochemistry": {
        "Blood Sugar (Random)": 40,
        "Serum Creatinine": 100,
        "Total Cholesterol": 150,
        "SGPT (ALT)": 120
    },
    "Microbiology": {
        "Throat swab for Diphtheria": 150,
        "Urine culture and sensitivity": 300,
        "Smear examination for Leprosy": 80
    },
    "Specific Diseases": {
        "Malaria antigen test": 100,
        "Dengue NS1 antigen test": 500,
        "Tuberculosis sputum test": 200
    },
    "Serology": {
        "Rheumatoid Factor (RF) quantitative": 150,
        "Anti-Streptolysin O (ASO) titre": 200
    },
    "Radiology": {
        "Chest X-ray": 500,
        "ECG": 300
    },
    "Other Diagnostic Tests": {
        "Visual Inspection with Acetic Acid (VIA)": 50,
        "Water quality testing (for H2S)": 100
    }
}

def get_tests_by_category(categories):
    available_tests = []
    for category in categories:
        if category in TEST_PRICES:
            for test, cost in TEST_PRICES[category].items():
                available_tests.append(f"{test} - ₹{cost}")
    return available_tests

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

    total_cost = 0
    tests_selected = []
    for item in selected_tests:
        test_name = item.split(" - ")[0]  # Extract the test name
        for category, tests in TEST_PRICES.items():
            if test_name in tests:
                total_cost += tests[test_name]
                tests_selected.append(test_name)
    
    data[patient_id]["tests"] = tests_selected
    data[patient_id]["total_cost"] = total_cost
    return f"Tests Selected: {', '.join(tests_selected)}. Total Cost: ₹{total_cost}"