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

BPXRMTP.m

Go to the documentation of this file.
BPXRMTP ; IHS/MSC/MGH - Computed Findings for Treatment prompt reminders. ;30-Mar-2018 14:32;DU
 ;;2.0;CLINICAL REMINDERS;**1001,1002,1009**;Feb 04, 2005;Build 17
 ;=================================================================
 ;This routine is designed to use the standard PCC logic for reminders to
 ;evaluate if items are met or not met. Using the standard PCC calls ensures
 ;that all IHS items are using the same logic.
 ;Patch 1009 changed the BQI call for tag
 ;=====================================================================
CVD(DFN,TEST,DATE,VALUE,TEXT) ; EP
 ;This computed finding will check the Treatment prompt logic for CVD
 N BPXRESLT,TODAY,X,Y,X1,X2
 S X="TODAY" D ^%DT S TODAY=Y
 S X1=TODAY,X2=-3 D C^%DTC
 ;S BPXRESLT=$$CVT^BQITRPHS(DFN)
 ;IHS/MSC/MGH changed for patch 1009
 S BPXRESLT=$$ATAG^BQITDUTL(DFN,"ASCVD At Risk")
 S BPXRSLT1=$$ATAG^BQITDUTL(DFN,"ASCVD Known")
 I BPXRESLT=0&(BPXRSLT1=0) S TEST=0,VALUE=TEST,DATE=TODAY
 I $P(BPXRESLT,U,1)=1  S TEST=1,VALUE=$P(BPXRESLT,U,2),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,3)
 I $P(BPXRSLT1,U,1)=1  S TEST=1,VALUE=$P(BPXRESLT,U,2),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRSLT1,U,3)
 Q
WAR(DFN,TEST,DATE,VALUE,TEXT) ;EP
 ;This computed finding will check for active warfarin
 N BPXRESLT,TODAY,X,Y,APCHSPAT
 S X="TODAY" D ^%DT S TODAY=Y
 S APCHSPAT=DFN
 S BPXRESLT=$$ACTWARF^APCHSTP1(APCHSPAT,$$FMADD^XLFDT(DT,-45),DT)
 I $P(BPXRESLT,U,1)=1 S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT="Warfarin prescription found",DATE=DT
 I $P(BPXRESLT,U,1)=0 S TEST=0,VALUE=TEST,DATE=TODAY
 Q
INRGOAL(DFN,TEST,DATE,VALUE,TEXT) ;EP
 ;This computed finding will check the PCC logic for INR goal
 N BPXRESLT,TODAY,X,Y,APCHSPAT,ACT,ITEM
 S ITEM=$O(^APCHSURV("B","ANTICOAGULATION: INR GOAL",""))
 S ACT=$$INAC^APCHSMU(ITEM)
 S X="TODAY" D ^%DT S TODAY=Y
 I ACT=0 S TEST=1,VALUE="TP NOT ACTIVE",DATE=TODAY
 I ACT=1 D
 .S APCHSPAT=DFN
 .S BPXRESLT=$$MRGOAL^APCHSACG(APCHSPAT)
 .I $P(BPXRESLT,U,1)>0 S TEST=1,VALUE=$P(BPXRESLT,U,2),TEXT=$P(BPXRESLT,U,2),DATE=TODAY
 .E  S TEST=0,VALUE="NO INRGOAL",DATE=TODAY
 Q
INRDUR(DFN,TEST,DATE,VALUE,TEXT) ; EP
 ;This computed finding will check the PCC logic for duration of therapy
 N BPXRESLT,TODAY,X,Y,APCHSPAT,ACT,ITEM
 S ITEM=$O(^APCHSURV("B","ANTICOAGULATION: DURATION OF A",""))
 S ACT=$$INAC^APCHSMU(ITEM)
 S X="TODAY" D ^%DT S TODAY=Y
 I ACT=0 S TEST=1,VALUE="TP NOT ACTIVE",DATE=TODAY
 I ACT=1 D
 .S APCHSPAT=DFN
 .S BPXRESLT=$$MRDUR^APCHSACG(APCHSPAT)
 .I $P(BPXRESLT,U,1)>0 S TEST=1,VALUE=$P(BPXRESLT,U,2),TEXT=$P(BPXRESLT,U,2),DATE=TODAY
 .E  S TEST=0,VALUE=TEST,DATE=TODAY
 Q
