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

SCDXFU01.m

Go to the documentation of this file.
  1. 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
  1. ;
  1. CRTXMIT(ENCPTR,DELPTR,EVNTDATE) ;Create entry in TRANSMITTED OUTPATIENT
  1. ; ENCOUNTER file (#409.73)
  1. ;
  1. ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
  1. ; file (#409.68)
  1. ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
  1. ; file (#409.74)
  1. ; EVNTDATE - Date/time the [DELETED] OUTPATIENT ENCOUNTER
  1. ; occurred in FileMan format (Defaults to NOW)
  1. ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
  1. ; ENCOUNTER file (#409.73)
  1. ; -1^Error - Unable to create entry / bad input
  1. ;Note : When an encounter is deleted from the OUTPATIENT ENCOUNTER
  1. ; file and an entry for the encounter is created in the
  1. ; DELETED OUTPATIENT ENCOUNTER file, the ENCPTR and DELPTR
  1. ; parameters should both be used. This allows an existing
  1. ; entry that points to the OUTPATIENT ENCOUNTER file (ENCPTR)
  1. ; to be repointed to the related entry entry in the DELETED
  1. ; OUTPATIENT ENCOUNTER file (DELPTR). If an existing entry
  1. ; for the OUTPATIENT ENCOUNTER is not found (or ENCPTR is not
  1. ; passed/valid), a new entry will be created that points to
  1. ; the DELETED OUTPATIENT ENCOUNTER.
  1. ;Note : A value for DELPTR should not be passed when creating an
  1. ; entry for an OUTPATIENT ENCOUNTER. A value for ENCPTR does
  1. ; not have to be passed when creating an entry for a DELETED
  1. ; OUTPATIENT ENCOUNTER, but is recommended.
  1. ;Note : If an entry for the [DELETED] OUTPATIENT ENCOUNTER already
  1. ; exists, a new entry will not be created and a pointer to
  1. ; the existing entry will be returned.
  1. ;
  1. ;Check input
  1. S ENCPTR=+$G(ENCPTR)
  1. S DELPTR=+$G(DELPTR)
  1. Q:(('ENCPTR)&('DELPTR)) "-1^Did not pass pointer to encounter"
  1. Q:(('$D(^SCE(ENCPTR)))&('$D(^SD(409.74,DELPTR)))) "-1^Did not pass valid pointer to encounter"
  1. S EVNTDATE=+$G(EVNTDATE)
  1. S:('EVNTDATE) EVNTDATE="NOW"
  1. ;Declare variables
  1. N ADDENC,XMITPTR,DIE,DA,DR,DIDEL,DIC,DA,DINUM,DLAYGO,X,Y
  1. ;do not recreate entries for encounters prior to 10/1/96
  1. Q:$$ENCDT(ENCPTR,DELPTR)<2961001 "-1^Encounter Date is prior to 10/1/96"
  1. ;Adding new Outpatient Encounter
  1. S ADDENC=1
  1. ;Adding new Deleted Outpatient Encounter
  1. S:(DELPTR) ADDENC=0
  1. ;Find existing Outpatient Encounter
  1. S XMITPTR=+$O(^SD(409.73,"AENC",ENCPTR,""))
  1. ;Adding an existing Outpatient Encounter - done
  1. Q:((ADDENC)&(XMITPTR)) XMITPTR
  1. ;Converting an Outpatient Encounter to a Deleted Outpatient Encounter
  1. ; Swap pointer & store event info - done
  1. I (('ADDENC)&(XMITPTR)) D Q XMITPTR
  1. .S DIE="^SD(409.73,"
  1. .S DA=XMITPTR
  1. .S DR=".02///@;.03////^S X=DELPTR"
  1. .D ^DIE
  1. .D STREEVNT(XMITPTR,3,EVNTDATE,+$G(DUZ))
  1. ;Adding a new [Deleted] Outpatient Encounter - create entry
  1. ; using auto-numbering capabilities of file
  1. S DIC="^SD(409.73,"
  1. S DIC(0)="L"
  1. S X="+"
  1. S DLAYGO=409.73
  1. ;Adding a new Outpatient Encounter
  1. S DIC("DR")=".02////^S X=ENCPTR"
  1. ;Adding a new Deleted Outpatient Encounter
  1. S:('ADDENC) DIC("DR")=".03////^S X=DELPTR"
  1. ;Create entry
  1. D ^DIC
  1. ;Get pointer to entry
  1. S XMITPTR=+Y
  1. ;Error creating entry
  1. Q:(XMITPTR<0) "-1^Unable to create entry in Transmitted Outpatient Encounter file"
  1. ;Store event info
  1. D STREEVNT(XMITPTR,$S(('ADDENC):3,1:1),EVNTDATE,+$G(DUZ))
  1. ;Done
  1. Q XMITPTR
  1. ;
  1. FINDXMIT(ENCPTR,DELPTR) ;Find entry in TRANSMITTED OUTPATIENT ENCOUNTER
  1. ; file (#409.73)
  1. ;
  1. ;Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
  1. ; file (#409.68)
  1. ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
  1. ; file (#409.74)
  1. ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
  1. ; ENCOUNTER file (#409.73)
  1. ; 0 - Entry in TRANSMITTED OUTPATIENT ENCOUNTER file for the
  1. ; [DELETED] OUTPATIENT ENCOUNTER does not exist
  1. ;Note : A value for DELPTR should not be passed if finding an entry
  1. ; for an OUTPATIENT ENCOUNTER. A value for ENCPTR should not
  1. ; be passed if finding an entry for a DELETED OUTPATIENT
  1. ; ENCOUNTER. If values for both parameters are passed, the
  1. ; pointer to the OUTPATIENT ENCOUNTER will be used.
  1. ;
  1. ;Check input
  1. S ENCPTR=+$G(ENCPTR)
  1. S DELPTR=+$G(DELPTR)
  1. Q:(('ENCPTR)&('DELPTR)) 0
  1. ;Find entry for Outpatient Encounter - done
  1. Q:(ENCPTR) +$O(^SD(409.73,"AENC",ENCPTR,""))
  1. ;Find entry for Deleted Outpatient Encounter - done
  1. Q +$O(^SD(409.73,"ADEL",DELPTR,""))
  1. ;
  1. STREEVNT(XMITPTR,XMITEVNT,EVNTDATE,EVNTDUZ) ;Store event information for
  1. ; entry in TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
  1. ; ENCOUNTER file (#409.73)
  1. ; XMITEVNT - Flag denoting event causing transmission
  1. ; 0 = Retransmit (DEFAULT)
  1. ; 1 = Addition of entry in OUTPATIENT ENCOUNTER file
  1. ; 2 = Editing of entry in OUTPATIENT ENCOUNTER file
  1. ; 3 = Deletion of entry in OUTPATIENT ENCOUNTER file
  1. ; (Addition of entry in DELETED OUTPATIENT
  1. ; ENCOUNTER file)
  1. ; EVNTDATE - Date/time event causing transmission occurred
  1. ; in FileMan format (defaults to NOW)
  1. ; EVNTDUZ - Pointer to entry in NEW PERSON file (#2) that
  1. ; caused the event to occur (defaults to current DUZ)
  1. ;Output : None
  1. ;Notes : If EVNTDUZ and/or the current DUZ are not valid, POSTMASTER
  1. ; (.5) will be used
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR)))
  1. S XMITEVNT=+$G(XMITEVNT)
  1. S:((XMITEVNT<0)!(XMITEVNT>3)) XMITEVNT=0
  1. S EVNTDATE=+$G(EVNTDATE)
  1. S:('EVNTDATE) EVNTDATE="NOW"
  1. S EVNTDUZ=+$G(EVNTDUZ,$G(DUZ))
  1. S:('$D(^VA(200,EVNTDUZ,0))) EVNTDUZ=.5
  1. ;Declare variables
  1. N DIE,DA,DR,DIDEL,X,Y,DIC
  1. ;Store event data
  1. S DIE="^SD(409.73,"
  1. S DA=XMITPTR
  1. S DR=".05////^S X=XMITEVNT;.06///^S X=EVNTDATE;.07////^S X=EVNTDUZ"
  1. D ^DIE
  1. ;Done
  1. Q
  1. ;
  1. XMITFLAG(XMITPTR,RESET) ;Set/reset transmission flag for entry in
  1. ; TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
  1. ;
  1. ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
  1. ; ENCOUNTER file (#409.73)
  1. ; RESET - Denotes if transmission field should be turned
  1. ; on or off
  1. ; 0 = Set TRANSMISSION REQUIRED field (#.04) equal
  1. ; to 'YES' (DEFAULT)
  1. ; 1 = Set TRANSMISSION REQUIRED field (#.04) equal
  1. ; to 'NO'
  1. ;Output : None
  1. ;Notes : Setting the TRANSMISSION REQUIRED field to 'YES' flags
  1. ; the entry for transmission
  1. ;
  1. ;Check input
  1. S XMITPTR=+$G(XMITPTR)
  1. Q:('$D(^SD(409.73,XMITPTR)))
  1. S RESET=+$G(RESET)
  1. ;Declare variables
  1. N DIE,DA,DR,DIDEL,X,Y,DIC
  1. ;Store new value for transmission flag
  1. S DIE="^SD(409.73,"
  1. S DA=XMITPTR
  1. ;Set transmission flag
  1. S DR=".04///YES"
  1. ;Reset transmission flag
  1. S:(RESET) DR=".04///NO"
  1. D ^DIE
  1. ;If turning flag on, check for late activity & send bulletin
  1. I 'RESET I +$$XMIT4DBC^SCDXFU04(XMITPTR)>0 D LATEACT^SCDXMSG2(XMITPTR) ;SD*5.3*247
  1. ;Done
  1. Q
  1. ;
  1. ENCDT(ENCPTR,DELPTR) ;returns the date of the encounter
  1. ; Input : ENCPTR - Pointer to entry in OUTPATIENT ENCOUNTER
  1. ; file (#409.68)
  1. ; DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
  1. ; file (#409.74)
  1. ; Returned: Date of encounter (#.01 of #409.68)
  1. Q $S($D(^SCE(+$G(ENCPTR),0)):+^(0),$D(^SD(409.74,+$G(DELPTR),0)):^(0),1:"-1^No Pointer")