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

AMHGDTP.m

Go to the documentation of this file.
AMHGDTP ; IHS/CMI/MAW - AMHG Treatment Plan Data Entry 1/6/2009 9:05:55 AM ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**1,4**;JUN 18, 2010;Build 28
 ;
 ;
 ;this routine will handle data on the Treatment Plan Data Entry Form (frmTreatmentPlanDataEntry)
 ;
DEBUG(RETVAL,AMHSTR) ;-- debug entry point
 D DEBUG^%Serenji("EP^AMHGD(RETVAL,.AMHSTR)")
 Q
 ;
TP(RETVAL,AMHSTR) ;-- get treatment plan info
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00030DateEstablished^T00030Program^T00030TargetDate^T00030ReviewDate^T00030DateClosed^T00030DesignatedProvider^T00240ProblemList^T00030CaseAdmit^T00030ConcurredDate^T00030ConcurSupervisor^T00001dsm4"_$C(30)
 N AMHDE,AMHPRGI,AMHPRG,AMHPRGS,AMHTD,AMHRD,AMHDC,AMHPRVI,AMHPRV,AMHPRVS,AMHPRBL,AMHCA,AMHCD,AMHCS,AMHCSI,AMHCSS,AMHDSM4
 S AMHDE=$$GET1^DIQ(9002011.56,AMHIEN,.01,"I")
 S AMHTD=$$GET1^DIQ(9002011.56,AMHIEN,.03,"I")
 S AMHRD=$$GET1^DIQ(9002011.56,AMHIEN,.09,"I")
 S AMHDC=$$GET1^DIQ(9002011.56,AMHIEN,.12,"I")
 S AMHPRGI=$$GET1^DIQ(9002011.56,AMHIEN,.17,"I")
 S AMHPRG=$$GET1^DIQ(9002011.56,AMHIEN,.17)
 I AMHPRGI]"" S AMHPRGS=AMHPRGI_R_AMHPRG
 S AMHPRVI=$$GET1^DIQ(9002011.56,AMHIEN,.04,"I")
 S AMHPRV=$$GET1^DIQ(9002011.56,AMHIEN,.04)
 I AMHPRVI S AMHPRVS=AMHPRVI_R_AMHPRV
 S AMHPRBL=$$GET1^DIQ(9002011.56,AMHIEN,1101)
 S AMHCA=$$GET1^DIQ(9002011.56,AMHIEN,.16,"I")
 S AMHCD=$$GET1^DIQ(9002011.56,AMHIEN,.06,"I")
 S AMHCSI=$$GET1^DIQ(9002011.56,AMHIEN,.05,"I")
 S AMHCS=$$GET1^DIQ(9002011.56,AMHIEN,.05)
 S AMHCSS=$S(AMHCSI:AMHCSI_R_AMHCS,1:"")
 S AMHDSM4=$$GET1^DIQ(9002011.56,AMHIEN,.22,"I")
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=AMHIEN_U_AMHDE_U_$G(AMHPRG)_U_AMHTD_U_AMHRD_U_AMHDC_U_$G(AMHPRVS)_U_AMHPRBL_U_AMHCA_U_AMHCD_U_AMHCSS_U_AMHDSM4_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
AXISI(RETVAL,AMHSTR) ;-- get axis I data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00250AxisI"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,6,AMHDA)) Q:'AMHDA  D
 . N AMHDATA
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,6,AMHDA,0))
 . ;I AMHDATA'[$C(10) S AMHDATA=AMHDATA_$C(10)  ;cmi/maw 06/16/2010 try removing this and see what happens 11/18/2010
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHDATA_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
AXISII(RETVAL,AMHSTR) ;-- get axis II data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00250AxisII"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,8,AMHDA)) Q:'AMHDA  D
 . N AMHDATA
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,8,AMHDA,0))
 . ;I AMHDATA'[$C(10) S AMHDATA=AMHDATA_$C(10)  ;cmi/maw 06/16/2010 try removing this and see what happens 11/18/2010
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHDATA_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
AXISIII(RETVAL,AMHSTR) ;-- get axis III data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00250AxisIII"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,7,AMHDA)) Q:'AMHDA  D
 . N AMHDATA
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,7,AMHDA,0))
 . ;I AMHDATA'[$C(10) S AMHDATA=AMHDATA_$C(10)  ;cmi/maw 06/16/2010 try removing this and see what happens 11/18/2010
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHDATA_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
AXISIV(RETVAL,AMHSTR) ;-- get axis IV data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00030Code^T00080Narrative"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,9,AMHDA)) Q:'AMHDA  D
 . N AMHXI,AMHXC,AMHXE
 . S AMHXI=$P($G(^AMHPTXP(AMHIEN,9,AMHDA,0)),U)
 . S AMHXC=$$GET1^DIQ(9002012.9,AMHXI,.01)
 . S AMHXE=$$GET1^DIQ(9002012.9,AMHXI,.02)
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHXI_U_AMHXC_U_AMHXE_$C(30)
 Q
 ;
AXISV(RETVAL,AMHSTR) ;-- get axis V data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00030AxisV^T00020GAF"_$C(30)
 N AMHDATA,AMHA5,AMHGAF
 S AMHDATA=$G(^AMHPTXP(AMHIEN,16))
 S AMHA5=$P(AMHDATA,U)
 S AMHGAF=$P(AMHDATA,U,2)
 S AMHI=AMHI+1
 S @RETVAL@(AMHI)=AMHA5_U_AMHGAF_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
