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

AMHLELV.m

Go to the documentation of this file.
AMHLELV ; IHS/CMI/LAB - MENTAL HLTH ROUTINE ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
START ;EP display patients last visit
 K AMHQUIT
 D GETPAT
 I 'AMHPAT D XIT Q
 D PROV
 D GETREC
 I 'AMHR,AMHLVPR W !!,"No visits to that provider." H 2 D XIT Q
 I 'AMHR D XIT Q
 D FORMAT
 Q:AMHTYPE=""
ZIS ;
 S XBRC="COMP^AMHLELV",XBRP=$S(AMHTYPE="E":"^AMHLEFP2",1:"EN1^AMHLELV"),XBNS="AMH",XBRX="XIT^AMHLELV"
 D ^XBDBQUE
 D XIT
 Q
XIT ;
 D KILL^AUPNPAT
 K AMHVDFN,AMHVDG,AMHVDSH,AMHVFLE,AMHVI,AMHVIGR,AMHVL,AMHVNM,AMHX,AMHBRK,AMHTYPE,AMHDLAST
 K ZTSK,Y,AMHBD,AMHED,IO("Q"),AMH80D,AMHBTH,AMHHRCN,AMHJOB,AMHLENG,AMHPCNT,AMHPG,AMHPROV,AMHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D,AMHC
 K AMHPRNM,AMHPRNT,AMHPROB,AMHPRV,AMHR,AMHRCNT,AMHRLOC,AMHSD,AMHTOT,AMHBDD,AMHBT,AMHEDD,AMHEDO,AMHBDO,AMHBT,AMHFOUND,AMHHIT,AMHID,AMHLINE,AMHP,AMHHRN,AMHODAT,AMHQUIT,AMHR0,AMHTICL,AMHTNRQ,AMHTQ,AMHTTXT
 K AMHPAT
 Q
EN2(AMHPAT) ;
 NEW AMHR
 I '$D(^AMHREC("AE",AMHPAT)) W !!,"No visits of file for this patient - "_$P(^DPT(AMHPAT,0),U),! H 2 Q
 D PROV
 D GETREC
 I 'AMHR W !,"No visits for that patient." H 2 Q
 D EN^AMHDVD
 Q
EN1 ;EP - called from xbdbque
 I $E(IOST)="C",IO=IO(0) D EN^AMHDVD Q
 K ^TMP("AMHVDSG",$J)
 D EP^AMHVDSG(AMHR)
 S AMHPG=0
 D PHD
 S AMHX=0 F  S AMHX=$O(^TMP("AMHVDSG",$J,AMHX)) Q:AMHX'=+AMHX  D
 .I $Y>(IOSL-3) D PHD
 .W !,^TMP("AMHVDSG",$J,AMHX,0)
 .Q
 K AMHX
 Q
PHD ;
 I 'AMHPG G PHD1
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S AMHQUIT="" Q
PHD1 ;
 S AMHPG=AMHPG+1 I AMHPG>1 W:$D(IOF) @IOF
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !,$P(^VA(200,DUZ,0),U,2),"  ",$$FMTE^XLFDT(DT),?20,"BEHAVIORAL HEALTH RECORD DISPLAY",?72,"Page ",AMHPG,!
 Q
GETPAT ; GET PATIENT
 S AMHPAT=""
 S DIC("A")="Enter PATIENT (if known, otherwise press ENTER): ",DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
 Q:Y<0
 S AMHPAT=+Y
 I '$$ALLOWP^AMHUTIL(DUZ,AMHPAT) D NALLOWP^AMHUTIL S AMHPAT="" Q
 I $G(AUPNDOD)]"" W !!?10,"***** PATIENT'S DATE OF DEATH IS ",$$FMTE^XLFDT(AUPNDOD),!! H 2
 Q
 ;
GETREC ;
 S AMHR=""
 I '$D(^AMHREC("AE",AMHPAT)) W !!,"No visits on file for this patient.",! Q
 ;I AMHLVPR="" D
 ;.;S AMHDLAST=$O(^AMHREC("AE",AUPNPAT,"")),AMHR=$O(^AMHREC("AE",AUPNPAT,AMHDLAST,"")) Q
 NEW D,%,P S (D,%)="" F  S D=$O(^AMHREC("AE",AMHPAT,D)) Q:D'=+D!(AMHR)  D
 .S V=0 F  S V=$O(^AMHREC("AE",AMHPAT,D,V)) Q:V'=+V  D
 ..Q:'$$ALLOWVI^AMHUTIL(DUZ,V)
 ..I AMHLVPR="" S AMHR=V Q
 ..I $$PPINT^AMHUTIL(V)=AMHLVPR S AMHR=V
 .Q
 Q
PROV ;
 S AMHLVPR=""
 S DIR(0)="Y",DIR("A")="Do you want a particular provider's last visit",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q
 I 'Y Q
 S DIC=200,DIC(0)="AEMQ",DIC("B")=$P(^VA(200,DUZ,0),U) D ^DIC
 I Y=-1 G PROV
 S AMHLVPR=+Y
 Q
FORMAT ;
 S AMHTYPE=""
 S DIR(0)="S^E:Encounter Form Format;S:Standard Display",DIR("A")="Select Print Format",DIR("B")="E" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 Q:$D(DIRUT)
 S AMHTYPE=Y
 Q:AMHTYPE="S"
 K AMHEFT
 ;W !! S DIR(0)="S^F:Full Encounter Form;S:Suppressed Encounter Form;B:Both",DIR("A")="What type of form do you want to print"
 ;S DIR("B")=$S($P(^AMHSITE(DUZ(2),0),U,23)]"":$P(^AMHSITE(DUZ(2),0),U,23),1:"B") K DA D ^DIR K DIR
 D FORMDIR^AMHLEFP(AMHR)
 I $D(DIRUT) G FORMAT
 S AMHEFT=Y
 Q
COMP ;
 Q