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

BWBRNED.m

Go to the documentation of this file.
BWBRNED ;IHS/ANMC/MWR - BROWSE TX NEEDS PAST DUE;11-Feb-2003 13:36;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CALLED BY OPTION: "BW BROWSE NEEDS PAST DUE" TO BROWSE AND
 ;;  EDIT PATIENTS WITH TREATMENT NEEDS PAST DUE.
 ;
 ;---> USE NODES 1 & 2 IN ^TMP GLOBAL.
 ;
BEGIN ;EP
 D SETVARS^BWUTL5 K BWRES
 D TITLE^BWUTL5("BREAST & CERVICAL TX NEEDS PAST DUE REPORT")
 D UNDETER G:BWPOP EXIT
 D ASKDATE G:BWPOP EXIT
 D CMGR    G:BWPOP EXIT
 D CURCOM  G:BWPOP EXIT
 D ORDER   G:BWPOP EXIT
 D DEVICE  G:BWPOP EXIT
 D SORT
 D COPYGBL
 D ^BWBRNED1
 ;
EXIT ;EP
 D KILLALL^BWUTL8
 Q
 ;
 ;
UNDETER ;EP
 ;---> ASK TO INCLUDE CASES WITH UNDETERMINED OR UNDATED NEEDS.
 ;---> BWA=1 SAYS INCLUDE PATIENTS WITH UNDETERMINED NEEDS.
 N DIR,DIRUT,Y
 W !!?3,"Include patients whose Breast or Cervical Tx Needs are "
 W "undetermined?"
 N DIR S DIR("A")="   Enter Yes or No: "
 S BWA=0,DIR(0)="YA",DIR("B")="YES" D HELP1^BWBRNEDH
 D ^DIR W !
 S:$D(DIRUT) BWPOP=1
 I Y S BWA=1 Q
 Q
 ;
 ;
ASKDATE ;EP
 ;---> ASK FOR DATE BY WHICH NEEDS WILL BE DELINQUENT.
 N DIR,DIRUT,Y
 W !!?3,"Select the date to be checked for patient Tx Needs past due:"
 S DIR(0)="D^::EX",DIR("A")="   Select a date"
 S DIR("B")="TODAY" D HELP4^BWBRNEDH
 D ^DIR
 I $D(DIRUT) S BWPOP=1 Q
 S BWDDATE=Y
 Q
 ;
 ;
