source: WorldVistAEHR/trunk/r/ZZREGIONAL-A1C-A5C-CRHD-RGED-RGUT-RGWB-RG/RGFIRM.m@ 1150

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1RGFIRM ;ALB/CJM-ROUTE FACILITY INTEGRATION MESSAGE ;08/27/99
2 ;;1.0;CLINICAL INFO RESOURCE NETWORK;**5,9**;30 Apr 99
3 ;
4MROUTE ;
5 ;Description: routing logic for the Facility Integration Message. This
6 ;entry point is meant to be called by the HL7 pacakge when used in
7 ;the message routing logic of the client protocol.
8 ;
9 ;Input:
10 ; HL7 variables must be defined
11 ;Output:
12 ; HLL("LINKS") array containing the dynamic routing list
13 ;Variables:
14 ; LEGACY - station # of legacy site
15 ; PRIMARY - station # of primary site
16 ; ICN - patient ICN from message
17 ; DFN - ien from the patient file
18 ;
19 N LEGACY,PRIMARY,ICN,DFN
20 S (DFN,LEGACY,PRIMARY,ICN)=""
21 Q:'$$PARSE^RGFIPM1(1,.LEGACY,.PRIMARY,.ICN)
22 S DFN=$$DFN^RGFIU(ICN)
23 Q:'DFN
24 D ROUTE(DFN,LEGACY,PRIMARY,.HLL)
25 Q
26 ;
27ROUTE(DFN,LEGACY,PRIMARY,HLL) ;
28 ;Description: routing logic for the Facility Integration Message. This
29 ;entry point is designed to be called directly by the application.
30 ;
31 ;Input:
32 ; DFN - ien from the patient file
33 ; LEGACY - station # of legacy site
34 ; PRIMARY - station # of primary site
35 ;Output:
36 ; HLL("LINKS") array containing the dynamic routing list (pass HLL by reference)
37 ;Variables:
38 ; SUB - ien of the subscriber list
39 ; HERE - station # of site this routine is executing on
40 ; HEREIEN - ien in Institution file of site this routine is executing on
41 ; MPINODE - "MPI" node from the Patient file
42 ; CMOR - station # of CMOR
43 ; CMORIEN - ien in Institution file of CMOR
44 ;
45 K HLL("LINKS")
46 ;
47 I $G(LEGACY),$G(PRIMARY),$G(DFN) D
48 .;just checking
49 E Q
50 ;
51 N SUB,HERE,HEREIEN,MPINODE,CMOR,CMORIEN
52 S (SUB,HERE,HEREIEN,MPINODE,CMOR,CMORIEN)=""
53 S HEREIEN=$$SITE^VASITE(),HERE=$P(HEREIEN,"^",3),HEREIEN=+HEREIEN
54 S MPINODE=$$MPINODE^RGFIU(DFN)
55 S CMORIEN=$P(MPINODE,"^",3)
56 S CMOR=$$STATNUM^RGFIU(CMORIEN)
57 ;
58 ;If the CMOR is not known, the message can not be routed
59 I 'CMORIEN D Q
60 .D EXC^RGFIU(221,"ERROR ENCOUNTERED WHILE PROCESSING FACITLIY INTEGRATION MESSAGE: MISSING CMOR",DFN)
61 ;
62 S SUB=$P(MPINODE,"^",5)
63 I CMOR=HERE D
64 .;this is the CMOR, so send to subscribers (except legacy) and Austin MPI
65 .N MPILINK ;logical link of MPI
66 .S MPILINK=$$MPILINK^MPIFAPI()
67 .I $P(MPILINK,"^")=-1 D
68 ..D EXC^RGFIU(224,"Facility Integration Message not sent to MPI, no MPI link identified in CIRN SITE PARAMETER file (#991.8)",DFN)
69 .E D
70 ..S HLL("LINKS",1)="RG FACILITY INTEGRATION CLIENT^"_MPILINK
71 .;
72 .;If this prmary site is not the CMOR, than make sure the prmary site
73 .;is on the subscription list
74 .;If this prmary site is not the CMOR, than make sure the prmary site
75 .;is on the subscription list
76 .I PRIMARY'=CMOR D
77 ..;PRIMIEN = ien of primary site in Institution file, LINK = its logical link
78 ..N PRIMIEN,LINK
79 ..S PRIMIEN=$$LKUP^XUAF4(PRIMARY)
80 ..Q:'PRIMIEN
81 ..;set HLL array to route message to primary site
82 ..S LINK=$$GETLINK^RGFIU(PRIMIEN)
83 ..I '$L(LINK) D
84 ...D EXC^RGFIU(224,"Facility Integration Message not sent to primary site, station # "_PRIMARY,DFN)
85 ..E D
86 ...S HLL("LINKS",2)="RG FACILITY INTEGRATION CLIENT^"_LINK
87 .;
88 .D:SUB
89 ..;there is a subscription list, use it to route the message, with changes
90 ..;Variables:
91 ..; ITEM - one of the sites (by subscript # on HLL("LINKS") array) on the subscriber list
92 ..; LINK - logical link ien of subscriber
93 ..; HERELINK - logical link of this site
94 ..; LEGLINK - logical link of legacy site
95 ..;
96 ..N ITEM,NODE,LINK,HERELINK,LEGLINK
97 ..S HERELINK=$$GETLINK^RGFIU(HEREIEN)
98 ..S LEGLINK=$$GETLINK^RGFIU($$LKUP^XUAF4(LEGACY))
99 ..D GET^HLSUB(SUB,,"RG FACILITY INTEGRATION CLIENT",.HLL)
100 ..;screen out legacy and this (here) site
101 ..S ITEM=0 F S ITEM=$O(HLL("LINKS",ITEM)) Q:'ITEM S NODE=$G(HLL("LINKS",ITEM)),LINK=$P(NODE,"^",2) D:$L(LINK)
102 ...I HERELINK=LINK K HLL("LINKS",ITEM) Q
103 ...I LEGLINK=LINK K HLL("LINKS",ITEM) Q
104 E D
105 .;send message to CMOR, but only if this is the legacy site
106 .N CMORLINK
107 .Q:(LEGACY'=HERE)
108 .S CMORLINK=$$GETLINK^RGFIU(CMORIEN)
109 .I '$L(CMORLINK) D
110 ..D EXC^RGFIU(224,"Facility Integration Message not sent to site "_CMOR,DFN)
111 .E D
112 ..S HLL("LINKS",1)="RG FACILITY INTEGRATION CLIENT^"_CMORLINK
113 Q
Note: See TracBrowser for help on using the repository browser.