source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCSLM4.m@ 1688

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

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1GMRCSLM4 ;SLC/DCM - List Manager routine - Activity Log Detailed Display ;1/28/99 10:30
2 ;;3.0;CONSULT/REQUEST TRACKING;**4,12,15,22,50**;DEC 27,1997;Build 8
3 ;
4 ; This routine invokes IA #3138
5 ;
6ACTLOG(GMRCO) ;Print activity log
7 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="",GMRCCT=GMRCCT+1
8 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="Facility",GMRCCT=GMRCCT+1
9 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=" Activity"_$E(TAB,1,16)_"Date/Time/Zone"_$E(TAB,1,6)_"Responsible Person"_$E(TAB,1,2)_"Entered By",GMRCCT=GMRCCT+1
10 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=$$REPEAT^XLFSTR("-",79),GMRCCT=GMRCCT+1
11 N GMRCD,GMRCDA
12 S GMRCD=0 F S GMRCD=$O(^GMR(123,+GMRCO,40,"B",GMRCD)) Q:'GMRCD S GMRCDA="" F S GMRCDA=$O(^GMR(123,+GMRCO,40,"B",GMRCD,GMRCDA)) Q:'GMRCDA D BLDALN(GMRCO,GMRCDA)
13 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="",GMRCCT=GMRCCT+1
14 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="Note: TIME ZONE is local if not indicated",GMRCCT=GMRCCT+1
15 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="",GMRCCT=GMRCCT+1
16 Q
17 ;
18BLDALN(GMRCO,GMRCDA) ;Build Activity Log Lines for an activity
19 ; GMRCO= consult internal entry number
20 ; GMRCDA= activity internal entry number
21 N GMRCACT,GMRCSLN,XDT1,XDT2,FLG,LN,LINE,DASH,X,GMRCX,GMRCDEV,GMRCISIT
22 S GMRCDA(0)=^GMR(123,+GMRCO,40,GMRCDA,0)
23 S GMRCACT=$P(GMRCDA(0),"^",2)
24 S GMRCDA(2)=$G(^GMR(123,+GMRCO,40,GMRCDA,2))
25 S GMRCDA(3)=$G(^GMR(123,+GMRCO,40,GMRCDA,3))
26 I $D(^GMR(123,GMRCO,40,GMRCDA,2)) D
27 . S GMRCISIT=$P(^GMR(123,GMRCO,0),U,23) Q:'GMRCISIT
28 . S GMRCISIT=$$GET1^DIQ(4,GMRCISIT,.01)
29 D BLDLN1
30 D BLDLN2
31 D BLDCMTS
32 Q
33 ;
34BLDLN1 ;Build the first line for the activity
35 ;GMRCX is scratch pad variable
36 I $L($G(GMRCISIT)) D
37 . S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=GMRCISIT
38 . S GMRCCT=GMRCCT+1
39 S GMRCX=$P($G(^GMR(123.1,+GMRCACT,0)),"^",1)
40 S:'$L(GMRCX) GMRCX=GMRCACT_" action?"
41 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=" "_GMRCX
42 ;
43 ;Add to line for Printed to (action 22) when device name <13 characters
44 I GMRCACT=22 D
45 . S GMRCDEV=$$GET1^DIQ(3.5,+$P(GMRCDA(0),"^",8),.01)
46 . I '$L(GMRCDEV) S GMRCDEV=$P(GMRCDA(0),"^",8)
47 . I $L(GMRCDEV)<13 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=^TMP("GMRCR",$J,"DT",GMRCCT,0)_" "_GMRCDEV K GMRCDEV
48 ;
49 ;Add on generic fields that apply to every activity
50 ;Date/time of Actual Activity, Who's Responsible for Activity,
51 ;and Who entered activity
52 S X=$P(GMRCDA(0),"^",3) D REGDTM^GMRCU S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=$S($D(^TMP("GMRCR",$J,"DT",GMRCCT,0)):^TMP("GMRCR",$J,"DT",GMRCCT,0)_$E(TAB,1,25-$L(^(0)))_X,1:X)_$E(TAB)_$S($P(GMRCDA(2),"^",3)]"":$P(GMRCDA(2),"^",3),1:$E(TAB,1,3))
53 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=^TMP("GMRCR",$J,"DT",GMRCCT,0)_$E(TAB,1,45-$L(^(0)))_$S($P(GMRCDA(2),"^",2)]"":$E($P(GMRCDA(2),"^",2),1,17),$P(GMRCDA(0),"^",4):$E($P($G(^VA(200,$P(GMRCDA(0),"^",4),0)),"^"),1,17),1:$E(TAB,1,18))
54 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=^TMP("GMRCR",$J,"DT",GMRCCT,0)_$E(TAB,1,65-$L(^(0)))_$S($P(GMRCDA(2),"^")]"":$E($P(GMRCDA(2),"^"),1,17),$P(GMRCDA(0),"^",5):$E($P($G(^VA(200,$P(GMRCDA(0),"^",5),0)),"^"),1,17),1:$E(TAB,1,17))
55 S GMRCCT=GMRCCT+1
56 Q
57 ;
58BLDLN2 ;SECOND line for activity
59 N GMRCSLN S GMRCSLN="" ;saved SECOND line
60 ;
61 ; Check if the entry date and specified actual date are different
62 S XDT1=$P(GMRCDA(0),"^",1),XDT2=$P(GMRCDA(0),"^",3),GMRCX=0
63 S:XDT2>XDT1 X=XDT1,XDT1=XDT2,XDT2=X
64 S GMRCDIF=$$FMDIFF^XLFDT(XDT1,XDT2,3)
65 I $L(GMRCDIF) D
66 . I +$P(GMRCDIF," ",1)>0 S GMRCX=1 Q ;Check Days
67 . S GMRCDIF=$P(GMRCDIF," ",2)
68 . I +$P(GMRCDIF,":",1)>0 S GMRCX=1 Q ;Check Hours
69 . I +$P(GMRCDIF,":",2)>1 S GMRCX=1 Q ;Check Minutes
70 . Q
71 I GMRCX D
72 . S X=$P(GMRCDA(0),"^",1) D REGDTM^GMRCU
73 . ;S GMRCSLN=$E(GMRCSLN_TAB,1,15)_"(entered) "_X_$E(TAB)_$S($P(GMRCDA(2),"^",3)]"":$P(GMRCDA(2),"^",3),1:$E(TAB,1,3))
74 . S GMRCSLN=$E(GMRCSLN_TAB,1,15)_"(entered) "_X_$E(TAB,1,4)
75 . Q
76 ;
77 I $L(GMRCSLN) D S GMRCSLN=""
78 . S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=GMRCSLN
79 . S GMRCCT=GMRCCT+1
80 . Q
81 ;
82 ;Get local Incomplete Report and Complete result # for second line of action
83 I +$P(GMRCDA(0),"^",9) D
84 . I $P($P(GMRCDA(0),"^",9),";",2)["TIU" D Q
85 .. S GMRCSLN=$E(TAB,1,5)_"Note# "_+$P(GMRCDA(0),"^",9)
86 . I $P($P(GMRCDA(0),"^",9),";",2)["MCAR" D Q
87 .. N MCFILE S MCFILE=+$P($P(GMRCDA(0),"^",9),"MCAR(",2) Q:'MCFILE
88 .. N MCPRDT S MCPRDT=$$GET1^DIQ(MCFILE,+$P(GMRCDA(0),"^",9),.01)
89 .. Q:'$L(MCPRDT)
90 .. S GMRCSLN=$E(TAB,1,5)_"Medicine Procedure performed: "_MCPRDT
91 ;
92 ;Get remote Incomplete Report and Complete result # for second line of action
93 I +$P(GMRCDA(2),"^",4) D
94 . N GMRCRR S GMRCRR=$P(GMRCDA(2),"^",4)
95 . S GMRCSLN=$E(TAB,1,5)_"Remote "_$P(GMRCRR,";",3)_" #"_+$P(GMRCRR,";")_" from "_$P($G(^DIC(4,+$P(GMRCRR,";",4),0)),"^")
96 ;
97 ;If GMRCDEV is defined, then print the device name on the second line
98 I GMRCACT=22,$D(GMRCDEV) D
99 . S GMRCSLN=$E(TAB,1,5)_$E(GMRCDEV,1,17) K GMRCDEV
100 ;
101 ;Build line for forwarded to (action 17)
102 I GMRCACT=17 D
103 . S GMRCX=$S(+$P(GMRCDA(0),"^",6):$P($G(^GMR(123.5,+$P(GMRCDA(0),"^",6),0)),"^"),$P(GMRCDA(3),"^")]"":$P(GMRCDA(3),"^"),1:" ??")
104 . S GMRCSLN=$E(TAB,1,5)_GMRCX
105 I GMRCACT=25 D
106 . S GMRCX=""
107 . I $P(^GMR(123,+GMRCO,12),U,5)="F" D
108 .. S GMRCX="Previous remote service name: "
109 . S GMRCX=GMRCX_$S(+$P(GMRCDA(0),"^",6):$P($G(^GMR(123.5,+$P(GMRCDA(0),"^",6),0)),"^"),$P(GMRCDA(3),"^")]"":$P(GMRCDA(3),"^"),1:" ??")
110 . S GMRCSLN=$E(TAB,1,5)_GMRCX
111 I $L(GMRCSLN) D
112 . S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=GMRCSLN
113 . S GMRCCT=GMRCCT+1
114 . Q
115 ;
116 Q
117 ;
118BLDCMTS ;Build lines for Comment activity.
119 I GMRCACT=11 D BLDCMT Q
120 ;
121 ;Build lines for general comments on any activity
122 I $D(^GMR(123,+GMRCO,40,+GMRCDA,1)) D Q
123 . S LN=$O(^GMR(123,+GMRCO,40,+GMRCDA,1,0)) Q:'+LN
124 . ;Check for edited fields generated text with lines <75 characters
125 . I $G(^GMR(123,+GMRCO,40,+GMRCDA,1,LN,0))["EDITED FIELDS" D BLDCMT Q
126 . D BLDCMT
127 . Q
128 . I $L($G(^GMR(123,+GMRCO,40,+GMRCDA,1,LN,0)))'>75 D BLDCMT Q
129 . ;Use utilities for long line formating
130 . S FLG=1,LINE=" "
131 . D WPSET^GMRCUTIL("^GMR(123,+GMRCO,40,GMRCDA,1)","^TMP(""GMRCR"",$J,""DT"")",LINE,.GMRCCT,TAB,FLG)
132 . D BLDASH
133 . Q
134 Q
135 ;
136BLDCMT ;Build comment lines
137 ;DASH is 1 or "" for print dash line after comment
138 S LN=0
139 F S LN=$O(^GMR(123,+GMRCO,40,+GMRCDA,1,LN)) Q:'+LN D
140 . S ^TMP("GMRCR",$J,"DT",GMRCCT,0)=^GMR(123,+GMRCO,40,GMRCDA,1,LN,0) ;$P(^GMR(123,+GMRCO,40,GMRCDA,1,LN,0),"^",1)
141 . S GMRCCT=GMRCCT+1
142 . Q
143 ;D BLDASH
144 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="",GMRCCT=GMRCCT+1
145 Q
146 ;
147BLDASH ;Build separater line with dashes
148 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="",$P(^(0),"-",80)="",GMRCCT=GMRCCT+1
149 S ^TMP("GMRCR",$J,"DT",GMRCCT,0)="",GMRCCT=GMRCCT+1
150 Q
Note: See TracBrowser for help on using the repository browser.