Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1741 Widoki

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)


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
5
paź 24
32360
1
lip 23
7058
2
lip 22
11294
2
paź 21
3121
0
sie 21
1926