VAQBUL03 ;ALB/JRP - BULLETINS;25-MAY-93
;;1.5;PATIENT DATA EXCHANGE;**9**;NOV 17, 1993
RESULTS(TRANPTR) ;SEND RESULTS RECEIVED BULLETIN
;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
;OUTPUT : 0 - Bulletin sent
; -1^Error_Text - Bulletin not sent
;
;CHECK INPUT
S TRANPTR=+$G(TRANPTR)
Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass valid transaction"
;DECLARE VARIABLES
N TRANNUM,NAME,PID,DOB,RQSTBY,RQSTON,ATHRBY,SITE,DOMAIN
N STATUS,TMP,TMPARR,LINE,OFFSET,SPACE,COMMENT,X,DIWL,DIWR,DIWF
N SENSITVE,DFN,XMY,Y,TMPROOT,ERROR
S TMPARR="^TMP(""VAQ-BUL"","_$J_")"
K @TMPARR,^UTILITY($J,"W")
S SPACE=" "
;DETERMINE RESULT OF REQUEST
S TMP=$$STATYPE^VAQCON1(TRANPTR,1)
Q:($P(TMP,"^",1)="-1") TMP
Q:($P(TMP,"^",2)'="RES") "-1^Transaction did not contain results of a request"
S STATUS=$P(TMP,"^",1)
;GET TRANSACTION NUMBER
S TMP=$G(^VAT(394.61,TRANPTR,0))
S TRANNUM=+TMP
Q:('TRANNUM) "-1^Transaction did not contain a transaction number"
;GET PATIENT POINTER
S DFN=+$P(TMP,"^",3)
;CHECK REMOTE SENSITIVITY (SET TO 1 IF SENSITIVE)
S SENSITVE=+$P(TMP,"^",4)
;CHECK LOCAL SENSITIVITY (SET TO 2 IF SENSITIVE)
I (('SENSITVE)&(DFN)) D
.S SENSITVE=+$$GETSEN^VAQUTL97(DFN)
.;ON ERROR ASSUME SENSITIVE
.S:(SENSITVE) SENSITVE=2
;RETURN SUCCESS IF NOTIFICATION WAS NOT REQUESTED AND PATIENT
; IS NOT SENSITIVE AT LOCAL AND REMOTE FACILITY
I ('(+$O(^VAT(394.61,TRANPTR,"NTFY2",0)))) Q:('SENSITVE) 0
;GET PATIENT INFORMATION
S TMP=$G(^VAT(394.61,TRANPTR,"QRY"))
S NAME=$P(TMP,"^",1)
S:(NAME="") NAME="Not listed"
S DOB=$$DOBFMT^VAQUTL99($P(TMP,"^",3),0)
S:(DOB="") DOB="Not listed"
S PID=$P(TMP,"^",4)
I (PID="") D
.;GET PID FROM SSN
.S PID=$P(TMP,"^",2)
.I (PID="") S PID="Not listed" Q
.S PID=$$DASHSSN^VAQUTL99(PID)
;GET REQUEST INFORMATION
S TMP=$G(^VAT(394.61,TRANPTR,"RQST1"))
S RQSTON=$$DOBFMT^VAQUTL99($P(TMP,"^",1),1)
S:(RQSTON="") RQSTON="Could not be determined"
S RQSTBY=$P(TMP,"^",2)
S:(RQSTBY="") RQSTBY="Unknown"
;GET REMOTE INFORMATION
S TMP=$G(^VAT(394.61,TRANPTR,"ATHR1"))
S ATHRBY=$P(TMP,"^",2)
S:(ATHRBY="") ATHBY="Uknown"
S:(ATHRBY="POSTMASTER") ATHBY="PDX Server"
S TMP=$G(^VAT(394.61,TRANPTR,"ATHR2"))
S SITE=$P(TMP,"^",1)
S:(SITE="") SITE="Could not be determined"
S DOMAIN=$P(TMP,"^",2)
S:(DOMAIN="") DOMAIN="Could not be determined"
;BUILD MESSAGE
S LINE=1
S TMP="Your request for information has been "
S TMP=TMP_$S((STATUS="VAQ-RSLT"):"processed and returned",1:"rejected")_" ..."
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=""
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
;PUT IN TRANSACTION INFO
S TMP=SPACE_"Transaction number: "_TRANNUM
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=SPACE_"Name: "_NAME
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=SPACE_"PID: "_PID
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=SPACE_"DOB: "_DOB
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=""
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
;PRINT SENSITIVITY
I (SENSITVE) D
.S TMP="*** PATIENT WAS LISTED AS SENSITIVE AT THE REMOTE FACILITY ***"
.S:(SENSITVE=2) TMP="*** PATIENT IS LISTED AS SENSITIVE IN YOUR FACILITY ***"
.S TMP=SPACE_TMP
.S @TMPARR@("DISPLAY",LINE,0)=TMP
.S LINE=LINE+1
.S TMP=""
.S @TMPARR@("DISPLAY",LINE,0)=TMP
.S LINE=LINE+1
;PUT IN REQUESTING INFO
S TMP=SPACE_"Requested by: "_RQSTBY
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=SPACE_"Requested on: "_RQSTON
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=""
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
;PUT IN AUTHORIZING INFO
S TMP=SPACE_"Processed by: "_ATHRBY
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=SPACE_"Site: "_SITE
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=SPACE_"Domain: "_DOMAIN
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
S TMP=""
S @TMPARR@("DISPLAY",LINE,0)=TMP
S LINE=LINE+1
;CONTINUATION
S ERROR=0
D RESULTS^VAQBUL04
;DONE (CLEAN UP)
K @TMPARR,^UTILITY($J,"W")
Q ERROR
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQBUL03 4129 printed Dec 13, 2024@02:24:37 Page 2
VAQBUL03 ;ALB/JRP - BULLETINS;25-MAY-93
+1 ;;1.5;PATIENT DATA EXCHANGE;**9**;NOV 17, 1993
RESULTS(TRANPTR) ;SEND RESULTS RECEIVED BULLETIN
+1 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
+2 ;OUTPUT : 0 - Bulletin sent
+3 ; -1^Error_Text - Bulletin not sent
+4 ;
+5 ;CHECK INPUT
+6 SET TRANPTR=+$GET(TRANPTR)
+7 if (('TRANPTR)!('$DATA(^VAT(394.61,TRANPTR))))
QUIT "-1^Did not pass valid transaction"
+8 ;DECLARE VARIABLES
+9 NEW TRANNUM,NAME,PID,DOB,RQSTBY,RQSTON,ATHRBY,SITE,DOMAIN
+10 NEW STATUS,TMP,TMPARR,LINE,OFFSET,SPACE,COMMENT,X,DIWL,DIWR,DIWF
+11 NEW SENSITVE,DFN,XMY,Y,TMPROOT,ERROR
+12 SET TMPARR="^TMP(""VAQ-BUL"","_$JOB_")"
+13 KILL @TMPARR,^UTILITY($JOB,"W")
+14 SET SPACE=" "
+15 ;DETERMINE RESULT OF REQUEST
+16 SET TMP=$$STATYPE^VAQCON1(TRANPTR,1)
+17 if ($PIECE(TMP,"^",1)="-1")
QUIT TMP
+18 if ($PIECE(TMP,"^",2)'="RES")
QUIT "-1^Transaction did not contain results of a request"
+19 SET STATUS=$PIECE(TMP,"^",1)
+20 ;GET TRANSACTION NUMBER
+21 SET TMP=$GET(^VAT(394.61,TRANPTR,0))
+22 SET TRANNUM=+TMP
+23 if ('TRANNUM)
QUIT "-1^Transaction did not contain a transaction number"
+24 ;GET PATIENT POINTER
+25 SET DFN=+$PIECE(TMP,"^",3)
+26 ;CHECK REMOTE SENSITIVITY (SET TO 1 IF SENSITIVE)
+27 SET SENSITVE=+$PIECE(TMP,"^",4)
+28 ;CHECK LOCAL SENSITIVITY (SET TO 2 IF SENSITIVE)
+29 IF (('SENSITVE)&(DFN))
Begin DoDot:1
+30 SET SENSITVE=+$$GETSEN^VAQUTL97(DFN)
+31 ;ON ERROR ASSUME SENSITIVE
+32 if (SENSITVE)
SET SENSITVE=2
End DoDot:1
+33 ;RETURN SUCCESS IF NOTIFICATION WAS NOT REQUESTED AND PATIENT
+34 ; IS NOT SENSITIVE AT LOCAL AND REMOTE FACILITY
+35 IF ('(+$ORDER(^VAT(394.61,TRANPTR,"NTFY2",0))))
if ('SENSITVE)
QUIT 0
+36 ;GET PATIENT INFORMATION
+37 SET TMP=$GET(^VAT(394.61,TRANPTR,"QRY"))
+38 SET NAME=$PIECE(TMP,"^",1)
+39 if (NAME="")
SET NAME="Not listed"
+40 SET DOB=$$DOBFMT^VAQUTL99($PIECE(TMP,"^",3),0)
+41 if (DOB="")
SET DOB="Not listed"
+42 SET PID=$PIECE(TMP,"^",4)
+43 IF (PID="")
Begin DoDot:1
+44 ;GET PID FROM SSN
+45 SET PID=$PIECE(TMP,"^",2)
+46 IF (PID="")
SET PID="Not listed"
QUIT
+47 SET PID=$$DASHSSN^VAQUTL99(PID)
End DoDot:1
+48 ;GET REQUEST INFORMATION
+49 SET TMP=$GET(^VAT(394.61,TRANPTR,"RQST1"))
+50 SET RQSTON=$$DOBFMT^VAQUTL99($PIECE(TMP,"^",1),1)
+51 if (RQSTON="")
SET RQSTON="Could not be determined"
+52 SET RQSTBY=$PIECE(TMP,"^",2)
+53 if (RQSTBY="")
SET RQSTBY="Unknown"
+54 ;GET REMOTE INFORMATION
+55 SET TMP=$GET(^VAT(394.61,TRANPTR,"ATHR1"))
+56 SET ATHRBY=$PIECE(TMP,"^",2)
+57 if (ATHRBY="")
SET ATHBY="Uknown"
+58 if (ATHRBY="POSTMASTER")
SET ATHBY="PDX Server"
+59 SET TMP=$GET(^VAT(394.61,TRANPTR,"ATHR2"))
+60 SET SITE=$PIECE(TMP,"^",1)
+61 if (SITE="")
SET SITE="Could not be determined"
+62 SET DOMAIN=$PIECE(TMP,"^",2)
+63 if (DOMAIN="")
SET DOMAIN="Could not be determined"
+64 ;BUILD MESSAGE
+65 SET LINE=1
+66 SET TMP="Your request for information has been "
+67 SET TMP=TMP_$SELECT((STATUS="VAQ-RSLT"):"processed and returned",1:"rejected")_" ..."
+68 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+69 SET LINE=LINE+1
+70 SET TMP=""
+71 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+72 SET LINE=LINE+1
+73 ;PUT IN TRANSACTION INFO
+74 SET TMP=SPACE_"Transaction number: "_TRANNUM
+75 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+76 SET LINE=LINE+1
+77 SET TMP=SPACE_"Name: "_NAME
+78 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+79 SET LINE=LINE+1
+80 SET TMP=SPACE_"PID: "_PID
+81 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+82 SET LINE=LINE+1
+83 SET TMP=SPACE_"DOB: "_DOB
+84 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+85 SET LINE=LINE+1
+86 SET TMP=""
+87 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+88 SET LINE=LINE+1
+89 ;PRINT SENSITIVITY
+90 IF (SENSITVE)
Begin DoDot:1
+91 SET TMP="*** PATIENT WAS LISTED AS SENSITIVE AT THE REMOTE FACILITY ***"
+92 if (SENSITVE=2)
SET TMP="*** PATIENT IS LISTED AS SENSITIVE IN YOUR FACILITY ***"
+93 SET TMP=SPACE_TMP
+94 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+95 SET LINE=LINE+1
+96 SET TMP=""
+97 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+98 SET LINE=LINE+1
End DoDot:1
+99 ;PUT IN REQUESTING INFO
+100 SET TMP=SPACE_"Requested by: "_RQSTBY
+101 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+102 SET LINE=LINE+1
+103 SET TMP=SPACE_"Requested on: "_RQSTON
+104 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+105 SET LINE=LINE+1
+106 SET TMP=""
+107 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+108 SET LINE=LINE+1
+109 ;PUT IN AUTHORIZING INFO
+110 SET TMP=SPACE_"Processed by: "_ATHRBY
+111 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+112 SET LINE=LINE+1
+113 SET TMP=SPACE_"Site: "_SITE
+114 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+115 SET LINE=LINE+1
+116 SET TMP=SPACE_"Domain: "_DOMAIN
+117 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+118 SET LINE=LINE+1
+119 SET TMP=""
+120 SET @TMPARR@("DISPLAY",LINE,0)=TMP
+121 SET LINE=LINE+1
+122 ;CONTINUATION
+123 SET ERROR=0
+124 DO RESULTS^VAQBUL04
+125 ;DONE (CLEAN UP)
+126 KILL @TMPARR,^UTILITY($JOB,"W")
+127 QUIT ERROR