PSSHLSCH ;BIR/RLW/MV-BUILD HL7 MESSAGE TO POPULATE ADMIN. SCHEDULE FILE ; 09/02/97 8:38
;;1.0;PHARMACY DATA MANAGEMENT;;9/30/97
; PSJEC=event code from HL7 table 8.4.2.1
; PSJIEN=ien to Administration Schedule file (#51.1)
; SPDNAME=.01 field (name) of super-primary drug
; DDIEN=ien to drug file (#50)
; LIMIT=number of fields in HL7 segment being built
;
EN1 ; start here for pre-install auto load
Q
;We no longer send schedules to OERR
N APPL,CODE,FIELD,LIMIT,MFE,PSJI,SEGMENT,SPDNAME,SYN,SYNONYM,USAGE,X
S PSJEC="MAD",CODE="REP"
D INIT
D LOOP
D SCH^PSSHLU(PSJI)
K PSJEC,PSJIEN,PSJCLEAR
Q
;
EN2 ; start here for "manual" update
Q
;We no longer send schedules to OERR
K ^TMP("HLS",$J)
N APPL,CODE,FIELD,PSJI,LIMIT,MFE,SEGMENT,SPDNAME,SYN,SYNONYM,USAGE,X,Y,DA,DS
S CODE="UPD"
D INIT
S PSJIEN=0 F S PSJIEN=$O(PSJHLDA(PSJIEN)) Q:'PSJIEN D
. S PSJEC=PSJHLDA(PSJIEN)
. D MFE,CALL^PSSHLU(PSJI)
K PSJEC,PSJIEN,PSJHLDA
Q
;
;
INIT ; initialize HL7 variables, set master file identification segment fields
S PSJI=0,LIMIT=6,HLMTN="MFN"
D INIT^PSSHLU X PSJCLEAR
S FIELD(0)="MFI"
S FIELD(1)="^^^51.1^ADMINSTRATION SCHEDULE FILE"
S FIELD(3)=CODE
S FIELD(6)="NE"
D SEGMENT^PSSHLU(LIMIT)
Q
;
LOOP ; loop through SCHEDULE file
S PSJIEN=0 F S PSJIEN=$O(^PS(51.1,PSJIEN)) Q:'PSJIEN D MFE
Q
;
MFE ; set master file entry segment fields
S LIMIT=4 X PSJCLEAR
S X=$G(^PS(51.1,PSJIEN,0))
S FIELD(0)="MFE"
S FIELD(1)=PSJEC
S FIELD(4)="^^^"_PSJIEN_"^"_$P(X,"^")_"~"_$P(X,"^",4)_"^99PSS"
D SEGMENT^PSSHLU(LIMIT)
Q
;
PSSHLSCH ;BIR/RLW/MV-BUILD HL7 MESSAGE TO POPULATE ADMIN. SCHEDULE FILE ; 09/02/97 8:38
+1 ;;1.0;PHARMACY DATA MANAGEMENT;;9/30/97
+2 ; PSJEC=event code from HL7 table 8.4.2.1
+3 ; PSJIEN=ien to Administration Schedule file (#51.1)
+4 ; SPDNAME=.01 field (name) of super-primary drug
+5 ; DDIEN=ien to drug file (#50)
+6 ; LIMIT=number of fields in HL7 segment being built
+7 ;
EN1 ; start here for pre-install auto load
+1 QUIT
+2 ;We no longer send schedules to OERR
+3 NEW APPL,CODE,FIELD,LIMIT,MFE,PSJI,SEGMENT,SPDNAME,SYN,SYNONYM,USAGE,X
+4 SET PSJEC="MAD"
SET CODE="REP"
+5 DO INIT
+6 DO LOOP
+7 DO SCH^PSSHLU(PSJI)
+8 KILL PSJEC,PSJIEN,PSJCLEAR
+9 QUIT
+10 ;
EN2 ; start here for "manual" update
+1 QUIT
+2 ;We no longer send schedules to OERR
+3 KILL ^TMP("HLS",$JOB)
+4 NEW APPL,CODE,FIELD,PSJI,LIMIT,MFE,SEGMENT,SPDNAME,SYN,SYNONYM,USAGE,X,Y,DA,DS
+5 SET CODE="UPD"
+6 DO INIT
+7 SET PSJIEN=0
FOR
SET PSJIEN=$ORDER(PSJHLDA(PSJIEN))
IF 'PSJIEN
QUIT
Begin DoDot:1
+8 SET PSJEC=PSJHLDA(PSJIEN)
+9 DO MFE
DO CALL^PSSHLU(PSJI)
End DoDot:1
+10 KILL PSJEC,PSJIEN,PSJHLDA
+11 QUIT
+12 ;
+13 ;
INIT ; initialize HL7 variables, set master file identification segment fields
+1 SET PSJI=0
SET LIMIT=6
SET HLMTN="MFN"
+2 DO INIT^PSSHLU
XECUTE PSJCLEAR
+3 SET FIELD(0)="MFI"
+4 SET FIELD(1)="^^^51.1^ADMINSTRATION SCHEDULE FILE"
+5 SET FIELD(3)=CODE
+6 SET FIELD(6)="NE"
+7 DO SEGMENT^PSSHLU(LIMIT)
+8 QUIT
+9 ;
LOOP ; loop through SCHEDULE file
+1 SET PSJIEN=0
FOR
SET PSJIEN=$ORDER(^PS(51.1,PSJIEN))
IF 'PSJIEN
QUIT
DO MFE
+2 QUIT
+3 ;
MFE ; set master file entry segment fields
+1 SET LIMIT=4
XECUTE PSJCLEAR
+2 SET X=$GET(^PS(51.1,PSJIEN,0))
+3 SET FIELD(0)="MFE"
+4 SET FIELD(1)=PSJEC
+5 SET FIELD(4)="^^^"_PSJIEN_"^"_$PIECE(X,"^")_"~"_$PIECE(X,"^",4)_"^99PSS"
+6 DO SEGMENT^PSSHLU(LIMIT)
+7 QUIT
+8 ;