VistA-FOIAVistA/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMPFAL0.m

31 lines
2.0 KiB
Mathematica

QAMPFAL0 ;HISC/DAD-PATIENTS WITH MULTIPLE FALL OUTS REPORT ;7/2/92 08:13
;;1.0;Clinical Monitoring System;;09/13/1993
K ^UTILITY($J,"QAMPFAL"),^UTILITY($J,"QAM MONITOR")
S QAQDIC="^QA(743,",QAQDIC(0)="AEMNQZ",QAQDIC("A")="Select MONITOR: ",QAQUTIL="QAM MONITOR" D EN1^QAQSELCT G:QAQQUIT EXIT
K DIR,DIRUT S DIR(0)="NO^1:99:0",DIR("A")="Minimum number of fall outs per patient",DIR("?",1)="Enter the minimum number of fall outs a patient must have",DIR("?")="in order to appear on this report."
W ! D ^DIR G:$D(DIRUT) EXIT S QAMINFAL=Y D ^QAQDATE G:QAQQUIT EXIT
K %ZIS,IOP S %ZIS="MQ" D ^%ZIS G:POP EXIT
I $D(IO("Q")) K IO("Q") S ZTRTN="ENTSK^QAMPFAL0",(ZTSAVE("QAM*"),ZTSAVE("QAQ*"),ZTSAVE("^UTILITY($J,"))="",ZTDESC="Patients with multiple fall outs report" D ^%ZTLOAD G EXIT
ENTSK ;
S QAMONTXT="" F QAMONTXT(0)=0:0 S QAMONTXT=$O(^UTILITY($J,"QAM MONITOR",QAMONTXT)) Q:QAMONTXT="" F QAMONIEN=0:0 S QAMONIEN=$O(^UTILITY($J,"QAM MONITOR",QAMONTXT,QAMONIEN)) Q:QAMONIEN'>0 D LOOP1
D ^QAMPFAL1
EXIT ;
W ! D ^%ZISC
K %ZIS,DFN,DIR,DIRUT,FALLDATE,MONITOR,PAGE,POP,QAM,QAMCOUNT,QAMD0,QAMDFN,QAMDT,QAMINFAL,QAMNAME,QAMONIEN,QAMONTXT,QAMQUIT,QAMSSN,TODAY,UNDL,VA,X,Y,ZTRTN,ZTSAVE,QAQQUIT,VAERR,^UTILITY($J,"QAMPFAL"),^UTILITY($J,"QAM MONITOR")
D K^QAQDATE S:$D(ZTQUEUED) ZTREQ="@"
Q
LOOP1 ;
F QAMDT=(QAQNBEG-.0000001):0 S QAMDT=$O(^QA(743.1,"AA",QAMONIEN,QAMDT)) Q:(QAMDT'>0)!(QAMDT>(QAQNEND+.9999999)) F QAMDFN=0:0 S QAMDFN=$O(^QA(743.1,"AA",QAMONIEN,QAMDT,QAMDFN)) Q:QAMDFN'>0 D LOOP2
Q
LOOP2 ;
S QAM=$S($D(^DPT(QAMDFN,0))#2:^(0),1:"") Q:QAM="" S QAMNAME=$P(QAM,"^"),QAMCOUNT=0 Q:$D(^UTILITY($J,"QAMPFAL",QAMNAME))
S DFN=QAMDFN D PID^VADPT6 S QAMSSN=VA("PID")
S ^UTILITY($J,"QAMPFAL",QAMNAME)=QAMSSN
F QAMD0=0:0 S QAMD0=$O(^QA(743.1,"B",QAMDFN,QAMD0)) Q:QAMD0'>0 D LOOP3
K:QAMCOUNT<QAMINFAL ^UTILITY($J,"QAMPFAL",QAMNAME)
Q
LOOP3 ;
S QAM=$S($D(^QA(743.1,QAMD0,0))#2:^(0),1:""),MONITOR=$P(QAM,"^",2),FALLDATE=$P(QAM,"^",3) Q:(MONITOR'>0)!(FALLDATE<QAQNBEG)!(FALLDATE>(QAQNEND+.9999999))
S ^UTILITY($J,"QAMPFAL",QAMNAME,FALLDATE,MONITOR,QAMD0)="",QAMCOUNT=QAMCOUNT+1
Q