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

AMHRP9.m

Go to the documentation of this file.
AMHRP9 ; IHS/CMI/LAB - SEEN > N TIMES ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
START ;
 I '$D(IOF) D HOME^%ZIS
 W @(IOF),!!
 W "**********  PATIENTS SEEN AT LEAST N NUMBER OF TIMES  **********",!!
 W "This report will produce a list of patients who have been seen at least",!," N number of times in a date range specified by the user.",!
 D DBHUSRP^AMHUTIL
 D DBHUSR^AMHUTIL
GETDATES ;
BD ;get beginning date
 W !,"Please enter the date range during which the patient should be 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 AMHBD=Y
ED ;get ending date
 W ! S DIR(0)="D^"_AMHBD_":DT:EP",DIR("A")="Enter ending Date" S Y=AMHBD D DD^%DT D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G BD
 S AMHED=Y
 S X1=AMHBD,X2=-1 D C^%DTC S AMHSD=X S Y=AMHBD D DD^%DT S AMHBDD=Y S Y=AMHED D DD^%DT S AMHEDD=Y
 ;
NUM ;
 S DIR(0)="N^2:100:0",DIR("A")="Enter the minimum number of times the patient should have been seen" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 G:$D(DIRUT) GETDATES
 G:Y="" GETDATES
 S AMHNUM=+Y
DEMO ;
 D DEMOCHK^AMHUTIL1(.AMHDEMO)
 I AMHDEMO=-1 G NUM
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 XIT
 I $G(Y)="B" D BROWSE,XIT Q
 S XBRC="PROC^AMHRP9",XBRP="^AMHRP9P",XBNS="AMH",XBRX="XIT^AMHRP9"
 D ^XBDBQUE
XIT K ZTSK,Y,AMHBD,AMHED,IO("Q"),AMH80D,AMHBTH,AMHHRCN,AMHJOB,AMHLENG,AMHPCNT,AMHPG,AMHNUM,AMHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D,AMHFOUN,AMHPOV,AMHRA,AMHRX,AMHRY
 K AMHPRNM,AMHPRNT,AMHPROB,AMHPRV,AMHR,AMHRCNT,AMHRLOC,AMHSD,AMHTOT,AMHBDD,AMHBT,AMHEDD,AMHEDO,AMHBDO,AMHBT,AMHFOUND,AMHHIT,AMHID,AMHLINE,AMHP
 Q
BROWSE ;
 S XBRP="VIEWR^XBLM(""^AMHRP9P"")"
 S XBNS="AMH",XBRC="PROC^AMHRP9",XBRX="XIT^AMHRP9",XBIOP=0 D ^XBDBQUE
 Q
 ;
PROC ;EP - entry point for processing
 S AMHJOB=$J,AMHBTH=$H,AMHTOT=0,DFN=0,AMHBT=$H
 D XTMP^AMHUTIL("AMHRP9","BH - PTS WITH N VISITS")
 F  S DFN=$O(^AMHREC("AE",DFN)) Q:DFN'=+DFN  I $$ALLOWP^AMHUTIL(DUZ,DFN) D PROC1
 S AMHET=$H
 K DFN
 Q
PROC1 ;
 Q:$$DEMO^AMHUTIL1(DFN,$G(AMHDEMO))
VSTS ; process visits
 S AMHR=0,AMHBDO=9999999-AMHBD,AMHEDO=9999999-AMHED,AMHSD=AMHED-1,AMHSD=AMHSD_".9999",AMHRCNT=0
 F  S AMHSD=$O(^AMHREC("AE",DFN,AMHSD)) Q:$P(AMHSD,".")>AMHBDO!(AMHSD="")  D
 .S AMHR=0 F  S AMHR=$O(^AMHREC("AE",DFN,AMHSD,AMHR)) Q:AMHR'=+AMHR  D
 ..Q:'$$ALLOWVI^AMHUTIL(DUZ,AMHR)
 ..S AMHRCNT=AMHRCNT+1 ;COUNT # VISITS
 .Q
 I AMHRCNT'<AMHNUM S ^XTMP("AMHRP9",AMHJOB,AMHBTH,$P(^DPT(DFN,0),U),DFN)=""
 Q
 ;