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

BJPC2P7.m

Go to the documentation of this file.
BJPC2P7 ; IHS/CMI/LAB - PCC Suite v1.0 patch 3 environment check ;   
 ;;2.0;IHS PCC SUITE;**7**;MAY 14, 2009
 ;
 ;
 ; The following line prevents the "Disable Options..." and "Move Routines..." questions from being asked during the install.
 I $G(XPDENV)=1 S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
 F X="XPO1","XPZ1","XPZ2","XPI1" S XPDDIQ(X)=0
 ;KERNEL
 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))
 ;FILEMAN
 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))
 ;BJPC
 I $$VERSION^XPDUTL("BJPC")'="2.0" D MES^XPDUTL($$CJ^XLFSTR("Version 2.0 of the IHS PCC SUITE (BJPC) is required.  Not installed",80)) D SORRY(2) I 1
 E  D MES^XPDUTL($$CJ^XLFSTR("Requires IHS PCC Suite (BJPC) Version 2.0....Present.",80))
 ;BJPC 2.0 PATCH 4
 I '$$INSTALLD("BJPC*2.0*6") D SORRY(2)
 I '$$INSTALLD("APCL*3.0*27") D SORRY(2)
 ;
 Q
 ;
PRE ;
 S DA=0 F  S DA=$O(^APCLVSTS(DA)) Q:DA'=+DA  S DIK="^APCLVSTS(" D ^DIK
 D PRE^AMQQPOST
 S DA=$O(^APCHSCMP("B","REFUSALS",0))
 I DA S DIE="^APCHSCMP(",DR=".01///REFUSALS/DECLINED SERVICES" D ^DIE
 S DA=$O(^APCHSCMP("B","REFUSALS-MOST RECENT OF EACH",0)) I DA S DIE="^APCHSCMP(",DR=".01///REFUSALS/DECLINED SERVICES-MOST RECENT OF EACH" D ^DIE
 ;
 S DA=$O(^APCHSCMP("B","REFUSALS/DECLINED SERVICES",0))
 I DA S DIE="^APCHSCMP(",DR="3///REFUSALS/DECLINED SERVICES" D ^DIE
 S DA=$O(^APCHSCMP("B","REFUSALS/DECLINED SERVICES-MOS",0))
 I DA S DIE="^APCHSCMP(",DR="3///REFUSALS/DECLINED SERVICES-MOST RECENT OF EACH" D ^DIE
 S DA=$O(^DIC(19,"APCH PWH UPDATE DEFAULT",0))
 I DA S DIE="^DIC(19,",DR="1///Update PWH Site Parameters" D ^DIE K DA,DR,DIE
 S DA=$O(^DIC(19,"APCL P REFUSAL LIST",0))
 I DA S DIE="^DIC(19,",DR="1///Listing of Patient Declined Services/Refusals" D ^DIE K DA,DR,DIE
 S DA=$O(^APCHSCMP("B","REPRODUCTIVE HISTORY",0))
 I DA S DIE="^APCHSCMP(",DR=".01///REPRODUCTIVE HISTORY - BRIEF" D ^DIE K DA,DR,DIE
 S DA=$O(^APCDTKW("B","EDC",0))
 I DA S DIE="^APCDTKW(",DR=".01///EDD;.06///EXPECTED DATE OF DELIVERY" D ^DIE K DA,DR,DIE
 S DA=$O(^APCHPWHC("B","EDUCATION FORMS",0))
 I DA S DIE="^APCHPWHC(",DR=".01///EDUCATION HANDOUTS" D ^DIE K DA,DR,DIE
 S DIU=9000017,DIU(0)="" D EN^DIU2  ;DELETE 9000017, FULL DD SENT IN BUILD
 K DIU
 Q
