SCMCHLE ;BP/DJB - PCMM HL7 EVENT File Utils ; 11 Dec 2002 1:14 PM
;;5.3;Scheduling;**177,204,272**;May 01, 1999
;
;Reference routine: ^SCDXFU01
ADD(EVDATE,EVPTR,DFN,TP,FTEE) ;Add a new event to PCMM HL7 EVENT file (#404.48).
;
; Input: EVDATE - Date/time of PCMM event in FM format.
; Default="NOW"
; EVPTR - Variable pointer that records IEN and file where
; event occurred. Used to determine Table Designator
; and Table ID for the ZPC segment.
; DFN - Pointer to PATIENT file (#2).
; TP - Team Position (Used when processing deletes)
; In the case of changes to 404.53, this may be
; PrecepteeTP-PreceptorTP.
;Output: None
;
NEW EVIEN
Q:$G(SCMCOFF) ;..djb/bp NOIS ISH-1299-40937. Turn off HL7 messaging.
Q:'$G(EVPTR) ;......................Event pointer
S EVIEN=$$CREATE(.EVDATE) ;..........Create new entry
Q:+EVIEN<0
S DFN=$G(DFN)
S TP=$G(TP)
D STORE(EVIEN,EVPTR,DFN,$G(DUZ),TP,$G(FTEE)) ;Store event info
D TRANSMIT(EVIEN,1) ;................Mark entry for transmission
Q
;
CREATE(EVDATE) ;Create entry in PCMM HL7 EVENT (#404.48)
;
; Input: EVDATE - Date/time of PCMM event, in Fileman format.
; Default="NOW".
;Output: Pointer to entry in PCMM HL7 EVENT (#404.48)
; -1^Error - Unable to create entry
;
NEW SCERR,SCFDA,SCIEN
S:'$G(EVDATE) EVDATE="NOW"
;
S SCFDA(404.48,"+1,",.01)=EVDATE
D UPDATE^DIE("E","SCFDA","SCIEN","SCERR")
;
I $D(SCERR) Q "-1^Unable to create entry in PCMM HL7 EVENT file"
Q SCIEN(1)
;
STORE(EVIEN,EVPTR,DFN,EVDUZ,TP,FTEE) ;Store data in PCMM HL7 EVENT file
;
; Input: EVIEN - Pointer to entry in PCMM HL7 EVENT file (#404.48)
; EVPTR - Variable pointer that records IEN and file where
; event occurred. Used to determine Table Designator
; and Table ID for the ZPC segment.
; DFN - Pointer to PATIENT file (#2).
; EVDUZ - Pointer to entry in NEW PERSON file (#200) that
; caused event to occur (defaults to current DUZ).
; TP - Team Position (Used when processing deletes)
; In the case of changes to 404.53, this may be
; FTEE Workload indicator
;Output: None
;Notes : If EVDUZ and current DUZ not valid, use POSTMASTER (.5)
;
NEW SCERR,SCFDA,SCIENS
;
;Check input
Q:'+$G(EVIEN)
Q:'$D(^SCPT(404.48,EVIEN))
Q:'$G(EVPTR)
S:'+$G(EVDUZ) EVDUZ=$S($G(DUZ):DUZ,1:.5)
I EVDUZ'=.5,'$D(^VA(200,EVDUZ)) S EVDUZ=.5
;
S SCIENS=EVIEN_","
S SCFDA(404.48,SCIENS,.02)=DFN ;....Patient
S SCFDA(404.48,SCIENS,.04)=TP ;.....Team Position
S SCFDA(404.48,SCIENS,.05)=EVDUZ ;..User
S SCFDA(404.48,SCIENS,.07)=EVPTR ;..Variable event pointer
I $G(FTEE) S SCFDA(404.48,SCIENS,.08)=FTEE ;Workload Indicator
D FILE^DIE(,"SCFDA","SCERR")
Q
;
TRANSMIT(EVIEN,RESET) ;Set transmit flag in PCMM HL7 EVENT (#404.48)
;
;Input: EVIEN - Pointer to entry in PCMM HL7 EVENT file (#404.48)
; RESET - Should TRANSMISSION REQUIRED fld be ON or OFF?
; 0 = NO
; 1 = YES (Default)
;Output: None
;Notes : Setting TRANSMISSION REQUIRED field to 'YES' flags entry
; entry for transmission.
;
NEW SCERR,SCFDA,SCIENS
;
;Check input
Q:'+$G(EVIEN)
Q:'$D(^SCPT(404.48,EVIEN))
S RESET=$S($G(RESET)=0:"NO",1:"YES")
;
S SCIENS=EVIEN_","
S SCFDA(404.48,SCIENS,.03)=RESET
D FILE^DIE("E","SCFDA","SCERR")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCMCHLE 3557 printed Dec 13, 2024@02:40:27 Page 2
SCMCHLE ;BP/DJB - PCMM HL7 EVENT File Utils ; 11 Dec 2002 1:14 PM
+1 ;;5.3;Scheduling;**177,204,272**;May 01, 1999
+2 ;
+3 ;Reference routine: ^SCDXFU01
ADD(EVDATE,EVPTR,DFN,TP,FTEE) ;Add a new event to PCMM HL7 EVENT file (#404.48).
+1 ;
+2 ; Input: EVDATE - Date/time of PCMM event in FM format.
+3 ; Default="NOW"
+4 ; EVPTR - Variable pointer that records IEN and file where
+5 ; event occurred. Used to determine Table Designator
+6 ; and Table ID for the ZPC segment.
+7 ; DFN - Pointer to PATIENT file (#2).
+8 ; TP - Team Position (Used when processing deletes)
+9 ; In the case of changes to 404.53, this may be
+10 ; PrecepteeTP-PreceptorTP.
+11 ;Output: None
+12 ;
+13 NEW EVIEN
+14 ;..djb/bp NOIS ISH-1299-40937. Turn off HL7 messaging.
if $GET(SCMCOFF)
QUIT
+15 ;......................Event pointer
if '$GET(EVPTR)
QUIT
+16 ;..........Create new entry
SET EVIEN=$$CREATE(.EVDATE)
+17 if +EVIEN<0
QUIT
+18 SET DFN=$GET(DFN)
+19 SET TP=$GET(TP)
+20 ;Store event info
DO STORE(EVIEN,EVPTR,DFN,$GET(DUZ),TP,$GET(FTEE))
+21 ;................Mark entry for transmission
DO TRANSMIT(EVIEN,1)
+22 QUIT
+23 ;
CREATE(EVDATE) ;Create entry in PCMM HL7 EVENT (#404.48)
+1 ;
+2 ; Input: EVDATE - Date/time of PCMM event, in Fileman format.
+3 ; Default="NOW".
+4 ;Output: Pointer to entry in PCMM HL7 EVENT (#404.48)
+5 ; -1^Error - Unable to create entry
+6 ;
+7 NEW SCERR,SCFDA,SCIEN
+8 if '$GET(EVDATE)
SET EVDATE="NOW"
+9 ;
+10 SET SCFDA(404.48,"+1,",.01)=EVDATE
+11 DO UPDATE^DIE("E","SCFDA","SCIEN","SCERR")
+12 ;
+13 IF $DATA(SCERR)
QUIT "-1^Unable to create entry in PCMM HL7 EVENT file"
+14 QUIT SCIEN(1)
+15 ;
STORE(EVIEN,EVPTR,DFN,EVDUZ,TP,FTEE) ;Store data in PCMM HL7 EVENT file
+1 ;
+2 ; Input: EVIEN - Pointer to entry in PCMM HL7 EVENT file (#404.48)
+3 ; EVPTR - Variable pointer that records IEN and file where
+4 ; event occurred. Used to determine Table Designator
+5 ; and Table ID for the ZPC segment.
+6 ; DFN - Pointer to PATIENT file (#2).
+7 ; EVDUZ - Pointer to entry in NEW PERSON file (#200) that
+8 ; caused event to occur (defaults to current DUZ).
+9 ; TP - Team Position (Used when processing deletes)
+10 ; In the case of changes to 404.53, this may be
+11 ; FTEE Workload indicator
+12 ;Output: None
+13 ;Notes : If EVDUZ and current DUZ not valid, use POSTMASTER (.5)
+14 ;
+15 NEW SCERR,SCFDA,SCIENS
+16 ;
+17 ;Check input
+18 if '+$GET(EVIEN)
QUIT
+19 if '$DATA(^SCPT(404.48,EVIEN))
QUIT
+20 if '$GET(EVPTR)
QUIT
+21 if '+$GET(EVDUZ)
SET EVDUZ=$SELECT($GET(DUZ):DUZ,1:.5)
+22 IF EVDUZ'=.5
IF '$DATA(^VA(200,EVDUZ))
SET EVDUZ=.5
+23 ;
+24 SET SCIENS=EVIEN_","
+25 ;....Patient
SET SCFDA(404.48,SCIENS,.02)=DFN
+26 ;.....Team Position
SET SCFDA(404.48,SCIENS,.04)=TP
+27 ;..User
SET SCFDA(404.48,SCIENS,.05)=EVDUZ
+28 ;..Variable event pointer
SET SCFDA(404.48,SCIENS,.07)=EVPTR
+29 ;Workload Indicator
IF $GET(FTEE)
SET SCFDA(404.48,SCIENS,.08)=FTEE
+30 DO FILE^DIE(,"SCFDA","SCERR")
+31 QUIT
+32 ;
TRANSMIT(EVIEN,RESET) ;Set transmit flag in PCMM HL7 EVENT (#404.48)
+1 ;
+2 ;Input: EVIEN - Pointer to entry in PCMM HL7 EVENT file (#404.48)
+3 ; RESET - Should TRANSMISSION REQUIRED fld be ON or OFF?
+4 ; 0 = NO
+5 ; 1 = YES (Default)
+6 ;Output: None
+7 ;Notes : Setting TRANSMISSION REQUIRED field to 'YES' flags entry
+8 ; entry for transmission.
+9 ;
+10 NEW SCERR,SCFDA,SCIENS
+11 ;
+12 ;Check input
+13 if '+$GET(EVIEN)
QUIT
+14 if '$DATA(^SCPT(404.48,EVIEN))
QUIT
+15 SET RESET=$SELECT($GET(RESET)=0:"NO",1:"YES")
+16 ;
+17 SET SCIENS=EVIEN_","
+18 SET SCFDA(404.48,SCIENS,.03)=RESET
+19 DO FILE^DIE("E","SCFDA","SCERR")
+20 QUIT