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

BJPC1EC1.m

Go to the documentation of this file.
BJPC1EC1 ; IHS/CMI/LAB - PCC Suite v1.0 patch 1 environment check [ 04/10/2008  9:01 AM ]
 ;;1.0;IHS PCC SUITE;**1**;MAR 14, 2008
 ;
 ;
 ; 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
 I '$$INSTALLD("ATX*5.1*10") D SORRY(2)
 I '$$INSTALLD("AUPN*99.1*18") D SORRY(2)
 I '$$INSTALLD("APCD*2.0*10") D SORRY(2)
 I '$$INSTALLD("APCL*3.0*21") D SORRY(2)
 I '$$INSTALLD("APCH*2.0*17") D SORRY(2)
 I '$$INSTALLD("BDP*1.0*1") D SORRY(2)
 I '$$INSTALLD("AMQQ*2.0*20") D SORRY(2)
 I '$D(^DIC(9.4,"C","LEX")) D MES^XPDUTL($$CJ^XLFSTR("Lexicon is *NOT* installed.",IOM)) D SORRY(2)
 ;
 Q
 ;
PRE ;
 S BJPCX=0 F  S BJPCX=$O(^APCLCNTL(BJPCX)) Q:BJPCX'=+BJPCX  S DA=BJPCX,DIK="^APCLCNTL(" D ^DIK
 F DA=1:1:900 S DIK="^APCLVSTS(" D ^DIK
 S BJPCX=0 F  S BJPCX=$O(^APCLDMTX(BJPCX)) Q:BJPCX'=+BJPCX  S DA=BJPCX,DIK="^APCLDMTX(" D ^DIK
