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

Pseudo Code

Uploaded by

Abreham Kassa
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Pseudo Code

Uploaded by

Abreham Kassa
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Program Start

Define a Structure Patient_Information

Define a Structure Medical_History

End Structure

Define Constants

MAX_PATIENTS = Maximum number of patients the system can handle

Declare an Array PatientRecords of PatientRecords with size MAX_PATIENTS

Declare an Integer numPatients and set it to 0

Function createRecord()

If numPatients < MAX_PATIENTS Then

Prompt user for patient information:

Create a new Patient_Record with the entered information

Add the new record to PatientRecords at index numPatients

Increment numPatients

Display "Patient record created successfully."

Else

Display "Maximum number of patients reached."

End Function

Function displayRecord(patientId)

For each record in PatientRecords

If patientId matches the record's patient_id Then

Display the patient's information

If patientId is not found in any records

Display "Patient ID not found."

End Function
Function searchRecord()

For each record in PatientRecords

If patientId matches the record's patient_id Then

Display the patient's information

If patientId is not found in any records

Display "Patient ID not found."

End Function

Function editRecord()

For each record in PatientRecords

If patientId matches the record's patient_id Then

Prompt user to choose which information to edit

If the user selects an option:

Prompt user for the new value and update the corresponding field in the
record

Display "Patient information updated successfully

If patientId is not found in any records

Display "Patient ID not found."

End Function

Function deleteRecord(patientId)

For each record in PatientRecords

If patientId matches the record's patient_id Then

Remove the record from PatientRecords

Display "Patient record with ID {patientId} deleted successfully."

If patientId is not found in any records

Display "Patient ID not found. No record deleted."

End Function

Function saveRecordsToFile()
Open a file for writing (e.g., "medical_records.txt")

For each record in PatientRecords

Write the patient's information to the file

Close the file

Display "Patient records saved to file."

End Function

Function main()

Initialize variables and data structures

Display program welcome message

Repeat until the user chooses to exit:

Display a menu with options:

Prompt the user for their choice

If the user chooses option 1:

Call createRecord()

Else if the user chooses option 2:

Prompt user for patient ID and call addDiagnosis()

Else if the user chooses option 3:

Prompt user for patient ID and call displayRecord()

Else if the user chooses option 4:

Prompt user for patient ID and call searchRecord()

Else if the user chooses option 5:

Prompt user for patient ID and call editRecord()

Else if the user chooses option 6:

Prompt user for patient ID and call deleteRecord()

Else if the user chooses option 7:

Call saveRecordsToFile()
Else if the user chooses option 8:

Exit the program

Display program closing message

End Function

Program End

You might also like