| [613] | 1 | SCMCHLE ;BP/DJB - PCMM HL7 EVENT File Utils ; 11 Dec 2002  1:14 PM
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**177,204,272**;May 01, 1999
 | 
|---|
 | 3 |  ;
 | 
|---|
 | 4 |  ;Reference routine: ^SCDXFU01
 | 
|---|
 | 5 | ADD(EVDATE,EVPTR,DFN,TP,FTEE) ;Add a new event to PCMM HL7 EVENT file (#404.48).
 | 
|---|
 | 6 |  ;
 | 
|---|
 | 7 |  ; Input: EVDATE - Date/time of PCMM event in FM format.
 | 
|---|
 | 8 |  ;                 Default="NOW"
 | 
|---|
 | 9 |  ;        EVPTR  - Variable pointer that records IEN and file where
 | 
|---|
 | 10 |  ;                 event occurred. Used to determine Table Designator
 | 
|---|
 | 11 |  ;                 and Table ID for the ZPC segment.
 | 
|---|
 | 12 |  ;        DFN    - Pointer to PATIENT file (#2).
 | 
|---|
 | 13 |  ;        TP     - Team Position (Used when processing deletes)
 | 
|---|
 | 14 |  ;                 In the case of changes to 404.53, this may be
 | 
|---|
 | 15 |  ;                 PrecepteeTP-PreceptorTP.
 | 
|---|
 | 16 |  ;Output: None
 | 
|---|
 | 17 |  ;
 | 
|---|
 | 18 |  NEW EVIEN
 | 
|---|
 | 19 |  Q:$G(SCMCOFF)  ;..djb/bp NOIS ISH-1299-40937. Turn off HL7 messaging.
 | 
|---|
 | 20 |  Q:'$G(EVPTR)  ;......................Event pointer
 | 
|---|
 | 21 |  S EVIEN=$$CREATE(.EVDATE) ;..........Create new entry
 | 
|---|
 | 22 |  Q:+EVIEN<0
 | 
|---|
 | 23 |  S DFN=$G(DFN)
 | 
|---|
 | 24 |  S TP=$G(TP)
 | 
|---|
 | 25 |  D STORE(EVIEN,EVPTR,DFN,$G(DUZ),TP,$G(FTEE)) ;Store event info
 | 
|---|
 | 26 |  D TRANSMIT(EVIEN,1) ;................Mark entry for transmission
 | 
|---|
 | 27 |  Q
 | 
|---|
 | 28 |  ;
 | 
|---|
 | 29 | CREATE(EVDATE) ;Create entry in PCMM HL7 EVENT (#404.48)
 | 
|---|
 | 30 |  ;
 | 
|---|
 | 31 |  ; Input: EVDATE - Date/time of PCMM event, in Fileman format.
 | 
|---|
 | 32 |  ;                 Default="NOW".
 | 
|---|
 | 33 |  ;Output: Pointer to entry in PCMM HL7 EVENT (#404.48)
 | 
|---|
 | 34 |  ;        -1^Error - Unable to create entry
 | 
|---|
 | 35 |  ;
 | 
|---|
 | 36 |  NEW SCERR,SCFDA,SCIEN
 | 
|---|
 | 37 |  S:'$G(EVDATE) EVDATE="NOW"
 | 
|---|
 | 38 |  ;
 | 
|---|
 | 39 |  S SCFDA(404.48,"+1,",.01)=EVDATE
 | 
|---|
 | 40 |  D UPDATE^DIE("E","SCFDA","SCIEN","SCERR")
 | 
|---|
 | 41 |  ;
 | 
|---|
 | 42 |  I $D(SCERR) Q "-1^Unable to create entry in PCMM HL7 EVENT file"
 | 
|---|
 | 43 |  Q SCIEN(1)
 | 
|---|
 | 44 |  ;
 | 
|---|
 | 45 | STORE(EVIEN,EVPTR,DFN,EVDUZ,TP,FTEE) ;Store data in PCMM HL7 EVENT file
 | 
|---|
 | 46 |  ;
 | 
|---|
 | 47 |  ; Input: EVIEN - Pointer to entry in PCMM HL7 EVENT file (#404.48)
 | 
|---|
 | 48 |  ;        EVPTR - Variable pointer that records IEN and file where
 | 
|---|
 | 49 |  ;                event occurred. Used to determine Table Designator
 | 
|---|
 | 50 |  ;                and Table ID for the ZPC segment.
 | 
|---|
 | 51 |  ;        DFN   - Pointer to PATIENT file (#2).
 | 
|---|
 | 52 |  ;        EVDUZ - Pointer to entry in NEW PERSON file (#200) that
 | 
|---|
 | 53 |  ;                caused event to occur (defaults to current DUZ).
 | 
|---|
 | 54 |  ;        TP    - Team Position (Used when processing deletes)
 | 
|---|
 | 55 |  ;                In the case of changes to 404.53, this may be
 | 
|---|
 | 56 |  ;       FTEE    Workload indicator
 | 
|---|
 | 57 |  ;Output: None
 | 
|---|
 | 58 |  ;Notes : If EVDUZ and current DUZ not valid, use POSTMASTER (.5)
 | 
|---|
 | 59 |  ;
 | 
|---|
 | 60 |  NEW SCERR,SCFDA,SCIENS
 | 
|---|
 | 61 |  ;
 | 
|---|
 | 62 |  ;Check input
 | 
|---|
 | 63 |  Q:'+$G(EVIEN)
 | 
|---|
 | 64 |  Q:'$D(^SCPT(404.48,EVIEN))
 | 
|---|
 | 65 |  Q:'$G(EVPTR)
 | 
|---|
 | 66 |  S:'+$G(EVDUZ) EVDUZ=$S($G(DUZ):DUZ,1:.5)
 | 
|---|
 | 67 |  I EVDUZ'=.5,'$D(^VA(200,EVDUZ)) S EVDUZ=.5
 | 
|---|
 | 68 |  ;
 | 
|---|
 | 69 |  S SCIENS=EVIEN_","
 | 
|---|
 | 70 |  S SCFDA(404.48,SCIENS,.02)=DFN ;....Patient
 | 
|---|
 | 71 |  S SCFDA(404.48,SCIENS,.04)=TP ;.....Team Position
 | 
|---|
 | 72 |  S SCFDA(404.48,SCIENS,.05)=EVDUZ ;..User
 | 
|---|
 | 73 |  S SCFDA(404.48,SCIENS,.07)=EVPTR ;..Variable event pointer
 | 
|---|
 | 74 |  I $G(FTEE) S SCFDA(404.48,SCIENS,.08)=FTEE  ;Workload Indicator
 | 
|---|
 | 75 |  D FILE^DIE(,"SCFDA","SCERR")
 | 
|---|
 | 76 |  Q
 | 
|---|
 | 77 |  ;
 | 
|---|
 | 78 | TRANSMIT(EVIEN,RESET) ;Set transmit flag in PCMM HL7 EVENT (#404.48)
 | 
|---|
 | 79 |  ;
 | 
|---|
 | 80 |  ;Input: EVIEN - Pointer to entry in PCMM HL7 EVENT file (#404.48)
 | 
|---|
 | 81 |  ;       RESET - Should TRANSMISSION REQUIRED fld be ON or OFF?
 | 
|---|
 | 82 |  ;                  0 = NO
 | 
|---|
 | 83 |  ;                  1 = YES (Default)
 | 
|---|
 | 84 |  ;Output: None
 | 
|---|
 | 85 |  ;Notes : Setting TRANSMISSION REQUIRED field to 'YES' flags entry
 | 
|---|
 | 86 |  ;        entry for transmission.
 | 
|---|
 | 87 |  ;
 | 
|---|
 | 88 |  NEW SCERR,SCFDA,SCIENS
 | 
|---|
 | 89 |  ;
 | 
|---|
 | 90 |  ;Check input
 | 
|---|
 | 91 |  Q:'+$G(EVIEN)
 | 
|---|
 | 92 |  Q:'$D(^SCPT(404.48,EVIEN))
 | 
|---|
 | 93 |  S RESET=$S($G(RESET)=0:"NO",1:"YES")
 | 
|---|
 | 94 |  ;
 | 
|---|
 | 95 |  S SCIENS=EVIEN_","
 | 
|---|
 | 96 |  S SCFDA(404.48,SCIENS,.03)=RESET
 | 
|---|
 | 97 |  D FILE^DIE("E","SCFDA","SCERR")
 | 
|---|
 | 98 |  Q
 | 
|---|