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

AMHVDISP.m

Go to the documentation of this file.
AMHVDISP ; IHS/CMI/LAB - DISPLAY VISIT ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 D GETPAT
 I AMHPAT="" W !!,"No PATIENT selected!" D EOJ Q
 D GETVISIT
 I $G(APCDVSIT)="" W !!,"No VISIT selected!" D EOJ Q
 D DSPLY
 D EOJ
 Q
 ;
GETPAT ;EP GET-  PATIENT
 W !
 S AUPNLK("INAC")=""
 S AMHPAT=""
 S DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
 Q:Y<0
 S AMHPAT=+Y
 Q
 ;
GETVISIT ;EP - this entry point called by the BVP package (View patient record)
 S AMHLOOK="",AMHVSIT="",APCDVSIT=""
 K AMHVLK
 D VLK
 I $G(APCDVSIT)="" Q
 K AMHLOOK
 Q
 ;
DSPLY ;
 D EN^APCDVD
 Q
 ;
EOJ ; EP - EOJ HOUSE KEEPING - this ep called by the BVP package (View patient record)
 K AUPNLK("INAC")
 K %,%DT,%X,%Y,C,DIYS,X,Y
 K AMHCLN,AMHCAT,AMHDATE,AMHLOC,AMHPAT,AMHVSIT,AMHLOOK,AMHTYPE,APCDVSIT
 D KILL^AUPNPAT
 Q
VLK ;
 S U="^",AMHLOOK="",APCDVSIT=""
 I $D(AMHVLK),AMHVLK S AMHLOOK=AMHVLK Q  ;*** FOR MODIFY IN ADD MODE ***
 I $D(AMHVLDT) S Y=$P(AMHVLDT,".") G VDPASSED
RDV W !,"Enter VISIT date: " R X:$S($D(DTIME):DTIME,1:300) S:'$T X="" I X=" " W $C(7),"  ??" G RDV
 Q:X=""!(X="^")
 S %DT="EX" D ^%DT
 G:X="?" RDV
 I Y<0 K Y Q
VDPASSED ; FOR CALLER PASSING VISIT DATE
 K AMHVLKT
 S AMHVLDC=Y,(AMHVLI,AMHVLV)=0 K Y
 S (AMHVLID,AMHVLL)=9999999-AMHVLDC
 F  S AMHVLL=$O(^AUPNVSIT("AA",AMHPAT,AMHVLL)) Q:AMHVLL'=+AMHVLL!($P(AMHVLL,".")'=AMHVLID)  D
 .S AMHVLV=0 F  S AMHVLV=$O(^AUPNVSIT("AA",AMHPAT,AMHVLL,AMHVLV)) Q:AMHVLV'=+AMHVLV  I $D(^AUPNVSIT(AMHVLV,0)),'$P(^(0),U,11) D
 ..Q:'$$ALLOWPCC^AMHUTIL(DUZ,AMHVLV)  ;SDE/UU
 ..S AMHVLI=AMHVLI+1,AMHVLKT(AMHVLI)=AMHVLV
 .Q
 G:'$D(AMHVLKT) XIT
 I AMHVLI=1,'$D(AMHVLDT) S APCDVSIT=AMHVLKT(1) G XIT
SELECT ; SELECT EXISTING VISIT
 W !!,"PATIENT: ",$P(^DPT(AMHPAT,0),U)," has one or more VISITs on this date.",!
 S AMHVLI="" F AMHVLL=0:0 S AMHVLI=$O(AMHVLKT(AMHVLI)) Q:AMHVLI=""  S AMHVLX=^AUPNVSIT(AMHVLKT(AMHVLI),0),AMHA11=$G(^AUPNVSIT(AMHVLKT(AMHVLI),11)) D WRITE
 S AMHVLV=""
SRDR W !!,"Select one: " R AMHVLI:$S($D(DTIME):DTIME,1:300) I '$T S AMHVLI=""
 G:AMHVLI=""!(AMHVLI="^") XIT
 I AMHVLI'?1N.N W $C(7),$C(7) G SELECT
 I '$D(AMHVLKT(AMHVLI)) W $C(7),$C(7) G SELECT
 S APCDVSIT=AMHVLKT(AMHVLI)
 G XIT
 ;
WRITE ; WRITE VISITS FOR SELECT
 S AMHVLT=$P(+AMHVLX,".",2),AMHVLT=$S(AMHVLT="":"<NONE>",$L(AMHVLT)=1:AMHVLT_"0:00 ",1:$E(AMHVLT,1,2)_":"_$E(AMHVLT,3,4)_$E("00",1,2-$L($E(AMHVLT,3,4)))_" ")
 S AMHVLOC=""
 I $P(AMHVLX,U,6),$D(^AUTTLOC($P(AMHVLX,U,6),0)) S AMHVLOC=$P(^(0),U,7),AMHVLOC=AMHVLOC_$E("    ",1,4-$L(AMHVLOC))
 S:AMHVLOC="" AMHVLOC="...."
 W !,AMHVLI,"  TIME: ",AMHVLT,"LOC: ",AMHVLOC," TYPE: ",$P(AMHVLX,U,3)," CAT: ",$P(AMHVLX,U,7)," CLINIC: ",$S($P(AMHVLX,U,8)]"":$E($P(^DIC(40.7,$P(AMHVLX,U,8),0),U),1,8),1:"<NONE>") D
 .W ?57,"DEC: ",$S($P(AMHVLX,U,9):$P(AMHVLX,U,9),1:0),$S($P(AMHA11,U,3)]"":" VCN:"_$P(AMHA11,U,3),1:"")
 .I $P(AMHVLX,U,22) W !?3,"Hospital Location: ",$P($G(^SC($P(AMHVLX,U,22),0)),U)
 .I $$PRIMPROV^APCLV(AMHVLKT(AMHVLI))]"" W !?3,"Primary Provider: ",$$PRIMPROV^APCLV(AMHVLKT(AMHVLI),"N")
 K AMHVLT,AMHVLOC
 Q
 ;
XIT ; KILL VARIABLES AND QUIT
 ;S APCDVSIT=AMHLOOK
 K AMHVLDC,AMHVLDT,AMHVLI,AMHVLKT,AMHVLL,AMHVLOC,AMHVLT,AMHVLV,AMHVLX,Y,AMHA11,AMHVLID
 Q