POST ;
 ;ADD EPI OPTIONS
 S X=$$ADD^XPDMENU("APCHMENU","APCH GEN SUPPLEMENT","GSUP")
 I 'X W !,"Attempt to add APCH GEN SUPPLEMENT option failed.." H 3
 S X=$$ADD^XPDMENU("APCD UPD PAT RELATED DATA","APCD PG PATIENT GOALS","PATG")
 I 'X W !,"Attempt to add APCD PG PATIENT GOALS option failed.." H 3
 S X=$$ADD^XPDMENU("BDP MENU REPORTS","BDP NO DESG PROVIDER","NODP")
 I 'X W !,"Attempt to add BDP NO DESG PROVIDER option failed.." H 3
 ;S X=$$ADD^XPDMENU("APCLMENU","APCM MU MAIN MENU","MUR",3)
 ;I 'X W !,"Attempt to add APCM MU MAIN MENU option failed.." H 3
 ;D POST^APCLEM1
 D POST^AMQQPOST
 S DA=$O(^APCDTKW("B","REF",0))
 I DA S DIE="^APCDTKW(",DR=".06///Refused/Declined Service" D ^DIE K DA,DIE,DR
 ;convert RF EDC to EDD fields and convert Contraceptive Methods to a multiple (2101)
 D RFCONV
 ;HEALTH FACTOR UPDATES
 D UPDHF
 D ^BJPC27
 ;update measurement types with .05, .06, .07
 F BJPCX="FH","FT","CXD","SN","PR","EGA","AG","EF" D
 .S BJPCY=$O(^AUTTMSR("B",BJPCX,0))
 .Q:'BJPCY
 .S DIE="^AUTTMSR(",DA=BJPCY,DR=".05///F;.06///9;.07///60" D ^DIE K DIE,DA,DR
 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
