source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLRPTT.m@ 1203

Last change on this file since 1203 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1RAHLRPTT ;HISC/CAH AISC/SAW-Compiles HL7 'ORU' Message Type ; 4/26/01 10:40am
2 ;;5.0;Radiology/Nuclear Medicine;**84**;Mar 16, 1998;Build 13
3EN ; Continuation from RAHLRPT which has been split because the 10 k size problem
4 ; & other inbound patch 84 utility
5 ;
6 ;Integration Agreements
7 ;----------------------
8 ;^%DT(10003); $$FIND1^DIC(2051); $$GET1^DIQ(2056); $$HLDATE^HLFNC(10106); $$HLNAME^HLFNC(10106)
9 ;$$M11^HLFNC(10106); $$EN^VAFHLPID(263)
10 ;read w/FileMan HL7 APPLICATION PARAMETER(10136)
11 ;
12INIT ;
13 D:$D(RANOSEND) ;Patch 84
14 .N RATIEN,DIERR,RAERR
15 .S RATIEN=$S(+RANOSEND:+RANOSEND,1:$$FIND1^DIC(771,"","X",RANOSEND,"","","RAERR"))
16 .Q:'RATIEN!($D(RAERR)#2)
17 .;RATELE is set to the value of the 'TELERADIOLOGY APPLICATION' (#1) field 0:No; 1:Yes
18 .S RATELE=$P($G(^RA(79.7,RATIEN,0)),U,2) I 'RATELE K RATELE Q
19 .;RATELX is set to the value of the 'RELEASE STUDY KEYWORD' (#1.2) field
20 .S RATELX=$P($G(^RA(79.7,RATIEN,0)),U,4)
21 .S:'$L(RATELX) RATELX="Released for local dictation by National Teleradiology"
22 S RASET=0,RACN0=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0))
23 S:'$D(RARPT) RARPT=+$P(RACN0,"^",17)
24 Q
25SETUP ; Setup basic examination information
26 S:RASET RACN0=^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)
27 S RADTE0=9999999.9999-RADTI,RADTECN=$E(RADTE0,4,7)_$E(RADTE0,2,3)_"-"_+RACN0,RARPT0=^RARPT(RARPT,0)
28 S RAPROC=+$P(RACN0,U,2),RAPROCIT=+$P($G(^RAMIS(71,RAPROC,0)),U,12),RAPROCIT=$P(^RA(79.2,RAPROCIT,0),U,1)
29 S RAPRCNDE=$G(^RAMIS(71,+RAPROC,0)),RACPT=+$P(RAPRCNDE,U,9)
30 S RACPTNDE=$$NAMCODE^RACPTMSC(RACPT,DT)
31 S Y=$$HLDATE^HLFNC(RADTE0) S RADTE0=$S(Y:Y,1:HLQ),Y=$$M11^HLFNC(RADFN)
32 Q
33TELE ;Setting TELERAD info for RAHLTCPB
34 ;RATELEKN = Keyword to get the name and NPI of teleradiologist
35 ;RATELENM = Teleradiologist Name
36 ;RATELEPI = Teleradiologist NPI
37 ;RATELEDR = Default DX for terad 'R' report
38 ;RATELEDF = Default DX for terad 'F' report
39 N RATIEN,DIERR,RAERR
40 S RATIEN=$$FIND1^DIC(771,"","X",$G(HL("SAN")),"","","RAERR")
41 Q:'RATIEN!($D(RAERR)#2)
42 S RATELE=$P($G(^RA(79.7,RATIEN,0)),U,2) ;Patch 84
43 Q:'RATELE
44 S RATELEKN=$P($G(^RA(79.7,RATIEN,0)),U,3) S:'$L(RATELEKN) RATELEKN="Report dictated by Teleradiologist: "
45 S RATELEDR=$P($G(^RA(79.7,RATIEN,2)),U) K:'$L(RATELEDR) RATELEDR
46 S RATELEDF=$P($G(^RA(79.7,RATIEN,2)),U,2) K:'$L(RATELEDF) RATELEDF
47 Q
48PID ;Compile 'PID' Segment
49 I HL("VER")']"2.2" D
50 .S X1="",X1="PID"_HLFS_HLFS_$G(VA("PID"))_HLFS_Y_HLFS_HLFS S X=VADM(1),Y=$$HLNAME^HLFNC(X) S X1=X1_Y_HLFS_HLFS
51 .S X=RAVADM(3),Y=$$HLDATE^HLFNC(X) S X1=X1_Y_HLFS_$S(VADM(5)]"":$S("MF"[$P(VADM(5),"^"):$P(VADM(5),"^"),1:"O"),1:"U") S:$P(VADM(2),"^")]"" $P(X1,HLFS,20)=$P(VADM(2),"^") S RAN=RAN+1,HLA("HLS",RAN)=X1
52 I HL("VER")]"2.2" S RAN=RAN+1,HLA("HLS",RAN)=$$EN^VAFHLPID(DFN,"2,3,5,7,8,19,20")
53 Q
54RESEND(RADFN,RADTI,RACNI) ; re-send exam message(s) to HL7 subscribers
55 ;
56 Q:'$G(RADFN)!'$G(RADTI)!'$G(RACNI)
57 Q:'$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)) Q:'$P(^(0),U,2)
58 N RABD,RAEDTT,QUIT
59 ;
60 I '$D(DT) D ^%DT S DT=Y
61 ;
62 S RAEDTT=$$RAED(RADFN,RADTI,RACNI)
63 Q:'$L(RAEDTT)
64 D:RAEDTT[",REG," REG^RAHLRPC
65 D:RAEDTT[",CANCEL," CANCEL^RAHLRPC
66 D:RAEDTT[",EXAM,"
67 .S $P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),"^",30)="" ;Reset sent flag
68 .N RAEXMDUN D 1^RAHLRPC
69 D:RAEDTT[",RPT,"
70 .N RANOSEND,RARPT D RPT^RAHLRPC
71 Q
72 ;
73RAED(RADFN,RADTI,RACNI) ; identify correct ^RAHLRPC entry point(s)
74 ;
75 N RASTAT,RAIMTYP,RAORD,RETURN,RARPT
76 S RASTAT=""
77 ;
78 S RETURN=",REG,"
79 ;
80 S RASTAT=$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN,3,"I")
81 S RARPT=$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN,17,"I")
82 ;
83 S RAIMTYP=$$GET1^DIQ(72,+RASTAT,7) Q:'$L(RAIMTYP) ""
84 S RAORD=$$GET1^DIQ(72,+RASTAT,3)
85 ;
86 S:RAORD=0 RETURN=RETURN_"CANCEL,"
87 ;
88 S:$$GET1^DIQ(72,+RASTAT,8)="YES" RETURN=RETURN_"EXAM," ; Generate Examined HL7 Message
89 ;
90 D:RETURN'[",EXAM,"
91 .; also check previous statuses for 'Generate Examined HL7 Message'
92 .F S RAORD=$O(^RA(72,"AA",RAIMTYP,RAORD),-1) Q:+RAORD<1 D Q:RETURN[",EXAM,"
93 ..S RASTAT=$O(^RA(72,"AA",RAIMTYP,RAORD,0))
94 ..S:$$GET1^DIQ(72,+RASTAT,8)="YES" RETURN=RETURN_"EXAM,"
95 ;
96 ; Check if Verified Report exists
97 I RARPT]"",$$GET1^DIQ(74,RARPT_",",5,"I")="V" S RETURN=RETURN_"RPT,"
98 ;
99 Q RETURN
Note: See TracBrowser for help on using the repository browser.