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

BTPWPTBL.m

Go to the documentation of this file.
BTPWPTBL ;VNGT/HS/ALA-CMET Event Table ; 05 Feb 2009  10:24 AM
 ;;1.0;CARE MANAGEMENT EVENT TRACKING;;Feb 07, 2011
 ;
 ;
LST(DATA,PROC) ; EP -- BTPW GET CMET PROCEDURES
 NEW UID,II,TIEN,TTXT,TAXV,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BTPWPTBL",UID))
 K @DATA
 ;
 S PROC=$G(PROC,"")
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BTPWPTBL D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S HDR="I00010PRCIEN^T00030PRCNAME^T00030PRCCAT^T00003PRCACTV^T00003PRCAUTO^T00004PRCRESD^T00004PRCNOTD^T00004PRCFOLD^"
 S HDR=HDR_"T00006PRCLIM^T00012PRCGEN^T00010PRCLOW^T00010PRCHIGH^T01024PRCTAX"
 S @DATA@(II)=HDR_$C(30)
 ;
 I PROC'="" D PRCS(PROC)
 ;
 I PROC="" D
 . S PROC=0
 . F  S PROC=$O(^BTPW(90621,PROC)) Q:'PROC  D PRCS(PROC)
 ;
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
 ;
PRCS(PRCN) ;
 NEW TDATA,TDATA5,NAME,AUTO,INACT,NOR,NOF,NON,LIM,AGEL,AGEU,GEN,TAX
 S TDATA=^BTPW(90621,PRCN,0),TDATA5=$G(^BTPW(90621,PRCN,5))
 S CAT=$$CAT^BTPWPDSP(PRCN)
 S NAME=$P(TDATA,U,1)
 S AUTO=$P(TDATA,U,6),AUTO=$S(AUTO=1:"YES",1:"NO")
 S INACT=$P(TDATA,U,3),INACT=$S(INACT'="":"NO",1:"YES")
 S NOR=$P(TDATA,U,7),NOF=$P(TDATA,U,8),NON=$P(TDATA,U,9)
 S LIM=$P(TDATA5,U,4),AGEL=$P(TDATA5,U,2),AGEU=$P(TDATA5,U,3)
 S GEN=$$GET1^DIQ(90621,PRCN_",",5.01,"E")
 S TAX="",TXN=0
 F  S TXN=$O(^BTPW(90621,PRCN,1,TXN)) Q:'TXN  D
 . S TAX=TAX_$P(^BTPW(90621,PRCN,1,TXN,0),U,1)_$C(28)
 S TAX=$$TKO^BQIUL1(TAX,$C(28))
 S II=II+1
 S @DATA@(II)=PRCN_U_NAME_U_CAT_U_INACT_U_AUTO_U_NOR_U_NON_U_NOF_U_LIM_U_GEN_U_AGEL_U_AGEU_U_TAX_$C(30)
 Q
 ;
FOL(DATA,PRCN) ;EP - Get Followup values
 NEW FN,VALUE,RES
 S FN=0,VALUE=PRCN_U_$$GET1^DIQ(90621,PRCN_",",.01,"E")
 F  S FN=$O(^BTPW(90621,PRCN,3,FN)) Q:'FN  D
 . NEW DA,IENS
 . S DA(1)=PRCN,DA=FN,IENS=$$IENS^DILF(.DA)
 . S RES=$$GET1^DIQ(90621.03,IENS,.01,"I")_$C(28)_$$GET1^DIQ(90621.03,IENS,.01,"E")
 . S WHEN=$$GET1^DIQ(90621.03,IENS,.04,"I"),WHEN=$$FMTE^BQIUL1(WHEN)
 . S II=II+1,@DATA@(II)=VALUE_U_RES_U_$$GET1^DIQ(90621.03,IENS,.02,"E")_U_$$GET1^DIQ(90621.03,IENS,.03,"E")_U_WHEN_$C(30)
 Q
 ;
UPD(DATA,PRCN,PARMS) ; EP -- BTPW UPDATE FOLLOWUP PARAMETERS
 NEW UID,II,BN,LIST,PDATA,NAME,VALUE,VFIEN,FILE,PTYP,CHIEN,FIELD,EXEC
 NEW BTPWDTA,ERROR,RESULT,BQ
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BTPWUPD",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BTPWPTBL D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="I00010RESULT^T001024ERROR"_$C(30)
 ;
 S VFIEN=$O(^BQI(90506.3,"B","CMET Event Followups",""))
 I VFIEN="" S BMXSEC="RPC Call Failed: CMET Event Followups Definition does not exist." Q
 S FILE=$P(^BQI(90506.3,VFIEN,0),U,2)
 ;
 S PARMS=$G(PARMS,"")
 I PARMS="" D
 . S LIST="",BN=""
 . F  S BN=$O(PARMS(BN)) Q:BN=""  S LIST=LIST_PARMS(BN)
 . K PARMS
 . S PARMS=LIST
 . K LIST
 ;
 F BQ=1:1:$L(PARMS,$C(28)) D  Q:$G(BMXSEC)'=""
 . S PDATA=$P(PARMS,$C(28),BQ) Q:PDATA=""
 . S NAME=$P(PDATA,"=",1),VALUE=$P(PDATA,"=",2,99)
 . I VALUE="" S VALUE="@"
 . S PFIEN=$O(^BQI(90506.3,VFIEN,10,"AC",NAME,""))
 . I PFIEN="" S BMXSEC=NAME_" not a valid parameter for this update" Q
 . S PTYP=$P($G(^BQI(90506.3,VFIEN,10,PFIEN,1)),U,1)
 . I PTYP="D" S VALUE=$$DATE^BQIUL1(VALUE)
 . I PTYP="C" D
 .. S CHIEN=$O(^BQI(90506.3,VFIEN,10,PFIEN,5,"B",VALUE,"")) I CHIEN="" Q
 .. S VALUE=$P(^BQI(90506.3,VFIEN,10,PFIEN,5,CHIEN,0),U,2)
 . S FIELD=$P($G(^BQI(90506.3,VFIEN,10,PFIEN,3)),U,1)
 . S EXEC=$G(^BQI(90506.3,VFIEN,10,PFIEN,7))
 . I EXEC'="" X EXEC Q
 . I FIELD="" Q
 . S DA(1)=PRCN
 . I NAME="BTPWPINT" S DA=$O(^BTPW(90621,PRCN,3,"B",VALUE,"")) I DA="" D
 .. NEW DIC,DLAYGO,X
 .. S X=VALUE,DLAYGO=90621.03,DA(1)=PRCN,DIC="^BTPW(90621,"_DA(1)_",3,",DIC(0)="L"
 .. I $G(^BTPW(90621,DA(1),3,0))="" S ^BTPW(90621,DA(1),3,0)="^90621.03S^^"
 .. K DO,DD D FILE^DICN
 .. S DA=+Y
 . NEW IENS
 . S IENS=$$IENS^DILF(.DA)
 . S BTPWDTA(FILE,IENS,FIELD)=VALUE
 . S BTPWDTA(FILE,IENS,.03)=DUZ,BTPWDTA(FILE,IENS,.04)=$$NOW^XLFDT()
 D FILE^DIE("","BTPWDTA","ERROR")
 ;
 S RESULT=1_U
 I $D(ERROR)>0 S RESULT=-1_U
 K ERROR
 I $D(BQIDATA)>0 D FILE^DIE("","BTPWDTA","ERROR")
 I $D(ERROR)>0 S RESULT=-1_U_$G(ERROR("DIERR",1,"TEXT",1))
 I $P(RESULT,U,1)'=-1 S RESULT=1_U
 S II=II+1,@DATA@(II)=RESULT_$C(30)
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q