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

AMHRP7.m

Go to the documentation of this file.
AMHRP7 ; IHS/CMI/LAB - VISIT COUNTS BY PROVIDER 03 Jun 2009 11:56 AM ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;Designated Provider List
 ;
 W:$D(IOF) @IOF W !!?20,"DESIGNATED PROVIDER LIST",!!
 D DBHUSRP^AMHUTIL
 I '$D(^AMHSITE(DUZ(2),16,"B",DUZ)) W !!,"You will only see a list of patients for which you are the designated",!,"provider, regardless of how you answer the questions below.",!!
PROG ;select program to run report for
 S AMHPROG=""
 S DIR(0)="S^M:MENTAL HEALTH;S:SOCIAL SERVICES;C:CHEMICAL DEPENDENCY or ALCOHOL/SUBSTANCE ABUSE;O:OTHER;T:OTHER NON-RPMS",DIR("A")="Which DESIGNATED PROVIDER",DIR("B")="M" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) D END Q
 S AMHPROG=Y,AMHPROGN=Y(0)
PRV ;
 S DIR(0)="S^1:ONE PROVIDER;2:ALL PROVIDERS",DIR("A")="Run Report for",DIR("B")="1" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G PROG
 S AMHS=Y
 S AMHPRV="" I '$D(^AMHSITE(DUZ(2),16,"B",DUZ)) D  G DEMO
 .S AMHPRV=DUZ
 .W !!,"Reporting on your provider list only.",!!
 I AMHS=1 D
 .I AMHPROG="T" D FT Q
 .S DIC=200,DIC(0)="AEQMZ" D ^DIC Q:Y<0  S AMHPRV=+Y
 I AMHS=1,AMHPRV="" G PROG
DEMO ;
 D DEMOCHK^AMHUTIL1(.AMHDEMO)
 I AMHDEMO=-1 G PRV
ZIS  ;
 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 END
 I $G(Y)="B" D BROWSE,END Q
 S XBRC="M^AMHRP7",XBRP="PRINT^AMHRP7",XBNS="AMH",XBRX="END^AMHRP7"
 D ^XBDBQUE
END K ZTSK,Y,AMHBD,AMHED,AMHCL,AMHS,IO("Q"),AMH80D,AMHBTH,AMHHRCN,AMHJOB,AMHLENG,AMHPCNT,AMHPG,AMHPN,AMHPROG,AMHPROGN,AMHPRV,AMHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D
 Q
 ;
FT ;
 S AMHPRV=""
 S DIR(0)="F^1:30",DIR("A")="Enter the OTHER NON-RPMS Designated Provider's Name" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q
 S AMHPRV=Y
 Q
BROWSE ;
 S XBRP="VIEWR^XBLM(""PRINT^AMHRP7"")"
 S XBNS="AMH",XBRC="M^AMHRP7",XBRX="END^AMHRP7",XBIOP=0 D ^XBDBQUE
 Q
M ;
 S AMHJOB=$J,AMHBTH=$H
 D XTMP^AMHUTIL("AMHRP7","BH - DESIGNATED PROV LIST")
 S DFN=0 F  S DFN=$O(^AMHPATR(DFN)) Q:DFN'=+DFN   D
 .Q:'$$ALLOWP^AMHUTIL(DUZ,DFN)
 .Q:$$DEMO^AMHUTIL1(DFN,$G(AMHDEMO))
 .S AMHX=$S(AMHPROG="M":$P(^AMHPATR(DFN,0),U,2),AMHPROG="S":$P(^AMHPATR(DFN,0),U,3),AMHPROG="C":$P(^AMHPATR(DFN,0),U,4),AMHPROG="O":$P(^AMHPATR(DFN,0),U,12),AMHPROG="T":$P(^AMHPATR(DFN,0),U,13),1:"") I AMHX]"" D PROC
 .I AMHPROG="T" S AMHX=$P(^AMHPATR(DFN,0),U,14) I AMHX]"" D PROC
 Q
PROC ;
 I AMHPRV]"",AMHPRV'=AMHX Q
 S ^XTMP("AMHRP7",AMHJOB,AMHBTH,AMHX,$P(^DPT(DFN,0),U),DFN)=""
 Q
PRINT ;
START ;
 K AMHX
 S AMH80D="-------------------------------------------------------------------------------"
 S AMHPG=0 D HEAD
 I '$D(^XTMP("AMHRP7",AMHJOB,AMHBTH)) W !!,"NO PATIENTS TO REPORT" G DONE
 S AMHPN="" K AMHQ
 F  S AMHPN=$O(^XTMP("AMHRP7",AMHJOB,AMHBTH,AMHPN)) Q:AMHPN=""!($D(AMHQ))  D DFN
 G:$D(AMHQ) DONE
DONE D DONE^AMHLEIN,^AMHEKL
 K ^XTMP("AMHRP7",AMHJOB,AMHBTH)
 Q
DFN ;
 I $Y>(IOSL-4) D HEAD Q:$D(AMHQ)
 S AMHPCNT=0
 I AMHPROG'="T" W !!,"PROVIDER:  ",$P(^VA(200,AMHPN,0),U),!
 I AMHPROG="T" W !!,"PROVIDER:  ",AMHPN
 S AMHNAME="" F  S AMHNAME=$O(^XTMP("AMHRP7",AMHJOB,AMHBTH,AMHPN,AMHNAME)) Q:AMHNAME=""!($D(AMHQ))  D
 .S DFN="" F  S DFN=$O(^XTMP("AMHRP7",AMHJOB,AMHBTH,AMHPN,AMHNAME,DFN)) Q:DFN=""!($D(AMHQ))  D PROCP
 Q:$D(AMHQ)
 I $Y>(IOSL-4) D HEAD Q:$D(AMHQ)
 W !?57,"SUB-TOTAL:  ",AMHPCNT
 Q
PROCP ;
 S AMHPCNT=AMHPCNT+1
 I $Y>(IOSL-4) D HEAD Q:$D(AMHQ)
 W !,$P(^DPT(DFN,0),U)
 S AMHHRCN=$S($D(^AUPNPAT(DFN,41,DUZ(2),0)):$P(^(0),U,2),1:"")
 W ?26,AMHHRCN
 W ?37,$P(^DPT(DFN,0),U,2)
 S Y=$P(^DPT(DFN,0),U,3) W ?41,$E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3)
 W ?52,$E($P($G(^AUPNPAT(DFN,11)),U,18),1,11)
 ;S D=$O(^AMHREC("AE",DFN,"")) I D]"" S D=9999999-$P(D,".") W ?65,$E(D,4,5),"/",$E(D,6,7),"/",$E(D,2,3)
 S D=$$LVD^AMHDPEE(DFN,"D") W ?65,D
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S AMHQ="" Q
HEAD1 ;
 W:$D(IOF) @IOF S AMHPG=AMHPG+1
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !,$P(^VA(200,DUZ,0),U,2),?72,"Page ",AMHPG,!
 W ?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),!
 S AMHLENG=$L(AMHPROGN)+25 W ?((80-AMHLENG)/2),"DESIGNATED ",AMHPROGN," PROVIDER LIST"
 S AMHLENG=$S(AMHPRV:$L($P(^VA(200,AMHPRV,0),U)),1:3)+10
 W !?((80-AMHLENG)/2),"PROVIDER: ",$S('AMHPRV:"ALL",1:$P(^VA(200,AMHPRV,0),U)),!
PIH W !,"PATIENT NAME",?25,"CHART #",?37,"SEX",?43,"DOB",?52,"COMMUNITY",?64,"LAST VISIT",!,AMH80D
 Q