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

BWUTL3.m

Go to the documentation of this file.
BWUTL3 ;IHS/ANMC/MWR - UTIL: DATE, LOCK, DIR, PATVARS;12-Feb-2003 10:41;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY: ASK DATE RANGE, LOCKS, DIR PROMPTS, STORE/DEL EDC,
 ;;  STORE PAP REGIMEN, PCDVARS & PATVARS.
 ;
 ;
OUT ;EP
 ;---> CALLED AFTER ERROR MESSAGES ARE DISPLAYED.
 S BWPOP=1 D DIRZ
 Q
 ;
ASKDATES(BWB,BWE,BWPOP,BWBDF,BWEDF,BWSAME,BWTIME) ;EP
 ;---> ASK DATE RANGE.
 ;---> PARAMETERS:
 ;     1 - BWB    (RETURNED) BEGIN DATE, FILEMAN FORMAT
 ;     2 - BWE    (RETURNED) END DATE, FILEMAN FORMAT
 ;     3 - BWPOP  (RETURNED) BWPOP=1 IF QUIT,FAIL,DTOUT,DUOUT
 ;     4 - BWBDF  (OPTIONAL) BEGIN DATE DEFAULT, FILEMAN FORMAT
 ;     5 - BWEDF  (OPTIONAL) END DATE DEFAULT, FILEMAN FORMAT
 ;     6 - BWSAME (OPTIONAL) FORCE END DATE DEFAULT=BEGIN DATE
 ;     7 - BWTIME (OPTIONAL) ASK TIMES
 ;
 ;---> EXAMPLE:
 ;        D ASKDATES^BWUTL3(.BWBEGDT,.BWENDDT,.BWPOP,"T-365","T")
 ;
 S BWPOP=0 N %DT,Y
 W !!,"   *** Date Range Selection ***"
 S %DT="APEX"_$S($D(BWTIME):"T",1:"")
 S %DT("A")="   Begin with DATE: "
 I $G(BWBDF)]"" S Y=BWBDF D DD^%DT S %DT("B")=Y
 D ^%DT K %DT
 I Y<0 S BWPOP=1 Q
 S (%DT(0),BWB)=Y K %DT("B")
 S %DT="APEX"_$S($D(BWTIME):"T",1:"")
 S %DT("A")="   End with DATE..: " ;IHS/CMI/THL PATCH 8
 I $G(BWEDF)]"" S Y=BWEDF D DD^%DT S %DT("B")=Y
 I $D(BWSAME) S Y=BWB D DD^%DT S %DT("B")=Y
 D ^%DT K %DT
 I Y<0 S BWPOP=1 Q
 S BWE=Y
 Q
 ;
LOCKED ;EP
 W !?5,"Another user is editing this entry.  Please, try again later."
 D DIRZ
 Q
 ;
LOCKEDE ;EP
 ;---> LOCKED PREGNANCY LOG ENTRY.
 W !?5,"Another user is editing the Pregnancy Log for this patient"
 W !?5,"for this day.  Please, try again later."
 D DIRZ
 Q
 ;
LOCKEDP ;EP
 ;---> LOCKED PREGNANCY LOG ENTRY.
 W !?5,"Another user is editing the PAP Regimen Log for this patient"
 W !?5,"for this day.  Please, try again later."
 D DIRZ
 Q
 ;
 ;
DIRZ ;EP
 ;---> PRESS RETURN TO CONTINUE.
 N DIR,DIRUT,X,Y
 I $D(BWPRMT) S DIR("A")=BWPRMT
 I $D(BWPRMT1) S DIR("A",1)=BWPRMT1
 I $D(BWPRMT2) S DIR("A",2)=BWPRMT2
 I $D(BWPRMTQ) S DIR("?")=BWPRMTQ
 S DIR(0)="E" W ! D ^DIR W !
 S BWPOP=$S($D(DIRUT):1,Y<1:1,1:0)
 Q
 ;
