[613] | 1 | SCDXFU11 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;02-JUL-97 ; 1/10/02 4:33pm
|
---|
| 2 | ;;5.3;Scheduling;**128,247**;AUG 13, 1993
|
---|
| 3 | ;
|
---|
| 4 | EZN4XMIT(XMITPTR) ;Return zero node of encounter associated to entry
|
---|
| 5 | ; in Transmitted Outpatient Encounter file (#409.73)
|
---|
| 6 | ;
|
---|
| 7 | ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
|
---|
| 8 | ; Encounter file
|
---|
| 9 | ;Output : Zero node of associated encounter
|
---|
| 10 | ; Null ("") - Error/bad input
|
---|
| 11 | ;
|
---|
| 12 | ;Check input
|
---|
| 13 | S XMITPTR=+$G(XMITPTR)
|
---|
| 14 | Q:('$D(^SD(409.73,XMITPTR,0))) ""
|
---|
| 15 | ;Declare variables
|
---|
| 16 | N NODE,ENCPTR,DELPTR
|
---|
| 17 | ;Determine if entry in xmit file is for a deleted or existing encounter
|
---|
| 18 | S NODE=$G(^SD(409.73,XMITPTR,0))
|
---|
| 19 | S ENCPTR=+$P(NODE,"^",2)
|
---|
| 20 | S DELPTR=+$P(NODE,"^",3)
|
---|
| 21 | ;Get zero node
|
---|
| 22 | S NODE=""
|
---|
| 23 | ;Existing encounter
|
---|
| 24 | I (ENCPTR) D
|
---|
| 25 | .;Grab zero node of Outpatient Encounter file (#409.68)
|
---|
| 26 | .S NODE=$G(^SCE(ENCPTR,0))
|
---|
| 27 | ;Deleted encounter
|
---|
| 28 | I (DELPTR) D
|
---|
| 29 | .;Original zero node in Deleted Outpatient Encounter file (#409.74)
|
---|
| 30 | .S NODE=$G(^SD(409.74,DELPTR,1))
|
---|
| 31 | ;Done
|
---|
| 32 | Q NODE
|
---|
| 33 | ;
|
---|
| 34 | EDT4XMIT(XMITPTR) ;Return date/time of encounter associated to entry
|
---|
| 35 | ; in Transmitted Outpatient Encounter file (#409.73)
|
---|
| 36 | ;
|
---|
| 37 | ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
|
---|
| 38 | ; Encounter file
|
---|
| 39 | ;Output : FM ^ Ext - Date/time of associated encounter
|
---|
| 40 | ; FM = Date/time in FileMan format
|
---|
| 41 | ; Ext = Date/time in external format
|
---|
| 42 | ; (MMM DD, YYYY@hh:mm:ss)
|
---|
| 43 | ; 0 - Error/bad input
|
---|
| 44 | ;
|
---|
| 45 | ;Check input
|
---|
| 46 | S XMITPTR=+$G(XMITPTR)
|
---|
| 47 | Q:('$D(^SD(409.73,XMITPTR,0))) 0
|
---|
| 48 | ;Declare variables
|
---|
| 49 | N NODE,FMDT,EXTDT
|
---|
| 50 | ;Get zero node of encounter
|
---|
| 51 | S NODE=$$EZN4XMIT(XMITPTR)
|
---|
| 52 | Q:(NODE="") 0
|
---|
| 53 | ;Get date/time of encounter
|
---|
| 54 | S FMDT=+NODE
|
---|
| 55 | Q:('FMDT) 0
|
---|
| 56 | ;Convert to external format
|
---|
| 57 | S EXTDT=$$FMTE^XLFDT(FMDT)
|
---|
| 58 | ;Done
|
---|
| 59 | Q FMDT_"^"_EXTDT
|
---|
| 60 | ;
|
---|
| 61 | LOC4XMIT(XMITPTR) ;Return clinic associated to entry in Transmitted
|
---|
| 62 | ; Outpatient Encounter file (#409.73)
|
---|
| 63 | ;
|
---|
| 64 | ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
|
---|
| 65 | ; Encounter file
|
---|
| 66 | ;Output : Ptr ^ Name - Clinic associated to entry
|
---|
| 67 | ; Ptr = Pointer to Hospital Location file (#44)
|
---|
| 68 | ; Name = Name of clinic
|
---|
| 69 | ; 0 - Error/bad input
|
---|
| 70 | ;
|
---|
| 71 | ;Check input
|
---|
| 72 | S XMITPTR=+$G(XMITPTR)
|
---|
| 73 | Q:('$D(^SD(409.73,XMITPTR,0))) 0
|
---|
| 74 | ;Declare variables
|
---|
| 75 | N NODE,PTRLOC,CLINIC
|
---|
| 76 | ;Get zero node of encounter
|
---|
| 77 | S NODE=$$EZN4XMIT(XMITPTR)
|
---|
| 78 | Q:(NODE="") 0
|
---|
| 79 | ;Get pointer to location
|
---|
| 80 | S PTRLOC=+$P(NODE,"^",4)
|
---|
| 81 | Q:('PTRLOC) 0
|
---|
| 82 | ;Get clinic name
|
---|
| 83 | S CLINIC=$P($G(^SC(PTRLOC,0)),"^",1)
|
---|
| 84 | Q:(CLINIC="") 0
|
---|
| 85 | ;Done
|
---|
| 86 | Q PTRLOC_"^"_CLINIC
|
---|
| 87 | ;
|
---|
| 88 | DIV4XMIT(XMITPTR) ;Return division associated to entry in Transmitted
|
---|
| 89 | ; Outpatient Encounter file (#409.73)
|
---|
| 90 | ;
|
---|
| 91 | ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
|
---|
| 92 | ; Encounter file
|
---|
| 93 | ;Output : Ptr ^ Name - Division associated to entry
|
---|
| 94 | ; Ptr = Pointer to Medical Ctr Division file (#40.8)
|
---|
| 95 | ; Name = Division name
|
---|
| 96 | ; 0 - Error/bad input
|
---|
| 97 | ;
|
---|
| 98 | ;Check input
|
---|
| 99 | S XMITPTR=+$G(XMITPTR)
|
---|
| 100 | Q:('$D(^SD(409.73,XMITPTR,0))) 0
|
---|
| 101 | ;Declare variables
|
---|
| 102 | N NODE,PTRDIV,DIVISION
|
---|
| 103 | ;Get zero node of encounter
|
---|
| 104 | S NODE=$$EZN4XMIT(XMITPTR)
|
---|
| 105 | Q:(NODE="") 0
|
---|
| 106 | ;Get pointer to division
|
---|
| 107 | S PTRDIV=+$P(NODE,"^",11)
|
---|
| 108 | Q:('PTRDIV) 0
|
---|
| 109 | ;Get division name
|
---|
| 110 | S DIVISION=$P($G(^DG(40.8,PTRDIV,0)),"^",1)
|
---|
| 111 | Q:(DIVISION="") 0
|
---|
| 112 | ;Done
|
---|
| 113 | Q PTRDIV_"^"_DIVISION
|
---|
| 114 | ;
|
---|
| 115 | VID4XMIT(XMITPTR) ;Return Visit ID of encounter associated to entry in
|
---|
| 116 | ; Transmitted Outpatient Encounter file (#409.73)
|
---|
| 117 | ;
|
---|
| 118 | ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
|
---|
| 119 | ; Encounter file
|
---|
| 120 | ;Output : Unique Visit ID
|
---|
| 121 | ; Null ("") - Error/bad input
|
---|
| 122 | ;
|
---|
| 123 | ;Check input
|
---|
| 124 | S XMITPTR=+$G(XMITPTR)
|
---|
| 125 | Q:('$D(^SD(409.73,XMITPTR,0))) ""
|
---|
| 126 | ;Declare variables
|
---|
| 127 | N NODE,VSITID
|
---|
| 128 | ;Get zero node of encounter
|
---|
| 129 | S NODE=$$EZN4XMIT(XMITPTR)
|
---|
| 130 | Q:(NODE="") ""
|
---|
| 131 | ;Get Unique Visit ID
|
---|
| 132 | S VSITID=$P(NODE,"^",20)
|
---|
| 133 | ;Done
|
---|
| 134 | Q VSITID
|
---|
| 135 | ;
|
---|
| 136 | LATE(HISTPTR) ;Determine if entry in ACRP Transmission History file (#409.77)
|
---|
| 137 | ; was transmitted after NPCD was closed for workload credit
|
---|
| 138 | ;
|
---|
| 139 | ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
|
---|
| 140 | ;Output : Int ^ Ext - Whether xmit was late for workload credit
|
---|
| 141 | ; 0 ^ NO - Transmission occurred before close-out
|
---|
| 142 | ; 1 ^ YES - Transmission occurred after close-out
|
---|
| 143 | ; -1 ^ ERROR - Unable to calculate / bad input
|
---|
| 144 | ;Notes : Determination is based on current workload close-out dates,
|
---|
| 145 | ; which may have changed since date of transmission
|
---|
| 146 | ;
|
---|
| 147 | ;Check input
|
---|
| 148 | S HISTPTR=+$G(HISTPTR)
|
---|
| 149 | Q:('$D(^SD(409.77,HISTPTR,0))) "-1^ERROR"
|
---|
| 150 | ;Declare variables
|
---|
| 151 | N NODE,ENCDATE,XMITDATE,CREDIT
|
---|
| 152 | ;Get zero node of entry
|
---|
| 153 | S NODE=$G(^SD(409.77,HISTPTR,0))
|
---|
| 154 | ;Get date/time of encounter
|
---|
| 155 | S ENCDATE=+$P(NODE,"^",2)
|
---|
| 156 | ;No encounter date/time (error)
|
---|
| 157 | Q:('ENCDATE) "-1^ERROR"
|
---|
| 158 | ;Get node with xmit info
|
---|
| 159 | S NODE=$G(^SD(409.77,HISTPTR,1))
|
---|
| 160 | ;Get date/time of transmission
|
---|
| 161 | S XMITDATE=+NODE
|
---|
| 162 | ;No xmit date/time (error)
|
---|
| 163 | Q:('XMITDATE) "-1^ERROR"
|
---|
| 164 | ;Determine if encounter was transmitted before close-out
|
---|
| 165 | S CREDIT=$$OKTOXMIT^SCDXFU04(ENCDATE,XMITDATE)
|
---|
| 166 | ;only CREDIT<2 and '<0 indicates acceptance for monthly credit ; SD*5.3*247
|
---|
| 167 | ;S CREDIT=+$P(CREDIT,"^",2) ;SD*5.3*247
|
---|
| 168 | ;Error
|
---|
| 169 | Q:(CREDIT=-1) "-1^ERROR"
|
---|
| 170 | ;Not late - transmitted before close-out
|
---|
| 171 | Q:(CREDIT<2) "0^NO"
|
---|
| 172 | ;Late - transmitted after close-out
|
---|
| 173 | Q "1^YES"
|
---|
| 174 | ;
|
---|
| 175 | XMIT4DEL(XMITPTR) ;Return whether or not an entry in the Transmitted
|
---|
| 176 | ; Outpatient Encounter file (#409.73) is for a deleted encounter
|
---|
| 177 | ;
|
---|
| 178 | ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
|
---|
| 179 | ; Encounter file
|
---|
| 180 | ;Output : 0 ^ NO - Entry is not for a deleted encounter
|
---|
| 181 | ; -1 ^ ERROR - Unable to determine / bad input
|
---|
| 182 | ; Ptr ^ YES - Entry is for a deleted encounter
|
---|
| 183 | ; Ptr = Pointer to entry in Deleted Outpatient
|
---|
| 184 | ; Encounter file (#409.74)
|
---|
| 185 | ;
|
---|
| 186 | ;Check input
|
---|
| 187 | S XMITPTR=+$G(XMITPTR)
|
---|
| 188 | Q:('$D(^SD(409.73,XMITPTR,0))) "-1^ERROR"
|
---|
| 189 | ;Declare variables
|
---|
| 190 | N NODE,DELPTR
|
---|
| 191 | ;Grab zero node
|
---|
| 192 | S NODE=$G(^SD(409.73,XMITPTR,0))
|
---|
| 193 | ;Get pointer to Deleted Outpatient Encounter file (#409.74)
|
---|
| 194 | S DELPTR=+$P(NODE,"^",3)
|
---|
| 195 | ;No pointer found - entry points to Outpatient Encounter file (#409.68)
|
---|
| 196 | Q:('DELPTR) "0^NO"
|
---|
| 197 | ;Points to deleted encounter
|
---|
| 198 | Q DELPTR_"^YES"
|
---|
| 199 | ;
|
---|
| 200 | HIST4DEL(HISTPTR) ;Return whether or not an entry in the ACRP Transmission
|
---|
| 201 | ; History file (#409.77) is for a deleted encounter
|
---|
| 202 | ;
|
---|
| 203 | ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
|
---|
| 204 | ;Output : 0 ^ NO - Entry is not for a deleted encounter
|
---|
| 205 | ; -1 ^ ERROR - Unable to determine / bad input
|
---|
| 206 | ; Ptr ^ YES - Entry is for a deleted encounter
|
---|
| 207 | ; Ptr = Pointer to entry in Deleted Outpatient
|
---|
| 208 | ; Encounter file (#409.74)
|
---|
| 209 | ;
|
---|
| 210 | ;Check input
|
---|
| 211 | S HISTPTR=+$G(HISTPTR)
|
---|
| 212 | Q:('$D(^SD(409.77,HISTPTR,0))) "-1^ERROR"
|
---|
| 213 | ;Declare variables
|
---|
| 214 | N XMITPTR
|
---|
| 215 | ;Get pointer to Transmitted Outpatient Encounter file (#409.73)
|
---|
| 216 | S XMITPTR=+$G(^SD(409.77,HISTPTR,0))
|
---|
| 217 | ;Return whether or not it's for a deleted encounter
|
---|
| 218 | Q $$XMIT4DEL(XMITPTR)
|
---|