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

AMHGE.m

Go to the documentation of this file.
AMHGE ; IHS/CMI/MAW - AMHG GUI BH Filing Utilities 12/19/2008 2:59:00 PM ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
 ;
DEBUG(RETVAL,AMHSTR)  ;replace tag below to allow Serenji debug of GUI
 D DEBUG^%Serenji("MRUU^AMHGE(.AMHRET,.AMHSTR)")
 Q
 ;
MRUP(RETVAL,AMHSTR) ;-- save most recently selected item in AMHG MOST RECENTLY SELECTED PATIENT file
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,AMHERRR,P,AMHIEN,AMHFL,AMHFIEN,AMHTXT1,AMHTXT2
 S P="|"
 K ^AMHTMP($J)
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 S @RETVAL@(AMHI)="T00001Result"_$C(30)
 S AMHIEN=$P(AMHSTR,P)
 S AMHFL=$P(AMHSTR,P,2)
 S AMHFIEN=$P(AMHSTR,P,3)
 S AMHTXT1=$P(AMHSTR,P,4)
 S AMHTXT2=$P(AMHSTR,P,5)
 S AMHI=AMHI+1
 N AMHE
 S AMHE=$O(^AMHGMRUP("B",AMHIEN,0))
 I '$G(AMHE) D  Q  ;lets add the entire entry here
 . N AMHFDA,AMHIENS,AMHERRR
 . S AMHERRR=""
 . S AMHIENS(1)=AMHIEN
 . S AMHIENS(2)=AMHFL
 . S AMHIENS(3)=AMHFIEN
 . S AMHFDA(9002012.96,"+1,",.01)=AMHIEN
 . S AMHFDA(9002012.961,"+2,+1,",.01)=AMHFL
 . S AMHFDA(9002012.9611,"+3,+2,+1,",.01)=AMHFIEN
 . S AMHFDA(9002012.9611,"+3,+2,+1,",.02)=AMHTXT1
 . S AMHFDA(9002012.9611,"+3,+2,+1,",.03)=AMHTXT2
 . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
 . I '$G(AMHIENS(1)) S @RETVAL@(AMHI)=0_$C(30)
 . I $G(AMHIENS(1)) S @RETVAL@(AMHI)=1_$C(30)
 . S @RETVAL@(AMHI+1)=$C(31)
 N AMHF
 S AMHF=$O(^AMHGMRUP(AMHE,1,"B",AMHFL,0))
 I '$G(AMHF) D  Q  ;we have the patient but no file yet
 . N AMHFDA,AMHIENS,AMHERRR
 . S AMHERRR=""
 . S AMHIENS(1)=AMHIEN
 . S AMHIENS(2)=AMHFL
 . S AMHIENS(3)=AMHFIEN
 . S AMHFDA(9002012.96,AMHIEN_",",.01)=AMHIEN
 . S AMHFDA(9002012.961,"+2,"_AMHIEN_",",.01)=AMHFL
 . S AMHFDA(9002012.9611,"+3,+2,"_AMHIEN_",",.01)=AMHFIEN
 . S AMHFDA(9002012.9611,"+3,+2,"_AMHIEN_",",.02)=AMHTXT1
 . S AMHFDA(9002012.9611,"+3,+2,"_AMHIEN_",",.03)=AMHTXT2
 . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
 . I '$G(AMHIENS(1)) S @RETVAL@(AMHI)=0_$C(30)
 . I $G(AMHIENS(1)) S @RETVAL@(AMHI)=1_$C(30)
 . S @RETVAL@(AMHI+1)=$C(31)
 N AMHIT
 S AMHIT=$O(^AMHGMRUP(AMHE,1,AMHFL,1,"B",AMHFIEN,0))
 I '$G(AMHIT) D  Q
 . N AMHFDA,AMHIENS,AMHERRR
 . S AMHERRR=""
 . S AMHIENS(1)=AMHIEN
 . S AMHIENS(2)=AMHFL
 . S AMHIENS(3)=AMHFIEN
 . S AMHFDA(9002012.96,AMHIEN_",",.01)=AMHIEN
 . S AMHFDA(9002012.961,AMHFL_","_AMHIEN_",",.01)=AMHFL
 . S AMHFDA(9002012.9611,"+3,"_AMHFL_","_AMHIEN_",",.01)=AMHFIEN
 . S AMHFDA(9002012.9611,"+3,"_AMHFL_","_AMHIEN_",",.02)=AMHTXT1
 . S AMHFDA(9002012.9611,"+3,"_AMHFL_","_AMHIEN_",",.03)=AMHTXT2
 . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
 . I '$G(AMHIENS(1)) S @RETVAL@(AMHI)=0_$C(30)
 . I $G(AMHIENS(1)) S @RETVAL@(AMHI)=1_$C(30)
 . S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
