RABUL2 ;HISC/FPT,GJC-'RAD/NUC MED REPORT UNVERIFIED' Bulletin ;11/10/97 11:01
;;5.0;Radiology/Nuclear Medicine;**8**;Mar 16, 1998
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; The variables DA and RAX must be defined. RAX must be equal to 'V',
; and the value of DA (IEN of the record in file 74) must be greater
; than 0. These conditions must exist for the RAD/NUC MED REPORT
; UNVERIFIED bulletin to execute.
; Called From: ^DD(74,5,1,1,0-"DT") xref nodes
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ***** Variable List *****
; 'DIFQ' -> Variable used to check if we are installing the
; Radiology Package. If we are, do not fire off
; bulletins.
; 'RADFN' -> IEN of the patient in the PATIENT file (2)
; 'RAEXAM' -> IEN of a record in the Examinations multiple
; of the Radiology/Nuclear Medicine Patient file. (70)
; 'RAEXAM(0)'-> Zero node of a record in the Examinations multiple
; of the Radiology/Nuclear Medicine Patient file. (70)
; 'RARXAM(0)'-> Zero node of a record in the Registered Exam multiple
; of the Radiology/Nuclear Medicine Patient file. (70)
; 'RAFN1' -> internal format of a FM date/time data element
; { internal format pointer value }
; 'RAFN2' -> FM data definition for RAFN1, used in XTERNAL^RAUTL5
; 'A' -> Zero node of the RADIOLOGY/NUCLEAR MEDICINE REPORTS
; file (74) { node: ^RARPT(DA,0) }
;
; Format: Data to be fired;local var name;XMB array representation
; Patient ; RANAME ; XMB(1) <---> Desired Date ; RADDT ; XMB(5)
; Patient SSN ; RASSN ; XMB(2) <---> Report Status ; RASTAT ; XMB(6)
; Case Number ; RACASE ; XMB(3)<---> Req. Physician ; RARPHY ; XMB(7)
; Exam Date ; RAXDT ; XMB(4) <---> Rad. Procedure ; RAPROC ; XMB(8)
; Imag. Loc. ; RAILOC ; XMB(9) <---> Pri. Int'g Staff ; RASTF ; XMB(10)
; Pri. Int'g Resident ; RARES ; XMB(11)
;
; Quit if we are installing the software, current report status is
; verified, or if we are deleting the report.
; 'RADELRPT' is defined in the entry action of the RA DELETERPT option.
Q:$D(DIFQ)!($D(RADELRPT))
N RAX S RAX=X
Q:RAX'="V"!(+$G(DA)'>0)
N A,RACASE,RACN,RADDT,RADTI,RADFN,RAEXAM,RAFN1,RAFN2,RAILOC,RANAME
N RAPROC,RARES,RARPHY,RARXAM,RASSN,RASTAT,RASTF,RAXDT,X,Y
S A=$G(^RARPT(DA,0)) Q:$P(A,"^",5)="V" ; quit if the rpt is v'fied
S Y=DA D RASET^RAUTL2 ; Derive case/exam data from file 70
S RADFN(0)=RADFN
S (RADFN,RANAME)=+$P(A,U,2)
S RANAME=$S($D(^DPT(RANAME,0)):$P(^(0),U),1:"Unknown")
S RASSN=$$SSN^RAUTL() S RADFN=RADFN(0)
S RACASE=$$RPTCSE(A,DA)
S RAFN1=$P(A,U,3),RAFN2=$P($G(^DD(74,3,0)),U,2)
S RAXDT=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
S RAXDT=$S(RAXDT]"":RAXDT,1:"Unknown")
S RARXAM(0)=$G(^RADPT(+$G(RADFN),"DT",+$G(RADTI),0))
S RAEXAM=$O(^RADPT(+$G(RADFN),"DT",+$G(RADTI),"P","B",+$G(RACN),0))
S RAEXAM(0)=$G(^RADPT(+$G(RADFN),"DT",+$G(RADTI),"P",+$G(RAEXAM),0))
S RAFN1=$P(RAEXAM(0),U,21),RAFN2=$P($G(^DD(70.03,21,0)),U,2)
S RADDT=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
S RADDT=$S(RADDT]"":RADDT,1:"Unknown")
S RAFN1=$P(RAEXAM(0),U,14),RAFN2=$P($G(^DD(70.03,14,0)),U,2)
S RARPHY=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
S RARPHY=$S(RARPHY]"":RARPHY,1:"Unknown")
S RAFN1=$P(RAEXAM(0),U,2),RAFN2=$P($G(^DD(70.03,2,0)),U,2)
S RAPROC=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
S RAPROC=$E($S(RAPROC]"":RAPROC,1:"Unknown"),1,37)
S RAFN1=$P(A,"^",5),RAFN2=$P($G(^DD(74,5,0)),U,2)
S RASTAT=$S(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
S RASTAT=$S(RASTAT]"":RASTAT,1:"Unknown")
S RAFN1=$P(RARXAM(0),U,4),RAFN2=$P($G(^DD(70.02,4,0)),U,2)
S RAILOC=$S(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
S RAFN1=$P(RAEXAM(0),U,15),RAFN2=$P($G(^DD(70.03,15,0)),U,2)
S RASTF=$S(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
S RAFN1=$P(RAEXAM(0),U,12),RAFN2=$P($G(^DD(70.03,12,0)),U,2)
S RARES=$S(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
S XMB(1)=RANAME,XMB(2)=RASSN,XMB(3)=RACASE,XMB(4)=RAXDT
S XMB(5)=RADDT,XMB(6)=RASTAT,XMB(7)=RARPHY,XMB(8)=RAPROC
S XMB(9)=RAILOC,XMB(10)=RASTF,XMB(11)=RARES
S XMB="RAD/NUC MED REPORT UNVERIFIED"
; if called from RAHLO1, then use remote user's duz as sender
; var RATRANSC is only defined in RAHL* routines
S:$D(RATRANSC) XMDUZ=$S($G(RAVERF):RAVERF,$G(RATRANSC):RATRANSC,1:DUZ)
D ^XMB:$D(^XMB(3.6,"B",XMB))
K XMB,XMB0,XMC0,XMDT,XMM,XMMG
Q
RPTCSE(RAA,RADA) ; Determine the case number for this report.
; There may be more than one case associated with a given report.
; If this is the case, all associated case numbers will be returned.
; Input Variables: 'RAA' - zero node of the Rad/Nuc Reports data global
; 'RADA'- ien of the entry in the Rad/Nuc Reports file
; Returns: a single case number or numerous case numbers
Q:'+$O(^RARPT(RADA,1,0)) $S($P(RAA,U)]"":$P(RAA,U),1:"Unknown") ;single
N I,J,RASTR S RASTR=$S($P(RAA,U)]"":$P(RAA,U),1:"Unknown"),I=0
F S I=$O(^RARPT(RADA,1,I)) Q:I'>0 D
. S J=$G(^RARPT(RADA,1,I,0))
. S RASTR=RASTR_","_$S($P(J,U)]"":$P(J,U),1:"Unknown")
. Q
Q RASTR
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRABUL2 5223 printed Nov 22, 2024@17:43:51 Page 2
RABUL2 ;HISC/FPT,GJC-'RAD/NUC MED REPORT UNVERIFIED' Bulletin ;11/10/97 11:01
+1 ;;5.0;Radiology/Nuclear Medicine;**8**;Mar 16, 1998
+2 ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+3 ; The variables DA and RAX must be defined. RAX must be equal to 'V',
+4 ; and the value of DA (IEN of the record in file 74) must be greater
+5 ; than 0. These conditions must exist for the RAD/NUC MED REPORT
+6 ; UNVERIFIED bulletin to execute.
+7 ; Called From: ^DD(74,5,1,1,0-"DT") xref nodes
+8 ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+9 ; ***** Variable List *****
+10 ; 'DIFQ' -> Variable used to check if we are installing the
+11 ; Radiology Package. If we are, do not fire off
+12 ; bulletins.
+13 ; 'RADFN' -> IEN of the patient in the PATIENT file (2)
+14 ; 'RAEXAM' -> IEN of a record in the Examinations multiple
+15 ; of the Radiology/Nuclear Medicine Patient file. (70)
+16 ; 'RAEXAM(0)'-> Zero node of a record in the Examinations multiple
+17 ; of the Radiology/Nuclear Medicine Patient file. (70)
+18 ; 'RARXAM(0)'-> Zero node of a record in the Registered Exam multiple
+19 ; of the Radiology/Nuclear Medicine Patient file. (70)
+20 ; 'RAFN1' -> internal format of a FM date/time data element
+21 ; { internal format pointer value }
+22 ; 'RAFN2' -> FM data definition for RAFN1, used in XTERNAL^RAUTL5
+23 ; 'A' -> Zero node of the RADIOLOGY/NUCLEAR MEDICINE REPORTS
+24 ; file (74) { node: ^RARPT(DA,0) }
+25 ;
+26 ; Format: Data to be fired;local var name;XMB array representation
+27 ; Patient ; RANAME ; XMB(1) <---> Desired Date ; RADDT ; XMB(5)
+28 ; Patient SSN ; RASSN ; XMB(2) <---> Report Status ; RASTAT ; XMB(6)
+29 ; Case Number ; RACASE ; XMB(3)<---> Req. Physician ; RARPHY ; XMB(7)
+30 ; Exam Date ; RAXDT ; XMB(4) <---> Rad. Procedure ; RAPROC ; XMB(8)
+31 ; Imag. Loc. ; RAILOC ; XMB(9) <---> Pri. Int'g Staff ; RASTF ; XMB(10)
+32 ; Pri. Int'g Resident ; RARES ; XMB(11)
+33 ;
+34 ; Quit if we are installing the software, current report status is
+35 ; verified, or if we are deleting the report.
+36 ; 'RADELRPT' is defined in the entry action of the RA DELETERPT option.
+37 if $DATA(DIFQ)!($DATA(RADELRPT))
QUIT
+38 NEW RAX
SET RAX=X
+39 if RAX'="V"!(+$GET(DA)'>0)
QUIT
+40 NEW A,RACASE,RACN,RADDT,RADTI,RADFN,RAEXAM,RAFN1,RAFN2,RAILOC,RANAME
+41 NEW RAPROC,RARES,RARPHY,RARXAM,RASSN,RASTAT,RASTF,RAXDT,X,Y
+42 ; quit if the rpt is v'fied
SET A=$GET(^RARPT(DA,0))
if $PIECE(A,"^",5)="V"
QUIT
+43 ; Derive case/exam data from file 70
SET Y=DA
DO RASET^RAUTL2
+44 SET RADFN(0)=RADFN
+45 SET (RADFN,RANAME)=+$PIECE(A,U,2)
+46 SET RANAME=$SELECT($DATA(^DPT(RANAME,0)):$PIECE(^(0),U),1:"Unknown")
+47 SET RASSN=$$SSN^RAUTL()
SET RADFN=RADFN(0)
+48 SET RACASE=$$RPTCSE(A,DA)
+49 SET RAFN1=$PIECE(A,U,3)
SET RAFN2=$PIECE($GET(^DD(74,3,0)),U,2)
+50 SET RAXDT=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
+51 SET RAXDT=$SELECT(RAXDT]"":RAXDT,1:"Unknown")
+52 SET RARXAM(0)=$GET(^RADPT(+$GET(RADFN),"DT",+$GET(RADTI),0))
+53 SET RAEXAM=$ORDER(^RADPT(+$GET(RADFN),"DT",+$GET(RADTI),"P","B",+$GET(RACN),0))
+54 SET RAEXAM(0)=$GET(^RADPT(+$GET(RADFN),"DT",+$GET(RADTI),"P",+$GET(RAEXAM),0))
+55 SET RAFN1=$PIECE(RAEXAM(0),U,21)
SET RAFN2=$PIECE($GET(^DD(70.03,21,0)),U,2)
+56 SET RADDT=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
+57 SET RADDT=$SELECT(RADDT]"":RADDT,1:"Unknown")
+58 SET RAFN1=$PIECE(RAEXAM(0),U,14)
SET RAFN2=$PIECE($GET(^DD(70.03,14,0)),U,2)
+59 SET RARPHY=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
+60 SET RARPHY=$SELECT(RARPHY]"":RARPHY,1:"Unknown")
+61 SET RAFN1=$PIECE(RAEXAM(0),U,2)
SET RAFN2=$PIECE($GET(^DD(70.03,2,0)),U,2)
+62 SET RAPROC=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
+63 SET RAPROC=$EXTRACT($SELECT(RAPROC]"":RAPROC,1:"Unknown"),1,37)
+64 SET RAFN1=$PIECE(A,"^",5)
SET RAFN2=$PIECE($GET(^DD(74,5,0)),U,2)
+65 SET RASTAT=$SELECT(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
+66 SET RASTAT=$SELECT(RASTAT]"":RASTAT,1:"Unknown")
+67 SET RAFN1=$PIECE(RARXAM(0),U,4)
SET RAFN2=$PIECE($GET(^DD(70.02,4,0)),U,2)
+68 SET RAILOC=$SELECT(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
+69 SET RAFN1=$PIECE(RAEXAM(0),U,15)
SET RAFN2=$PIECE($GET(^DD(70.03,15,0)),U,2)
+70 SET RASTF=$SELECT(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
+71 SET RAFN1=$PIECE(RAEXAM(0),U,12)
SET RAFN2=$PIECE($GET(^DD(70.03,12,0)),U,2)
+72 SET RARES=$SELECT(RAFN1']"":"Unknown",1:$$XTERNAL^RAUTL5(RAFN1,RAFN2))
+73 SET XMB(1)=RANAME
SET XMB(2)=RASSN
SET XMB(3)=RACASE
SET XMB(4)=RAXDT
+74 SET XMB(5)=RADDT
SET XMB(6)=RASTAT
SET XMB(7)=RARPHY
SET XMB(8)=RAPROC
+75 SET XMB(9)=RAILOC
SET XMB(10)=RASTF
SET XMB(11)=RARES
+76 SET XMB="RAD/NUC MED REPORT UNVERIFIED"
+77 ; if called from RAHLO1, then use remote user's duz as sender
+78 ; var RATRANSC is only defined in RAHL* routines
+79 if $DATA(RATRANSC)
SET XMDUZ=$SELECT($GET(RAVERF):RAVERF,$GET(RATRANSC):RATRANSC,1:DUZ)
+80 if $DATA(^XMB(3.6,"B",XMB))
DO ^XMB
+81 KILL XMB,XMB0,XMC0,XMDT,XMM,XMMG
+82 QUIT
RPTCSE(RAA,RADA) ; Determine the case number for this report.
+1 ; There may be more than one case associated with a given report.
+2 ; If this is the case, all associated case numbers will be returned.
+3 ; Input Variables: 'RAA' - zero node of the Rad/Nuc Reports data global
+4 ; 'RADA'- ien of the entry in the Rad/Nuc Reports file
+5 ; Returns: a single case number or numerous case numbers
+6 ;single
if '+$ORDER(^RARPT(RADA,1,0))
QUIT $SELECT($PIECE(RAA,U)]"":$PIECE(RAA,U),1:"Unknown")
+7 NEW I,J,RASTR
SET RASTR=$SELECT($PIECE(RAA,U)]"":$PIECE(RAA,U),1:"Unknown")
SET I=0
+8 FOR
SET I=$ORDER(^RARPT(RADA,1,I))
if I'>0
QUIT
Begin DoDot:1
+9 SET J=$GET(^RARPT(RADA,1,I,0))
+10 SET RASTR=RASTR_","_$SELECT($PIECE(J,U)]"":$PIECE(J,U),1:"Unknown")
+11 QUIT
End DoDot:1
+12 QUIT RASTR