VistA-WorldVistAEHR/r/CLINICAL_INFO_RESOURCE_NETW.../RGEQSTAT.m

23 lines
851 B
Mathematica

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