[613] | 1 | SCDXFU01 ;ALB/JRP - AMB CARE FILE UTILITIES;01-MAY-1996 ; 1/14/02 2:45pm
|
---|
| 2 | ;;5.3;Scheduling;**44,64,97,121,247**;AUG 13, 1993
|
---|
| 3 | ;
|
---|
| 4 | CRTXMIT(ENCPTR,DELPTR,EVNTDATE) ;Create entry in TRANSMITTED OUTPATIENT
|
---|
| 5 | ; ENCOUNTER file (#409.73)
|
---|
| 6 | ;
|
---|
| 7 | ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
|
---|
| 8 | ; file (#409.68)
|
---|
| 9 | ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
|
---|
| 10 | ; file (#409.74)
|
---|
| 11 | ; EVNTDATE - Date/time the [DELETED] OUTPATIENT ENCOUNTER
|
---|
| 12 | ; occurred in FileMan format (Defaults to NOW)
|
---|
| 13 | ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
|
---|
| 14 | ; ENCOUNTER file (#409.73)
|
---|
| 15 | ; -1^Error - Unable to create entry / bad input
|
---|
| 16 | ;Note : When an encounter is deleted from the OUTPATIENT ENCOUNTER
|
---|
| 17 | ; file and an entry for the encounter is created in the
|
---|
| 18 | ; DELETED OUTPATIENT ENCOUNTER file, the ENCPTR and DELPTR
|
---|
| 19 | ; parameters should both be used. This allows an existing
|
---|
| 20 | ; entry that points to the OUTPATIENT ENCOUNTER file (ENCPTR)
|
---|
| 21 | ; to be repointed to the related entry entry in the DELETED
|
---|
| 22 | ; OUTPATIENT ENCOUNTER file (DELPTR). If an existing entry
|
---|
| 23 | ; for the OUTPATIENT ENCOUNTER is not found (or ENCPTR is not
|
---|
| 24 | ; passed/valid), a new entry will be created that points to
|
---|
| 25 | ; the DELETED OUTPATIENT ENCOUNTER.
|
---|
| 26 | ;Note : A value for DELPTR should not be passed when creating an
|
---|
| 27 | ; entry for an OUTPATIENT ENCOUNTER. A value for ENCPTR does
|
---|
| 28 | ; not have to be passed when creating an entry for a DELETED
|
---|
| 29 | ; OUTPATIENT ENCOUNTER, but is recommended.
|
---|
| 30 | ;Note : If an entry for the [DELETED] OUTPATIENT ENCOUNTER already
|
---|
| 31 | ; exists, a new entry will not be created and a pointer to
|
---|
| 32 | ; the existing entry will be returned.
|
---|
| 33 | ;
|
---|
| 34 | ;Check input
|
---|
| 35 | S ENCPTR=+$G(ENCPTR)
|
---|
| 36 | S DELPTR=+$G(DELPTR)
|
---|
| 37 | Q:(('ENCPTR)&('DELPTR)) "-1^Did not pass pointer to encounter"
|
---|
| 38 | Q:(('$D(^SCE(ENCPTR)))&('$D(^SD(409.74,DELPTR)))) "-1^Did not pass valid pointer to encounter"
|
---|
| 39 | S EVNTDATE=+$G(EVNTDATE)
|
---|
| 40 | S:('EVNTDATE) EVNTDATE="NOW"
|
---|
| 41 | ;Declare variables
|
---|
| 42 | N ADDENC,XMITPTR,DIE,DA,DR,DIDEL,DIC,DA,DINUM,DLAYGO,X,Y
|
---|
| 43 | ;do not recreate entries for encounters prior to 10/1/96
|
---|
| 44 | Q:$$ENCDT(ENCPTR,DELPTR)<2961001 "-1^Encounter Date is prior to 10/1/96"
|
---|
| 45 | ;Adding new Outpatient Encounter
|
---|
| 46 | S ADDENC=1
|
---|
| 47 | ;Adding new Deleted Outpatient Encounter
|
---|
| 48 | S:(DELPTR) ADDENC=0
|
---|
| 49 | ;Find existing Outpatient Encounter
|
---|
| 50 | S XMITPTR=+$O(^SD(409.73,"AENC",ENCPTR,""))
|
---|
| 51 | ;Adding an existing Outpatient Encounter - done
|
---|
| 52 | Q:((ADDENC)&(XMITPTR)) XMITPTR
|
---|
| 53 | ;Converting an Outpatient Encounter to a Deleted Outpatient Encounter
|
---|
| 54 | ; Swap pointer & store event info - done
|
---|
| 55 | I (('ADDENC)&(XMITPTR)) D Q XMITPTR
|
---|
| 56 | .S DIE="^SD(409.73,"
|
---|
| 57 | .S DA=XMITPTR
|
---|
| 58 | .S DR=".02///@;.03////^S X=DELPTR"
|
---|
| 59 | .D ^DIE
|
---|
| 60 | .D STREEVNT(XMITPTR,3,EVNTDATE,+$G(DUZ))
|
---|
| 61 | ;Adding a new [Deleted] Outpatient Encounter - create entry
|
---|
| 62 | ; using auto-numbering capabilities of file
|
---|
| 63 | S DIC="^SD(409.73,"
|
---|
| 64 | S DIC(0)="L"
|
---|
| 65 | S X="+"
|
---|
| 66 | S DLAYGO=409.73
|
---|
| 67 | ;Adding a new Outpatient Encounter
|
---|
| 68 | S DIC("DR")=".02////^S X=ENCPTR"
|
---|
| 69 | ;Adding a new Deleted Outpatient Encounter
|
---|
| 70 | S:('ADDENC) DIC("DR")=".03////^S X=DELPTR"
|
---|
| 71 | ;Create entry
|
---|
| 72 | D ^DIC
|
---|
| 73 | ;Get pointer to entry
|
---|
| 74 | S XMITPTR=+Y
|
---|
| 75 | ;Error creating entry
|
---|
| 76 | Q:(XMITPTR<0) "-1^Unable to create entry in Transmitted Outpatient Encounter file"
|
---|
| 77 | ;Store event info
|
---|
| 78 | D STREEVNT(XMITPTR,$S(('ADDENC):3,1:1),EVNTDATE,+$G(DUZ))
|
---|
| 79 | ;Done
|
---|
| 80 | Q XMITPTR
|
---|
| 81 | ;
|
---|
| 82 | FINDXMIT(ENCPTR,DELPTR) ;Find entry in TRANSMITTED OUTPATIENT ENCOUNTER
|
---|
| 83 | ; file (#409.73)
|
---|
| 84 | ;
|
---|
| 85 | ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
|
---|
| 86 | ; file (#409.68)
|
---|
| 87 | ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
|
---|
| 88 | ; file (#409.74)
|
---|
| 89 | ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
|
---|
| 90 | ; ENCOUNTER file (#409.73)
|
---|
| 91 | ; 0 - Entry in TRANSMITTED OUTPATIENT ENCOUNTER file for the
|
---|
| 92 | ; [DELETED] OUTPATIENT ENCOUNTER does not exist
|
---|
| 93 | ;Note : A value for DELPTR should not be passed if finding an entry
|
---|
| 94 | ; for an OUTPATIENT ENCOUNTER. A value for ENCPTR should not
|
---|
| 95 | ; be passed if finding an entry for a DELETED OUTPATIENT
|
---|
| 96 | ; ENCOUNTER. If values for both parameters are passed, the
|
---|
| 97 | ; pointer to the OUTPATIENT ENCOUNTER will be used.
|
---|
| 98 | ;
|
---|
| 99 | ;Check input
|
---|
| 100 | S ENCPTR=+$G(ENCPTR)
|
---|
| 101 | S DELPTR=+$G(DELPTR)
|
---|
| 102 | Q:(('ENCPTR)&('DELPTR)) 0
|
---|
| 103 | ;Find entry for Outpatient Encounter - done
|
---|
| 104 | Q:(ENCPTR) +$O(^SD(409.73,"AENC",ENCPTR,""))
|
---|
| 105 | ;Find entry for Deleted Outpatient Encounter - done
|
---|
| 106 | Q +$O(^SD(409.73,"ADEL",DELPTR,""))
|
---|
| 107 | ;
|
---|
| 108 | STREEVNT(XMITPTR,XMITEVNT,EVNTDATE,EVNTDUZ) ;Store event information for
|
---|
| 109 | ; entry in TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
|
---|
| 110 | ;
|
---|
| 111 | ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
|
---|
| 112 | ; ENCOUNTER file (#409.73)
|
---|
| 113 | ; XMITEVNT - Flag denoting event causing transmission
|
---|
| 114 | ; 0 = Retransmit (DEFAULT)
|
---|
| 115 | ; 1 = Addition of entry in OUTPATIENT ENCOUNTER file
|
---|
| 116 | ; 2 = Editing of entry in OUTPATIENT ENCOUNTER file
|
---|
| 117 | ; 3 = Deletion of entry in OUTPATIENT ENCOUNTER file
|
---|
| 118 | ; (Addition of entry in DELETED OUTPATIENT
|
---|
| 119 | ; ENCOUNTER file)
|
---|
| 120 | ; EVNTDATE - Date/time event causing transmission occurred
|
---|
| 121 | ; in FileMan format (defaults to NOW)
|
---|
| 122 | ; EVNTDUZ - Pointer to entry in NEW PERSON file (#2) that
|
---|
| 123 | ; caused the event to occur (defaults to current DUZ)
|
---|
| 124 | ;Output : None
|
---|
| 125 | ;Notes : If EVNTDUZ and/or the current DUZ are not valid, POSTMASTER
|
---|
| 126 | ; (.5) will be used
|
---|
| 127 | ;
|
---|
| 128 | ;Check input
|
---|
| 129 | S XMITPTR=+$G(XMITPTR)
|
---|
| 130 | Q:('XMITPTR)
|
---|
| 131 | Q:('$D(^SD(409.73,XMITPTR)))
|
---|
| 132 | S XMITEVNT=+$G(XMITEVNT)
|
---|
| 133 | S:((XMITEVNT<0)!(XMITEVNT>3)) XMITEVNT=0
|
---|
| 134 | S EVNTDATE=+$G(EVNTDATE)
|
---|
| 135 | S:('EVNTDATE) EVNTDATE="NOW"
|
---|
| 136 | S EVNTDUZ=+$G(EVNTDUZ,$G(DUZ))
|
---|
| 137 | S:('$D(^VA(200,EVNTDUZ,0))) EVNTDUZ=.5
|
---|
| 138 | ;Declare variables
|
---|
| 139 | N DIE,DA,DR,DIDEL,X,Y,DIC
|
---|
| 140 | ;Store event data
|
---|
| 141 | S DIE="^SD(409.73,"
|
---|
| 142 | S DA=XMITPTR
|
---|
| 143 | S DR=".05////^S X=XMITEVNT;.06///^S X=EVNTDATE;.07////^S X=EVNTDUZ"
|
---|
| 144 | D ^DIE
|
---|
| 145 | ;Done
|
---|
| 146 | Q
|
---|
| 147 | ;
|
---|
| 148 | XMITFLAG(XMITPTR,RESET) ;Set/reset transmission flag for entry in
|
---|
| 149 | ; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
|
---|
| 150 | ;
|
---|
| 151 | ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
|
---|
| 152 | ; ENCOUNTER file (#409.73)
|
---|
| 153 | ; RESET - Denotes if transmission field should be turned
|
---|
| 154 | ; on or off
|
---|
| 155 | ; 0 = Set TRANSMISSION REQUIRED field (#.04) equal
|
---|
| 156 | ; to 'YES' (DEFAULT)
|
---|
| 157 | ; 1 = Set TRANSMISSION REQUIRED field (#.04) equal
|
---|
| 158 | ; to 'NO'
|
---|
| 159 | ;Output : None
|
---|
| 160 | ;Notes : Setting the TRANSMISSION REQUIRED field to 'YES' flags
|
---|
| 161 | ; the entry for transmission
|
---|
| 162 | ;
|
---|
| 163 | ;Check input
|
---|
| 164 | S XMITPTR=+$G(XMITPTR)
|
---|
| 165 | Q:('$D(^SD(409.73,XMITPTR)))
|
---|
| 166 | S RESET=+$G(RESET)
|
---|
| 167 | ;Declare variables
|
---|
| 168 | N DIE,DA,DR,DIDEL,X,Y,DIC
|
---|
| 169 | ;Store new value for transmission flag
|
---|
| 170 | S DIE="^SD(409.73,"
|
---|
| 171 | S DA=XMITPTR
|
---|
| 172 | ;Set transmission flag
|
---|
| 173 | S DR=".04///YES"
|
---|
| 174 | ;Reset transmission flag
|
---|
| 175 | S:(RESET) DR=".04///NO"
|
---|
| 176 | D ^DIE
|
---|
| 177 | ;If turning flag on, check for late activity & send bulletin
|
---|
| 178 | I 'RESET I +$$XMIT4DBC^SCDXFU04(XMITPTR)>0 D LATEACT^SCDXMSG2(XMITPTR) ;SD*5.3*247
|
---|
| 179 | ;Done
|
---|
| 180 | Q
|
---|
| 181 | ;
|
---|
| 182 | ENCDT(ENCPTR,DELPTR) ;returns the date of the encounter
|
---|
| 183 | ; Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
|
---|
| 184 | ; file (#409.68)
|
---|
| 185 | ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
|
---|
| 186 | ; file (#409.74)
|
---|
| 187 | ; Returned: Date of encounter (#.01 of #409.68)
|
---|
| 188 | Q $S($D(^SCE(+$G(ENCPTR),0)):+^(0),$D(^SD(409.74,+$G(DELPTR),0)):^(0),1:"-1^No Pointer")
|
---|