source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIU189.m@ 1361

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

initial load of WorldVistAEHR

File size: 8.9 KB
RevLine 
[613]1TIU189 ;BPFO/JML - UNCOSIGNED WITH NO COSIGNER ; 5/19/05 12:33pm
2 ;;1.0;Text Integration Utilities;**189**;JUN 20, 1997
3 ;
4 ; This report can be run from the menu option
5 ; TIUMEC - Missing Expected Cosignor Report found under the
6 ; TIU MAIN MENU MGR option. It can also be added to Taskman with
7 ; the entry point NITE^TIU189. This option will look for problems
8 ; in the previous 30 days and upon finding any will send an email to
9 ; the mail group G.TIU MIS ALERTS.
10 ;
11MENU ; ENTRY POINT FOR RUNNING FROM MENU WITH PROMPTS
12 N TIUIEN,TIUDT,TIUDTS,TIUPDT,TIUJ,TIUPIEN,TIUPN,TIURES,TIU0,TIU12,TIUEDT,TIUCS,TIUAUTH,TIUTITLE
13 N TIUPAR,DFN,TIUPCO,TIURTYP,TIUSIEN,TIUSERV,TIUJIEN,TIUJTITL,NOCOL,DIR,TIUAUTHI,TIUQUIT,TIUPAGE,TIUOFF
14 N %ZIS,POP,NOW,Y,COSTAT,X1,X2
15 S TIUJ=$J,TIUCS=$$COSTAT()
16 D DTRANGE^TIUADCL(.TIUDTS)
17 Q:'$D(TIUDTS("BEGDT"))!('$D(TIUDTS("ENDDT")))
18 S X1=TIUDTS("BEGDT"),X2=-1 D C^%DTC
19 S TIUDT=X+.99999999,TIUEDT=TIUDTS("ENDDT")
20 D DEV
21 Q:$G(POP)>0
22 I $G(IO("Q"))=1 D Q
23 .N ZTRTN,ZTDESC,ZTSAVE
24 .S ZTRTN="MENU1^TIU189",ZTDESC="Uncosigned Problem Report"
25 .S ZTSAVE("TIU*")=""
26 .D ^%ZTLOAD K IO("Q")
27MENU1 ; TASK POINT FOR MENU ENTRY
28 F S TIUDT=$O(^TIU(8925,"F",TIUDT)) Q:TIUDT=""!(TIUDT>TIUEDT) D
29 .S TIUIEN=""
30 .F S TIUIEN=$O(^TIU(8925,"F",TIUDT,TIUIEN)) Q:TIUIEN="" D
31 ..S TIUPDT=$$CHECK(TIUIEN)
32 ..I TIUPDT>0 D SET(TIUJ,TIUPDT,TIUIEN)
33 D REPORT
34 K ^TMP(TIUJ)
35 D ^%ZISC
36 Q
37 ;
38REPORT ; ENTRIES WRITTEN TO REPORT
39 U IO
40 I $G(IO("Q"))'=1,IOST["C-",TIURTYP'="NOCOL" W @IOF
41 I '$D(^TMP(TIUJ,"TIU189")) D Q
42 .D TITLE
43 .W !!,"No Problem Notes Found."
44 .I $G(IO("Q"))='1,IOST["C-" D PAUSE^VALM1
45 S TIUQUIT=0
46 D HEAD
47 S TIUDT=""
48 F S TIUDT=$O(^TMP(TIUJ,"TIU189","PROBLEM",TIUDT)) Q:TIUDT=""!(TIUQUIT) D
49 .S TIUIEN=""
50 .F S TIUIEN=$O(^TMP(TIUJ,"TIU189","PROBLEM",TIUDT,TIUIEN)) Q:TIUIEN=""!(TIUQUIT) D
51 ..D PAGE
52 ..Q:TIUQUIT
53 ..S TIU0=$G(^TIU(8925,TIUIEN,0)),TIU12=$G(^TIU(8925,TIUIEN,12))
54 ..S Y=$P(TIU12,"^") D DD^%DT S TIUEDT=Y
55 ..S DFN=$P(TIU0,"^",2) D DEM^VADPT
56 ..S TIUSSN=$E($P(VADM(2),"^"),6,9)
57 ..S TIULNAME=$P(VADM(1),","),TIUFNAME=$P(VADM(1),",",2),TIUMNAME=$P(TIUFNAME," ",2)
58 ..S TIUPN=$E(TIUFNAME)_$E(TIUMNAME)_$E(TIULNAME)_TIUSSN
59 ..S TIUAUTH=$E($$GET1^DIQ(8925,TIUIEN_",",1202),1,15)
60 ..S TIUAUTHI=$P($G(^TIU(8925,TIUIEN,12)),"^",2)
61 ..S TIUTITLE=$E($$GET1^DIQ(8925,TIUIEN_",",.01),1,15)
62 ..S TIUSIEN=$$GET1^DIQ(200,TIUAUTHI_",",29,"I"),TIUSERV=$$GET1^DIQ(49,TIUSIEN_",",.01)
63 ..S TIUJIEN=$$GET1^DIQ(200,TIUAUTHI_",",8,"I"),TIUJTITL=$$GET1^DIQ(3.1,TIUJIEN_",",.01)
64 ..S TIUPAR=^TMP(TIUJ,"TIU189","PROBLEM",TIUDT,TIUIEN)
65 ..I TIURTYP="COL80" D
66 ...W !,TIUPN,?9,TIUEDT,?32,$E(TIUTITLE,1,20),?53,$E(TIUAUTH,1,15),?69,"~",TIUIEN
67 ...D TIUPAR(TIUPAR)
68 ..I TIURTYP="COL132" D
69 ...W !,TIUPN,?9,TIUEDT,?32,$E(TIUTITLE,1,24),?58,$E(TIUAUTH,1,23),?83,$E(TIUSERV,1,16)
70 ...W ?101,$E(TIUJTITL,1,16),?119,"~",TIUIEN
71 ...D TIUPAR(TIUPAR)
72 ..I TIURTYP="NOCOL" D
73 ...W !,TIUPN,"^",TIUEDT,"^",TIUTITLE,"^",TIUAUTH,"^",TIUSERV,"^",TIUJTITL,"^",TIUIEN
74 ...W "^",$P(TIUPAR,"^",1),"^",$P(TIUPAR,"^",2),"^",$P(TIUPAR,"^",3)
75 I $G(IO("Q"))'=1,IOST["C-",TIURTYP'="NOCOL" D PAUSE^VALM1 W @IOF
76 Q
77 ;
78TIUPAR(TIUPAR) ;
79 I TIUPAR'="" D
80 .W !,?12,"Parent Document Type: "_$E($P(TIUPAR,"^",1),1,44)
81 .W !,?12,"Parent Document Date: "_$P(TIUPAR,"^",2)
82 .W !,?12,"Parent Document Cosigner: "_$P(TIUPAR,"^",3)
83 Q
84 ;
85NITE ; ENTRY POINT FOR RUNNING IN TASKMAN
86 N TIUIEN,TIUDT,TIUDTS,TIUPDT,TIUJ,TIUPIEN,TIUPN,TIURES,TIU0,TIU12
87 N TIUEDT,TIUAUTH,TIUTITLE,TIUSSN
88 N %ZIS,POP,NOW,Y,COSTAT,X
89 S TIUJ=$J,TIUCS=$$COSTAT()
90 D NOW^%DTC S X1=X,X2=-31 D C^%DTC
91 S TIUDT=X+.99999999
92 F S TIUDT=$O(^TIU(8925,"F",TIUDT)) Q:TIUDT="" D
93 .S TIUIEN=""
94 .F S TIUIEN=$O(^TIU(8925,"F",TIUDT,TIUIEN)) Q:TIUIEN="" D
95 ..S TIUPDT=$$CHECK(TIUIEN)
96 ..I TIUPDT>0 D SET(TIUJ,TIUPDT,TIUIEN)
97 D MAIL
98 K ^TMP(TIUJ)
99 D ^%ZISC
100 Q
101 ;
102SET(TIUJ,TIUDT,TIUIEN) ; TEMP STORAGE OF DATA
103 N TIUTYP,TIUPIEN,TIUPIEN,TIUPDT,TIUPTYP,TIUPCO,TIUPAR,Y
104 S TIUPAR=""
105 S TIUTYP=$P(^TIU(8925,TIUIEN,0),"^"),TIUTYP=$P(^TIU(8925.1,TIUTYP,0),"^")
106 I TIUTYP="ADDENDUM" D
107 .S TIUPIEN=$P(^TIU(8925,TIUIEN,0),"^",6)
108 .Q:+TIUPIEN'>0
109 .Q:'$D(^TIU(8925,TIUPIEN))
110 .S Y=$P(^TIU(8925,TIUPIEN,12),"^") D DD^%DT S TIUPDT=Y
111 .S TIUPTYP=$P(^TIU(8925,TIUPIEN,0),"^"),TIUPTYP=$P(^TIU(8925.1,TIUPTYP,0),"^")
112 .S TIUPCO=$P($G(^TIU(8925,TIUPIEN,12)),"^",8)
113 .S TIUPCO=$$GET1^DIQ(200,TIUPCO_",",.01)
114 .S TIUPAR=TIUPTYP_"^"_TIUPDT_"^"_TIUPCO
115 S ^TMP(TIUJ,"TIU189","PROBLEM",TIUDT,TIUIEN)=TIUPAR
116 Q
117 ;
118CHECK(TIUIEN) ; CHECK IF THIS IS A PROBLEM NOTE
119 S TIURES=0
120 I $P($G(^TIU(8925,TIUIEN,0)),"^",5)=TIUCS D
121 .S TIU12=$G(^TIU(8925,TIUIEN,12))
122 .I $P(TIU12,"^",8)<1 S TIURES=$P(TIU12,"^")
123 Q TIURES
124 ;
125MAIL ; SEND MAIL TO MAIL GROUP
126 N XMDUZ,XMSUBJ,XMTO,DFN,VADM,TIUCNT,TIUAUTE,TIUAUTI,TIUATITL,TIUPIEN,TIUPTYPE,TIUPCO,TIUPAR
127 N TIULNAME,TIUFNAME,TIUMNAME,TIUSIEN,TIUJIEN,TIUASERV,TIUATITL,TIUAUTI
128 S XMDUZ="",XMSUBJ="MISSING EXPECTED COSIGNER"
129 K ^TMP(TIUJ,"MAIL")
130 S TIUDT="",TIUCNT=1
131 F S TIUDT=$O(^TMP(TIUJ,"TIU189","PROBLEM",TIUDT)) Q:TIUDT="" D
132 .S TIUIEN=""
133 .F S TIUIEN=$O(^TMP(TIUJ,"TIU189","PROBLEM",TIUDT,TIUIEN)) Q:TIUIEN="" D
134 ..S TIU0=$G(^TIU(8925,TIUIEN,0)),TIU12=$G(^TIU(8925,TIUIEN,12))
135 ..S Y=$P(TIU12,"^") D DD^%DT S TIUEDT=Y
136 ..S TIUTITLE=$$GET1^DIQ(8925,TIUIEN_",",.01)
137 ..S DFN=$P(TIU0,"^",2) D DEM^VADPT
138 ..S TIUSSN=$E($P(VADM(2),"^"),6,9)
139 ..S TIULNAME=$P(VADM(1),","),TIUFNAME=$P(VADM(1),",",2),TIUMNAME=$P(TIUFNAME," ",2)
140 ..S TIUPN=$E(TIUFNAME)_$E(TIUMNAME)_$E(TIULNAME)_TIUSSN
141 ..S TIUAUTE=$$GET1^DIQ(8925,TIUIEN_",",1202)
142 ..S TIUAUTI=$P($G(^TIU(8925,TIUIEN,12)),"^",2)
143 ..S TIUSIEN=$$GET1^DIQ(200,TIUAUTI_",",29,"I"),TIUASERV=$$GET1^DIQ(49,TIUSIEN_",",.01)
144 ..S TIUJIEN=$$GET1^DIQ(200,TIUAUTI_",",8,"I"),TIUATITL=$$GET1^DIQ(3.1,TIUJIEN_",",.01)
145 ..S TIUPAR=$G(^TMP(TIUJ,"TIU189","PROBLEM",TIUDT,TIUIEN))
146 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT,0)="PATIENT: "_TIUPN
147 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+1,0)="ENTRY DATE/TIME: "_TIUEDT
148 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+2,0)="NOTE TITLE: "_TIUTITLE
149 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+3,0)="AUTHOR: "_TIUAUTE
150 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+4,0)="AUTHOR'S SERVICE/SECTION: "_TIUASERV
151 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+5,0)="AUTHOR'S TITLE: "_TIUATITL
152 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+6,0)="NOTE IEN: `"_TIUIEN
153 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+7,0)="PARENT DOCUMENT TYPE: "_$P(TIUPAR,"^",1)
154 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+8,0)="PARENT DOCUMENT ENTRY DATE: "_$P(TIUPAR,"^",2)
155 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+9,0)="PARENT DOCUMENT COSIGNER: "_$P(TIUPAR,"^",3)
156 ..S ^TMP(TIUJ,"TIU189","MAIL",TIUCNT+10,0)=""
157 ..S TIUCNT=TIUCNT+11
158 S XMTO("G.TIU MIS ALERTS")=""
159 D SENDMSG^XMXAPI(XMDUZ,XMSUBJ,"^TMP($J,""TIU189"",""MAIL"")",.XMTO)
160 Q
161 ;
162HEAD ; HEADER FOR REPORT
163 I TIURTYP'="NOCOL" W @IOF D TITLE
164 I TIURTYP="COL80" D Q
165 .W !,"Patient",?9,"Entry Date/Time",?32,"Title",?53,"Author",?69,"Note IEN"
166 .W !,"-------",?9,"---------------",?32,"-----",?53,"------",?69,"--------"
167 .W !
168 I TIURTYP="COL132" D Q
169 .W !,"Patient",?9,"Entry Date/Time",?32,"Title",?58,"Author",?83,"Service/Section",?101,"Job Title",?119,"Note IEN"
170 .W !,"-------",?9,"---------------",?32,"-----",?58,"------",?83,"---------------",?101,"---------",?119,"--------"
171 .W !
172 I TIURTYP="NOCOL" D
173 .I +$G(NOCOL)=0 D
174 ..S NOCOL=1
175 ..W "Patient Name^Entry Date/Time^Title^Author^Service/Section^Job Title^Note IEN^Parent Document Type^"
176 ..W "Parent Document Date^Parent Document Cosigner"
177 Q
178 ;
179TITLE ;
180 W !,?TIUOFF,"NOTES WITH 'UNCOSIGNED' STATUS THAT DON'T HAVE AN EXPECTED COSIGNER",!!
181 Q
182 ;
183PAGE ; HANDLE PAGING FOR TERMINAL OR PRINTER
184 Q:TIURTYP="NOCOL"
185 I $Y>(IOSL-8) D
186 .I IOST["C-" D PAUSE^VALM1 I $G(DIRUT)=1 S TIUQUIT=1 Q
187 .D HEAD
188 Q
189 ;
190COSTAT() ; GET UNCOSIGNED STATUS
191 Q $O(^TIU(8925.6,"B","UNCOSIGNED",""))
192 ;
193DEV ; PROMPT FOR OUTPUT DEVICE
194 N DIR,DIRUT
195 S DIR(0)="SO^1:80 column;2:132 column;3:Table Export"
196 S DIR("L",1)="Please select an output format from the following:"
197 S DIR("L",2)=""
198 S DIR("L",3)="1 - 80 column standard print [STANDARD]"
199 S DIR("L",4)="2 - 132 column standard print"
200 S DIR("L")="3 - Table without headers (export to another application)"
201 S DIR("B")=1
202 D ^DIR I $D(DIRUT)!(Y>3) S POP=1 Q
203 S TIURTYP=$S(Y=1:"COL80",Y=2:"COL132",Y=3:"NOCOL")
204 I TIURTYP="COL132" D MESS132
205 I TIURTYP="NOCOL" D MESSNCOL
206 S TIUOFF=$S(TIURTYP="COL80":5,TIURTYP="COL132":31,1:5)
207 S %ZIS="Q" D ^%ZIS
208 Q
209 ;
210MESS132 ; Instructional message if printing 132 column version
211 W !!,"You must configure your terminal so that it will support 132 character"
212 W !,"emulation and reply 132 to the right margin setting if using HOME"
213 W !,"as the device."
214 W !,""
215 Q
216 ;
217MESSNCOL ; Instructional message if printing "^" delimited version
218 W !!,"OK, you have selected a TABLE output format."
219 W !,"You must use your personal computer's terminal emulation"
220 W !,"to capture the output:"
221 W !,""
222 W !," 1. Enter at the DEVICE: HOME// prompt "";250;99999999"" "
223 W !," and do not hit the enter key."
224 W !," 2. Open a capture file within your terminal emulation program."
225 W !," 3. Hit enter to start the down load."
226 W !," 4. Close the capture file when the output stops."
227 W !,""
228 Q
Note: See TracBrowser for help on using the repository browser.