RAHLRS ;HIRMFO/CRT/PDW - Resend HL7 messages for selected cases ;01/19/08 12:40
;;5.0;Radiology/Nuclear Medicine;**25,54,60,71,82,95**;Mar 16, 1998;Build 7
;
; Utility to RESEND HL7 messages
;
;;02/14/2006 BAY/KAM RA*5*71 Add ability to update exam data to V/R
N RACNI,RADFN,RADTI,RARPT,X
;
D SETVARS Q:$G(RAIMGTY)=""
;
F S X=$$RACNLU(.RADFN,.RADTI,.RACNI) Q:+X'>0 D Q:QUIT<0
.D RESEND(RADFN,RADTI,RACNI,.QUIT)
Q
;
RACNLU(RADFN,RADTI,RACNI) ; Select Case Number
;
N RANOSCRN S RANOSCRN="" ; Don't limit cases to current Imaging Type
S (RADFN,RADTI,RADFN)=""
D ^RACNLU
Q X
;
RESEND(RADFN,RADTI,RACNI,QUIT) ; re-send exam message(s) to HL7 subscribers
;
N RAED,RASSSX,RARPST ;added RASSSX,RARPST, RA*5*95
;
S QUIT=0
I '$D(DT) D ^%DT S DT=Y
;
S RAED=$$RAED(RADFN,RADTI,RACNI)
S QUIT=$$OK(RADFN,RADTI,RACNI)
I QUIT>0 D
.I RAED[",REG," D
..D EN^DDIOL("Re-sending 'EXAM REGISTERD' HL7 message...",,"!!,?6")
..D REG^RAHLRPC
.I RAED[",CANCEL," D
..D EN^DDIOL("Re-sending 'EXAM CANCELLED' HL7 message...",,"!,?6")
..D CANCEL^RAHLRPC
.I RAED[",EXAM," D
..S $P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),"^",30)="" ;Reset sent flag
..D EN^DDIOL("Re-sending 'EXAMINED' HL7 message...",,"!,?6")
..N RAEXMDUN D 1^RAHLRPC ;*60 Newed RAEXMDUN to prevent variable leak
.I RAED[",RPT," D
..D EN^DDIOL("Re-sending 'REPORT VERIFIED' HL7 message...",,"!,?6")
..;If EF report, set up RASSSX() to exclude VR subscribers, RA*5*95
..I $G(RARPST)="EF" D HLXMSG^RARTE5
..D RPT^RAHLRPC
Q
;
RAED(RADFN,RADTI,RACNI) ; identify correct ^RAHLRPC entry point(s)
;
; removed RARPTST from new, RA*5*95
N RASTAT,RAIMTYP,RAORD,RETURN
S (RARPST,RASTAT)=""
;
S RETURN=",REG,"
;
S RASTAT=$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN,3,"I")
;
S RAIMTYP=$$GET1^DIQ(72,+RASTAT,7)
S RAORD=$$GET1^DIQ(72,+RASTAT,3)
;
S:RAORD=0 RETURN=RETURN_"CANCEL,"
;
I $$GET1^DIQ(72,+RASTAT,8)="YES" D ; Generate Examined HL7 Message
.S RETURN=RETURN_"EXAM,"
;
I RETURN'[",EXAM," D
.; also check previous statuses for 'Generate Examined HL7 Message'
.F S RAORD=$O(^RA(72,"AA",RAIMTYP,RAORD),-1) Q:+RAORD<1 D Q:RETURN[",EXAM,"
..S RASTAT=$O(^RA(72,"AA",RAIMTYP,RAORD,0))
..I $$GET1^DIQ(72,+RASTAT,8)="YES" S RETURN=RETURN_"EXAM,"
;
I RARPT]"" D ; Check if Verified or Elect. Filed report exists
.S RARPST=$$GET1^DIQ(74,RARPT,5,"I")
.I "^V^EF^"[("^"_RARPST_"^") S RETURN=RETURN_"RPT," ;RA*5*95
;
Q RETURN
;
OK(RADFN,RADTI,RACNI) ; Get User to confirm continue
;
N X,RAEXST
;
S RAEXST=$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN,3)
;
S X="",$P(X,"=",70)=""
D EN^DDIOL(X,"","!?5")
S DIR("A")="Re-send all HL7 messages for this '"_RAEXST_"' case?"
S DIR(0)="Y",DIR("B")="YES" D ^DIR
I Y="^" Q -1
Q Y
;
SETVARS ; Setup key Rad/Nuc Med variables
;
I $O(RACCESS(DUZ,""))="" D SETVARS^RAPSET1(0)
Q:'($D(RACCESS(DUZ))\10) ; user does not have location access
I $G(RAIMGTY)="" D SETVARS^RAPSET1(1) K:$G(RAIMGTY)="" XQUIT
Q
RAHLRS ;HIRMFO/CRT/PDW - Resend HL7 messages for selected cases ;01/19/08 12:40
+1 ;;5.0;Radiology/Nuclear Medicine;**25,54,60,71,82,95**;Mar 16, 1998;Build 7
+2 ;
+3 ; Utility to RESEND HL7 messages
+4 ;
+5 ;;02/14/2006 BAY/KAM RA*5*71 Add ability to update exam data to V/R
+6 NEW RACNI,RADFN,RADTI,RARPT,X
+7 ;
+8 DO SETVARS
IF $GET(RAIMGTY)=""
QUIT
+9 ;
+10 FOR
SET X=$$RACNLU(.RADFN,.RADTI,.RACNI)
IF +X'>0
QUIT
Begin DoDot:1
+11 DO RESEND(RADFN,RADTI,RACNI,.QUIT)
End DoDot:1
IF QUIT<0
QUIT
+12 QUIT
+13 ;
RACNLU(RADFN,RADTI,RACNI) ; Select Case Number
+1 ;
+2 ; Don't limit cases to current Imaging Type
NEW RANOSCRN
SET RANOSCRN=""
+3 SET (RADFN,RADTI,RADFN)=""
+4 DO ^RACNLU
+5 QUIT X
+6 ;
RESEND(RADFN,RADTI,RACNI,QUIT) ; re-send exam message(s) to HL7 subscribers
+1 ;
+2 ;added RASSSX,RARPST, RA*5*95
NEW RAED,RASSSX,RARPST
+3 ;
+4 SET QUIT=0
+5 IF '$DATA(DT)
DO ^%DT
SET DT=Y
+6 ;
+7 SET RAED=$$RAED(RADFN,RADTI,RACNI)
+8 SET QUIT=$$OK(RADFN,RADTI,RACNI)
+9 IF QUIT>0
Begin DoDot:1
+10 IF RAED[",REG,"
Begin DoDot:2
+11 DO EN^DDIOL("Re-sending 'EXAM REGISTERD' HL7 message...",,"!!,?6")
+12 DO REG^RAHLRPC
End DoDot:2
+13 IF RAED[",CANCEL,"
Begin DoDot:2
+14 DO EN^DDIOL("Re-sending 'EXAM CANCELLED' HL7 message...",,"!,?6")
+15 DO CANCEL^RAHLRPC
End DoDot:2
+16 IF RAED[",EXAM,"
Begin DoDot:2
+17 ;Reset sent flag
SET $PIECE(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),"^",30)=""
+18 DO EN^DDIOL("Re-sending 'EXAMINED' HL7 message...",,"!,?6")
+19 ;*60 Newed RAEXMDUN to prevent variable leak
NEW RAEXMDUN
DO 1^RAHLRPC
End DoDot:2
+20 IF RAED[",RPT,"
Begin DoDot:2
+21 DO EN^DDIOL("Re-sending 'REPORT VERIFIED' HL7 message...",,"!,?6")
+22 ;If EF report, set up RASSSX() to exclude VR subscribers, RA*5*95
+23 IF $GET(RARPST)="EF"
DO HLXMSG^RARTE5
+24 DO RPT^RAHLRPC
End DoDot:2
End DoDot:1
+25 QUIT
+26 ;
RAED(RADFN,RADTI,RACNI) ; identify correct ^RAHLRPC entry point(s)
+1 ;
+2 ; removed RARPTST from new, RA*5*95
+3 NEW RASTAT,RAIMTYP,RAORD,RETURN
+4 SET (RARPST,RASTAT)=""
+5 ;
+6 SET RETURN=",REG,"
+7 ;
+8 SET RASTAT=$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN,3,"I")
+9 ;
+10 SET RAIMTYP=$$GET1^DIQ(72,+RASTAT,7)
+11 SET RAORD=$$GET1^DIQ(72,+RASTAT,3)
+12 ;
+13 IF RAORD=0
SET RETURN=RETURN_"CANCEL,"
+14 ;
+15 ; Generate Examined HL7 Message
IF $$GET1^DIQ(72,+RASTAT,8)="YES"
Begin DoDot:1
+16 SET RETURN=RETURN_"EXAM,"
End DoDot:1
+17 ;
+18 IF RETURN'[",EXAM,"
Begin DoDot:1
+19 ; also check previous statuses for 'Generate Examined HL7 Message'
+20 FOR
SET RAORD=$ORDER(^RA(72,"AA",RAIMTYP,RAORD),-1)
IF +RAORD<1
QUIT
Begin DoDot:2
+21 SET RASTAT=$ORDER(^RA(72,"AA",RAIMTYP,RAORD,0))
+22 IF $$GET1^DIQ(72,+RASTAT,8)="YES"
SET RETURN=RETURN_"EXAM,"
End DoDot:2
IF RETURN[",EXAM,"
QUIT
End DoDot:1
+23 ;
+24 ; Check if Verified or Elect. Filed report exists
IF RARPT]""
Begin DoDot:1
+25 SET RARPST=$$GET1^DIQ(74,RARPT,5,"I")
+26 ;RA*5*95
IF "^V^EF^"[("^"_RARPST_"^")
SET RETURN=RETURN_"RPT,"
End DoDot:1
+27 ;
+28 QUIT RETURN
+29 ;
OK(RADFN,RADTI,RACNI) ; Get User to confirm continue
+1 ;
+2 NEW X,RAEXST
+3 ;
+4 SET RAEXST=$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN,3)
+5 ;
+6 SET X=""
SET $PIECE(X,"=",70)=""
+7 DO EN^DDIOL(X,"","!?5")
+8 SET DIR("A")="Re-send all HL7 messages for this '"_RAEXST_"' case?"
+9 SET DIR(0)="Y"
SET DIR("B")="YES"
DO ^DIR
+10 IF Y="^"
QUIT -1
+11 QUIT Y
+12 ;
SETVARS ; Setup key Rad/Nuc Med variables
+1 ;
+2 IF $ORDER(RACCESS(DUZ,""))=""
DO SETVARS^RAPSET1(0)
+3 ; user does not have location access
IF '($DATA(RACCESS(DUZ))\10)
QUIT
+4 IF $GET(RAIMGTY)=""
DO SETVARS^RAPSET1(1)
IF $GET(RAIMGTY)=""
KILL XQUIT
+5 QUIT