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

APCLDP1.m

Go to the documentation of this file.
APCLDP1 ; IHS/CMI/LAB - ACTIVE CLIENT LIST ;
 ;;2.0;IHS PCC SUITE;**2,7**;MAY 14, 2009
 ;
START ;
 D XIT
 I '$D(IOF) D HOME^%ZIS
 W @(IOF),!!
 W "**  PATIENTS BY DESIGNATED PRIMARY CARE PROVIDER, WITH VISIT COUNTS, DX'S **",!
 W "This report will produce a list of patients by their Designated Primary ",!,"Care Provider.  It will include the patient's name, chart #, age, "
 W !,"number of times seen by the Designated Primary Care Provider, number of times "
 W !,"seen by other primary providers and diagnoses.",!
GETDATES ;
BD ;get beginning date
 W !,"Please enter the date range during which the patient should have been seen.",!
 W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Date" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G XIT
 S APCLBD=Y
ED ;get ending date
 W ! S DIR(0)="DA^"_APCLBD_":DT:EP",DIR("A")="Enter ending Date:  " S Y=APCLBD D DD^%DT S Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G BD
 S APCLED=Y
 S X1=APCLBD,X2=-1 D C^%DTC S APCLSD=X S Y=APCLBD D DD^%DT S APCLBDD=Y S Y=APCLED D DD^%DT S APCLEDD=Y
 ;
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) GETDATES
 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 ;
DEMO ;
 D DEMOCHK^APCLUTL(.APCLDEMO)
 I APCLDEMO=-1 G ASK
 S XBRC="PROC^APCLDP1",XBRP="^APCLDP1P",XBNS="APCL",XBRX="XIT^APCLDP1"
 D ^XBDBQUE
XIT K ZTSK,Y,APCLBD,APCLED,IO("Q"),APCL80D,APCLBTH,APCLHRCN,APCLJOB,APCLLENG,APCLPCNT,APCLPG,APCLNUM,APCLX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D
 K APCLPRNM,APCLPRNT,APCLPROB,APCLPRV,APCLR,APCLRCNT,APCLRLOC,APCLSD,APCLTOT,APCLBDD,APCLBT,APCLEDD,APCLEDO,APCLBDO,APCLBT,APCLFOUN,APCLHIT,APCLID,APCLLINE,APCLP,APCLQ,APCLRCNT,APCLET
 K I,J,K,P,X,Y,Z,%,DDH,DIV,DIU,DFN,DIG,DIW,APCLAGE,APCLPROV,C,D0,DA,DIC,DR,DIQ
 D EN^XBVK("APCL")
 Q
 ;
PROC ;EP - entry point for processing
 S APCLJOB=$J,APCLBTH=$H,APCLTOT=0,DFN=0,APCLBT=$H
 D XTMP^APCLOSUT("APCLDP1","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("APCLDP1",APCLJOB,APCLBTH,APCLPROV,DFN)=""
 Q
VSTS ; process visits
 S APCLR=0,APCLBDO=9999999-APCLBD,APCLEDO=9999999-APCLED,APCLSD=APCLED-1,APCLRCNT=0
 F  S APCLSD=$O(^AUPNVSIT("AA",DFN,APCLSD)) Q:APCLSD>APCLBDO!(APCLSD="")  D
 .S APCLR=0 F  S APCLR=$O(^AUPNVSIT("AA",DFN,APCLSD,APCLR)) Q:APCLR'=+APCLR  D
 ..Q:'$P(^AUPNVSIT(APCLR,0),U,9)
 ..Q:$P(^AUPNVSIT(APCLR,0),U,11)
 ..Q:"ECT"[$P(^AUPNVSIT(APCLR,0),U,7)
 ..S APCLRCNT=APCLRCNT+1 ;COUNT # VISITS
 .Q
 I APCLRCNT'<APCLNUM S ^XTMP("APCLDP1",APCLJOB,APCLBTH,DFN)=""
 Q
 ;