source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLRPC.m@ 1535

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1RAHLRPC ;HIRMFO/BNT-Rad/NM HL7 Protocol calls ;05/21/99 14:50
2 ;;5.0;Radiology/Nuclear Medicine;**12,25,54,71,82,81,84**;Mar 16, 1998;Build 13
3 ; 03/16/2006 *71 Rem Call 124379 allow exam updates to create HL7 msg
4 ;
5 ;Integration Agreements
6 ;----------------------
7 ;$$FIND1^DIC(2051); GETS^DIQ(2056)
8 ;all access to ^ORD(101 to maintain application specific protocols(872)
9 ;read w/FileMan HL7 APPLICATION PARAMETER(10136)
10 ;
11REG ; register exam
12 N X,RA101Z,RAEID
13 S RA101Z="RA REF" ; get all protocols beginning RA REG
14 F S RA101Z=$O(^ORD(101,"B",RA101Z)) Q:RA101Z'["RA REG" D
15 .S RAEID=$O(^ORD(101,"B",RA101Z,0))
16 .I RAEID,'$L($P(^ORD(101,RAEID,0),"^",3)) D EN^RAHLR
17 Q
18CANCEL ; cancel exam
19 N X,RA101Z,RAEID
20 S RA101Z="RA CANCEK" ; get all protocols beginning RA CANCEL
21 F S RA101Z=$O(^ORD(101,"B",RA101Z)) Q:RA101Z'["RA CANCEL" D
22 .S RAEID=$O(^ORD(101,"B",RA101Z,0))
23 .I RAEID,'$L($P(^ORD(101,RAEID,0),"^",3)) D EN^RAHLR
24 Q
25 ;
26RPT ; report verified or released/not verified
27 N X,RA101Z,RAEID,RASSS ; RASSS subcriber array to be passed to HLL for GENERATE^HLMA
28 ;S X="^%ET",@^%ZOSF("TRAP")
29 S RA101Z="RA RPS" ; get all protocols beginning RA RPT
30 F S RA101Z=$O(^ORD(101,"B",RA101Z)) Q:RA101Z'["RA RPT" D
31 .S RAEID=$O(^ORD(101,"B",RA101Z,0)) K RASSS ; RA*5*81
32 .S:$L($G(RANOSEND)) RAEID=$$GETEID(RAEID,RANOSEND,.RASSS) ;RA*5*81
33 .I RAEID,'$L($P(^ORD(101,RAEID,0),"^",3)) D EN^RAHLRPT
34 K RANOSEND
35 Q
36 ;
37EXM ;Examined case; called from RAUTL1 and RASTED after a case has been edited.
38 ;
39 ;Called from RAUTL1 and RASTED after a case's status is upgraded
40 ; and case's 30th piece is null
41 ;
42 ;If this new status is :
43 ; at a status (or higher than a status) where
44 ; GENERATE EXAMINED HL7 MSG = Y,
45 ; then :
46 ; 1. send an HL7 msg re this case having reached EXAMINED status
47 ; 2. set subfile 70.03's HL7 EXAMINED MSG SENT to Y
48 ;
49 ; RALOWER = next lower status
50 ; RANEWST = new status ien
51 ; RAEXEDT = Indication of editing of: proc, proc mod, req phys, CPT mod, Tech comm...
52 ; RAGENHL7 = Indication that sending ORU is due...
53 ; RASSSX1(IENs) = Array of subscribers from 771, the message will be sent (SCIMGE)
54 ;
55 N RAIMGTYI,RAIMGTYJ,RALOWER,RANEWST,RAEXMDUN,RAGENHL7,RASSSX1
56 S RAIMGTYI=$P($G(^RADPT(RADFN,"DT",RADTI,0)),U,2),RAIMGTYJ=$P(^RA(79.2,RAIMGTYI,0),U),RANEWST=$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)),U,3)
57 S:$P(^RA(72,RANEWST,0),U,8)="Y" RAGENHL7=1 ;this status has GEN HL7 marked Y
58 ; look thru lower statuses for GEN HL7 marked Y
59DOWN S RALOWER=$P($G(^RA(72,+RANEWST,0)),U,3)
60 I '$G(RAGENHL7) F S RALOWER=$O(^RA(72,"AA",RAIMGTYJ,RALOWER),-1) Q:RALOWER<1 S:$P(^RA(72,+$O(^RA(72,"AA",RAIMGTYJ,RALOWER,0)),0),U,8)="Y" RAGENHL7=1
61 ;?? none of the lower status levels have GEN HL7 marked Y
62 K:$P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),U,30)="Y" RAGENHL7 ;already sent
63 ;Q:'$G(RAEXEDT)&'$G(RAGENHL7)
64 ; Business Rule: RA*5*84 sends an examined message to ScImage unconditionally
65 I '$G(RAEXEDT),'$G(RAGENHL7) Q:'$O(^RA(79.7,0)) D Q:'$O(RASSSX1(0))
66 .N X,RASSS,RASSSL S X=0 F S X=$O(^RA(79.7,X)) Q:'X S:$P(^(X,0),U,2) RASSS(X)=""
67 .D:$D(RASSS) GETSUB^RAHLRS1(.RASSS,.RASSSX1,.RASSSL)
681 N RAEXMDUN
69 S RAEXMDUN=1
70A1 N X,RA101Z,RAEID
71 S RA101Z="RA EXAMINEC" ; get all protocols beginning RA EXAMINED
72 F S RA101Z=$O(^ORD(101,"B",RA101Z)) Q:RA101Z'["RA EXAMINED" D
73 .N RAGENHL7 S RAEID=$O(^ORD(101,"B",RA101Z,0))
74 .I RAEID,'$L($P(^ORD(101,RAEID,0),"^",3)) D EN^RAHLR
75 S:$G(RAGENHL7) $P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),U,30)="Y"
76 Q
77 ;
78GETEID(RAEID,RANOSEND,RASSS) ; RA*5*81 Return RAEID or 0 (zero) = for future use.
79 ; RAEID = IEN of regular Event driver
80 ; RANOSEND Application name or IEN from 771 file.. don't send message to Subcr. with this application.
81 ; RASSS Array of subcribers (IENs) associated with RANOSEND application
82 ; 0 (zero) returned if No subscriber exist or all subscribers associated with RANOSEND application.
83 S RAEID=$G(RAEID) Q:'RAEID!'$L($G(RANOSEND))!'$D(^ORD(101,+RAEID,0)) RAEID
84 N RAXX,ERR,X1,Y1,YY,RAPL,RANEW,RAPIDS,RAIEDS,DIERR,RAERR
85 S RAPL=$S(+RANOSEND:+RANOSEND,1:$$FIND1^DIC(771,"","X",RANOSEND,"","","RAERR"))
86 Q:'RAPL!($D(RAERR)#2) RAEID
87 D GETS^DIQ(101,RAEID_",","**","I","RAXX","ERR")
88 Q:$D(ERR) RAEID ; Was not able get Event driver info... so just pass event driver...
89 Q:'$D(RAXX(101.0775)) 0 ;No subcribers exist for Event driver
90 S X1="",RANEW=0,Y1=0 F S X1=$O(RAXX(101.0775,X1)) Q:'$L(X1) D
91 .S YY=$G(RAXX(101.0775,X1,.01,"I"))
92 .I $P($G(^ORD(101,+YY,770)),U,2)=RAPL D Q
93 ..S Y1=Y1+1,RASSS("EXCLUDE SUBSCRIBER",Y1)=YY ;Y1= 1,2,3...
94 .S RANEW=1
95 Q:'RANEW 0 ;All subscribers are associated with application RANOSEND.. Don't send the message.
96 Q RAEID
Note: See TracBrowser for help on using the repository browser.