Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1879 มุมมอง

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)


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
5
ต.ค. 24
32826
1
ก.ค. 23
7490
2
ก.ค. 22
11642
2
ต.ค. 21
3435
0
ส.ค. 21
2151