1 | SDAMEVT4 ;ALB/MJK - Appt Event Driver Utilities ;12/1/91
|
---|
2 | ;;5.3;Scheduling;**28,132**;Aug 13, 1993
|
---|
3 | ;
|
---|
4 | COMP(SDHDL,SDAMEVT) ; -- main entry point for compare
|
---|
5 | N SDORG,SDCHG
|
---|
6 | S (SDORG,SDCHG)=0
|
---|
7 | F S SDORG=$O(^TMP("SDEVT",$J,SDHDL,SDORG)) Q:'SDORG D Q:SDCHG
|
---|
8 | .;
|
---|
9 | .; -- if overall visit flag is 1
|
---|
10 | .; then set to 1
|
---|
11 | .IF $G(^TMP("SDEVT",$J,SDHDL,SDORG,"VISIT CHANGE FLAGS"))[1 S SDCHG=1 Q
|
---|
12 | .;
|
---|
13 | .; -- if not a credit stop
|
---|
14 | .; and visit flags not set then assume data changed
|
---|
15 | .; then set to 1
|
---|
16 | .IF SDORG'=4,$G(^TMP("SDEVT",$J,SDHDL,SDORG,"VISIT CHANGE FLAGS"))="" S SDCHG=1 Q
|
---|
17 | .;
|
---|
18 | .; -- process orginating types
|
---|
19 | .I SDORG=1 S SDCHG=$$APPT(SDHDL) Q
|
---|
20 | .I SDORG=2 S SDCHG=$$AE(SDHDL) Q
|
---|
21 | .I SDORG=3 S SDCHG=$$DIS(SDHDL) Q
|
---|
22 | .I SDORG=4 S SDCHG=$$CRSC(SDHDL) Q
|
---|
23 | COMPQ Q SDCHG
|
---|
24 | ;
|
---|
25 | APPT(SDHDL) ; -- appt check
|
---|
26 | N SDCHG,NODE
|
---|
27 | S SDCHG=$S(SDATA("BEFORE","STATUS")'=SDATA("AFTER","STATUS"):1,1:0)
|
---|
28 | I 'SDCHG S SDCHG=$$OE(SDHDL,1)
|
---|
29 | I 'SDCHG F NODE="DPT","SC" I $G(^TMP("SDEVT",$J,SDHDL,1,NODE,0,"BEFORE"))'=$G(^("AFTER")) S SDCHG=1 Q
|
---|
30 | Q SDCHG
|
---|
31 | ;
|
---|
32 | AE(SDHDL) ; -- add/edit check
|
---|
33 | N SDCHG,SDDA,NODE
|
---|
34 | S SDCHG=$$OE(SDHDL,2)
|
---|
35 | I 'SDCHG,$G(^TMP("SDEVT",$J,SDHDL,2,"STANDALONE",0,"BEFORE"))'=$G(^("AFTER")) S SDCHG=1
|
---|
36 | Q SDCHG
|
---|
37 | ;
|
---|
38 | DIS(SDHDL) ; - disposition check
|
---|
39 | N SDCHG
|
---|
40 | S SDCHG=$$OE(SDHDL,3)
|
---|
41 | I 'SDCHG,$G(^TMP("SDEVT",$J,SDHDL,3,"DIS",0,"BEFORE"))'=$G(^("AFTER")) S SDCHG=1
|
---|
42 | Q SDCHG
|
---|
43 | ;
|
---|
44 | CRSC(SDHDL) ; -- credit stop code check
|
---|
45 | N SDCHG
|
---|
46 | S SDCHG=$$OE(SDHDL,4)
|
---|
47 | Q SDCHG
|
---|
48 | ;
|
---|
49 | OE(SDHDL,SDORG) ; -- compare encounter data
|
---|
50 | N SDCHG,SDI,NODE,SDOE
|
---|
51 | S (SDOE,SDCHG)=0
|
---|
52 | F S SDOE=$O(^TMP("SDEVT",$J,SDHDL,SDORG,"SDOE",SDOE)) Q:'SDOE D Q:SDCHG
|
---|
53 | .I $G(^TMP("SDEVT",$J,SDHDL,SDORG,"SDOE",SDOE,0,"BEFORE"))'=$G(^("AFTER")) S SDCHG=1 Q
|
---|
54 | .F NODE="CL" S SDI=0 D Q:SDCHG
|
---|
55 | ..F S SDI=$O(^TMP("SDEVT",$J,SDHDL,SDORG,"SDOE",SDOE,NODE,SDI)) Q:'SDI D Q:SDCHG
|
---|
56 | ...I $G(^TMP("SDEVT",$J,SDHDL,SDORG,"SDOE",SDOE,NODE,SDI,0,"BEFORE"))'=$G(^("AFTER")) S SDCHG=1
|
---|
57 | OEQ Q SDCHG
|
---|
58 | ;
|
---|
59 | ; -- SEE SDAMEVT0 FOR DOC ON VARIABLES
|
---|
60 | ;
|
---|
61 | MODE(SDHDL) ; -- can event talk
|
---|
62 | N Y S Y=""
|
---|
63 | I $D(ZTQUEUED) S Y=2 ; -- queued job
|
---|
64 | I Y="",IO'=IO(0) S Y=2 ; -- not home device
|
---|
65 | S:Y="" Y=$G(SDMODE)
|
---|
66 | Q $S(Y=0:"DIALOGUE",Y=1:"MONOLOGUE",Y=2:"QUIET",1:"QUIET")
|
---|
67 | ;
|
---|
68 | MESSAGE(MESSAGE,SDHDL) ; -- show message to user if ok
|
---|
69 | N SDSENT
|
---|
70 | I $$MODE()["LOGUE" W !!,MESSAGE S SDSENT=1
|
---|
71 | Q $G(SDSENT)
|
---|
72 | ;
|
---|
73 | CHANGE(SDHDL,SDORG,SDFLAGS) ; -- set visit change flags value
|
---|
74 | S ^TMP("SDEVT",$J,+$G(SDHDL),+$G(SDORG),"VISIT CHANGE FLAGS")=$G(SDFLAGS)
|
---|
75 | Q
|
---|
76 | ;
|
---|