FORUM PER UTENTI MILLEWIN
Attenzione !
Per intervenire sul forum è necessario essere registrati e connessi.

L'Amministratore

****************************************************
“Se tu hai una mela ed io ho una mela, e ce la scambiamo, alla fine tu ed io avremo sempre una mela ciascuno.
Ma se tu hai un’idea ed io ho un’idea, e ce la scambiamo, allora avremo entrambi due idee”.

George Bernard Shaw
****************************************************

Unisciti al forum, è facile e veloce

FORUM PER UTENTI MILLEWIN
Attenzione !
Per intervenire sul forum è necessario essere registrati e connessi.

L'Amministratore

****************************************************
“Se tu hai una mela ed io ho una mela, e ce la scambiamo, alla fine tu ed io avremo sempre una mela ciascuno.
Ma se tu hai un’idea ed io ho un’idea, e ce la scambiamo, allora avremo entrambi due idee”.

George Bernard Shaw
****************************************************
FORUM PER UTENTI MILLEWIN
Vuoi reagire a questo messaggio? Crea un account in pochi click o accedi per continuare.

frequenza cardiaca

3 partecipanti

Andare in basso

frequenza cardiaca Empty frequenza cardiaca

Messaggio  nanci giacinto Lun 14 Lug 2014 - 23:03

BUONA SERA A questa query dovrei aggiungere l'estrazione della frequenza cardiaca 


select distinct p.nome nome, p.cognome cognome, n.pa_uslcode cod_reg,
v.codmedico codice_medico,
days(p.nascita, today())/365 eta, p.sesso sesso,
today() data_odierna,
 
 
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '401%'  or a.cp_code like '405%') and a.data_open between today()-365 and today())  ___INCID_12mesi_ipertens___,
 
 
 
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '272%')
___dislipidemia____,
 
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '250%')
__diabete__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '250%' and a.data_open between today()-365 and today())  ___INCID_12mesi_diab___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '414%')
___CARD_ISCH___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '414%' and a.data_open between today()-365 and today())  ___INCID_12mesi_CARD_ISCH___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and  a.cp_code like '413%' )
____angina_pect___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '413%' and a.data_open between today()-365 and today())  ___INCID_12mesi_angina___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '410%' or a.cp_code like '412%'))
__infarto_mioc__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '410%'  or a.cp_code like '412%') and a.data_open between today()-365 and today())  ___INCID_12mesi_infarto___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '435.%')
___TIA__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '435.9%' and a.data_open between today()-365 and today())  ___INCID_12mesi_TIA___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '411%')
__SINDR_cORON__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '411%' and a.data_open between today()-365 and today())  ___INCID_12mesi_SINDR_cORON___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '436%')
__stroke___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '436%' and a.data_open between today()-365 and today())  ___INCID_12mesi_stroke___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '433.9%')
__claud_intermitt___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '433.9%' and a.data_open between today()-365 and today())  ___INCID_12mesi_claudi___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '414.5%' or a.cp_code like 'V45.81%' or a.cp_code like 'V45.82%' or a.cp_code like 'V45.89%'))
__rivascolarizz___,
 
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '414.5%'  or a.cp_code like 'V45.81%'  or a.cp_code like 'V45.82%' or a.cp_code like 'V45.89%') and a.data_open
between today()-365 and today())  ___INCID_12mesi_Vascolarizz___,
 
 
(select a.ac_val from cart_accert a
where a.codice=p.codice
and (a.ac_des like '%creatinina%' and a.ac_des not like '%clearance%creatinina%') and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and (b.ac_des like '%creatinina%'
and b.ac_des not like '%clearance%creatinina%') and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today() ) ______creatinina_ultima15mesi______,
 
 
 
 
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%colesterolo%totale%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and b.ac_des like '%colesterolo%totale%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today()) ______colest_tot_ultimo15mesi______,
 
 
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%trigliceridi%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and b.ac_des like '%trigliceridi%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today()) ______trigliceridi_ultimo15mesi______,
 