MRUU(RETVAL,AMHSTR) ;-- save most recently selected item in AMHG MOST RECENTLY SELECTED USER file
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,AMHERRR,P,AMHIEN,AMHFL,AMHFIEN,AMHTXT1,AMHTXT2
 S P="|"
 K ^AMHTMP($J)
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 S @RETVAL@(AMHI)="T00001Result"_$C(30)
 S AMHIEN=$P(AMHSTR,P)
 S AMHFL=$P(AMHSTR,P,2)
 S AMHFIEN=$P(AMHSTR,P,3)
 S AMHTXT1=$P(AMHSTR,P,4)
 S AMHTXT2=$P(AMHSTR,P,5)
 S AMHI=AMHI+1
 N AMHE
 S AMHE=$O(^AMHGMRUU("B",AMHIEN,0))
 I '$G(AMHE) D  Q  ;lets add the entire entry here
 . N AMHFDA,AMHIENS,AMHERRR
 . S AMHERRR=""
 . S AMHIENS(1)=AMHIEN
 . S AMHIENS(2)=AMHFL
 . S AMHIENS(3)=AMHFIEN
 . S AMHFDA(9002012.97,"+1,",.01)=AMHIEN
 . S AMHFDA(9002012.971,"+2,+1,",.01)=AMHFL
 . S AMHFDA(9002012.9711,"+3,+2,+1,",.01)=AMHFIEN
 . S AMHFDA(9002012.9711,"+3,+2,+1,",.02)=AMHTXT1
 . S AMHFDA(9002012.9711,"+3,+2,+1,",.03)=AMHTXT2
 . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
 . I '$G(AMHIENS(1)) S @RETVAL@(AMHI)=0_$C(30)
 . I $G(AMHIENS(1)) S @RETVAL@(AMHI)=1_$C(30)
 . S @RETVAL@(AMHI+1)=$C(31)
 N AMHF
 S AMHF=$O(^AMHGMRUU(AMHE,1,"B",AMHFL,0))
 I '$G(AMHF) D  Q  ;we have the patient but no file yet
 . N AMHFDA,AMHIENS,AMHERRR
 . S AMHERRR=""
 . S AMHIENS(1)=AMHIEN
 . S AMHIENS(2)=AMHFL
 . S AMHIENS(3)=AMHFIEN
 . S AMHFDA(9002012.97,AMHIEN_",",.01)=AMHIEN
 . S AMHFDA(9002012.971,"+2,"_AMHIEN_",",.01)=AMHFL
 . S AMHFDA(9002012.9711,"+3,+2,"_AMHIEN_",",.01)=AMHFIEN
 . S AMHFDA(9002012.9711,"+3,+2,"_AMHIEN_",",.02)=AMHTXT1
 . S AMHFDA(9002012.9711,"+3,+2,"_AMHIEN_",",.03)=AMHTXT2
 . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
 . I '$G(AMHIENS(1)) S @RETVAL@(AMHI)=0_$C(30)
 . I $G(AMHIENS(1)) S @RETVAL@(AMHI)=1_$C(30)
 . S @RETVAL@(AMHI+1)=$C(31)
 N AMHIT
 S AMHIT=$O(^AMHGMRUU(AMHE,1,AMHFL,1,"B",AMHFIEN,0))
 I '$G(AMHIT) D  Q
 . N AMHFDA,AMHIENS,AMHERRR
 . S AMHERRR=""
 . S AMHIENS(1)=AMHIEN
 . S AMHIENS(2)=AMHFL
 . S AMHIENS(3)=AMHFIEN
 . S AMHFDA(9002012.97,AMHIEN_",",.01)=AMHIEN
 . S AMHFDA(9002012.971,AMHFL_","_AMHIEN_",",.01)=AMHFL
 . S AMHFDA(9002012.9711,"+3,"_AMHFL_","_AMHIEN_",",.01)=AMHFIEN
 . S AMHFDA(9002012.9711,"+3,"_AMHFL_","_AMHIEN_",",.02)=AMHTXT1
 . S AMHFDA(9002012.9711,"+3,"_AMHFL_","_AMHIEN_",",.03)=AMHTXT2
 . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
 . I '$G(AMHIENS(1)) S @RETVAL@(AMHI)=0_$C(30)
 . I $G(AMHIENS(1)) S @RETVAL@(AMHI)=1_$C(30)
 . S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
MRUDP(RETVAL,AMHSTR) ;-- remove an entry from the most recently selected list
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,AMHERRR,P,AMHIEN,AMHFL,AMHFIEN
 S P="|"
 K ^AMHTMP($J)
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 S @RETVAL@(AMHI)="T00001Result"_$C(30)
 S AMHIEN=$P(AMHSTR,P)
 S AMHFL=$P(AMHSTR,P,2)
 S AMHFIEN=$P(AMHSTR,P,3)
 S DA(2)=AMHIEN,DA(1)=AMHFL,DA=AMHFIEN
 S DIK="^AMHGMRUP("_DA(2)_",1,"_DA(1)_",1,"
 D ^DIK
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
MRUDU(RETVAL,AMHSTR) ;-- remove an entry from the most recently selected list
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,AMHERRR,P,AMHIEN,AMHFL,AMHFIEN
 S P="|"
 K ^AMHTMP($J)
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 S @RETVAL@(AMHI)="T00001Result"_$C(30)
 S AMHIEN=$P(AMHSTR,P)
 S AMHFL=$P(AMHSTR,P,2)
 S AMHFIEN=$P(AMHSTR,P,3)
 S DA(2)=AMHIEN,DA(1)=AMHFL,DA=AMHFIEN
 S DIK="^AMHGMRUU("_DA(2)_",1,"_DA(1)_",1,"
 D ^DIK
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;