source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLRPC.m@ 1147

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

revised back to 6/30/08 version

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