54 lines
3.4 KiB
Mathematica
54 lines
3.4 KiB
Mathematica
|
QAMAUTO0 ;HISC/DAD-AUTO ENROLL MAIN DRIVER ROUTINE ;6/18/93 15:52
|
||
|
;;1.0;Clinical Monitoring System;;09/13/1993
|
||
|
I $D(QAMTODAY)[0 S %DT="",X="T-1" D ^%DT S QAMTODAY=Y
|
||
|
K ^UTILITY($J,"QAM"),^("QAM CONDITION"),^("QAM FALL OUT"),^("QAM SAMPLE")
|
||
|
D EN4^QAMAUTO1 ; *** AUTO RUN DATES FILE, DATE
|
||
|
F QAMD0=0:0 S QAMD0=$O(^QA(743,QAMD0)) Q:QAMD0'>0 D GETMON
|
||
|
D EN2^QAMPRUN0 ; *** REPORT OF AUTO ENROLL MONITORS RUN
|
||
|
EXIT D ^QAMAUTO8 ; *** CLEAN-UP
|
||
|
S:$D(ZTQUEUED) ZTREQ="@"
|
||
|
Q
|
||
|
GETMON S QAMZERO=$S($D(^QA(743,QAMD0,0))#2:^(0),1:"") Q:$P(QAMZERO,"^",5)'>0
|
||
|
I $D(^UTILITY($J,"QAM MONITOR")) Q:$D(^UTILITY($J,"QAM MONITOR",$P(QAMZERO,"^"),QAMD0))[0
|
||
|
I $D(^UTILITY($J,"QAM SERVICE")) S QA=+$P(QAMZERO,"^",3),QAM=$S($D(^DIC(49,QA,0))#2:$P(^(0),"^"),1:0) Q:$D(^UTILITY($J,"QAM MONITOR",QAM,QA))[0
|
||
|
S QAMONE=$S($D(^QA(743,QAMD0,1))#2:^(1),1:"") Q:$P(QAMONE,"^",5)'>0
|
||
|
Q:$P(QAMONE,"^",6)>QAMTODAY Q:QAMTODAY>$P(QAMONE,"^",7)&$P(QAMONE,"^",7)
|
||
|
I $P(QAMZERO,"^",4)'>0 D ^QAMAUTO6,^QAMAUTO2 Q ; *** MANUAL ENROLL MONITOR
|
||
|
S QAMRELAT=$S($D(^QA(743,QAMD0,"REL"))#2:^("REL"),1:"") Q:QAMRELAT=""
|
||
|
S QAMSAMPL=$S($D(^QA(743,QAMD0,"SMP"))#2:^("SMP"),1:0)
|
||
|
Q:$D(^QA(743,QAMD0,"COND",0))[0 Q:$P(^(0),"^",4)'>0
|
||
|
F QAMD1=0:0 S QAMD1=$O(^QA(743,QAMD0,"COND",QAMD1)) Q:QAMD1'>0 S @("C"_QAMD1)=1
|
||
|
S ^UTILITY($J,"QAM",QAMD0,"LST")=$P(QAMONE,"^",8)
|
||
|
S ^UTILITY($J,"QAM",QAMD0,"WSR")=$P(QAMONE,"^",9)_"^"_$S($D(^QA(743,QAMD0,"WSR"))#2:^("WSR"),1:"")
|
||
|
S ^UTILITY($J,"QAM",QAMD0,"SFR")=$S($D(^QA(743,QAMD0,"SFR"))#2:"1^"_^("SFR"),1:0)
|
||
|
Q:$D(^QA(743.6,QAMARUN,1,"B",QAMD0)) ;*** MONITOR ALREADY RAN THIS DATE
|
||
|
D EN5^QAMAUTO1 ; *** AUTO RUN DATES FILE, MONITOR
|
||
|
K QAMCOND,QAMCCOND,^UTILITY($J,"QAM CONDITION"),^UTILITY($J,"QAM FALL OUT",QAMD0),^UTILITY($J,"QAMSAMPLE",QAMD0)
|
||
|
; *** CONDITIONS
|
||
|
F QAMD1=0:0 S QAMD1=$O(^QA(743,QAMD0,"COND",QAMD1)) Q:QAMD1'>0 D XCOND
|
||
|
; *** RELATIONSHIP
|
||
|
S (QAMFALL,QAMDENOM)=0,QAMCND=+$P(QAMONE,"^",15),DUPLICAT=$P(QAMONE,"^",14),^UTILITY($J,"QAM SAMPLE",QAMD0)=QAMDENOM,^UTILITY($J,"QAM FALL OUT",QAMD0)=QAMFALL
|
||
|
D EN^QAMTIME0
|
||
|
F QAMC0=0:0 S QAMC0=$O(^UTILITY($J,"QAM CONDITION",QAMC0)) Q:QAMC0'>0 F QAMDFN=0:0 S QAMDFN=$O(^UTILITY($J,"QAM CONDITION",QAMC0,QAMDFN)) Q:QAMDFN'>0 D REL0
|
||
|
S ^UTILITY($J,"QAM SAMPLE",QAMD0)=QAMDENOM,^UTILITY($J,"QAM FALL OUT",QAMD0)=QAMFALL K ^UTILITY($J,"QAM CONDITION")
|
||
|
D ^QAMAUTO2 ; *** UPDATE FALL OUT & HISTORY FILES, BULLETIN, REPORTS
|
||
|
Q
|
||
|
REL0 F QAMDATE=0:0 S QAMDATE=$O(^UTILITY($J,"QAM CONDITION",QAMC0,QAMDFN,QAMDATE)) Q:QAMDATE'>0 D REL1
|
||
|
Q
|
||
|
REL1 K QAMCARAY F QAMC1=0:0 S QAMC1=$O(^QA(743,QAMD0,"COND",QAMC1)) Q:QAMC1'>0 S QA=$D(^UTILITY($J,"QAM CONDITION",QAMC1,QAMDFN)),QAMCARAY("C"_QAMC1)=QA_"^"_(QA#2)
|
||
|
F QAMEVENT=0:0 S QAMEVENT=$O(^UTILITY($J,"QAM CONDITION",QAMCND,QAMDFN,QAMEVENT)) Q:QAMEVENT'>0 D REL2
|
||
|
I $D(^UTILITY($J,"QAM SAMPLE",QAMD0,QAMDFN,QAMDATE))[0 S QA="" F QA(0)=0:0 S QA=$O(QAMCARAY(QA)) Q:QA="" S @QA=+$P(QAMCARAY(QA),"^",2)
|
||
|
I I QAMSAMPL]"",@QAMSAMPL S ^UTILITY($J,"QAM SAMPLE",QAMD0,QAMDFN,QAMDATE)="",QAMDENOM=QAMDENOM+1
|
||
|
Q
|
||
|
REL2 I $D(^UTILITY($J,"QAM FALL OUT",QAMD0,QAMDFN,QAMEVENT))[0 S QA="" F QA(0)=0:0 S QA=$O(QAMCARAY(QA)) Q:QA="" S @QA=+$P(QAMCARAY(QA),"^")
|
||
|
I I @QAMRELAT D ^QAMAUTO7
|
||
|
Q
|
||
|
XCOND S QAMCOND=$S($D(^QA(743,QAMD0,"COND",QAMD1,0))#2:^(0),1:"")
|
||
|
G:QAMCOND="" 2
|
||
|
S QAMCCODE=$S($D(^QA(743.3,+QAMCOND,"COND"))#2:^("COND"),1:"")
|
||
|
G:QAMCCODE="" 2
|
||
|
; *** S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN,QAMDATE)=""
|
||
|
S X=$P(QAMCCODE,"^",$L(QAMCCODE,"^")) X ^%ZOSF("TEST") I X QAMCCODE
|
||
|
2 K @("C"_QAMD1)
|
||
|
Q
|