Single encounter per visit

I want to only fill one encounter per visit at a time, for example, if I have filled admissions form for the current active visit, it should NOT be available again for the same visit, unless it is a new visit. Something like that form should be ejected out of the available forms to be filled for that visit, Only those that haven’t been filled should be on the list. This is regard to reference application. @darius @dkayiwa @raff

Which form listing interface are you using? This one? http://uat02.openmrs.org:8080/openmrs/xforms/formentry/patient.page?patientId=60ebfc38-9d30-4c35-a40d-f3c720627d61

On a side note, what is the real use case? Do you mind giving it some more detail?

All my forms have been designed using HFE module. A use case is, on refApp POC, I want to only fill one form of any kind per visit. that to say, there should be no instance where a single form will be filled more than once per visit.

@ningosi The first thought would be to use the disallowMultipleEncountersOnDate for the encounterDate HTML Form Entry tag but this does not work any ideas @mogoodrich @mseaton? https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+HTML+Reference#HTMLFormEntryModuleHTMLReference-

However you try to use Javascript, to have checks once per visit, here is the code that we use to ensure that a form is entered only once per encounter type https://github.com/METS-Programme/openmrs-module-aijar/blob/1b43becc4521ec8a2fb92010285e065675c217f1/omod/src/main/webapp/resources/htmlforms/122a-HIVCare_ARTCard-SummaryPage.xml#L2359-L2370

Thanks. I tried disallowMultipleEncountersOnDate but never worked for me either. I will try your approach

You may want to consider designing this restriction based on form ID or form type, since you will later discover forms that should be able to repeat during a visit.

When you use the disallowMultipleEncoutnersOnDate attribute, can you check if there are any errors in the underlying Javascript by checking the console log? I don’t think this function is often used, so it’s possible it broke a while back and the bug was unnoticed/unreported. It’s possible it could be something straightforward to fix.

Take care, Mark

@ningosi, btw, the “right” way to do this would be to make a change in the reference application code so that those links are controlled by whether encounters of the given type have been entered so far.

Are you interested in making this change to the core refapp code?

I am interested. @ssmusoke can we have this as one of the hackthon item during our implementer’s meeting in Uganda?

@ningosi can you create a ticket and share it here for me to track it

Hello Mark @mogoodrich , yes when we use the disallowMultipleEncoutnersOnDate we get errors of Js and it doesn’t let you choose the date : Line 565 : var date = jq(item).val(); function : function existingEncounterOnDate(item, instruction){ error : Uncaught ReferenceError: jq is not defined
Log : Uncaught ReferenceError: jq is not defined at existingEncounterOnDate (htmlFormEntry.js?v=1.11.6:565) at HTMLInputElement.onchange (htmlFormEntry.form?personId=365&patientId=365&returnUrl=&formId=99:744) at Object.trigger (jquery-1.8.3.min.js?v=1.11.6:2) at HTMLInputElement. (jquery-1.8.3.min.js?v=1.11.6:2) at Function.each (jquery-1.8.3.min.js?v=1.11.6:2) at init.each (jquery-1.8.3.min.js?v=1.11.6:2) at init.trigger (jquery-1.8.3.min.js?v=1.11.6:2) at init.v.fn. [as change] (jquery-1.8.3.min.js?v=1.11.6:2) at HTMLInputElement.onSelect (htmlFormEntry.js?v=1.11.6:628) at Datepicker._selectDate (jquery-ui-1.9.2.custom.min.js?v=1.11.6:6)