AS ;get rid of FEV1, FV1P
 F BJPCMR="FEV1","FV1P","FVC","FVCP" S BJPCM=$O(^AUTTMSR("B",BJPCMR,0)) I BJPCM D
 .S BJPCDA=0 F  S BJPCDA=$O(^AUPNVMSR("B",BJPCM,BJPCDA)) Q:BJPCDA'=+BJPCDA  S DA=BJPCDA,DIK="^AUPNVMSR(" D ^DIK
 .S DA=BJPCM,DIK="^AUTTMSR(" D ^DIK
 F BJPCMR="FEV1","FV1P","FVC","FVCP" S BJPCM=$O(^APCDTKW("B",BJPCMR,0)) I BJPCM S DA=BJPCM,DIK="^APCDTKW(" D ^DIK
 ;STUFF ALL EXISTING REMINDERS WITH R
 S BJPCX=0 F  S BJPCX=$O(^APCHSURV(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P(^APCHSURV(BJPCX,0),U,7)]""
 .Q:$P(^APCHSURV(BJPCX,0),U,7)="T"
 .S $P(^APCHSURV(BJPCX,0),U,7)="R"
 S DA=$O(^APCHSURV("B","ASTHMA - ADD/INCREASE INHALED ",0))
 I DA S DIE="^APCHSURV(",DR=".01///ASTHMA - ADD/INCREASE INHALED STEROIDS" D ^DIE K DA,DIE
 Q
POST ;
 ;;add new clinic code telebehavioral health
 NEW DA,DIC,DR,DIE
 S DA=$O(^DIC(40.7,"C","C9",0)) I 'DA D
 .S DLAYGO=40.7,DIC(0)="L",DIC="^DIC(40.7,",X="TELEBEHAVIORAL HEALTH"
 .K DD,D0,DO
 .D FILE^DICN
 .I Y=-1 D MES^XPDUTL($$CJ^XLFSTR("Adding Clinic TELEBEHAVIORAL HEALTH Failed.",IOM))
 .S DA=+Y
 .K DLAYGO,DIC,Y
 I DA D
 .S DIE="^DIC(40.7,",DR="1///C9;999999901///TEBH;90000.01///Y"
 .D ^DIE
 .I $D(Y) D MES^XPDUTL($$CJ^XLFSTR("Updating Clinic TELEBEHAVIORAL HEALTH Failed.",IOM))
 K DA,DR,DIE
OPTIONS ;
 S X=$$ADD^XPDMENU("APCDCAF EHR CODING AUDIT MENU","APCDCAF LIST INCOMPLETE","INCV")
 I 'X W "Attempt to add coding queue incomplete visit option failed." H 3
 S X=$$ADD^XPDMENU("APCHSMAINT","APCH TREATMENT PROMPT MENU","TP")
 I 'X W "Attempt to add coding queue incomplete visit option failed." H 3
 ;
ASAMP ;
 D MES^XPDUTL($$CJ^XLFSTR("Copying Asthma Management Plan to V Patient Education.",IOM))
 S BJPCIEN=$O(^AUTTEDT("C","ASM-SMP",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("ASM-SMP education topic missing from file, cannot move data.",IOM)) G ASTRIGET
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,12)=""  ;no asthma management plan to copy
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,12)'=1
 .Q:$$HASASAMP($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.16 (ADD)]"
 .S APCDALVR("APCDTTOP")="`"_BJPCIEN
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Patient ed ASM-SMP failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
ASTRIGET ;
 D MES^XPDUTL($$CJ^XLFSTR("Copying Asthma Trigger ETS to V Health Factors.",IOM))
 S BJPCIEN=$O(^AUTTHF("B","ASTHMA TRIGGER-TOBACCO SMOKE",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("ASTHMA TRIGGER-TOBACCO SMOKE missing from file, cannot move data.",IOM)) G ASTRIGPM
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,8)'="Y"  ;no asthma management plan to copy
 .Q:$$HASASHF($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.23 (ADD)]"
 .S APCDALVR("APCDTHF")="`"_BJPCIEN
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Health Factor ASTHMA TRIGGERS-TOBACCO SMOKE failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
ASTRIGPM ;
 D MES^XPDUTL($$CJ^XLFSTR("Copying Asthma Trigger AIR POLLUTANTS to V Health Factors.",IOM))
 S BJPCIEN=$O(^AUTTHF("B","ASTHMA TRIGGER-AIR POLLUTANTS",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("ASTHMA TRIGGER-AIR POLLUTANTS missing from file, cannot move data.",IOM)) G ASTRIGDM
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,9)'="Y"
 .Q:$$HASASHF($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.23 (ADD)]"
 .S APCDALVR("APCDTHF")="`"_BJPCIEN
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Health Factor ASTHMA TRIGGERS-AIR POLLUTANTS failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
ASTRIGDM ;
 D MES^XPDUTL($$CJ^XLFSTR("Copying Asthma Trigger DUST MITES to V Health Factors.",IOM))
 S BJPCIEN=$O(^AUTTHF("B","ASTHMA TRIGGER-DUST MITES",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("ASTHMA TRIGGERS-DUST MITES missing from file, cannot move data.",IOM)) G ASMEAPEF
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,11)'="Y"
 .Q:$$HASASHF($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.23 (ADD)]"
 .S APCDALVR("APCDTHF")="`"_BJPCIEN
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Health Factor ASTHMA TRIGGER-DUST MITES failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
ASMEAPEF ;
 D MES^XPDUTL($$CJ^XLFSTR("Copying PEF/BEST PF to V Measurements.",IOM))
 S BJPCIEN=$O(^AUTTMSR("B","BPF",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("BPF missing from file, cannot move data.",IOM)) G ASMEAFEF
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,7)=""
 .Q:$$HASASME($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.01 (ADD)]"
 .S APCDALVR("APCDTTYP")="`"_BJPCIEN
 .S APCDALVR("APCDTVAL")=$P(^AUPNVAST(BJPCX,0),U,7)
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Measurement BPF failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
ASMEAFEF ;
 D MES^XPDUTL($$CJ^XLFSTR("Copying FEF 25-75 to V Measurements.",IOM))
 S BJPCIEN=$O(^AUTTMSR("B","FEF",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("FEF missing from file, cannot move data.",IOM)) G ASMEAFEV
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,6)=""
 .Q:$$HASASME($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.01 (ADD)]"
 .S APCDALVR("APCDTTYP")="`"_BJPCIEN
 .S APCDALVR("APCDTVAL")=$P(^AUPNVAST(BJPCX,0),U,6)
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Measurement FEF 25-75 failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
ASMEAFEV ;
 G NEXT
 D MES^XPDUTL($$CJ^XLFSTR("Copying Fev1 % to V Measurements.",IOM))
 S BJPCIEN=$O(^AUTTMSR("B","FV1P",0))
 I 'BJPCIEN D MES^XPDUTL($$CJ^XLFSTR("FV1P missing from file, cannot move data.",IOM)) G NEXT
 S BJPCX=0 F  S BJPCX=$O(^AUPNVAST(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P($G(^AUPNVAST(BJPCX,0)),U,5)=""
 .Q:$$HASASME($P(^AUPNVAST(BJPCX,0),U,3),BJPCIEN)
 .K APCDALVR
 .S APCDALVR("APCDATMP")="[APCDALVR 9000010.01 (ADD)]"
 .S APCDALVR("APCDTTYP")="`"_BJPCIEN
 .S APCDALVR("APCDTVAL")=$P(^AUPNVAST(BJPCX,0),U,5)
 .S APCDALVR("APCDVSIT")=$P(^AUPNVAST(BJPCX,0),U,3)
 .S APCDALVR("APCDPAT")=$P(^AUPNVAST(BJPCX,0),U,2)
 .D ^APCDALVR
 .I $D(APCDALVR("APCDAFLG")) D MES^XPDUTL($$CJ^XLFSTR("Measurement FEV 1% failed for Visit "_$P(^AUPNVAST(BJPCX,0),U,3),IOM))
 .K APCDALVR
NEXT ;
 ;FIX FH 8TH PIECE
 S BJPCX=0 F  S BJPCX=$O(^AUPNFH(BJPCX)) Q:BJPCX'=+BJPCX  I '$P(^AUPNFH(BJPCX,0),U,8) S $P(^AUPNFH(BJPCX,0),U,8)=""
 ;
MOVEFH ;move Family History problem entries to fh
 D MES^XPDUTL($$CJ^XLFSTR("Copying Family History Problem entries to Family History.",IOM))
 S BJPCX=0 F  S BJPCX=$O(^AUPNPROB(BJPCX)) Q:BJPCX'=+BJPCX  D
 .Q:$P(^AUPNPROB(BJPCX,0),U,4)'="F"
 .;CREATE FAMILY HX ENTRY
 .S P=$P(^AUPNPROB(BJPCX,0),U,2)
 .Q:'P
 .S X=$P(^AUPNPROB(BJPCX,0),U)
 .Q:'X
 .S N=$P(^AUPNPROB(BJPCX,0),U,5)
 .I '$$HASFH(P,X,N) D
 ..S DIC="^AUPNFH("
 ..S DLAYGO=9000014
 ..S DIADD=1
 ..S DIC("DR")=".02////"_P_";.03////"_$P(^AUPNPROB(BJPCX,0),U,8)_";.04////"_N_";.08////"_$P($G(^AUPNPROB(1,1)),U,4)
 ..S DIC(0)="L"
 ..K DD,D0,DO
 ..D FILE^DICN
 ..I Y=-1 D MES^XPDUTL("Error creating family history entry for problem entry "_BJPCX) K DIC,DIADD,DLAYGO Q
 ..K DIC,DIADD,DLAYGO
 ..;S DA=BJPCX,DIK="^AUPNPROB(" D ^DIK K DA,DIK  DO NOT DELETE PER HOWARD ON CCB CALL 1/31/08
 ..Q
DELAST ;
 ;delete ast and hast mnemonics
 S DA=$O(^APCDTKW("B","AST",0)) I DA S DIK="^APCDTKW(" D ^DIK
 S DA=$O(^APCDTKW("B","HAST",0)) I DA S DIK="^APCDTKW(" D ^DIK
 ;
 ;now "delete" anmc reminders
 S DA=$O(^APCHSURV("B","ANMC COLORECTAL",0))
 I DA S DIE="^APCHSURV(",DR=".03///D" D ^DIE K DIE,DA,DR
 S DA=$O(^APCHSURV("B","ANMC COLORECTAL CANCER",0))
 I DA S DIE="^APCHSURV(",DR=".03///D" D ^DIE K DIE,DA,DR
 S DA=$O(^APCHSURV("B","ANMC DEPRESSION SCREEN",0))
 I DA S DIE="^APCHSURV(",DR=".03///D" D ^DIE K DIE,DA,DR
 S DA=$O(^APCHSURV("B","REHAB/FUNCTIONAL SCREEN",0))
 I DA S DIE="^APCHSURV(",DR=".03///D" D ^DIE K DIE,DA,DR
 ;
 D ^BJPCTX
 D ^BJPC1ECA
 S DA=$O(^APCDSTGC("B","DIABETIC RETINOPATHY",0))
 I DA S DIE="^APCDSTGC(",DR=".02///APCD DIABETIC RETINOPATHY DXS" D ^DIE K DA,DIE
 ;
 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
 ;
WRITEMSG ;
 S X=$O(^APCLPDES("B","BJPCV1P1",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
 ;
CLINNEW ;;H. NEW CLINIC CODES (SECTION XIX): CODE^NAME^ABBRV^PRIMARY CARE CLINIC^1A WORKLOAD
 ;;C8^TELEBEHAVIORAL HEALTH^TEBH^N^Y
 ;;END
 ;
HASASAMP(V,I) ;is there a v patient ed of ASM-SMP?
 NEW X,Y,Z
 S (X,Z)=0 F  S X=$O(^AUPNVPED("AD",V,X)) Q:X'=+X  D
 .I $P($G(^AUPNVPED(X,0)),U)=I S Z=1
 .Q
 Q Z
 ;
HASASHF(V,I) ;
 NEW X,Y,Z
 S (X,Z)=0 F  S X=$O(^AUPNVHF("AD",V,X)) Q:X'=+X  D
 .I $P($G(^AUPNVHF(X,0)),U)=I S Z=1
 .Q
 Q Z
 ;
HASASME(V,I) ;is there a v MEASUREMENT I?
 NEW X,Y,Z
 S (X,Z)=0 F  S X=$O(^AUPNVMSR("AD",V,X)) Q:X'=+X  D
 .I $P($G(^AUPNVMSR(X,0)),U)=I S Z=1
 .Q
 Q Z
 ;
HASFH(P,I,N) ;
 NEW X,Y,Z
 S (X,Z)=0 F  S X=$O(^AUPNFH("AC",P,X)) Q:X'=+X  D
 .Q:'$D(^AUPNFH(X,0))
 .I $P(^AUPNFH(X,0),U,1)=I,$P(^AUPNFH(X,0),U,4)=N S Z=1
 .Q
 Q Z
 ;