source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCT.m@ 814

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

initial load of WorldVistAEHR

File size: 4.7 KB
RevLine 
[613]1GMRCT ; SLC/DLT\JFR - Get DUZ's of users for notification to service ; 11/25/2000
2 ;;3.0;CONSULT/REQUEST TRACKING;**1,5,11,18**;Dec 27, 1997
3EN(GMRCSRV,USER,TEST) ;Get who is to be notified for alert action
4 ; return them in array GMRCADUZ(DUZ)=""
5 N GMRCLIS,GMRCHKD,GMRCNT,GMRCLP,GMRCQUIT
6 D RECIP(GMRCSRV,$G(TEST)) I $D(TEST),$G(USER),$D(GMRCADUZ(USER)) Q
7 I '$P(^GMR(123.5,+GMRCSRV,0),U,8) Q ; don't check parents
8 S GMRCHKD(GMRCSRV)="",GMRCNT=1
9 D FINDPAR^GMRCAU(GMRCSRV,.GMRCNT) I '$D(GMRCLIS) Q
10 S GMRCLP=0
11 F S GMRCLP=$O(GMRCLIS(GMRCLP)) Q:'GMRCLP D I $D(GMRCQUIT) Q
12 . I +$P(GMRCLIS(GMRCLP),U,2) K GMRCLIS(GMRCLP) Q ;been checked
13 . I '$D(GMRCHKD(+GMRCLIS(GMRCLP))) D
14 .. ; check parent
15 .. D RECIP(+GMRCLIS(GMRCLP),$G(TEST)) I $G(USER),$D(GMRCADUZ(USER)) D Q
16 ... S GMRCQUIT=1
17 .. S GMRCHKD(+GMRCLIS(GMRCLP))=""
18 . S $P(GMRCLIS(GMRCLP),U,2)=1
19 . I $P(^GMR(123.5,+GMRCLIS(GMRCLP),0),U,8) D ;check parents, fld .08 =1
20 .. D FINDPAR^GMRCAU(+GMRCLIS(GMRCLP),.GMRCNT)
21 . S GMRCLP=0 ;start back at top and don't miss any
22 Q
23RECIP(GMRCSS,NOTNULL) ;gather recipients for GMRCSS
24 N GMRCTM,GMRCTMI,GMRCLST,GMRCER,GMRCHL,GMRCSSI,GMRCU,GMRCWL
25 I $D(^GMR(123.5,GMRCSS,123)),$P(^GMR(123.5,GMRCSS,123),"^",8) S GMRCADUZ($P(^(123),"^",8))=$S($G(NOTNULL):$$NOTSERV($P(^(123),"^",8)),1:"")
26 I $D(^GMR(123.5,GMRCSS,123.1)) D TEAM
27 I $D(^GMR(123.5,GMRCSS,123.2)),+$G(GMRCO) D LOC
28 I $D(^GMR(123.5,GMRCSS,123.33)) D ADMU
29 I $D(^GMR(123.5,GMRCSS,123.34)) D ADMT
30 Q
31LOC ;Find the patients location and match to location assignments
32 S GMRCWL="",GMRCHL=""
33 I +$G(GMRCO) S GMRCHL=$P(^GMR(123,+GMRCO,0),"^",4) I GMRCHL S GMRCWL=$G(^SC(GMRCHL,42)) S:GMRCWL GMRCWL=GMRCWL_";DIC(42," S GMRCHL=GMRCHL_";SC("
34 E S:+$G(GMRCWLI) GMRCWL=GMRCWLI_";DIC(42," S:+$G(GMRCHLI) GMRCHL=GMRCHLI_";SC("
35 I +GMRCWL S GMRCSSI=$O(^GMR(123.5,GMRCSS,123.2,"B",GMRCWL,"")) I GMRCSSI D LOC1
36 I +GMRCHL S GMRCSSI=$O(^GMR(123.5,GMRCSS,123.2,"B",GMRCHL,"")) I GMRCSSI D LOC1
37 Q
38LOC1 ;Get user and/or team assigned to location
39 I $P(^GMR(123.5,GMRCSS,123.2,GMRCSSI,0),"^",2) S GMRCADUZ($P(^(0),"^",2))=$S($G(NOTNULL):$$NOTSERV($P(^(0),"^",2)),1:"")
40 I $P(^GMR(123.5,GMRCSS,123.2,GMRCSSI,0),"^",3) S GMRCTMI=$P(^(0),"^",3) D TEAM1
41 Q
42ADMU ;Get notification recips from admin users field (123.33)
43 ;Loop "AC" x-ref to get those admin users marked as notif recipients
44 N RECIP
45 S RECIP=0
46 F S RECIP=$O(^GMR(123.5,GMRCSS,123.33,"AC",1,RECIP)) Q:'RECIP D
47 . S GMRCADUZ(RECIP)=$S($G(NOTNULL):$$NOTSERV(RECIP),1:"")
48 Q
49ADMT ;Get notification recips from admin teams field (123.34)
50 ;Loop "AC" x-ref to get those admin teams marked as notif recipients
51 ;call TEAM1 to get list of users and add to recip list
52 N GMRCTMI S GMRCTMI=0
53 F S GMRCTMI=$O(^GMR(123.5,GMRCSS,123.34,"AC",1,GMRCTMI)) Q:'GMRCTMI D
54 . D TEAM1
55TEAM ;Loop through Teams to send all users notifications
56 S GMRCTM=0 F S GMRCTM=$O(^GMR(123.5,GMRCSS,123.1,GMRCTM)) Q:'+GMRCTM S GMRCTMI=$P($G(^GMR(123.5,GMRCSS,123.1,GMRCTM,0)),"^") I GMRCTMI D TEAM1
57 Q
58TEAM1 ;Get user DUZ's from Team pointed to in File
59 S GMRCLST="" D TEAMPROV^ORQPTQ1(.GMRCLST,GMRCTMI)
60 Q:$S('$O(GMRCLST(0)):1,$P(GMRCLST(1),"^",2)="No providers found.":1,1:0)
61 S GMRCU=0 F S GMRCU=$O(GMRCLST(GMRCU)) Q:GMRCU="" D
62 . I '$G(NOTNULL) D Q
63 .. S GMRCADUZ($P(GMRCLST(GMRCU),"^",1)_U_GMRCTMI)=""
64 . S GMRCADUZ($P(GMRCLST(GMRCU),"^",1))=$S($G(NOTNULL):$$NOTSERV(GMRCU),1:"")
65 K GMRCLST
66 Q
67NOTSERV(RECIP) ;set GMRCADUZ(RECIP)=all services they receive for
68 I '$D(GMRCADUZ(RECIP)) Q $P(^GMR(123.5,+GMRCSS,0),U)
69 Q GMRCADUZ(RECIP)_"~"_$P(^GMR(123.5,+GMRCSS,0),U)
70TEST ; called from GMRC NOTIF RECIPIENTS
71 N GMRCSRV,GMRCUSR,GMRCADUZ
72 N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y
73 S DIR(0)="PO^123.5:EM",DIR("A")="Select Consult Service"
74 S DIR("?")="Choose the consult service to check update status of user"
75 S DIR("??")="^D TESTHELP^GMRCAU(""ALL SERVICES"")" D ^DIR
76 I $D(DIRUT) Q
77 S GMRCSRV=+Y
78 N DIR
79 S DIR(0)="PO^200:EM",DIR("A")="Choose notification recipient"
80 D ^DIR I $D(DIRUT) Q
81 S GMRCUSR=+Y
82 D EN(GMRCSRV,GMRCUSR,1)
83 I $D(GMRCADUZ(GMRCUSR)) D
84 . W !!,"This user is a notification recipients for "_GMRCADUZ(GMRCUSR),!
85 . I GMRCADUZ(GMRCUSR)'=$P(^GMR(123.5,GMRCSRV,0),U) D
86 .. D HIER(GMRCADUZ(GMRCUSR))
87 . W !!
88 I '$D(GMRCADUZ(GMRCUSR)) W !!,"This user is not a notification recipient.",!!
89 G TEST
90HIER(SERV) ;ask to see the hierarchy
91 N DIR,DIRUT,DUOUT,DTOUT
92 S DIR(0)="Y"
93 S DIR("A")="View hierarchy from this service to the selected service"
94 S DIR("B")="NO"
95 D ^DIR
96 I Y>0 D TESTHELP^GMRCAU(SERV)
97 Q
98TSTINTRO ; entry action for GMRC USER NOTIFICATION
99 W !,"This option will list how a given user became a notification recipient"
100 W !,"for a selected consult service. If the PROCESS PARENTS FOR NOTIFS field is"
101 W !,"set to YES, all the parents of the service will also be processed to"
102 W !,"determine if the user is a recipient via that service.",!!
103 Q
Note: See TracBrowser for help on using the repository browser.