(select count(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%HDL%' and
a.data_open between today()-1095 and today()
and a.ac_val is not null group by a.codice) ______N_HDL_3anni______,
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%HDL%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and b.ac_des like '%HDL%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today())  ______HDL_ultimo15mesi______,
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%LDL%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and b.ac_des like '%LDL%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today())  LDL_ultimo15mesi,
 
(select count(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%urine%esame%completo%' and
a.data_open between today()-1095 and today() group by a.codice) ______N_urine_3anni______,
 
(select count(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%potassio%' and
a.data_open between today()-1095 and today()
and a.ac_val is not null group by a.codice) ______N_potassio_3anni______,
 
 
 
 
 
(select avg(a.ac_val) from cart_accert a
where a.codice=p.codice
and (a.ac_des like '%glicemia%' and a.ac_des not like '%glicemia%post%prandiale%'
and a.ac_des not like '%ultima%misurazione%glicemia%') and
a.data_open between today()-1095 and today()
and a.ac_val is not null group by a.codice) ______media_glicemia_3anni______,
 
(select a.ac_val from cart_accert a
where a.codice=p.codice
and (a.ac_des like '%glicemia%' and a.ac_des not like '%glicemia%post%prandiale%'  
and a.ac_des not like '%ultima%misurazione%glicemia%') and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and (b.ac_des like '%glicemia%' and b.ac_des not like '%glicemia%post%prandiale%' and a.ac_des not like '%ultima%misurazione%glicemia%') and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today() ) ______glicemia_ultima15mesi______,
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%microalbuminuria%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and b.ac_des like '%microalbuminuria%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today())  ______microalb_ultimi15mesi______,
 
 
(select count(a.ac_val) from cart_accert a where a.codice=p.codice
and (a.ac_des like '%ECG%'
or a.ac_des like '%v.cardiologica%')
and a.data_open between today()-1095 and today() group by a.codice) ___N_ECG_3anni____,
 
(select count(a.ac_val) from cart_accert a where a.codice=p.codice
and (a.ac_des like '%ECODOPPLER%TRONCHI%SOVRAORTICI%'
or a.ac_des like '%ECOCOLORDOPPLER%CARDIACA%'  or a.ac_des like '%ECO%CARDIACA%')
and a.data_open between today()-1095 and today() group by a.codice) ___N_ECOCARD_TSA_3anni____,
 
 
(select avg(a.p_max) from cart_press a where a.codice=p.codice and
a.data_open between today()-455 and today()
and a.p_max is not null group by a.codice) ______media_p_max_15mesi______,
(select avg(a.p_min) from cart_press a where a.codice=p.codice and
a.data_open between today()-455 and today()
and a.p_min is not null group by a.codice) ______media_p_min_15mesi______,
(select a.p_max from cart_press a
where a.codice=p.codice
and not exists (select b.codice from cart_press b where a.codice=b.codice and 
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and a.p_max is not null)
and a.data_open between today()-180 and today())  ______p_max_ultima_6mesi______,
(select a.p_min from cart_press a
where a.codice=p.codice
and not exists (select b.codice from cart_press b where a.codice=b.codice and 
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and a.p_min is not null)
and a.data_open between today()-180 and today())  ______p_min_ultima_6mesi______,
 
 
 
(select avg(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des like '%bmi%' and
a.data_open between today()-1095 and today() 
and a.ac_val is not null group by a.codice) ______media_bmi_3anni______,
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%bmi%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice and b.ac_des like '%bmi%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-455 and today() ) ______bmi_val_ultimo_15mesi______,
 
(select count(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%rischio%cardio%vascolare%who/ish%' and
a.data_open between today()-1825 and today() 
and a.ac_val is not null group by a.codice) ______N_RCVwhoish_5anni______,
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%rischio%cardio%vascolare%who/ish%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice
and b.ac_des like '%rischio%cardio%vascolare%who/ish%'  and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-1825 and today()) ______rcviwho_ultimo_5anni______,
 
(select count(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%rischio%cardio%vascolare%(ISS)%' and
a.data_open between today()-1825 and today() 
and a.ac_val is not null group by a.codice) ______N_RCV_ISS_5anni______,
 
(select a.ac_val from cart_accert a
where a.codice=p.codice and a.ac_des like '%rischio%cardio%vascolare%(ISS)%'
and (a.ac_val is not null)
and not exists (select b.codice from cart_accert b where a.codice=b.codice
and b.ac_des like '%rischio%cardio%vascolare%(ISS)%' and
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and b.ac_val is not null)
and a.data_open between today()-1825 and today())  ______rcviss_ultimo_5anni______,
 
(select distinct 'SI' from cart_accert a
where a.codice=p.codice and a.ac_des like 'fumo'
and (a.ac_val like 'p' or a.ac_val
like 's' or a.ac_val like '1' or a.ac_val like '2' or a.ac_val like '3')) ____fumoSI____,
(select distinct 'EX' from cart_accert a
where a.codice=p.codice and a.ac_des like 'fumo'
and (a.ac_val like 'm' or a.ac_val like 'z'
or a.ac_val like 'e' or a.ac_val like 'f' or a.ac_val like 'u')) ____fumoEX____,
(select distinct 'NO' from cart_accert a
where a.codice=p.codice and a.ac_des like 'fumo'
and (a.ac_val like 'x' or a.ac_val like 'n')) ____fumoNO____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c03%'
and
a.data_open between today()-365 and today()) ____diuret____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c07A%'
and
a.data_open between today()-365 and today()) ____betablocc____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'C02CA%'
and
a.data_open between today()-365 and today()) ____alfablocc____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c07cb%'
and
a.data_open between today()-365 and today()) ____Betablcc_diu____,
(select distinct 'si'from cart_terap a
where a.codice=p.codice and a.co_atc like 'c08%'
and
a.data_open between today()-365 and today()) ____Ca_antag____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c09a%'
and
a.data_open between today()-365 and today()) ____ACE____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c09b%'
and
a.data_open between today()-365 and today()) ____ACE_diur____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c09c%'
and
a.data_open between today()-365 and today()) ____sartani____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c09da%'
and
a.data_open between today()-365 and today()) ____Sartani_diur____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'c02ac01%'
and
a.data_open between today()-365 and today()) ____clonidina____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like 'b01ac%'
and
a.data_open between today()-365 and today()) ____ASA_ticlop____,
(select distinct 'si' from cart_terap a
where a.codice=p.codice and a.co_atc like '%c10aa%'
and a.data_open between today()-365 and today()) ____statine____,
(select count(a.codice) from cart_visite a
where a.codice=p.codice
and a.data_open between today()-365 and today() group by a.codice) N_accessi_MMG_anno,
 
 
(select count(a.codice) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%ricov.%'
and a.data_open between today()-365 and today() group by a.codice)  ____N_ric_12_mesi____,
 
