RGEQSTAT ;BHM/RGY-Statistics ;17-Feb-98
;;1.0; CLINICAL INFO RESOURCE NETWORK ;;30 Apr 99
ENT(TYPE) ;Get available entry
NEW DATE
I TYPE'?1N.N S TYPE=+$O(^RGEQASN("B",TYPE,0))
I '$D(^RGEQASN(TYPE,0)) Q 0
S DATE=$$NOW^XLFDT\1
I '$O(^RGSTAT(995.2,"AX",TYPE,DATE,0)) D ADD(TYPE,DATE)
Q $O(^RGSTAT(995.2,"AX",TYPE,DATE,0))
;
ADD(TYPE,DATE) ;Add statistics entry for type of event
NEW DIC,D0,DIE,DA,X,DLAYGO,DR,RGOK,EVN
I $G(TYPE)="" Q
I $G(DATE)="" Q
I TYPE'?1N.N S TYPE=$O(^RGEQASN("B",TYPE,0)) I TYPE="" G Q
F EVN=+$P(^RGSTAT(995.2,0),"^",3)+1:1 L +^RGSTAT(995.2,EVN):0 I $T S RGOK=0 D L -^RGSTAT(995.2,EVN) Q:RGOK
.I $D(^RGSTAT(995.2,EVN)) Q
.S DINUM=EVN,DIC="^RGSTAT(995.2,",DIC(0)="L",DLAYGO=995.2,X=EVN K DD,D0 D FILE^DICN K DIC,DLAYGO,D0
.S DIE="^RGSTAT(995.2,",DR="[RGEQ NEW STATISTIC]",DA=EVN D ^DIE
.S RGOK=1
.Q
Q Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRGEQSTAT 873 printed Dec 13, 2024@01:41:37 Page 2
RGEQSTAT ;BHM/RGY-Statistics ;17-Feb-98
+1 ;;1.0; CLINICAL INFO RESOURCE NETWORK ;;30 Apr 99
ENT(TYPE) ;Get available entry
+1 NEW DATE
+2 IF TYPE'?1N.N
SET TYPE=+$ORDER(^RGEQASN("B",TYPE,0))
+3 IF '$DATA(^RGEQASN(TYPE,0))
QUIT 0
+4 SET DATE=$$NOW^XLFDT\1
+5 IF '$ORDER(^RGSTAT(995.2,"AX",TYPE,DATE,0))
DO ADD(TYPE,DATE)
+6 QUIT $ORDER(^RGSTAT(995.2,"AX",TYPE,DATE,0))
+7 ;
ADD(TYPE,DATE) ;Add statistics entry for type of event
+1 NEW DIC,D0,DIE,DA,X,DLAYGO,DR,RGOK,EVN
+2 IF $GET(TYPE)=""
QUIT
+3 IF $GET(DATE)=""
QUIT
+4 IF TYPE'?1N.N
SET TYPE=$ORDER(^RGEQASN("B",TYPE,0))
IF TYPE=""
GOTO Q
+5 FOR EVN=+$PIECE(^RGSTAT(995.2,0),"^",3)+1:1
LOCK +^RGSTAT(995.2,EVN):0
IF $TEST
SET RGOK=0
Begin DoDot:1
+6 IF $DATA(^RGSTAT(995.2,EVN))
QUIT
+7 SET DINUM=EVN
SET DIC="^RGSTAT(995.2,"
SET DIC(0)="L"
SET DLAYGO=995.2
SET X=EVN
KILL DD,D0
DO FILE^DICN
KILL DIC,DLAYGO,D0
+8 SET DIE="^RGSTAT(995.2,"
SET DR="[RGEQ NEW STATISTIC]"
SET DA=EVN
DO ^DIE
+9 SET RGOK=1
+10 QUIT
End DoDot:1
LOCK -^RGSTAT(995.2,EVN)
if RGOK
QUIT
Q QUIT