DGPFHLRT ;ALB/RPM - PRF HL7 MESSAGE RETRANSMIT ; 7/18/06 10:49am
;;5.3;Registration;**425,650,1015**;Aug 13, 1993;Build 21
;This routine generates a QRY~R02 HL7 message for all Incomplete
;status PRF HL7 EVENT (#26.21) file patient query records.
;
Q ;no direct entry
;
RUNQRY ;Generate new PRF QRY~R02 HL7 Query for a patient
;This procedure scans all entries in the ASTAT index of the PRF HL7
;EVENT (#26.21) file, looking for INCOMPLETE status HL7 query records
;
N DGASGN ;array of Category I assignment ien's
N DGDFN ;pointer to patient in PATIENT (#2) file
N DGLIEN ;PRF HL7 EVENT (#26.21) file IEN
N DGPFL ;array of event data fields
;
S DGLIEN=0
F S DGLIEN=$O(^DGPF(26.21,"ASTAT","I",DGLIEN)) Q:'DGLIEN D
. K DGPFL,DGASGN
. Q:'$$GETEVNT^DGPFHLL1(DGLIEN,.DGPFL)
. ;
. Q:($P($G(DGPFL("STAT")),U,1)'="I")
. ;
. S DGDFN=$P($G(DGPFL("DFN")),U,1)
. Q:DGDFN']""
. ;
. ;If patient already has the total possible number of Cat I flags,
. ;then mark the query event file as COMPLETE and quit.
. I $$GETALL^DGPFAA(DGDFN,.DGASGN,"",1)=$$CNTRECS^DGPFUT1(26.15) D Q
. . D STOEVNT^DGPFHLL1(DGDFN,"C")
. ;
. ;mark the event in ERROR when attempt limit is reached and quit
. I $$QRYCNT(DGLIEN)+1>$$TRYLIMIT() D Q
. . D STOEVNT^DGPFHLL1(DGDFN,"E")
. ;
. ;run query in deferred mode
. I $$SNDQRY^DGPFHLS(DGDFN,2)
. ;
Q
;
QRYCNT(DGEVNT) ;get number of logged query attempts
;This function counts the number of entries in the PRF HL7 QUERY LOG
;(#26.19) file for a given PRF HL7 EVENT.
;
; Input:
; DGEVNT - pointer to PRF HL7 EVENT (#26.21) file
;
; Function value - number of logged query attempts
;
N DGCNT
N DGLIEN
;
S DGEVNT=+$G(DGEVNT)
S DGCNT=0
S DGLIEN=0
F S DGLIEN=$O(^DGPF(26.19,"C",DGEVNT,DGLIEN)) Q:'DGLIEN D
. S DGCNT=DGCNT+1
;
Q DGCNT
;
TRYLIMIT() ;get PRF Query Try Limit parameter value
;
; Input: none
;
; Output:
; Function value - DGPF QUERY TRY LIMIT parameter [DEFAULT=5]
;
N DGVAL
S DGVAL=$$GET^XPAR("PKG","DGPF QUERY TRY LIMIT",1,"Q")
Q $S(DGVAL="":5,1:DGVAL)
DGPFHLRT ;ALB/RPM - PRF HL7 MESSAGE RETRANSMIT ; 7/18/06 10:49am
+1 ;;5.3;Registration;**425,650,1015**;Aug 13, 1993;Build 21
+2 ;This routine generates a QRY~R02 HL7 message for all Incomplete
+3 ;status PRF HL7 EVENT (#26.21) file patient query records.
+4 ;
+5 ;no direct entry
QUIT
+6 ;
RUNQRY ;Generate new PRF QRY~R02 HL7 Query for a patient
+1 ;This procedure scans all entries in the ASTAT index of the PRF HL7
+2 ;EVENT (#26.21) file, looking for INCOMPLETE status HL7 query records
+3 ;
+4 ;array of Category I assignment ien's
NEW DGASGN
+5 ;pointer to patient in PATIENT (#2) file
NEW DGDFN
+6 ;PRF HL7 EVENT (#26.21) file IEN
NEW DGLIEN
+7 ;array of event data fields
NEW DGPFL
+8 ;
+9 SET DGLIEN=0
+10 FOR
SET DGLIEN=$ORDER(^DGPF(26.21,"ASTAT","I",DGLIEN))
IF 'DGLIEN
QUIT
Begin DoDot:1
+11 KILL DGPFL,DGASGN
+12 IF '$$GETEVNT^DGPFHLL1(DGLIEN,.DGPFL)
QUIT
+13 ;
+14 IF ($PIECE($GET(DGPFL("STAT")),U,1)'="I")
QUIT
+15 ;
+16 SET DGDFN=$PIECE($GET(DGPFL("DFN")),U,1)
+17 IF DGDFN']""
QUIT
+18 ;
+19 ;If patient already has the total possible number of Cat I flags,
+20 ;then mark the query event file as COMPLETE and quit.
+21 IF $$GETALL^DGPFAA(DGDFN,.DGASGN,"",1)=$$CNTRECS^DGPFUT1(26.15)
Begin DoDot:2
+22 DO STOEVNT^DGPFHLL1(DGDFN,"C")
End DoDot:2
QUIT
+23 ;
+24 ;mark the event in ERROR when attempt limit is reached and quit
+25 IF $$QRYCNT(DGLIEN)+1>$$TRYLIMIT()
Begin DoDot:2
+26 DO STOEVNT^DGPFHLL1(DGDFN,"E")
End DoDot:2
QUIT
+27 ;
+28 ;run query in deferred mode
+29 IF $$SNDQRY^DGPFHLS(DGDFN,2)
+30 ;
End DoDot:1
+31 QUIT
+32 ;
QRYCNT(DGEVNT) ;get number of logged query attempts
+1 ;This function counts the number of entries in the PRF HL7 QUERY LOG
+2 ;(#26.19) file for a given PRF HL7 EVENT.
+3 ;
+4 ; Input:
+5 ; DGEVNT - pointer to PRF HL7 EVENT (#26.21) file
+6 ;
+7 ; Function value - number of logged query attempts
+8 ;
+9 NEW DGCNT
+10 NEW DGLIEN
+11 ;
+12 SET DGEVNT=+$GET(DGEVNT)
+13 SET DGCNT=0
+14 SET DGLIEN=0
+15 FOR
SET DGLIEN=$ORDER(^DGPF(26.19,"C",DGEVNT,DGLIEN))
IF 'DGLIEN
QUIT
Begin DoDot:1
+16 SET DGCNT=DGCNT+1
End DoDot:1
+17 ;
+18 QUIT DGCNT
+19 ;
TRYLIMIT() ;get PRF Query Try Limit parameter value
+1 ;
+2 ; Input: none
+3 ;
+4 ; Output:
+5 ; Function value - DGPF QUERY TRY LIMIT parameter [DEFAULT=5]
+6 ;
+7 NEW DGVAL
+8 SET DGVAL=$$GET^XPAR("PKG","DGPF QUERY TRY LIMIT",1,"Q")
+9 QUIT $SELECT(DGVAL="":5,1:DGVAL)