(select count(a.ac_val) from cart_accert a
where a.codice=p.codice and a.ac_des
like '%ricov.%' and
a.data_open between today()-1885 and today()
and a.ac_val is not null group by a.codice) ____N_ricov_5anni______
 
from pazienti p , nos_002 n, cart_pazpbl c, v_pazienti v
where p.codice=n.codice
and c.codice=n.codice
and v.codice=p.codice
and (c.cp_code like '401%' or c.cp_code like '405%')
and n.pa_drevoca is null
and p.decesso is null
and p.pa_convenzione not like 'l'
 
 
 

order by p.cognome, p.nome




HO PROVATO AD AGGIUNGERE QUESTA SUBQUERY MA MI DA RISULTATO ZERO. COME FARE? GRAZIE 


(select a.frequenza from cart_press a
where a.codice=p.codice
and not exists (select b.codice from cart_press b where a.codice=b.codice and 
(b.data_open>a.data_open or (b.data_open=a.data_open and b.rowid>a.rowid))
and a.frequenza is not null)

and a.data_open between today()-180 and today())  ______ferquenza_ultimi_6mesi______,
nanci giacinto
nanci giacinto
Membro Junior
Membro Junior

Messaggi : 128
Punti : 4999
Voti per importanza dei messaggi : -1
Data d'iscrizione : 02.03.11

Torna in alto Andare in basso

frequenza cardiaca Empty Re: frequenza cardiaca

Messaggio  Admin Mar 15 Lug 2014 - 10:38

Prova con questa:

