AMERFIX ; IHS/ANMC/GIS - RESTORES MISSING DATA TO ER VISIT FILE ;
;;3.0;ER VISIT SYSTEM;;FEB 23, 2009
;
NEW N A,E,T,W,%,X,Y,Z,G
N DIE,DA,DR,DIC,DQ,DI,D0
S DIE="^AMERVSIT(",G="^AMERVSIT"
RUN S DA=0 F S DA=$O(@G@(DA)) Q:'DA D
.D VAR
.I 'A Q
.I T("D"),'W("D") D DR(A,T("D"),12.3)
.I T("R"),'W("R") D DR(A,T("R"),12.4)
.I T("S"),'W("S") D DR(A,T("S"),12.7)
.I E,'W("V") D DR(A,E,12.5)
.I DR]"" L +^AMERVSIT:DTIME
.I $T D ^DIE L -^AMERVSIT Q
.W !,"Sorry Someone else is editing this visit."
.Q
Q
;
VAR S DR=""
S A=$P($G(@G@(DA,0)),U) I 'A Q
S T("D")=$P($G(@G@(DA,12)),U),W("D")=$P($G(@G@(DA,12)),U,3)
S T("R")=$P($G(@G@(DA,12)),U,2),W("R")=$P($G(@G@(DA,12)),U,4)
S T("S")=$P($G(@G@(DA,12)),U,6),W("S")=$P($G(@G@(DA,12)),U,7)
S E=$P($G(@G@(DA,6)),U,2),W("V")=$P($G(@G@(DA,12)),U,5)
Q
;
DR(X,Y,Z) ; BUILD DR STRING
N %
S %=$$DT^AMERSAV1(Y,X,"M") I %="" Q
I DR]"" S DR=DR_";"
S DR=DR_Z_"///"_%
Q
AMERFIX ; IHS/ANMC/GIS - RESTORES MISSING DATA TO ER VISIT FILE ;
+1 ;;3.0;ER VISIT SYSTEM;;FEB 23, 2009
+2 ;
NEW NEW A,E,T,W,%,X,Y,Z,G
+1 NEW DIE,DA,DR,DIC,DQ,DI,D0
+2 SET DIE="^AMERVSIT("
SET G="^AMERVSIT"
RUN SET DA=0
FOR
SET DA=$ORDER(@G@(DA))
IF 'DA
QUIT
Begin DoDot:1
+1 DO VAR
+2 IF 'A
QUIT
+3 IF T("D")
IF 'W("D")
DO DR(A,T("D"),12.3)
+4 IF T("R")
IF 'W("R")
DO DR(A,T("R"),12.4)
+5 IF T("S")
IF 'W("S")
DO DR(A,T("S"),12.7)
+6 IF E
IF 'W("V")
DO DR(A,E,12.5)
+7 IF DR]""
LOCK +^AMERVSIT:DTIME
+8 IF $TEST
DO ^DIE
LOCK -^AMERVSIT
QUIT
+9 WRITE !,"Sorry Someone else is editing this visit."
+10 QUIT
End DoDot:1
+11 QUIT
+12 ;
VAR SET DR=""
+1 SET A=$PIECE($GET(@G@(DA,0)),U)
IF 'A
QUIT
+2 SET T("D")=$PIECE($GET(@G@(DA,12)),U)
SET W("D")=$PIECE($GET(@G@(DA,12)),U,3)
+3 SET T("R")=$PIECE($GET(@G@(DA,12)),U,2)
SET W("R")=$PIECE($GET(@G@(DA,12)),U,4)
+4 SET T("S")=$PIECE($GET(@G@(DA,12)),U,6)
SET W("S")=$PIECE($GET(@G@(DA,12)),U,7)
+5 SET E=$PIECE($GET(@G@(DA,6)),U,2)
SET W("V")=$PIECE($GET(@G@(DA,12)),U,5)
+6 QUIT
+7 ;
DR(X,Y,Z) ; BUILD DR STRING
+1 NEW %
+2 SET %=$$DT^AMERSAV1(Y,X,"M")
IF %=""
QUIT
+3 IF DR]""
SET DR=DR_";"
+4 SET DR=DR_Z_"///"_%
+5 QUIT