DX(RETVAL,AMHSTR) ;-- get DX data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00250Dx"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,21,AMHDA)) Q:'AMHDA  D
 . N AMHDATA
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,21,AMHDA,0))
 . ;I AMHDATA'[$C(10) S AMHDATA=AMHDATA_$C(10)  ;cmi/maw 06/16/2010 try removing this and see what happens 11/18/2010
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHDATA_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
NARR(RETVAL,AMHSTR) ;-- get narrative data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00250TreatmentPlanNarrative"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,18,AMHDA)) Q:'AMHDA  D
 . N AMHDATA
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,18,AMHDA,0))
 . ;I AMHDATA'[$C(10) S AMHDATA=AMHDATA_$C(10)  ;cmi/maw 06/16/2010 try removing this and see what happens 11/18/2010
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHDATA_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
REV(RETVAL,AMHSTR) ;-- get treatment plan review list view
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00010BMXIEN2^T00030ReviewDate^T00030ReviewProvider^T00030ReviewSupervisor^T00030NextReviewDate^T00050ReviewProviderComplete^T00050ReviewSupervisorComplete"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,41,AMHDA)) Q:'AMHDA  D
 . N AMHDATA,AMHRD,AMHRP,AMHRS,AMHNR,AMHRPI,AMHRPS,AMHRSI,AMHRSS
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,41,AMHDA,0))
 . S AMHRD=$P(AMHDATA,U)
 . S AMHRPI=$P(AMHDATA,U,3)
 . S AMHRSI=$P(AMHDATA,U,4)
 . S AMHRP=$S($P(AMHDATA,U,3):$$GET1^DIQ(200,$P(AMHDATA,U,3),.01),1:"")
 . S AMHRS=$S($P(AMHDATA,U,4):$$GET1^DIQ(200,$P(AMHDATA,U,4),.01),1:"")
 . I AMHRPI]"" S AMHRPS=AMHRPI_R_AMHRP
 . I AMHRSI]"" S AMHRSS=AMHRSI_R_AMHRS
 . S AMHNR=$P(AMHDATA,U,2)
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHIEN_U_AMHDA_U_$$LVDT^AMHGU(AMHRD)_U_AMHRP_U_AMHRS_U_$$LVDT^AMHGU(AMHNR)_U_$G(AMHRPS)_U_$G(AMHRSS)_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
PPAR(RETVAL,AMHSTR) ;-- get plan participants
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00030Participant^T00030Relationship"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,17,AMHDA)) Q:'AMHDA  D
 . N AMHDATA,AMHPAR,AMHREL
 . S AMHDATA=$G(^AMHPTXP(AMHIEN,17,AMHDA,0))
 . S AMHPAR=$P(AMHDATA,U)
 . S AMHREL=$P(AMHDATA,U,2)
 . S AMHI=AMHI+1
 . S @RETVAL@(AMHI)=AMHIEN_U_AMHPAR_U_AMHREL_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
PAR(RETVAL,AMHSTR) ;-- get participants for treatment plan review
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00010BMXIEN2^T00010BMXIEN3^T00030Participant^T00030Relationship"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,41,AMHDA)) Q:'AMHDA  D
 . N AMHOEN
 . S AMHOEN=0 F  S AMHOEN=$O(^AMHPTXP(AMHIEN,41,AMHDA,12,AMHOEN)) Q:'AMHOEN  D
 .. N AMHDATA,AMHPAR,AMHREL
 .. S AMHDATA=$G(^AMHPTXP(AMHIEN,41,AMHDA,12,AMHOEN,0))
 .. S AMHPAR=$P(AMHDATA,U)
 .. S AMHREL=$P(AMHDATA,U,2)
 .. S AMHI=AMHI+1
 ..S @RETVAL@(AMHI)=AMHIEN_U_AMHDA_U_AMHOEN_U_AMHPAR_U_AMHREL_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
SUM(RETVAL,AMHSTR) ;-- get participants for treatment plan review
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00010BMXIEN2^T00010BMXIEN3^T00250ProgressSummary"_$C(30)
 N AMHDA
 S AMHDA=0 F  S AMHDA=$O(^AMHPTXP(AMHIEN,41,AMHDA)) Q:'AMHDA  D
 . N AMHOEN
 . S AMHOEN=0 F  S AMHOEN=$O(^AMHPTXP(AMHIEN,41,AMHDA,1,AMHOEN)) Q:'AMHOEN  D
 .. N AMHSUM
 .. S AMHSUM=$G(^AMHPTXP(AMHIEN,41,AMHDA,1,AMHOEN,0))
 .. ;I AMHSUM'[$C(10) S AMHSUM=AMHSUM_$C(10)  ;cmi/maw 06/16/2010 try removing this and see what happens 11/18/2010
 .. S AMHI=AMHI+1
 ..S @RETVAL@(AMHI)=AMHIEN_U_AMHDA_U_AMHOEN_U_AMHSUM_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
DELRD(RETVAL,AMHSTR) ;-- delete treatment plan review data
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN,AMHOEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S AMHOEN=$P(AMHSTR,P,2)
 S DA(1)=AMHIEN
 S DA=AMHOEN
 S @RETVAL@(AMHI)="T00001Result"_$C(30)
 S DIK="^AMHPTXP("_DA(1)_",41,"
 D ^DIK
 Q
 ;
DELPAR(RETVAL,AMHSTR) ;-- delete treatment plan review participants
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN,AMHOEN,AMHUEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S AMHOEN=$P(AMHSTR,P,2)
 S AMHUEN=$P(AMHSTR,P,3)
 S DA(2)=AMHIEN
 S DA(1)=AMHOEN
 S DA=AMHUEN
 S @RETVAL@(AMHI)="T00001Result"_$C(30)
 S DIK="^AMHPTXP("_DA(2)_",41,"_DA(1)_",12,"
 D ^DIK
 Q
 ;