Best approach for having Patient ID card in OpenMRS 2x and RefApp 2x

Can you add this to the module wiki documentation?

A ticket (https://issues.openmrs.org/browse/REPORT-800) is created for following URL encoding issue : Best approach for having Patient ID card in OpenMRS 2x and RefApp 2x

@dkayiwa

In attached screenshot, the ID Card report privilege is set as “App:xreports.run” but I do not have a privilege with same name. Also except admin user, other users can not see and print the report from patient dashboard.

Are you asking a question or just reporting your findings? :smile:

My intention was to ask the question :wink: but you found it as report. fortunately i solved it.

  • I have created a new Privilege as “Print ID Card”
  • Then I give “Print ID Card” privilege to specific role
  • then I changed “regquiredPrivilege”:“Print ID Card” for my report.

finally users of specific role can print the ID Card. :slight_smile:

Oh excellent! :slight_smile:

I have been asked how i printed the ID Card in OpenMRS. here are the steps:

  1. Setup the OpenMRS with default modules

  2. Add XReports Module

  3. Administration/ Data Set Definitions/SQL Dataset -

  • Add a new data set under name “Patient ID Card” and copy paste the SQL Query

SELECT GROUP_CONCAT(patient_identifier.identifier SEPARATOR ‘,’) as reg_nos, (SELECT identifier FROM patient_identifier WHERE patient_identifier.patient_id = person.person_id AND identifier_type=1 AND voided=0 AND preferred=1) AS identifier1, (SELECT identifier FROM patient_identifier WHERE patient_identifier.patient_id = person.person_id AND identifier_type=2 AND voided=0 AND preferred=1) AS identifier2, (SELECT identifier FROM patient_identifier WHERE patient_identifier.patient_id = person.person_id AND identifier_type=3 AND voided=0 AND preferred=1) AS identifier3, DATE(person.date_created) AS register_date, given_name, family_name, CONCAT(family_name, ', ', given_name) AS fullname, birthdate, gender, (select person_attribute.value from person_attribute where person_attribute_type_id=11 and person_attribute.person_id=person.person_id ) AS fathername, (select person_attribute.value from person_attribute where person_attribute_type_id=4 and person_attribute.person_id=person.person_id ) AS mothername, (select CONCAT(person_address.address1, ', ', person_address.address2 , ', ', person_address.city_village, ', ', person_address.state_province, ', ', person_address.country) From person_address where person_address.person_id=person.person_id) as address FROM person, person_name, patient_identifier WHERE person.person_id = :patientId AND person.person_id=person_name.person_id AND person.person_id=patient_identifier.patient_id AND person.voided=0 AND person_name.voided=0 AND patient_identifier.voided=0 AND person_name.preferred=1 AND patient_identifier.preferred=1 AND patient_identifier.identifier_type=3 LIMIT 1;

  • Add parameter as Name: patientId, Type: Patient
  1. Administration/Report Administration/Custom Report (Advanced)/Create New Report -
  • Name: Patient ID Card
  • Add Parameters - Name: patientId , Type: Patient
  • add New Dataset Definition - DataSetDefinition: Patient ID Card. patientId: Parameter: Patient ID
  • add Output Designs - select and add XReport
  1. XReports/Manage Reports/New Report
  • Name: Patient ID Card, Source: Patient ID Card, Extension:
  1. Design the report template by clicking the design button - here you can find a sample ID Card design (https://raw.githubusercontent.com/hpardess/OpenMRS-NRH/master/Reports/Patient%20ID%20Card.xml). It is better to download it and open it in XReport Designer through File>Open menu item

Thanks @hpardess for sharing your solution. Can you share some screenshots of how your ID cards look like?

Please, can you check this SQL query and provide it in a pastable manner. I need the same information on my ID card. I have errors when I post this sql on MYSQL . Many thanks

MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '‘,’), (SELECT identifier FROM patient_identifier WHERE patient_identifier.pa' at line 1

Can you get some time and i walk you through this on a call? On condition that you will pay back by updating the wiki documentation. :grinning: