BGPMUDD5 ; IHS/MSC/SAT - MU EP measures NQF0033 ;29-AUG-2011 11:26;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Delimited output reports for this measure
DCHL ;EP
D P1
K ^TMP("BGPMU0033",$J)
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3
N PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRD7,PRD8,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRN7,PRN8
S STRING1=$$NUM33^BGPMUDP5("C")
S STRING2=$$NUM33^BGPMUDP5("P")
S STRING3=$$NUM33^BGPMUDP5("B")
D SUMMARY1^BGPMUDP5(STRING1,STRING2,STRING3)
;population
S PRD11=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRD14=$P(STRING1,U,9)-$P(STRING2,U,9)
S PRN11=$P(STRING1,U,5)-$P(STRING3,U,5)
S PRN14=$P(STRING1,U,9)-$P(STRING3,U,9)
S PRD21=$P(STRING1,U,14)-$P(STRING2,U,14)
S PRD24=$P(STRING1,U,18)-$P(STRING2,U,18)
S PRN21=$P(STRING1,U,14)-$P(STRING3,U,14)
S PRN24=$P(STRING1,U,18)-$P(STRING3,U,18)
S PRD31=$P(STRING1,U,23)-$P(STRING2,U,23)
S PRD34=$P(STRING1,U,27)-$P(STRING2,U,27)
S PRN31=$P(STRING1,U,23)-$P(STRING3,U,23)
S PRN34=$P(STRING1,U,27)-$P(STRING3,U,27)
S X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
D S^BGPMUDEL(X,2,1)
;
S X="Denominator 1:"
D S^BGPMUDEL(X,2,1)
S X="Pts 15-24 sexually active"_U_+$P(STRING1,U,1)_U_U_+$P(STRING2,U,1)_U_U_U_+$P(STRING3,U,1) D S^BGPMUDEL(X,2,1)
S X="females" D S^BGPMUDEL(X,1,1)
S X="# Excluded (Exc)"_U_+$P(STRING1,U,4)_U_U_+$P(STRING2,U,4)_U_U_U_+$P(STRING3,U,4)
D S^BGPMUDEL(X,1,1)
S X="Pts 15-24 sexually active"_U_+$P(STRING1,U,3)_U_U_+$P(STRING2,U,3)_U_U_U_+$P(STRING3,U,3)
D S^BGPMUDEL(X,1,1)
S X="females less Exc"
D S^BGPMUDEL(X,1,1)
S X="# w/chlamydia screening"_U_+$P(STRING1,U,2)_U_$J($P(STRING1,U,5),5,1)_U_+$P(STRING2,U,2)_U_$J($P(STRING2,U,5),5,1)_U_$FN(PRD11,",+",1)_U_+$P(STRING3,U,2)_U_$J($P(STRING3,U,5),5,1)_U_$FN(PRN11,",+",1)
D S^BGPMUDEL(X,2,1)
S X="# w/o chlamydia screening"_U_+$P(STRING1,U,8)_U_$J($P(STRING1,U,9),5,1)_U_+$P(STRING2,U,8)_U_$J($P(STRING2,U,9),5,1)_U_$FN(PRD14,",+",1)_U_+$P(STRING3,U,8)_U_$J($P(STRING3,U,9),5,1)_U_$FN(PRN14,",+",1)
D S^BGPMUDEL(X,1,1)
;
S X="Denominator 2:"
D S^BGPMUDEL(X,2,1)
S X="Pts 15-19 sexually active"_U_+$P(STRING1,U,10)_U_U_+$P(STRING2,U,10)_U_U_U_+$P(STRING3,U,10) D S^BGPMUDEL(X,2,1)
S X="females" D S^BGPMUDEL(X,1,1)
S X="# Excluded (Exc)"_U_+$P(STRING1,U,13)_U_U_+$P(STRING2,U,13)_U_U_U_+$P(STRING3,U,13)
D S^BGPMUDEL(X,1,1)
S X="Pts 15-19 sexually active"_U_+$P(STRING1,U,12)_U_U_+$P(STRING2,U,12)_U_U_U_+$P(STRING3,U,12)
D S^BGPMUDEL(X,1,1)
S X="females less Exc"
D S^BGPMUDEL(X,1,1)
S X="# w/chlamydia screening"_U_+$P(STRING1,U,11)_U_$J($P(STRING1,U,14),5,1)_U_+$P(STRING2,U,11)_U_$J($P(STRING2,U,14),5,1)_U_$FN(PRD21,",+",1)_U_+$P(STRING3,U,11)_U_$J($P(STRING3,U,14),5,1)_U_$FN(PRN21,",+",1)
D S^BGPMUDEL(X,2,1)
S X="# w/o chlamydia screening"_U_+$P(STRING1,U,17)_U_$J($P(STRING1,U,18),5,1)_U_+$P(STRING2,U,17)_U_$J($P(STRING2,U,18),5,1)_U_$FN(PRD24,",+",1)_U_+$P(STRING3,U,17)_U_$J($P(STRING3,U,18),5,1)_U_$FN(PRN24,",+",1)
D S^BGPMUDEL(X,1,1)
;
S X="Denominator 3:"
D S^BGPMUDEL(X,2,1)
S X="Pts 15-24 sexually active"_U_+$P(STRING1,U,19)_U_U_+$P(STRING2,U,19)_U_U_U_+$P(STRING3,U,19) D S^BGPMUDEL(X,2,1)
S X="females" D S^BGPMUDEL(X,1,1)
S X="# Excluded (Exc)"_U_+$P(STRING1,U,22)_U_U_+$P(STRING2,U,22)_U_U_U_+$P(STRING3,U,22)
D S^BGPMUDEL(X,1,1)
S X="Pts 15-24 sexually active"_U_+$P(STRING1,U,21)_U_U_+$P(STRING2,U,21)_U_U_U_+$P(STRING3,U,21)
D S^BGPMUDEL(X,1,1)
S X="females less Exc"
D S^BGPMUDEL(X,1,1)
S X="# w/chlamydia screening"_U_+$P(STRING1,U,20)_U_$J($P(STRING1,U,23),5,1)_U_+$P(STRING2,U,20)_U_$J($P(STRING2,U,23),5,1)_U_$FN(PRD31,",+",1)_U_+$P(STRING3,U,20)_U_$J($P(STRING3,U,23),5,1)_U_$FN(PRN31,",+",1)
D S^BGPMUDEL(X,2,1)
S X="# w/o chlamydia screening"_U_+$P(STRING1,U,26)_U_$J($P(STRING1,U,27),5,1)_U_+$P(STRING2,U,26)_U_$J($P(STRING2,U,27),5,1)_U_$FN(PRD34,",+",1)_U_+$P(STRING3,U,26)_U_$J($P(STRING3,U,27),5,1)_U_$FN(PRN34,",+",1)
D S^BGPMUDEL(X,1,1)
;
I $D(BGPLIST(BGPIC)) D P2
Q
P2 ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X,PTCT
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
S X="Patients 15-24 years of age with at least 1 encounter with the EP within 1 year" D S^BGPMUDEL(X,1,1)
S X="of the reporting period end date, who have been identified as sexually active or" D S^BGPMUDEL(X,1,1)
S X="pregnant on or before the reporting period end date AND who had at least" D S^BGPMUDEL(X,1,1)
S X="1 chlamydia screening during the reporting period, if any." D S^BGPMUDEL(X,1,1)
;
S X="Patients who do not meet the numerator criteria are listed first (NM:), followed" D S^BGPMUDEL(X,2,1)
S X="by patients who do meet the numerator criteria (M:). Excluded patients are" D S^BGPMUDEL(X,1,1)
S X="listed last." D S^BGPMUDEL(X,1,1)
;
S X="The following are the abbreviations used in the denominator and numerator" D S^BGPMUDEL(X,2,1)
S X="columns:" D S^BGPMUDEL(X,1,1)
S X="PROC=Procedure Indicative of a Sexually Active Woman" D S^BGPMUDEL(X,1,1)
S X="LABP=Laboratory Test for Pregnancy" D S^BGPMUDEL(X,1,1)
S X="PREG=Pregnancy Encounter" D S^BGPMUDEL(X,1,1)
S X="LAB=Laboratory Test Indicative of a Sexually Active Woman" D S^BGPMUDEL(X,1,1)
S X="DX=Diagnosis Indicative of a Sexually Active Woman" D S^BGPMUDEL(X,1,1)
S X="MED=Contraceptive Medication" D S^BGPMUDEL(X,1,1)
S X="IUD=Use of IUD Device" D S^BGPMUDEL(X,1,1)
S X="ALR=Allergy to IUD Device" D S^BGPMUDEL(X,1,1)
S X="EDU=Contraceptive Use Education" D S^BGPMUDEL(X,1,1)
S X="RF=Reproductive Factor" D S^BGPMUDEL(X,1,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="CHL=Chlamydia screening" D S^BGPMUDEL(X,1,1)
;
S PTCT=0
S X="Patients 15-19" D S^BGPMUDEL(X,2,1)
S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,2,1)
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$J_",""PAT"",""C"",""NOT"",2)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$J_",""PAT"",""C"",""NUM"",2)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$J_",""PAT"",""C"",""EXC"",2)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
;
S PTCT=0
S X="Patients 20-24" D S^BGPMUDEL(X,2,1)
S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,2,1)
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$J_",""PAT"",""C"",""NOT"",3)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$J_",""PAT"",""C"",""NUM"",3)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$J_",""PAT"",""C"",""EXC"",3)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
Q
;
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,DEN3,LINE
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,22)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S DEN=$P(NODE,U,2)
S NUM=$P(NODE,U,3)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
S SEX=$P(^DPT(DFN,0),U,2)
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_$P(DEN,";",1)_U_NUM
D S^BGPMUDEL(X,1,1)
F BGPI=2:1:$L(DEN,";") D
.S X=U_U_U_U_U_$P(DEN,";",BGPI)
.D S^BGPMUDEL(X,1,1)
Q
BGPMUDD5 ; IHS/MSC/SAT - MU EP measures NQF0033 ;29-AUG-2011 11:26;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Delimited output reports for this measure
DCHL ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0033",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3
+3 NEW PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRD7,PRD8,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRN7,PRN8
+4 SET STRING1=$$NUM33^BGPMUDP5("C")
+5 SET STRING2=$$NUM33^BGPMUDP5("P")
+6 SET STRING3=$$NUM33^BGPMUDP5("B")
+7 DO SUMMARY1^BGPMUDP5(STRING1,STRING2,STRING3)
+8 ;population
+9 SET PRD11=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+10 SET PRD14=$PIECE(STRING1,U,9)-$PIECE(STRING2,U,9)
+11 SET PRN11=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+12 SET PRN14=$PIECE(STRING1,U,9)-$PIECE(STRING3,U,9)
+13 SET PRD21=$PIECE(STRING1,U,14)-$PIECE(STRING2,U,14)
+14 SET PRD24=$PIECE(STRING1,U,18)-$PIECE(STRING2,U,18)
+15 SET PRN21=$PIECE(STRING1,U,14)-$PIECE(STRING3,U,14)
+16 SET PRN24=$PIECE(STRING1,U,18)-$PIECE(STRING3,U,18)
+17 SET PRD31=$PIECE(STRING1,U,23)-$PIECE(STRING2,U,23)
+18 SET PRD34=$PIECE(STRING1,U,27)-$PIECE(STRING2,U,27)
+19 SET PRN31=$PIECE(STRING1,U,23)-$PIECE(STRING3,U,23)
+20 SET PRN34=$PIECE(STRING1,U,27)-$PIECE(STRING3,U,27)
+21 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+22 DO S^BGPMUDEL(X,2,1)
+23 ;
+24 SET X="Denominator 1:"
+25 DO S^BGPMUDEL(X,2,1)
+26 SET X="Pts 15-24 sexually active"_U_+$PIECE(STRING1,U,1)_U_U_+$PIECE(STRING2,U,1)_U_U_U_+$PIECE(STRING3,U,1)
DO S^BGPMUDEL(X,2,1)
+27 SET X="females"
DO S^BGPMUDEL(X,1,1)
+28 SET X="# Excluded (Exc)"_U_+$PIECE(STRING1,U,4)_U_U_+$PIECE(STRING2,U,4)_U_U_U_+$PIECE(STRING3,U,4)
+29 DO S^BGPMUDEL(X,1,1)
+30 SET X="Pts 15-24 sexually active"_U_+$PIECE(STRING1,U,3)_U_U_+$PIECE(STRING2,U,3)_U_U_U_+$PIECE(STRING3,U,3)
+31 DO S^BGPMUDEL(X,1,1)
+32 SET X="females less Exc"
+33 DO S^BGPMUDEL(X,1,1)
+34 SET X="# w/chlamydia screening"_U_+$PIECE(STRING1,U,2)_U_$JUSTIFY($PIECE(STRING1,U,5),5,1)_U_+$PIECE(STRING2,U,2)_U_$JUSTIFY($PIECE(STRING2,U,5),5,1)_U_$FNUMBER(PRD11,",+",1)_U_+$PIECE(STRING3,U,2)_U_$JUSTIFY($PIECE(STRING3,U,5),5,1)_U_...
... $FNUMBER(PRN11,",+",1)
+35 DO S^BGPMUDEL(X,2,1)
+36 SET X="# w/o chlamydia screening"_U_+$PIECE(STRING1,U,8)_U_$JUSTIFY($PIECE(STRING1,U,9),5,1)_U_+$PIECE(STRING2,U,8)_U_$JUSTIFY($PIECE(STRING2,U,9),5,1)_U_$FNUMBER(PRD14,",+",1)_U_+$PIECE(STRING3,U,8)_U_$JUSTIFY(...
... $PIECE(STRING3,U,9),5,1)_U_$FNUMBER(PRN14,",+",1)
+37 DO S^BGPMUDEL(X,1,1)
+38 ;
+39 SET X="Denominator 2:"
+40 DO S^BGPMUDEL(X,2,1)
+41 SET X="Pts 15-19 sexually active"_U_+$PIECE(STRING1,U,10)_U_U_+$PIECE(STRING2,U,10)_U_U_U_+$PIECE(STRING3,U,10)
DO S^BGPMUDEL(X,2,1)
+42 SET X="females"
DO S^BGPMUDEL(X,1,1)
+43 SET X="# Excluded (Exc)"_U_+$PIECE(STRING1,U,13)_U_U_+$PIECE(STRING2,U,13)_U_U_U_+$PIECE(STRING3,U,13)
+44 DO S^BGPMUDEL(X,1,1)
+45 SET X="Pts 15-19 sexually active"_U_+$PIECE(STRING1,U,12)_U_U_+$PIECE(STRING2,U,12)_U_U_U_+$PIECE(STRING3,U,12)
+46 DO S^BGPMUDEL(X,1,1)
+47 SET X="females less Exc"
+48 DO S^BGPMUDEL(X,1,1)
+49 SET X="# w/chlamydia screening"_U_+$PIECE(STRING1,U,11)_U_$JUSTIFY($PIECE(STRING1,U,14),5,1)_U_+$PIECE(STRING2,U,11)_U_$JUSTIFY($PIECE(STRING2,U,14),5,1)_U_$FNUMBER(PRD21,",+",1)_U_+$PIECE(STRING3,U,11)_U_$JUSTIFY(...
... $PIECE(STRING3,U,14),5,1)_U_$FNUMBER(PRN21,",+",1)
+50 DO S^BGPMUDEL(X,2,1)
+51 SET X="# w/o chlamydia screening"_U_+$PIECE(STRING1,U,17)_U_$JUSTIFY($PIECE(STRING1,U,18),5,1)_U_+$PIECE(STRING2,U,17)_U_$JUSTIFY($PIECE(STRING2,U,18),5,1)_U_$FNUMBER(PRD24,",+",1)_U_+$PIECE(STRING3,U,17)_U_...
... $JUSTIFY($PIECE(STRING3,U,18),5,1)_U_$FNUMBER(PRN24,",+",1)
+52 DO S^BGPMUDEL(X,1,1)
+53 ;
+54 SET X="Denominator 3:"
+55 DO S^BGPMUDEL(X,2,1)
+56 SET X="Pts 15-24 sexually active"_U_+$PIECE(STRING1,U,19)_U_U_+$PIECE(STRING2,U,19)_U_U_U_+$PIECE(STRING3,U,19)
DO S^BGPMUDEL(X,2,1)
+57 SET X="females"
DO S^BGPMUDEL(X,1,1)
+58 SET X="# Excluded (Exc)"_U_+$PIECE(STRING1,U,22)_U_U_+$PIECE(STRING2,U,22)_U_U_U_+$PIECE(STRING3,U,22)
+59 DO S^BGPMUDEL(X,1,1)
+60 SET X="Pts 15-24 sexually active"_U_+$PIECE(STRING1,U,21)_U_U_+$PIECE(STRING2,U,21)_U_U_U_+$PIECE(STRING3,U,21)
+61 DO S^BGPMUDEL(X,1,1)
+62 SET X="females less Exc"
+63 DO S^BGPMUDEL(X,1,1)
+64 SET X="# w/chlamydia screening"_U_+$PIECE(STRING1,U,20)_U_$JUSTIFY($PIECE(STRING1,U,23),5,1)_U_+$PIECE(STRING2,U,20)_U_$JUSTIFY($PIECE(STRING2,U,23),5,1)_U_$FNUMBER(PRD31,",+",1)_U_+$PIECE(STRING3,U,20)_U_$JUSTIFY(...
... $PIECE(STRING3,U,23),5,1)_U_$FNUMBER(PRN31,",+",1)
+65 DO S^BGPMUDEL(X,2,1)
+66 SET X="# w/o chlamydia screening"_U_+$PIECE(STRING1,U,26)_U_$JUSTIFY($PIECE(STRING1,U,27),5,1)_U_+$PIECE(STRING2,U,26)_U_$JUSTIFY($PIECE(STRING2,U,27),5,1)_U_$FNUMBER(PRD34,",+",1)_U_+$PIECE(STRING3,U,26)_U_...
... $JUSTIFY($PIECE(STRING3,U,27),5,1)_U_$FNUMBER(PRN34,",+",1)
+67 DO S^BGPMUDEL(X,1,1)
+68 ;
+69 IF $DATA(BGPLIST(BGPIC))
DO P2
+70 QUIT
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X,PTCT
+2 SET X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****"
DO S^BGPMUDEL(X,2,1)
+3 SET X="Patients 15-24 years of age with at least 1 encounter with the EP within 1 year"
DO S^BGPMUDEL(X,1,1)
+4 SET X="of the reporting period end date, who have been identified as sexually active or"
DO S^BGPMUDEL(X,1,1)
+5 SET X="pregnant on or before the reporting period end date AND who had at least"
DO S^BGPMUDEL(X,1,1)
+6 SET X="1 chlamydia screening during the reporting period, if any."
DO S^BGPMUDEL(X,1,1)
+7 ;
+8 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO S^BGPMUDEL(X,2,1)
+9 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO S^BGPMUDEL(X,1,1)
+10 SET X="listed last."
DO S^BGPMUDEL(X,1,1)
+11 ;
+12 SET X="The following are the abbreviations used in the denominator and numerator"
DO S^BGPMUDEL(X,2,1)
+13 SET X="columns:"
DO S^BGPMUDEL(X,1,1)
+14 SET X="PROC=Procedure Indicative of a Sexually Active Woman"
DO S^BGPMUDEL(X,1,1)
+15 SET X="LABP=Laboratory Test for Pregnancy"
DO S^BGPMUDEL(X,1,1)
+16 SET X="PREG=Pregnancy Encounter"
DO S^BGPMUDEL(X,1,1)
+17 SET X="LAB=Laboratory Test Indicative of a Sexually Active Woman"
DO S^BGPMUDEL(X,1,1)
+18 SET X="DX=Diagnosis Indicative of a Sexually Active Woman"
DO S^BGPMUDEL(X,1,1)
+19 SET X="MED=Contraceptive Medication"
DO S^BGPMUDEL(X,1,1)
+20 SET X="IUD=Use of IUD Device"
DO S^BGPMUDEL(X,1,1)
+21 SET X="ALR=Allergy to IUD Device"
DO S^BGPMUDEL(X,1,1)
+22 SET X="EDU=Contraceptive Use Education"
DO S^BGPMUDEL(X,1,1)
+23 SET X="RF=Reproductive Factor"
DO S^BGPMUDEL(X,1,1)
+24 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+25 SET X="CHL=Chlamydia screening"
DO S^BGPMUDEL(X,1,1)
+26 ;
+27 SET PTCT=0
+28 SET X="Patients 15-19"
DO S^BGPMUDEL(X,2,1)
+29 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
DO S^BGPMUDEL(X,2,1)
+30 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+31 KILL BGPARR
+32 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$JOB_",""PAT"",""C"",""NOT"",2)")
+33 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+34 SET PTCT=PTCT+1
+35 SET NODE=$GET(BGPARR(PT))
+36 DO DATA(NODE)
End DoDot:2
End DoDot:1
+37 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+38 KILL BGPARR
+39 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$JOB_",""PAT"",""C"",""NUM"",2)")
+40 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+41 SET PTCT=PTCT+1
+42 SET NODE=$GET(BGPARR(PT))
+43 DO DATA(NODE)
End DoDot:2
End DoDot:1
+44 IF BGPLIST="A"
Begin DoDot:1
+45 KILL BGPARR
+46 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$JOB_",""PAT"",""C"",""EXC"",2)")
+47 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+48 SET PTCT=PTCT+1
+49 SET NODE=$GET(BGPARR(PT))
+50 DO DATA(NODE)
End DoDot:2
End DoDot:1
+51 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+52 ;
+53 SET PTCT=0
+54 SET X="Patients 20-24"
DO S^BGPMUDEL(X,2,1)
+55 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
DO S^BGPMUDEL(X,2,1)
+56 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+57 KILL BGPARR
+58 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$JOB_",""PAT"",""C"",""NOT"",3)")
+59 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+60 SET PTCT=PTCT+1
+61 SET NODE=$GET(BGPARR(PT))
+62 DO DATA(NODE)
End DoDot:2
End DoDot:1
+63 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+64 KILL BGPARR
+65 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$JOB_",""PAT"",""C"",""NUM"",3)")
+66 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+67 SET PTCT=PTCT+1
+68 SET NODE=$GET(BGPARR(PT))
+69 DO DATA(NODE)
End DoDot:2
End DoDot:1
+70 IF BGPLIST="A"
Begin DoDot:1
+71 KILL BGPARR
+72 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0033"","_$JOB_",""PAT"",""C"",""EXC"",3)")
+73 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+74 SET PTCT=PTCT+1
+75 SET NODE=$GET(BGPARR(PT))
+76 DO DATA(NODE)
End DoDot:2
End DoDot:1
+77 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+78 QUIT
+79 ;
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,DEN3,LINE
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,22)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET DEN=$PIECE(NODE,U,2)
+7 SET NUM=$PIECE(NODE,U,3)
+8 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,11)
+9 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+10 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_$PIECE(DEN,";",1)_U_NUM
+11 DO S^BGPMUDEL(X,1,1)
+12 FOR BGPI=2:1:$LENGTH(DEN,";")
Begin DoDot:1
+13 SET X=U_U_U_U_U_$PIECE(DEN,";",BGPI)
+14 DO S^BGPMUDEL(X,1,1)
End DoDot:1
+15 QUIT