APCLDF0 ; IHS/CMI/LAB -IHS -INTERACTIVE ROUTINE FOR DATA FETCHER ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
D ^XBKVAR
START S DIC="^DPT(",DIC(0)="EAQM" D ^DIC K DIC Q:Y=-1 S APCLPDFN=+Y W !
ASK ;
R !,"ENTER SCRIPT: ",APCLX:DTIME
I '$T!(U[$G(APCLX))!(APCLX=" ") K APCLPDFN,APCLX,APCLY,APCLINT,APCLTYPE,APCLER G START
I $P(APCLX," ")="DATE"!($P(APCLX," ")="VALUE") W !!,*7,"Do not enter the words 'DATE' or 'VALUE' before your script. This is done",!,"only for use with the report template utility.",! G ASK
NEW % F %=1:1:$L(APCLX) S:$E(APCLX,%)?1L APCLX=$E(APCLX,0,%-1)_$C($A(APCLX,%)-32)_$E(APCLX,%+1,999)
K APCLDFVR S APCLY="APCLDFVR(",APCLX=APCLPDFN_U_APCLX,APCLINT=1 S APCLER=$$START1^APCLDF(APCLX,APCLY,APCLINT,.APCLTYPE) S APCLX=$P(APCLX,U,2) I $D(APCLDFVR) W ! D K APCLDFVR
. NEW I,Z,VALUE
. F I=1:1 Q:'$D(APCLDFVR(I)) S Y=$P(APCLDFVR(I),U),Z=$P(APCLDFVR(I),U,2),T=$P(APCLDFVR(I),U,3) D
.. W !,$S($E("PATIENT",1,$L($P(APCLX," ")))=$P(APCLX," ")!($P(APCLX," ")="PT"):"",1:$S(APCLTYPE="NV":"DATE NOTED OR LAST MODIFIED: ",1:"VISIT DATE: ")_$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_(1700+$E(Y,1,3))) W:Z]""&(Z'=T) " VALUE: ",Z D
... I Z]""&(Z'=T) W ?45
... E W " "
... W $S(T]"":$S(Z]""&(Z'=T):"TYPE: ",1:"VALUE: ")_T,1:"") K Y,Z,T
E I 'APCLER W !,"No ",$S($E("PATIENT",1,$L($P(APCLX," ")))=$P(APCLX," ")!($P(APCLX," ")="PT"):"demographic value",1:"clinical occurrence")," for this patient"
I APCLER W *7,!," => ",$P($T(@APCLER^APCLDF2),";",3) K APCLER
W ! G ASK
APCLDF0 ; IHS/CMI/LAB -IHS -INTERACTIVE ROUTINE FOR DATA FETCHER ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 DO ^XBKVAR
START SET DIC="^DPT("
SET DIC(0)="EAQM"
DO ^DIC
KILL DIC
IF Y=-1
QUIT
SET APCLPDFN=+Y
WRITE !
ASK ;
+1 READ !,"ENTER SCRIPT: ",APCLX:DTIME
+2 IF '$TEST!(U[$GET(APCLX))!(APCLX=" ")
KILL APCLPDFN,APCLX,APCLY,APCLINT,APCLTYPE,APCLER
GOTO START
+3 IF $PIECE(APCLX," ")="DATE"!($PIECE(APCLX," ")="VALUE")
WRITE !!,*7,"Do not enter the words 'DATE' or 'VALUE' before your script. This is done",!,"only for use with the report template utility.",!
GOTO ASK
+4 NEW %
FOR %=1:1:$LENGTH(APCLX)
IF $EXTRACT(APCLX,%)?1L
SET APCLX=$EXTRACT(APCLX,0,%-1)_$CHAR($ASCII(APCLX,%)-32)_$EXTRACT(APCLX,%+1,999)
+5 KILL APCLDFVR
SET APCLY="APCLDFVR("
SET APCLX=APCLPDFN_U_APCLX
SET APCLINT=1
SET APCLER=$$START1^APCLDF(APCLX,APCLY,APCLINT,.APCLTYPE)
SET APCLX=$PIECE(APCLX,U,2)
IF $DATA(APCLDFVR)
WRITE !
Begin DoDot:1
+6 NEW I,Z,VALUE
+7 FOR I=1:1
IF '$DATA(APCLDFVR(I))
QUIT
SET Y=$PIECE(APCLDFVR(I),U)
SET Z=$PIECE(APCLDFVR(I),U,2)
SET T=$PIECE(APCLDFVR(I),U,3)
Begin DoDot:2
+8 WRITE !,$SELECT($EXTRACT("PATIENT",1,$LENGTH($PIECE(APCLX," ")))=$PIECE(APCLX," ")!($PIECE(APCLX," ")="PT"):"",1:$SELECT(APCLTYPE="NV":"DATE NOTED OR LAST MODIFIED: ",1:"VISIT DATE: ")_$EXTRACT(Y,4,5)_"/"_$EXTRACT(Y,6,7)_"/"_(17
IF Z]""&(Z'=T)
WRITE " VALUE: ",Z
Begin DoDot:3
+9 IF Z]""&(Z'=T)
WRITE ?45
+10 IF '$TEST
WRITE " "
+11 WRITE $SELECT(T]"":$SELECT(Z]""&(Z'=T):"TYPE: ",1:"VALUE: ")_T,1:"")
KILL Y,Z,T
End DoDot:3
End DoDot:2
End DoDot:1
KILL APCLDFVR
+12 IF '$TEST
IF 'APCLER
WRITE !,"No ",$SELECT($EXTRACT("PATIENT",1,$LENGTH($PIECE(APCLX," ")))=$PIECE(APCLX," ")!($PIECE(APCLX," ")="PT"):"demographic value",1:"clinical occurrence")," for this patient"
+13 IF APCLER
WRITE *7,!," => ",$PIECE($TEXT(@APCLER^APCLDF2),";",3)
KILL APCLER
+14 WRITE !
GOTO ASK