fdbregistrovani=""" select rodcis from registr join kar on registr.idpac=kar.idpac where kar.vyrazen!='A' and kar.rodcis is not null and idicp!=0 and datum_zruseni is null""" from Functions import get_medicus_connection,get_mysql_connection medicus_registrovani=[] fdbcon=get_medicus_connection() if fdbcon: cur=fdbcon.cursor() cur.execute(fdbregistrovani) for row in cur.fetchall(): medicus_registrovani.append(row[0]) print(medicus_registrovani) print(len(medicus_registrovani)) mysqlcon=get_mysql_connection() sql="""SELECT rc FROM `vzp_registrace` where icz=09305000""" mysql_registrovani=[] sqlcur=mysqlcon.cursor() sqlcur.execute(sql) for row in sqlcur.fetchall(): mysql_registrovani.append(row[0]) print(mysql_registrovani) # extra_in_a = [x for x in a if x not in b] # extra_in_b = [x for x in b if x not in a] #Kdo je registrovany v Medicus, ale neni opravdu registrovany v ambulanci? print("Toto jsou pacienti registrovaní v medicus ale nejsou registrovaní na webu") print(len([x for x in medicus_registrovani if x not in mysql_registrovani])) mysql_pojisteni=[] sql="""SELECT rc FROM `vzp_stav_pojisteni` where stav=1""" sqlcur.execute(sql) for row in sqlcur.fetchall(): mysql_pojisteni.append(row[0]) # print(mysql_pojisteni) # #Kdo je registrovany v Medicus, ale neni pojisteny (zemrel a tak)? # print("Toto jsou pacienti registrovaní v medicus ale nejsou pojisteni na webu") # print(len([x for x in medicus_registrovani if x not in mysql_pojisteni])) # mysql_set = set(mysql_pojisteni) # print(*[x for x in medicus_registrovani if x not in mysql_set], sep="\n")