source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRC101H.m@ 1442

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

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1GMRC101H ;SLC/DCM - SET UP HL-7 MESSAGE TO UPDATE OERR ORDERABLE ITEMS FILE WITH NEW CONSULT TYPE ;5/20/98 14:20
2 ;;3.0;CONSULT/REQUEST TRACKING;**1,15**;DEC 27, 1997
3EN(ELC,RLECODE,ORDA,ORNAME,GMRCARRY,GMRCPRFX) ;entry point to set up HL-7 message to update orderable items file - file 101.43
4 ;ELC=message type - MFN or UPD
5 ;RLECODE=record level event code from table 180
6 ;DA=IEN of procedure in ^ORD(101
7 ;ORNAME=procedure name
8 ;GMRCARRY=array of synonyms for procedure
9 ;GMRCPRFX=prefix from ^ORD(101, i.e., "GMRCR " or "GMRCT "
10 S MSH=$$MSH^GMRCHL7,$P(MSH,"|",3)=$S(GMRCPRFX="GMRCR ":"PROCEDURES",1:"CONSULTS"),$P(MSH,"|",9)="MFN"
11 S MFI=$$MFI(RLECODE)
12 S MFE=$$MFE(ELC,ORDA,ORNAME,GMRCPRFX)
13 D ZSY(.GMRCARRY)
14 D BUILD
15 K HLQ,MFE,MSH,MFI,MSG,MSGND,ND,ND1,ND2,ZSY,SEP1,SEP2,SEP3,SEP4,SEP5
16 Q
17BUILD ;build the HL-7 array into its export form
18 S ND=1,MSG="GMRCMSG"
19 S @(MSG_"("_ND_")")=MSH,ND=ND+1
20 S @(MSG_"("_ND_")")=MFI,ND=ND+1
21 S @(MSG_"("_ND_")")=MFE,ND=ND+1
22 I $O(ZSY(0)) D
23 .S ND1=0 F S ND1=$O(ZSY(ND1)) Q:ND1="" S @(MSG_"("_ND_")")=ZSY(ND1),ND=ND+1
24 .K ND1
25 .Q
26 K ND
27 Q
28 ;
29MFI(MTP) ;set MFI HL-7 segment
30 S MFI="MFI|123.3^GMRC PROCEDURE^99DD||"_MTP_"|||NE"
31 Q MFI
32 ;
33MFE(RSPLVL,ORXDA,GMRCPRNO,PFX) ;set MFE HL-7 segment
34 N X
35 S X="MFE|"_RSPLVL_"|||^^^"_ORXDA_"^"_GMRCPRNO_"^99PRC"
36 Q X
37ZSY(ARRAY) ;set ZSY segment of the HL-7 segment; contains synonyms
38 S ND1="",ND2=1
39 F S ND1=$O(ARRAY(ND1)) Q:ND1="" S ZSY(ND2)="ZSY|"_ND2_"|"_ARRAY(ND1)_"|",ND2=ND2+1
40 K ND,ND1
41 Q
42SVC(SVCIEN,SVCNAME,EVCODE) ;format an HL-7 message that defines a new service
43 ;SVCIEN=Service IEN from file 123.5
44 ;SVCNAME=Service name, i.e., Medicine
45 ;EVCODE=record level event code from HL-7 table 180
46 K GMRCMSG
47 S MSH=$$MSH^GMRCHL7,$P(MSH,"|",9)="MFN"
48 S MFI="MFI|123.5^Request Services^99DD||"_$S(EVCODE="MUP":"UPD",1:"REP")_"|||NE"
49 S MFE="MFE|"_EVCODE_"|||^^^"_SVCIEN_"^"_SVCNAME_"^99CON"
50 I $L($O(^GMR(123.5,SVCIEN,2,"B",""))) D
51 .S ND="",ND1=0 F S ND=$O(^GMR(123.5,SVCIEN,2,"B",ND)) Q:ND="" S ND1=ND1+1,GMRCARRY(ND1)=ND
52 .D ZSY(.GMRCARRY)
53 .Q
54 D BUILD
55 K GMRCARRY,ND,ND1,HLQ,MSG,MSH,MFI,MFE,SEP1,SEP2,SEP3,SEP4,SEP5,ZSY
56 Q
Note: See TracBrowser for help on using the repository browser.