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

AMHGSGP.m

Go to the documentation of this file.
AMHGSGP ; IHS/CMI/MAW - AMHG Save Group Encounter 3/8/2009 7:41:21 PM ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**2,4,5**;JUN 02, 2010;Build 18
 ;
 ;
 ;
DEBUG(RETVAL,AMHSTR)  ;replace tag below to allow Serenji debug of GUI
 D DEBUG^%Serenji("GP^AMHGSGP(.RETVAL,.AMHSTR)")
 Q
 ;
GP(RETVAL,AMHSTR) ;-- save group data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHDM,AMHREC,AMHPP,AMHPRG,AMHGN,AMHCL,AMNNS,AMHTOC,AMHEL,AMHED,AMHCS,AMHACT,AMHAT,AMHSP,AMHPV,AMHPRGN,AMHCPT,AMHEDU,AMHPATS,AMHER,AMHCC
 N PV,CPT,EDU,PATS
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 I $G(AMHSTR)="" D CATSTR^AMHGU(.AMHSTR,.AMHSTR)
 S AMHDM=$P(AMHSTR,P)
 S AMHREC=$P(AMHSTR,P,2)
 S AMHPP=$P(AMHSTR,P,3)
 S AMHPRG=$$SCI^AMHGT(9002011.67,.02,$P(AMHSTR,P,4))
 S AMHGN=$P(AMHSTR,P,5)
 S AMHCL=$P(AMHSTR,P,6)
 S AMHNS=$P(AMHSTR,P,7)
 S AMHTOC=$P(AMHSTR,P,8)
 S AMHEL=$P(AMHSTR,P,9)
 S AMHED=+$P(AMHSTR,P,10)
 S AMHCS=$P(AMHSTR,P,11)
 S AMHACT=$P(AMHSTR,P,12)
 S AMHAT=$P(AMHSTR,P,13)
 S AMHSP=$P(AMHSTR,P,14)
 S AMHPV=$P(AMHSTR,P,15)
 S AMHPRGN=$P(AMHSTR,P,16)
 S AMHCPT=$P(AMHSTR,P,17)
 S AMHEDU=$P(AMHSTR,P,18)
 S AMHPATS=$P(AMHSTR,P,19)
 S AMHCC=$P(AMHSTR,P,20)
 D ARRAY^AMHGU(.PV,AMHPV)
 D ARRAY^AMHGU(.CPT,AMHCPT)
 D ARRAY^AMHGU(.EDU,AMHEDU)
 D ARRAY^AMHGU(.PATS,AMHPATS)
 D GP^AMHGEGP(.AMHREC,AMHDM,AMHREC,AMHPRG,AMHGN,AMHCL,AMHNS,AMHTOC,AMHEL,AMHED,AMHCS,AMHACT,AMHAT,AMHCC)
 I $G(AMHER)="" D CLNPRV^AMHGEGP(AMHREC)
 I $G(AMHER)="" D MODPRV^AMHGEGP(AMHPP,AMHDM,AMHREC,"","P")
 ;v4.0p2 ihs/cmi/maw modified all below to not file if in edit mode
 I $G(AMHER)="",AMHDM="A" D SP^AMHGEGP(AMHDM,AMHREC,"",AMHSP)
 I $G(AMHER)="",AMHDM="A" D GPOV^AMHGEGP(AMHDM,AMHREC,.PV)
 I $G(AMHER)="",AMHDM="A" D PN^AMHGEGP(AMHDM,AMHREC,AMHPRGN,"")
 I $G(AMHER)="",AMHDM="A" D CPT^AMHGEGP(AMHREC,.CPT)
 I $G(AMHER)="",AMHDM="A" D EDU^AMHGEGP(AMHREC,.EDU)
 I $G(AMHER)="",AMHDM="A" D PATS^AMHGEGP(AMHREC,.PATS)
 S @RETVAL@(AMHI)="T00030Result"_$C(30)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=$S($G(AMHER)]"":AMHER,1:AMHREC)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
POV(RETVAL,AMHSTR) ;-- save POV
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHDM,AMHREC,AMHPV,AMHP,AMHER,APV
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 I $G(AMHSTR)="" D CATSTR^AMHGU(.AMHSTR,.AMHSTR)
 S AMHDM=$P(AMHSTR,P)
 S AMHREC=$P(AMHSTR,P,2)
 S AMHPV=$P(AMHSTR,P,3)
 S AMHP=$P(AMHSTR,P,4)
 D ARRAY^AMHGU(.APV,AMHPV)
 D POV^AMHGEGP(AMHDM,AMHREC,AMHP,.APV)
 S @RETVAL@(AMHI)="T00030Result"_$C(30)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=$S($G(AMHER)]"":AMHER,1:AMHREC)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