(select a.frequenza from cart_press a
where a.codice=p.codice
and not exists (select b.codice from cart_press b where a.codice=b.codice and 
(b.data_open>a.data_open or b.data_open=a.data_open and b.rowid>a.rowid))
and a.data_open between today()-180 and today())  ______ferquenza_ultimi_6mesi______
Admin
Admin
Admin
Admin

Messaggi : 537
Punti : 5482
Voti per importanza dei messaggi : 89
Data d'iscrizione : 20.02.11
Località : CASERTA

https://utentimillewin.forumattivo.it

Torna in alto Andare in basso

frequenza cardiaca Empty FREQUENZA CARDIACA

Messaggio  nanci giacinto Mar 15 Lug 2014 - 16:14

BUON POMERIGGIO. GRAZIE LA QUERY FUNZIOnA BENISSIMO. DOMANDA: L'ERRORE DELLA MIA SUBQUERY AGGIUNTA STA NELL'ASSENZA DELLA PARENTESI  NEL PUNTO "B.DATA_OPEN" OPPURE ALLA PRESENZA DEL COMANDO "a.frequenza is not null"?, perchè nel primo caso è un errore formale ne secondo è sostanziale. Da qui una ulteriore domanda: ma è possibile che non esiste un manuale con i comandi per il linguaggio SQL -millewin-tabelle, quello del sito millewin  mi pare si riferisse soltanto alle query con le viste e non a quelle con le  tabelle o no? grazie
nanci giacinto
nanci giacinto
Membro Junior
Membro Junior

Messaggi : 128
Punti : 4999
Voti per importanza dei messaggi : -1
Data d'iscrizione : 02.03.11

Torna in alto Andare in basso

frequenza cardiaca Empty frequenza cardiaca

Messaggio  nanci giacinto Mar 15 Lug 2014 - 20:14

BUONA SERA HO APPLICATO LA QUERY ALL'ARCHIVIO DI TULLA LA MIA ASSOCIAZIONE (MEDIASS OTTO MEDICI IN RETE GEOGRAFICA) E IL RISULTATO E' ZERO. COME MAI FUNZIONA CON L'ARCHIVIO DEL SINGOLO MEDICO E NON CON QUELLO DI TUTTA L'ASSOCIAZIONE? NON FUNZIONA SIA LA QUERY BASE CHE QUELLA IMPLEMENTATA CON IL TUO SUGGERIMENTO E L'AGGIUNTA DELLA FREQUENZA CARDIACA. GRAZIE
nanci giacinto
nanci giacinto
Membro Junior
Membro Junior

Messaggi : 128
Punti : 4999
Voti per importanza dei messaggi : -1
Data d'iscrizione : 02.03.11

Torna in alto Andare in basso

frequenza cardiaca Empty Re: frequenza cardiaca

Messaggio  Admin Mar 15 Lug 2014 - 20:52

nanci giacinto ha scritto:BUON POMERIGGIO. GRAZIE LA QUERY FUNZIOnA BENISSIMO. DOMANDA: L'ERRORE DELLA MIA SUBQUERY AGGIUNTA STA NELL'ASSENZA DELLA PARENTESI  NEL PUNTO "B.DATA_OPEN" OPPURE ALLA PRESENZA DEL COMANDO "a.frequenza is not null"?, perchè nel primo caso è un errore formale ne secondo è sostanziale. Da qui una ulteriore domanda: ma è possibile che non esiste un manuale con i comandi per il linguaggio SQL -millewin-tabelle, quello del sito millewin  mi pare si riferisse soltanto alle query con le viste e non a quelle con le  tabelle o no? grazie

il comando "where frequenza is not null" esclude dalla selezione tutti i pazienti a cui nel periodo considerato non è stato mai inserito un valore, quindi non ha senso e contrasta con la selezione dei pazienti da considerare ben più ampia.
A giudicare dalla lunghezza della query e dal gran numero di subquery è molto facile che si manifestino incongruenze per cui la query può dare risultato zero. A maggior ragione se il database è più grande, è un miracolo avere una risposta corretta e completa.
Riguardo ai manuali non mi risultano che ne esistano di completi, si tratta di un linguaggio abbastanza complesso dove, a parte dei comandi base, molto viene lasciato all'intuizione ed al ragionamento dell'utente, oltre alla sua esperienza. Pertanto quando si chiedono query complesse, sarebbe bene pensare che chi si cimenta spesso impiega giornate intere per raggiungere un risultato soddisfacente e spesso, nonostante l'impegno, non si riesce nemmeno a capire perché non funziona. Ciò vale a maggior ragione quando a svolgere il compito non è un professionista della materia.
Admin
Admin
Admin
Admin

