RORRP007 ;HCIOFO/SG - RPC: LOGS & MESSAGES ; 11/4/05 8:56am
;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
;
Q
;
;***** LOADS THE LOG INFORMATION INTO THE BUFFER
;
; IEN Log IEN
;
; ROR8DST Closed root of the destination buffer
;
; [[.]OFFSET] Offset in the buffer (modified by the function
; if passed by reference)
;
; Return Values:
; <0 Error code
; 0 Ok
; >0 Skip the log
;
LOAD(IEN,ROR8DST,OFFSET) ;
N BUF,IENS,IENS1,RORBUF,RORMSG
S IENS=IEN_"," K RORBUF
D GETS^DIQ(798.7,IENS,RORFLDS,"EI","RORBUF","RORMSG")
Q:$G(DIERR) 1
;--- Skip the 'Access Violation' activities
Q:$G(RORBUF(798.7,IENS,1,"I"))=6 2
S BUF="L^"_IEN
;--- Activity (external)
S $P(BUF,"^",3)=$G(RORBUF(798.7,IENS,1,"E"))
;--- Activity (internal)
S $P(BUF,"^",4)=$G(RORBUF(798.7,IENS,1,"I"))
;--- Start Date/Time
S $P(BUF,"^",5)=$G(RORBUF(798.7,IENS,.01,"E"))
;--- Contains messages
S $P(BUF,"^",6)=($O(^RORDATA(798.7,IEN,2,0))>0)
;--- Job Number
S $P(BUF,"^",7)=$G(RORBUF(798.7,IENS,2,"E"))
;--- End Date/Time
S $P(BUF,"^",8)=$G(RORBUF(798.7,IENS,5,"E"))
;--- Number of Processed Patients
S $P(BUF,"^",9)=$G(RORBUF(798.7,IENS,6.01,"E"))
;--- Number of Patients with Errors
S $P(BUF,"^",10)=$G(RORBUF(798.7,IENS,6.02,"E"))
;--- Processing Rate
S $P(BUF,"^",11)=$G(RORBUF(798.7,IENS,6.03,"E"))
;--- Task Number
S $P(BUF,"^",12)=$G(RORBUF(798.7,IENS,8,"I"))
;--- Add the log descriptor to the output
S OFFSET=$G(OFFSET)+1,@ROR8DST@(OFFSET)=BUF
;--- Load the list of registries
S IENS1=""
F S IENS1=$O(RORBUF(798.73,IENS1)) Q:IENS1="" D
. S BUF="R^"_$G(RORBUF(798.73,IENS1,.01,"I"))
. S $P(BUF,"^",3)=$G(RORBUF(798.73,IENS1,.01,"E"))
. ;--- Add the registry descriptor to the output
. S OFFSET=OFFSET+1,@ROR8DST@(OFFSET)=BUF
;---Add the 'End of log' marker
S OFFSET=OFFSET+1,@ROR8DST@(OFFSET)="L^END"
Q 0
;
;***** RETURNS THE LOG INFORMATION
; RPC: [ROR LOG INFO]
;
; .RORRES Reference to a local variable where the results
; are returned to.
;
; LOGIEN Log IEN
;
; Return Values:
;
; A negative value of the first "^"-piece of the RORRES(0) indicates
; an error (see the RPCSTK^RORERR procedure for more details).
;
; Otherwise, either 0 (the log does not exist) or 1 is returned
; in the RORRES(0) and the subsequent nodes of the RORRES array
; contain the log information.
;
; RORRES(0) 0 or 1
;
; RORRES(i) See description of the LOGLIST^RORRP007
;
LOGINFO(RORRES,LOGIEN) ;
N RC,RORFLDS
;--- Initialize the variables
K RORRES S RORRES(0)=0
S RORFLDS=".01;1;2;3*;5;6.01;6.02;6.03;8"
;--- Check the parameters
S LOGIEN=+$G(LOGIEN) Q:LOGIEN'>0
Q:'$D(^RORDATA(798.7,LOGIEN,0))
;--- Load the log information
S RC=$$LOAD(LOGIEN,"RORRES")
;--- Check for the errors
I 'RC S RORRES(0)=1
E D:RC<0 RPCSTK^RORERR(.RORRES,RC)
Q
;
;***** RETURNS THE LIST OF LOGS
; RPC: [ROR LOG GET LIST]
;
; .RESULTS Reference to a local variable where the results
; are returned to.
;
; REGIEN Registry IEN
;
; [STDT] Start date (by default, from the earliest log)
; [ENDT] End date (by default, to the latest log)
;
; Return Values:
;
; A negative value of the first "^"-piece of the RESULTS(0) indicates
; an error (see the RPCSTK^RORERR procedure for more details).
;
; Otherwise, number of logs is returned in the @RESULTS@(0) and the
; subsequent nodes of the RESULTS array contain the logs.
;
; @RESULTS@(0) Number of logs
;
; @RESULTS@(i) Log descriptor
; ^01: "L"
; ^02: Log IEN
; ^03: Activity (external)
; ^04: Activity (internal)
; ^05: Start Date/Time (external)
; ^06: Contains messages (0/1)
; ^07: Job Number
; ^08: End Date/Time (external)
; ^09: Number of Processed Patients
; ^10: Number of Patients with Errors
; ^11: Processing Rate
; ^12: Task Number (optional)
;
; @RESULTS@(...) Registry descriptor (optional)
; ^01: "R"
; ^02: Registry IEN
; ^03: Registry Name
;
; @RESULTS@(i+n) 'End of log' marker
; ^01: "L"
; ^02: "END"
;
LOGLIST(RESULTS,REGIEN,STDT,ENDT) ;
N CNT,DATE,IEN,RORFLDS,RC,XREF
D CLEAR^RORERR("LOGLIST^RORRP007",1)
S RORFLDS=".01;1;2;3*;5;6.01;6.02;6.03;8"
;--- Check the parameters
I $G(REGIEN)'>0 D D RPCSTK^RORERR(.RESULTS,RC) Q
. S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
S REGIEN=+REGIEN,STDT=$G(STDT)\1,ENDT=$G(ENDT)\1
S ENDT=$S(ENDT>0:$$FMADD^XLFDT(ENDT,1),1:9999999)
;--- Initialize the variables
S XREF=$NA(^RORDATA(798.7,"ARD",REGIEN)),CNT=0
K RESULTS S RESULTS=$$ALLOC^RORTMP()
;--- Browse through the logs
S CNT("L")=0,DATE=ENDT
F S DATE=$O(@XREF@(DATE),-1) Q:DATE="" Q:DATE<STDT D
. S IEN=""
. F S IEN=$O(@XREF@(DATE,IEN),-1) Q:IEN="" D
. . S RC=$$LOAD(IEN,RESULTS,.CNT)
. . S:'RC CNT("L")=CNT("L")+1
;--- Number of logs
S @RESULTS@(0)=CNT("L")
Q
;
;***** RETURNS THE LIST OF MESSAGES
; RPC: [ROR LOG GET MESSAGES]
;
; .RESULTS Reference to a local variable where the results
; are returned to.
;
; LOGIEN IEN of the log
;
; Return Values:
;
; A negative value of the first "^"-piece of the RESULTS(0) indicates
; an error (see the RPCSTK^RORERR procedure for more details).
;
; Otherwise, number of messages is returned in the RESULTS(0) and
; the subsequent nodes of the RESULTS array contain the messages.
;
; @RESULTS@(0) Number of messages
;
; @RESULTS@(i) Message descriptor
; ^01: "M"
; ^02: Message IENS
; ^03: Type (external)
; ^04: Type (internal)
; ^05: Date/Time (external)
; ^06: Has Additional Info (0/1)
; ^07: Patient Name
; ^08: Patient IEN (DFN)
;
; @RESULTS@(i+1) Message
; ^01: "T"
; ^02: Message Text
;
; @RESULTS@(...) Line of the ADDITIONAL INFO text
; ^01: "A"
; ^02: Text
;
; @RESULTS@(i+n) 'End of message' marker
; ^01: "M"
; ^02: "END"
;
MSGLIST(RESULTS,LOGIEN) ;
N CNT,I,IEN,IENS,RC,ROOT,RORBUF,RORMSG
D CLEAR^RORERR("MESSAGE^RORRP007",1)
;--- Check the parameters
I $G(LOGIEN)'>0 D D RPCSTK^RORERR(.RESULTS,RC) Q
. S RC=$$ERROR^RORERR(-88,,,,"LOGIEN",$G(LOGIEN))
S LOGIEN=+LOGIEN
;--- Initialize the variables
S ROOT=$$ROOT^DILFD(798.7,,1),CNT=0
K RESULTS S RESULTS=$$ALLOC^RORTMP()
;--- Browse through the messages
S (CNT("M"),IEN)=0
F S IEN=$O(@ROOT@(LOGIEN,2,IEN)) Q:IEN'>0 D
. S IENS=IEN_","_LOGIEN_"," K RORBUF
. ;--- Load the message details
. D GETS^DIQ(798.74,IENS,".01;1;2;3;4","EI","RORBUF","RORMSG")
. Q:$G(DIERR)
. S BUF="M^"_IENS
. ;--- Type (external)
. S $P(BUF,"^",3)=$G(RORBUF(798.74,IENS,1,"E"))
. ;--- Type (Internal)
. S $P(BUF,"^",4)=$G(RORBUF(798.74,IENS,1,"I"))
. ;--- Date/Time
. S $P(BUF,"^",5)=$G(RORBUF(798.74,IENS,.01,"E"))
. ;--- Has Additional Info
. S $P(BUF,"^",6)=($D(RORBUF(798.74,IENS,4))>1)
. ;--- Patient Name
. S $P(BUF,"^",7)=$G(RORBUF(798.74,IENS,3,"E"))
. ;--- Patient IEN (DFN)
. S $P(BUF,"^",8)=$G(RORBUF(798.74,IENS,3,"I"))
. ;--- Add the descriptor to the output
. S CNT=CNT+1,@RESULTS@(CNT)=BUF
. ;--- Add the message text to the output
. S CNT=CNT+1,@RESULTS@(CNT)="T^"_$G(RORBUF(798.74,IENS,2,"E"))
. ;--- Append the ADDITIONAL INFO
. S I=0
. F S I=$O(RORBUF(798.74,IENS,4,I)) Q:'I D
. . S CNT=CNT+1,@RESULTS@(CNT)="A^"_RORBUF(798.74,IENS,4,I)
. ;---Add the 'End of message' marker
. S CNT=CNT+1,@RESULTS@(CNT)="M^END"
. S CNT("M")=CNT("M")+1
;--- Number of messages
S @RESULTS@(0)=CNT("M")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORRP007 8503 printed Dec 13, 2024@01:42:53 Page 2
RORRP007 ;HCIOFO/SG - RPC: LOGS & MESSAGES ; 11/4/05 8:56am
+1 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
+2 ;
+3 QUIT
+4 ;
+5 ;***** LOADS THE LOG INFORMATION INTO THE BUFFER
+6 ;
+7 ; IEN Log IEN
+8 ;
+9 ; ROR8DST Closed root of the destination buffer
+10 ;
+11 ; [[.]OFFSET] Offset in the buffer (modified by the function
+12 ; if passed by reference)
+13 ;
+14 ; Return Values:
+15 ; <0 Error code
+16 ; 0 Ok
+17 ; >0 Skip the log
+18 ;
LOAD(IEN,ROR8DST,OFFSET) ;
+1 NEW BUF,IENS,IENS1,RORBUF,RORMSG
+2 SET IENS=IEN_","
KILL RORBUF
+3 DO GETS^DIQ(798.7,IENS,RORFLDS,"EI","RORBUF","RORMSG")
+4 if $GET(DIERR)
QUIT 1
+5 ;--- Skip the 'Access Violation' activities
+6 if $GET(RORBUF(798.7,IENS,1,"I"))=6
QUIT 2
+7 SET BUF="L^"_IEN
+8 ;--- Activity (external)
+9 SET $PIECE(BUF,"^",3)=$GET(RORBUF(798.7,IENS,1,"E"))
+10 ;--- Activity (internal)
+11 SET $PIECE(BUF,"^",4)=$GET(RORBUF(798.7,IENS,1,"I"))
+12 ;--- Start Date/Time
+13 SET $PIECE(BUF,"^",5)=$GET(RORBUF(798.7,IENS,.01,"E"))
+14 ;--- Contains messages
+15 SET $PIECE(BUF,"^",6)=($ORDER(^RORDATA(798.7,IEN,2,0))>0)
+16 ;--- Job Number
+17 SET $PIECE(BUF,"^",7)=$GET(RORBUF(798.7,IENS,2,"E"))
+18 ;--- End Date/Time
+19 SET $PIECE(BUF,"^",8)=$GET(RORBUF(798.7,IENS,5,"E"))
+20 ;--- Number of Processed Patients
+21 SET $PIECE(BUF,"^",9)=$GET(RORBUF(798.7,IENS,6.01,"E"))
+22 ;--- Number of Patients with Errors
+23 SET $PIECE(BUF,"^",10)=$GET(RORBUF(798.7,IENS,6.02,"E"))
+24 ;--- Processing Rate
+25 SET $PIECE(BUF,"^",11)=$GET(RORBUF(798.7,IENS,6.03,"E"))
+26 ;--- Task Number
+27 SET $PIECE(BUF,"^",12)=$GET(RORBUF(798.7,IENS,8,"I"))
+28 ;--- Add the log descriptor to the output
+29 SET OFFSET=$GET(OFFSET)+1
SET @ROR8DST@(OFFSET)=BUF
+30 ;--- Load the list of registries
+31 SET IENS1=""
+32 FOR
SET IENS1=$ORDER(RORBUF(798.73,IENS1))
if IENS1=""
QUIT
Begin DoDot:1
+33 SET BUF="R^"_$GET(RORBUF(798.73,IENS1,.01,"I"))
+34 SET $PIECE(BUF,"^",3)=$GET(RORBUF(798.73,IENS1,.01,"E"))
+35 ;--- Add the registry descriptor to the output
+36 SET OFFSET=OFFSET+1
SET @ROR8DST@(OFFSET)=BUF
End DoDot:1
+37 ;---Add the 'End of log' marker
+38 SET OFFSET=OFFSET+1
SET @ROR8DST@(OFFSET)="L^END"
+39 QUIT 0
+40 ;
+41 ;***** RETURNS THE LOG INFORMATION
+42 ; RPC: [ROR LOG INFO]
+43 ;
+44 ; .RORRES Reference to a local variable where the results
+45 ; are returned to.
+46 ;
+47 ; LOGIEN Log IEN
+48 ;
+49 ; Return Values:
+50 ;
+51 ; A negative value of the first "^"-piece of the RORRES(0) indicates
+52 ; an error (see the RPCSTK^RORERR procedure for more details).
+53 ;
+54 ; Otherwise, either 0 (the log does not exist) or 1 is returned
+55 ; in the RORRES(0) and the subsequent nodes of the RORRES array
+56 ; contain the log information.
+57 ;
+58 ; RORRES(0) 0 or 1
+59 ;
+60 ; RORRES(i) See description of the LOGLIST^RORRP007
+61 ;
LOGINFO(RORRES,LOGIEN) ;
+1 NEW RC,RORFLDS
+2 ;--- Initialize the variables
+3 KILL RORRES
SET RORRES(0)=0
+4 SET RORFLDS=".01;1;2;3*;5;6.01;6.02;6.03;8"
+5 ;--- Check the parameters
+6 SET LOGIEN=+$GET(LOGIEN)
if LOGIEN'>0
QUIT
+7 if '$DATA(^RORDATA(798.7,LOGIEN,0))
QUIT
+8 ;--- Load the log information
+9 SET RC=$$LOAD(LOGIEN,"RORRES")
+10 ;--- Check for the errors
+11 IF 'RC
SET RORRES(0)=1
+12 IF '$TEST
if RC<0
DO RPCSTK^RORERR(.RORRES,RC)
+13 QUIT
+14 ;
+15 ;***** RETURNS THE LIST OF LOGS
+16 ; RPC: [ROR LOG GET LIST]
+17 ;
+18 ; .RESULTS Reference to a local variable where the results
+19 ; are returned to.
+20 ;
+21 ; REGIEN Registry IEN
+22 ;
+23 ; [STDT] Start date (by default, from the earliest log)
+24 ; [ENDT] End date (by default, to the latest log)
+25 ;
+26 ; Return Values:
+27 ;
+28 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
+29 ; an error (see the RPCSTK^RORERR procedure for more details).
+30 ;
+31 ; Otherwise, number of logs is returned in the @RESULTS@(0) and the
+32 ; subsequent nodes of the RESULTS array contain the logs.
+33 ;
+34 ; @RESULTS@(0) Number of logs
+35 ;
+36 ; @RESULTS@(i) Log descriptor
+37 ; ^01: "L"
+38 ; ^02: Log IEN
+39 ; ^03: Activity (external)
+40 ; ^04: Activity (internal)
+41 ; ^05: Start Date/Time (external)
+42 ; ^06: Contains messages (0/1)
+43 ; ^07: Job Number
+44 ; ^08: End Date/Time (external)
+45 ; ^09: Number of Processed Patients
+46 ; ^10: Number of Patients with Errors
+47 ; ^11: Processing Rate
+48 ; ^12: Task Number (optional)
+49 ;
+50 ; @RESULTS@(...) Registry descriptor (optional)
+51 ; ^01: "R"
+52 ; ^02: Registry IEN
+53 ; ^03: Registry Name
+54 ;
+55 ; @RESULTS@(i+n) 'End of log' marker
+56 ; ^01: "L"
+57 ; ^02: "END"
+58 ;
LOGLIST(RESULTS,REGIEN,STDT,ENDT) ;
+1 NEW CNT,DATE,IEN,RORFLDS,RC,XREF
+2 DO CLEAR^RORERR("LOGLIST^RORRP007",1)
+3 SET RORFLDS=".01;1;2;3*;5;6.01;6.02;6.03;8"
+4 ;--- Check the parameters
+5 IF $GET(REGIEN)'>0
Begin DoDot:1
+6 SET RC=$$ERROR^RORERR(-88,,,,"REGIEN",$GET(REGIEN))
End DoDot:1
DO RPCSTK^RORERR(.RESULTS,RC)
QUIT
+7 SET REGIEN=+REGIEN
SET STDT=$GET(STDT)\1
SET ENDT=$GET(ENDT)\1
+8 SET ENDT=$SELECT(ENDT>0:$$FMADD^XLFDT(ENDT,1),1:9999999)
+9 ;--- Initialize the variables
+10 SET XREF=$NAME(^RORDATA(798.7,"ARD",REGIEN))
SET CNT=0
+11 KILL RESULTS
SET RESULTS=$$ALLOC^RORTMP()
+12 ;--- Browse through the logs
+13 SET CNT("L")=0
SET DATE=ENDT
+14 FOR
SET DATE=$ORDER(@XREF@(DATE),-1)
if DATE=""
QUIT
if DATE<STDT
QUIT
Begin DoDot:1
+15 SET IEN=""
+16 FOR
SET IEN=$ORDER(@XREF@(DATE,IEN),-1)
if IEN=""
QUIT
Begin DoDot:2
+17 SET RC=$$LOAD(IEN,RESULTS,.CNT)
+18 if 'RC
SET CNT("L")=CNT("L")+1
End DoDot:2
End DoDot:1
+19 ;--- Number of logs
+20 SET @RESULTS@(0)=CNT("L")
+21 QUIT
+22 ;
+23 ;***** RETURNS THE LIST OF MESSAGES
+24 ; RPC: [ROR LOG GET MESSAGES]
+25 ;
+26 ; .RESULTS Reference to a local variable where the results
+27 ; are returned to.
+28 ;
+29 ; LOGIEN IEN of the log
+30 ;
+31 ; Return Values:
+32 ;
+33 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
+34 ; an error (see the RPCSTK^RORERR procedure for more details).
+35 ;
+36 ; Otherwise, number of messages is returned in the RESULTS(0) and
+37 ; the subsequent nodes of the RESULTS array contain the messages.
+38 ;
+39 ; @RESULTS@(0) Number of messages
+40 ;
+41 ; @RESULTS@(i) Message descriptor
+42 ; ^01: "M"
+43 ; ^02: Message IENS
+44 ; ^03: Type (external)
+45 ; ^04: Type (internal)
+46 ; ^05: Date/Time (external)
+47 ; ^06: Has Additional Info (0/1)
+48 ; ^07: Patient Name
+49 ; ^08: Patient IEN (DFN)
+50 ;
+51 ; @RESULTS@(i+1) Message
+52 ; ^01: "T"
+53 ; ^02: Message Text
+54 ;
+55 ; @RESULTS@(...) Line of the ADDITIONAL INFO text
+56 ; ^01: "A"
+57 ; ^02: Text
+58 ;
+59 ; @RESULTS@(i+n) 'End of message' marker
+60 ; ^01: "M"
+61 ; ^02: "END"
+62 ;
MSGLIST(RESULTS,LOGIEN) ;
+1 NEW CNT,I,IEN,IENS,RC,ROOT,RORBUF,RORMSG
+2 DO CLEAR^RORERR("MESSAGE^RORRP007",1)
+3 ;--- Check the parameters
+4 IF $GET(LOGIEN)'>0
Begin DoDot:1
+5 SET RC=$$ERROR^RORERR(-88,,,,"LOGIEN",$GET(LOGIEN))
End DoDot:1
DO RPCSTK^RORERR(.RESULTS,RC)
QUIT
+6 SET LOGIEN=+LOGIEN
+7 ;--- Initialize the variables
+8 SET ROOT=$$ROOT^DILFD(798.7,,1)
SET CNT=0
+9 KILL RESULTS
SET RESULTS=$$ALLOC^RORTMP()
+10 ;--- Browse through the messages
+11 SET (CNT("M"),IEN)=0
+12 FOR
SET IEN=$ORDER(@ROOT@(LOGIEN,2,IEN))
if IEN'>0
QUIT
Begin DoDot:1
+13 SET IENS=IEN_","_LOGIEN_","
KILL RORBUF
+14 ;--- Load the message details
+15 DO GETS^DIQ(798.74,IENS,".01;1;2;3;4","EI","RORBUF","RORMSG")
+16 if $GET(DIERR)
QUIT
+17 SET BUF="M^"_IENS
+18 ;--- Type (external)
+19 SET $PIECE(BUF,"^",3)=$GET(RORBUF(798.74,IENS,1,"E"))
+20 ;--- Type (Internal)
+21 SET $PIECE(BUF,"^",4)=$GET(RORBUF(798.74,IENS,1,"I"))
+22 ;--- Date/Time
+23 SET $PIECE(BUF,"^",5)=$GET(RORBUF(798.74,IENS,.01,"E"))
+24 ;--- Has Additional Info
+25 SET $PIECE(BUF,"^",6)=($DATA(RORBUF(798.74,IENS,4))>1)
+26 ;--- Patient Name
+27 SET $PIECE(BUF,"^",7)=$GET(RORBUF(798.74,IENS,3,"E"))
+28 ;--- Patient IEN (DFN)
+29 SET $PIECE(BUF,"^",8)=$GET(RORBUF(798.74,IENS,3,"I"))
+30 ;--- Add the descriptor to the output
+31 SET CNT=CNT+1
SET @RESULTS@(CNT)=BUF
+32 ;--- Add the message text to the output
+33 SET CNT=CNT+1
SET @RESULTS@(CNT)="T^"_$GET(RORBUF(798.74,IENS,2,"E"))
+34 ;--- Append the ADDITIONAL INFO
+35 SET I=0
+36 FOR
SET I=$ORDER(RORBUF(798.74,IENS,4,I))
if 'I
QUIT
Begin DoDot:2
+37 SET CNT=CNT+1
SET @RESULTS@(CNT)="A^"_RORBUF(798.74,IENS,4,I)
End DoDot:2
+38 ;---Add the 'End of message' marker
+39 SET CNT=CNT+1
SET @RESULTS@(CNT)="M^END"
+40 SET CNT("M")=CNT("M")+1
End DoDot:1
+41 ;--- Number of messages
+42 SET @RESULTS@(0)=CNT("M")
+43 QUIT