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

APCLW1.m

Go to the documentation of this file.
  1. APCLW1 ; IHS/CMI/LAB - AGE BUCKET/DIAGNOSIS REPORT ;
  1. ;;2.0;IHS PCC SUITE;**2,10**;MAY 14, 2009;Build 88
  1. ;
  1. START ;
  1. W !!?15,"***** OVERWEIGHT/OBESITY PREVALENCE REPORT *****",!!
  1. D EXIT
  1. S APCLSEAT="",APCLCMS=""
  1. S APCLTYPE=""
  1. ;
  1. S DIR(0)="S^S:Search Template of Patients;P:Search All Patients;R:Case Management System Register"
  1. S DIR("A")=" Select List " D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. G:$D(DIRUT) EXIT
  1. S APCLTYPE=Y
  1. I APCLTYPE="S" D TEMPLATE
  1. I APCLTYPE="R" D R I APCLSTP G START
  1. ;
  1. DATE ;
  1. W !!
  1. S APCLDATE=""
  1. S DIR(0)="D^::EP",DIR("A")="Enter As of Date" KILL DA D ^DIR KILL DIR
  1. G:$D(DIRUT) START
  1. I Y="" G START
  1. I APCLDATE["00" W !!,"cannot be an imprecise date" H 1 W ! G DATE
  1. S APCLDATE=Y
  1. AGE1 ;
  1. S DIR(0)="SO^E:Each Age in Years listed separately;G:Age Groups listed",DIR("A")="Do you want to see the report with",DIR("B")="E" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. G:$D(DIRUT) START
  1. S APCLAGEG=Y
  1. D @Y I '$D(APCLLOWA)!('$D(APCLHGHA)) G START
  1. G SEX
  1. G ;
  1. K APCLLOWA,APCLHGHA D SETBIN
  1. BIN ;
  1. W !,"The Age Groups to be used are currently defined as:",! D LIST
  1. S DIR(0)="Y",DIR("A")="Do you wish to modify these age groups",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) Q
  1. I Y=0 S APCLLOWA=$P(APCLBIN,"-",1) F I=1:1 S X=$P(APCLBIN,";",I) Q:X="" S APCLHGHA=$P(X,"-",2)
  1. Q:Y=0
  1. RUN ;
  1. K APCLQUIT S APCLY="",APCLA=-1 W ! F D AGE Q:APCLX="" I $D(APCLQUIT) G BIN
  1. D CLOSE I $D(APCLQUIT) G BIN
  1. D LIST G BIN
  1. Q
  1. E ;
  1. S DIR(0)="N^2:74:0",DIR("A")="Enter the low age",DIR("B")="2" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q:$D(DIRUT)
  1. S APCLLOWA=Y
  1. S DIR(0)="N^2:74:0",DIR("A")="Enter the high age",DIR("B")="2" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q:$D(DIRUT)
  1. S APCLHGHA=Y
  1. Q
  1. ;
  1. AGE ;
  1. S APCLX=""
  1. S DIR(0)="NO^2:74:0",DIR("A")="Enter the starting age of the "_$S(APCLY="":"first",1:"next")_" age group" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DUOUT)!($D(DTOUT)) S APCLQUIT="" Q
  1. S APCLX=Y
  1. I Y="" Q
  1. I APCLX?1.3N,APCLX>APCLA D SET Q
  1. W $C(7) W !,"Make sure the age is higher the beginning age of the previous group.",! G RUN
  1. ;
  1. SET S APCLA=APCLX
  1. I APCLY="" S APCLY=APCLX Q
  1. S APCLY=APCLY_"-"_(APCLX-1)_";"_APCLX
  1. Q
  1. ;
  1. CLOSE I APCLY="" Q
  1. GC ;
  1. S DIR(0)="NO^2:74:0",DIR("A")="Enter the highest age for the last group" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DUOUT)!($D(DTOUT)) S APCLQUIT="" Q
  1. S APCLX=Y I Y="" S APCLX=74
  1. I APCLX?1.3N,APCLX'<APCLA S APCLY=APCLY_"-"_APCLX,APCLBIN=APCLY Q
  1. W " ??",$C(7) G CLOSE
  1. Q
  1. ;
  1. ;
  1. LIST ;
  1. S %=APCLBIN
  1. F I=1:1 S X=$P(%,";",I) Q:X="" W !,$P(X,"-")," - ",$P(X,"-",2)
  1. W !
  1. Q
  1. ;
  1. SETBIN ;
  1. S APCLBIN="2-4;5-14;15-19;20-24;25-44;45-64;65-74"
  1. Q
  1. SEX ;
  1. S DIR(0)="S^M:Males;F:Females;B:Both",DIR("A")="Do you want the report run for",DIR("B")="B" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. G:$D(DIRUT) START
  1. S APCLSEX=Y
  1. ;
  1. INDBEN ;
  1. W !
  1. S DIR(0)="Y",DIR("A")="Do you wish to include ONLY Indian/Alaska Native Beneficiaries",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DUOUT) G SEX
  1. S APCLIBEN=Y
  1. ZIS ;
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.APCLDEMO)
  1. I APCLDEMO=-1 G INDBEN
  1. S XBRC="^APCLW11",XBRP="^APCLW1P",XBNS="APCL",XBRX="EXIT^APCLW1"
  1. D ^XBDBQUE
  1. D EXIT
  1. Q
  1. EXIT ;
  1. K APCLAGEG,APCLSEX,APCLBIN,APCLX,APCLY,APCLA,APCLQUIT,APCL1YR,APCL3YR,APCL80,APCLA,APCLAGE,APCLAGEP,APCLBBMI,APCLBD,APCLBHGH,APCLBIN,APCLBLOW,APCLBMI,APCLBOBE,APCLBOVR,APCLBTH,APCLBTUP,APCLDATE
  1. K APCLCHT,APCLCWT,APCLDT,APCLER,APCLFBMI,APCLFHGH,APCLFLOW,APCLFOBE,APCLFOVR,APCLFTUP,APCLGHT,APCLGWT,APCLHGHA,APCLJOB,APCLLENG,APCLLOWA,APCLMBMI,APCLMHGH,APCLMHT,APCLMLOW,APCLMOBE,APCLOVRE,APCLMTUP,APCLMWT,APCLNN,APCLPAGE
  1. K APCLPG,APCLQUIT,APCLREF,APCLROHT,APCLROWT,APCLSEX,APCLSEXP,APCLTEXT,APCLX,APCLY,APCLFOBE,APCLMOVR,APCLIBEN,APCLCLAS,APCLWT,APCLHBD
  1. K AUPNSEX,AUPNPAT,AUPNDOB,AUPNDOD,AUPNDAYS
  1. K B,D,DA,DFN,DIC,DIR,DIRUT,J,K,M,P,R,S,T,V,X,X1,X2,Y,Z
  1. K DIR,DA,DIC,J,K,M,S,X,Y,APCLSEAT,APCLTYPE
  1. Q
  1. ;
  1. TEMPLATE ;If Template was selected
  1. S APCLSEAT=""
  1. ;
  1. W ! S DIC("S")="I $P(^(0),U,4)=9000001!($P(^(0),U,4)=2)" S DIC="^DIBT(",DIC("A")="Enter Patient SEARCH TEMPLATE name: ",DIC(0)="AEMQ" D ^DIC K DIC,DA,DR,DICR
  1. I Y=-1 K APCLTYPE Q
  1. S APCLSEAT=+Y
  1. Q
  1. R ;get register and status
  1. S APCLSTP=""
  1. S APCLCMS=""
  1. S DIC="^ACM(41.1,",DIC(0)="AEMQ",DIC("A")="Enter the Name of the Register: " D ^DIC
  1. I Y=-1 W !,"No register selected." S APCLSTP=1 Q
  1. S APCLCMS=+Y
  1. ;get status
  1. S APCLSTAT=""
  1. S DIR(0)="Y",DIR("A")="Do you want to select register patients with a particular status",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) S APCLSTP=1 Q
  1. I Y=0 S APCLSTAT="" Q
  1. ;which status
  1. S DIR(0)="9002241,1",DIR("A")="Which status",DIR("B")="A" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) S APCLSTP=1 Q
  1. S APCLSTAT=Y
  1. Q