SCDXFU11 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;02-JUL-97 ; 1/10/02 4:33pm
;;5.3;Scheduling;**128,247**;AUG 13, 1993
;
EZN4XMIT(XMITPTR) ;Return zero node of encounter associated to entry
; in Transmitted Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : Zero node of associated encounter
; Null ("") - Error/bad input
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) ""
;Declare variables
N NODE,ENCPTR,DELPTR
;Determine if entry in xmit file is for a deleted or existing encounter
S NODE=$G(^SD(409.73,XMITPTR,0))
S ENCPTR=+$P(NODE,"^",2)
S DELPTR=+$P(NODE,"^",3)
;Get zero node
S NODE=""
;Existing encounter
I (ENCPTR) D
.;Grab zero node of Outpatient Encounter file (#409.68)
.S NODE=$G(^SCE(ENCPTR,0))
;Deleted encounter
I (DELPTR) D
.;Original zero node in Deleted Outpatient Encounter file (#409.74)
.S NODE=$G(^SD(409.74,DELPTR,1))
;Done
Q NODE
;
EDT4XMIT(XMITPTR) ;Return date/time of encounter associated to entry
; in Transmitted Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : FM ^ Ext - Date/time of associated encounter
; FM = Date/time in FileMan format
; Ext = Date/time in external format
; (MMM DD, YYYY@hh:mm:ss)
; 0 - Error/bad input
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) 0
;Declare variables
N NODE,FMDT,EXTDT
;Get zero node of encounter
S NODE=$$EZN4XMIT(XMITPTR)
Q:(NODE="") 0
;Get date/time of encounter
S FMDT=+NODE
Q:('FMDT) 0
;Convert to external format
S EXTDT=$$FMTE^XLFDT(FMDT)
;Done
Q FMDT_"^"_EXTDT
;
LOC4XMIT(XMITPTR) ;Return clinic associated to entry in Transmitted
; Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : Ptr ^ Name - Clinic associated to entry
; Ptr = Pointer to Hospital Location file (#44)
; Name = Name of clinic
; 0 - Error/bad input
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) 0
;Declare variables
N NODE,PTRLOC,CLINIC
;Get zero node of encounter
S NODE=$$EZN4XMIT(XMITPTR)
Q:(NODE="") 0
;Get pointer to location
S PTRLOC=+$P(NODE,"^",4)
Q:('PTRLOC) 0
;Get clinic name
S CLINIC=$P($G(^SC(PTRLOC,0)),"^",1)
Q:(CLINIC="") 0
;Done
Q PTRLOC_"^"_CLINIC
;
DIV4XMIT(XMITPTR) ;Return division associated to entry in Transmitted
; Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : Ptr ^ Name - Division associated to entry
; Ptr = Pointer to Medical Ctr Division file (#40.8)
; Name = Division name
; 0 - Error/bad input
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) 0
;Declare variables
N NODE,PTRDIV,DIVISION
;Get zero node of encounter
S NODE=$$EZN4XMIT(XMITPTR)
Q:(NODE="") 0
;Get pointer to division
S PTRDIV=+$P(NODE,"^",11)
Q:('PTRDIV) 0
;Get division name
S DIVISION=$P($G(^DG(40.8,PTRDIV,0)),"^",1)
Q:(DIVISION="") 0
;Done
Q PTRDIV_"^"_DIVISION
;
VID4XMIT(XMITPTR) ;Return Visit ID of encounter associated to entry in
; Transmitted Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : Unique Visit ID
; Null ("") - Error/bad input
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) ""
;Declare variables
N NODE,VSITID
;Get zero node of encounter
S NODE=$$EZN4XMIT(XMITPTR)
Q:(NODE="") ""
;Get Unique Visit ID
S VSITID=$P(NODE,"^",20)
;Done
Q VSITID
;
LATE(HISTPTR) ;Determine if entry in ACRP Transmission History file (#409.77)
; was transmitted after NPCD was closed for workload credit
;
;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
;Output : Int ^ Ext - Whether xmit was late for workload credit
; 0 ^ NO - Transmission occurred before close-out
; 1 ^ YES - Transmission occurred after close-out
; -1 ^ ERROR - Unable to calculate / bad input
;Notes : Determination is based on current workload close-out dates,
; which may have changed since date of transmission
;
;Check input
S HISTPTR=+$G(HISTPTR)
Q:('$D(^SD(409.77,HISTPTR,0))) "-1^ERROR"
;Declare variables
N NODE,ENCDATE,XMITDATE,CREDIT
;Get zero node of entry
S NODE=$G(^SD(409.77,HISTPTR,0))
;Get date/time of encounter
S ENCDATE=+$P(NODE,"^",2)
;No encounter date/time (error)
Q:('ENCDATE) "-1^ERROR"
;Get node with xmit info
S NODE=$G(^SD(409.77,HISTPTR,1))
;Get date/time of transmission
S XMITDATE=+NODE
;No xmit date/time (error)
Q:('XMITDATE) "-1^ERROR"
;Determine if encounter was transmitted before close-out
S CREDIT=$$OKTOXMIT^SCDXFU04(ENCDATE,XMITDATE)
;only CREDIT<2 and '<0 indicates acceptance for monthly credit ; SD*5.3*247
;S CREDIT=+$P(CREDIT,"^",2) ;SD*5.3*247
;Error
Q:(CREDIT=-1) "-1^ERROR"
;Not late - transmitted before close-out
Q:(CREDIT<2) "0^NO"
;Late - transmitted after close-out
Q "1^YES"
;
XMIT4DEL(XMITPTR) ;Return whether or not an entry in the Transmitted
; Outpatient Encounter file (#409.73) is for a deleted encounter
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : 0 ^ NO - Entry is not for a deleted encounter
; -1 ^ ERROR - Unable to determine / bad input
; Ptr ^ YES - Entry is for a deleted encounter
; Ptr = Pointer to entry in Deleted Outpatient
; Encounter file (#409.74)
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) "-1^ERROR"
;Declare variables
N NODE,DELPTR
;Grab zero node
S NODE=$G(^SD(409.73,XMITPTR,0))
;Get pointer to Deleted Outpatient Encounter file (#409.74)
S DELPTR=+$P(NODE,"^",3)
;No pointer found - entry points to Outpatient Encounter file (#409.68)
Q:('DELPTR) "0^NO"
;Points to deleted encounter
Q DELPTR_"^YES"
;
HIST4DEL(HISTPTR) ;Return whether or not an entry in the ACRP Transmission
; History file (#409.77) is for a deleted encounter
;
;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
;Output : 0 ^ NO - Entry is not for a deleted encounter
; -1 ^ ERROR - Unable to determine / bad input
; Ptr ^ YES - Entry is for a deleted encounter
; Ptr = Pointer to entry in Deleted Outpatient
; Encounter file (#409.74)
;
;Check input
S HISTPTR=+$G(HISTPTR)
Q:('$D(^SD(409.77,HISTPTR,0))) "-1^ERROR"
;Declare variables
N XMITPTR
;Get pointer to Transmitted Outpatient Encounter file (#409.73)
S XMITPTR=+$G(^SD(409.77,HISTPTR,0))
;Return whether or not it's for a deleted encounter
Q $$XMIT4DEL(XMITPTR)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXFU11 7286 printed Dec 13, 2024@02:39:12 Page 2
SCDXFU11 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;02-JUL-97 ; 1/10/02 4:33pm
+1 ;;5.3;Scheduling;**128,247**;AUG 13, 1993
+2 ;
EZN4XMIT(XMITPTR) ;Return zero node of encounter associated to entry
+1 ; in Transmitted Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : Zero node of associated encounter
+6 ; Null ("") - Error/bad input
+7 ;
+8 ;Check input
+9 SET XMITPTR=+$GET(XMITPTR)
+10 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT ""
+11 ;Declare variables
+12 NEW NODE,ENCPTR,DELPTR
+13 ;Determine if entry in xmit file is for a deleted or existing encounter
+14 SET NODE=$GET(^SD(409.73,XMITPTR,0))
+15 SET ENCPTR=+$PIECE(NODE,"^",2)
+16 SET DELPTR=+$PIECE(NODE,"^",3)
+17 ;Get zero node
+18 SET NODE=""
+19 ;Existing encounter
+20 IF (ENCPTR)
Begin DoDot:1
+21 ;Grab zero node of Outpatient Encounter file (#409.68)
+22 SET NODE=$GET(^SCE(ENCPTR,0))
End DoDot:1
+23 ;Deleted encounter
+24 IF (DELPTR)
Begin DoDot:1
+25 ;Original zero node in Deleted Outpatient Encounter file (#409.74)
+26 SET NODE=$GET(^SD(409.74,DELPTR,1))
End DoDot:1
+27 ;Done
+28 QUIT NODE
+29 ;
EDT4XMIT(XMITPTR) ;Return date/time of encounter associated to entry
+1 ; in Transmitted Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : FM ^ Ext - Date/time of associated encounter
+6 ; FM = Date/time in FileMan format
+7 ; Ext = Date/time in external format
+8 ; (MMM DD, YYYY@hh:mm:ss)
+9 ; 0 - Error/bad input
+10 ;
+11 ;Check input
+12 SET XMITPTR=+$GET(XMITPTR)
+13 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT 0
+14 ;Declare variables
+15 NEW NODE,FMDT,EXTDT
+16 ;Get zero node of encounter
+17 SET NODE=$$EZN4XMIT(XMITPTR)
+18 if (NODE="")
QUIT 0
+19 ;Get date/time of encounter
+20 SET FMDT=+NODE
+21 if ('FMDT)
QUIT 0
+22 ;Convert to external format
+23 SET EXTDT=$$FMTE^XLFDT(FMDT)
+24 ;Done
+25 QUIT FMDT_"^"_EXTDT
+26 ;
LOC4XMIT(XMITPTR) ;Return clinic associated to entry in Transmitted
+1 ; Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : Ptr ^ Name - Clinic associated to entry
+6 ; Ptr = Pointer to Hospital Location file (#44)
+7 ; Name = Name of clinic
+8 ; 0 - Error/bad input
+9 ;
+10 ;Check input
+11 SET XMITPTR=+$GET(XMITPTR)
+12 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT 0
+13 ;Declare variables
+14 NEW NODE,PTRLOC,CLINIC
+15 ;Get zero node of encounter
+16 SET NODE=$$EZN4XMIT(XMITPTR)
+17 if (NODE="")
QUIT 0
+18 ;Get pointer to location
+19 SET PTRLOC=+$PIECE(NODE,"^",4)
+20 if ('PTRLOC)
QUIT 0
+21 ;Get clinic name
+22 SET CLINIC=$PIECE($GET(^SC(PTRLOC,0)),"^",1)
+23 if (CLINIC="")
QUIT 0
+24 ;Done
+25 QUIT PTRLOC_"^"_CLINIC
+26 ;
DIV4XMIT(XMITPTR) ;Return division associated to entry in Transmitted
+1 ; Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : Ptr ^ Name - Division associated to entry
+6 ; Ptr = Pointer to Medical Ctr Division file (#40.8)
+7 ; Name = Division name
+8 ; 0 - Error/bad input
+9 ;
+10 ;Check input
+11 SET XMITPTR=+$GET(XMITPTR)
+12 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT 0
+13 ;Declare variables
+14 NEW NODE,PTRDIV,DIVISION
+15 ;Get zero node of encounter
+16 SET NODE=$$EZN4XMIT(XMITPTR)
+17 if (NODE="")
QUIT 0
+18 ;Get pointer to division
+19 SET PTRDIV=+$PIECE(NODE,"^",11)
+20 if ('PTRDIV)
QUIT 0
+21 ;Get division name
+22 SET DIVISION=$PIECE($GET(^DG(40.8,PTRDIV,0)),"^",1)
+23 if (DIVISION="")
QUIT 0
+24 ;Done
+25 QUIT PTRDIV_"^"_DIVISION
+26 ;
VID4XMIT(XMITPTR) ;Return Visit ID of encounter associated to entry in
+1 ; Transmitted Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : Unique Visit ID
+6 ; Null ("") - Error/bad input
+7 ;
+8 ;Check input
+9 SET XMITPTR=+$GET(XMITPTR)
+10 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT ""
+11 ;Declare variables
+12 NEW NODE,VSITID
+13 ;Get zero node of encounter
+14 SET NODE=$$EZN4XMIT(XMITPTR)
+15 if (NODE="")
QUIT ""
+16 ;Get Unique Visit ID
+17 SET VSITID=$PIECE(NODE,"^",20)
+18 ;Done
+19 QUIT VSITID
+20 ;
LATE(HISTPTR) ;Determine if entry in ACRP Transmission History file (#409.77)
+1 ; was transmitted after NPCD was closed for workload credit
+2 ;
+3 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
+4 ;Output : Int ^ Ext - Whether xmit was late for workload credit
+5 ; 0 ^ NO - Transmission occurred before close-out
+6 ; 1 ^ YES - Transmission occurred after close-out
+7 ; -1 ^ ERROR - Unable to calculate / bad input
+8 ;Notes : Determination is based on current workload close-out dates,
+9 ; which may have changed since date of transmission
+10 ;
+11 ;Check input
+12 SET HISTPTR=+$GET(HISTPTR)
+13 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT "-1^ERROR"
+14 ;Declare variables
+15 NEW NODE,ENCDATE,XMITDATE,CREDIT
+16 ;Get zero node of entry
+17 SET NODE=$GET(^SD(409.77,HISTPTR,0))
+18 ;Get date/time of encounter
+19 SET ENCDATE=+$PIECE(NODE,"^",2)
+20 ;No encounter date/time (error)
+21 if ('ENCDATE)
QUIT "-1^ERROR"
+22 ;Get node with xmit info
+23 SET NODE=$GET(^SD(409.77,HISTPTR,1))
+24 ;Get date/time of transmission
+25 SET XMITDATE=+NODE
+26 ;No xmit date/time (error)
+27 if ('XMITDATE)
QUIT "-1^ERROR"
+28 ;Determine if encounter was transmitted before close-out
+29 SET CREDIT=$$OKTOXMIT^SCDXFU04(ENCDATE,XMITDATE)
+30 ;only CREDIT<2 and '<0 indicates acceptance for monthly credit ; SD*5.3*247
+31 ;S CREDIT=+$P(CREDIT,"^",2) ;SD*5.3*247
+32 ;Error
+33 if (CREDIT=-1)
QUIT "-1^ERROR"
+34 ;Not late - transmitted before close-out
+35 if (CREDIT<2)
QUIT "0^NO"
+36 ;Late - transmitted after close-out
+37 QUIT "1^YES"
+38 ;
XMIT4DEL(XMITPTR) ;Return whether or not an entry in the Transmitted
+1 ; Outpatient Encounter file (#409.73) is for a deleted encounter
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : 0 ^ NO - Entry is not for a deleted encounter
+6 ; -1 ^ ERROR - Unable to determine / bad input
+7 ; Ptr ^ YES - Entry is for a deleted encounter
+8 ; Ptr = Pointer to entry in Deleted Outpatient
+9 ; Encounter file (#409.74)
+10 ;
+11 ;Check input
+12 SET XMITPTR=+$GET(XMITPTR)
+13 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT "-1^ERROR"
+14 ;Declare variables
+15 NEW NODE,DELPTR
+16 ;Grab zero node
+17 SET NODE=$GET(^SD(409.73,XMITPTR,0))
+18 ;Get pointer to Deleted Outpatient Encounter file (#409.74)
+19 SET DELPTR=+$PIECE(NODE,"^",3)
+20 ;No pointer found - entry points to Outpatient Encounter file (#409.68)
+21 if ('DELPTR)
QUIT "0^NO"
+22 ;Points to deleted encounter
+23 QUIT DELPTR_"^YES"
+24 ;
HIST4DEL(HISTPTR) ;Return whether or not an entry in the ACRP Transmission
+1 ; History file (#409.77) is for a deleted encounter
+2 ;
+3 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
+4 ;Output : 0 ^ NO - Entry is not for a deleted encounter
+5 ; -1 ^ ERROR - Unable to determine / bad input
+6 ; Ptr ^ YES - Entry is for a deleted encounter
+7 ; Ptr = Pointer to entry in Deleted Outpatient
+8 ; Encounter file (#409.74)
+9 ;
+10 ;Check input
+11 SET HISTPTR=+$GET(HISTPTR)
+12 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT "-1^ERROR"
+13 ;Declare variables
+14 NEW XMITPTR
+15 ;Get pointer to Transmitted Outpatient Encounter file (#409.73)
+16 SET XMITPTR=+$GET(^SD(409.77,HISTPTR,0))
+17 ;Return whether or not it's for a deleted encounter
+18 QUIT $$XMIT4DEL(XMITPTR)