[796] | 1 | TMGTICKL ;TMG/kst-Tickler Text Object Support Files;09/04/08
|
---|
| 2 | ;;1.0;TMG-LIB;**1**;09/05/08
|
---|
| 3 |
|
---|
| 4 | ;"---------------------------------------------------------------------------
|
---|
| 5 | ;"PUBLIC FUNCTIONS
|
---|
| 6 | ;"---------------------------------------------------------------------------
|
---|
| 7 | ;"GETMSG(DocIEN,WPArray) -- retrieve tickler message in document.
|
---|
| 8 | ;"FLMSG(IEN) -- return the first line of the tickler message
|
---|
| 9 | ;"SELTCKLS(SelArray) -- Browse tickler messages and return array of IEN's selected.
|
---|
| 10 | ;"REUSER -- Allow browsing for a set of Tickler files, and reassigning the target user
|
---|
| 11 | ;"REDATE -- Allow browsing for a set of Tickler files, and reassigning the due date
|
---|
| 12 | ;"BROWSE -- Browse tickler messages.
|
---|
| 13 | ;"$$SELTICKLERS(SelArray) -- Browse tickler messages and return array of IEN's selected.
|
---|
| 14 | ;"---------------------------------------------------------------------------
|
---|
| 15 | ;"PRIVATE FUNCTIONS
|
---|
| 16 | ;"---------------------------------------------------------------------------
|
---|
| 17 | ;"Dependencies:
|
---|
| 18 | ;" IENSelector^TMGUSRIF
|
---|
| 19 | ;" --> SELECT^%ZVEMKT
|
---|
| 20 | ;" --> ItrAInit^TMGITR
|
---|
| 21 | ;" Menu^TMGUSRIF
|
---|
| 22 | ;" ShowDIERR^TMGDEBUG
|
---|
| 23 |
|
---|
| 24 | FLMSG(IEN)
|
---|
| 25 | ;"Purpose: To return the first line of the tickler message
|
---|
| 26 | ;"NOTE: !!! DON'T REMOVE THIS FUNCTION. It is called by the computed field,
|
---|
| 27 | ;" FIRST LINE OF MESSAGE (field #5) in file 22705.5 (TICKLER FILE MESSAGES)
|
---|
| 28 | ;"Input: IEN: IEN in file 22705.5
|
---|
| 29 | ;"Output: Returns first line, or "" if null
|
---|
| 30 |
|
---|
| 31 | new result set result=""
|
---|
| 32 | new DocIEN set DocIEN=+$piece($get(^TMG(22705.5,IEN,0)),"^",4)
|
---|
| 33 | if DocIEN>0 do
|
---|
| 34 | . new WPArray
|
---|
| 35 | . new temp set temp=$$GETMSG(DocIEN,.WPArray)
|
---|
| 36 | . set result=$get(WPArray(1))
|
---|
| 37 | quit result
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | GETMSG(DocIEN,WPArray)
|
---|
| 41 | ;"Purpose: To retrieve the message for a tickler message in document.
|
---|
| 42 | ;"Note: It is expected that the Tickler text structure will be:
|
---|
| 43 | ;"
|
---|
| 44 | ;" ======= [TICKLER MESSGE] =======
|
---|
| 45 | ;" #DUE#: Put-DUE-DATE-here
|
---|
| 46 | ;" ================================
|
---|
| 47 | ;" Message: ...
|
---|
| 48 | ;"
|
---|
| 49 | ;" ================================
|
---|
| 50 | ;"
|
---|
| 51 | ;" And specifically, the key elements are:
|
---|
| 52 | ;" 1. Entire Tickler starts with [TICKLER MESSGE]
|
---|
| 53 | ;" 2. Message starts on line after ===========
|
---|
| 54 | ;" 3. Messge ends with line with ===========
|
---|
| 55 | ;" If no closing =========== found, message extends to end of document
|
---|
| 56 | ;"
|
---|
| 57 | ;"Input: DocIEN -- IEN in 8925
|
---|
| 58 | ;" WPArray -- PASS BY REFERENCE, an OUT PARAMETER. Returns message. Format:
|
---|
| 59 | ;" WPArray(1)='1st list'
|
---|
| 60 | ;" WPArray(2)='2nd line' etc...
|
---|
| 61 | ;"Result: 1 if found, 0 if not.
|
---|
| 62 |
|
---|
| 63 | new found,line set (found,line)=0
|
---|
| 64 | for set line=$order(^TIU(8925,DocIEN,"TEXT",line)) quit:(+line'>0)!found do
|
---|
| 65 | . set found=($get(^TIU(8925,DocIEN,"TEXT",line,0))["[TICKLER MESSGE]")
|
---|
| 66 | . if found do
|
---|
| 67 | . . new done set done=0
|
---|
| 68 | . . new lineText set lineText=""
|
---|
| 69 | . . for quit:done set line=$order(^TIU(8925,DocIEN,"TEXT",line)) quit:(+line'>0)!done do
|
---|
| 70 | . . . set done=$get(^TIU(8925,DocIEN,"TEXT",line,0))["====="
|
---|
| 71 | . . set done=0
|
---|
| 72 | . . new wpIndex set wpIndex=1
|
---|
| 73 | . . for set line=$order(^TIU(8925,DocIEN,"TEXT",line)) quit:(+line'>0)!done do
|
---|
| 74 | . . . set done=$get(^TIU(8925,DocIEN,"TEXT",line,0))["====="
|
---|
| 75 | . . . if done quit
|
---|
| 76 | . . . set WPArray(wpIndex)=$get(^TIU(8925,DocIEN,"TEXT",line,0))
|
---|
| 77 | . . . set wpIndex=wpIndex+1
|
---|
| 78 |
|
---|
| 79 | quit found
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | SELTICKLERS(SelArray)
|
---|
| 83 | ;"Browse tickler messages and return array of IEN's selected.
|
---|
| 84 | ;"Input: SelArray -- PASS BY REFERENCE. An OUT ARRAY.
|
---|
| 85 | ;"Output: SelArray is filled as follows:
|
---|
| 86 | ;" SelArray(IEN)=DispLineNumber
|
---|
| 87 | ;" SelArray(IEN)=DispLineNumber
|
---|
| 88 | ;"Results: 1 if aborted, otherwise 0
|
---|
| 89 |
|
---|
| 90 | new abort set abort=0
|
---|
| 91 | kill SelArray
|
---|
| 92 | new Menu,usrChoice
|
---|
| 93 | set Menu(0)="Pick Display Order for Selector"
|
---|
| 94 | set Menu(1)="User Name; Status; Due Date; Patient Name"_$C(9)_"3;2;1;.01^20;10;15;20"
|
---|
| 95 | set Menu(2)="Patient Name; Status; User Name; Due Date"_$C(9)_".01;2;3;1^20;10;20;15"
|
---|
| 96 | set Menu(3)="Due Date; Patient Name; Status; User Name"_$C(9)_"1;.01;2;3^15;20;10;20"
|
---|
| 97 | set Menu(4)="Note Date; Patient Name; Status; User Name"_$C(9)_"4;.01;2;3^15;20;10;15"
|
---|
| 98 | set Menu(5)="Status; Due Date; Patient Name; User Name"_$C(9)_"2;1;.01;3^10;15;20;20"
|
---|
| 99 |
|
---|
| 100 | set usrChoice=$$Menu^TMGUSRIF(.Menu,3)
|
---|
| 101 | if usrChoice="^" goto SELTDONE
|
---|
| 102 |
|
---|
| 103 | new fields,widths
|
---|
| 104 | set fields=$piece(usrChoice,"^",1)
|
---|
| 105 | set widths=$piece(usrChoice,"^",2)
|
---|
| 106 |
|
---|
| 107 | new IENArray
|
---|
| 108 | new IEN set IEN=0
|
---|
| 109 | for set IEN=$order(^TMG(22705.5,IEN)) quit:(+IEN'>0) set IENArray(IEN)=""
|
---|
| 110 | new Header set Header="Pick Tickler Messages. Press <ESC><ESC> when done."
|
---|
| 111 | do IENSelector^TMGUSRIF("IENArray","SelArray",22705.5,fields,widths,Header,fields)
|
---|
| 112 |
|
---|
| 113 | new % set %=1
|
---|
| 114 | write "Review tickler messages for selected entries?" do YN^DICN write !
|
---|
| 115 | if %=-1 set abort=1 goto SELTDONE
|
---|
| 116 | if %=1 do DispTicklers(.SelArray)
|
---|
| 117 |
|
---|
| 118 | SELTDONE
|
---|
| 119 | quit abort
|
---|
| 120 |
|
---|
| 121 |
|
---|
| 122 | BROWSE
|
---|
| 123 | ;"Purpose: To browse tickler messages
|
---|
| 124 | ;"Results: none
|
---|
| 125 |
|
---|
| 126 | new SelArray,abort
|
---|
| 127 | write !
|
---|
| 128 | set abort=$$SELTICKLERS(.SelArray)
|
---|
| 129 |
|
---|
| 130 | write "Goodbye.",!
|
---|
| 131 | quit
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 | DispTicklers(IENArray)
|
---|
| 135 | ;"Purpose: Display a list of tickler messages
|
---|
| 136 | ;"Input: IENArray. PASS BY REFERENCE. format:
|
---|
| 137 | ;" IENArray(IEN)=""
|
---|
| 138 | ;" IENArray(IEN)=""
|
---|
| 139 | ;"Results: None
|
---|
| 140 |
|
---|
| 141 | new count set count=0
|
---|
| 142 | new abort set abort=0
|
---|
| 143 | new TklIEN set TklIEN=""
|
---|
| 144 | for set TklIEN=$order(SelArray(TklIEN)) quit:(TklIEN="")!abort do
|
---|
| 145 | . set count=count+1
|
---|
| 146 | . write "----------------------------------",!
|
---|
| 147 | . write "STATUS: ",$$GET1^DIQ(22705.5,TklIEN,2),!
|
---|
| 148 | . write "DUE DATE: ",$$GET1^DIQ(22705.5,TklIEN,1),!
|
---|
| 149 | . write "PATIENT: ",$$GET1^DIQ(22705.5,TklIEN,.01),!
|
---|
| 150 | . write "DOCUMENT: ",$$GET1^DIQ(22705.5,TklIEN,.05)," (#",$$GET1^DIQ(22705.5,TklIEN,.05,"I"),")",!
|
---|
| 151 | . write "DOC DATE: ",$$GET1^DIQ(22705.5,TklIEN,4),!
|
---|
| 152 | . write "USER: ",$$GET1^DIQ(22705.5,TklIEN,3),!
|
---|
| 153 | . write "MESSAGE (1st line):",!," ",$$GET1^DIQ(22705.5,TklIEN,5),!
|
---|
| 154 | . if count#3=0 do
|
---|
| 155 | . . new temp read "Press Enter to Continue",temp:$get(DTIME,3600),!
|
---|
| 156 | . . set abort=(temp="^")
|
---|
| 157 |
|
---|
| 158 | if count=0 write "(No items to display.)",!
|
---|
| 159 | write !
|
---|
| 160 | quit
|
---|
| 161 |
|
---|
| 162 |
|
---|
| 163 | REUSER ;"Reassign Tickler File Recipient User
|
---|
| 164 | ;"Purpose: to allow browsing for a set of Tickler files, and reassigning the target user
|
---|
| 165 | ;"Result: none
|
---|
| 166 |
|
---|
| 167 | new numErrors set numErrors=0
|
---|
| 168 | new NumProcessed set NumProcessed=0
|
---|
| 169 |
|
---|
| 170 | write !," -= REASSIGN RECIPIENT USER FOR TICKLER MESSAGES =-",!,!
|
---|
| 171 | write "You will next be able to select tickler messages to reassign.",!
|
---|
| 172 | write "Note: Only change tickler messages with a PENDING status.",!
|
---|
| 173 | write " Changing others will have no effect.",!,!
|
---|
| 174 | do PressToCont^TMGUSRIF
|
---|
| 175 |
|
---|
| 176 | if $$SELTICKLERS(.SelArray)=1 goto REUDONE
|
---|
| 177 |
|
---|
| 178 | if $data(SelArray)=0 goto REUDONE
|
---|
| 179 | new % set %=2
|
---|
| 180 | write "Pick new recipient user for the selected tickler messages?"
|
---|
| 181 | do YN^DICN write !
|
---|
| 182 | if %'=1 goto REUDONE
|
---|
| 183 |
|
---|
| 184 | new DIC set DIC=200
|
---|
| 185 | set DIC(0)="MAEQ"
|
---|
| 186 | set DIC("A")="Select new RECIPIENT USER: "
|
---|
| 187 | do ^DIC write !
|
---|
| 188 | if +Y'>0 goto REUDONE
|
---|
| 189 |
|
---|
| 190 | new IEN set IEN=""
|
---|
| 191 | for set IEN=$order(SelArray(IEN)) quit:(IEN="") do
|
---|
| 192 | . set NumProcessed=NumProcessed+1
|
---|
| 193 | . new TMGFDA,TMGMSG
|
---|
| 194 | . set TMGFDA(22705.5,IEN_",",3)=+Y
|
---|
| 195 | . do FILE^DIE("","TMGFDA","TMGMSG")
|
---|
| 196 | . if $data(TMGMSG("DIERR"))>0 do
|
---|
| 197 | . . do ShowDIERR^TMGDEBUG(.TMGMSG)
|
---|
| 198 | . . set numErrors=numErrors+1
|
---|
| 199 |
|
---|
| 200 | REUDONE
|
---|
| 201 | write !,NumProcessed," tickler message file entries processed.",!
|
---|
| 202 | if NumProcessed>0 write numErrors," errors encountered.",!
|
---|
| 203 | write "Goodbye",!
|
---|
| 204 | quit
|
---|
| 205 |
|
---|
| 206 |
|
---|
| 207 | REDATE ;"Reassign Due Dates for Tickler File
|
---|
| 208 | ;"Purpose: to allow browsing for a set of Tickler files, and reassigning due date
|
---|
| 209 | ;"Result: none
|
---|
| 210 |
|
---|
| 211 | write !," -= REASSIGN DUE DATE FOR TICKLER MESSAGES =-",!,!
|
---|
| 212 | write "You will next be able to select tickler messages to change.",!
|
---|
| 213 | write "Note: Only change tickler messages with a PENDING status.",!
|
---|
| 214 | write " Changing others will have no effect.",!,!
|
---|
| 215 | do PressToCont^TMGUSRIF
|
---|
| 216 |
|
---|
| 217 | if $$SELTICKLERS(.SelArray)=1 goto REDDONE
|
---|
| 218 |
|
---|
| 219 | new numErrors set numErrors=0
|
---|
| 220 | new NumProcessed set NumProcessed=0
|
---|
| 221 | if $data(SelArray)=0 goto REUDONE
|
---|
| 222 | new % set %=2
|
---|
| 223 | write "Pick new DUE DATE for the selected tickler messages?"
|
---|
| 224 | do YN^DICN write !
|
---|
| 225 | if %'=1 goto REDDONE
|
---|
| 226 |
|
---|
| 227 | new DIR,X,Y
|
---|
| 228 | set DIR(0)="DO",DIR("A")="Enter new DUE DATE (^ to abort)"
|
---|
| 229 | do ^DIR write !
|
---|
| 230 | if +Y'>0 goto REDDONE
|
---|
| 231 |
|
---|
| 232 | new IEN set IEN=""
|
---|
| 233 | for set IEN=$order(SelArray(IEN)) quit:(IEN="") do
|
---|
| 234 | . set NumProcessed=NumProcessed+1
|
---|
| 235 | . new TMGFDA,TMGMSG
|
---|
| 236 | . set TMGFDA(22705.5,IEN_",",1)=+Y
|
---|
| 237 | . do FILE^DIE("","TMGFDA","TMGMSG")
|
---|
| 238 | . if $data(TMGMSG("DIERR"))>0 do
|
---|
| 239 | . . do ShowDIERR^TMGDEBUG(.TMGMSG)
|
---|
| 240 | . . set numErrors=numErrors+1
|
---|
| 241 |
|
---|
| 242 | REDDONE
|
---|
| 243 | write !,NumProcessed," tickler message file entries processed.",!
|
---|
| 244 | if NumProcessed>0 write numErrors," errors encountered.",!
|
---|
| 245 | write "Goodbye",!
|
---|
| 246 | quit |
---|