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

AMHLEI2.m

Go to the documentation of this file.
AMHLEI2  ; IHS/TUCSON/LAB -VISIT DISPLAY ;        
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
DISP(DFN) ;EP
 NEW AMHARRY
 K ^TMP("AMHLEI1",$J)
 S AMHARRY="^TMP(""AMHLEI1"",$J)"
 Q:'$D(DFN)
 Q:'DFN
 Q:'$D(^AMHPINTK(DFN,0))
 D BUILD
 D XIT
 Q
 ;
SET ;set array
 S AMHCTR=AMHCTR+1
 S @AMHARRY@(AMHCTR,0)=AMHSTR
 S AMHSTR=""
 Q
BUILD ; build array
 NEW AMHAR,AMHSTR,AMHX,AMHH,AMHV
 I $E(IOST)'="P" D TERM^VALM0
 S Y=DFN D ^AUPNPAT
 S AMHSTR="",AMHCTR=0
 S AMHH="Designated MH Provider",AMHV=$$VAL^XBDIQ1(9002011.55,DFN,.02) D BUILD1
 S AMHH="Designated SS Provider",AMHV=$$VAL^XBDIQ1(9002011.55,DFN,.03) D BUILD1
 S AMHH="Desg CD A/SA Provider",AMHV=$$VAL^XBDIQ1(9002011.55,DFN,.04) D BUILD1
 S AMHH="Desg Other Provider",AMHV=$$VAL^XBDIQ1(9002011.55,DFN,.12) D BUILD1
 S AMHH="Desg Other (2) Provider",AMHV=$$VAL^XBDIQ1(9002011.55,DFN,.13) D BUILD1
INTAKE ;
 S AMHSTR="=============== "_"BH INTAKE DOCUMENT"_" ===============",X=(80-$L(AMHSTR)\2) D SET ;$J("",X)_AMHSTR D SET
 S AMHH="Initial Intake",AMHV=$$VAL^XBDIQ1(9002011.07,AMHINT,.07) D BUILD2
 S AMHH="      Provider",AMHV=$$VAL^XBDIQ1(9002011.07,AMHINT,.08) D BUILD2
 S AMHH="   Last Update",AMHV=$$VAL^XBDIQ1(9002011.07,AMHINT,.02) D BUILD2
 S AMHH="      Provider",AMHV=$$VAL^XBDIQ1(9002011.07,AMHINT,.03) D BUILD2
 S AMHSTR="" D SET
1 ;
 I $O(^AMHPINTK(AMHINT,10,0)) D
 .F AMHX=1000 I $D(^DD(9002011.07,AMHX,0)) D
 ..S AMHSTR=$P(^DD(9002011.07,AMHX,0),U)_":" D SET
 ..K AMHAR D ENP^XBDIQ1(9002011.07,DFN,AMHX,"AMHAR(","E")
 ..S F=0 F  S F=$O(AMHAR(AMHX,F)) Q:F'=+F  S AMHSTR=AMHAR(AMHX,F) D SET
 ..S AMHSTR="" D SET
 .Q
 F AMHX=4100 I $D(^DD(9002011.07,AMHX,0)) D
 .S AMHSTR=$P(^DD(9002011.07,AMHX,0),U)_":" D SET
 .K AMHAR D ENP^XBDIQ1(9002011.07,DFN,AMHX,"AMHAR(","E")
 .S F=0 F  S F=$O(AMHAR(AMHX,F)) Q:F'=+F  S AMHSTR=AMHAR(AMHX,F) D SET
 .S AMHSTR="" D SET
 .Q
 Q
BUILD1 ;
 S AMHSTR=$E(AMHH,1,35)_":",AMHSTR=$$SETSTR^VALM1(AMHV,AMHSTR,40,$L(AMHV))
 D SET
 Q
BUILD2 ;
 S AMHSTR=$E(AMHH,1,35)_":",AMHSTR=$$SETSTR^VALM1(AMHV,AMHSTR,26,$L(AMHV))
 D SET
 Q
XIT ;
 Q
SENDINT ;EP
 D FULL^VALM1
 D SEND
 D CLEAN
 D BACK^AMHLEI
 Q
SEND ;
 I '$D(^AMHSITE(DUZ(2),13,"B",DUZ)) Q  ;no access
 S DIR(0)="Y",DIR("A")="Do you want to share this Intake Document with other Providers",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q
 I 'Y Q
 K XMY D GETLIST
 I '$D(XMY) G SENDINT
 W !!,"Intake Document as a message will be sent to:" S X=0 F  S X=$O(XMY(X)) Q:X'=+X  W ?28,$P(^VA(200,X,0),U),!
 S DIR(0)="Y",DIR("A")="Ready to send mail message",DIR("B")="Y" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) K XMY,XMTEXT,XMDUZ,XMZ,XMSUB,AMHEFT Q
 I 'Y K XMY,XMTEXT,XMDUZ,XMZ,XMSUB G SENDINT
 D MAILMSG
 Q
GETLIST ;
 K XMY
GETLIST1 ;
 K DIC,DR,DD,D0,DO S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="Send to: " D ^DIC
 I Y=-1 Q
 S XMY(+Y)=""
 G GETLIST1
 ;
MAILMSG ;
 K ^TMP("AMHLEI1",$J)
 D ^XBFMK
 ;S AMHX=0 F  S AMHX=$O(XMY(AMHX)) Q:AMHX'=+AMHX  D
 ;.I '$D(^AMHREC(AMHR,52,"B",AMHX)) S DA=AMHR,DIE="^AMHREC(",DR="5200///`"_AMHX D ^DIE
 D DISP(DFN)
 S (C,X)=0 F  S X=$O(^TMP("AMHLEI1",$J,X)) Q:X'=+X  S C=C+1
 S C=C+1,^TMP("AMHLEI1",$J,C)="THIS FORM CONTAINS CONFIDENTIAL PATIENT INFORMATION.  UNAUTHORIZED"
 S C=C+1,^TMP("AMHLEI1",$J,C)="REPRODUCTION OF THIS FORM MAY VIOLATE PRIVACY ACT STATUTES AND BE"
 S C=C+1,^TMP("AMHLEI1",$J,C)="PUNISHABLE BY LAW."
 S C=C+1,^TMP("AMHLEI1",$J,C)="*********** PLEASE DELETE IMMEDIATELY AFTER REVIEW. ***********"
 S XMSUB="Intake Document - Behavioral Health - CONFIDENTIAL"
 S XMDUZ=$P(^VA(200,DUZ,0),U)
 D XMZ^XMA2
 S AMHXMZ=XMZ
 S XMDUZ=$P(^VA(200,DUZ,0),U)
 S XMTEXT="^TMP(""AMHLEI1"",$J,"
 W !,"Sending Mailman message to distribution list"
 D ENL^XMD
 S XMZ=AMHXMZ
 S DA=XMZ,DIE=3.9,DR="1.95///Y;1.96///Y" D ^DIE K DIE,DR,DA
 D ENT1^XMD
 KILL ^TMP("AMHLEI1",$J)
 ;set multiple imn record file
 ;kill vars
 K XMZ,DA,DIE,DR,XMDUZ,AMHXMZ,AMHEFT,XMSUB,AMHX,XMY
 W !,"Message Sent  "
 D PAUSE^AMHLEP2
 Q
CLEAN ;
 K AMHX,AMHY,XMY,XMTEXT,XMDUZ,XMZ,XMSUB,AMHXMZ
 D ^XBFMK
 Q
 ;