DGMSTL2 ;ALB/SCK - MST LISTMANAGER UTILITIES CONT. ; 12/17/98
;;5.3;Registration;**195,1015**;Aug 13, 1993;Build 21
Q
;
ASKDATE(MSTDT,MSTOLDDT) ; Return status change date
; Future dates will not be allowed
;
; Input
; MSTDT - Date to be used as default [optional] Default is NOW
; MSTOLDDT - Date to be used as the minimum allowed entry date
; [optional] Default is null
; Both dates must be in FM date format is passed in.
;
; Output
; DGRSLT has the following values:
; 0 - if user up-arrows, times out, or enters null
; Y - date in FM date format
;
N DGRSLT,Y
;
K DIRUT
S MSTDT=$G(MSTDT)
S MSTOLDDT=$G(MSTOLDDT)
S DIR(0)="DAO^"_$S(MSTOLDDT>0:MSTOLDDT,1:"")_":NOW:ERXP"
S DIR("B")=$S(MSTDT>0:$$FMTE^XLFDT(MSTDT),1:"NOW")
S DIR("A")="Enter date of status change: "
D ^DIR K DIR
I $D(DIRUT) S DGRSLT=0
E S DGRSLT=Y
;
Q $G(DGRSLT)
;
ASKPROV(MSTPV) ; Ask for Provider
; Input
; MSTPV - IEN of default provider [optional]
;
; Returns
; DGRSLT
; 0 - if user up-arrows, times out, or enters null
; +Y - IEN of selected provider
;
N DGRSLT
;
K DIRUT
S MSTPV=$G(MSTPV)
S DIR(0)="29.11,4AO"
S DIR("B")=$S(MSTPV>0:$$NAME^DGMSTAPI(MSTPV),1:"")
S DIR("A")="Provider determining status: "
D ^DIR K DIR
I $D(DIRUT) S DGRSLT=0
E S DGRSLT=+Y
;
Q $G(DGRSLT)
;
ADDSTR(DFN,MSTST,MSTDT,MSTPR,MSTIEN) ; Build the formatted display string for the List Manager display
; Input
; DFN - IEN of patient in the PATIENT File (#2)
; MSTST - Status code for the MST status
; MSTDT - Date of the status change in FM internal format
; MSTPR - IEN of provider in the NEW USER File (#200)
; MSTIEN- IEN of new entry in the MST HISTORY File (#29.11)
;
;; Check for empty list. If list is empty, clear message and reset LM variables.
N DGX
I $D(^TMP("DGMST",$J,"INIT"))>0 D
. K ^TMP("DGMST",$J)
. D CLEAN^VALM10
. S (VALMCNT,MSTCNT)=0
;
N VADM,VA
D DEM^VADPT,PID^VADPT
S MSTCNT=$G(MSTCNT)+1
S DGX=$$SETFLD^VALM1(MSTCNT,"","MST#")
S DGX=$$SETFLD^VALM1(VA("BID"),DGX,"SSN")
S DGX=$$SETFLD^VALM1(VADM(1),DGX,"PATIENT")
S DGX=$$SETFLD^VALM1(MSTST,DGX,"STATUS")
S DGX=$$SETFLD^VALM1($$FMTE^XLFDT(MSTDT),DGX,"DATE")
S DGX=$$SETFLD^VALM1($S(MSTPR>0:$$NAME^DGMSTAPI(MSTPR),1:""),DGX,"PROVIDER")
D SET(DGX,MSTCNT,DFN,MSTIEN)
S ^TMP("DGMST",$J,0)=MSTCNT
D KVA^VADPT
Q
;
SET(X,IDX,DFN,MSTIEN) ; Set the formatted display string into the List Manager global
; Build the DFN and IDX indexes
; Input
; X - formated display string
; IDX - Index number
; DFN - IEN of patient in the PATIENT File (#2)
;
S VALMCNT=$G(VALMCNT)+1,^TMP("DGMST",$J,VALMCNT,0)=X
S ^TMP("DGMST",$J,"IDX",VALMCNT,IDX)=""
S ^TMP("DGMST",$J,"DFN",VALMCNT,DFN)=""
S ^TMP("DGMST",$J,"IEN",VALMCNT,MSTIEN)=""
Q
;
EXTMST(MSTST) ; convert MST status code to external dislay format
Q $S(MSTST["Y":"Yes, Screened reports MST",MSTST["N":"No, Screened does not report MST",MSTST["D":"Screened Declines to answer",1:"Unknown, not screened")
;
NUL ; Check for empty list. If empty display message and force page number
I '$O(^TMP("DGMST",$J,0)) D SET^DGMSTL(" No Entries")
Q
;
CHKNUL() ; Checks of an "empty" list to lock out protocols.
N DGRSLT
S DGRSLT=0
I VALMCNT>0,^TMP("DGMST",$J,1,0)["No Entries" D
. S DIR(0)="FAO"
. S DIR("A",1)="Action not allowed at this point."
. S (DIR("A"),DIR("?"),DIR("??"))="Press any key to continue..."
. D ^DIR K DIR
. S DGRSLT=1
Q $G(DGRSLT)
DGMSTL2 ;ALB/SCK - MST LISTMANAGER UTILITIES CONT. ; 12/17/98
+1 ;;5.3;Registration;**195,1015**;Aug 13, 1993;Build 21
+2 QUIT
+3 ;
ASKDATE(MSTDT,MSTOLDDT) ; Return status change date
+1 ; Future dates will not be allowed
+2 ;
+3 ; Input
+4 ; MSTDT - Date to be used as default [optional] Default is NOW
+5 ; MSTOLDDT - Date to be used as the minimum allowed entry date
+6 ; [optional] Default is null
+7 ; Both dates must be in FM date format is passed in.
+8 ;
+9 ; Output
+10 ; DGRSLT has the following values:
+11 ; 0 - if user up-arrows, times out, or enters null
+12 ; Y - date in FM date format
+13 ;
+14 NEW DGRSLT,Y
+15 ;
+16 KILL DIRUT
+17 SET MSTDT=$GET(MSTDT)
+18 SET MSTOLDDT=$GET(MSTOLDDT)
+19 SET DIR(0)="DAO^"_$SELECT(MSTOLDDT>0:MSTOLDDT,1:"")_":NOW:ERXP"
+20 SET DIR("B")=$SELECT(MSTDT>0:$$FMTE^XLFDT(MSTDT),1:"NOW")
+21 SET DIR("A")="Enter date of status change: "
+22 DO ^DIR
KILL DIR
+23 IF $DATA(DIRUT)
SET DGRSLT=0
+24 IF '$TEST
SET DGRSLT=Y
+25 ;
+26 QUIT $GET(DGRSLT)
+27 ;
ASKPROV(MSTPV) ; Ask for Provider
+1 ; Input
+2 ; MSTPV - IEN of default provider [optional]
+3 ;
+4 ; Returns
+5 ; DGRSLT
+6 ; 0 - if user up-arrows, times out, or enters null
+7 ; +Y - IEN of selected provider
+8 ;
+9 NEW DGRSLT
+10 ;
+11 KILL DIRUT
+12 SET MSTPV=$GET(MSTPV)
+13 SET DIR(0)="29.11,4AO"
+14 SET DIR("B")=$SELECT(MSTPV>0:$$NAME^DGMSTAPI(MSTPV),1:"")
+15 SET DIR("A")="Provider determining status: "
+16 DO ^DIR
KILL DIR
+17 IF $DATA(DIRUT)
SET DGRSLT=0
+18 IF '$TEST
SET DGRSLT=+Y
+19 ;
+20 QUIT $GET(DGRSLT)
+21 ;
ADDSTR(DFN,MSTST,MSTDT,MSTPR,MSTIEN) ; Build the formatted display string for the List Manager display
+1 ; Input
+2 ; DFN - IEN of patient in the PATIENT File (#2)
+3 ; MSTST - Status code for the MST status
+4 ; MSTDT - Date of the status change in FM internal format
+5 ; MSTPR - IEN of provider in the NEW USER File (#200)
+6 ; MSTIEN- IEN of new entry in the MST HISTORY File (#29.11)
+7 ;
+8 ;; Check for empty list. If list is empty, clear message and reset LM variables.
+9 NEW DGX
+10 IF $DATA(^TMP("DGMST",$JOB,"INIT"))>0
Begin DoDot:1
+11 KILL ^TMP("DGMST",$JOB)
+12 DO CLEAN^VALM10
+13 SET (VALMCNT,MSTCNT)=0
End DoDot:1
+14 ;
+15 NEW VADM,VA
+16 DO DEM^VADPT
DO PID^VADPT
+17 SET MSTCNT=$GET(MSTCNT)+1
+18 SET DGX=$$SETFLD^VALM1(MSTCNT,"","MST#")
+19 SET DGX=$$SETFLD^VALM1(VA("BID"),DGX,"SSN")
+20 SET DGX=$$SETFLD^VALM1(VADM(1),DGX,"PATIENT")
+21 SET DGX=$$SETFLD^VALM1(MSTST,DGX,"STATUS")
+22 SET DGX=$$SETFLD^VALM1($$FMTE^XLFDT(MSTDT),DGX,"DATE")
+23 SET DGX=$$SETFLD^VALM1($SELECT(MSTPR>0:$$NAME^DGMSTAPI(MSTPR),1:""),DGX,"PROVIDER")
+24 DO SET(DGX,MSTCNT,DFN,MSTIEN)
+25 SET ^TMP("DGMST",$JOB,0)=MSTCNT
+26 DO KVA^VADPT
+27 QUIT
+28 ;
SET(X,IDX,DFN,MSTIEN) ; Set the formatted display string into the List Manager global
+1 ; Build the DFN and IDX indexes
+2 ; Input
+3 ; X - formated display string
+4 ; IDX - Index number
+5 ; DFN - IEN of patient in the PATIENT File (#2)
+6 ;
+7 SET VALMCNT=$GET(VALMCNT)+1
SET ^TMP("DGMST",$JOB,VALMCNT,0)=X
+8 SET ^TMP("DGMST",$JOB,"IDX",VALMCNT,IDX)=""
+9 SET ^TMP("DGMST",$JOB,"DFN",VALMCNT,DFN)=""
+10 SET ^TMP("DGMST",$JOB,"IEN",VALMCNT,MSTIEN)=""
+11 QUIT
+12 ;
EXTMST(MSTST) ; convert MST status code to external dislay format
+1 QUIT $SELECT(MSTST["Y":"Yes, Screened reports MST",MSTST["N":"No, Screened does not report MST",MSTST["D":"Screened Declines to answer",1:"Unknown, not screened")
+2 ;
NUL ; Check for empty list. If empty display message and force page number
+1 IF '$ORDER(^TMP("DGMST",$JOB,0))
DO SET^DGMSTL(" No Entries")
+2 QUIT
+3 ;
CHKNUL() ; Checks of an "empty" list to lock out protocols.
+1 NEW DGRSLT
+2 SET DGRSLT=0
+3 IF VALMCNT>0
IF ^TMP("DGMST",$JOB,1,0)["No Entries"
Begin DoDot:1
+4 SET DIR(0)="FAO"
+5 SET DIR("A",1)="Action not allowed at this point."
+6 SET (DIR("A"),DIR("?"),DIR("??"))="Press any key to continue..."
+7 DO ^DIR
KILL DIR
+8 SET DGRSLT=1
End DoDot:1
+9 QUIT $GET(DGRSLT)