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

AMHBHRP9.m

Go to the documentation of this file.
AMHBHRP9 ; IHS/CMI/LAB - behavioral health display for GUI ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
 ;
TEST ;
 D NOSHOW(.RETVAL,40503,"01/01/1995","01/20/2005")
 Q
NOSHOW(AMHARRAY,AMHPAT,AMHBD,AMHED,AMHPROG) ;EP - AMHBH RPT LIST NO SHOWS 1 PAT
 NEW AMHR
 S JOB=$J,AMHGUI=1,XWBWRAP=1
 S ZTIO="",ZTQUEUED=1
 S AMHARRAY="^XTMP(""AMHRPT"","_$J_")"
 K ^XTMP("AMHRPT",$J)
 I $G(AMHPROG)="" S AMHPROG="A"
 S AMHPROG=AMHPROG
 I $G(AMHPAT)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid DFN of patient passed" D KILL Q
 I $G(AMHBD)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid beginning date passed" D KILL Q
 I AMHBD]"" D DT^DILF("X",AMHBD,.AMHBD) I $G(AMHBD)=-1 S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid beginning date passed" D KILL Q
 I $G(AMHED)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid ending date passed" D KILL Q
 I AMHED]"" D DT^DILF("X",AMHED,.AMHED) I $G(AMHED)=-1 S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid ending date passed" D KILL Q
 S (DFN,AMHPAT,AUPNPAT)=AMHPAT
 S AMHBDD=$$FMTE^XLFDT(AMHBD)
 S AMHEDD=$$FMTE^XLFDT(AMHED)
 D PROC^AMHRNS
 K ^XTMP("AMHRPT",JOB)
 S ^XTMP("AMHRPTRUN",JOB)=""
 D ^XBKSET
 ;S ZTRTN="TSK^AMHBHRP9",ZTIO="",ZTDESC="AMH LIST NO SHOW",ZTSAVE("DFN")="",ZTSAVE("AMH*")="",ZTSAVE("JOB")="",ZTDTH=$H D ^%ZTLOAD
 ;F I=1:1:120 Q:$G(^XTMP("AMHRPTRUN",$J))="DONE"  H 1
 D TSK
 D KILL
 Q
 ;
TSK ;
 D ^XBKSET
 S ^XTMP("AMHRPTRUN",JOB)="START"
 D GUIR^XBLM("PRINT^AMHRNS","^XTMP(""AMHRPT"",JOB)")
 S ^XTMP("AMHRPT",JOB,.5)=$O(^XTMP("AMHRPT",JOB,""),-1)+1
 S ^XTMP("AMHRPTRUN",JOB)="DONE"
 Q
 ;
KILL ;
 K DFN,AMHPAT,AUPNPAT
 K AMHOA,AMHBT,AMHTOT
 K AMHCTR,AMHGUI,AMHSF,DIC,JOB,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
 D EN^XBVK("AMH")
 Q
L ;get patients last visit
 ;AMHV array
 I '$D(^AMHREC("AE",DFN)) Q
 S D=$O(^AMHREC("AE",DFN,"")),R=$O(^AMHREC("AE",DFN,D,""))
 I R S AMHV(D,R)=""
 Q
S ;san only
 S D=0,V=0
 F  S D=$O(^AMHREC("AE",DFN,D)) Q:D'=+D  S V=0 F  S V=$O(^AMHREC("AE",DFN,D,V)) Q:V'=+V  I $P(^AMHREC(V,0),U,33)="S" S AMHV(D,V)=""
 Q