- SCDXFU01 ;ALB/JRP - AMB CARE FILE UTILITIES;01-MAY-1996 ; 1/14/02 2:45pm
- ;;5.3;Scheduling;**44,64,97,121,247**;AUG 13, 1993
- ;
- CRTXMIT(ENCPTR,DELPTR,EVNTDATE) ;Create entry in TRANSMITTED OUTPATIENT
- ; ENCOUNTER file (#409.73)
- ;
- ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
- ; file (#409.68)
- ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
- ; file (#409.74)
- ; EVNTDATE - Date/time the [DELETED] OUTPATIENT ENCOUNTER
- ; occurred in FileMan format (Defaults to NOW)
- ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- ; ENCOUNTER file (#409.73)
- ; -1^Error - Unable to create entry / bad input
- ;Note : When an encounter is deleted from the OUTPATIENT ENCOUNTER
- ; file and an entry for the encounter is created in the
- ; DELETED OUTPATIENT ENCOUNTER file, the ENCPTR and DELPTR
- ; parameters should both be used. This allows an existing
- ; entry that points to the OUTPATIENT ENCOUNTER file (ENCPTR)
- ; to be repointed to the related entry entry in the DELETED
- ; OUTPATIENT ENCOUNTER file (DELPTR). If an existing entry
- ; for the OUTPATIENT ENCOUNTER is not found (or ENCPTR is not
- ; passed/valid), a new entry will be created that points to
- ; the DELETED OUTPATIENT ENCOUNTER.
- ;Note : A value for DELPTR should not be passed when creating an
- ; entry for an OUTPATIENT ENCOUNTER. A value for ENCPTR does
- ; not have to be passed when creating an entry for a DELETED
- ; OUTPATIENT ENCOUNTER, but is recommended.
- ;Note : If an entry for the [DELETED] OUTPATIENT ENCOUNTER already
- ; exists, a new entry will not be created and a pointer to
- ; the existing entry will be returned.
- ;
- ;Check input
- S ENCPTR=+$G(ENCPTR)
- S DELPTR=+$G(DELPTR)
- Q:(('ENCPTR)&('DELPTR)) "-1^Did not pass pointer to encounter"
- Q:(('$D(^SCE(ENCPTR)))&('$D(^SD(409.74,DELPTR)))) "-1^Did not pass valid pointer to encounter"
- S EVNTDATE=+$G(EVNTDATE)
- S:('EVNTDATE) EVNTDATE="NOW"
- ;Declare variables
- N ADDENC,XMITPTR,DIE,DA,DR,DIDEL,DIC,DA,DINUM,DLAYGO,X,Y
- ;do not recreate entries for encounters prior to 10/1/96
- Q:$$ENCDT(ENCPTR,DELPTR)<2961001 "-1^Encounter Date is prior to 10/1/96"
- ;Adding new Outpatient Encounter
- S ADDENC=1
- ;Adding new Deleted Outpatient Encounter
- S:(DELPTR) ADDENC=0
- ;Find existing Outpatient Encounter
- S XMITPTR=+$O(^SD(409.73,"AENC",ENCPTR,""))
- ;Adding an existing Outpatient Encounter - done
- Q:((ADDENC)&(XMITPTR)) XMITPTR
- ;Converting an Outpatient Encounter to a Deleted Outpatient Encounter
- ; Swap pointer & store event info - done
- I (('ADDENC)&(XMITPTR)) D Q XMITPTR
- .S DIE="^SD(409.73,"
- .S DA=XMITPTR
- .S DR=".02///@;.03////^S X=DELPTR"
- .D ^DIE
- .D STREEVNT(XMITPTR,3,EVNTDATE,+$G(DUZ))
- ;Adding a new [Deleted] Outpatient Encounter - create entry
- ; using auto-numbering capabilities of file
- S DIC="^SD(409.73,"
- S DIC(0)="L"
- S X="+"
- S DLAYGO=409.73
- ;Adding a new Outpatient Encounter
- S DIC("DR")=".02////^S X=ENCPTR"
- ;Adding a new Deleted Outpatient Encounter
- S:('ADDENC) DIC("DR")=".03////^S X=DELPTR"
- ;Create entry
- D ^DIC
- ;Get pointer to entry
- S XMITPTR=+Y
- ;Error creating entry
- Q:(XMITPTR<0) "-1^Unable to create entry in Transmitted Outpatient Encounter file"
- ;Store event info
- D STREEVNT(XMITPTR,$S(('ADDENC):3,1:1),EVNTDATE,+$G(DUZ))
- ;Done
- Q XMITPTR
- ;
- FINDXMIT(ENCPTR,DELPTR) ;Find entry in TRANSMITTED OUTPATIENT ENCOUNTER
- ; file (#409.73)
- ;
- ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
- ; file (#409.68)
- ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
- ; file (#409.74)
- ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- ; ENCOUNTER file (#409.73)
- ; 0 - Entry in TRANSMITTED OUTPATIENT ENCOUNTER file for the
- ; [DELETED] OUTPATIENT ENCOUNTER does not exist
- ;Note : A value for DELPTR should not be passed if finding an entry
- ; for an OUTPATIENT ENCOUNTER. A value for ENCPTR should not
- ; be passed if finding an entry for a DELETED OUTPATIENT
- ; ENCOUNTER. If values for both parameters are passed, the
- ; pointer to the OUTPATIENT ENCOUNTER will be used.
- ;
- ;Check input
- S ENCPTR=+$G(ENCPTR)
- S DELPTR=+$G(DELPTR)
- Q:(('ENCPTR)&('DELPTR)) 0
- ;Find entry for Outpatient Encounter - done
- Q:(ENCPTR) +$O(^SD(409.73,"AENC",ENCPTR,""))
- ;Find entry for Deleted Outpatient Encounter - done
- Q +$O(^SD(409.73,"ADEL",DELPTR,""))
- ;
- STREEVNT(XMITPTR,XMITEVNT,EVNTDATE,EVNTDUZ) ;Store event information for
- ; entry in TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
- ;
- ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- ; ENCOUNTER file (#409.73)
- ; XMITEVNT - Flag denoting event causing transmission
- ; 0 = Retransmit (DEFAULT)
- ; 1 = Addition of entry in OUTPATIENT ENCOUNTER file
- ; 2 = Editing of entry in OUTPATIENT ENCOUNTER file
- ; 3 = Deletion of entry in OUTPATIENT ENCOUNTER file
- ; (Addition of entry in DELETED OUTPATIENT
- ; ENCOUNTER file)
- ; EVNTDATE - Date/time event causing transmission occurred
- ; in FileMan format (defaults to NOW)
- ; EVNTDUZ - Pointer to entry in NEW PERSON file (#2) that
- ; caused the event to occur (defaults to current DUZ)
- ;Output : None
- ;Notes : If EVNTDUZ and/or the current DUZ are not valid, POSTMASTER
- ; (.5) will be used
- ;
- ;Check input
- S XMITPTR=+$G(XMITPTR)
- Q:('XMITPTR)
- Q:('$D(^SD(409.73,XMITPTR)))
- S XMITEVNT=+$G(XMITEVNT)
- S:((XMITEVNT<0)!(XMITEVNT>3)) XMITEVNT=0
- S EVNTDATE=+$G(EVNTDATE)
- S:('EVNTDATE) EVNTDATE="NOW"
- S EVNTDUZ=+$G(EVNTDUZ,$G(DUZ))
- S:('$D(^VA(200,EVNTDUZ,0))) EVNTDUZ=.5
- ;Declare variables
- N DIE,DA,DR,DIDEL,X,Y,DIC
- ;Store event data
- S DIE="^SD(409.73,"
- S DA=XMITPTR
- S DR=".05////^S X=XMITEVNT;.06///^S X=EVNTDATE;.07////^S X=EVNTDUZ"
- D ^DIE
- ;Done
- Q
- ;
- XMITFLAG(XMITPTR,RESET) ;Set/reset transmission flag for entry in
- ; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
- ;
- ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- ; ENCOUNTER file (#409.73)
- ; RESET - Denotes if transmission field should be turned
- ; on or off
- ; 0 = Set TRANSMISSION REQUIRED field (#.04) equal
- ; to 'YES' (DEFAULT)
- ; 1 = Set TRANSMISSION REQUIRED field (#.04) equal
- ; to 'NO'
- ;Output : None
- ;Notes : Setting the TRANSMISSION REQUIRED field to 'YES' flags
- ; the entry for transmission
- ;
- ;Check input
- S XMITPTR=+$G(XMITPTR)
- Q:('$D(^SD(409.73,XMITPTR)))
- S RESET=+$G(RESET)
- ;Declare variables
- N DIE,DA,DR,DIDEL,X,Y,DIC
- ;Store new value for transmission flag
- S DIE="^SD(409.73,"
- S DA=XMITPTR
- ;Set transmission flag
- S DR=".04///YES"
- ;Reset transmission flag
- S:(RESET) DR=".04///NO"
- D ^DIE
- ;If turning flag on, check for late activity & send bulletin
- I 'RESET I +$$XMIT4DBC^SCDXFU04(XMITPTR)>0 D LATEACT^SCDXMSG2(XMITPTR) ;SD*5.3*247
- ;Done
- Q
- ;
- ENCDT(ENCPTR,DELPTR) ;returns the date of the encounter
- ; Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
- ; file (#409.68)
- ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
- ; file (#409.74)
- ; Returned: Date of encounter (#.01 of #409.68)
- Q $S($D(^SCE(+$G(ENCPTR),0)):+^(0),$D(^SD(409.74,+$G(DELPTR),0)):^(0),1:"-1^No Pointer")
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXFU01 7873 printed Feb 19, 2025@00:05:35 Page 2
- SCDXFU01 ;ALB/JRP - AMB CARE FILE UTILITIES;01-MAY-1996 ; 1/14/02 2:45pm
- +1 ;;5.3;Scheduling;**44,64,97,121,247**;AUG 13, 1993
- +2 ;
- CRTXMIT(ENCPTR,DELPTR,EVNTDATE) ;Create entry in TRANSMITTED OUTPATIENT
- +1 ; ENCOUNTER file (#409.73)
- +2 ;
- +3 ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
- +4 ; file (#409.68)
- +5 ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
- +6 ; file (#409.74)
- +7 ; EVNTDATE - Date/time the [DELETED] OUTPATIENT ENCOUNTER
- +8 ; occurred in FileMan format (Defaults to NOW)
- +9 ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- +10 ; ENCOUNTER file (#409.73)
- +11 ; -1^Error - Unable to create entry / bad input
- +12 ;Note : When an encounter is deleted from the OUTPATIENT ENCOUNTER
- +13 ; file and an entry for the encounter is created in the
- +14 ; DELETED OUTPATIENT ENCOUNTER file, the ENCPTR and DELPTR
- +15 ; parameters should both be used. This allows an existing
- +16 ; entry that points to the OUTPATIENT ENCOUNTER file (ENCPTR)
- +17 ; to be repointed to the related entry entry in the DELETED
- +18 ; OUTPATIENT ENCOUNTER file (DELPTR). If an existing entry
- +19 ; for the OUTPATIENT ENCOUNTER is not found (or ENCPTR is not
- +20 ; passed/valid), a new entry will be created that points to
- +21 ; the DELETED OUTPATIENT ENCOUNTER.
- +22 ;Note : A value for DELPTR should not be passed when creating an
- +23 ; entry for an OUTPATIENT ENCOUNTER. A value for ENCPTR does
- +24 ; not have to be passed when creating an entry for a DELETED
- +25 ; OUTPATIENT ENCOUNTER, but is recommended.
- +26 ;Note : If an entry for the [DELETED] OUTPATIENT ENCOUNTER already
- +27 ; exists, a new entry will not be created and a pointer to
- +28 ; the existing entry will be returned.
- +29 ;
- +30 ;Check input
- +31 SET ENCPTR=+$GET(ENCPTR)
- +32 SET DELPTR=+$GET(DELPTR)
- +33 if (('ENCPTR)&('DELPTR))
- QUIT "-1^Did not pass pointer to encounter"
- +34 if (('$DATA(^SCE(ENCPTR)))&('$DATA(^SD(409.74,DELPTR))))
- QUIT "-1^Did not pass valid pointer to encounter"
- +35 SET EVNTDATE=+$GET(EVNTDATE)
- +36 if ('EVNTDATE)
- SET EVNTDATE="NOW"
- +37 ;Declare variables
- +38 NEW ADDENC,XMITPTR,DIE,DA,DR,DIDEL,DIC,DA,DINUM,DLAYGO,X,Y
- +39 ;do not recreate entries for encounters prior to 10/1/96
- +40 if $$ENCDT(ENCPTR,DELPTR)<2961001
- QUIT "-1^Encounter Date is prior to 10/1/96"
- +41 ;Adding new Outpatient Encounter
- +42 SET ADDENC=1
- +43 ;Adding new Deleted Outpatient Encounter
- +44 if (DELPTR)
- SET ADDENC=0
- +45 ;Find existing Outpatient Encounter
- +46 SET XMITPTR=+$ORDER(^SD(409.73,"AENC",ENCPTR,""))
- +47 ;Adding an existing Outpatient Encounter - done
- +48 if ((ADDENC)&(XMITPTR))
- QUIT XMITPTR
- +49 ;Converting an Outpatient Encounter to a Deleted Outpatient Encounter
- +50 ; Swap pointer & store event info - done
- +51 IF (('ADDENC)&(XMITPTR))
- Begin DoDot:1
- +52 SET DIE="^SD(409.73,"
- +53 SET DA=XMITPTR
- +54 SET DR=".02///@;.03////^S X=DELPTR"
- +55 DO ^DIE
- +56 DO STREEVNT(XMITPTR,3,EVNTDATE,+$GET(DUZ))
- End DoDot:1
- QUIT XMITPTR
- +57 ;Adding a new [Deleted] Outpatient Encounter - create entry
- +58 ; using auto-numbering capabilities of file
- +59 SET DIC="^SD(409.73,"
- +60 SET DIC(0)="L"
- +61 SET X="+"
- +62 SET DLAYGO=409.73
- +63 ;Adding a new Outpatient Encounter
- +64 SET DIC("DR")=".02////^S X=ENCPTR"
- +65 ;Adding a new Deleted Outpatient Encounter
- +66 if ('ADDENC)
- SET DIC("DR")=".03////^S X=DELPTR"
- +67 ;Create entry
- +68 DO ^DIC
- +69 ;Get pointer to entry
- +70 SET XMITPTR=+Y
- +71 ;Error creating entry
- +72 if (XMITPTR<0)
- QUIT "-1^Unable to create entry in Transmitted Outpatient Encounter file"
- +73 ;Store event info
- +74 DO STREEVNT(XMITPTR,$SELECT(('ADDENC):3,1:1),EVNTDATE,+$GET(DUZ))
- +75 ;Done
- +76 QUIT XMITPTR
- +77 ;
- FINDXMIT(ENCPTR,DELPTR) ;Find entry in TRANSMITTED OUTPATIENT ENCOUNTER
- +1 ; file (#409.73)
- +2 ;
- +3 ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
- +4 ; file (#409.68)
- +5 ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
- +6 ; file (#409.74)
- +7 ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- +8 ; ENCOUNTER file (#409.73)
- +9 ; 0 - Entry in TRANSMITTED OUTPATIENT ENCOUNTER file for the
- +10 ; [DELETED] OUTPATIENT ENCOUNTER does not exist
- +11 ;Note : A value for DELPTR should not be passed if finding an entry
- +12 ; for an OUTPATIENT ENCOUNTER. A value for ENCPTR should not
- +13 ; be passed if finding an entry for a DELETED OUTPATIENT
- +14 ; ENCOUNTER. If values for both parameters are passed, the
- +15 ; pointer to the OUTPATIENT ENCOUNTER will be used.
- +16 ;
- +17 ;Check input
- +18 SET ENCPTR=+$GET(ENCPTR)
- +19 SET DELPTR=+$GET(DELPTR)
- +20 if (('ENCPTR)&('DELPTR))
- QUIT 0
- +21 ;Find entry for Outpatient Encounter - done
- +22 if (ENCPTR)
- QUIT +$ORDER(^SD(409.73,"AENC",ENCPTR,""))
- +23 ;Find entry for Deleted Outpatient Encounter - done
- +24 QUIT +$ORDER(^SD(409.73,"ADEL",DELPTR,""))
- +25 ;
- STREEVNT(XMITPTR,XMITEVNT,EVNTDATE,EVNTDUZ) ;Store event information for
- +1 ; entry in TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
- +2 ;
- +3 ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- +4 ; ENCOUNTER file (#409.73)
- +5 ; XMITEVNT - Flag denoting event causing transmission
- +6 ; 0 = Retransmit (DEFAULT)
- +7 ; 1 = Addition of entry in OUTPATIENT ENCOUNTER file
- +8 ; 2 = Editing of entry in OUTPATIENT ENCOUNTER file
- +9 ; 3 = Deletion of entry in OUTPATIENT ENCOUNTER file
- +10 ; (Addition of entry in DELETED OUTPATIENT
- +11 ; ENCOUNTER file)
- +12 ; EVNTDATE - Date/time event causing transmission occurred
- +13 ; in FileMan format (defaults to NOW)
- +14 ; EVNTDUZ - Pointer to entry in NEW PERSON file (#2) that
- +15 ; caused the event to occur (defaults to current DUZ)
- +16 ;Output : None
- +17 ;Notes : If EVNTDUZ and/or the current DUZ are not valid, POSTMASTER
- +18 ; (.5) will be used
- +19 ;
- +20 ;Check input
- +21 SET XMITPTR=+$GET(XMITPTR)
- +22 if ('XMITPTR)
- QUIT
- +23 if ('$DATA(^SD(409.73,XMITPTR)))
- QUIT
- +24 SET XMITEVNT=+$GET(XMITEVNT)
- +25 if ((XMITEVNT<0)!(XMITEVNT>3))
- SET XMITEVNT=0
- +26 SET EVNTDATE=+$GET(EVNTDATE)
- +27 if ('EVNTDATE)
- SET EVNTDATE="NOW"
- +28 SET EVNTDUZ=+$GET(EVNTDUZ,$GET(DUZ))
- +29 if ('$DATA(^VA(200,EVNTDUZ,0)))
- SET EVNTDUZ=.5
- +30 ;Declare variables
- +31 NEW DIE,DA,DR,DIDEL,X,Y,DIC
- +32 ;Store event data
- +33 SET DIE="^SD(409.73,"
- +34 SET DA=XMITPTR
- +35 SET DR=".05////^S X=XMITEVNT;.06///^S X=EVNTDATE;.07////^S X=EVNTDUZ"
- +36 DO ^DIE
- +37 ;Done
- +38 QUIT
- +39 ;
- XMITFLAG(XMITPTR,RESET) ;Set/reset transmission flag for entry in
- +1 ; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
- +2 ;
- +3 ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
- +4 ; ENCOUNTER file (#409.73)
- +5 ; RESET - Denotes if transmission field should be turned
- +6 ; on or off
- +7 ; 0 = Set TRANSMISSION REQUIRED field (#.04) equal
- +8 ; to 'YES' (DEFAULT)
- +9 ; 1 = Set TRANSMISSION REQUIRED field (#.04) equal
- +10 ; to 'NO'
- +11 ;Output : None
- +12 ;Notes : Setting the TRANSMISSION REQUIRED field to 'YES' flags
- +13 ; the entry for transmission
- +14 ;
- +15 ;Check input
- +16 SET XMITPTR=+$GET(XMITPTR)
- +17 if ('$DATA(^SD(409.73,XMITPTR)))
- QUIT
- +18 SET RESET=+$GET(RESET)
- +19 ;Declare variables
- +20 NEW DIE,DA,DR,DIDEL,X,Y,DIC
- +21 ;Store new value for transmission flag
- +22 SET DIE="^SD(409.73,"
- +23 SET DA=XMITPTR
- +24 ;Set transmission flag
- +25 SET DR=".04///YES"
- +26 ;Reset transmission flag
- +27 if (RESET)
- SET DR=".04///NO"
- +28 DO ^DIE
- +29 ;If turning flag on, check for late activity & send bulletin
- +30 ;SD*5.3*247
- IF 'RESET
- IF +$$XMIT4DBC^SCDXFU04(XMITPTR)>0
- DO LATEACT^SCDXMSG2(XMITPTR)
- +31 ;Done
- +32 QUIT
- +33 ;
- ENCDT(ENCPTR,DELPTR) ;returns the date of the encounter
- +1 ; Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
- +2 ; file (#409.68)
- +3 ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
- +4 ; file (#409.74)
- +5 ; Returned: Date of encounter (#.01 of #409.68)
- +6 QUIT $SELECT($DATA(^SCE(+$GET(ENCPTR),0)):+^(0),$DATA(^SD(409.74,+$GET(DELPTR),0)):^(0),1:"-1^No Pointer")