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

BPCBHDSP.m

Go to the documentation of this file.
BPCBHDSP ; IHS/OIT/MJL - behavioral health display for GUI ; [ 11/14/2007  10:40 AM ]
 ;;1.5;BPC;**3,4**;FEB 16, 2005
 ;
 ;
TESTREC ;
 D RECDISP(.RETVAL,33)
 Q
TESTENC ;
 D ENCFORM(.RETVAL,33,"S")
 Q
TESTSUIC ;
 D SUICDSP(.RETVAL,5)
 Q
SUICDSP(BGUARRAY,BPCIEN) ;EP CALL FROM REMOTE PROC: BPCBH SUICIDE FORM DSP
 ;
ENSFDSP ;
 S JOB=$J,BPCGUI=1,XWBWRAP=1
 S ZTIO="",ZTQUEUED=1
 S BGUARRAY="^XTMP(""BPCSF"","_$J_")"
 S AMHSF=BPCIEN
 K ^XTMP("BPCSF",JOB)
 S ^XTMP("BPCSFRUN",JOB)=""
 D ^XBKSET
 ;D GUIR^XBLM("PRINT^AMHLESF1","^XTMP(""BPCSF"",JOB)")
 ;S X=0,BPCCTR=0 F  S X=$O(^XTMP("BPCSF",JOB,X)) Q:X'=+X  S BPCCTR=BPCCTR+1
 ;S ^XTMP("BPCSF",JOB,.5)=BPCCTR+1
 S ZTRTN="TSK^BPCBHDSP",ZTIO="",ZTDESC="BPC SF REPORT",ZTSAVE("AMHSF")="",ZTSAVE("JOB")="",ZTDTH=$H D ^%ZTLOAD
 F I=1:1:60 Q:$G(^XTMP("BPCSFRUN",$J))="DONE"  H 1
 D KILL
 Q
 ;
TSK ;
 D ^XBKSET
 S ^XTMP("BPCSFRUN",JOB)="START"
 D GUIR^XBLM("PRINT^AMHLESF1","^XTMP(""BPCSF"",JOB)")
 S ^XTMP("BPCSF",JOB,.5)=$O(^XTMP("BPCSF",JOB,""),-1)+1
 S ^XTMP("BPCSFRUN",JOB)="DONE"
 Q
 ;
TSKITKF ; Task Intake Form
 D ^XBKSET
 S ^XTMP("BPCIFRUN",JOB)="START"
 D GUIR^XBLM("PRINT1^AMHLEI3","^XTMP(""BPCIF"",JOB)")
 S ^XTMP("BPCIF",JOB,.5)=$O(^XTMP("BPCIF",JOB,""),-1)+1
 S ^XTMP("BPCIFRUN",JOB)="DONE"
 Q
 ;
KILL ;
 K BPCCTR,BPCGUI,AMHSF,DIC,JOB,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
 Q
ENCFORM(AMHARRY,AMHR,AMHEFT) ;EP called to get encounter form in array
 ;AMHR=ien of BH record
 ;array is ^TMP("AMHS",$J,"DCS")
 ;AMHEFT=type of form to print
 ;      S - Suppressed
 ;      F - Full
 S AMHARRY=$NA(@"^TMP(""AMHS"",$J,""DCS"")")
 K ^TMP("AMHS",$J,"DCS")
 I $G(AMHEFT)="" S AMHEFT="F"
 I "FS"'[AMHEFT Q
 D EP2^AMHLEFP2(AMHR,1)
 NEW BPCCTR,X S (X,BPCCTR)=0 F  S X=$O(^TMP("AMHS",$J,"DCS",X)) Q:X'=+X  S BPCCTR=BPCCTR+1
 S ^TMP("AMHS",$J,"DCS",.5)=BPCCTR+1 K ^TMP("AMHS",$J,"DCS",0)
 Q
 ;