INREND(DFN,TEST,DATE,VALUE,TEXT) ; EP
 ;This computed finding will check for stop date of treatment
 N BPXRESLT,TODAY,X,Y,APCHSPAT,ACT,ITEM
 S ITEM=$O(^APCHSURV("B","ANTICOAGULATION: ANTICOAGULATI",""))
 S ACT=$$INAC^APCHSMU(ITEM)
 S X="TODAY" D ^%DT S TODAY=Y
 I ACT=0 S TEST=1,VALUE="TP NOT ACTIVE",DATE=TODAY
 I ACT=1 D
 .NEW X,G
 .S APCHSPAT=DFN
 .S X=$P($$MREND^APCHSACG(APCHSPAT),U,1)  ;END DATE
 .I X="" S TEST=1,VALUE=TEST,DATE=TODAY Q  ;no end date less than t+45
 .S G=0
 .S X=$P(X,U,1)
 .I X<$$FMADD^XLFDT(DT,45) S G=1
 .I G S TEST=0,VALUE=TEST,DATE=TODAY Q
 .I 'G S TEST=1,VALUE=TEST,DATE=TODAY   ;Not a candidate
 Q
ACURIN(DFN,TEST,DATE,VALUE,TEXT) ; EP
 ;This computed finding will check the PCC logic urinalysis
 N BPXRESLT,TODAY,X,Y,APCHSPAT
 S X="TODAY" D ^%DT S TODAY=Y
 S APCHSPAT=DFN
 S BPXRESLT=$$LASTACUR^APCHSACG(APCHSPAT)
 I BPXRESLT="" S TEST=0,VALUE=TEST,DATE=TODAY
 I $P(BPXRESLT,U,1)'<$$FMADD^XLFDT(DT,-365) S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT=$p(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,1)  ;had one in past year
 I $P(BPXRESLT,U,1)>0 S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,1)
 I $P(BPXRESLT,U,1)=0 S TEST=0,VALUE=TEST,DATE=TODAY
 Q
ACCBC(DFN,TEST,DATE,VALUE,TEXT) ; EP
 ;This computed finding will check the PCC logic for CBC
 N BPXRESLT,TODAY,X,Y,APCHSPAT
 S X="TODAY" D ^%DT S TODAY=Y
 S APCHSPAT=DFN
 S BPXRESLT=$$LASTACCB^APCHSACG(APCHSPAT)
 I BPXRESLT="" S TEST=0,VALUE=TEST,DATE=TODAY
 I $P(BPXRESLT,U,1)'<$$FMADD^XLFDT(DT,-365) S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,1)
 I $P(BPXRESLT,U,1)>0 S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,1)
 I $P(BPXRESLT,U,1)=0 S TEST=0,VALUE=TEST,DATE=TODAY
 Q
ACFOBT(DFN,TEST,DATE,VALUE,TEXT) ; EP
 ;This computed finding will check the PCC logic for FOBT
 N BPXRESLT,TODAY,X,Y,APCHSPAT
 S X="TODAY" D ^%DT S TODAY=Y
 S APCHSPAT=DFN
 I $$LASTDX^APCHSMU2(APCHSPAT,"BGP OSTEOPOROSIS DXS",$P(^DPT(APCHSPAT,0),U,3),TODAY) S TEST=1,VALUE="NA",TEXT="Pt has DX of osteoporosis",DATE=TODAY Q
 S BPXRESLT=$$LASTACFO^APCHSACG(APCHSPAT)
 I BPXRESLT="" S TEST=0,VALUE=TEST,DATE=TODAY
 I $P(BPXRESLT,U,1)'<$$FMADD^XLFDT(DT,-365) S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,1) Q  ;had one in past year
 I $P(BPXRESLT,U,1)>1 S TEST=1,VALUE=$P(BPXRESLT,U,4),TEXT=$P(BPXRESLT,U,2),DATE=$P(BPXRESLT,U,1)
 I $P(BPXRESLT,U,1)=0 S TEST=0,VALUE=TEST,DATE=TODAY
 Q