CMGR ;EP
 ;---> SELECT CASES FOR ONE CASE MANAGER OR ALL.
 ;---> DO NOT PROMPT FOR CASE MANAGER IF SITE PARAMETERS SAY NOT TO.
 I '$D(^BWSITE(DUZ(2),0)) S BWE=1 Q
 I '$P(^BWSITE(DUZ(2),0),U,5) S BWE=1 Q
 W !!?3,"Report on all patients for ONE particular Case Manager,"
 W !?3,"or report on all patients for ALL Case Managers?"
 N DIR,DIRUT,Y
 S DIR("A")="   Select ONE or ALL: ",DIR("B")="ALL",BWMGR=""
 S DIR(0)="SAM^o:ONE;a:ALL" D HELP3^BWBRNEDH
 D ^DIR K DIR
 I Y=-1!($D(DIRUT)) S BWPOP=1 Q
 ;---> IF ALL CASE MANAGERS, S BWE=1 AND QUIT.
 I Y="a" S BWE=1 Q
 ;
 W !!,"   Select the Case Manager whose patients you wish to browse."
 D DIC^BWFMAN(9002086.01,"QEMA",.Y,"   Select CASE MANAGER: ")
 I Y<0 S BWPOP=1 Q
 ;---> FOR ONE CASE MANAGER, SET BWE=0 AND BWMGR=^VA(200 DFN, QUIT.
 S BWMGR=+Y,BWE=0
 Q
 ;
 ;
CURCOM ;EP
 ;---> SELECT CASES FOR ONE OR MORE CURRENT COMMUNITY (OR ALL).
 ;---> DO NOT PROMPT FOR CURRENT COMMUNITY IF THIS IS A VA SITE.
 I $$AGENCY^BWUTL5(DUZ(2))'="i" S BWCC("ALL")="" Q   ;VAMOD
 ;---> SELECT CURRENT COMMUNITY(S).
 D TEXT1
 D SELECT^BWSELECT("Current Community",9999999.05,"BWCC","","",.BWPOP)
 Q
 ;
ORDER ;EP
 ;---> ASK ORDER BY DATE DELINQUENT OR BY PATIENT NAME.
 ;---> SORT SEQUENCE IN BWB:  1=DELINQ DATE (DEFAULT), 2=PATIENT NAME
 N DIR,DIRUT,Y S BWB=1
 W !!?3,"Display Procedures in order of:"
 W ?37,"1) DATE DELINQUENT (earliest first)"
 W !?37,"2) PATIENT NAME (alphabetically)"
 S DIR("A")="   Select 1 or 2: ",DIR("B")=1
 S DIR(0)="SAM^1:DATE DELINQUENT;2:PATIENT NAME" D HELP2^BWBRNEDH
 D ^DIR K DIR
 I Y=-1!($D(DIRUT)) S BWPOP=1 Q
 S BWB=Y
 Q
 ;
DEVICE ;EP
 ;---> GET DEVICE AND POSSIBLY QUEUE TO TASKMAN.
 S ZTRTN="DEQUEUE^BWBRNED"
 F BWSV="A","B","E","DDATE","MGR" D
 .I $D(@("BW"_BWSV)) S ZTSAVE("BW"_BWSV)=""
 ;---> SAVE CURRENT COMMUNITY ARRAY.
 I $D(BWCC) N N S N=0 F  S N=$O(BWCC(N)) Q:N=""  D
 .S ZTSAVE("BWCC("""_N_""")")=""
 D ZIS^BWUTL2(.BWPOP,1,"HOME")
 Q
 ;
SORT ;EP
 ;---> SORT AND STORE LOCAL ARRAY IN ^TMP("BW",$J,1,
 ;---> BWA=1 SAYS INCLUDE PATIENTS WITH UNDETERMINED NEEDS.
 ;---> 5 & 8 ARE IENS IN ^BWCUR AND ^BWMAMT GLOBALS FOR "UNDETERMINED".
 ;
 K ^TMP("BW",$J) N N,Y
 S N=0
 F  S N=$O(^BWP(N)) Q:'N  D
 .S Y=^BWP(N,0)
 .;---> QUIT IF PATIENT IS INACTIVE.
 .Q:$P(Y,U,24)
 .;---> QUIT IF LOOKING FOR ONE CASE MANAGER AND THIS DOESN'T MATCH.
 .I 'BWE Q:$P(Y,U,10)'=BWMGR
 .;---> QUIT IF NOT SELECTING ALL CURRENT COMMUNITIES AND IF THIS
 .;---> IS NOT ONE OF THE SELECETED.
 .I '$D(BWCC("ALL")) S X=$$CURCOM^BWUTL1(N) Q:'X  Q:'$D(BWCC(X))
 .;---> IF BWA=0, DON'T INCLUDE BECAUSE OF UNDETERMINED NEEDS.
 .I 'BWA D  Q
 ..;---> ONLY IF IT'S A SPECIFIED NEED AND IT'S DELINQUENT, INCLUDE.
 ..I 5'[$P(Y,U,11)&($P(Y,U,12)<BWDDATE) D SET Q
 ..I 8'[$P(Y,U,18)&($P(Y,U,19)<BWDDATE) D SET Q
 .;---> IF BWA=1, INCLUDE BECAUSE OF UNDETERMINED NEEDS.
 .I 5[$P(Y,U,11)!(8[$P(Y,U,18)) D SET Q
 .;---> IF EITHER NEED IS DELINQUENT, INCLUDE.
 .I $P(Y,U,12)<BWDDATE!($P(Y,U,19)<BWDDATE) D SET
 Q
 ;
 ;
COPYGBL ;EP
 ;---> COPY ^TMP("BW",$J,1 TO ^TMP("BW",$J,2 TO MAKE IT FLAT.
 N I,M,N
 S N=-1,I=0
 F  S N=$O(^TMP("BW",$J,1,N)) Q:N=""  D
 .S M=-1
 .F  S M=$O(^TMP("BW",$J,1,N,M)) Q:M=""  D
 ..S I=I+1,^TMP("BW",$J,2,I)=^TMP("BW",$J,1,N,M)
 Q
 ;
SET ;EP
 ;---> SORT SEQUENCE IN BWB: 1=DELINQ DATE (DEFAULT), 2=PATIENT NAME
 N Z S BWDFN=$P(Y,U) D PATVARS^BWUTL3(BWDFN)
 S Z=BWCHRT_U_BWNAME_U_BWCMGR_U_BWCNEED_U_BWBNEED_U_BWDFN
 I BWB=1 D  Q
 .S BWPDAT=+$P(Y,U,12),BWMDAT=+$P(Y,U,19)
 .S ^TMP("BW",$J,1,$S(BWPDAT<BWMDAT:BWPDAT,1:BWMDAT),BWNAME)=Z
 S ^TMP("BW",$J,1,BWNAME,BWDFN)=Z
 Q
 ;
 ;
DEQUEUE ;EP
 ;---> TASKMAN QUEUE OF PRINTOUT.
 D SETVARS^BWUTL5,SORT,COPYGBL,^BWBRNED1,EXIT
 Q
 ;
TEXT1 ;EP
 ;;
 ;;You may browse needs for patients living in one or more specific
 ;;communities, or you may select all communities.  "Community" in this
 ;;context refers to the patient's "Current Community" as displayed and
 ;;edited in the IHS Registration software.
 S BWTAB=3,BWLINL="TEXT1" D PRINTX
 Q
 ;
PRINTX ;EP
 N I,T,X S T="" F I=1:1:BWTAB S T=T_" "
 F I=1:1 S X=$T(@BWLINL+I) Q:X'[";;"  W !,T,$P(X,";;",2)
 Q