source: FOIAVistA/trunk/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMAUTO0.m@ 812

Last change on this file since 812 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1QAMAUTO0 ;HISC/DAD-AUTO ENROLL MAIN DRIVER ROUTINE ;6/18/93 15:52
2 ;;1.0;Clinical Monitoring System;;09/13/1993
3 I $D(QAMTODAY)[0 S %DT="",X="T-1" D ^%DT S QAMTODAY=Y
4 K ^UTILITY($J,"QAM"),^("QAM CONDITION"),^("QAM FALL OUT"),^("QAM SAMPLE")
5 D EN4^QAMAUTO1 ; *** AUTO RUN DATES FILE, DATE
6 F QAMD0=0:0 S QAMD0=$O(^QA(743,QAMD0)) Q:QAMD0'>0 D GETMON
7 D EN2^QAMPRUN0 ; *** REPORT OF AUTO ENROLL MONITORS RUN
8EXIT D ^QAMAUTO8 ; *** CLEAN-UP
9 S:$D(ZTQUEUED) ZTREQ="@"
10 Q
11GETMON S QAMZERO=$S($D(^QA(743,QAMD0,0))#2:^(0),1:"") Q:$P(QAMZERO,"^",5)'>0
12 I $D(^UTILITY($J,"QAM MONITOR")) Q:$D(^UTILITY($J,"QAM MONITOR",$P(QAMZERO,"^"),QAMD0))[0
13 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
14 S QAMONE=$S($D(^QA(743,QAMD0,1))#2:^(1),1:"") Q:$P(QAMONE,"^",5)'>0
15 Q:$P(QAMONE,"^",6)>QAMTODAY Q:QAMTODAY>$P(QAMONE,"^",7)&$P(QAMONE,"^",7)
16 I $P(QAMZERO,"^",4)'>0 D ^QAMAUTO6,^QAMAUTO2 Q ; *** MANUAL ENROLL MONITOR
17 S QAMRELAT=$S($D(^QA(743,QAMD0,"REL"))#2:^("REL"),1:"") Q:QAMRELAT=""
18 S QAMSAMPL=$S($D(^QA(743,QAMD0,"SMP"))#2:^("SMP"),1:0)
19 Q:$D(^QA(743,QAMD0,"COND",0))[0 Q:$P(^(0),"^",4)'>0
20 F QAMD1=0:0 S QAMD1=$O(^QA(743,QAMD0,"COND",QAMD1)) Q:QAMD1'>0 S @("C"_QAMD1)=1
21 S ^UTILITY($J,"QAM",QAMD0,"LST")=$P(QAMONE,"^",8)
22 S ^UTILITY($J,"QAM",QAMD0,"WSR")=$P(QAMONE,"^",9)_"^"_$S($D(^QA(743,QAMD0,"WSR"))#2:^("WSR"),1:"")
23 S ^UTILITY($J,"QAM",QAMD0,"SFR")=$S($D(^QA(743,QAMD0,"SFR"))#2:"1^"_^("SFR"),1:0)
24 Q:$D(^QA(743.6,QAMARUN,1,"B",QAMD0)) ;*** MONITOR ALREADY RAN THIS DATE
25 D EN5^QAMAUTO1 ; *** AUTO RUN DATES FILE, MONITOR
26 K QAMCOND,QAMCCOND,^UTILITY($J,"QAM CONDITION"),^UTILITY($J,"QAM FALL OUT",QAMD0),^UTILITY($J,"QAMSAMPLE",QAMD0)
27 ; *** CONDITIONS
28 F QAMD1=0:0 S QAMD1=$O(^QA(743,QAMD0,"COND",QAMD1)) Q:QAMD1'>0 D XCOND
29 ; *** RELATIONSHIP
30 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
31 D EN^QAMTIME0
32 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
33 S ^UTILITY($J,"QAM SAMPLE",QAMD0)=QAMDENOM,^UTILITY($J,"QAM FALL OUT",QAMD0)=QAMFALL K ^UTILITY($J,"QAM CONDITION")
34 D ^QAMAUTO2 ; *** UPDATE FALL OUT & HISTORY FILES, BULLETIN, REPORTS
35 Q
36REL0 F QAMDATE=0:0 S QAMDATE=$O(^UTILITY($J,"QAM CONDITION",QAMC0,QAMDFN,QAMDATE)) Q:QAMDATE'>0 D REL1
37 Q
38REL1 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)
39 F QAMEVENT=0:0 S QAMEVENT=$O(^UTILITY($J,"QAM CONDITION",QAMCND,QAMDFN,QAMEVENT)) Q:QAMEVENT'>0 D REL2
40 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)
41 I I QAMSAMPL]"",@QAMSAMPL S ^UTILITY($J,"QAM SAMPLE",QAMD0,QAMDFN,QAMDATE)="",QAMDENOM=QAMDENOM+1
42 Q
43REL2 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),"^")
44 I I @QAMRELAT D ^QAMAUTO7
45 Q
46XCOND S QAMCOND=$S($D(^QA(743,QAMD0,"COND",QAMD1,0))#2:^(0),1:"")
47 G:QAMCOND="" 2
48 S QAMCCODE=$S($D(^QA(743.3,+QAMCOND,"COND"))#2:^("COND"),1:"")
49 G:QAMCCODE="" 2
50 ; *** S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN,QAMDATE)=""
51 S X=$P(QAMCCODE,"^",$L(QAMCCODE,"^")) X ^%ZOSF("TEST") I X QAMCCODE
522 K @("C"_QAMD1)
53 Q
Note: See TracBrowser for help on using the repository browser.