CPT(RETVAL,AMHSTR) ;-- save CPT
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHDM,AMHREC,AMHCPT,AMHP,AMHER
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 I $G(AMHSTR)="" D CATSTR^AMHGU(.AMHSTR,.AMHSTR)
 S AMHDM=$P(AMHSTR,P)
 S AMHREC=$P(AMHSTR,P,2)
 S AMHCPT=$P(AMHSTR,P,3)
 S AMHP=$P(AMHSTR,P,4)
 N ACPT
 D ARRAY^AMHGU(.ACPT,.AMHCPT)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(ACPT(AMHDA)) Q:'AMHDA  D
 . N CPT
 . S CPT=+$G(ACPT(AMHDA))
 . S QTY=+$P(ACPT(AMHDA),R,4)
 . I QTY<1 S QTY=1
 . S MOD1=$P(ACPT(AMHDA),R,5)
 . S MOD2=$P(ACPT(AMHDA),R,7)
 . D MODCPT^AMHGEVF(CPT,QTY,MOD1,MOD2,AMHP,AMHREC)
 I AMHDM="E" D DELCPT^AMHGEVF(AMHREC,.ACPT)
 S @RETVAL@(AMHI)="T00030Result"_$C(30)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=$S($G(AMHER)]"":AMHER,1:AMHREC)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
MH(RETVAL,AMHSTR) ;-- save MHSS records
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHDM,AMHREC,AMHMH,AMHP,MH,AMHER
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 I $G(AMHSTR)="" D CATSTR^AMHGU(.AMHSTR,.AMHSTR)
 S AMHDM=$P(AMHSTR,P)
 S AMHREC=$P(AMHSTR,P,2)
 S AMHMH=$P(AMHSTR,P,3)
 D ARRAY^AMHGU(.MH,AMHMH)
 D MH^AMHGEGP(AMHREC,.MH)
 S @RETVAL@(AMHI)="T00030Result"_$C(30)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=$S($G(AMHER)]"":AMHER,1:AMHREC)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
PNCA(RETVAL,AMHSTR) ;-- save progress notes/comment next appointment
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHDM,AMHREC,AMHPN,AMHCA,AMHP,AMHER,AMHCC
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 I $G(AMHSTR)="" D CATSTR^AMHGU(.AMHSTR,.AMHSTR)
 S AMHDM=$P(AMHSTR,P)
 S AMHREC=$P(AMHSTR,P,2)
 S AMHPN=$P(AMHSTR,P,3)
 S AMHCA=$P(AMHSTR,P,4)
 S AMHP=$P(AMHSTR,P,5)
 S AMHCC=$P(AMHSTR,P,6)
 I $G(AMHDM)="A" S $P(^AMHREC(AMHREC,21),U)=AMHCC
 D PN^AMHGEVF(AMHDM,AMHREC,AMHPN,AMHP)
 D CMT^AMHGEVF(AMHDM,AMHREC,AMHCA,AMHP)
 S @RETVAL@(AMHI)="T00030Result"_$C(30)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=$S($G(AMHER)]"":AMHER,1:AMHREC)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
DEL(RETVAL,AMHSTR) ;-- mark a record as deleted
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHDM,AMHREC,AMHER
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 I $G(AMHSTR)="" D CATSTR^AMHGU(.AMHSTR,.AMHSTR)
 K ^AMHTMP($J)
 S AMHREC=$P(AMHSTR,P)
 ;D DELI(AMHREC)
 S DIK="^AMHGROUP(",DA=AMHREC D ^DIK
 S @RETVAL@(AMHI)="T00030Result"_$C(30)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=$S($G(AMHER)]"":AMHER,1:AMHREC)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
DELI(REC) ;-- delete each individual entry first
 N RDA
 S RDA=0 F  S RDA=$O(^AMHGROUP(REC,61,RDA)) Q:'RDA  D
 . N IREC
 . S IREC=$G(^AMHGROUP(REC,61,RDA,0))
 . D EN^AMHGVDEL(.IREC,IREC)
 Q
 ;