AFJXTRF ;FO-OAKLAND/GMB-AFJXALRT (cont'd) ;2/13/01 14:59
;;5.1;Network Health Exchange;**17,18,23,26,31**;Jan 23, 1996
; Totally rewritten 11/2001. (Previously AAA.)
SPL2TMP ; Transfer the lines from the spool document to the temp global
; Incoming: AXPID,AXTI,AXSPDOC,AXSPDATA,AXRQFROM
D CHKDATA(AXSPDATA,.AXPID) Q:AXABORT
N AXSPI,AXDREC
S AXSPI=0
S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)="-Patient ID verified on all data segments-"
S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=""
F D Q:'AXSPI ; Transfer one segment at a time
. F S AXSPI=$O(^XMBS(3.519,AXSPDATA,2,AXSPI)) Q:'AXSPI S AXDREC=^(AXSPI,0) Q:$E(AXDREC,1,3)="---"!(AXDREC["*** DECEASED ***")
. Q:'AXSPI
. S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=AXPID("INFO")
. I AXDREC["(max 365 days) " S AXDREC=$P(AXDREC,"(max 365 days) ")_"(12 months) ---"_$P(AXDREC,"(max 365 days) ",2)
. S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=AXDREC
. F S AXSPI=$O(^XMBS(3.519,AXSPDATA,2,AXSPI)) Q:'AXSPI S AXDREC=^(AXSPI,0) Q:$E(AXDREC,1,7)="*** END" D
. . S AXDREC=$G(^XMBS(3.519,AXSPDATA,2,AXSPI,0))
. . Q:AXDREC["|TOP|"!(AXDREC["(continued)")
. . S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=AXDREC
Q:'$P($G(^XMB(3.51,AXSPDOC,0)),U,11)
S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)="*** Data is incomplete ***"
Q
CHKDATA(AXSPDATA,AXPID) ; Patient ID Filter
N AXSPI,AXBAD,AXDREC,I
S AXSPI=0
F S AXSPI=$O(^XMBS(3.519,AXSPDATA,2,AXSPI)) Q:'AXSPI S AXDREC=^(AXSPI,0) D
. Q:AXDREC'["NHE EXTRACT SUMMARY"!(AXDREC["END ")
. F I=1:1:5,0 Q:$L($G(^XMBS(3.519,AXSPDATA,2,AXSPI+I,0)))
. Q:'I
. S AXDREC=$G(^XMBS(3.519,AXSPDATA,2,AXSPI+I,0))
. I '$$VALID(AXDREC,.AXPID) S AXBAD(AXDREC)="" ; Wrong Patient Data
Q:'$D(AXBAD)
D FAIL^AFJXALRT("Health Summary returned data for the wrong patient. Please try again.")
D BADMSG(.AXPID,.AXBAD)
Q
VALID(AXDREC,AXPID) ; Make sure we've got the right patient.
; AXDREC - Patient ID line from health summary.
; AXPID("NAME") - Patient Name
; AXPID("S-S-N") - Patient SSN
; AXPID("DOB") - Patient Date of Birth
; If AXDREC contains all three Patient ID's then AXFLD will equal zero.
N AXFLD
F AXFLD="NAME","S-S-N","DOB",0 Q:AXFLD=0 I $L($G(AXPID(AXFLD))),$L(AXDREC),AXDREC'[AXPID(AXFLD) Q
Q AXFLD=0
BADMSG(AXPID,AXBAD) ; Send message if PatID Filter Blocked a Data Request.
; Make sure AFJX PATID FILTER BLOCK mail group exists and has members
Q:'$$GOTLOCAL^XMXAPIG("AFJX PATID FILTER BLOCK")
N I,AXTEXT,XMSUB,XMTEXT,XMY,XMZ,AXDREC
S XMSUB="NHE PatID Filter Warning ("_AXPID("NAME")_")"
S XMY("G.AFJX PATID FILTER BLOCK")=""
S XMTEXT="AXTEXT("
S AXTEXT(1)=$$REPEAT^XLFSTR("*",69)
S AXTEXT(2)="NHE Data Request blocked by possible invalid Health Summary data."
S AXTEXT(3)="Requested by: "_$G(AXRQFROM,"Unknown user")
S AXTEXT(4)=$$REPEAT^XLFSTR("*",69)
S AXTEXT(5)=""
S AXTEXT(6)="Data Requested on Patient:"
S AXTEXT(7)=AXPID("INFO")
S AXTEXT(8)=""
S AXTEXT(9)="Patients Returned by Health Summary:"
S AXTEXT(10)=""
S I=10
S AXDREC=""
F S AXDREC=$O(AXBAD(AXDREC)) Q:AXDREC="" S I=I+1,AXTEXT(I)=AXDREC
D ^XMD
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HAFJXTRF 3097 printed Dec 13, 2024@02:17:54 Page 2
AFJXTRF ;FO-OAKLAND/GMB-AFJXALRT (cont'd) ;2/13/01 14:59
+1 ;;5.1;Network Health Exchange;**17,18,23,26,31**;Jan 23, 1996
+2 ; Totally rewritten 11/2001. (Previously AAA.)
SPL2TMP ; Transfer the lines from the spool document to the temp global
+1 ; Incoming: AXPID,AXTI,AXSPDOC,AXSPDATA,AXRQFROM
+2 DO CHKDATA(AXSPDATA,.AXPID)
if AXABORT
QUIT
+3 NEW AXSPI,AXDREC
+4 SET AXSPI=0
+5 SET AXTI=AXTI+1
SET ^TMP("AFJX",$JOB,AXTI,0)="-Patient ID verified on all data segments-"
+6 SET AXTI=AXTI+1
SET ^TMP("AFJX",$JOB,AXTI,0)=""
+7 ; Transfer one segment at a time
FOR
Begin DoDot:1
+8 FOR
SET AXSPI=$ORDER(^XMBS(3.519,AXSPDATA,2,AXSPI))
if 'AXSPI
QUIT
SET AXDREC=^(AXSPI,0)
if $EXTRACT(AXDREC,1,3)="---"!(AXDREC["*** DECEASED ***")
QUIT
+9 if 'AXSPI
QUIT
+10 SET AXTI=AXTI+1
SET ^TMP("AFJX",$JOB,AXTI,0)=AXPID("INFO")
+11 IF AXDREC["(max 365 days) "
SET AXDREC=$PIECE(AXDREC,"(max 365 days) ")_"(12 months) ---"_$PIECE(AXDREC,"(max 365 days) ",2)
+12 SET AXTI=AXTI+1
SET ^TMP("AFJX",$JOB,AXTI,0)=AXDREC
+13 FOR
SET AXSPI=$ORDER(^XMBS(3.519,AXSPDATA,2,AXSPI))
if 'AXSPI
QUIT
SET AXDREC=^(AXSPI,0)
if $EXTRACT(AXDREC,1,7)="*** END"
QUIT
Begin DoDot:2
+14 SET AXDREC=$GET(^XMBS(3.519,AXSPDATA,2,AXSPI,0))
+15 if AXDREC["|TOP|"!(AXDREC["(continued)")
QUIT
+16 SET AXTI=AXTI+1
SET ^TMP("AFJX",$JOB,AXTI,0)=AXDREC
End DoDot:2
End DoDot:1
if 'AXSPI
QUIT
+17 if '$PIECE($GET(^XMB(3.51,AXSPDOC,0)),U,11)
QUIT
+18 SET AXTI=AXTI+1
SET ^TMP("AFJX",$JOB,AXTI,0)="*** Data is incomplete ***"
+19 QUIT
CHKDATA(AXSPDATA,AXPID) ; Patient ID Filter
+1 NEW AXSPI,AXBAD,AXDREC,I
+2 SET AXSPI=0
+3 FOR
SET AXSPI=$ORDER(^XMBS(3.519,AXSPDATA,2,AXSPI))
if 'AXSPI
QUIT
SET AXDREC=^(AXSPI,0)
Begin DoDot:1
+4 if AXDREC'["NHE EXTRACT SUMMARY"!(AXDREC["END ")
QUIT
+5 FOR I=1:1:5,0
if $LENGTH($GET(^XMBS(3.519,AXSPDATA,2,AXSPI+I,0)))
QUIT
+6 if 'I
QUIT
+7 SET AXDREC=$GET(^XMBS(3.519,AXSPDATA,2,AXSPI+I,0))
+8 ; Wrong Patient Data
IF '$$VALID(AXDREC,.AXPID)
SET AXBAD(AXDREC)=""
End DoDot:1
+9 if '$DATA(AXBAD)
QUIT
+10 DO FAIL^AFJXALRT("Health Summary returned data for the wrong patient. Please try again.")
+11 DO BADMSG(.AXPID,.AXBAD)
+12 QUIT
VALID(AXDREC,AXPID) ; Make sure we've got the right patient.
+1 ; AXDREC - Patient ID line from health summary.
+2 ; AXPID("NAME") - Patient Name
+3 ; AXPID("S-S-N") - Patient SSN
+4 ; AXPID("DOB") - Patient Date of Birth
+5 ; If AXDREC contains all three Patient ID's then AXFLD will equal zero.
+6 NEW AXFLD
+7 FOR AXFLD="NAME","S-S-N","DOB",0
if AXFLD=0
QUIT
IF $LENGTH($GET(AXPID(AXFLD)))
IF $LENGTH(AXDREC)
IF AXDREC'[AXPID(AXFLD)
QUIT
+8 QUIT AXFLD=0
BADMSG(AXPID,AXBAD) ; Send message if PatID Filter Blocked a Data Request.
+1 ; Make sure AFJX PATID FILTER BLOCK mail group exists and has members
+2 if '$$GOTLOCAL^XMXAPIG("AFJX PATID FILTER BLOCK")
QUIT
+3 NEW I,AXTEXT,XMSUB,XMTEXT,XMY,XMZ,AXDREC
+4 SET XMSUB="NHE PatID Filter Warning ("_AXPID("NAME")_")"
+5 SET XMY("G.AFJX PATID FILTER BLOCK")=""
+6 SET XMTEXT="AXTEXT("
+7 SET AXTEXT(1)=$$REPEAT^XLFSTR("*",69)
+8 SET AXTEXT(2)="NHE Data Request blocked by possible invalid Health Summary data."
+9 SET AXTEXT(3)="Requested by: "_$GET(AXRQFROM,"Unknown user")
+10 SET AXTEXT(4)=$$REPEAT^XLFSTR("*",69)
+11 SET AXTEXT(5)=""
+12 SET AXTEXT(6)="Data Requested on Patient:"
+13 SET AXTEXT(7)=AXPID("INFO")
+14 SET AXTEXT(8)=""
+15 SET AXTEXT(9)="Patients Returned by Health Summary:"
+16 SET AXTEXT(10)=""
+17 SET I=10
+18 SET AXDREC=""
+19 FOR
SET AXDREC=$ORDER(AXBAD(AXDREC))
if AXDREC=""
QUIT
SET I=I+1
SET AXTEXT(I)=AXDREC
+20 DO ^XMD
+21 QUIT