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

BCHPOST.m

Go to the documentation of this file.
BCHPOST ; IHS/CMI/LAB - POST INIT ROUTINE ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;
ENV ;EP;
 ; The following line prevents the "Disable Options..." and "Move
 ; Routines..." questions from being asked during the install.
 F X="XPM1","XPO1","XPZ1","XPZ2","XPI1" S XPDDIQ(X)=0
 I +$$VERSION^XPDUTL("XU")<8 D MES^XPDUTL($$CJ^XLFSTR("Version 8.0 of KERNEL is required.  Not installed",80)) D SORRY(2) I 1
 E  D MES^XPDUTL($$CJ^XLFSTR("Requires Kernel Version 8.0....Present.",80))
 I +$$VERSION^XPDUTL("DI")<22 D MES^XPDUTL($$CJ^XLFSTR("Version 22.0 of FILEMAN is required.  Not installed.",80)) D SORRY(2) I 1
 E  D MES^XPDUTL($$CJ^XLFSTR("Requires Fileman v22....Present.",80))
 ;I '$$INSTALLD("ACM*2.0*6") D SORRY(2)
 Q
PRE ;
 S DA=0 F  S DA=$O(^BCHSORT(DA)) Q:DA'=+DA  S DIK="^BCHSORT(" D ^DIK
 S DA=0 F  S DA=$O(^BCHTCNAR(DA)) Q:DA'=+DA  S DIK="^BCHTCNAR(" D ^DIK
SC S DA=$O(^BCHTSERV("B","OTHER EDUCATION",0))
 I DA S DIE="^BCHTSERV(",DR=".01///PROVIDE STAFF TRAINING;.03///ST" D ^DIE K DA,DR,DIE
 ;S DIU=90002.01,DIU(0)="S" D EN^DIU2
 Q
PWH ;create CHR type PWH
 NEW BCHX,BCHC,BCHHTX,BCHTEXT,BCHFDA,BCHER,BCHERRR,FL,BCHIENS
 S X="CHR PWH",DIC="^APCHPWHT(",DIC(0)="L",DIADD=1,DLAYGO=9001026 D FILE^DICN K DIADD,DLAYGO,DIC
 I Y=-1 D MES^XPDUTL("UNABLE TO CREATE PWH TYPE - NOTIFY PROGRAMMER") Q
 S BCHY=+Y
 S BCHTEXT="PWHC" F BCHX=1:1 S BCHTX=$P($T(@BCHTEXT+BCHX),";;",2,4) Q:BCHTX=""  D
 .S BCHO=$P(BCHTX,";;",1),BCHC=$P(BCHTX,";;",2)
 . S DA(1)=BCHY,X=BCHO,DINUM=X
 . S DIC="^APCHPWHT("_DA(1)_",1,"
 . S DIC(0)="L"
 . S DIC("P")=$P(^DD(9001026,1,0),U,2)
 . S DIC("DR")=".03///"_$P(BCHTX,";;",3)_";1////"_$O(^APCHPWHC("B",BCHC,0))
 . D ^DIC
 . I Y=-1 D MES^XPDUTL("ERROR CREATING PWH - NOTIFY PROGRAMMER") Q
 . Q
 K DINUM,DIC,DIADD,DLAYGO
 Q
POST ;
 ;
 I '$O(^APCHPWHT("B","CHR PWH",0)) D PWH
 ;move referral data into the multiples
 S BCHR=0 F  S BCHR=$O(^BCHR(BCHR)) Q:BCHR'=+BCHR  D
 .Q:'$D(^BCHR(BCHR,0))
 .S BCHRT=$P(^BCHR(BCHR,0),U,7)
 .I BCHRT D
 ..Q:$D(^BCHR(BCHR,41,0))  ;already has multiple
 ..S ^BCHR(BCHR,41,0)="^90002.141PA^1^1"
 ..S ^BCHR(BCHR,41,1,0)=BCHRT
 ..S ^BCHR(BCHR,41,"B",BCHRT,1)=""
 .S BCHRT=$P(^BCHR(BCHR,0),U,8)
 .I BCHRT D
 ..Q:$D(^BCHR(BCHR,42,0))  ;already has multiple
 ..S ^BCHR(BCHR,42,0)="^90002.142PA^1^1"
 ..S ^BCHR(BCHR,42,1,0)=BCHRT
 ..S ^BCHR(BCHR,42,"B",BCHRT,1)=""
 ;K ^DD(90002.01,0,"ID")  
 ; REINDEX C XREF OF CHR TEMP GROUP FILE
 S DIK="^BCHGROUP(" D IXALL^DIK
 ;set up zish send parameters
 D ZISH
 Q
 ;
 ;
ZISH ;create entry in ZISH SEND PARAMETERS file
 D ^XBFMK K DIADD,DLAYGO,DIC,DD,D0,DO
 ;Q:$D(^%ZIB(9888888.93,"B","BCHR AUTO SEND"))
 S APCLY=0 F  S APCLY=$O(^%ZIB(9888888.93,"B","BCHR AUTO SEND",0)) Q:APCLY'=+APCLY  D
 .I APCLY S DA=APCLY,DIK="^%ZIB(9888888.93," D ^DIK K DA,DIK
 S X="BCHR AUTO SEND",DIC(0)="L",DIC="^%ZIB(9888888.93," D FILE^DICN
 I Y=-1 W !!,"error creating ZISH SEND PARAMETERS entry" Q
 S DA=+Y,DIE="^%ZIB(9888888.93,",DR=".02///QUOVADX-IE.IHS.GOV;.03///ihpesusr;.04///g2dwy66b;.06///-u;.07///B;.08///sendto"
 D ^DIE
 I $D(Y) W !!,"error updating ZISH SEND PARAMETERS entry" Q
 Q
 ;
INSTALLD(BCHSTAL) ;EP - Determine if patch BCHSTAL was installed, where
 ; BCHSTAL is the name of the INSTALL.  E.g "AG*6.0*11".
 NEW BCHY,DIC,X,Y
 S X=$P(BCHSTAL,"*",1)
 S DIC="^DIC(9.4,",DIC(0)="FM",D="C"
 D IX^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",22,",X=$P(BCHSTAL,"*",2)
 D ^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",""PAH"",",X=$P(BCHSTAL,"*",3)
 D ^DIC
 S BCHY=Y
 D IMES
 Q $S(BCHY<1:0,1:1)
IMES ;
 D MES^XPDUTL($$CJ^XLFSTR("Patch """_BCHSTAL_""" is"_$S(Y<1:" *NOT*",1:"")_" installed.",IOM))
 Q
SORRY(X) ;
 KILL DIFQ
 I X=3 S XPDQUIT=2 Q
 S XPDQUIT=X
 W *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
 Q
PWHC ;;
 ;;10;;ACTIVITY LEVEL
 ;;20;;ALLERGIES;;A
 ;;40;;BLOOD PRESSURE
 ;;70;;CANCER SCREENING
 ;;80;;CHOLESTEROL
 ;;90;;DIABETES CARE
 ;;50;;HEIGHT/WEIGHT/BMI
 ;;60;;IMMUNIZATIONS DUE
 ;;30;;MEDICATIONS (ACTIVE ONLY)
 ;;100;;PATIENT GOALS