BJPC2EVH ; IHS/CMI/LAB - PCC Suite v1.0 patch 1 environment check ;
;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
;
;
START ;
D MES^XPDUTL($$CJ^XLFSTR("Updating Health Factors...",IOM))
S BJPCX=0 F S BJPCX=$O(^APCDTHFD(BJPCX)) Q:BJPCX'=+BJPCX D
.S BJPCON=$P(^APCDTHFD(BJPCX,0),U,1)
.S BJPCNN=$P($G(^APCDTHFD(BJPCX,99)),U)
.S BJPCCAT=$P(^APCDTHFD(BJPCX,0),U,3)
.S BJPCCATI=$O(^AUTTHF("B",BJPCCAT,0))
.I 'BJPCCATI D ADDCAT I 'BJPCCATI D MES^XPDUTL("Failure to add category "_BJPCCAT) Q
.S BJPCCODE=$P(^APCDTHFD(BJPCX,0),U,2)
.S BJPCDHS=$P(^APCDTHFD(BJPCX,0),U,8)
.S BJPCET=$P(^APCDTHFD(BJPCX,0),U,10)
.S BJPCIF=$P(^APCDTHFD(BJPCX,0),U,13)
.S BJPCID=$P(^APCDTHFD(BJPCX,0),U,15)
.S BJPCMN=$P($G(^APCDTHFD(BJPCX,88)),U,1)
.S BJPCITP=$P($G(^APCDTHFD(BJPCX,99)),U,2)
.S BJPCY=0,BJPCHFI=0 F S BJPCY=$O(^AUTTHF("B",BJPCON,BJPCY)) Q:BJPCY'=+BJPCY!(BJPCHFI) D
..Q:$$VAL^XBDIQ1(9999999.64,BJPCY,.03)'=BJPCCAT
..S BJPCHFI=BJPCY
.;doesn't exist and is to be inactivated or is already inactivated so don't add it
.I 'BJPCHFI,(BJPCIF+BJPCITP+BJPCID) Q ;move on to next
.I 'BJPCHFI D
..I BJPCNN]"" S BJPCY=0,BJPCHFI=0 F S BJPCY=$O(^AUTTHF("B",BJPCNN,BJPCY)) Q:BJPCY'=+BJPCY!(BJPCHFI) D
...Q:$$VAL^XBDIQ1(9999999.64,BJPCY,.03)'=BJPCCAT
...S BJPCHFI=BJPCY
.I 'BJPCHFI D ADDNEW ;add new one
.;edit
.I BJPCNN]"",BJPCON'=BJPCNN S DIE="^AUTTHF(",DA=BJPCHFI,DR=".01///"_BJPCNN D ^DIE K DIE,DA,DR
.I BJPCITP S DA=BJPCHFI,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DR
.S DA=BJPCHFI,DIE="^AUTTHF(",DR=".1///"_BJPCET D ^DIE K DA,DR
.Q
S DIK="^AUTTHF(",DIK(1)=".03^F" D ENALL^DIK K DIK
Q
ADDNEW ;
S X=BJPCON,DIC="^AUTTHF(",DIC(0)="L",DIADD=1,DLAYGO=9999999.64,DIC("DR")=".02///"_BJPCCODE_";.03////"_BJPCCATI_";.1///"_BJPCET_";.08///"_BJPCDHS_";8801///"_BJPCMN K DO,DD,D0 D FILE^DICN K DIADD,DLAYGO,DIC,X
I Y=-1 D MES^XPDUTL("Error creating health factor "_BJPCON)
S BJPCHFI=+Y
Q
ADDCAT ;
S BJPCCATI=""
S X=BJPCCAT,DIC="^AUTTHF(",DIC(0)="L",DIADD=1,DLAYGO=9999999.64,DIC("DR")=".03///"_BJPCCAT_";.1///C;.02///"_BJPCCODE K DO,DD,D0 D FILE^DICN K DIADD,DLAYGO,DIC,X
I Y=-1 Q
S BJPCCATI=+Y
Q
BJPC2EVH ; IHS/CMI/LAB - PCC Suite v1.0 patch 1 environment check ;
+1 ;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
+2 ;
+3 ;
START ;
+1 DO MES^XPDUTL($$CJ^XLFSTR("Updating Health Factors...",IOM))
+2 SET BJPCX=0
FOR
SET BJPCX=$ORDER(^APCDTHFD(BJPCX))
IF BJPCX'=+BJPCX
QUIT
Begin DoDot:1
+3 SET BJPCON=$PIECE(^APCDTHFD(BJPCX,0),U,1)
+4 SET BJPCNN=$PIECE($GET(^APCDTHFD(BJPCX,99)),U)
+5 SET BJPCCAT=$PIECE(^APCDTHFD(BJPCX,0),U,3)
+6 SET BJPCCATI=$ORDER(^AUTTHF("B",BJPCCAT,0))
+7 IF 'BJPCCATI
DO ADDCAT
IF 'BJPCCATI
DO MES^XPDUTL("Failure to add category "_BJPCCAT)
QUIT
+8 SET BJPCCODE=$PIECE(^APCDTHFD(BJPCX,0),U,2)
+9 SET BJPCDHS=$PIECE(^APCDTHFD(BJPCX,0),U,8)
+10 SET BJPCET=$PIECE(^APCDTHFD(BJPCX,0),U,10)
+11 SET BJPCIF=$PIECE(^APCDTHFD(BJPCX,0),U,13)
+12 SET BJPCID=$PIECE(^APCDTHFD(BJPCX,0),U,15)
+13 SET BJPCMN=$PIECE($GET(^APCDTHFD(BJPCX,88)),U,1)
+14 SET BJPCITP=$PIECE($GET(^APCDTHFD(BJPCX,99)),U,2)
+15 SET BJPCY=0
SET BJPCHFI=0
FOR
SET BJPCY=$ORDER(^AUTTHF("B",BJPCON,BJPCY))
IF BJPCY'=+BJPCY!(BJPCHFI)
QUIT
Begin DoDot:2
+16 IF $$VAL^XBDIQ1(9999999.64,BJPCY,.03)'=BJPCCAT
QUIT
+17 SET BJPCHFI=BJPCY
End DoDot:2
+18 ;doesn't exist and is to be inactivated or is already inactivated so don't add it
+19 ;move on to next
IF 'BJPCHFI
IF (BJPCIF+BJPCITP+BJPCID)
QUIT
+20 IF 'BJPCHFI
Begin DoDot:2
+21 IF BJPCNN]""
SET BJPCY=0
SET BJPCHFI=0
FOR
SET BJPCY=$ORDER(^AUTTHF("B",BJPCNN,BJPCY))
IF BJPCY'=+BJPCY!(BJPCHFI)
QUIT
Begin DoDot:3
+22 IF $$VAL^XBDIQ1(9999999.64,BJPCY,.03)'=BJPCCAT
QUIT
+23 SET BJPCHFI=BJPCY
End DoDot:3
End DoDot:2
+24 ;add new one
IF 'BJPCHFI
DO ADDNEW
+25 ;edit
+26 IF BJPCNN]""
IF BJPCON'=BJPCNN
SET DIE="^AUTTHF("
SET DA=BJPCHFI
SET DR=".01///"_BJPCNN
DO ^DIE
KILL DIE,DA,DR
+27 IF BJPCITP
SET DA=BJPCHFI
SET DIE="^AUTTHF("
SET DR=".13///1;.15////"_DT
DO ^DIE
KILL DA,DR
+28 SET DA=BJPCHFI
SET DIE="^AUTTHF("
SET DR=".1///"_BJPCET
DO ^DIE
KILL DA,DR
+29 QUIT
End DoDot:1
+30 SET DIK="^AUTTHF("
SET DIK(1)=".03^F"
DO ENALL^DIK
KILL DIK
+31 QUIT
ADDNEW ;
+1 SET X=BJPCON
SET DIC="^AUTTHF("
SET DIC(0)="L"
SET DIADD=1
SET DLAYGO=9999999.64
SET DIC("DR")=".02///"_BJPCCODE_";.03////"_BJPCCATI_";.1///"_BJPCET_";.08///"_BJPCDHS_";8801///"_BJPCMN
KILL DO,DD,D0
DO FILE^DICN
KILL DIADD,DLAYGO,DIC,X
+2 IF Y=-1
DO MES^XPDUTL("Error creating health factor "_BJPCON)
+3 SET BJPCHFI=+Y
+4 QUIT
ADDCAT ;
+1 SET BJPCCATI=""
+2 SET X=BJPCCAT
SET DIC="^AUTTHF("
SET DIC(0)="L"
SET DIADD=1
SET DLAYGO=9999999.64
SET DIC("DR")=".03///"_BJPCCAT_";.1///C;.02///"_BJPCCODE
KILL DO,DD,D0
DO FILE^DICN
KILL DIADD,DLAYGO,DIC,X
+3 IF Y=-1
QUIT
+4 SET BJPCCATI=+Y
+5 QUIT