RORXU009 ;HOIFO/VC - REPORT MODIFICATON UTILITY ;2/10/09 5:01pm
;;1.5;CLINICAL CASE REGISTRIES;**8**;Feb 17, 2006;Build 8
;
Q
DEL(TSK) ;DELETES RECORDS FROM A REPORT FILE
;This routine will remove all except the most recent lab test
;Input TASK - the task number created when the report is generated
;
K ^TMP($J,"RORKILL")
N NAMEOLD,DATENEW,TEST,DATE,BEG,CTR,END,NAME,RES,J,K,I,M,N,X
S I=0,NAMEOLD="",DATENEW=""
;
;--- Put the test records in order by Patient,test,and date
;
F X=1:1 S I=$O(^RORDATA(798.8,TSK,"RI",I)) D Q:+I=0
.S NAME=$G(^RORDATA(798.8,TSK,"RI",I,1))
.Q:NAME'[","
.S J=I+3
.S DATENEW=$G(^RORDATA(798.8,TSK,"RI",J,1))
.Q:DATENEW=""
.S K=I+4
.S TEST=$G(^RORDATA(798.8,TSK,"RI",K,1))
.Q:TEST=""
.S CTR=1
.S RES=0
.I $G(^TMP($J,"RORKILL",NAME,TEST,(DATENEW*(-1)),CTR))'="" D
..S CTR=CTR+1
..F M=1:1:10 I $G(^TMP($J,"RORKILL",NAME,TEST,(DATENEW*(-1)),CTR))'="" S CTR=CTR+1
.S ^TMP($J,"RORKILL",NAME,TEST,(DATENEW*(-1)),CTR)=(I-1)_U_(K+1)
;
;--- Use the TMP file to kill the nodes in file 798.8
;
S NAME=""
F S NAME=$O(^TMP($J,"RORKILL",NAME)) Q:NAME="" D
.S TEST=""
.F S TEST=$O(^TMP($J,"RORKILL",NAME,TEST)) Q:TEST="" D
..S DATE=-9999999
..F M=1:1 S DATE=$O(^TMP($J,"RORKILL",NAME,TEST,DATE)) Q:DATE="" D
...Q:M=1
...S CTR=0
...F S CTR=$O(^TMP($J,"RORKILL",NAME,TEST,DATE,CTR)) Q:CTR="" D
....S BEG=$P(^TMP($J,"RORKILL",NAME,TEST,DATE,CTR),U,1)
....S END=$P(^TMP($J,"RORKILL",NAME,TEST,DATE,CTR),U,2)
....F N=BEG:1:END K ^RORDATA(798.8,TSK,"RI",N)
K ^TMP($J,"RORKILL")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORXU009 1592 printed Dec 13, 2024@01:45:12 Page 2
RORXU009 ;HOIFO/VC - REPORT MODIFICATON UTILITY ;2/10/09 5:01pm
+1 ;;1.5;CLINICAL CASE REGISTRIES;**8**;Feb 17, 2006;Build 8
+2 ;
+3 QUIT
DEL(TSK) ;DELETES RECORDS FROM A REPORT FILE
+1 ;This routine will remove all except the most recent lab test
+2 ;Input TASK - the task number created when the report is generated
+3 ;
+4 KILL ^TMP($JOB,"RORKILL")
+5 NEW NAMEOLD,DATENEW,TEST,DATE,BEG,CTR,END,NAME,RES,J,K,I,M,N,X
+6 SET I=0
SET NAMEOLD=""
SET DATENEW=""
+7 ;
+8 ;--- Put the test records in order by Patient,test,and date
+9 ;
+10 FOR X=1:1
SET I=$ORDER(^RORDATA(798.8,TSK,"RI",I))
Begin DoDot:1
+11 SET NAME=$GET(^RORDATA(798.8,TSK,"RI",I,1))
+12 if NAME'[","
QUIT
+13 SET J=I+3
+14 SET DATENEW=$GET(^RORDATA(798.8,TSK,"RI",J,1))
+15 if DATENEW=""
QUIT
+16 SET K=I+4
+17 SET TEST=$GET(^RORDATA(798.8,TSK,"RI",K,1))
+18 if TEST=""
QUIT
+19 SET CTR=1
+20 SET RES=0
+21 IF $GET(^TMP($JOB,"RORKILL",NAME,TEST,(DATENEW*(-1)),CTR))'=""
Begin DoDot:2
+22 SET CTR=CTR+1
+23 FOR M=1:1:10
IF $GET(^TMP($JOB,"RORKILL",NAME,TEST,(DATENEW*(-1)),CTR))'=""
SET CTR=CTR+1
End DoDot:2
+24 SET ^TMP($JOB,"RORKILL",NAME,TEST,(DATENEW*(-1)),CTR)=(I-1)_U_(K+1)
End DoDot:1
if +I=0
QUIT
+25 ;
+26 ;--- Use the TMP file to kill the nodes in file 798.8
+27 ;
+28 SET NAME=""
+29 FOR
SET NAME=$ORDER(^TMP($JOB,"RORKILL",NAME))
if NAME=""
QUIT
Begin DoDot:1
+30 SET TEST=""
+31 FOR
SET TEST=$ORDER(^TMP($JOB,"RORKILL",NAME,TEST))
if TEST=""
QUIT
Begin DoDot:2
+32 SET DATE=-9999999
+33 FOR M=1:1
SET DATE=$ORDER(^TMP($JOB,"RORKILL",NAME,TEST,DATE))
if DATE=""
QUIT
Begin DoDot:3
+34 if M=1
QUIT
+35 SET CTR=0
+36 FOR
SET CTR=$ORDER(^TMP($JOB,"RORKILL",NAME,TEST,DATE,CTR))
if CTR=""
QUIT
Begin DoDot:4
+37 SET BEG=$PIECE(^TMP($JOB,"RORKILL",NAME,TEST,DATE,CTR),U,1)
+38 SET END=$PIECE(^TMP($JOB,"RORKILL",NAME,TEST,DATE,CTR),U,2)
+39 FOR N=BEG:1:END
KILL ^RORDATA(798.8,TSK,"RI",N)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+40 KILL ^TMP($JOB,"RORKILL")
+41 QUIT
+42 ;