0% found this document useful (0 votes)
18 views

Class Patient

This Python code defines a Patient class with attributes like ID, name, age etc. and initializes an empty patients list. It provides options to add a new patient, add monitoring data for an existing patient and view a patient report. The main loop displays a menu and calls the respective functions based on user input to manage patient records.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Class Patient

This Python code defines a Patient class with attributes like ID, name, age etc. and initializes an empty patients list. It provides options to add a new patient, add monitoring data for an existing patient and view a patient report. The main loop displays a menu and calls the respective functions based on user input to manage patient records.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

class Patient:

def __init__(self):
self.id = 0
self.name = ""
self.age = 0
self.gender = ""
self.disease = ""
# Additional monitoring fields
self.temperature = 0.0
self.blood_pressure = 0
# Add more monitoring fields as needed

patients = []
patient_count = 0

def add_patient():
new_patient = Patient()

new_patient.id = int(input("Enter patient id: "))


new_patient.name = input("Enter patient name: ")
new_patient.age = int(input("Enter patient age: "))
new_patient.gender = input("Enter patient gender (M/F): ")
new_patient.disease = input("Enter patient disease: ")

# Initialize monitoring fields


new_patient.temperature = 0.0
new_patient.blood_pressure = 0
# Initialize other monitoring fields as needed

patients.append(new_patient)
global patient_count
patient_count += 1

print("Patient added successfully.")

def add_monitoring_data():
if patient_count == 0:
print("No patients found.")
return

search_id = int(input("Enter patient ID to add monitoring data: "))

for patient in patients:


if patient.id == search_id:
patient.temperature = float(input("Enter patient temperature: "))
patient.blood_pressure = int(input("Enter patient blood pressure: "))
# Enter other monitoring data as needed

print("Monitoring data added successfully.")


return

print("No patient found with the provided ID.")

def view_patient_report(patient):
print("Patient Report:")
print("ID:", patient.id)
print("Name:", patient.name)
print("Age:", patient.age)
print("Gender:", patient.gender)
print("Disease:", patient.disease)
print("Temperature:", patient.temperature)
print("Blood Pressure:", patient.blood_pressure)
# Display other monitoring data as needed

while True:
print("\n--- Patient Management System ---")
print("1. Add Patient")
print("2. Add Monitoring Data")
print("3. View Patient Report")
print("4. Exit")

choice = int(input("Enter your choice (1-4): "))

if choice == 1:
add_patient()
elif choice == 2:
add_monitoring_data()
elif choice == 3:
if patient_count == 0:
print("No patients found.")
else:
search_id = int(input("Enter patient ID to view report: "))
for patient in patients:
if patient.id == search_id:
view_patient_report(patient)
break
else:
print("No patient found with the provided ID.")
elif choice == 4:
print("Exiting the program.")
break
else:
print("Invalid choice. Please enter a number from 1 to 4.")

enhance this program or add some more unique codes to this program

You might also like