INTAKE(BGUARRAY,BPCIEN) ;EP called to return an INTAKE form in an array
 S JOB=$J,BPCGUI=1,XWBWRAP=1
 S ZTIO="",ZTQUEUED=1
 S BGUARRAY="^XTMP(""BPCIF"","_$J_")"
 K ^XTMP("BPCIF",JOB)
 S ^XTMP("BPCIFRUN",JOB)=""
 D ^XBKSET
 S DFN=BPCIEN,AMHPG=0
 S ZTRTN="TSKITKF^BPCBHDSP",ZTIO="",ZTDESC="BPCBH INTAKE FORM",ZTSAVE("DFN")="",ZTSAVE("DFN")="",ZTSAVE("JOB")="",ZTSAVE("AMHPG")="",ZTDTH=$H D ^%ZTLOAD
 F I=1:1:60 Q:$G(^XTMP("BPCIFRUN",$J))="DONE"  H 1
 D KILL
 Q
 ;
 ;
RECDISP(AMHARRY,AMHR) ;EP - called to display one BH record
 ;retval=array containg data, AMHR=ien of behavioral health record
 ;array returned is ^TMP("AMHVDSG",$J)
 NEW X
 S AMHARRY=$NA(@"^TMP(""AMHVDSG"",$J)")
 K ^TMP("AMHVDSG",$J)
 K X D EN^AMHVDSG1(AMHARRY,AMHR)
 NEW BPCCTR S (X,BPCCTR)=0 F  S X=$O(^TMP("AMHVDSG",$J,X)) Q:X'=+X  S BPCCTR=BPCCTR+1,^TMP("AMHVDSG",$J,X)=^TMP("AMHVDSG",$J,X,0) K ^TMP("AMHVDSG",$J,X,0)
 S ^TMP("AMHVDSG",$J,.5)=BPCCTR+1
 Q
 ;
TIUN(BGUARRAY,BPCIEN) ;EP called to return TIU notes in an array
 I '$P($G(^AMHREC(BPCIEN,11)),U,8) Q
 S BGUARRAY="^TMP(""AMHS"","_$J_",""DCS"")"
 S AMHR=BPCIEN
 K @BGUARRAY S @BGUARRAY@(0)=0
 S X="TIU Note:" D S(X,1)
 K AMHAR,AMHERR,AMHTIU
 S AMHDOC=$P(^AMHREC(AMHR,11),U,8)
 I '+$$CANDO^TIULP(AMHDOC,"PRINT RECORD",DUZ) S X="",$E(X,3)="You do not have security clearance to display the TIU NOTE." D S(X) K AMHTIU Q
 ; Extract specified note
 S AMHGBL=$NA(^TMP("AMHOENPS",$J)),AMHHLF=IOM\2
 K @AMHGBL
 D EXTRACT^TIULQ(AMHDOC,AMHGBL,.AMHERR,".01;.02;.03;.05;.07;.08;1202;1203;1205;1208;1209;1301;1307;1402;1501:1505;1507:1513;1701","",1,"E")
 M AMHTIU=^TMP("AMHOENPS",$J,AMHDOC)
 K ^TMP("AMHOENPS",$J)
 D S(AMHTIU(.01,"E"))
 D S("AUTHOR: "_AMHTIU(1202,"E"))
 D S("SIGNED BY: "_AMHTIU(1502,"E")_"               STATUS: "_AMHTIU(.05,"E"))
 D S("LOCATION: "_AMHTIU(1205,"E"))
 F AMHX=0:0 S AMHX=$O(AMHTIU("TEXT",AMHX)) Q:'AMHX  D S(AMHTIU("TEXT",AMHX,0))
 I $L($G(AMHTIU(1501,"E"))) D
 .D S("/es/ "_$G(AMHTIU(1503,"E")))
 .D S("Signed: "_$G(AMHTIU(1501,"E")))
 ;
 K AMHTIU
 Q
 ;
S(Y,F,C,T) ;set up array
 NEW %
 I '$G(F) S F=0
 I '$G(T) S T=0
 ;blank lines
 F F=1:1:F S X="" D S1
 S X=Y
 I $G(C) S L=$L(Y),T=(80-L)/2 D  D S1 Q
 .F %=1:1:(T-1) S X=" "_X
 F %=1:1:T S X=" "_Y
 D S1
 Q
S1 ;
 S %=$P(^TMP("AMHS",$J,"DCS",0),U)+1,$P(^TMP("AMHS",$J,"DCS",0),U)=%
 S ^TMP("AMHS",$J,"DCS",%)=X
 Q