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

BWUTL8.m

Go to the documentation of this file.
BWUTL8 ;IHS/ANMC/MWR - UTIL: PATLKUP, SELECT, KILLALL;15-Feb-2003 22:15;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY: PATIENT LOOKUP, SELECT FOR REPORT, KILLALL.
 ;
PATLKUP(Y,BWADD,BWCDC,DUZ2,BWPOP) ;EP
 ;---> BW PATIENT LOOKUP.
 ;---> PARAMETERS:
 ;     1 - Y             (RETURNED) PATIENT DFN OR -1 IF FAILED.
 ;     2 - BWADD         (OPTIONAL) EQUALS "ADD" IF ADD CAPABILITY
 ;     3 - BWCDC         (OPTIONAL) EQUALS "NOCDC" IF CDC UNIQUE ID#
 ;                                  SHOULD NOT BE ASKED.
 ;     4 - DUZ2=DUZ(2)   (OPTIONAL) IF NOT SET, WILL=ENVIROMENTAL DUZ(2)
 ;     5 - BWPOP         (RETURNED) BWPOP=1 IF DTOUT OR DUOUT
 ;
 ;---> EXAMPLE: D PATLKUP^BWUTL8(.Y)
 ;              D PATLKUP^BWUTL8(.Y,"ADD") - MAY ADD PATIENT TO WH.
 ;
 N DFN,DIC,X
PATLKUP1 ;---> RETURN HERE IF LOOKUP FAILED FOR SEX OR AGE.
 ;---> SET VARIABLES: Y=DFN,BWPOP=1 FOR QUIT.
 S BWPOP=0 D SETVARS^BWUTL5
 S:$G(DUZ2)]"" DUZ(2)=DUZ2
 S DIC="^AUPNPAT(",DIC(0)="AEMQ"
 S DIC("S")="I $P(^DPT(Y,0),U,2)=""F"""
 D ^DIC
 Q:$D(DUOUT)!($D(DTOUT))
 ;
 ;---> IF LOOKUP FAILS, AND IF CDC EXPORT SITE PARAMETER=YES,
 ;---> TRY LOOKUP ON CDC UNIQUE ID#.
 I Y<0,$$CDC^BWUTL5(DUZ(2)),$G(BWCDC)'="NOCDC" D UNIQUE(.Y)
 ;
 Q:Y<0
 S (DFN,Y)=+Y
 ;---> IF PATIENT ALREADY EXISTS IN BW PATIENT FILE, QUIT.
 Q:$D(^BWP(DFN,0))
 ;
 ;---> IF PATIENT IS NOT FEMALE, PROMPT USER.
 I '$$SEX^BWUTL1(DFN) D  G PATLKUP1
 .W !!?3,$$NAME^BWUTL1(DFN)," is not female." D DIRZ^BWUTL3
 ;
 ;---> QUIT IF NO ADD ("LAYGO") CAPABILITY.
 I $G(BWADD)'="ADD" D  G PATLKUP1
 .W !!?3,$$NAME^BWUTL1(DFN)
 .W " is not currently in the Women's Health database." D DIRZ^BWUTL3
 ;
 ;---> ASK TO ADD AS A NEW PATIENT.
 W !!?3,$$NAME^BWUTL1(DFN)
 ;---> IF PATIENT IS UNDER 12 YEARS, PROMPT USER.
 W:+$$AGE^BWUTL1(DFN)<12 " is under 12 years of age,",!?3,"and she"
 W " is not currently in the Women's Health database."
 W !?3,"Do you wish to add her to the Women's Health Database?"
 S DIR("?",1)="     Enter YES to ADD this patient to the Women's Health"
 S DIR("?",1)=DIR("?",1)_" database."
 S DIR("?")="     Enter NO to quit without adding her to the database."
 S DIR(0)="Y",DIR("A")="   Enter Yes or No"
 D ^DIR W !
 I $D(DIRUT) S Y=-1 Q
 G:Y=0 PATLKUP1
 D AUTOADD^BWPATE(DFN,DUZ(2),.Y,1)
 Q
 ;
UNIQUE(Y) ;EP
 ;---> TRY PATIENT LOOKUP ON CDC UNIQUE ID#.
 ;---> PARAMETERS:
 ;     1 - Y             (RETURNED) PATIENT DFN OR -1 IF FAILED.
 ;
 N D,DIC,DIR
 W !!?3,"Do you wish to search for a patient by her CDC Unique ID#?"
 S DIR("?",1)="     Enter YES to search for a patient by entering her"
 S DIR("?",1)=DIR("?",1)_" CDC Unique ID#"
 S DIR("?",2)="     as reported by the MDE Edit Program."
 S DIR("?")="     Enter NO to quit without searching by CDC Unique ID#."
 S DIR(0)="Y",DIR("A")="   Enter Yes or No",DIR("B")="NO"
 D ^DIR W !
 I $D(DIRUT) S Y=-1 Q
 I Y=0 S Y=-1 Q
 S DIC="^BWP(",DIC(0)="QEA",D="CDC"
 D IX^DIC S Y=+Y
 Q
 ;
 ;
KGBL(GBL) ;EP
 ;---> KILL A GLOBAL.  GBL SHOULD INCLUDE THE LEADING "^".
 S:GBL["(" GBL=$P(GBL,"(")
 F  S GBL=$Q(@GBL) Q:GBL=""  K @GBL
 Q
 ;
ZGBL(GBL) ;EP
 ;---> ZERO OUT (DELETE ALL DATA) IN A FILEMAN FILE.
 ;---> GBL SHOULD INCLUDE THE LEADING "^".
 N N,X
 S:GBL["(" GBL=$P(GBL,"(")
 Q:'$D(@(GBL_"(0)"))
 S N=0,X=$P(@(GBL_"(0)"),U,1,2)
 F  S N=$O(@(GBL_"("""_N_""")")) Q:N=""  K @(GBL_"("""_N_""")")
 S @(GBL_"(0)")=X
 Q
 ;
KILLALL ;EP
 ;---> CLEAN UP VARIABLES.
 ;---> MSM
 ;S X="BW" F  S X=$O(@X) Q:$E(X,1,2)'="BW"  K @X
 ;S X="DI" F  S X=$O(@X) Q:$E(X,1,2)'="BW"  K @X
 ;---> DSM
 ;S X="BW" F  S X=$ZSORT(@X) Q:$E(X,1,2)'="BW"  K @X
 ;S X="DI" F  S X=$ZSORT(@X) Q:$E(X,1,2)'="BW"  K @X
 ;
 ;---> REPLACE KILLS BELOW WITH $O COMMANDS ABOVE WHEN AVAILABLE.
 K BW,BW0,BW1,BW1DX,BW2,BW2DX,BWA,BWABBV,BWABBVS,BWACC
 K BWACCN,BWACCP,BWADD,BWAGE,BWAGENCY,BWAGRG,BWAGRP,BWAR,BWAREA
 K BWARR,BWARR1,BWASKTIM,BWATT,BWB,BWBDF,BWBEGDF,BWBEGDT
 K BWBEGDT1,BWBNEED,BWC,BWC0,BWCAPT,BWCBEDA,BWCC,BWCDC,BWCDCV,BWCHAGE
 K BWCHG,BWCHRT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