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

AMHGDINT.m

Go to the documentation of this file.
AMHGDINT ; IHS/CMI/MAW - AMHG Intake Form Data - frmIntake 9/16/2009 10:57:49 AM ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**1**;JUN 18, 2010;Build 8
 ;
 ;
 ;
DEBUG(RETVAL,AMHSTR) ;-- debug entry point
 D DEBUG^%Serenji("EP^AMHGD(RETVAL,.AMHSTR)")
 Q
 ;
INT(RETVAL,AMHSTR) ;-- get intake documents to display on listview
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHPAT,AMHREC,AMHPRG,AMHINTR,AMHBD,AMHED,AMHIDT
 S P="|",R="~"
 S AMHPAT=$P(AMHSTR,P)
 S AMHPRG=$P(AMHSTR,P,2)
 S AMHBD=$P(AMHSTR,P,3)
 S AMHED=$P(AMHSTR,P,4)
 S AMHPRGI=$$SCI^AMHGT(9002011.13,.05,AMHPRG)
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00001Type^T00010AMHREC^T00030DateInitial^T00030Program^T00030ProviderInitial^T00030DateUpdate^T00030ProviderUpdate^T00001Signed^T00010IPIen^T00010UpdIen^T00010InitialIntake^T00030UpdateProgram^"
 S @RETVAL@(AMHI)=@RETVAL@(AMHI)_"T00010UserUpdate^T00030DateofLastUpdate"_$C(30)
 S AMHRCNT=0,AMHLINE=0
 K AMHV
 N AMHXI
 S AMHXI=0 F  S AMHXI=$O(^AMHRINTK("AC",AMHPAT,AMHXI)) Q:AMHXI'=+AMHXI  D
 .;S AMHINTR=$P(^AMHRINTK(AMHXI,0),U,3)
 .;Q:'AMHINTR
 .Q:'$$ALLOWINT^AMHLEIV(DUZ,AMHXI)
 .I $P(^AMHRINTK(AMHXI,0),U,5)]"" Q:$P(^AMHRINTK(AMHXI,0),U,5)'=AMHPRGI
 .Q:$P(^AMHRINTK(AMHXI,0),U,9)'="I"  ;only initial intakes
 .S AMHIDT=$P($G(^AMHRINTK(AMHXI,0)),U)
 .I AMHBD,AMHIDT<AMHBD Q
 .I AMHED,AMHIDT>AMHED Q
 .S AMHV(9999999-$P(^AMHRINTK(AMHXI,0),U),AMHXI)=""
 S D=0,AMHLINE=0,AMHRCNT=0
 F  S D=$O(AMHV(D)) Q:D'=+D  D
 .S AMHXI=0 F  S AMHXI=$O(AMHV(D,AMHXI)) Q:AMHXI'=+AMHXI  D
 ..N AMHIDT,AMHPRGE,AMHPI,AMHDU,AMHPU,AMHSIG,AMHPIEN,AMHUIEN,AMHUUP,AMHDLUP
 ..S AMHL=""
 ..S AMHRCNT=AMHRCNT+1
 ..S AMHL=AMHRCNT
 ..S AMHINTR=$P(^AMHRINTK(AMHXI,0),U,3)
 ..S AMHIDT=$$LVDT^AMHGU($P(^AMHRINTK(AMHXI,0),U))
 ..S AMHPRGE=$$GET1^DIQ(9002011.13,AMHXI,.05)
 ..S AMHPI=$$GET1^DIQ(9002011.13,AMHXI,.04)
 ..S AMHPIEN=$$GET1^DIQ(9002011.13,AMHXI,.04,"I")
 ..S AMHUIEN=$$GET1^DIQ(9002011.13,AMHXI,.13,"I")
 ..S AMHUUP=$$GET1^DIQ(9002011.13,AMHXI,.06,"I")
 ..S AMHDLUP=$$GET1^DIQ(9002011.13,AMHXI,.07,"I")
 ..S AMHSIG=$S($P($G(^AMHRINTK(AMHXI,0)),U,11):"Y",1:"N")
 ..;I '$O(^AMHRINTK("AI",AMHXI,0)) D  Q
 .. S AMHI=AMHI+1
 .. S @RETVAL@(AMHI)=AMHXI_U_"I"_U_AMHINTR_U_AMHIDT_U_AMHPRGE_U_AMHPI_U_U_U_AMHSIG_U_AMHPIEN_U_AMHUIEN_U_""_U_""_U_AMHUUP_U_AMHDLUP_$C(30)
 ..N AMHY
 ..S AMHY=0 F  S AMHY=$O(^AMHRINTK("AI",AMHXI,AMHY)) Q:AMHY'=+AMHY  D
 ...S AMHL=""
 ...N AMHDU,AMHPU,AMHSIG,AMHPIEN,AMHUIEN,AMHUUP,AMHDLUP
 ...S AMHINTR=$P(^AMHRINTK(AMHY,0),U,3)
 ...S AMHDU=$$LVDT^AMHGU($P($P(^AMHRINTK(AMHY,0),U),"."))
 ...S AMHPU=$$VAL^XBDIQ1(9002011.13,AMHY,.04)
 ...S AMHSIG=$S($P($G(^AMHRINTK(AMHY,0)),U,11):"Y",1:"N")
 ...S AMHPIEN=$$GET1^DIQ(9002011.13,AMHY,.04,"I")
 ...S AMHPRGE=$$GET1^DIQ(9002011.13,AMHY,.05)
 ...S AMHUIEN=$$GET1^DIQ(9002011.13,AMHY,.13,"I")
 ...S AMHUUP=$$GET1^DIQ(9002011.13,AMHY,.06,"I")
 ...S AMHDLUP=$$GET1^DIQ(9002011.13,AMHY,.07,"I")
 ...S AMHI=AMHI+1
 ...;S @RETVAL@(AMHI)=AMHXI_U_"U"_U_AMHINTR_U_AMHIDT_U_AMHPRGE_U_AMHPI_U_AMHDU_U_AMHPU_U_AMHSIG_U_AMHPIEN_U_AMHUIEN_$C(30)
 ...S @RETVAL@(AMHI)=AMHY_U_"U"_U_AMHINTR_U_U_U_U_AMHDU_U_AMHPU_U_AMHSIG_U_AMHPIEN_U_AMHUIEN_U_AMHXI_U_AMHPRGE_U_AMHUUP_U_AMHDLUP_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
