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

BJPC2EV3.m

Go to the documentation of this file.
BJPC2EV3 ; IHS/CMI/LAB - PCC Suite v1.0 patch 2 environment check ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
PRE ;
 ;
M ;EP - FIX MAMMOGRAM REMINDER
 S BJPCX=$O(^APCHSURV("B","MAMMOGRAM",0))
 I BJPCX D
 .S X=0 F  S X=$O(^APCHSURV(BJPCX,11,"B","B",X)) Q:X'=+X  D
 ..K ^APCHSURV(BJPCX,11,"B","B",X),^APCHSURV(BJPCX,11,X)
 S BJPCX=$O(^APCHSURV("B","BREAST EXAM",0))
 I BJPCX D
 .S X=0 F  S X=$O(^APCHSURV(BJPCX,11,"B","F",X)) Q:X'=+X  D
 ..I $G(^APCHSURV(BJPCX,11,X,11,1,0))="18Y^100Y^1Y" K ^APCHSURV(BJPCX,11,X),^APCHSURV(BJPCX,11,X,"B","F",X)
 S BJPCX=$O(^APCHSURV("B","DIABETES SCREENING",0))
 I BJPCX D
 .S X=0 F  S X=$O(^APCHSURV(BJPCX,11,"B","B",X)) Q:X'=+X  D
 ..I $G(^APCHSURV(BJPCX,11,X,11,1,0))="12Y^99Y^1Y" K ^APCHSURV(BJPCX,11,X),^APCHSURV(BJPCX,11,X,"B","B",X)
 Q
POST ;
MOVEFH ;EP - move Family History
 D MES^XPDUTL($$CJ^XLFSTR("Converting family hx relationship field to new File.",IOM))
 S BJPCX=0 F  S BJPCX=$O(^AUPNFH(BJPCX)) Q:BJPCX'=+BJPCX  D
 .S DFN=$P(^AUPNFH(BJPCX,0),U,2)
 .Q:DFN=""
 .I $P(^AUPNFH(BJPCX,0),U,12)="" S DIE="^AUPNFH(",DA=BJPCX,DR=".12////"_$P(^AUPNFH(BJPCX,0),U,3) D ^DIE K DA,DR,DIE
 .I $P(^AUPNFH(BJPCX,0),U,11)="" D CONVAGE
 .Q:$P(^AUPNFH(BJPCX,0),U,9)]""  ;already has a relation
 .S X=$P(^AUPNFH(BJPCX,0),U,7)
 .I X="" S N=$O(^AUTTRLSH("B","UNKNOWN",0)) G SET
 .I '$D(^AUTTRLSH(X,0)) S N=$O(^AUTTRLSH("B","OTHER",0)) G SET
 .S X=$P(^AUTTRLSH(X,0),U)
 .S N="" F BJPCJ=1:1 S BJPCT=$T(MAPRL+BJPCJ) Q:$P(BJPCT,";;",2)=""!(N]"")  D
 ..S O=$P(BJPCT,";;",2)
 ..I O=X S N=$P(BJPCT,";;",3)
 .I N]"" S N=$O(^AUTTRLSH("B",N,0))
 .;I N="" S N=$O(^AUTTRLSH("C",N,0))
 .I N="" S N=$O(^AUTTRLSH("B","OTHER",0))
SET .;
 .;create family member file entry with this or use existing one and stuff .09 field
 .S BJPCY=$O(^AUPNFHR("AA",DFN,N,0))
 .I BJPCY D DIE09 Q
 .K DIC,DR,DA
 .K DD,DO
 .S DIC="^AUPNFHR(",DIC(0)="L",X=N,DIC("DR")=".02////"_DFN_";.04////"_$P(^AUPNFH(BJPCX,0),U,6),DIADD=1,DLAYGO=9000014.1
 .D FILE^DICN
 .I Y=-1 D MES^XPDUTL("Error in CREATING relation for ien "_BJPCX) K DIC,DR,DA,DD,D0,DO,DIADD,DLAYGO Q
 .S BJPCY=+Y
 .K DIC,DR,DA,DD,D0,DO,DIADD,DLAYGO
 .D DIE09
 D ^XBFMK
 S DIK="^AUPNFH(",DIK(1)=".09^AE" D ENALL^DIK K DIK
 ;
 D HOME^%ZIS,DT^DICRW
 ;
 NEW XMSUB,XMDUZ,XMTEXT,XMY,DIFROM
 KILL ^TMP($J,"BJPCBUL")
 D WRITEMSG,GETRECIP
 ;Change following lines as desired
