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

AMHBHRP4.m

Go to the documentation of this file.
AMHBHRP4 ; IHS/CMI/LAB - behavioral health display for GUI ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
 ;
TEST ;
 D DISPLAST(.RETVAL,40503,,"S")
 Q
DISPLAST(AMHARRAY,AMHPAT,AMHPROV,AMHTYPE,AMHEFT) ;EP - AMHBH RPT LAST VISIT
 NEW AMHR
 S JOB=$J,AMHGUI=1,XWBWRAP=1
 S ZTIO="",ZTQUEUED=1
 S AMHARRAY="^XTMP(""AMHRPT"","_$J_")"
 K ^XTMP("AMHRPT",JOB)
 I $G(AMHPAT)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid DFN of patient passed" D KILL Q
 I $G(AMHTYPE)="" S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid format type passed" D KILL Q
 I "ES"'[AMHTYPE S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid format type passed" D KILL Q
 I $G(AMHPROV),'$D(^VA(200,AMHPROV,0)) S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="Invalid IEN of provider entry passed" D KILL Q
 S AMHLVPR=$G(AMHPROV)
 S AMHTYPE=$G(AMHTYPE)
 S (DFN,AMHPAT,AUPNPAT)=AMHPAT
 S ^XTMP("AMHRPTRUN",JOB)=""
 D ^XBKSET
 D GETREC
 I 'AMHR S ^XTMP("AMHRPT",JOB,.5)=2,^XTMP("AMHRPT",JOB,1)="No visit found" D KILL Q
 ;S ZTRTN="TSK^AMHBHRP4",ZTIO="",ZTDESC="AMH LAST VISIT DISPLAY",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
 ;
GETREC ;
 S AMHR="",AMHEFT=$G(AMHEFT) I AMHEFT="" S AMHEFT="F"
 I '$D(^AMHREC("AE",AMHPAT)) Q
 I AMHLVPR="" S AMHDLAST=$O(^AMHREC("AE",AMHPAT,"")),AMHR=$O(^AMHREC("AE",AMHPAT,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  I $$PPINT^AMHUTIL(V)=AMHLVPR S AMHR=V
 .Q
 Q
TSK ;
 D ^XBKSET
 S ^XTMP("AMHRPTRUN",JOB)="START"
 D GUIR^XBLM($S(AMHTYPE="S":"EN1^AMHLELV",1:"^AMHLEFP2"),"^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