[613] | 1 | RORRP007 ;HCIOFO/SG - RPC: LOGS & MESSAGES ; 11/4/05 8:56am
|
---|
| 2 | ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
|
---|
| 3 | ;
|
---|
| 4 | Q
|
---|
| 5 | ;
|
---|
| 6 | ;***** LOADS THE LOG INFORMATION INTO THE BUFFER
|
---|
| 7 | ;
|
---|
| 8 | ; IEN Log IEN
|
---|
| 9 | ;
|
---|
| 10 | ; ROR8DST Closed root of the destination buffer
|
---|
| 11 | ;
|
---|
| 12 | ; [[.]OFFSET] Offset in the buffer (modified by the function
|
---|
| 13 | ; if passed by reference)
|
---|
| 14 | ;
|
---|
| 15 | ; Return Values:
|
---|
| 16 | ; <0 Error code
|
---|
| 17 | ; 0 Ok
|
---|
| 18 | ; >0 Skip the log
|
---|
| 19 | ;
|
---|
| 20 | LOAD(IEN,ROR8DST,OFFSET) ;
|
---|
| 21 | N BUF,IENS,IENS1,RORBUF,RORMSG
|
---|
| 22 | S IENS=IEN_"," K RORBUF
|
---|
| 23 | D GETS^DIQ(798.7,IENS,RORFLDS,"EI","RORBUF","RORMSG")
|
---|
| 24 | Q:$G(DIERR) 1
|
---|
| 25 | ;--- Skip the 'Access Violation' activities
|
---|
| 26 | Q:$G(RORBUF(798.7,IENS,1,"I"))=6 2
|
---|
| 27 | S BUF="L^"_IEN
|
---|
| 28 | ;--- Activity (external)
|
---|
| 29 | S $P(BUF,"^",3)=$G(RORBUF(798.7,IENS,1,"E"))
|
---|
| 30 | ;--- Activity (internal)
|
---|
| 31 | S $P(BUF,"^",4)=$G(RORBUF(798.7,IENS,1,"I"))
|
---|
| 32 | ;--- Start Date/Time
|
---|
| 33 | S $P(BUF,"^",5)=$G(RORBUF(798.7,IENS,.01,"E"))
|
---|
| 34 | ;--- Contains messages
|
---|
| 35 | S $P(BUF,"^",6)=($O(^RORDATA(798.7,IEN,2,0))>0)
|
---|
| 36 | ;--- Job Number
|
---|
| 37 | S $P(BUF,"^",7)=$G(RORBUF(798.7,IENS,2,"E"))
|
---|
| 38 | ;--- End Date/Time
|
---|
| 39 | S $P(BUF,"^",8)=$G(RORBUF(798.7,IENS,5,"E"))
|
---|
| 40 | ;--- Number of Processed Patients
|
---|
| 41 | S $P(BUF,"^",9)=$G(RORBUF(798.7,IENS,6.01,"E"))
|
---|
| 42 | ;--- Number of Patients with Errors
|
---|
| 43 | S $P(BUF,"^",10)=$G(RORBUF(798.7,IENS,6.02,"E"))
|
---|
| 44 | ;--- Processing Rate
|
---|
| 45 | S $P(BUF,"^",11)=$G(RORBUF(798.7,IENS,6.03,"E"))
|
---|
| 46 | ;--- Task Number
|
---|
| 47 | S $P(BUF,"^",12)=$G(RORBUF(798.7,IENS,8,"I"))
|
---|
| 48 | ;--- Add the log descriptor to the output
|
---|
| 49 | S OFFSET=$G(OFFSET)+1,@ROR8DST@(OFFSET)=BUF
|
---|
| 50 | ;--- Load the list of registries
|
---|
| 51 | S IENS1=""
|
---|
| 52 | F S IENS1=$O(RORBUF(798.73,IENS1)) Q:IENS1="" D
|
---|
| 53 | . S BUF="R^"_$G(RORBUF(798.73,IENS1,.01,"I"))
|
---|
| 54 | . S $P(BUF,"^",3)=$G(RORBUF(798.73,IENS1,.01,"E"))
|
---|
| 55 | . ;--- Add the registry descriptor to the output
|
---|
| 56 | . S OFFSET=OFFSET+1,@ROR8DST@(OFFSET)=BUF
|
---|
| 57 | ;---Add the 'End of log' marker
|
---|
| 58 | S OFFSET=OFFSET+1,@ROR8DST@(OFFSET)="L^END"
|
---|
| 59 | Q 0
|
---|
| 60 | ;
|
---|
| 61 | ;***** RETURNS THE LOG INFORMATION
|
---|
| 62 | ; RPC: [ROR LOG INFO]
|
---|
| 63 | ;
|
---|
| 64 | ; .RORRES Reference to a local variable where the results
|
---|
| 65 | ; are returned to.
|
---|
| 66 | ;
|
---|
| 67 | ; LOGIEN Log IEN
|
---|
| 68 | ;
|
---|
| 69 | ; Return Values:
|
---|
| 70 | ;
|
---|
| 71 | ; A negative value of the first "^"-piece of the RORRES(0) indicates
|
---|
| 72 | ; an error (see the RPCSTK^RORERR procedure for more details).
|
---|
| 73 | ;
|
---|
| 74 | ; Otherwise, either 0 (the log does not exist) or 1 is returned
|
---|
| 75 | ; in the RORRES(0) and the subsequent nodes of the RORRES array
|
---|
| 76 | ; contain the log information.
|
---|
| 77 | ;
|
---|
| 78 | ; RORRES(0) 0 or 1
|
---|
| 79 | ;
|
---|
| 80 | ; RORRES(i) See description of the LOGLIST^RORRP007
|
---|
| 81 | ;
|
---|
| 82 | LOGINFO(RORRES,LOGIEN) ;
|
---|
| 83 | N RC,RORFLDS
|
---|
| 84 | ;--- Initialize the variables
|
---|
| 85 | K RORRES S RORRES(0)=0
|
---|
| 86 | S RORFLDS=".01;1;2;3*;5;6.01;6.02;6.03;8"
|
---|
| 87 | ;--- Check the parameters
|
---|
| 88 | S LOGIEN=+$G(LOGIEN) Q:LOGIEN'>0
|
---|
| 89 | Q:'$D(^RORDATA(798.7,LOGIEN,0))
|
---|
| 90 | ;--- Load the log information
|
---|
| 91 | S RC=$$LOAD(LOGIEN,"RORRES")
|
---|
| 92 | ;--- Check for the errors
|
---|
| 93 | I 'RC S RORRES(0)=1
|
---|
| 94 | E D:RC<0 RPCSTK^RORERR(.RORRES,RC)
|
---|
| 95 | Q
|
---|
| 96 | ;
|
---|
| 97 | ;***** RETURNS THE LIST OF LOGS
|
---|
| 98 | ; RPC: [ROR LOG GET LIST]
|
---|
| 99 | ;
|
---|
| 100 | ; .RESULTS Reference to a local variable where the results
|
---|
| 101 | ; are returned to.
|
---|
| 102 | ;
|
---|
| 103 | ; REGIEN Registry IEN
|
---|
| 104 | ;
|
---|
| 105 | ; [STDT] Start date (by default, from the earliest log)
|
---|
| 106 | ; [ENDT] End date (by default, to the latest log)
|
---|
| 107 | ;
|
---|
| 108 | ; Return Values:
|
---|
| 109 | ;
|
---|
| 110 | ; A negative value of the first "^"-piece of the RESULTS(0) indicates
|
---|
| 111 | ; an error (see the RPCSTK^RORERR procedure for more details).
|
---|
| 112 | ;
|
---|
| 113 | ; Otherwise, number of logs is returned in the @RESULTS@(0) and the
|
---|
| 114 | ; subsequent nodes of the RESULTS array contain the logs.
|
---|
| 115 | ;
|
---|
| 116 | ; @RESULTS@(0) Number of logs
|
---|
| 117 | ;
|
---|
| 118 | ; @RESULTS@(i) Log descriptor
|
---|
| 119 | ; ^01: "L"
|
---|
| 120 | ; ^02: Log IEN
|
---|
| 121 | ; ^03: Activity (external)
|
---|
| 122 | ; ^04: Activity (internal)
|
---|
| 123 | ; ^05: Start Date/Time (external)
|
---|
| 124 | ; ^06: Contains messages (0/1)
|
---|
| 125 | ; ^07: Job Number
|
---|
| 126 | ; ^08: End Date/Time (external)
|
---|
| 127 | ; ^09: Number of Processed Patients
|
---|
| 128 | ; ^10: Number of Patients with Errors
|
---|
| 129 | ; ^11: Processing Rate
|
---|
| 130 | ; ^12: Task Number (optional)
|
---|
| 131 | ;
|
---|
| 132 | ; @RESULTS@(...) Registry descriptor (optional)
|
---|
| 133 | ; ^01: "R"
|
---|
| 134 | ; ^02: Registry IEN
|
---|
| 135 | ; ^03: Registry Name
|
---|
| 136 | ;
|
---|
| 137 | ; @RESULTS@(i+n) 'End of log' marker
|
---|
| 138 | ; ^01: "L"
|
---|
| 139 | ; ^02: "END"
|
---|
| 140 | ;
|
---|
| 141 | LOGLIST(RESULTS,REGIEN,STDT,ENDT) ;
|
---|
| 142 | N CNT,DATE,IEN,RORFLDS,RC,XREF
|
---|
| 143 | D CLEAR^RORERR("LOGLIST^RORRP007",1)
|
---|
| 144 | S RORFLDS=".01;1;2;3*;5;6.01;6.02;6.03;8"
|
---|
| 145 | ;--- Check the parameters
|
---|
| 146 | I $G(REGIEN)'>0 D D RPCSTK^RORERR(.RESULTS,RC) Q
|
---|
| 147 | . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
|
---|
| 148 | S REGIEN=+REGIEN,STDT=$G(STDT)\1,ENDT=$G(ENDT)\1
|
---|
| 149 | S ENDT=$S(ENDT>0:$$FMADD^XLFDT(ENDT,1),1:9999999)
|
---|
| 150 | ;--- Initialize the variables
|
---|
| 151 | S XREF=$NA(^RORDATA(798.7,"ARD",REGIEN)),CNT=0
|
---|
| 152 | K RESULTS S RESULTS=$$ALLOC^RORTMP()
|
---|
| 153 | ;--- Browse through the logs
|
---|
| 154 | S CNT("L")=0,DATE=ENDT
|
---|
| 155 | F S DATE=$O(@XREF@(DATE),-1) Q:DATE="" Q:DATE<STDT D
|
---|
| 156 | . S IEN=""
|
---|
| 157 | . F S IEN=$O(@XREF@(DATE,IEN),-1) Q:IEN="" D
|
---|
| 158 | . . S RC=$$LOAD(IEN,RESULTS,.CNT)
|
---|
| 159 | . . S:'RC CNT("L")=CNT("L")+1
|
---|
| 160 | ;--- Number of logs
|
---|
| 161 | S @RESULTS@(0)=CNT("L")
|
---|
| 162 | Q
|
---|
| 163 | ;
|
---|
| 164 | ;***** RETURNS THE LIST OF MESSAGES
|
---|
| 165 | ; RPC: [ROR LOG GET MESSAGES]
|
---|
| 166 | ;
|
---|
| 167 | ; .RESULTS Reference to a local variable where the results
|
---|
| 168 | ; are returned to.
|
---|
| 169 | ;
|
---|
| 170 | ; LOGIEN IEN of the log
|
---|
| 171 | ;
|
---|
| 172 | ; Return Values:
|
---|
| 173 | ;
|
---|
| 174 | ; A negative value of the first "^"-piece of the RESULTS(0) indicates
|
---|
| 175 | ; an error (see the RPCSTK^RORERR procedure for more details).
|
---|
| 176 | ;
|
---|
| 177 | ; Otherwise, number of messages is returned in the RESULTS(0) and
|
---|
| 178 | ; the subsequent nodes of the RESULTS array contain the messages.
|
---|
| 179 | ;
|
---|
| 180 | ; @RESULTS@(0) Number of messages
|
---|
| 181 | ;
|
---|
| 182 | ; @RESULTS@(i) Message descriptor
|
---|
| 183 | ; ^01: "M"
|
---|
| 184 | ; ^02: Message IENS
|
---|
| 185 | ; ^03: Type (external)
|
---|
| 186 | ; ^04: Type (internal)
|
---|
| 187 | ; ^05: Date/Time (external)
|
---|
| 188 | ; ^06: Has Additional Info (0/1)
|
---|
| 189 | ; ^07: Patient Name
|
---|
| 190 | ; ^08: Patient IEN (DFN)
|
---|
| 191 | ;
|
---|
| 192 | ; @RESULTS@(i+1) Message
|
---|
| 193 | ; ^01: "T"
|
---|
| 194 | ; ^02: Message Text
|
---|
| 195 | ;
|
---|
| 196 | ; @RESULTS@(...) Line of the ADDITIONAL INFO text
|
---|
| 197 | ; ^01: "A"
|
---|
| 198 | ; ^02: Text
|
---|
| 199 | ;
|
---|
| 200 | ; @RESULTS@(i+n) 'End of message' marker
|
---|
| 201 | ; ^01: "M"
|
---|
| 202 | ; ^02: "END"
|
---|
| 203 | ;
|
---|
| 204 | MSGLIST(RESULTS,LOGIEN) ;
|
---|
| 205 | N CNT,I,IEN,IENS,RC,ROOT,RORBUF,RORMSG
|
---|
| 206 | D CLEAR^RORERR("MESSAGE^RORRP007",1)
|
---|
| 207 | ;--- Check the parameters
|
---|
| 208 | I $G(LOGIEN)'>0 D D RPCSTK^RORERR(.RESULTS,RC) Q
|
---|
| 209 | . S RC=$$ERROR^RORERR(-88,,,,"LOGIEN",$G(LOGIEN))
|
---|
| 210 | S LOGIEN=+LOGIEN
|
---|
| 211 | ;--- Initialize the variables
|
---|
| 212 | S ROOT=$$ROOT^DILFD(798.7,,1),CNT=0
|
---|
| 213 | K RESULTS S RESULTS=$$ALLOC^RORTMP()
|
---|
| 214 | ;--- Browse through the messages
|
---|
| 215 | S (CNT("M"),IEN)=0
|
---|
| 216 | F S IEN=$O(@ROOT@(LOGIEN,2,IEN)) Q:IEN'>0 D
|
---|
| 217 | . S IENS=IEN_","_LOGIEN_"," K RORBUF
|
---|
| 218 | . ;--- Load the message details
|
---|
| 219 | . D GETS^DIQ(798.74,IENS,".01;1;2;3;4","EI","RORBUF","RORMSG")
|
---|
| 220 | . Q:$G(DIERR)
|
---|
| 221 | . S BUF="M^"_IENS
|
---|
| 222 | . ;--- Type (external)
|
---|
| 223 | . S $P(BUF,"^",3)=$G(RORBUF(798.74,IENS,1,"E"))
|
---|
| 224 | . ;--- Type (Internal)
|
---|
| 225 | . S $P(BUF,"^",4)=$G(RORBUF(798.74,IENS,1,"I"))
|
---|
| 226 | . ;--- Date/Time
|
---|
| 227 | . S $P(BUF,"^",5)=$G(RORBUF(798.74,IENS,.01,"E"))
|
---|
| 228 | . ;--- Has Additional Info
|
---|
| 229 | . S $P(BUF,"^",6)=($D(RORBUF(798.74,IENS,4))>1)
|
---|
| 230 | . ;--- Patient Name
|
---|
| 231 | . S $P(BUF,"^",7)=$G(RORBUF(798.74,IENS,3,"E"))
|
---|
| 232 | . ;--- Patient IEN (DFN)
|
---|
| 233 | . S $P(BUF,"^",8)=$G(RORBUF(798.74,IENS,3,"I"))
|
---|
| 234 | . ;--- Add the descriptor to the output
|
---|
| 235 | . S CNT=CNT+1,@RESULTS@(CNT)=BUF
|
---|
| 236 | . ;--- Add the message text to the output
|
---|
| 237 | . S CNT=CNT+1,@RESULTS@(CNT)="T^"_$G(RORBUF(798.74,IENS,2,"E"))
|
---|
| 238 | . ;--- Append the ADDITIONAL INFO
|
---|
| 239 | . S I=0
|
---|
| 240 | . F S I=$O(RORBUF(798.74,IENS,4,I)) Q:'I D
|
---|
| 241 | . . S CNT=CNT+1,@RESULTS@(CNT)="A^"_RORBUF(798.74,IENS,4,I)
|
---|
| 242 | . ;---Add the 'End of message' marker
|
---|
| 243 | . S CNT=CNT+1,@RESULTS@(CNT)="M^END"
|
---|
| 244 | . S CNT("M")=CNT("M")+1
|
---|
| 245 | ;--- Number of messages
|
---|
| 246 | S @RESULTS@(0)=CNT("M")
|
---|
| 247 | Q
|
---|