Messaggi : 537
Punti : 5482
Voti per importanza dei messaggi : 89
Data d'iscrizione : 20.02.11
Località : CASERTA

https://utentimillewin.forumattivo.it

Torna in alto Andare in basso

frequenza cardiaca Empty FREQUENZA CARDIACA

Messaggio  nanci giacinto Lun 28 Lug 2014 - 16:31

BUON POMERIGGIO DOMANDA: PER QUALE MISTERIOSO MOTIVO DUE QUERY IDENTICHE (QUI SOTTO RIPRODOTTE) NON FUNZIONANO ALLA STESSA MANIERA SULL'ARCHIOVIO DELLO STESSO MEDICO?. LA PRIMA ESTRAE 388 PZ E LA SECONDA ZERO. ALTRA DOMANDA: LA QUERY (QUELLA LUNGA) CON LA QUALE HO APERTO QUESTO FORUM PERCHE' HA FUNZIONATO SU SETTE MEDICI DEGLI OTTO DELLA NOSTRA ASSOCIAZIONE DENOMINATA MEDIASS (HO FATTO L'ESTRAZIONE NON SULL'INTERO ARCHIVIO MA SUL SINGOLO MEDICO)? DA NOTARE CHE LE QUERY QUI SOTTO RIPRODOTTE NON SONO ALTRO CHE LA PRIMA QUERY A CUI HO FATTO DEI TAGLI. LA PRIMA QUERY (QUELLA LUNGA CON LA QUALE HO APERTO IL FORUM)  NON HA FUNZIONATO SULL'ARCHIVIO DEL MEDICO SUL QUALE NON FUNZIONA ANCHE UNA QUERY QUI SOTTO RIPRODOTTA CHE E' UN RIASSUNTO DI QUELLA ORIGINARIA PIU' LUNGA. DEDUCO QUINDI CHE IL NON FUNZIONAMENTO SULL'INTERO ARCHIVIO DELL'ASSOCIAZIONE SIA DELLA PRIMA QUERY (QUELLA LUNGA) SIA DELLE DUE (IDENTICHE) QUI RIPRODOTTE NON DIPENDE DALLA LUNGHEZZA MA DA QUALCOSALTRO CHE MI STA FACENDO IMPAZZIRE. COSA PUO' ESSERE? GRAZIE


QUERY CHE FUNZIONA ED ESTRAE 388 PAZIENTI
select distinct p.nome nome, p.cognome cognome,
days(p.nascita, today())/365 eta, p.sesso sesso,
today() data_odierna,
 
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '272%')
___dislipidemia____,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and  a.cp_code like '413%' )
____angina_pect___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '410%%' or a.cp_code like '412%%'))
__infarto_mioc__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '436.%')
___ICTUS__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '411%')
__SINDR_cORON__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '431%' or a.cp_code like '430%')
__emorragia_cerebrale___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like 'v45.82%')
__angioplastica_coronarica___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '414.5%%' or a.cp_code like 'V45.81%'))
__bypass_aortocoronarico___,
 
(select a.frequenza from cart_press a
where a.codice=p.codice
and not exists (select b.codice from cart_press b where a.codice=b.codice and 
(b.data_open>a.data_open or b.data_open=a.data_open and b.rowid>a.rowid))
and a.data_open between today()-180 and today())  ______ferquenza_ultimi_6mesi______
from pazienti p , nos_002 n, cart_pazpbl c, v_pazienti v
where p.codice=n.codice
and c.codice=n.codice
and v.codice=p.codice
and (c.cp_code like '401%' or c.cp_code like '405%')
and n.pa_drevoca is null
and p.decesso is null
and p.pa_convenzione not like 'l'
order by p.cognome, p.nome



