Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SCDXFU11

SCDXFU11.m

Go to the documentation of this file.
  1. SCDXFU11 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;02-JUL-97 ; 1/10/02 4:33pm
  1. ;;5.3;Scheduling;**128,247,1015**;AUG 13, 1993;Build 21
  1. ;
  1. EZN4XMIT(XMITPTR) ;Return zero node of encounter associated to entry
  1. ; in Transmitted Outpatient Encounter file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
  1. ; Encounter file
  1. ;Output : Zero node of associated encounter
  1. ; Null ("") - Error/bad input
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR,0))) ""
  1. ;Declare variables
  1. N NODE,ENCPTR,DELPTR
  1. ;Determine if entry in xmit file is for a deleted or existing encounter
  1. S NODE=$G(^SD(409.73,XMITPTR,0))
  1. S ENCPTR=+$P(NODE,"^",2)
  1. S DELPTR=+$P(NODE,"^",3)
  1. ;Get zero node
  1. S NODE=""
  1. ;Existing encounter
  1. I (ENCPTR) D
  1. .;Grab zero node of Outpatient Encounter file (#409.68)
  1. .S NODE=$G(^SCE(ENCPTR,0))
  1. ;Deleted encounter
  1. I (DELPTR) D
  1. .;Original zero node in Deleted Outpatient Encounter file (#409.74)
  1. .S NODE=$G(^SD(409.74,DELPTR,1))
  1. ;Done
  1. Q NODE
  1. ;
  1. EDT4XMIT(XMITPTR) ;Return date/time of encounter associated to entry
  1. ; in Transmitted Outpatient Encounter file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
  1. ; Encounter file
  1. ;Output : FM ^ Ext - Date/time of associated encounter
  1. ; FM = Date/time in FileMan format
  1. ; Ext = Date/time in external format
  1. ; (MMM DD, YYYY@hh:mm:ss)
  1. ; 0 - Error/bad input
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR,0))) 0
  1. ;Declare variables
  1. N NODE,FMDT,EXTDT
  1. ;Get zero node of encounter
  1. S NODE=$$EZN4XMIT(XMITPTR)
  1. Q:(NODE="") 0
  1. ;Get date/time of encounter
  1. S FMDT=+NODE
  1. Q:('FMDT) 0
  1. ;Convert to external format
  1. S EXTDT=$$FMTE^XLFDT(FMDT)
  1. ;Done
  1. Q FMDT_"^"_EXTDT
  1. ;
  1. LOC4XMIT(XMITPTR) ;Return clinic associated to entry in Transmitted
  1. ; Outpatient Encounter file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
  1. ; Encounter file
  1. ;Output : Ptr ^ Name - Clinic associated to entry
  1. ; Ptr = Pointer to Hospital Location file (#44)
  1. ; Name = Name of clinic
  1. ; 0 - Error/bad input
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR,0))) 0
  1. ;Declare variables
  1. N NODE,PTRLOC,CLINIC
  1. ;Get zero node of encounter
  1. S NODE=$$EZN4XMIT(XMITPTR)
  1. Q:(NODE="") 0
  1. ;Get pointer to location
  1. S PTRLOC=+$P(NODE,"^",4)
  1. Q:('PTRLOC) 0
  1. ;Get clinic name
  1. S CLINIC=$P($G(^SC(PTRLOC,0)),"^",1)
  1. Q:(CLINIC="") 0
  1. ;Done
  1. Q PTRLOC_"^"_CLINIC
  1. ;
  1. DIV4XMIT(XMITPTR) ;Return division associated to entry in Transmitted
  1. ; Outpatient Encounter file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
  1. ; Encounter file
  1. ;Output : Ptr ^ Name - Division associated to entry
  1. ; Ptr = Pointer to Medical Ctr Division file (#40.8)
  1. ; Name = Division name
  1. ; 0 - Error/bad input
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR,0))) 0
  1. ;Declare variables
  1. N NODE,PTRDIV,DIVISION
  1. ;Get zero node of encounter
  1. S NODE=$$EZN4XMIT(XMITPTR)
  1. Q:(NODE="") 0
  1. ;Get pointer to division
  1. S PTRDIV=+$P(NODE,"^",11)
  1. Q:('PTRDIV) 0
  1. ;Get division name
  1. S DIVISION=$P($G(^DG(40.8,PTRDIV,0)),"^",1)
  1. Q:(DIVISION="") 0
  1. ;Done
  1. Q PTRDIV_"^"_DIVISION
  1. ;
  1. VID4XMIT(XMITPTR) ;Return Visit ID of encounter associated to entry in
  1. ; Transmitted Outpatient Encounter file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
  1. ; Encounter file
  1. ;Output : Unique Visit ID
  1. ; Null ("") - Error/bad input
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR,0))) ""
  1. ;Declare variables
  1. N NODE,VSITID
  1. ;Get zero node of encounter
  1. S NODE=$$EZN4XMIT(XMITPTR)
  1. Q:(NODE="") ""
  1. ;Get Unique Visit ID
  1. S VSITID=$P(NODE,"^",20)
  1. ;Done
  1. Q VSITID
  1. ;
  1. LATE(HISTPTR) ;Determine if entry in ACRP Transmission History file (#409.77)
  1. ; was transmitted after NPCD was closed for workload credit
  1. ;
  1. ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
  1. ;Output : Int ^ Ext - Whether xmit was late for workload credit
  1. ; 0 ^ NO - Transmission occurred before close-out
  1. ; 1 ^ YES - Transmission occurred after close-out
  1. ; -1 ^ ERROR - Unable to calculate / bad input
  1. ;Notes : Determination is based on current workload close-out dates,
  1. ; which may have changed since date of transmission
  1. ;
  1. ;Check input
  1. S HISTPTR=+$G(HISTPTR)
  1. Q:('$D(^SD(409.77,HISTPTR,0))) "-1^ERROR"
  1. ;Declare variables
  1. N NODE,ENCDATE,XMITDATE,CREDIT
  1. ;Get zero node of entry
  1. S NODE=$G(^SD(409.77,HISTPTR,0))
  1. ;Get date/time of encounter
  1. S ENCDATE=+$P(NODE,"^",2)
  1. ;No encounter date/time (error)
  1. Q:('ENCDATE) "-1^ERROR"
  1. ;Get node with xmit info
  1. S NODE=$G(^SD(409.77,HISTPTR,1))
  1. ;Get date/time of transmission
  1. S XMITDATE=+NODE
  1. ;No xmit date/time (error)
  1. Q:('XMITDATE) "-1^ERROR"
  1. ;Determine if encounter was transmitted before close-out
  1. S CREDIT=$$OKTOXMIT^SCDXFU04(ENCDATE,XMITDATE)
  1. ;only CREDIT<2 and '<0 indicates acceptance for monthly credit ; SD*5.3*247
  1. ;S CREDIT=+$P(CREDIT,"^",2) ;SD*5.3*247
  1. ;Error
  1. Q:(CREDIT=-1) "-1^ERROR"
  1. ;Not late - transmitted before close-out
  1. Q:(CREDIT<2) "0^NO"
  1. ;Late - transmitted after close-out
  1. Q "1^YES"
  1. ;
  1. XMIT4DEL(XMITPTR) ;Return whether or not an entry in the Transmitted
  1. ; Outpatient Encounter file (#409.73) is for a deleted encounter
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
  1. ; Encounter file
  1. ;Output : 0 ^ NO - Entry is not for a deleted encounter
  1. ; -1 ^ ERROR - Unable to determine / bad input
  1. ; Ptr ^ YES - Entry is for a deleted encounter
  1. ; Ptr = Pointer to entry in Deleted Outpatient
  1. ; Encounter file (#409.74)
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR,0))) "-1^ERROR"
  1. ;Declare variables
  1. N NODE,DELPTR
  1. ;Grab zero node
  1. S NODE=$G(^SD(409.73,XMITPTR,0))
  1. ;Get pointer to Deleted Outpatient Encounter file (#409.74)
  1. S DELPTR=+$P(NODE,"^",3)
  1. ;No pointer found - entry points to Outpatient Encounter file (#409.68)
  1. Q:('DELPTR) "0^NO"
  1. ;Points to deleted encounter
  1. Q DELPTR_"^YES"
  1. ;
  1. HIST4DEL(HISTPTR) ;Return whether or not an entry in the ACRP Transmission
  1. ; History file (#409.77) is for a deleted encounter
  1. ;
  1. ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
  1. ;Output : 0 ^ NO - Entry is not for a deleted encounter
  1. ; -1 ^ ERROR - Unable to determine / bad input
  1. ; Ptr ^ YES - Entry is for a deleted encounter
  1. ; Ptr = Pointer to entry in Deleted Outpatient
  1. ; Encounter file (#409.74)
  1. ;
  1. ;Check input
  1. S HISTPTR=+$G(HISTPTR)
  1. Q:('$D(^SD(409.77,HISTPTR,0))) "-1^ERROR"
  1. ;Declare variables
  1. N XMITPTR
  1. ;Get pointer to Transmitted Outpatient Encounter file (#409.73)
  1. S XMITPTR=+$G(^SD(409.77,HISTPTR,0))
  1. ;Return whether or not it's for a deleted encounter
  1. Q $$XMIT4DEL(XMITPTR)