UINT(RETVAL,AMHSTR) ;-- get list of update intakes based on initial passed in
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN
 S P="|",R="~"
 S AMHIEN=$P(AMHSTR,P)
 S AMHPRG=$P(AMHSTR,P,2)
 S AMHPRGI=$$SCI^AMHGT(9002011,.02,AMHPRG)
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S @RETVAL@(AMHI)="T00010BMXIEN^T00010AMHREC^T00030DateUpdate^T00030ProviderUpdate^T00030Program^T00001Signed^T00010IPIen^T00010UpdIen"_$C(30)
 S AMHRCNT=0,AMHLINE=0
 K AMHV
 N AMHY,AMHINTR,AMHPIEN,AMHUIEN,AMHSIG,SMHDU,AMHPU
 S AMHY=0 F  S AMHY=$O(^AMHRINTK("AI",AMHIEN,AMHY)) Q:AMHY'=+AMHY  D
 .S AMHL=""
 .S AMHINTR=$P($G(^AMHRINTK(AMHY,0)),U,3)
 .S AMHPIEN=$$GET1^DIQ(9002011.13,AMHY,.04,"I")
 .S AMHUIEN=$$GET1^DIQ(9002011.13,AMHY,.06,"I")
 .S AMHSIG=$S($P($G(^AMHRINTK(AMHY,0)),U,11):"Y",1:"N")
 .S AMHDU=$$LVDT^AMHGU($P($P(^AMHRINTK(AMHY,0),U),"."))
 .S AMHPU=$$VAL^XBDIQ1(9002011.13,AMHY,.04)
 .S AMHI=AMHI+1
 .;S @RETVAL@(AMHI)=AMHXI_U_"U"_U_AMHINTR_U_AMHIDT_U_AMHPRGE_U_AMHPI_U_AMHDU_U_AMHPU_U_AMHSIG_U_AMHPIEN_U_AMHUIEN_$C(30)
 .S @RETVAL@(AMHI)=AMHY_U_AMHINTR_U_AMHDU_U_AMHPU_U_AMHPRG_U_AMHSIG_U_AMHPIEN_U_AMHUIEN_$C(30)
 S @RETVAL@(AMHI+1)=$C(31)
 Q
 ;
ASSESS(RETVAL,AMHSTR) ;-- retrieve the assessment for the assessment tab
 S X="MERR^AMHGU",@^%ZOSF("TRAP") ; m error trap
 N AMHI,P,R,AMHIEN,AMHVIEN
 S P="|",R="~"
 S RETVAL="^AMHTMP("_$J_")"
 S AMHI=0
 K ^AMHTMP($J)
 S AMHIEN=$P(AMHSTR,P)
 S @RETVAL@(AMHI)="T00250Assessment"_$C(30)
 N AMHDA
 I $G(AMHIEN) D
 . S AMHDA=0 F  S AMHDA=$O(^AMHRINTK(AMHIEN,41,AMHDA)) Q:'AMHDA  D
 .. N AMHDATA
 .. S AMHDATA=$G(^AMHRINTK(AMHIEN,41,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
 ;