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

BQIBHSFL.m

Go to the documentation of this file.
BQIBHSFL ;VNGT/HS/ALA-Behav Health Suicide Form List ; 01 Mar 2011  3:37 PM
 ;;2.2;ICARE MANAGEMENT SYSTEM;;Jul 28, 2011;Build 37
 ;
 ;
EN(DATA,DFN) ;EP -- BQI BH GET SUICIDE FORMS
 ; Input Parameter
 ;   DFN - Patient internal entry number
 ; 
 NEW UID,II,HDR,IEN,SDATA,DTACT,BEH,METH,MT,UCR,DCR,ULM,DLM
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIBHSFL",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIBHSFL D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S HDR="I00010HIDE_IEN^D00015DATE_ACT^T00030BEHAVIOR^T01024METHOD^T00035USER_CRT"
 S HDR=HDR_"^D00030DT_CRT^T00035USER_LSTMOD^D00030DT_LSTMOD"
 ;
 S @DATA@(II)=HDR_$C(30)
 S IEN=""
 F  S IEN=$O(^AMHPSUIC("AC",DFN,IEN)) Q:IEN=""  D
 . S SDATA=$G(^AMHPSUIC(IEN,0))
 . ; Date of Act
 . S DTACT=$P(SDATA,U,6) I DTACT="" Q
 . ; Suicide behavior
 . S BEH=$$GET1^DIQ(9002011.65,IEN_",",.13,"E") I BEH="" Q
 . ; User/Date created/last modified
 . S UCR=$$GET1^DIQ(9002011.65,IEN_",",.19,"E")
 . S DCR=$$GET1^DIQ(9002011.65,IEN_",",.18,"I")
 . S ULM=$$GET1^DIQ(9002011.65,IEN_",",.22,"E")
 . S DLM=$$GET1^DIQ(9002011.65,IEN_",",.21,"I")
 . S METH="",MT=0
 . F  S MT=$O(^AMHPSUIC(IEN,11,MT)) Q:'MT  D
 .. NEW DA,IENS
 .. S DA(1)=IEN,DA=MT,IENS=$$IENS^DILF(.DA)
 .. S METH=METH_$$GET1^DIQ(9002011.6511,IENS,.01,"E")_"; "
 . S METH=$$TKO^BQIUL1(METH,"; ")
 . S II=II+1,@DATA@(II)=IEN_U_$$FMTE^BQIUL1(DTACT)_U_BEH_U_METH_U_UCR_U_$$FMTE^BQIUL1(DCR)_U_ULM_U_$$FMTE^BQIUL1(DLM)_$C(30)
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q