DIRPRMT ;EP
 ;---> REQUIRED VARIABLE: BWPROMPT,M (M=LAST SELECTION# DISPLAYED)
 ;---> OPTIONAL VARIABLE: BWCODE (EXECUTABLE CODE ACTING ON INPUT X)
 ;---> BWD=1 IF RANGE OF SELECTION NUMBERS SHOULD BE DISPLAYED.
 N DIR,DIRUT,Y
 W ! S:'$D(BWD) BWD=0
 S DIR(0)="LO^"_$S(BWD:":"_M,1:"1:"_M)
 I $D(BWPRMT) S DIR("A")=BWPRMT
 I $D(BWPRMT1) S DIR("A",1)=BWPRMT1
 I $D(BWPRMT2) S DIR("A",2)=BWPRMT2
 I $D(BWPRMTQ) S DIR("?")=BWPRMTQ
 I $D(BWCODE) S DIR(0)=DIR(0)_U_BWCODE
 D ^DIR
 S:$D(DTOUT)!($D(DUOUT)) BWPOP=1
 Q
 ;
STOREDC ;EP
 ;---> STORE PREGNANCY AND EDC, CALLED BY MUMPS XREF ON FIELDS #.13
 ;---> AND #.14 IN BW PATIENT FILE.  NOTE: WHEN AN EDIT IS DONE,
 ;---> FIRST KILL AND THEN SET LOGIC OF THE MUMPS XREF IS EXECUTED;
 ;---> BUT FOR A DELETE (@), ONLY THE KILL LOGIC IS EXECUTED.
 ;---> REQUIRED VARIABLES: BWDFN, BWPREG=PREGNANT(1=YES,0=NO), BWEDC=EDC
 Q:'$D(BWEDC)!('$D(BWPREG))!('$D(BWDFN))
 Q:'BWDFN
 N (BWEDC,BWPREG,BWDFN,DT,DTIME,DUZ,N,U) D SETVARS^BWUTL5
 D NOW^%DTC S DT=X K X
 S BWQUIT=0,DLAYGO=9002086
 I BWPREG="" D DELETEDC Q
 S:BWPREG=0 BWEDC=0
 S DIE="^BWEDC(",DR=".03////"_BWPREG_";.04////"_+BWEDC
 S DR=DR_";.05///NOW;.06////"_DUZ
 S N=0
 F  S N=$O(^BWEDC("C",BWDFN,N)) Q:'N  D
 .I $D(^BWEDC("B",DT,N)) S DA=N D
 ..L +^BWEDC(DA):0 I '$T D LOCKEDE S BWQUIT=1 Q
 ..D DIE^BWFMAN(9002086.05,DR,DA) L -^BWEDC(DA) S BWQUIT=1
 Q:BWQUIT
 ;
 K DD,DO
 S DIC="^BWEDC(",DIC(0)="L",X=DT,DLAYGO=9002086
 S DIC("DR")=".02////"_BWDFN_";.03////"_BWPREG_";.04////"_+BWEDC
 S DIC("DR")=DIC("DR")_";.05///NOW;.06////"_DUZ
 D FILE^DICN
 Q
 ;
DELETEDC ;EP
 ;---> DELETE PREGANCY LOG ENTRY FOR THIS DAY (DT).
 S DIK="^BWEDC("
 S N=0
 F  S N=$O(^BWEDC("C",BWDFN,N)) Q:'N  D
 .I $D(^BWEDC("B",DT,N)) S DA=N D ^DIK
 Q
 ;
STORPAP ;EP
 ;---> STORE PAP REGIMEN, START DATE AND DATE ENTERED; CALLED BY
 ;---> MUMPS XREF ON FIELDS #.15 AND #.16 IN BW PATIENT FILE.
 ;---> REQUIRED VARIABLES: BWLDAT=BEGIN DATE, BWLPRG=PAP REGIMEN, BWDFN.
 Q:'$D(BWLDAT)!('$D(BWLPRG))!('$D(BWDFN))
 Q:'BWLDAT!('BWLPRG)!('BWDFN)
 N (BWLDAT,BWLPRG,BWDFN,DT,DTIME,DUZ,U) D SETVARS^BWUTL5
 S BWQUIT=0,DLAYGO=9002086
 S DIE="^BWPLOG("
 S DR=".01////"_BWLDAT_";.03////"_BWLPRG
 S DR=DR_";.05///NOW;.06////"_DUZ
 S N=0
 F  S N=$O(^BWPLOG("C",BWDFN,N)) Q:'N!(BWQUIT)  D
 .I $D(^BWPLOG("B",BWLDAT,N)) S DA=N D
 ..L +^BWPLOG(DA):0 I '$T D LOCKEDP S BWQUIT=1 Q
 ..D DIE^BWFMAN(9002086.04,DR,DA,.BWPOP) L -^BWPLOG(DA) S BWQUIT=1
 Q:BWQUIT
 ;
 K DD,DO
 S DIC="^BWPLOG(",DIC(0)="L",X=BWLDAT,DLAYGO=9002086
 S DIC("DR")=".02////"_BWDFN_";.03////"_BWLPRG
 S DIC("DR")=DIC("DR")_";.05///NOW;.06////"_DUZ
 D FILE^DICN
 Q
 ;
 ;
PCDVARS(DA,TEXTDATE,COLP) ;EP
 ;---> SET VARIABLES FOR PROCEDURE DATA FOR HEADERS.
 ;---> REQUIRED VARIABLES: DA=IEN OF PROCEDURE IN PROC FILE 9002086.1.
 ;--->               TEXTDATE=1 PROVIDE DATE IN TEXT FORMAT,
 ;--->                          OTHERWISE IN NUMERIC FORMAT (1/1/95)
 ;--->                   COLP=1 TO SET BWC0=ASSOC'D COLP IF THIS IS
 ;--->                          A PAP.
 ;---> Y=ZERO NODE OF PROCEDURE, BWACCN=ACCESSION#,
 ;---> BWPCDN=IEN OF PROCEDURE TYPE,
 ;---> BWRESN=IEN OF RESULT/DIAG,BWRES=TEXT OF RESULT/DIAG
 ;---> BWPN=PROCEDURE TYPE, BWDFN=DFN OF PATIENT.
 ;---> BW0=ZERO NODE OF THIS PROCEDURE, BW2=TWO NODE.
 ;---> BWPAP=1=PCD IS A PAP, BWMAM=1=PCD IS A SCREENING MAM.
 ;---> BWC0=ZERO NODE OF ASSOCIATED COLP (IF THIS IS A PAP).
 ;
 N X,Y S (BW0,Y)=^BWPCD(DA,0),BWC0=""
 S BW2=$S($D(^BWPCD(DA,2)):^(2),1:"")
 S COLP=$G(COLP) S:COLP BWC0=$$COLP0^BWUTL4(DA)
 S TEXTDATE=$G(TEXTDATE)
 S BWACCN=$$ACC^BWUTL1(DA)
 S BWPCDN=$P(Y,U,4)
 S X=DA,BWPN=$$PROC^BWUTL1
 S BWRESN=$P(Y,U,5),BWRES=$$DIAG^BWUTL4(BWRESN)
 S X=$P(Y,U,7),BWPROV=$$PROV^BWUTL6
 S BWDFN=$P(Y,U,2) D PATVARS(BWDFN,TEXTDATE)
 S (BWMAM,BWPAP)=0
 ;S:BWPCDN=28 BWMAM=1
 S:"^28^25^26^"[(U_BWPCDN_U) BWMAM=1
 S:BWPCDN=1 BWPAP=1
 Q
 ;
PATVARS(DFN,TEXTDATE) ;EP
 ;---> SET VARIABLES FO PATIENT DATA FOR HEADERS.
 ;---> REQUIRED VARIABLES: BWDFN=IEN OF PATIENT
 ;---> YIELDS: BWNAME=PATIENT NAME, BWCHRT=CHART#
 ;---> BWCMGR=CASE MANAGER, BWCNEED=CX TX NEED,
 ;---> BWPAPRG=PAP REGIMEN, BWBNEED=BR TX NEED, BWEDC=EDC.
 S TEXTDATE=$G(TEXTDATE)
 S BWNAME=$$NAME^BWUTL1(DFN)
 S BWNAMAGE=$$NAMAGE^BWUTL1(DFN)
 S BWCHRT=$$HRCN^BWUTL1(DFN)
 S BWCMGR=$$CMGR^BWUTL1(DFN)
 S BWCNEED=$$CNEED^BWUTL1(DFN,TEXTDATE)
 S BWPAPRG=$$PAPRG^BWUTL1(DFN,TEXTDATE)
 S BWBNEED=$$BNEED^BWUTL1(DFN,TEXTDATE)
 S BWEDC=$$EDC^BWUTL1(DFN)
 Q