SUBJECT S XMSUB="* * * IMPORTANT RPMS INFORMATION * * *"
SENDER S XMDUZ="Cimarron Medical Informatics"
 S XMTEXT="^TMP($J,""BJPCBUL"",",XMY(1)="",XMY(DUZ)=""
 I $E(IOST)="C" W !,"Sending Mailman message to PCC Users."
 D ^XMD
 KILL ^TMP($J,"BJPCBUL"),BJPCKEY
 Q
 ;
CONVAGE ;
 S BJPCN=""
 S X=$P(^AUPNFH(BJPCX,0),U,5)
 I X="" S BJPCN="U" D DIE11 Q
 I X<1 S BJPCN="I" D DIE11 Q
 I X<20 S BJPCN="B" D DIE11 Q
 I X<30 S BJPCN="2" D DIE11 Q
 I X<40 S BJPCN="3" D DIE11 Q
 I X<50 S BJPCN="4" D DIE11 Q
 I X<60 S BJPCN="5" D DIE11 Q
 S BJPCN="6" D DIE11 Q
 Q
DIE09 ;
 S DA=BJPCX,DIE="^AUPNFH(",DR=".09////"_BJPCY D ^DIE K DIE,DA,DR
 I $D(Y) D MES^XPDUTL("Error in updating relation .09 for ien "_BJPCX)
 Q
 ;
DIE11 ;
 S DA=BJPCX,DIE="^AUPNFH(",DR=".11////"_BJPCN D ^DIE K DIE,DA,DR
 I $D(Y) D MES^XPDUTL("Error in updating AGE .11 for ien "_BJPCX)
 Q
 ;
WRITEMSG ;
 S X=$O(^APCLPDES("B","BJPCV1P2",0))
 Q:'X
 S Y=0 F  S Y=$O(^APCLPDES(X,11,Y)) Q:Y'=+Y  S ^TMP($J,"BJPCBUL",Y)=^APCLPDES(X,11,Y,0)
 Q
 ;
GETRECIP ;
 ;
 S CTR=0
 F BJPCKEY="APCLZMENU","APCDZMENU","APCHZMENU","BDPZMENU","AMQQZMENU"
 F  S CTR=$O(^XUSEC(BJPCKEY,CTR)) Q:'CTR  S Y=CTR S XMY(Y)=""
 Q
INSTALLD(BJPCSTAL) ;EP - Determine if patch BJPCSTAL was installed, where
 ; APCLSTAL is the name of the INSTALL.  E.g "AG*6.0*11".
 ;
 NEW BJPCY,DIC,X,Y
 S X=$P(BJPCSTAL,"*",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(BJPCSTAL,"*",2)
 D ^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",""PAH"",",X=$P(BJPCSTAL,"*",3)
 D ^DIC
 S BJPCY=Y
 D IMES
 Q $S(BJPCY<1:0,1:1)
IMES ;
 D MES^XPDUTL($$CJ^XLFSTR("Patch """_BJPCSTAL_""" 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
 ;
MAPRL ;
 ;;AUNT;;AUNT
 ;;BROTHER;;BROTHER
 ;;COUSIN;;COUSIN
 ;;DAUGHTER;;DAUGHTER (BIOLOGICAL)
 ;;FATHER;;FATHER (BIOLOGICAL)
 ;;GRANDFATHER;;GRANDFATHER
 ;;GRANDMOTHER;;GRANDMOTHER
 ;;MOTHER;;MOTHER (BIOLOGICAL)
 ;;NATURAL CHILD;;CHILD (BIOLOGICAL)
 ;;SISTER;;SISTER
 ;;SON;;SON (BIOLOGICAL)
 ;;UNCLE;;UNCLE
 ;;