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

SCDXRT02.m

Go to the documentation of this file.
  1. SCDXRT02 ;ALB/JRP - RETRANSMIT REJECTS FROM NPCDB ;10/15/96
  1. ;;5.3;Scheduling;**68,640**;AUG 13, 1993;Build 8
  1. ;
  1. EN ;Entry point for List Manager display
  1. ;
  1. ;SD*640 Stop selective retransmit of NPCDB rejections
  1. Q
  1. ;
  1. D EN^VALM("SCDX RETRAN REJECTS FROM NPCDB")
  1. Q
  1. ;
  1. ;Input : Variables as set by List Manager interface
  1. ;Output : Header for List Manager screen
  1. ;
  1. ;Declare variables
  1. N TMP,SPOT
  1. ;Build header
  1. S TMP="Patients whose encounter data has been rejected by the National"
  1. S SPOT=40-($L(TMP)\2)
  1. S VALMHDR(1)=$$INSERT^SCDXUTL1(TMP,"",SPOT)
  1. S TMP="Patient Care Database and not currently marked for retransmission"
  1. S SPOT=40-($L(TMP)\2)
  1. S VALMHDR(2)=$$INSERT^SCDXUTL1(TMP,"",SPOT)
  1. S TMP="(Entries marked by '*' will be flagged for retransmission on exit)"
  1. S SPOT=40-($L(TMP)\2)
  1. S VALMHDR(3)=$$INSERT^SCDXUTL1(TMP,"",SPOT)
  1. Q
  1. ;
  1. INIT ;Entry point for building List Manager display & indexes
  1. ;Input : Variables as set by List Manager interface
  1. ;Output : List Manager display
  1. ; VALMAR(Line,0) = Line to display
  1. ; Indexes
  1. ; VALMAR("ENTRIES") = Total number of entries
  1. ; VALMAR("LINES") = Total number of lines
  1. ; VALMAR("ENTRY2DFN",Entry) = DFN of entry
  1. ; VALMAR("DFN",DFN,XmitPtr) = Patient's name
  1. ; XmitPtr => Pointer to TRANSMITTED OUTPATIENT
  1. ; ENCOUNTER file (#409.73)
  1. ; VALMAR("NAME",Name) = DFN ^ Total encounters rejected
  1. ;
  1. ;Declare variables
  1. N SPOT,COL4ENT,LINE4ENT,TOTENTRY,DATA,ENTRY,DFN,NAME,NAMEID,VA,BS,VAERR
  1. ;Initialize global locations being used
  1. K @VALMAR
  1. ;Get array of all rejections not currently marked for [re]transmission
  1. W !!
  1. W !,"Building list of patients who have encounters that were rejected by"
  1. W !,"the National Patient Care Database and are not currently marked for"
  1. W !,"retransmission. This list only includes demographic and other non-"
  1. W !,"encounter related errors."
  1. S TOTENTRY=+$$GETREJ^SCDXUTL4(VALMAR,3,20)
  1. I (TOTENTRY<1) D Q
  1. .;No rejections on file - print message and quit
  1. .W !!,"No demographic rejections requiring retransmission are currently on file.",!
  1. .K @VALMAR
  1. .H 2
  1. .S VALMQUIT=1
  1. ;Determine total number of lines that will be in display
  1. ; (this is also the last entry number of column 1)
  1. S VALMCNT=TOTENTRY\2
  1. S:(TOTENTRY#2) VALMCNT=VALMCNT+1
  1. ;Remember total number of entries and lines
  1. S @VALMAR@("ENTRIES")=TOTENTRY
  1. S @VALMAR@("LINES")=VALMCNT
  1. ;Build display
  1. W !!,"Building display screen "
  1. S ENTRY=1
  1. ; string of blank characters
  1. S BS="",$P(BS," ",25)=""
  1. ; Loop through name index of rejection array
  1. S NAME=""
  1. F S NAME=$O(@VALMAR@("NAME",NAME)) Q:(NAME="") D
  1. .;Write a dot for every 10 entries
  1. .W:('(ENTRY#10)) "."
  1. .;Get DFN
  1. .S DFN=+$G(@VALMAR@("NAME",NAME))
  1. .D PID^VADPT6
  1. .;Determine which column & line to put entry in
  1. .S COL4ENT=(ENTRY>VALMCNT)+1
  1. .S LINE4ENT=ENTRY
  1. .S:(ENTRY>VALMCNT) LINE4ENT=ENTRY-VALMCNT
  1. .;Get data currently stored in display
  1. .S DATA=$G(@VALMAR@(LINE4ENT,0))
  1. .;Insert entry number
  1. .S SPOT=5-$L(ENTRY)
  1. .S:(COL4ENT=2) SPOT=43-$L(ENTRY)
  1. .S DATA=$$INSERT^SCDXUTL1(ENTRY,DATA,SPOT)
  1. .;Insert patient name truncated to 20 characters, then BID
  1. .S SPOT=6
  1. .S:(COL4ENT=2) SPOT=44
  1. .S NAMEID=$E(NAME_BS,1,20)_$S(VA("BID")]"":" ("_VA("BID")_")",1:"")
  1. .S DATA=$$INSERT^SCDXUTL1(NAMEID,DATA,SPOT)
  1. .;Put data back into display
  1. .S @VALMAR@(LINE4ENT,0)=DATA
  1. .;Store data into indexes
  1. .S @VALMAR@("ENTRY2DFN",ENTRY)=DFN
  1. .S @VALMAR@("DFN2ENTRY",DFN)=ENTRY
  1. .;Increment entry number
  1. .S ENTRY=ENTRY+1
  1. ;Done
  1. S VALMBG=1
  1. Q
  1. ;
  1. MARK(RESET) ;Entry point to prompt user for entry numbers to mark/unmark
  1. ; for retransmission
  1. ;
  1. ;Input : RESET - Flag denoting which process to execute
  1. ; 0 = Mark entry for retransmission (default)
  1. ; 1 = Unmark entry for retransmission
  1. ; Variables as set by List Manager interface
  1. ;Output : None
  1. ; The following index is set when marking an entry
  1. ; VALMAR("MARKED",Entry) = ""
  1. ; This index is deleted when unmarking an entry
  1. ; The List Manager display is updated accordingly
  1. ;Note : Marking/unmarking is done only in the context of the List
  1. ; Manager display
  1. ;
  1. ;Check input
  1. S RESET=+$G(RESET)
  1. ;Declare variables
  1. N ENTRY,SELECT,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. ;Switch to full screen
  1. D FULL^VALM1
  1. ;Prompt user for selection(s)
  1. S X=+$O(@VALMAR@("ENTRY2DFN",""))
  1. S Y=+$O(@VALMAR@("ENTRY2DFN",""),-1)
  1. S DIR(0)="LAO^"_X_":"_Y_":0"
  1. S DIR("A")="Select "_VALM("ENTITY")_"(s) ("_X_"-"_Y_"): "
  1. S DIR("?",1)=" Select the patient(s) whose rejected encounters you want "_$S(RESET:"un",1:"")_"marked"
  1. S DIR("?")=" for retransmission to the National Patient Care Database"
  1. D ^DIR
  1. I $D(DIRUT) S VALMBCK="R" Q
  1. ;Move selections from Y into SELECT - parse main output of DIR
  1. ; into individual entries in SELECT() array
  1. M SELECT=Y
  1. F X=1:1 S Y=$P(SELECT(0),",",X) Q:('Y) S SELECT(Y)=""
  1. K SELECT(0)
  1. ;Loop through selected entries
  1. S ENTRY=0
  1. F S ENTRY=+$O(SELECT(ENTRY)) Q:('ENTRY) D
  1. .;Mark/unmark entry for retransmission
  1. .D MARKIDX(ENTRY,RESET)
  1. ;Done
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. MARKPT(RESET) ; Entry point to prompt user for patients to mark/unmark
  1. ; for retransmission
  1. ;
  1. ; (see description of input/output for MARK call)
  1. ;
  1. S RESET=+$G(RESET)
  1. ;Declare variables
  1. N ENTRY,DA,DIC,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,VAUTN
  1. ;Switch to full screen
  1. D FULL^VALM1
  1. ;Prompt user for selection(s) via VAUTOMA
  1. S VAUTNI=2
  1. S DIC("S")="I $D(@VALMAR@(""DFN2ENTRY"",+Y))"
  1. D PATIENT^VAUTOMA
  1. I Y<0 S VALMBCK="R" Q
  1. I VAUTN=1 D MARKALL(RESET)
  1. ;Loop through selected entries
  1. S DFN=0
  1. F S DFN=+$O(VAUTN(DFN)) Q:('DFN) D
  1. .S ENTRY=$G(@VALMAR@("DFN2ENTRY",DFN)) Q:'ENTRY
  1. .;Mark/unmark entry for retransmission
  1. .D MARKIDX(ENTRY,RESET)
  1. ;Done
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. MARKALL(RESET) ;Entry point to mark all entries for retransmission
  1. ;
  1. ;Input : RESET - Flag denoting which process to execute
  1. ; 0 = Mark entry for retransmission (default)
  1. ; 1 = Unmark entry for retransmission
  1. ; Variables as set by List Manager interface
  1. ;Output : None
  1. ; The following index is set when marking an entry
  1. ; VALMAR("MARKED",Entry) = ""
  1. ; This index is deleted when unmarking an entry
  1. ; The List Manager display is updated accordingly
  1. ;Note : Marking/unmarking is done only in the context of the List
  1. ; Manager display
  1. ;
  1. ;Check input
  1. S RESET=+$G(RESET)
  1. ;Declare variables
  1. N ENTRY
  1. ;Loop through all entries in entry & DFN index
  1. S ENTRY=""
  1. F S ENTRY=+$O(@VALMAR@("ENTRY2DFN",ENTRY)) Q:('ENTRY) D
  1. .;Mark/unmark for retransmission
  1. .D MARKIDX(ENTRY,RESET)
  1. ;Done
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. MARKIDX(ENTRY,RESET) ;Entry point to mark/unmark an entry for retransmission
  1. ;
  1. ;Input : ENTRY - Entry number in display to mark/unmark
  1. ; RESET - Flag denoting which process to execute
  1. ; 0 = Mark entry for retransmission (default)
  1. ; 1 = Unmark entry for retransmission
  1. ; Variables as set by List Manager interface
  1. ;Output : None
  1. ; The following index is set when marking an entry
  1. ; VALMAR("MARKED",Entry) = ""
  1. ; This index is deleted when unmarking an entry
  1. ; The List Manager display is updated accordingly
  1. ;Note : Marking/unmarking is done only in the context of the List
  1. ; Manager display
  1. ;
  1. ;Check input
  1. S ENTRY=+$G(ENTRY)
  1. Q:(ENTRY<1)
  1. Q:('$D(@VALMAR@("ENTRY2DFN",ENTRY)))
  1. S RESET=+$G(RESET)
  1. ;Declare variables
  1. N TMP,COL4ENT,LINE4ENT,DATA,SPOT
  1. ;Set index
  1. S:('RESET) @VALMAR@("MARKED",ENTRY)=""
  1. ;Delete index
  1. K:(RESET) @VALMAR@("MARKED",ENTRY)
  1. ;Update display
  1. ; Determine which column & line to put entry in
  1. S TMP=+$G(@VALMAR@("LINES"))
  1. S COL4ENT=(ENTRY>TMP)+1
  1. S LINE4ENT=ENTRY
  1. S:(ENTRY>TMP) LINE4ENT=ENTRY-TMP
  1. ;Get data currently stored in display
  1. S DATA=$G(@VALMAR@(LINE4ENT,0))
  1. ;Put/remove retransmission mark
  1. S SPOT=1
  1. S:(COL4ENT=2) SPOT=39
  1. S TMP="*"
  1. S:(RESET) TMP=" "
  1. S DATA=$$INSERT^SCDXUTL1(TMP,DATA,SPOT)
  1. ;Put data back into display
  1. S @VALMAR@(LINE4ENT,0)=DATA
  1. ;Done
  1. Q
  1. ;
  1. CLEANUP ;Entry point for cleaning up
  1. ;
  1. ;Input : Variables as set by List Manager interface
  1. ;Output : None
  1. ;
  1. ;Declare variables
  1. N ENTRY,DFN,XMITPTR
  1. ;Switch to full screen
  1. D FULL^VALM1
  1. W !
  1. W !,"Rejected encounters for the selected patient(s) will now be"
  1. W !,"marked for retransmission "
  1. ;Loop through index of marked entries
  1. S ENTRY=""
  1. F S ENTRY=+$O(@VALMAR@("MARKED",ENTRY)) Q:('ENTRY) D
  1. .;Get DFN for entry
  1. .S DFN=+$G(@VALMAR@("ENTRY2DFN",ENTRY))
  1. .Q:('DFN)
  1. .;Loop through index of all entries in TRANSMITTED OUTPATIENT
  1. .; ENCOUNTER file (#409.73) for DFN
  1. .S XMITPTR=""
  1. .F S XMITPTR=+$O(@VALMAR@("DFN",DFN,XMITPTR)) Q:('XMITPTR) D
  1. ..;Mark entry for retransmission
  1. ..D STREEVNT^SCDXFU01(XMITPTR,0)
  1. ..;Turn on transmission flag
  1. ..D XMITFLAG^SCDXFU01(XMITPTR)
  1. ..W "."
  1. ;Done - clean up global location used and quit
  1. K @VALMAR
  1. Q