I have created a program for ‘Antenatal Care’ and i only want female patients to be enrolled to that program. I restrain from use adding a where statement to sqlSearch global property since it will restrict male patients from all programs. What is the best way to restrict enrolling a male patient to the program.
Within that program i want to set the start date attribute default to today. And i have added two other attributes lmp and edd which are both dates. I want to restrict setting lmp only to past dates then after lmp is set i want to restrict selection for edd dates 280 days before the date of lmp. edd can only be set 280 days after the date of lmp.
AFAIK There is no way in Bahmni to prevent a male patient from being enrolled in a program, but you should be able to change the Patient List screen (tab) to show only female patients while searching. That can possibly help ensure that only female patients (Gender=F) are selected while enrolling. You can read more about how to configure search result criteria here: Configure Patient List queues. Please note, the patient list screen is shared across Clinical / Programs tab, so ensure while adding/modifying TAB you test accordingly. You can also introduce a privilege (e.g hasProgramsAccess) to ensure in Programs section only this TAB is visible, and maybe others are hidden.
I am not sure I understand your requirement. Can you explain where the new attributes (lmp and edd) are added and where do you intend to show them?
Okay. i added the code in $scope.enrollPatient event on
openmrs-module-bahmniapps/ui/app/common/uicontrols/programmanagement/controllers/manageProgramController.js. I think you can implement a way to validate it on the bahmni config
Glad to know this worked for you. Please note than whenever you update your Bahmni version later, the UI code base will also upgrade. So, you will need to make the same change in new Bahmni code file, as this is not a configuration change. But does seem like a small enough change, for the given requirement.