source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCPOST.m@ 1800

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

initial load of WorldVistAEHR

File size: 1.9 KB
RevLine 
[613]1GMRCPOST ;SLC/DCM - Post init driver routine ;10/28/98 14:31
2 ;;3.0;CONSULT/REQUEST TRACKING;**1**;DEC 27, 1997
3 D EN^GMRCPOS1
4 Q
5EN S ND=0 I '$O(^GMR(123.5,ND)) S DIE=123.5,DA=1,DR=".01////^S X=""ALL SERVICES""" D ^DIE K DIE,DA,DR
6 K ND
7 Q
8SVC(SVCIEN,SVCNAME,EVCODE) ;build HL7 message for conversion
9 K GMRCMSG
10 S MSH="MSH|^~\&|CONSULTS|"_$S($G(DUZ(2))]"":DUZ(2),1:+$$SITE^VASITE())_"|||||MFN"
11 S MFI="MFI|123.5^Request Services^99DD||"_$S(EVCODE="MUD":"REP",1:"UPD")_"|||NE"
12 S MFE="MFE|"_EVCODE_"|||^^^"_SVCIEN_"^"_SVCNAME_"^99CON"
13 I $L($O(^GMR(123.5,SVCIEN,2,"B",""))) D
14 .S ND1="",ND2=0 F S ND1=$O(^GMR(123.5,SVCIEN,2,"B",ND1)) Q:ND1="" S ND2=ND2+1,GMRCARRY(ND2)=ND1
15 .D ZSY(.GMRCARRY)
16 .Q
17 I +$P(^GMR(123.5,SVCIEN,0),"^",2),$P(^(0),"^",2)'=9 S ZCS="ZCS|"_$P(^(0),"^",2)
18 D BUILD
19 K MSH,MFI,MFE,GMRCARRY,ZSY,ZCS
20 Q
21 ;
22BUILD ;build the HL-7 array into its export form
23 S ND=1,MSG="GMRCMSG"
24 S @(MSG_"("_ND_")")=MSH,ND=ND+1
25 S @(MSG_"("_ND_")")=MFI,ND=ND+1
26 S @(MSG_"("_ND_")")=MFE,ND=ND+1
27 S:$D(ZCS) @(MSG_"("_ND_")")=ZCS,ND=ND+1
28 S ND1=0 F S ND1=$O(ZSY(ND1)) Q:ND1="" S @(MSG_"("_ND_")")=ZSY(ND1),ND=ND+1
29 Q
30 ;
31MFI(MTP) ;s MFI HL-7 segment
32 N X
33 S MFI="MFI|101^Protocol^99DD||"_$S(MTP="MFN":"REP",1:"UPD")_"|||NE"
34 Q MFI
35 ;
36MFE(RSPLVL,ORXDA,GMRCPRNO,PFX) ;set MFE HL=7 segment
37 N X
38 S X="MFE|"_RSPLVL_"|||^^^"_ORXDA_"^"_GMRCPRNO_"^99"_$S(PFX="GMRCR ":"PRO",1:"CON")
39 Q X
40 ;
41ZSY(ARRAY) ;set ZSY segment of the HL-7 segment; contains synonyms
42 S ND1="",ND2=1
43 F S ND1=$O(ARRAY(ND1)) Q:ND1="" S ZSY(ND2)="ZSY|"_ND2_"|"_ARRAY(ND1)_"|",ND2=ND2+1
44 K ND1,ND2
45 Q
46 ;
47ITEMS(ELC,RLECODE,ORDA,ORNAME,GMRCARRY,GMRCPRFX) ;entry point to set up HL-7 message to update orderable items file - file 101.43 in Post INIT
48 S MSH="MSH|^~\&|"_$S(GMRCPRFX="GMRCR ":"PROCEDURES",1:"CONSULTS")_"|"_+$$SITE^VASITE_"|||||"_ELC
49 S MFI=$$MFI(ELC)
50 S MFE=$$MFE(RLECODE,ORDA,ORNAME,GMRCPRFX)
51 D ZSY(.GMRCARRY)
52 D BUILD
53 K HLQ,MFE,MSH,MFI,MSG,MSGND,ND,ND1,ND2,ZSY
54 Q
55 ;
Note: See TracBrowser for help on using the repository browser.