UPDHF ;
 ;inactivate HEALTH LITERACY CATEGORY
 S DA=$O(^AUTTHF("B","HEALTH LITERACY",0))
 I DA S DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 ;inactivate HEALTH LITERATE
 S DA=$O(^AUTTHF("B","HEALTH LITERATE",0))
 I DA S DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 ;inactivate LOW HEALTH LITERACY from the Health Literate category
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","LOW HEALTH LITERACY",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="HEALTH LITERACY"!($$VAL^XBDIQ1(9999999.64,BJPCX,.02)="F081") D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 ;inactivate any other HEALTH LITERACY items
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF(BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="HEALTH LITERACY" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 ;inactivate several Barriers to Learning
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","CHILDHOOD DEVELOPMENT",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","LEARNING DISABILITY",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","DEVELOPMENTAL DELAY",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","<6TH GRADE EDUCATION",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","SOCIAL STRESSORS",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","LESS THAN 6TH GRADE EDUCATION",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 ;change emotional stressors (STRS) to Stressors (STRESS)
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","EMOTIONAL STRESSORS",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".01///STRESSORS;8801///STRESS" D ^DIE K DA,DIE,DR
 ;add barriers to learning LOW HEALTH LITERACY AND COGNITIVE IMPAIRMENT
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF("B","LOW HEALTH LITERACY",BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="BARRIERS TO LEARNING" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR="8801///LOWLIT" D ^DIE K DA,DIE,DR
 ;
 ;inactivate all Rubella Immunity Status HFs
 ;
 S BJPCX=0 F  S BJPCX=$O(^AUTTHF(BJPCX)) Q:BJPCX'=+BJPCX  I $$VAL^XBDIQ1(9999999.64,BJPCX,.03)="RUBELLA IMMUNITY STATUS" D
 .S DA=BJPCX,DIE="^AUTTHF(",DR=".13///1;.15////"_DT D ^DIE K DA,DIE,DR
 ;now add COGNITIVE IMPAIRMENT
 Q:$D(^AUTTHF("C","F120"))  ;already there
 S BJPCC=$O(^AUTTHF("B","BARRIERS TO LEARNING",0))
 S (BJPCX,X)="COGNITIVE IMPAIRMENT",DIC="^AUTTHF(",DIC(0)="L",DIADD=1,DLAYGO=9999999.64,DIC("DR")=".1///F;.03////"_BJPCC_";.02////F120;8801///COGI" D FILE^DICN K DIC,X,DIADD,DLAYGO
 I Y=-1 D MES^XPDUTL("Adding Health Factor "_BJPCX_" failed")
 Q
RFCONV ;
 S BJPCX=0 F  S BJPCX=$O(^AUPNREP(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNREP(BJPCX,0)),U,9)=""  ;nothing to convert
 .;W BJPCX,"~"
 .S BJPCEDD=$P(^AUPNREP(BJPCX,0),U,9)
 .S BJPCHOW=$P(^AUPNREP(BJPCX,0),U,10)
 .I BJPCHOW=""!(BJPCHOW=0) D  Q
 ..S DA=BJPCX,DIE="^AUPNREP(",DR="1314///"_BJPCEDD D ^DIE K DA,DIE,DR
 .I BJPCHOW=1 D  Q
 ..S DA=BJPCX,DIE="^AUPNREP(",DR="1305////"_BJPCEDD D ^DIE K DIE,DA,DR
 .I BJPCHOW=2 D  Q
 ..S DA=BJPCX,DIE="^AUPNREP(",DR="1302////"_BJPCEDD D ^DIE K DIE,DA,DR
 .I BJPCHOW=3 D  Q
 ..S DA=BJPCX,DIE="^AUPNREP(",DR="1308////"_BJPCEDD D ^DIE K DIE,DA,DR
CM ;contraceptive history
 S BJPCX=0 F  S BJPCX=$O(^AUPNREP(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P(^AUPNREP(BJPCX,0),U,6)=""  ;no method to copy to 21 mult
 .S BJPCTC=$$VAL^XBDIQ1(9000017,BJPCX,3)  ;OLD EXTERNAL SET VALUE (^AUPNREP(BJPCX,0),U,6)
 .S BJPCT="",BJPCCOM=""  ;NEW VALUE
 .S BJPCTE=$$NEWVAL(BJPCTC)  ;get external value
 .I $P(BJPCTE,U,1)="" D MES^XPDUTL("No conversion value for "_BJPCTC) Q  ;no external value
 .S BJPCT=$O(^AUTTCM("B",$P(BJPCTE,U,1),0))
 .I BJPCT="" D MES^XPDUTL("Error converting "_$P(BJPCTE,U,1)_" ien "_BJPCX) Q
 .S BJPCD=$P(^AUPNREP(BJPCX,0),U,7)  ;date begun
 .I BJPCD Q:$D(^AUPNREP("ACON",BJPCX,BJPCT,BJPCD))  ;already has this one in the multiple
 .I 'BJPCD Q:$$HASND(BJPCX,BJPCT)  ;already have it with no date
 .I $P(BJPCTE,U,2) S BJPCCOM=BJPCTC
 .;now create multiple entry
 .S DIC="^AUPNREP("_BJPCX_",2101,"
 .S DIC(0)="L"
 .S DA(1)=BJPCX
 .S DIC("P")=$P(^DD(9000017,2101,0),U,2)
 .S X=BJPCT
 .S DIC("DR")=".02////"_BJPCD_";.06///"_BJPCCOM   ;.04///^S X=$S($G(APCDDATE):$$FMTE^XLFDT(APCDDATE),1:$$FMTE^XLFDT(DT))"
 .K DD,D0,DO
 .D FILE^DICN
 .I Y=-1 D MES^XPDUTL("Converting Contraceptive Method for DFN "_BJPCX_" failed.")
 .K DIC,DD,DO,D0,DA
 Q
 ;
HASND(X,T) ;DOES THIS PATIENT HAVE THIS ONE WITH NO DATE BEGUN?
 NEW Y,G
 S G=0
 S Y=0 F  S Y=$O(^AUPNREP(X,2101,Y)) Q:Y'=+Y  I $P(^AUPNREP(X,2101,Y,0),U,1)=T,$P(^AUPNREP(X,2101,Y,0),U,2)="" S G=1
 Q G
NEWVAL(E) ;
 NEW X,Y,BJPCTEXT,BJPCY
 S Y=""
 S BJPCTEXT="CMMAP" F BJPCY=1:1 S X=$T(@BJPCTEXT+BJPCY) Q:$P(X,";;",2)=""!(Y]"")  I $P(X,";;",2)=E S Y=$P(X,";;",3)_U_$P(X,";;",4)
 Q Y
 ;
CMMAP ;;
 ;;ABSTINENCE;;ABSTINENCE
 ;;HORMONE INJECTION;;HORMONAL/DEPO PROVERA
 ;;HORMONAL IMPLANT;;HORMONAL/IMPLANT
 ;;MENOPAUSE;;NA MENOPAUSE
 ;;EDUCATION ONLY;;OTHER;;1
 ;;ORAL CONTRACEPTIVES;;OTHER;;1
 ;;IUD;;OTHER;;1
 ;;BARRIER METHODS;;OTHER;;1
 ;;OTHER;;OTHER
 ;;NATURAL TECHNIQUES;;PERIODIC ABSTINENCE METHODS
 ;;SURGICAL STERILIZATION;;STERILIZATION (FEMALE)
 ;;PARTNER STERILIZED;;STERILIZATION (MALE)
 ;;NONE;;NONE
 ;;