Print Patient Name on Impress

Hi,

Is there a way to print the patient’s name, Patient ID, Date of Birth and sex on the impress?

Thanks

I presume you mean the COA when you say Impress. You will need to develop a senaite addon and create your own custom COA. This tells you how to go about: GitHub - senaite/senaite.impress: HTML to PDF Rendering Engine for SENAITE

Once you have your own template and view, you can create a method in the view to provide any patient data you require which will be called from inside the template where you can use that data.

1 Like

Hi Mike,
Thanks for your reply. I have tried like that:

I have created a method at …/bika/lims/content/client.py

from Products.Archetypes.public import *
from Products.ATContentTypes.content import schemata
from Products.ATContentTypes.content import folder

class Patient(folder.ATFolder):
    schema = schemata.ATContentTypeSchema.copy() + Schema((
        StringField('patient_id',
            required=True,
            searchable=True,
            widget=StringWidget(
                label='Patient ID',
                description='Enter the patient ID',
            ),
        ),
        StringField('first_name',
            required=True,
            searchable=True,
            widget=StringWidget(
                label='First Name',
                description='Enter the patient\'s first name',
            ),
        ),
        StringField('middle_name',
            searchable=True,
            widget=StringWidget(
                label='Middle Name',
                description='Enter the patient\'s middle name',
            ),
        ),
        StringField('last_name',
            required=True,
            searchable=True,
            widget=StringWidget(
                label='Last Name',
                description='Enter the patient\'s last name',
            ),
        ),
        StringField('sex',
            required=True,
            searchable=True,
            widget=SelectionWidget(
                label='Sex',
                description='Select the patient\'s sex',
                vocabulary=[
                    ('male', 'Male'),
                    ('female', 'Female'),
                    ('other', 'Other'),
                ],
            ),
        ),
        DateField('date_of_birth',
            required=True,
            searchable=True,
            widget=CalendarWidget(
                label='Date of Birth',
                description='Select the patient\'s date of birth',
            ),
        ),
    ))

    def get_full_name(self):
        # Create the full name from first name, middle name, and last name
        parts = [self.getField('first_name').get(self), self.getField('middle_name').get(self), self.getField('last_name').get(self)]
        return " ".join(filter(None, parts))

Then I have modified the COA report template Default.pt to display the patient’s name by adding the following code:

<tr>
    <td>Patient Name:</td>
    <td tal:content="client/first_name"></td>
</tr>

I could not be successful. Can you correct me? Thanks