QUERY CHE NON FUNZIONA IDENTICA ALLA PRIMA
select distinct p.nome nome, p.cognome cognome,
days(p.nascita, today())/365 eta, p.sesso sesso,
today() data_odierna,
 
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '272%')
___dislipidemia____,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and  a.cp_code like '413%' )
____angina_pect___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '410%%' or a.cp_code like '412%%'))
__infarto_mioc__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '436.%')
___ICTUS__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '411%')
__SINDR_cORON__,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like '431%' or a.cp_code like '430%')
__emorragia_cerebrale___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and a.cp_code like 'v45.82%')
__angioplastica_coronarica___,
(select max(a.cp_code) from cart_pazpbl a
where a.codice=p.codice and (a.cp_code like '414.5%%' or a.cp_code like 'V45.81%'))
__bypass_aortocoronarico___,
 
(select a.frequenza from cart_press a
where a.codice=p.codice
and not exists (select b.codice from cart_press b where a.codice=b.codice and 
(b.data_open>a.data_open or b.data_open=a.data_open and b.rowid>a.rowid))
and a.data_open between today()-180 and today())  ______ferquenza_ultimi_6mesi______
from pazienti p , nos_002 n, cart_pazpbl c, v_pazienti v
where p.codice=n.codice
and c.codice=n.codice
and v.codice=p.codice
and (c.cp_code like '401%' or c.cp_code like '405%')
and n.pa_drevoca is null
and p.decesso is null
and p.pa_convenzione not like 'l'
order by p.cognome, p.nome
nanci giacinto
nanci giacinto
Membro Junior
Membro Junior

Messaggi : 128
Punti : 4999
Voti per importanza dei messaggi : -1
Data d'iscrizione : 02.03.11

Torna in alto Andare in basso

frequenza cardiaca Empty Re: frequenza cardiaca

Messaggio  Cervino Mer 30 Lug 2014 - 1:08

sul mio Mille.db MonoUtente, funzionano tutte e due ( stesso numero di righe estratte ) : daltronde se sono uguali ... ( ma non ho verificato) .

Alcune osservazioni :  trattasi di query analitiche adatte ad estrarre il maggior numero possibili di dati, anche su database gestiti non sempre in modo ottimale ( l' obiettivo principale è la quantità dei dati e non la qualità ), in uso anche nella mia ASL  ( Brescia ) dal 2005 , se non erro , per l' invio di Report ( ora annuale )  x l'analisi statistica ed il confronto fra pari ;  attualmente inviano i dati oltre 400 Medici .

La Query ogni anno subisce parziali modifiche ed è pensata per funzionare anche sui Mille.db MultiUtente ridotti a Monotente, come si deduce dalla condizione di ricerca :    FROM  pazienti p , ... v_pazienti v  WHERE ...  v.codice=p.codice 

che altrimenti sarebbe soltanto limitativa ( difatti esclude buona parte dei pazienti con scadenza a termine ) .

Negli ultimi anni inoltre la query è stata sdoppiata, dato che superato un certo numero di colonne si bloccava : con PostGreSQL non è piu' nesessario utilizzare 2 query .

Saluti ,  Sergio

Cervino
Membro Junior
Membro Junior

Messaggi : 245
Punti : 5071
Voti per importanza dei messaggi : 22
Data d'iscrizione : 03.03.11
Età : 69
Località : Orzivecchi (BS)

Torna in alto Andare in basso

frequenza cardiaca Empty numeri estratti come testo

Messaggio  nanci giacinto Dom 14 Dic 2014 - 0:02

BUONA SERA i dati numerici estratti con la query sono estratti come "testo" per cui nel foglio excell devono poi essere trasformati in dati numerici con grande perdita di tempo. C'è un modo di estrarre i dati numerici come numeri e non come testo? grazie BUONA NOTTE.
nanci giacinto
nanci giacinto
Membro Junior
Membro Junior

Messaggi : 128
Punti : 4999
Voti per importanza dei messaggi : -1
Data d'iscrizione : 02.03.11

Torna in alto Andare in basso

frequenza cardiaca Empty Re: frequenza cardiaca

Messaggio  Contenuto sponsorizzato


Contenuto sponsorizzato


Torna in alto Andare in basso

Torna in alto

- Argomenti simili

 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.