source: FOIAVistA/tag/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCGUIB.m@ 628

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

initial load of FOIAVistA 6/30/08 version

File size: 8.0 KB
Line 
1GMRCGUIB ;SLC/DCM,JFR,MA - GUI actions for consults ;8/19/03 07:31
2 ;;3.0;CONSULT/REQUEST TRACKING;**4,12,18,20,17,22,29,30,35,45,53,55**;DEC 27, 1997;Build 4
3 ; This routine invokes IA #2980
4 ;
5SETDA() ;set DA of where audit actions are to be filed
6 S:'$D(^GMR(123,+GMRCO,40,0)) ^GMR(123,GMRCO,40,0)="^123.02DA^^"
7 S DA=$S($P(^GMR(123,+GMRCO,40,0),"^",3):$P(^(0),"^",3)+1,1:1)
8 S $P(^GMR(123,+GMRCO,40,0),"^",3,4)=DA_"^"_DA
9 Q DA
10REASON(GMRCFN,GMRCRQ,GMRCDT) ;Load the reason for the request into ^GMR(123,GMRCO,20
11 ;GMRCFN=File 123 IFN; GMRCRQ=Array containing Reason For Request
12 ;GMRCDT=Date time of entry
13 S ^GMR(123,GMRCFN,20,0)="^^^"_GMRCDT_"^"
14 S L=0,LN=1 F S L=$O(GMRCRQ(L)) Q:L="" S ^GMR(123,GMRCFN,20,LN,0)=GMRCRQ(L),LN=LN+1
15 S LN=LN-1,$P(^GMR(123,GMRCFN,20,0),"^",3)=LN
16 K LN,L
17 Q
18SETCOM(COMMENT,WHO) ;Set comment array into tracking actions
19 N GMRCNOW,DR,DIE
20 S GMRCNOW=$$NOW^XLFDT
21 S DIE="^GMR(123,GMRCO,40,",DA(1)=GMRCO,DR=".01////^S X=GMRCNOW;1////^S X=GMRCA;2////^S X=GMRCAD;3////^S X=$G(GMRCORNP);4////^S X=$S($G(WHO):WHO,1:DUZ);6////^S X=$G(GMRCFR);8////^S X=$G(GMRCFF)"
22 D ^DIE
23 S ^GMR(123,GMRCO,40,DA,1,0)="^^^^"_GMRCAD_"^"
24 S (GMRCND,GMRCND1)=0 F S GMRCND1=$O(COMMENT(GMRCND1)) Q:GMRCND1="" S GMRCND=GMRCND+1,^GMR(123,GMRCO,40,DA,1,GMRCND,0)=COMMENT(GMRCND)
25 S $P(^GMR(123,GMRCO,40,DA,1,0),"^",3)=GMRCND,$P(^(0),"^",4)=GMRCND,^GMR(123,GMRCO,40,"B",GMRCNOW,DA)=""
26 ;
27 ; if an IFC, call event handler to generate a msg to remote site
28 I $D(^GMR(123,+GMRCO,12)),$D(^(40,DA)) D TRIGR^GMRCIEVT(GMRCO,DA)
29 ;
30 K GMRCND,GMRCND1
31 Q
32CMT(GMRCO,GMRCOM,GMRCADUZ,GMRCWHN,GMRCWHO) ;add comment to consult
33 ; GMRCO = IEN from file 123
34 ; GMRCOM = array of comments in format GMRCOM(1)="xxxx", GMRCOM(2)="xxx"
35 ; GMRCADUZ = array of alert recipients as GMRCADUZ(DUZ)="" (optional)
36 ; GMRCWHO = IEN from file 200 who's responsible activity (optional)
37 ; GMRCWHN = date time of activity in FM format
38 ;
39 N DA,GMRCA,GMRCAD,GMRCORTX,GMRCDFN,GMRCTM,GMRCRP,GMRCUPD
40 S DA=$$SETDA ; get next activity tracking entry
41 S GMRCA=20,GMRCAD=GMRCWHN S:$G(GMRCWHO) GMRCORNP=GMRCWHO
42 D SETCOM(.GMRCOM,$G(GMRCWHO))
43 D ;update LAST ACTION field even though no status change
44 . N GMRCDR,GMRCSTS
45 . S GMRCSTS="",GMRCDR="9////20"
46 . D STATUS^GMRCP
47 S GMRCDFN=$P(^GMR(123,+GMRCO,0),"^",2)
48 S GMRCORTX="Comment Added to Consult "
49 I $P($G(^GMR(123,GMRCO,12)),U,5)="P" D
50 . S GMRCORTX="Comment Added to remote consult "
51 S GMRCORTX=GMRCORTX_$$ORTX^GMRCAU(+GMRCO)
52 S GMRCRP=+$P(^GMR(123,GMRCO,0),U,14)
53 S GMRCUPD=$$VALID^GMRCAU($P(^GMR(123,+GMRCO,0),U,5),GMRCO,DUZ)
54 I GMRCRP=DUZ D ;alert team if ord. prov. takes the action
55 . S GMRCTM=1
56 I GMRCUPD>1,GMRCRP'=DUZ D ; alert ord. prov if update users takes action
57 . S GMRCADUZ(GMRCRP)=""
58 I '$G(GMRCTM),GMRCUPD<2 D ;alert both if not ord. prov or update user
59 . S GMRCTM=1,GMRCADUZ(GMRCRP)=""
60 D MSG^GMRCP(GMRCDFN,GMRCORTX,+GMRCO,63,.GMRCADUZ,$G(GMRCTM))
61 Q
62SFILE(GMRCO,GMRCA,GMRCSF,GMRCORNP,GMRCDUZ,GMRCOM,GMRCALF,GMRCATO,GMRCAD) ;Process various file update functions from the GUI for a consult
63 ; ADMIN COMPLETE or SIGNIFICANT FINDINGS
64 ;Input variables:
65 ;GMRCO=File 123 IEN of the consult record
66 ;GMRCA=pointer to REQUEST ACTION TYPES (#123.1) 10=complete, 4=Sig find.
67 ;GMRCSF=Significant Findings flag: 'Y'= significant finding
68 ; : 'N'= no significant finding
69 ; : 'U'=unknown significant finding
70 ;GMRCORNP=Provider Responsible for action
71 ;GMRCDUZ=Person actually doing the action
72 ;GMRCOM=An array of comments by reference ARRAY(1)="xxx",ARRAY(2)="xxx"
73 ;GMRCALF=Flag to signal that alerts are to be sent; 'N'=NO, 'Y'=YES
74 ;GMRCATO=Who alerts are to be sent to; a comma delimited string of DUZ's
75 ;GMRCAD =FM date/time of activity
76 ;
77 ;Output:
78 ; GMRCERR=Error Flag: 0 if no error, 1 if error occurred
79 ; GMRCERMS - Error message or null
80 ; returned as GMRCERR^GMRCERMS
81 ;
82 N GMRCERR,GMRCERMS
83 L +^GMR(123,GMRCO):5 I '$T S GMRCERR=1,GMRCERMS="Record Locked. File Update Not Accomplished." Q GMRCERR_"^"_GMRCERMS
84 S GMRCERR=0,GMRCERMS="",DR="",GMRCORTX=""
85 N GMRCADUZ S GMRCADUZ=""
86 S GMRCNOW=$$NOW^XLFDT,GMRCSTS=$P(^GMR(123,+GMRCO,0),"^",12),GMRCDFN=$P(^(0),"^",2)
87 I '$G(GMRCDUZ) S GMRCDUZ=DUZ
88 I '$G(GMRCAD) S GMRCAD=GMRCNOW
89 ;Insure comment array contains text for Complete action.
90 I GMRCA=10 D I GMRCERR=1 S GMRCERMS="Comment field must contain a text value!" Q GMRCERR_"^"_GMRCERMS
91 . S GMRCERR=1
92 . I '$D(GMRCOM) Q
93 . N GMRCOM1 S GMRCOM1=""
94 . F S GMRCOM1=$O(GMRCOM(GMRCOM1)) Q:(GMRCOM1=""!(GMRCERR=0)) D
95 .. I $TR($G(GMRCOM(GMRCOM1))," ","")'="" S GMRCERR=0 Q
96 I +$G(GMRCA),GMRCA=10 D
97 .S GMRCSF=$G(GMRCSF,"")
98 .S GMRCSTS=2
99 .S DR="8////^S X=GMRCSTS;9////^S X=GMRCA;15////^S X=GMRCSF"
100 .S GMRCORTX="Completed Consult "_$$ORTX^GMRCAU(+GMRCO)_$S(GMRCSF="Y":" with Sig Findings",GMRCSF="N":" with no Sig Findings",1:"")
101 .I $P($G(^GMR(123,+GMRCO,0)),U,14) S GMRCADUZ($P($G(^(0)),U,14))=""
102 .Q
103 I $G(GMRCALF)=1 D
104 .N I
105 .F I=1:1 S X=$P(GMRCATO,";",I) Q:X="" S GMRCADUZ(X)=""
106 .Q
107 I $L(GMRCA),GMRCA=4 S DR=DR_$S($L(DR):";",1:"")_"9////^S X=GMRCA;15////^S X=GMRCSF" D
108 .S GMRCORTX=$S(GMRCSF="Y":"Sig Findings ",GMRCSF="N":"No Sig Findings ",1:"Unknown Sig Findings ")_"for consult "_$$ORTX^GMRCAU(GMRCO)
109 .I $P($G(^GMR(123,+GMRCO,0)),U,14) S GMRCADUZ($P($G(^(0)),U,14))=""
110 .Q
111 I $L(DR) S DIE="^GMR(123,",DA=GMRCO D ^DIE K DIE,DR
112 I '$O(GMRCOM(0)) D AUDIT^GMRCP
113 I $D(GMRCOM),$O(GMRCOM(0)) D
114 .N DA
115 .S DA=$$SETDA()
116 .D SETCOM(.GMRCOM,GMRCDUZ)
117 .Q
118 L -^GMR(123,GMRCO)
119 ;
120 D MSG^GMRCP(GMRCDFN,GMRCORTX,+GMRCO,$S(GMRCA=20:63,1:23),.GMRCADUZ,0)
121 ;
122 I $S(GMRCA=10:1,(GMRCA=4&($P(^GMR(123,GMRCO,0),U,12)=2)):1,1:0) D
123 . D EN^GMRCHL7($P(^GMR(123,GMRCO,0),"^",2),GMRCO,$G(GMRCTYPE),$G(GMRCRB),"RE",GMRCORNP,$G(GMRCVSIT),.GMRCOM,,GMRCAD)
124 K DIE,DR,DA,GMRCDT,GMRCNOW,GMRCAD,GMRCORNP,GMRCDUZ,GMRCRSLT,GMRCSTS,GMRCADUZ,GMRCORTX,GMRCDFN
125 Q GMRCERR_"^"_GMRCERMS
126 ;
127SCH(GMRCO,GMRCORNP,GMRCAD,GMRCADUZ,GMRCMT) ;schedule a consult API
128 ; Input variables:
129 ;GMRCO - The internal file number of the consult from File 123
130 ;GMRCORNP - Name of the person who actually 'Received' the consult
131 ;GMRCAD - Actual date time that consult was received into the service.
132 ;GMRCADUZ - array of alert recipients as chosen by user (by reference)
133 ; ARRAY(DUZ)=""
134 ;GMRCMT - array of comments if entered (by reference)
135 ; ARRAY(1)="FIRST LINE OF COMMENT"
136 ; ARRAY(2)="SECOND LINE OF COMMENT"
137 ;
138 ;Output:
139 ;GMRCERR - Error Condition Code: 0 = NO error, 1=error
140 ;GMRCERMS - Error message or null
141 ; returned as GMRCERR^GMRCERMS
142 ;
143 N DFN,GMRCSTS,GMRCNOW,GMRCERR,GMRCERMS
144 S GMRCERR=0,GMRCERMS="",GMRCNOW=$$NOW^XLFDT
145 S:$G(GMRCAD)="" GMRCAD=GMRCNOW
146 S:'$G(GMRCDUZ) GMRCDUZ=DUZ
147 S DFN=$P($G(^GMR(123,GMRCO,0)),"^",2) I DFN="" D Q GMRCERR_"^"_GMRCERMS
148 . S GMRCERR="1",GMRCERMS="Not A Valid Consult - File Not Found."
149 . D EXIT^GMRCGUIA
150 S GMRCSTS=8,GMRCA=8
151 D STATUS^GMRCP I $D(GMRCQUT) D EXIT^GMRCGUIA Q GMRCERR_"^"_GMRCERMS
152 I '$O(GMRCMT(0)) D AUDIT^GMRCP
153 I $O(GMRCMT(0)) D
154 . S DA=$$SETDA
155 . D SETCOM(.GMRCMT,GMRCDUZ)
156 D EN^GMRCHL7(DFN,GMRCO,"","","SC",GMRCORNP,"","","",GMRCAD)
157 D ;send alerts
158 . N TXT
159 . S TXT="Scheduled Consult: "_$$ORTX^GMRCAU(GMRCO)
160 . I $P(^GMR(123,+GMRCO,0),U,14) S GMRCADUZ($P(^(0),U,14))=""
161 . D MSG^GMRCP(DFN,TXT,GMRCO,63,.GMRCADUZ,0)
162 D EXIT^GMRCGUIA
163 Q GMRCERR_"^"_GMRCERMS
164DOCLIST(GMRCAR,GMRCDA,GMRCMED) ;return list of linked results
165 ; Input:
166 ; GMRCAR - array to return list, passed by reference
167 ; GMRCDA - ien from file 123
168 ; GMRCMED- 1 = include med results; 0 = only TIU docs
169 ;
170 ; Output:
171 ; GMRCAR - array in format
172 ; GMRCAR(0)=zero node of record
173 ; GMRCAR(50,1)="ien;global ref," e.g. 5;TIU(8925, or 3;MCAR(691,
174 ; GMRCAR(50,2)="ien;global ref,"
175 ;
176 I '$D(^GMR(123,GMRCDA,0)) Q
177 S GMRCAR(0)=^GMR(123,GMRCDA,0),$P(GMRCAR(0),U,20)=""
178 N RES,CNT S RES="",CNT=1
179 F S RES=$O(^GMR(123,GMRCDA,50,"B",RES)) Q:RES="" D
180 . I '$G(GMRCMED) Q:RES'["TIU(8925"
181 . S GMRCAR(50,CNT)=RES
182 . I RES["MCAR" D
183 .. N ARR,STR
184 .. D MEDLKUP^MCARUTL3(.ARR,+$P(RES,"MCAR(",2),+RES)
185 .. I '+ARR K GMRCAR(50,CNT) Q
186 .. S STR=$P(ARR,U,9)_U_$P(ARR,U,6)_$S($P(ARR,U,10):"^^^^^^^^1",1:"")
187 .. S GMRCAR(50,CNT)=GMRCAR(50,CNT)_U_STR
188 . S CNT=CNT+1
189 Q
Note: See TracBrowser for help on using the repository browser.