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