Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1762 Prikazi

I have a list of vaccines e.g Covid, Cholera, etc, the patient's name, and the dose. A patient can have Cholera dose 1,2,3 now and in future dose 1,2.

Now, how can I show just the first name (John) of the patient in a given vaccine using python?

This is the data I have:

Vaccine      patient_name     dose

Cholera      John             1
             John             2
             John             3
             John             1
             John             2

Covid        John             1
             John             2
             John             2

Here's my Code. Any assistance will be greatly appreciated.

@api.multi
def print_report(self):
   data = {
       'sizes': [],
     }

p_list = self.env['med.vaccines'].search([])
patient_list = []
for i in p_list:
     if i.vaccine not in patient_list and i.patient not in patient_list:
        data['sizes'].append({
            'patient': i.patient,
            'vaccine': i.vaccine,
             'dose': i.dose                                
             })
             patient_list.append(i.vaccine and i.patient)
      else:
           data['sizes'].append({
              'patient': '',
               'vaccine': '',
               'dose': '', 
       })   
    return self.env.ref('med_vaccines.report_patient').report_action(self, data=data)


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
5
okt. 24
32544
1
jul. 23
7205
2
jul. 22
11429
2
okt. 21
3229
0
avg. 21
1990