BPXRMASM ; IHS/CIA/MGH - Asthma reminders. ;18-Apr-2014 15:23;DU
;;2.0;CLINICAL REMINDERS;**1001,1002**;Feb 04, 2005;Build 15
;=================================================================
;This routine is designed to evaluate the asthma registry information
;to create the reminders for asthma patients that match the
;health summary maintenance reminders for asthma patients
;1004 MODIFIED TO MAKE MORE UNIFORM DATE RETURN FOR ASTHAM PLAN
;1007 Updated to match the treatment prompts logic
;=====================================================================
STEROID(DFN,TEST,DATE,VALUE,TEXT) ; EP
;This computed finding will check to see if steroids should be increased
I '$$HMR1ST^APCHSMAS(DFN) S TEST=1,DATE=DT,TEXT="Not a candidate for this reminder" Q
E S TEST=0,DATE=DT,TEXT="If this patient has asthma, consider adding or increasing this patient's inhaled corticsteroids."
Q
PRIMARY(DFN,TEST,DATE,VALUE,TEXT) ; EP
;This computed finding will check to see if this asthma patient has a primary provider
N CIADOB,CIASEX,X1,X2,CIAAGE
S TEST=0,DATE="",TEXT="",VALUE=""
I $P($G(^AUPNPAT(DFN,0)),U,14)]"" S TEST=1,DATE=DT,TEXT="PROVIDER FOUND" Q
NEW APCHPRV
D WHPCP^BDPAPI(DFN,.APCHPRV)
I $G(APCHPRV("DESIGNATED PRIMARY PROVIDER"))]"" S TEST=1,DATE=DT,TEXT="PROVIDER FOUND" Q
I '$$HMR5ST^APCHSMAS(DFN) S TEST=1,DATE=DT,TEXT="Does not meet criteria for reminder" Q
E S TEST=0,DATE=DT,TEXT="No primary provider found"
Q
SEVERITY(DFN,TEST,DATE,VALUE,TEXT) ; EP
;This computed finding will check to see if the asthma patient has
;had a severity indicated
N CIASTAT,X
I $$LASTASCL^APCHSMAS(DFN,1)]"" S TEST=1,DATE=DT,TEXT="ASTHMA SEVERITY DOCUMENTED" Q ;asthma severity documented
I '$$HMR4ST^APCHSMAS(DFN) S TEST=1,DATE=DT,TEXT="NOT A CANDIDATE FOR ASTHMA SEVERITY" ;not a candidate so reminder is resolved
E S TEST=0,DATE=DT,TEXT="ASTHMA SEVERITY NOT DOCUMENTED" ; severity is NOT documented
Q
PLAN(DFN,TEST,DATE,VALUE,TEXT) ; EP
;This computed finding will check to see if the patient has an asthma plan
;in place
;IHS/MSC/MGH Changed to match treatment plan logic
N APCHICAR,Y
S APCHICAR=$$LASTITEM^APCLAPIU(DFN,"ASM-SMP","EDUCATION",,,"A")
I APCHICAR="" S APCHICAR=$$LASTAM^APCHSAST(DFN,3)
S (APCHLAST,Y)=$P(APCHICAR,U,1)
I Y>$$FMADD^XLFDT(DT,-365) S TEST=1,DATE=APCHLAST,VALUE=APCHLAST,TEXT="Asthma plan found in the last year" Q
I '$$HMR2ST^APCHSMAS(DFN) S TEST=1,DATE=DT,TEXT="Not a candidate for asthma plan"
E D
.S TEST=0,DATE=DT,TEXT="No asthma management plan found"
Q
CONTROL(DFN,TEST,DATE,VALUE,TEXT) ;EP
N APCHLAST
I '$$HMR6ST^APCHSMAS(DFN) S TEST=1,DATE=DT,TEXT="Not a candidate for this reminder" Q
S APCHLAST=$$LASTACON^APCHSMAS(DFN,2)
I $$FMDIFF^XLFDT(DT,APCHLAST)<365 S TEST=1,DATE=APCHLAST,VALUE=APCHLAST,TEXT="Asthma control documented"
E S TEST=0,DATE=DT,TEXT="No asthma control documented"
Q
RISK(DFN,TEST,DATE,VALUE,TEXT) ;EP
N APCHSEV
S APCHSEV=$$HMR7ST^APCHSMAS(DFN) ;not a candidate
I 'APCHSEV S TEST=1,DATE=DT,TEXT="Not a candidate for this reminder"
E S TEST=0,DATE=DT,TEXT="Pt at risk for exacerbation"
Q
BPXRMASM ; IHS/CIA/MGH - Asthma reminders. ;18-Apr-2014 15:23;DU
+1 ;;2.0;CLINICAL REMINDERS;**1001,1002**;Feb 04, 2005;Build 15
+2 ;=================================================================
+3 ;This routine is designed to evaluate the asthma registry information
+4 ;to create the reminders for asthma patients that match the
+5 ;health summary maintenance reminders for asthma patients
+6 ;1004 MODIFIED TO MAKE MORE UNIFORM DATE RETURN FOR ASTHAM PLAN
+7 ;1007 Updated to match the treatment prompts logic
+8 ;=====================================================================
STEROID(DFN,TEST,DATE,VALUE,TEXT) ; EP
+1 ;This computed finding will check to see if steroids should be increased
+2 IF '$$HMR1ST^APCHSMAS(DFN)
SET TEST=1
SET DATE=DT
SET TEXT="Not a candidate for this reminder"
QUIT
+3 IF '$TEST
SET TEST=0
SET DATE=DT
SET TEXT="If this patient has asthma, consider adding or increasing this patient's inhaled corticsteroids."
+4 QUIT
PRIMARY(DFN,TEST,DATE,VALUE,TEXT) ; EP
+1 ;This computed finding will check to see if this asthma patient has a primary provider
+2 NEW CIADOB,CIASEX,X1,X2,CIAAGE
+3 SET TEST=0
SET DATE=""
SET TEXT=""
SET VALUE=""
+4 IF $PIECE($GET(^AUPNPAT(DFN,0)),U,14)]""
SET TEST=1
SET DATE=DT
SET TEXT="PROVIDER FOUND"
QUIT
+5 NEW APCHPRV
+6 DO WHPCP^BDPAPI(DFN,.APCHPRV)
+7 IF $GET(APCHPRV("DESIGNATED PRIMARY PROVIDER"))]""
SET TEST=1
SET DATE=DT
SET TEXT="PROVIDER FOUND"
QUIT
+8 IF '$$HMR5ST^APCHSMAS(DFN)
SET TEST=1
SET DATE=DT
SET TEXT="Does not meet criteria for reminder"
QUIT
+9 IF '$TEST
SET TEST=0
SET DATE=DT
SET TEXT="No primary provider found"
+10 QUIT
SEVERITY(DFN,TEST,DATE,VALUE,TEXT) ; EP
+1 ;This computed finding will check to see if the asthma patient has
+2 ;had a severity indicated
+3 NEW CIASTAT,X
+4 ;asthma severity documented
IF $$LASTASCL^APCHSMAS(DFN,1)]""
SET TEST=1
SET DATE=DT
SET TEXT="ASTHMA SEVERITY DOCUMENTED"
QUIT
+5 ;not a candidate so reminder is resolved
IF '$$HMR4ST^APCHSMAS(DFN)
SET TEST=1
SET DATE=DT
SET TEXT="NOT A CANDIDATE FOR ASTHMA SEVERITY"
+6 ; severity is NOT documented
IF '$TEST
SET TEST=0
SET DATE=DT
SET TEXT="ASTHMA SEVERITY NOT DOCUMENTED"
+7 QUIT
PLAN(DFN,TEST,DATE,VALUE,TEXT) ; EP
+1 ;This computed finding will check to see if the patient has an asthma plan
+2 ;in place
+3 ;IHS/MSC/MGH Changed to match treatment plan logic
+4 NEW APCHICAR,Y
+5 SET APCHICAR=$$LASTITEM^APCLAPIU(DFN,"ASM-SMP","EDUCATION",,,"A")
+6 IF APCHICAR=""
SET APCHICAR=$$LASTAM^APCHSAST(DFN,3)
+7 SET (APCHLAST,Y)=$PIECE(APCHICAR,U,1)
+8 IF Y>$$FMADD^XLFDT(DT,-365)
SET TEST=1
SET DATE=APCHLAST
SET VALUE=APCHLAST
SET TEXT="Asthma plan found in the last year"
QUIT
+9 IF '$$HMR2ST^APCHSMAS(DFN)
SET TEST=1
SET DATE=DT
SET TEXT="Not a candidate for asthma plan"
+10 IF '$TEST
Begin DoDot:1
+11 SET TEST=0
SET DATE=DT
SET TEXT="No asthma management plan found"
End DoDot:1
+12 QUIT
CONTROL(DFN,TEST,DATE,VALUE,TEXT) ;EP
+1 NEW APCHLAST
+2 IF '$$HMR6ST^APCHSMAS(DFN)
SET TEST=1
SET DATE=DT
SET TEXT="Not a candidate for this reminder"
QUIT
+3 SET APCHLAST=$$LASTACON^APCHSMAS(DFN,2)
+4 IF $$FMDIFF^XLFDT(DT,APCHLAST)<365
SET TEST=1
SET DATE=APCHLAST
SET VALUE=APCHLAST
SET TEXT="Asthma control documented"
+5 IF '$TEST
SET TEST=0
SET DATE=DT
SET TEXT="No asthma control documented"
+6 QUIT
RISK(DFN,TEST,DATE,VALUE,TEXT) ;EP
+1 NEW APCHSEV
+2 ;not a candidate
SET APCHSEV=$$HMR7ST^APCHSMAS(DFN)
+3 IF 'APCHSEV
SET TEST=1
SET DATE=DT
SET TEXT="Not a candidate for this reminder"
+4 IF '$TEST
SET TEST=0
SET DATE=DT
SET TEXT="Pt at risk for exacerbation"
+5 QUIT