GMRC101H ;SLC/DCM - SET UP HL-7 MESSAGE TO UPDATE OERR ORDERABLE ITEMS FILE WITH NEW CONSULT TYPE ;5/20/98 14:20
;;3.0;CONSULT/REQUEST TRACKING;**1,15**;DEC 27, 1997
EN(ELC,RLECODE,ORDA,ORNAME,GMRCARRY,GMRCPRFX) ;entry point to set up HL-7 message to update orderable items file - file 101.43
;ELC=message type - MFN or UPD
;RLECODE=record level event code from table 180
;DA=IEN of procedure in ^ORD(101
;ORNAME=procedure name
;GMRCARRY=array of synonyms for procedure
;GMRCPRFX=prefix from ^ORD(101, i.e., "GMRCR " or "GMRCT "
S MSH=$$MSH^GMRCHL7,$P(MSH,"|",3)=$S(GMRCPRFX="GMRCR ":"PROCEDURES",1:"CONSULTS"),$P(MSH,"|",9)="MFN"
S MFI=$$MFI(RLECODE)
S MFE=$$MFE(ELC,ORDA,ORNAME,GMRCPRFX)
D ZSY(.GMRCARRY)
D BUILD
K HLQ,MFE,MSH,MFI,MSG,MSGND,ND,ND1,ND2,ZSY,SEP1,SEP2,SEP3,SEP4,SEP5
Q
BUILD ;build the HL-7 array into its export form
S ND=1,MSG="GMRCMSG"
S @(MSG_"("_ND_")")=MSH,ND=ND+1
S @(MSG_"("_ND_")")=MFI,ND=ND+1
S @(MSG_"("_ND_")")=MFE,ND=ND+1
I $O(ZSY(0)) D
.S ND1=0 F S ND1=$O(ZSY(ND1)) Q:ND1="" S @(MSG_"("_ND_")")=ZSY(ND1),ND=ND+1
.K ND1
.Q
K ND
Q
;
MFI(MTP) ;set MFI HL-7 segment
S MFI="MFI|123.3^GMRC PROCEDURE^99DD||"_MTP_"|||NE"
Q MFI
;
MFE(RSPLVL,ORXDA,GMRCPRNO,PFX) ;set MFE HL-7 segment
N X
S X="MFE|"_RSPLVL_"|||^^^"_ORXDA_"^"_GMRCPRNO_"^99PRC"
Q X
ZSY(ARRAY) ;set ZSY segment of the HL-7 segment; contains synonyms
S ND1="",ND2=1
F S ND1=$O(ARRAY(ND1)) Q:ND1="" S ZSY(ND2)="ZSY|"_ND2_"|"_ARRAY(ND1)_"|",ND2=ND2+1
K ND,ND1
Q
SVC(SVCIEN,SVCNAME,EVCODE) ;format an HL-7 message that defines a new service
;SVCIEN=Service IEN from file 123.5
;SVCNAME=Service name, i.e., Medicine
;EVCODE=record level event code from HL-7 table 180
K GMRCMSG
S MSH=$$MSH^GMRCHL7,$P(MSH,"|",9)="MFN"
S MFI="MFI|123.5^Request Services^99DD||"_$S(EVCODE="MUP":"UPD",1:"REP")_"|||NE"
S MFE="MFE|"_EVCODE_"|||^^^"_SVCIEN_"^"_SVCNAME_"^99CON"
I $L($O(^GMR(123.5,SVCIEN,2,"B",""))) D
.S ND="",ND1=0 F S ND=$O(^GMR(123.5,SVCIEN,2,"B",ND)) Q:ND="" S ND1=ND1+1,GMRCARRY(ND1)=ND
.D ZSY(.GMRCARRY)
.Q
D BUILD
K GMRCARRY,ND,ND1,HLQ,MSG,MSH,MFI,MFE,SEP1,SEP2,SEP3,SEP4,SEP5,ZSY
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRC101H 2177 printed Oct 16, 2024@17:45:28 Page 2
GMRC101H ;SLC/DCM - SET UP HL-7 MESSAGE TO UPDATE OERR ORDERABLE ITEMS FILE WITH NEW CONSULT TYPE ;5/20/98 14:20
+1 ;;3.0;CONSULT/REQUEST TRACKING;**1,15**;DEC 27, 1997
EN(ELC,RLECODE,ORDA,ORNAME,GMRCARRY,GMRCPRFX) ;entry point to set up HL-7 message to update orderable items file - file 101.43
+1 ;ELC=message type - MFN or UPD
+2 ;RLECODE=record level event code from table 180
+3 ;DA=IEN of procedure in ^ORD(101
+4 ;ORNAME=procedure name
+5 ;GMRCARRY=array of synonyms for procedure
+6 ;GMRCPRFX=prefix from ^ORD(101, i.e., "GMRCR " or "GMRCT "
+7 SET MSH=$$MSH^GMRCHL7
SET $PIECE(MSH,"|",3)=$SELECT(GMRCPRFX="GMRCR ":"PROCEDURES",1:"CONSULTS")
SET $PIECE(MSH,"|",9)="MFN"
+8 SET MFI=$$MFI(RLECODE)
+9 SET MFE=$$MFE(ELC,ORDA,ORNAME,GMRCPRFX)
+10 DO ZSY(.GMRCARRY)
+11 DO BUILD
+12 KILL HLQ,MFE,MSH,MFI,MSG,MSGND,ND,ND1,ND2,ZSY,SEP1,SEP2,SEP3,SEP4,SEP5
+13 QUIT
BUILD ;build the HL-7 array into its export form
+1 SET ND=1
SET MSG="GMRCMSG"
+2 SET @(MSG_"("_ND_")")=MSH
SET ND=ND+1
+3 SET @(MSG_"("_ND_")")=MFI
SET ND=ND+1
+4 SET @(MSG_"("_ND_")")=MFE
SET ND=ND+1
+5 IF $ORDER(ZSY(0))
Begin DoDot:1
+6 SET ND1=0
FOR
SET ND1=$ORDER(ZSY(ND1))
if ND1=""
QUIT
SET @(MSG_"("_ND_")")=ZSY(ND1)
SET ND=ND+1
+7 KILL ND1
+8 QUIT
End DoDot:1
+9 KILL ND
+10 QUIT
+11 ;
MFI(MTP) ;set MFI HL-7 segment
+1 SET MFI="MFI|123.3^GMRC PROCEDURE^99DD||"_MTP_"|||NE"
+2 QUIT MFI
+3 ;
MFE(RSPLVL,ORXDA,GMRCPRNO,PFX) ;set MFE HL-7 segment
+1 NEW X
+2 SET X="MFE|"_RSPLVL_"|||^^^"_ORXDA_"^"_GMRCPRNO_"^99PRC"
+3 QUIT X
ZSY(ARRAY) ;set ZSY segment of the HL-7 segment; contains synonyms
+1 SET ND1=""
SET ND2=1
+2 FOR
SET ND1=$ORDER(ARRAY(ND1))
if ND1=""
QUIT
SET ZSY(ND2)="ZSY|"_ND2_"|"_ARRAY(ND1)_"|"
SET ND2=ND2+1
+3 KILL ND,ND1
+4 QUIT
SVC(SVCIEN,SVCNAME,EVCODE) ;format an HL-7 message that defines a new service
+1 ;SVCIEN=Service IEN from file 123.5
+2 ;SVCNAME=Service name, i.e., Medicine
+3 ;EVCODE=record level event code from HL-7 table 180
+4 KILL GMRCMSG
+5 SET MSH=$$MSH^GMRCHL7
SET $PIECE(MSH,"|",9)="MFN"
+6 SET MFI="MFI|123.5^Request Services^99DD||"_$SELECT(EVCODE="MUP":"UPD",1:"REP")_"|||NE"
+7 SET MFE="MFE|"_EVCODE_"|||^^^"_SVCIEN_"^"_SVCNAME_"^99CON"
+8 IF $LENGTH($ORDER(^GMR(123.5,SVCIEN,2,"B","")))
Begin DoDot:1
+9 SET ND=""
SET ND1=0
FOR
SET ND=$ORDER(^GMR(123.5,SVCIEN,2,"B",ND))
if ND=""
QUIT
SET ND1=ND1+1
SET GMRCARRY(ND1)=ND
+10 DO ZSY(.GMRCARRY)
+11 QUIT
End DoDot:1
+12 DO BUILD
+13 KILL GMRCARRY,ND,ND1,HLQ,MSG,MSH,MFI,MFE,SEP1,SEP2,SEP3,SEP4,SEP5,ZSY
+14 QUIT