LA7VSTP ;DALOI/JMC - HL7 environment setup routine ;June 20, 2007
;;5.2;AUTOMATED LAB INSTRUMENTS;**27,44,51,46,64,74**;Sep 27, 1994;Build 229
;
; This routine will create LEDI v1.6 file setups.
;
; Reference to PROTOCOL file (#101) supported by DBIA #872
;
HOST(PRIMARY,PRSITE,LRI,SITE,LA7VER) ;
;
N LA7Y,LAREMOTE,LAHOST,LASERV,LACLNT,LRS,PROT,ORU
;
I $G(LRI)="" D EXIT Q
;
W !,"Setting up the following Host Labs for "_PRSITE
W !," Updating HL7 APPLICATION PARAMETER file (#771)."
;
S LA7VER=$S($G(LA7VER)]"":LA7VER,1:2.3)
S LAREMOTE="LA7V REMOTE "_PRIMARY
S $P(LAREMOTE,"^",2)=$$SETAPP(LAREMOTE,PRIMARY)
;
S LAHOST="LA7V HOST "_LRI
S $P(LAHOST,"^",2)=$$SETAPP(LAHOST,LRI)
;
W !," Updating PROTOCOL file (#101)."
;
; Setup protocols to receive and process result (ORU) messages.
; Create event & subscriber protocols.
K LASERV
S LASERV="LA7V Receive Results from "_LRI
S LASERV(4)="E"
S LASERV(770.1)=$P(LAHOST,"^")
S LASERV(770.3)="ORU"
S LASERV(770.4)="R01"
S LASERV(770.8)="AL"
S LASERV(770.95)=LA7VER
D SETPRO(.LASERV)
;
K LACLNT
S LACLNT="LA7V Process Results from "_LRI
S LACLNT(4)="S"
S LACLNT(770.2)=$P(LAREMOTE,"^")
S LACLNT(770.3)="@"
S LACLNT(770.4)="R01"
S LACLNT(770.11)="ACK"
S LACLNT(770.95)=LA7VER
S LACLNT(771)="D ORU^LA7VHL"
F I=773.1,773.2,773.4 S LACLNT(I)=1
D SETPRO(.LACLNT)
;
; Add subscriber to event.
D ADDSUB(LASERV,LACLNT)
;
; Setup protocols to build and send order (ORM) messages.
; Create event & subscriber protocols.
K LASERV
S LASERV="LA7V Order to "_LRI
S LASERV(4)="E"
S LASERV(770.1)=$P(LAREMOTE,"^")
S LASERV(770.3)="ORM"
S LASERV(770.4)="O01"
F I=770.2,770.11 S LASERV(I)="@"
F I=770.8,770.9 S LASERV(I)="AL"
S LASERV(770.95)=LA7VER
S LASERV(772)="D ORR^LA7VHL"
D SETPRO(.LASERV)
;
K LACLNT
S LACLNT="LA7V Send Order to "_LRI
S LACLNT(4)="S"
S LACLNT(770.2)=$P(LAHOST,"^")
S LACLNT(770.4)="O02"
S LACLNT(770.11)="ORR"
S LACLNT(770.95)=LA7VER
F I=770.1,770.3 S LACLNT(I)="@"
F I=773.1,773.2,773.4 S LACLNT(I)=1
D SETPRO(.LACLNT)
;
; Add subscriber to event.
D ADDSUB(LASERV,LACLNT)
;
D HOST^LA7VSTP1
D EXIT
;
Q
;
;
REMOTE(PRIMARY,PRSITE,LRI,SITE,LA7VER) ;
N LA7Y,LAREMOTE,LAHOST,LASERV,LACLNT,LRS,PROT,ORU
;
I $G(LRI)="" D EXIT Q
;
W !,"Setting up the REMOTE Lab, "_SITE_" and HOST Lab "_PRSITE
W !," Updating HL7 APPLICATION PARAMETER file (#771)."
;
S LA7VER=$S($G(LA7VER)]"":LA7VER,1:2.3)
S LAHOST="LA7V HOST "_PRIMARY
S $P(LAHOST,"^",2)=$$SETAPP(LAHOST,PRIMARY)
;
S LAREMOTE="LA7V REMOTE "_LRI
S $P(LAREMOTE,"^",2)=$$SETAPP(LAREMOTE,LRI)
;
W !," Updating PROTOCOL file (#101)."
;
; Setup protocols to build and send results (ORU) message back.
; Create event & subscriber protocols.
K LASERV
S LASERV="LA7V Results Reporting to "_LRI
S LASERV(4)="E"
S LASERV(770.1)=$P(LAHOST,"^")
S LASERV(770.3)="ORU"
S LASERV(770.4)="R01"
S LASERV(770.95)=LA7VER
F I=770.8,770.9 S LASERV(I)="AL"
S LASERV(772)="D ACK^LA7VHL"
D SETPRO(.LASERV)
;
K LACLNT
S LACLNT="LA7V Send Results to "_LRI
S LACLNT(4)="S"
S LACLNT(770.2)=$P(LAREMOTE,"^")
S LACLNT(770.3)="@"
S LACLNT(770.4)="R01"
S LACLNT(770.11)="ACK"
S LACLNT(770.95)=LA7VER
F I=773.1,773.2,773.4 S LACLNT(I)=1
D SETPRO(.LACLNT)
;
; Add subscriber to event.
D ADDSUB(LASERV,LACLNT)
;
; Setup protocols to receive and process order (ORM) messages.
; Create event & subscriber protocols.
K LASERV
S LASERV="LA7V Receive Order from "_LRI
S LASERV(4)="E"
S LASERV(770.1)=$P(LAREMOTE,"^")
S LASERV(770.3)="ORM"
S LASERV(770.4)="O01"
S LASERV(770.8)="AL"
S LASERV(770.95)=LA7VER
F I=770.2,770.11 S LASERV(I)="@"
D SETPRO(.LASERV)
;
K LACLNT
S LACLNT="LA7V Process Order from "_LRI
S LACLNT(4)="S"
S LACLNT(770.2)=$P(LAHOST,"^")
S LACLNT(770.4)="O02"
S LACLNT(770.11)="ORR"
F I=770.1,770.3 S LACLNT(I)="@"
F I=773.1,773.2,773.4 S LACLNT(I)=1
S LACLNT(770.95)=LA7VER
S LACLNT(771)="D IN^LA7VORM"
D SETPRO(.LACLNT)
;
; Add subscriber to event.
D ADDSUB(LASERV,LACLNT)
;
D REMOTE^LA7VSTP1
D EXIT
;
Q
;
;
EXIT ; Exit with message
W !!,"HL7 v1.6 Environment setup is complete!!"
S LASERV(770.95)=LA7VER
K DIR
S DIR(0)="E" D ^DIR
Q
;
;
SETAPP(LA7X,LA7FAC) ;sets up the HL7 APPLICATION PARAMETER file #771
;
; Call with LA7X = value of .01 field to add to file #771
; LA7FAC = facility name
;
N DIC,DIE,DLAYGO,DR,LA7Y
;
S X=LA7X
S DIC="^HL(771,",DLAYGO=771,DIC(0)="L"
D ^DIC
S LA7Y=Y
W:$P(LA7Y,"^",3) !," Adding "_LA7X
I +LA7Y<1 Q
;
S DA=+LA7Y,DIE="^HL(771,",DR="2////a;3////"_LA7FAC
D ^DIE
Q $P(LA7Y,"^")
;
;
SETPRO(FIELDS) ;sets up the PROTOCOL file #101
; Call with LA7X = Protocol name
; FIELDS = FileMan fields array
;
N DA,DIC,FDA,I,LA7DIE,LA7IENS
;
S X=FIELDS,DIC="^ORD(101,",DIC(0)="L",DLAYGO=101
D ^DIC
I '$G(LA7QUIET) W !,FIELDS W:$P(Y,U,3) !," Adding "_X
S DA=+Y
I DA<0 Q
;
S I=0,LA7IENS=DA_","
F S I=$O(FIELDS(I)) Q:'I S FDA(1,101,LA7IENS,I)=FIELDS(I)
S FDA(1,101,LA7IENS,770.6)="@"
D FILE^DIE("E","FDA(1)","LA7DIE(1)")
S FDA(2,101,LA7IENS,5)=DUZ
D FILE^DIE("","FDA(2)","LA7DIE(2)")
D CLEAN^DILF
Q
;
;
ADDSUB(LA7EVNT,LA7SUB) ; Add subscriber to event protocol
; Call with LA7EVNT = name of event protocol
; LA7SUB = name of subscriber protocol
;
N DIC,DA,DR,D0,DLAYGO,LA7101E,LA7101S,X,Y
;
I '$D(^ORD(101,"B",LA7SUB)) Q
I '$D(^ORD(101,"B",LA7EVNT)) Q
;
; Get ien for event and subscriber protocols
S LA7101E=$O(^ORD(101,"B",LA7EVNT,0))
S LA7101S=$O(^ORD(101,"B",LA7SUB,0))
;
; Already listed as a subscriber to this event
I $D(^ORD(101,LA7101E,775,"B",LA7101S)) Q
;
S X=LA7SUB,DA(1)=LA7101E,DIC="^ORD(101,"_DA(1)_",775,"
S DLAYGO=101.01,DIC(0)="QEL",DIC("P")=$P(^DD(101,775,0),U,2)
D ^DIC
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLA7VSTP 5983 printed Oct 16, 2024@17:42:01 Page 2
LA7VSTP ;DALOI/JMC - HL7 environment setup routine ;June 20, 2007
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,44,51,46,64,74**;Sep 27, 1994;Build 229
+2 ;
+3 ; This routine will create LEDI v1.6 file setups.
+4 ;
+5 ; Reference to PROTOCOL file (#101) supported by DBIA #872
+6 ;
HOST(PRIMARY,PRSITE,LRI,SITE,LA7VER) ;
+1 ;
+2 NEW LA7Y,LAREMOTE,LAHOST,LASERV,LACLNT,LRS,PROT,ORU
+3 ;
+4 IF $GET(LRI)=""
DO EXIT
QUIT
+5 ;
+6 WRITE !,"Setting up the following Host Labs for "_PRSITE
+7 WRITE !," Updating HL7 APPLICATION PARAMETER file (#771)."
+8 ;
+9 SET LA7VER=$SELECT($GET(LA7VER)]"":LA7VER,1:2.3)
+10 SET LAREMOTE="LA7V REMOTE "_PRIMARY
+11 SET $PIECE(LAREMOTE,"^",2)=$$SETAPP(LAREMOTE,PRIMARY)
+12 ;
+13 SET LAHOST="LA7V HOST "_LRI
+14 SET $PIECE(LAHOST,"^",2)=$$SETAPP(LAHOST,LRI)
+15 ;
+16 WRITE !," Updating PROTOCOL file (#101)."
+17 ;
+18 ; Setup protocols to receive and process result (ORU) messages.
+19 ; Create event & subscriber protocols.
+20 KILL LASERV
+21 SET LASERV="LA7V Receive Results from "_LRI
+22 SET LASERV(4)="E"
+23 SET LASERV(770.1)=$PIECE(LAHOST,"^")
+24 SET LASERV(770.3)="ORU"
+25 SET LASERV(770.4)="R01"
+26 SET LASERV(770.8)="AL"
+27 SET LASERV(770.95)=LA7VER
+28 DO SETPRO(.LASERV)
+29 ;
+30 KILL LACLNT
+31 SET LACLNT="LA7V Process Results from "_LRI
+32 SET LACLNT(4)="S"
+33 SET LACLNT(770.2)=$PIECE(LAREMOTE,"^")
+34 SET LACLNT(770.3)="@"
+35 SET LACLNT(770.4)="R01"
+36 SET LACLNT(770.11)="ACK"
+37 SET LACLNT(770.95)=LA7VER
+38 SET LACLNT(771)="D ORU^LA7VHL"
+39 FOR I=773.1,773.2,773.4
SET LACLNT(I)=1
+40 DO SETPRO(.LACLNT)
+41 ;
+42 ; Add subscriber to event.
+43 DO ADDSUB(LASERV,LACLNT)
+44 ;
+45 ; Setup protocols to build and send order (ORM) messages.
+46 ; Create event & subscriber protocols.
+47 KILL LASERV
+48 SET LASERV="LA7V Order to "_LRI
+49 SET LASERV(4)="E"
+50 SET LASERV(770.1)=$PIECE(LAREMOTE,"^")
+51 SET LASERV(770.3)="ORM"
+52 SET LASERV(770.4)="O01"
+53 FOR I=770.2,770.11
SET LASERV(I)="@"
+54 FOR I=770.8,770.9
SET LASERV(I)="AL"
+55 SET LASERV(770.95)=LA7VER
+56 SET LASERV(772)="D ORR^LA7VHL"
+57 DO SETPRO(.LASERV)
+58 ;
+59 KILL LACLNT
+60 SET LACLNT="LA7V Send Order to "_LRI
+61 SET LACLNT(4)="S"
+62 SET LACLNT(770.2)=$PIECE(LAHOST,"^")
+63 SET LACLNT(770.4)="O02"
+64 SET LACLNT(770.11)="ORR"
+65 SET LACLNT(770.95)=LA7VER
+66 FOR I=770.1,770.3
SET LACLNT(I)="@"
+67 FOR I=773.1,773.2,773.4
SET LACLNT(I)=1
+68 DO SETPRO(.LACLNT)
+69 ;
+70 ; Add subscriber to event.
+71 DO ADDSUB(LASERV,LACLNT)
+72 ;
+73 DO HOST^LA7VSTP1
+74 DO EXIT
+75 ;
+76 QUIT
+77 ;
+78 ;
REMOTE(PRIMARY,PRSITE,LRI,SITE,LA7VER) ;
+1 NEW LA7Y,LAREMOTE,LAHOST,LASERV,LACLNT,LRS,PROT,ORU
+2 ;
+3 IF $GET(LRI)=""
DO EXIT
QUIT
+4 ;
+5 WRITE !,"Setting up the REMOTE Lab, "_SITE_" and HOST Lab "_PRSITE
+6 WRITE !," Updating HL7 APPLICATION PARAMETER file (#771)."
+7 ;
+8 SET LA7VER=$SELECT($GET(LA7VER)]"":LA7VER,1:2.3)
+9 SET LAHOST="LA7V HOST "_PRIMARY
+10 SET $PIECE(LAHOST,"^",2)=$$SETAPP(LAHOST,PRIMARY)
+11 ;
+12 SET LAREMOTE="LA7V REMOTE "_LRI
+13 SET $PIECE(LAREMOTE,"^",2)=$$SETAPP(LAREMOTE,LRI)
+14 ;
+15 WRITE !," Updating PROTOCOL file (#101)."
+16 ;
+17 ; Setup protocols to build and send results (ORU) message back.
+18 ; Create event & subscriber protocols.
+19 KILL LASERV
+20 SET LASERV="LA7V Results Reporting to "_LRI
+21 SET LASERV(4)="E"
+22 SET LASERV(770.1)=$PIECE(LAHOST,"^")
+23 SET LASERV(770.3)="ORU"
+24 SET LASERV(770.4)="R01"
+25 SET LASERV(770.95)=LA7VER
+26 FOR I=770.8,770.9
SET LASERV(I)="AL"
+27 SET LASERV(772)="D ACK^LA7VHL"
+28 DO SETPRO(.LASERV)
+29 ;
+30 KILL LACLNT
+31 SET LACLNT="LA7V Send Results to "_LRI
+32 SET LACLNT(4)="S"
+33 SET LACLNT(770.2)=$PIECE(LAREMOTE,"^")
+34 SET LACLNT(770.3)="@"
+35 SET LACLNT(770.4)="R01"
+36 SET LACLNT(770.11)="ACK"
+37 SET LACLNT(770.95)=LA7VER
+38 FOR I=773.1,773.2,773.4
SET LACLNT(I)=1
+39 DO SETPRO(.LACLNT)
+40 ;
+41 ; Add subscriber to event.
+42 DO ADDSUB(LASERV,LACLNT)
+43 ;
+44 ; Setup protocols to receive and process order (ORM) messages.
+45 ; Create event & subscriber protocols.
+46 KILL LASERV
+47 SET LASERV="LA7V Receive Order from "_LRI
+48 SET LASERV(4)="E"
+49 SET LASERV(770.1)=$PIECE(LAREMOTE,"^")
+50 SET LASERV(770.3)="ORM"
+51 SET LASERV(770.4)="O01"
+52 SET LASERV(770.8)="AL"
+53 SET LASERV(770.95)=LA7VER
+54 FOR I=770.2,770.11
SET LASERV(I)="@"
+55 DO SETPRO(.LASERV)
+56 ;
+57 KILL LACLNT
+58 SET LACLNT="LA7V Process Order from "_LRI
+59 SET LACLNT(4)="S"
+60 SET LACLNT(770.2)=$PIECE(LAHOST,"^")
+61 SET LACLNT(770.4)="O02"
+62 SET LACLNT(770.11)="ORR"
+63 FOR I=770.1,770.3
SET LACLNT(I)="@"
+64 FOR I=773.1,773.2,773.4
SET LACLNT(I)=1
+65 SET LACLNT(770.95)=LA7VER
+66 SET LACLNT(771)="D IN^LA7VORM"
+67 DO SETPRO(.LACLNT)
+68 ;
+69 ; Add subscriber to event.
+70 DO ADDSUB(LASERV,LACLNT)
+71 ;
+72 DO REMOTE^LA7VSTP1
+73 DO EXIT
+74 ;
+75 QUIT
+76 ;
+77 ;
EXIT ; Exit with message
+1 WRITE !!,"HL7 v1.6 Environment setup is complete!!"
+2 SET LASERV(770.95)=LA7VER
+3 KILL DIR
+4 SET DIR(0)="E"
DO ^DIR
+5 QUIT
+6 ;
+7 ;
SETAPP(LA7X,LA7FAC) ;sets up the HL7 APPLICATION PARAMETER file #771
+1 ;
+2 ; Call with LA7X = value of .01 field to add to file #771
+3 ; LA7FAC = facility name
+4 ;
+5 NEW DIC,DIE,DLAYGO,DR,LA7Y
+6 ;
+7 SET X=LA7X
+8 SET DIC="^HL(771,"
SET DLAYGO=771
SET DIC(0)="L"
+9 DO ^DIC
+10 SET LA7Y=Y
+11 if $PIECE(LA7Y,"^",3)
WRITE !," Adding "_LA7X
+12 IF +LA7Y<1
QUIT
+13 ;
+14 SET DA=+LA7Y
SET DIE="^HL(771,"
SET DR="2////a;3////"_LA7FAC
+15 DO ^DIE
+16 QUIT $PIECE(LA7Y,"^")
+17 ;
+18 ;
SETPRO(FIELDS) ;sets up the PROTOCOL file #101
+1 ; Call with LA7X = Protocol name
+2 ; FIELDS = FileMan fields array
+3 ;
+4 NEW DA,DIC,FDA,I,LA7DIE,LA7IENS
+5 ;
+6 SET X=FIELDS
SET DIC="^ORD(101,"
SET DIC(0)="L"
SET DLAYGO=101
+7 DO ^DIC
+8 IF '$GET(LA7QUIET)
WRITE !,FIELDS
if $PIECE(Y,U,3)
WRITE !," Adding "_X
+9 SET DA=+Y
+10 IF DA<0
QUIT
+11 ;
+12 SET I=0
SET LA7IENS=DA_","
+13 FOR
SET I=$ORDER(FIELDS(I))
if 'I
QUIT
SET FDA(1,101,LA7IENS,I)=FIELDS(I)
+14 SET FDA(1,101,LA7IENS,770.6)="@"
+15 DO FILE^DIE("E","FDA(1)","LA7DIE(1)")
+16 SET FDA(2,101,LA7IENS,5)=DUZ
+17 DO FILE^DIE("","FDA(2)","LA7DIE(2)")
+18 DO CLEAN^DILF
+19 QUIT
+20 ;
+21 ;
ADDSUB(LA7EVNT,LA7SUB) ; Add subscriber to event protocol
+1 ; Call with LA7EVNT = name of event protocol
+2 ; LA7SUB = name of subscriber protocol
+3 ;
+4 NEW DIC,DA,DR,D0,DLAYGO,LA7101E,LA7101S,X,Y
+5 ;
+6 IF '$DATA(^ORD(101,"B",LA7SUB))
QUIT
+7 IF '$DATA(^ORD(101,"B",LA7EVNT))
QUIT
+8 ;
+9 ; Get ien for event and subscriber protocols
+10 SET LA7101E=$ORDER(^ORD(101,"B",LA7EVNT,0))
+11 SET LA7101S=$ORDER(^ORD(101,"B",LA7SUB,0))
+12 ;
+13 ; Already listed as a subscriber to this event
+14 IF $DATA(^ORD(101,LA7101E,775,"B",LA7101S))
QUIT
+15 ;
+16 SET X=LA7SUB
SET DA(1)=LA7101E
SET DIC="^ORD(101,"_DA(1)_",775,"
+17 SET DLAYGO=101.01
SET DIC(0)="QEL"
SET DIC("P")=$PIECE(^DD(101,775,0),U,2)
+18 DO ^DIC
+19 ;
+20 QUIT