How to print an encounter details? - OpenMRS 2x and RefApp 2x

My main purpose is to be able list types of encounters in XReport JSON (in Extension value) and a print button should appear for those encounters. When I click on print button then encounterID and PatientID should be send as parameter to the report.

Without a mockup, i cant really be sure of what is in your mind. :smile:

I want to print Visit Note and Transfer encounters separately. when a patient visits a doctor then end of the visit i should take print out of his visit note and attach it to his physical file. or when patient is transferred to another ward, I should take print out of his transfer encounter and give him to show in another ward to be admitted.

Even if a patient ask for his Visit Note of his old visit then we should be able to print it for patient. Here are the screenshots:

Ticket is created for this. here is the link https://issues.openmrs.org/browse/XREP-2

I am thinking for an alternative way to have print button for the encounter. As much I learned, I should customize all forms such as discharge, vitals, clinical note. Then add print button inside each form like following screenshot,

<a target="_blank" href="" style="float: right">Print</a>

I will set the href value as report URL but this href should be created dynamically http://qa-refapp.openmrs.org/xreports/runReports.page?patientId={{patient.patientId}}&reportId=5$encounterId={{encounter.id}}

how can i set the encounterId, patientId and visitId ?

This is what I was asking for

Currently, I have hard-coded the xreport URL for each encounter type in Coreapps Module.

In future, we can set this report URL in Form Management for each form. Also we should be able to set the print right based on encounter type.

@dkayiwa: I have designed reports that need two parameters 1. Encounter ID 2. Patient ID In your old post, you have mentioned that parameters should be passed as in URL Query string. I am also doing same but the report is not printed.

/openmrs/xreports/reportRunner.page?reportId=3&groupId=3&patientId=7&encounterId=3

but I try to print the report from Home>XReports>Run Reports and entered encounterId and patientId, the report is printed correctly. but the patientId and encouterId are not listed in URL Query string.

/openmrs/xreports/reportRunner.page?reportId=3&groupId=3

@dkayiwa:I have extended the RefApp and I display the print button for each encounter with specific report URL.

But the report printed empty while i press the print button. Although i have all the required parameters in URL

Does this report have a reporting module dataset behind it?

Yeah i have. Here is the screen shots when i run it from Home>XReports>Run Reports

The patientId in XReports is hard-coded. Are we going to do same for all parameters?

@dkayiwa: I feel this is the right controller that would handle the request for a report with paramenters

but I is called only on submit action and then redirect the page to show the report.

Better option will be to create different controller which will get parameters in URL Query string and send those parameters to onSubmit() controller to avoid duplication of code.

Are you able to reproduce this at? qa-refapp.openmrs.org

The demo server returns 400 (Bad Request) response while i am trying to add parameters in Data Set Definitions.

Currently the XRepors get the report parameters through following POST request

http://localhost/openmrs/module/xreports/fillParameter.form?reportId=6bc489c6-c1ad-4c89-acb2-fde40edcfe66&formId=3

Then redirect the page to following URL

http://localhost:9999/openmrs/xreports/reportRunner.page?reportId=3&groupId=3

Could you please make it possible pass the parameters through GET request to report? like

http://localhost/openmrs/module/xreports/fillParameter.form?reportId=3&formId=3&patientId=7&encounterId=3

or

http://localhost:9999/openmrs/xreports/reportRunner.page?reportId=3&groupId=3&patientId=7&encounterId=3

Can you create a ticket and then link this thread to it?

Here I have created the ticket for mentioned task: https://issues.openmrs.org/browse/XREP-3

Hey Can I work on this issue ? is this available ?

thanks

@dkayiwa: Any progress regarding (https://issues.openmrs.org/browse/XREP-3) issue?

Feel free to take it up.