Bala.
I’m not quite sure I fully understand what you are after, but if you need to send a file of all admitted patients, then you’ll need to store this information someway – sqllite?
If you receive an admission, add a patient.
If you receive a discharge, remove the patient.
If you receive a cancel discharge, add the patient.
If you receive a cancel admission, remove the patient.
you’ll probably need to coordinate a ‘point-in-time’ load of all admitted patients.
Does this help?