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

APCLBP.m

Go to the documentation of this file.
  1. APCLBP ; IHS/CMI/LAB - AGE BUCKET/DIAGNOSIS REPORT ;
  1. ;;2.0;IHS PCC SUITE;**10,15**;MAY 14, 2009;Build 11
  1. ;
  1. ; If APCLREP (repeat) = 1 then the last tag executed in APCLTAG is
  1. ; repeated.
  1. ; If DIRUT = 1 execution starts at the tag in APCLTAG that is the one
  1. ; before the last one executed.
  1. START ;
  1. S APCLERR=0,APCLREP=0,APCLTAGS="ASKPT\CMMNTS\CLINIC\DATERNG\AGE\SEX\INDBEN\RTYPE\ZIS"
  1. W !!?15,"***** BLOOD PRESSURE OUT OF CONTROL REPORT *****",!!
  1. D DESCR
  1. F APCLI=1:1:$L(APCLTAGS,"\") D @($P(APCLTAGS,"\",APCLI)) Q:APCLERR Q:$G(Y)="^^" S:APCLREP APCLREP=0,APCLI=APCLI-1 I $D(DIRUT) Q:APCLI=1 S APCLI=APCLI-2
  1. D EXIT
  1. Q
  1. ;
  1. ; Ask to search all patients or use a template
  1. ASKPT ;
  1. S APCLTYPE=""
  1. S APCLSEAT=""
  1. K DIR,X,Y
  1. S DIR(0)="S^S:Search Template of Patients;P:Search All Patients"
  1. S DIR("A")=" Select List " D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S APCLTYPE=Y
  1. D:APCLTYPE="S" TEMPLATE
  1. Q
  1. ;
  1. ; Template was selected
  1. TEMPLATE ;
  1. ;
  1. W ! S DIC("S")="I $P(^(0),U,4)=9000001" S DIC="^DIBT(",DIC("A")="Enter Visit SEARCH TEMPLATE name: ",DIC(0)="AEMQ" D ^DIC K DIC,DA,DR,DICR
  1. S:$D(DUOUT)!$D(DIRUT) APCLREP=1 S:Y<0 APCLREP=1
  1. ; If APCLREP = 1 the program will return to ASKPT (the last tag executed in the main for loop)
  1. I APCLREP K DIRUT,APCLTYPE Q
  1. S APCLSEAT=+Y
  1. Q
  1. ;
  1. ; Ask for communities
  1. CMMNTS ;
  1. K APCLCOMM
  1. S DIR(0)="S^O:One particular Community;A:All Communities;S:Selected Set of Communities (Taxonomy)",DIR("A")="List patients who live in",DIR("B")="O" K DA D ^DIR K DIR
  1. Q:$D(DIRUT)
  1. I Y="A" W !!,"Patients from all communities will be included in the report.",! Q
  1. I Y="O" D S:'$D(APCLCOMM) APCLREP=1 Q
  1. .S DIC="^AUTTCOM(",DIC(0)="AEMQ",DIC("A")="Which COMMUNITY: " D ^DIC K DIC
  1. .Q:Y=-1
  1. .S APCLCOMM($P(^AUTTCOM(+Y,0),U))=""
  1. S X="COMMUNITY",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" S APCLERR=1 Q
  1. D PEP^AMQQGTX0(+Y,"APCLCOMM(")
  1. I '$D(APCLCOMM) S APCLREP=1 Q
  1. I $D(APCLCOMM("*")) K APCLCOMM
  1. Q
  1. ;
  1. ; Ask for Clinic
  1. CLINIC ;
  1. K APCLCLNT
  1. W ! S DIR(0)="Y",DIR("A")="Include visits to ALL clinics",DIR("B")="Yes" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q:$D(DIRUT)
  1. Q:Y=1
  1. S X="CLINIC",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 S APCLERR=1 W "OOPS - QMAN NOT CURRENT - QUITTING" Q
  1. D PEP^AMQQGTX0(+Y,"APCLCLNT(")
  1. I '$D(APCLCLNT) S APCLREP=1 Q
  1. I $D(APCLCLNT("*")) K APCLCLNT
  1. Q
  1. ;
  1. ; Ask for date range
  1. DATERNG ;
  1. BD ; Ask starting date
  1. I $D(DIRUT) S APCLI=APCLI-3 K DIRUT Q ; temporary line
  1. S APCLSD=0,APCLED=9999999
  1. W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Visit Date" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q:$D(DIRUT)
  1. S APCLBD=Y,APCLSD=9999999-Y
  1. D ED
  1. Q
  1. ;
  1. ED ; ask ending date
  1. W ! S DIR(0)="DA^"_APCLBD_":DT:EP",DIR("A")="Enter ending Visit Date: " S Y=APCLBD D DD^%DT S Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S:$D(DUOUT)!$D(DIRUT) APCLREP=1 S:Y<0 APCLREP=1
  1. ; If APCLREP = 1 the program will return to BD (the last tag executed in the main for loop)
  1. I APCLREP K DIRUT,APCLTYPE Q
  1. S APCLED=9999999-Y
  1. Q
  1. ;
  1. AGE ;
  1. W !
  1. K APCLAGER
  1. S DIR(0)="FO^1:7",DIR("A")="Enter a Range of Ages (e.g. 5-12) [HIT RETURN TO INCLUDE ALL RANGES]" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I Y="" W !!,"No age range entered. All ages will be included." K DIRUT Q
  1. Q:$D(DIRUT)
  1. I Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter an age range in the format nnn-nnn. E.g. 2-5, 12-74, 5-20." S APCLREP=1 Q
  1. I $P(Y,"-")<2 W !,$C(7),"Cannot run for patients under 2." S APCLREP=1 Q
  1. ;I $P(Y,"-",2)>74 W !,$C(7),"Cannot run for patients over 74." S APCLREP=1 Q
  1. S APCLAGER=Y
  1. Q
  1. ;
  1. SEX ;
  1. S DIR(0)="S^M:Males;F:Females;U:Unknown Gender;B:ALL Genders",DIR("A")="Report should include",DIR("B")="B" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S APCLSEX=Y
  1. Q
  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. S APCLIBEN=Y
  1. Q
  1. ;
  1. ; Ask if suppressing identifying information
  1. IDENT ;
  1. S DIR(0)="S^P:Patient Name;C:Chart #;B:Both;N:Neither",DIR("A")="Do you wish to suppress patient identifying data",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S:$D(DUOUT)!$D(DIRUT) APCLREP=1 S:Y<0 APCLREP=1
  1. ; If APCLREP = 1 the program will return to RTYPE (the last tag executed in the main for loop)
  1. I APCLREP K DIRUT,APCLTYPE Q
  1. S APCLIDEN=$S(Y="P":1,Y="C":10,Y="B":11,1:0)
  1. Q
  1. ;
  1. ; Ask if Detail or Summary type report
  1. RTYPE ;
  1. S DIR(0)="S^D:Detail;S:Summary;C:Cohort/Template Save",DIR("A")="Report type should be",DIR("B")="D" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S APCLRTYP=Y
  1. Q:APCLRTYP="S"!$D(DIRUT)
  1. I APCLRTYP="D" D SORT Q
  1. ; Create a cohort/template
  1. D ^APCLSTMP
  1. I X="^^" S Y="^^" Q
  1. S:$D(DUOUT)!$D(DIRUT) APCLREP=1 S:$G(Y)<0 APCLREP=1
  1. K:APCLREP DIRUT
  1. Q
  1. ;
  1. SORT ;
  1. S DIR(0)="S^P:Patient Name;A:Age of Patient",DIR("A")="Sort the report by",DIR("B")="P" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S:$D(DUOUT)!$D(DIRUT) APCLREP=1 S:Y<0 APCLREP=1
  1. ; If APCLREP = 1 the program will return to RTYPE (the last tag executed in the main for loop)
  1. I APCLREP K DIRUT,APCLTYPE Q
  1. S APCLSORT=Y
  1. W ! D IDENT
  1. Q
  1. ;
  1. DESCR ;
  1. W ?26,"LIST OF BLOOD PRESSURE OUT OF CONTROL PATIENTS"
  1. W !!,"This report will produce a listing of all patients for the specified age, sex,"
  1. W !,"communities, clinic and time period, who are considered out of control based on",!,"their mean Systolic or Diastolic blood pressure .",!
  1. W !,"Out of Control is defined as greater than or equal to 140/90."
  1. Q
  1. ;
  1. ZIS ;
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.APCLDEMO)
  1. I APCLDEMO=-1 G RTYPE
  1. S XBRC="^APCLBP1",XBNS="APCL",XBRX=""
  1. S XBRP=$S(APCLRTYP'="C":"^APCLBPP",1:"")
  1. D ^XBDBQUE
  1. Q
  1. ;
  1. EXIT ;
  1. K APCL80,APCLA,APCLAGE,APCLAGER,APCLBD,APCLBHGH,APCLBMI,APCLBPC,APCLBPTY,APCLBPX,APCLBTH,APCLBTYP,APCLCBC,APCLCHT,APCLCLAS,APCLCLIN,APCLCLNC,APCLCMTS,APCLCMTY,APCLCOMM,APCLCPT,APCLCTB,APCLDT,APCLDTL,APCLED
  1. K APCLEDD,APCLER,APCLERR,APCLI,APCLIBEN,APCLIDEN,APCLJOB,APCLLENG,APCLMDBP,APCLMGI,APCLMHT,APCLMIEN,APCLMSBP,APCLMWT,APCLNAME,APCLOCTL,APCLPCT,APCLPG,APCLPTOT,APCLQUIT,APCLREF,APCLREP,APCLROHT,APCLROWT,APCLRPT
  1. K APCLRTYP,APCLSD,APCLSDD,APCLSEAT,APCLSEX,APCLSEXP,APCLSORT,APCLSRT,APCLTAGS,APCLTBP,APCLTDBP,APCLTOBC,APCLTOBP,APCLTOP,APCLTPOC,APCLTPT,APCLTSBP,APCLTYPE,APCLX,APCLY,DA,DFN,DIC,DIR,DIRUT,J,K,M,R,S,X,X1
  1. K X2,XBNS,XBRC,XBRP,XBRX,Y
  1. Q