AGVQQFS ;IHS/ASDS/SDH - SPLIT-OFF PRINT OF FACE SHEETS TO DISK FOR VERIQUEST ; [ 12/10/2001 7:39 AM ]
;;6.0;IHS PATIENT REGISTRATION;**15**;OCTOBER 11, 2000
;
; IHS/ASDS/SDH - AG*6*15 12/10/2001
; DIR acknowledges and thanks Mr. Floyd Dennis, Nashville Area
; Office, for the original routines and components.
; VeriQuest, a product of Envoy, helps identify ineligible
; claimants prior to claim submittal.
;
Q:'($$VERSION^%ZOSV(1)["MSM") ; %HOSTCMD() used in SNDFILE.
;
D INIT
Q:AGVQQUIT
;
D MAIN,^%ZISC,SNDFILE,EXIT
Q
;
INIT ;Primary routine initialization module.
;
NEW AGVQ3
S AGVQQFS="" ;Routine activity flag.
S AGVQIL=6 ;Max length of filename index.
S AGVQQUIT=1 ;QUIT flag.
;
Q:'$D(^AGFAC(DUZ(2),3)) S AGVQ3=^(3)
;
; Target directory mandatory.
S AGVQDIR=$P(AGVQ3,U,2)
Q:'$L(AGVQDIR)
;
; VeriQuest target system ID mandatory.
S AGVQID=$P(AGVQ3,U,6)
Q:'$L(AGVQID)
;
; Communications protocol mandatory and not "NONE".
S AGVQCP=$P(AGVQ3,U,7)
Q:"N"[AGVQCP
;
; Number of days to wait between successive checks on a patient.
S AGVQINTV=$S(+$P(AGVQ3,U,5)>0:$P(AGVQ3,U,5),1:30)
;
; Don't advance index/open file if Pat not recheck eligible.
I $D(^AGVQP(DFN,0)) Q:$$FMDIFF^XLFDT(DT,$P(^AGVQP(DFN,0),U,2))<AGVQINTV
;
; Filename prefix.
S AGVQPRE=$S($P(AGVQ3,U,4)]"":$P(AGVQ3,U,4),1:"VQ")
;
; VeriQuest target system logon.
S AGVQUSR=$P(AGVQ3,U,8)
;
; VeriQuest target system password.
S AGVQPWD=$P(AGVQ3,U,9)
;
;Get incremental file index number for file names.
LOCK +^AGFAC(DUZ(2),3):5
E Q
S AGVQIDX=$P(^AGFAC(DUZ(2),3),U,3)+1,$P(^(3),U,3)=AGVQIDX
LOCK -^AGFAC(DUZ(2),3)
;
;Pad/Format index number for file name, if necessary.
I $L(AGVQIDX)<AGVQIL NEW P S P=AGVQIL-$L(AGVQIDX),P=$E("000000",1,P),AGVQIDX=P_AGVQIDX
S AGVQFILE=AGVQPRE_AGVQIDX
;
;Open HFS device.
D OPEN^%ZISH("AGVQOUT",AGVQDIR,AGVQFILE,"W")
Q:POP
;
S AGVQQUIT=0
Q
;
MAIN ;Primary execution module.
;
U IO
D START^AGFACE
; Ensure last line of file is complete.
W !
;
;Update record of Patient's last Elig Check.
;
;If no previous entry, create one.
I '$D(^AGVQP(DFN,0)) NEW DIC,X S DIC="^AGVQP(",X="`"_DFN,DIC(0)="LN",DIC("DR")=".02////"_DT D ^DIC Q
;
;Else update the previous entry.
NEW DA,DIE,DR
S DIE="^AGVQP(",DA=DFN,DR=".02////"_DT
D ^DIE
Q
;
SNDFILE ;Transmit file to VeriQuest receiving system.
NEW AGCMD
;
S AGCMD="sendto"
I ^%ZOSF("OS")["UNIX" S AGCMD="/usr/bin/"_AGCMD
I AGVQCP="F",$L(AGVQUSR) S AGCMD=AGCMD_" -l "_AGVQUSR I $L(AGVQPWD) S AGCMD=AGCMD_":"_AGVQPWD
S AGCMD=AGCMD_" "_AGVQID_" "_AGVQDIR_AGVQFILE
I $$JOBWAIT^%HOSTCMD(AGCMD),'$D(ZTQUEUED) W !,"""sendto"" of Face Sheet to VeriQuest FAILED." I $$DIR^XBDIR("E","Press RETURN")
Q
;
EXIT ;Clean up before leaving.
KILL AGVQDIR,AGVQFILE,AGVQIDX,AGVQIL,AGVQINTV,AGVQPRE,AGVQQUIT,AGVQID,AGVQUSR,AGVQPWD,AGVQQFS
Q
;
AGVQQFS ;IHS/ASDS/SDH - SPLIT-OFF PRINT OF FACE SHEETS TO DISK FOR VERIQUEST ; [ 12/10/2001 7:39 AM ]
+1 ;;6.0;IHS PATIENT REGISTRATION;**15**;OCTOBER 11, 2000
+2 ;
+3 ; IHS/ASDS/SDH - AG*6*15 12/10/2001
+4 ; DIR acknowledges and thanks Mr. Floyd Dennis, Nashville Area
+5 ; Office, for the original routines and components.
+6 ; VeriQuest, a product of Envoy, helps identify ineligible
+7 ; claimants prior to claim submittal.
+8 ;
+9 ; %HOSTCMD() used in SNDFILE.
IF '($$VERSION^%ZOSV(1)["MSM")
QUIT
+10 ;
+11 DO INIT
+12 IF AGVQQUIT
QUIT
+13 ;
+14 DO MAIN
DO ^%ZISC
DO SNDFILE
DO EXIT
+15 QUIT
+16 ;
INIT ;Primary routine initialization module.
+1 ;
+2 NEW AGVQ3
+3 ;Routine activity flag.
SET AGVQQFS=""
+4 ;Max length of filename index.
SET AGVQIL=6
+5 ;QUIT flag.
SET AGVQQUIT=1
+6 ;
+7 IF '$DATA(^AGFAC(DUZ(2),3))
QUIT
SET AGVQ3=^(3)
+8 ;
+9 ; Target directory mandatory.
+10 SET AGVQDIR=$PIECE(AGVQ3,U,2)
+11 IF '$LENGTH(AGVQDIR)
QUIT
+12 ;
+13 ; VeriQuest target system ID mandatory.
+14 SET AGVQID=$PIECE(AGVQ3,U,6)
+15 IF '$LENGTH(AGVQID)
QUIT
+16 ;
+17 ; Communications protocol mandatory and not "NONE".
+18 SET AGVQCP=$PIECE(AGVQ3,U,7)
+19 IF "N"[AGVQCP
QUIT
+20 ;
+21 ; Number of days to wait between successive checks on a patient.
+22 SET AGVQINTV=$SELECT(+$PIECE(AGVQ3,U,5)>0:$PIECE(AGVQ3,U,5),1:30)
+23 ;
+24 ; Don't advance index/open file if Pat not recheck eligible.
+25 IF $DATA(^AGVQP(DFN,0))
IF $$FMDIFF^XLFDT(DT,$PIECE(^AGVQP(DFN,0),U,2))<AGVQINTV
QUIT
+26 ;
+27 ; Filename prefix.
+28 SET AGVQPRE=$SELECT($PIECE(AGVQ3,U,4)]"":$PIECE(AGVQ3,U,4),1:"VQ")
+29 ;
+30 ; VeriQuest target system logon.
+31 SET AGVQUSR=$PIECE(AGVQ3,U,8)
+32 ;
+33 ; VeriQuest target system password.
+34 SET AGVQPWD=$PIECE(AGVQ3,U,9)
+35 ;
+36 ;Get incremental file index number for file names.
+37 LOCK +^AGFAC(DUZ(2),3):5
+38 IF '$TEST
QUIT
+39 SET AGVQIDX=$PIECE(^AGFAC(DUZ(2),3),U,3)+1
SET $PIECE(^(3),U,3)=AGVQIDX
+40 LOCK -^AGFAC(DUZ(2),3)
+41 ;
+42 ;Pad/Format index number for file name, if necessary.
+43 IF $LENGTH(AGVQIDX)<AGVQIL
NEW P
SET P=AGVQIL-$LENGTH(AGVQIDX)
SET P=$EXTRACT("000000",1,P)
SET AGVQIDX=P_AGVQIDX
+44 SET AGVQFILE=AGVQPRE_AGVQIDX
+45 ;
+46 ;Open HFS device.
+47 DO OPEN^%ZISH("AGVQOUT",AGVQDIR,AGVQFILE,"W")
+48 IF POP
QUIT
+49 ;
+50 SET AGVQQUIT=0
+51 QUIT
+52 ;
MAIN ;Primary execution module.
+1 ;
+2 USE IO
+3 DO START^AGFACE
+4 ; Ensure last line of file is complete.
+5 WRITE !
+6 ;
+7 ;Update record of Patient's last Elig Check.
+8 ;
+9 ;If no previous entry, create one.
+10 IF '$DATA(^AGVQP(DFN,0))
NEW DIC,X
SET DIC="^AGVQP("
SET X="`"_DFN
SET DIC(0)="LN"
SET DIC("DR")=".02////"_DT
DO ^DIC
QUIT
+11 ;
+12 ;Else update the previous entry.
+13 NEW DA,DIE,DR
+14 SET DIE="^AGVQP("
SET DA=DFN
SET DR=".02////"_DT
+15 DO ^DIE
+16 QUIT
+17 ;
SNDFILE ;Transmit file to VeriQuest receiving system.
+1 NEW AGCMD
+2 ;
+3 SET AGCMD="sendto"
+4 IF ^%ZOSF("OS")["UNIX"
SET AGCMD="/usr/bin/"_AGCMD
+5 IF AGVQCP="F"
IF $LENGTH(AGVQUSR)
SET AGCMD=AGCMD_" -l "_AGVQUSR
IF $LENGTH(AGVQPWD)
SET AGCMD=AGCMD_":"_AGVQPWD
+6 SET AGCMD=AGCMD_" "_AGVQID_" "_AGVQDIR_AGVQFILE
+7 IF $$JOBWAIT^%HOSTCMD(AGCMD)
IF '$DATA(ZTQUEUED)
WRITE !,"""sendto"" of Face Sheet to VeriQuest FAILED."
IF $$DIR^XBDIR("E","Press RETURN")
+8 QUIT
+9 ;
EXIT ;Clean up before leaving.
+1 KILL AGVQDIR,AGVQFILE,AGVQIDX,AGVQIL,AGVQINTV,AGVQPRE,AGVQQUIT,AGVQID,AGVQUSR,AGVQPWD,AGVQQFS
+2 QUIT
+3 ;