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

APCLPRPM.m

Go to the documentation of this file.
APCLPRPM ; IHS/CMI/LAB - driver for primary care provider report ;
 ;;2.0;IHS PCC SUITE;**2,7**;MAY 14, 2009
 ;
 W:$D(IOF) @IOF
 W !,"This report will generate a list of patients for a specific Designated Primary Care"
 W !,"Provider or a list of patients for all Primary Care Providers at this facility."
 I '$G(DUZ(2)) W !!!,$C(7),$C(7),"SITE NOT SET IN YOUR USER PROFILE!  Please notify your Site Manager!" Q
ASK ;
 S APCLPROV=""
 S DIR(0)="S^1:ONE PROVIDER;2:ALL PROVIDERS",DIR("A")="Run the report for",DIR("B")=1 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 G:$D(DIRUT) EOJ
 G:Y=2 ZIS
PROV ;
 ;
 S DIC=$S($P(^DD(9000010.06,.01,0),U,2)[200:200,1:6),DIC("A")="Enter PROVIDER: ",DIC(0)="AEMQ" D ^DIC K DIC
 I Y=-1 G ASK
 S APCLPROV=+Y
 S APCLPRV=$S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,+Y,0),U),1:$P(^DIC(16,+Y,0),U))
ZIS ;
 ;S FLDS="[APCL PRIM PROV LISTING]",BY=$S(APCLPROV="":"#.14",1:"@INTERNAL(#.14)"),DIC="^AUPNPAT(",L=0 I APCLPROV S DHD="[APCL PRIM PROV HEADING]"
 ;S FR=$S(APCLPROV="":"",1:APCLPROV),TO=$S(APCLPROV="":"",1:APCLPROV)
 ;K DHIT,DIOEND,DIOBEG
 ;D EN1^DIP
DEMO ;
 D DEMOCHK^APCLUTL(.APCLDEMO)
 I APCLDEMO=-1 G ASK
 S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to ",DIR("B")="P" K DA D ^DIR K DIR
 I $D(DIRUT) G EOJ
 S APCLBROW=Y
 I $G(Y)="B" D BROWSE,EOJ Q
 W !! S XBRP="PRINT^APCLPRPM",XBRC="PROC^APCLPRPM",XBNS="APCL",XBRX="EOJ^APCLPRPM"
 D ^XBDBQUE
 D EOJ
 Q
BROWSE ;
 S XBRP="VIEWR^XBLM(""PRINT^APCLPRPM"")"
 S XBNS="APCL",XBRC="PROC^APCLPRPM",XBRX="EOJ^APCLPRPM",XBIOP=0 D ^XBDBQUE
 Q
 ;
PAUSE ; 
 S DIR(0)="E",DIR("A")="Press return to continue or '^' to quit" D ^DIR K DIR,DA
 S:$D(DIRUT) APCLQUIT=1
 W:$D(IOF) @IOF
 Q
EOJ ;
 D EN^XBVK("APCL")
 K L,M,S,T,X,X1,X2,Y,Z,B
 D KILL^AUPNPAT
 D ^XBFMK
 Q
PROC ;
 S APCLJOB=$J,APCLBTH=$H,APCLTOT=0,DFN=0,APCLBT=$H
 D XTMP^APCLOSUT("APCLPRPM","PCC - DESIGNATED PROV REPORT")
 I APCLPROV]"" D PROC0 Q
 F  S APCLPROV=$O(^AUPNPAT("AK",APCLPROV)) Q:APCLPROV'=+APCLPROV  D PROC0
 S APCLET=$H
 K DFN
 Q
PROC0 ;
 S DFN=0 F  S DFN=$O(^AUPNPAT("AK",APCLPROV,DFN)) Q:DFN'=+DFN  D PROC1
 Q
PROC1 ;
 Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))
 S ^XTMP("APCLPRPM",APCLJOB,APCLBTH,APCLPROV,DFN)=""
 Q
PRINT ;
START ;
 S APCL80D="-------------------------------------------------------------------------------"
 S APCLPG=0
 I '$D(^XTMP("APCLPRPM",APCLJOB,APCLBTH)) D HEAD W !!,"NO PATIENTS TO REPORT" G DONE
 I APCLBROW="B" D HEAD
 S APCLPROV=0 F  S APCLPROV=$O(^XTMP("APCLPRPM",APCLJOB,APCLBTH,APCLPROV)) Q:APCLPROV'=+APCLPROV!($D(APCLQ))  D
 .S DFN="",APCLSUB=0 K APCLQ
 .I APCLBROW="P" D HEAD Q:$D(APCLQ)
 .I APCLBROW="B" W !!
 .W ?9,"PRIMARY CARE PROVIDER:  "_$$VAL^XBDIQ1(200,APCLPROV,.01),!
 .F  S DFN=$O(^XTMP("APCLPRPM",APCLJOB,APCLBTH,APCLPROV,DFN)) Q:DFN=""!($D(APCLQ))  D DFN
 .Q:$D(APCLQ)
 .I $Y>(IOSL-3) D HEAD Q:$D(APCLQ)
 .W !,"Total # of Patients for ",$$VAL^XBDIQ1(200,APCLPROV,.01),":  ",APCLSUB,!
 G:$D(APCLQ) DONE
DONE D DONE^APCLOSUT
 K ^XTMP("APCLPRPM",APCLJOB,APCLBTH),APCLJOB,APCLBTH
 Q
DFN ;
 I $Y>(IOSL-6) D HEAD Q:$D(APCLQ)
 D LVST
 W $E($P(^DPT(DFN,0),U),1,20),?24,$$UP^XLFSTR($$DOB^AUPNPAT(DFN,"E")),?40,$$HRN^AUPNPAT(DFN,DUZ(2)),?50,$E($$COMMRES^AUPNPAT(DFN,"E"),1,15),?66,APCLDT,!
 S APCLSUB=APCLSUB+1
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQ="" Q
HEAD1 ;
 I APCLPG W:$D(IOF) @IOF
 S APCLPG=APCLPG+1
 W $P(^VA(200,DUZ,0),U,2)
 W ?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),!
 W ?5,"DESIGNATED PROVIDER PATIENT LISTING    "_$$FMTE^XLFDT($$NOW^XLFDT)_"    PAGE  "_APCLPG,!
 W ?50,"CURRENT",!
 W "NAME",?24,"DOB",?40,"HRN",?50,"COMMUNITY",?66,"LAST VISIT",!,APCL80D,!
 Q
LVST ;ENTRY POINT from [APCL PRIM PROV LISTING print template
 S APCLAST=""
 S APCLVDFN=""
 S APCLAST=$O(^AUPNVSIT("AA",DFN,""))
 I APCLAST="" S APCLAST="NONE FOUND" Q
 S APCLVDFN=$O(^AUPNVSIT("AA",DFN,APCLAST,""))
 S Y=$P(^AUPNVSIT(APCLVDFN,0),U)
 D DD^%DT S APCLDT=$E(Y,1,12)
 Q