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

BUDHRP6D.m

Go to the documentation of this file.
BUDHRP6D ; IHS/CMI/LAB - UDS REPORT PROCESSOR ;
 ;;13.0;IHS/RPMS UNIFORM DATA SYSTEM;;OCT 12, 2018;Build 90
 ;
TEST ;
 S DFN=1717,BUDBD=3180101,BUDED=3181231
 D PAPD
 Q
 ;
PAPD ;EP - called from xbdbque
 ;must have DOB between 1/1/06 and 12/31/06
 NEW BUDPAP,BUDHASP
 S (BUDPAP,BUDHASP,BUDPAPH)=""
 Q:$P(^DPT(DFN,0),U,2)'="F"
 S BUDDOB=$P(^DPT(DFN,0),U,3)
 S BUD64RB=($E(BUDBD,1,3)-64)_"0101"
 S BUDX23RB=($E(BUDED,1,3)-24)_"1231"
 S BUDDOB=$P(^DPT(DFN,0),U,3)
 Q:BUDDOB<BUD64RB
 Q:BUDDOB>BUDX23RB
 Q:BUDMEDV<1
 S BUD65TH=$E(BUDDOB,1,3)+65_$E(BUDDOB,4,7)
 I '$$VBBD(DFN,BUDDOB,$$FMADD^XLFDT(BUD65TH,-1)) Q  ;quit if no visiT before 65TH birthday
 K BUDPAP  ;
 I $$HYSTER(DFN,BUDED) Q  ;IF HYSTERECTOMY DON'T PUT IN DENOMINATOR
 Q:$$HOSPIND^BUDHRP6C(DFN,BUDBD,BUDED)  ;new v18, hospice during report period
 ;THESE HAD A PAP IN PAST 3 YEARS
 S BUDSECTD("PTS")=$G(BUDSECTD("PTS"))+1  ;denominator
 S BUDD=$E(BUDED,1,3)-2_$E(BUDBD,4,7)
 S BUDPAP=$$PAP(DFN,$$DOB^AUPNPAT(DFN),BUDED)  ;GET LAST PAP DATE
 S D=$P(BUDPAP,U,2)
 S BUDPD=$E(BUDED,1,3)-2_$E(BUDBD,4,7)
 I D'<BUDPD S BUDSECTD("PAP")=$G(BUDSECTD("PAP"))+1,BUDHASP=1
 I BUDHASP G PAPL
 ;new v12 add hpv/pap same day in past 4 years for 30-64
 S A=$$AGE^AUPNPAT(DFN,BUDBD)
 I A<30 G PAPL
 I A>64 G PAPL
 S BUDPAPH=$$PAPHPV^BUDHRP6M(DFN,BUDED,4)
 I BUDPAPH]"" S BUDSECTD("PAP")=$G(BUDSECTD("PAP"))+1,BUDHASP=1
PAPL ;
 I $G(BUDPAP1L),BUDHASP D
 .I BUDPAPH]"" S BUDPAP=BUDPAPH
 .S Y=$$FMTE^XLFDT($P(BUDPAP,U,2))_U_$P(BUDPAP,U,3)_U I $P(BUDPAP,U,4) S Y=Y_$$PRIMPROV^APCLV($P(BUDPAP,U,4),"D")_U_$P(^AUPNVSIT($P(BUDPAP,U,4),0),U,7)_U_$$CLINIC^APCLV($P(BUDPAP,U,4),"E")_U_$$LOCENC^APCLV($P(BUDPAP,U,4),"E")
 .S ^XTMP("BUDHRP6B",BUDJ,BUDH,"PAP1",BUDAGE,$P(^DPT(DFN,0),U),BUDCCOM,DFN)=Y
 I $G(BUDPAP2L),'BUDHASP D
 .S Y="" I BUDPAP="" S Y="Never"
 .I Y="" S Y=$$FMTE^XLFDT($P(BUDPAP,U,2))_U_$P(BUDPAP,U,3)_U I $P(BUDPAP,U,4) S Y=Y_$$PRIMPROV^APCLV($P(BUDPAP,U,4),"D")_U_$P(^AUPNVSIT($P(BUDPAP,U,4),0),U,7)_U_$$CLINIC^APCLV($P(BUDPAP,U,4),"E")_U_$$LOCENC^APCLV($P(BUDPAP,U,4),"E")
 .S ^XTMP("BUDHRP6B",BUDJ,BUDH,"PAP2",BUDAGE,$P(^DPT(DFN,0),U),BUDCCOM,DFN)=Y
 Q
 ;
 ;
VBBD(P,BDATE,EDATE) ;EP
 NEW BUDVL,G
 K BUDVL
 S G=""
 S A="BUDVL(",B=DFN_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(BUDVL) Q ""
 S X=0 F  S X=$O(BUDVL(X)) Q:X'=+X  S V=$P(BUDVL(X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:'$D(^AUPNVPRV("AD",V))
 .Q:'$D(^AUPNVPOV("AD",V))
 .S L=$P(^AUPNVSIT(V,0),U,6)
 .Q:L=""
 .Q:'$D(^BUDHSITE(BUDSITE,11,L))
 .Q:$P(^AUPNVSIT(V,0),U,7)="C"
 .Q:$P(^AUPNVSIT(V,0),U,7)="T"
 .Q:$P(^AUPNVSIT(V,0),U,7)="N"
 .Q:$P(^AUPNVSIT(V,0),U,7)="D"
 .Q:$P(^AUPNVSIT(V,0),U,7)="X"
 .Q:$P(^AUPNVSIT(V,0),U,7)="E"
 .S G=V
 .Q
 Q G
 ;
PAP(P,BDATE,EDATE) ;EP
 NEW BUDD,BUDLPAP,T,BUDLT,B,E,D,L,X,Z,J,T,BUD
 K BUDD
 S BUDD=""
 S BUDLPAP=""
 S T=$O(^ATXAX("B","BGP PAP LOINC CODES",0))
 S BUDLT=$O(^ATXLAB("B","BGP PAP SMEAR TAX",0))
 S B=9999999-BDATE,E=9999999-EDATE S D=E-1 F  S D=$O(^AUPNVLAB("AE",P,D)) Q:D'=+D!(D>B)!(BUDD]"")  D
 .S L=0 F  S L=$O(^AUPNVLAB("AE",P,D,L)) Q:L'=+L!(BUDD]"")  D
 ..S X=0 F  S X=$O(^AUPNVLAB("AE",P,D,L,X)) Q:X'=+X!(BUDD]"")  D
 ...Q:'$D(^AUPNVLAB(X,0))
 ...S Z=$P(^AUPNVLAB(X,0),U),Z=$P($G(^LAB(60,Z,0)),U) I Z="PAP SMEAR" S BUDD="1^"_(9999999-D)_"^Lab "_Z_U_$P(^AUPNVLAB(X,0),U,3) Q
 ...I BUDLT,$P(^AUPNVLAB(X,0),U),$D(^ATXLAB(BUDLT,21,"B",$P(^AUPNVLAB(X,0),U))) S BUDD="1^"_(9999999-D)_"^Lab "_$$VAL^XBDIQ1(9000010.09,X,.01)_U_$P(^AUPNVLAB(X,0),U,3) Q
 ...Q:'T
 ...S J=$P($G(^AUPNVLAB(X,11)),U,13) Q:J=""
 ...Q:'$$LOINC(J,T)
 ...S BUDD="1^"_(9999999-D)_"^Lab "_$$VAL^XBDIQ1(9000010.09,X,.01)_U_$P(^AUPNVLAB(X,0),U,3) Q
 ...Q
 S BUDLPAP=BUDD
 K BUD
 S T=$O(^ATXAX("B","BUD 18 CPT PAP",0))
 I T D  I X]"",$P(BUDLPAP,U,2)<$P(X,U,2) S BUDLPAP="1^"_$P(X,U,2)_"^CPT "_$P(X,U,3)_"^"_$P(X,U,5)
 .S X=$$CPT^BUDHDU(P,BDATE,EDATE,T,6) I X]"" Q
 .S X=$$TRAN^BUDHDU(P,BDATE,EDATE,T,6)
 S T="PAP SMEAR",T=$O(^BWPN("B",T,0))
 I T D  I X]"",$P(BUDLPAP,U,2)<X S BUDLPAP="1^"_X_"^WH PAP SMEAR"
 .S X=$$WH^BUDHDU(P,BDATE,EDATE,T,3)
 Q BUDLPAP
 ;
LOINC(A,B) ;EP
 NEW %
 S %=$P($G(^LAB(95.3,A,9999999)),U,2)
 I %]"",$D(^ATXAX(B,21,"B",%)) Q 1
 S %=$P($G(^LAB(95.3,A,0)),U)_"-"_$P($G(^LAB(95.3,A,0)),U,15)
 I $D(^ATXAX(B,21,"B",%)) Q 1
 Q ""
 ;
HYSTER(P,EDATE) ;EP 
 I '$G(P) Q ""
 NEW BUDG,VIEN,VDATE,CTR,X,Y,Z,T,BUDVS,TIEN
 ;
 S T="HYSTERECTOMY",T=$O(^BWPN("B",T,0))
 I T D  I X]"" Q 1
 .S X=$$WH^BUDHDU(P,$$DOB^AUPNPAT(P),EDATE,T,2)
 D ALLV^APCLAPIU(P,$$DOB^AUPNPAT(P),EDATE,"BUDVS")  ;all visits in 42 days to end
 S TIEN=$O(^BUDHTSSC("B","T6B PAP HYSTERECTOMY CODES",0))
 S CTR=0,G="" F  S CTR=$O(BUDVS(CTR)) Q:CTR'=+CTR!(G)  D
 .S VIEN=$P(BUDVS(CTR),U,5)
 .S VDATE=$P(BUDVS(CTR),U,1)
 .;CPT
 .S X=0 F  S X=$O(^AUPNVCPT("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVCPT(X,0))
 ..S Y=$$VAL^XBDIQ1(9000010.18,X,.01)
 ..Q:Y=""
 ..I $D(^BUDHTSSC("AC",Y,TIEN)) S G=1 Q
 .;V TRANS
 .S X=0 F  S X=$O(^AUPNVTC("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVTC(X,0))
 ..S Y=$$VAL^XBDIQ1(9000010.33,X,.07)
 ..Q:Y=""
 ..I $D(^BUDHTSSC("AC",Y,TIEN)) S G=1 Q
 .;V PROC
 .S X=0 F  S X=$O(^AUPNVPRC("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVPRC(X,0))
 ..S Y=$$VALI^XBDIQ1(9000010.08,X,.01)
 ..I $D(^BUDHTSSC("AP",Y,TIEN)) S G=1 Q
 .;SNOMED/DX
 .S X=0 F  S X=$O(^AUPNVPOV("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVPOV(X,0))
 ..S Y=$$VALI^XBDIQ1(9000010.07,X,.01)
 ..I $D(^BUDHTSSC("AD",Y,TIEN)) S G=1 Q
 ..S Y=$$VAL^XBDIQ1(9000010.07,X,1101)
 ..Q:Y=""
 ..I $D(^BUDHTSSC("AS",Y,TIEN)) S G=1 Q
 I G Q 1
 S X=$$PLCL^BUDHDU(P,"T6B PAP HYSTERECTOMY CODES",EDATE,0) I X Q 1
 Q ""
MMR(P,BDATE,EDATE) ;EP
MMRC ;
 NEW BUDG,%,E,T,X,G,Y,Z,S,N,BUDZ,BUDX,BUDMR,BUDMU,BUDMEA,BUDRUB,BUDVS,TIEN,TIENMR,TIENMU,TIENMEA,TIENRUB,CTR,VIEN,VDATE
 NEW BUDHVRUB,BUDHVMU,BUDHVMEA,BUDCORUB,BUDCOMU,BUDCOMEA,BUDZ
MMR1 ;
 ;IS THERE AN MMR CONTRAINDICATION?
 ;FIRST CHECK ALL VACCINES
 S X=$$CONTRA^BUDHRP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDHTSSC("B","T6B IMM MMR CODES",0)),"MMR")
 I X Q X
 ;NOW CHECK IMM PKG FOR
 F BUDZ=3,94,5,7,6,4 S X=$$MMRCONT^BUDHRP6C(P,BUDZ,EDATE) Q:X]""
 I X]"" Q "1^MMR CONTRA: "_$P(X,U,2)_" on "_$$DATE^BUDHUTL1($P(X,U,1))_" Immunization Package"
 ;
 ;CONTRA IN ALLERGY TRACKING
 S G=""
 S X=0 F  S X=$O(^GMR(120.8,"B",P,X)) Q:X'=+X!(G)  D
 .S N=$P($G(^GMR(120.8,X,0)),U,2),N=$$UP^XLFSTR(N)
 .Q:'$$ANAREACT^BUDHRP6C(X)
 .I N["NEOMYCIN" S G="1^MMR: CONTRA "_$$DATE^BUDHUTL1($P($P($G(^GMR(120.8,X,0)),U,4),"."))_"  Allergy Tracking: "_N
 I G]"" Q G
 ;
 ;SNOMED ANALPHALACTIC V POV OR PROBLEM LIST?
 S T=$O(^BUDHTSSC("B","T6B IMM CONTRA VARICELLA/MMR",0))
 S (X,Y,I)=0
 F  S X=$O(^AUPNPROB("AC",P,X)) Q:X'=+X!(I)  D
 .Q:'$D(^AUPNPROB(X,0))
 .Q:$P(^AUPNPROB(X,0),U,12)="D"
 .I $P(^AUPNPROB(X,0),U,13),$P(^AUPNPROB(X,0),U,13)>EDATE Q
 .I $P(^AUPNPROB(X,0),U,13)="",$P(^AUPNPROB(X,0),U,8)>EDATE Q  ;entered after report period, skip
 .S S=$$VAL^XBDIQ1(9000011,X,80001)
 .I S]"",$D(^BUDHTSSC("AS",S,T)) S I="1^MMR: CONTRA PL "_S Q
 .Q
 I I Q I
 ;NOW V POV SNOMED
 S G="",I=""
 S S="" F  S S=$O(^AUPNVPOV("ASNC",P,S)) Q:S=""!(G)  D
 .S I=0
 .I $D(^BUDHTSSC("AS",S,T)) S I="1^MMR: CONTRA POV "_S
 .Q:'I
 .S D=0 F  S D=$O(^AUPNVPOV("ASNC",P,S,D)) Q:D=""!(G)  D
 ..S Y=9999999-D
 ..Q:Y>EDATE
 ..S G=I_"^"_$$DATE^BUDHUTL1(Y)
 I G Q G
 ;CONTRAINDICATION TO MMR - FROM IPC LOGIC
 S X=$$DIS^BUDHUTL3(P,EDATE) I X Q 1_U_"MMR: CONTRA DIS IMMUNE SYS"
 S X=$$HIV^BUDHUTL3(P,EDATE) I X Q 1_U_"MMR: CONTRA HIV"
 S X=$$MNLHT^BUDHUTL3(P,EDATE) I X Q 1_U_"MMR: CONTRA NEOPLASM"
MMRV ;NOW DO THEY HAVE AN MMR?
 S (BUDHVRUB,BUDHVMU,BUDHVMEA,BUDCORUB,BUDCOMU,BUDCOMEA)=""
 ;now check contra to MMR
 S (BUDX,BUDMR,BUDMU,BUDMEA,BUDRUB)=""
 D ALLV^APCLAPIU(P,BDATE,EDATE,"BUDVS")
 S TIEN=$O(^BUDHTSSC("B","T6B IMM MMR CODES",0))
 S TIENMR=$O(^BUDHTSSC("B","T6B IMM MR CODES",0))
 S TIENMU=$O(^BUDHTSSC("B","T6B IMM MUMPS CODES",0))
 S TIENMEA=$O(^BUDHTSSC("B","T6B IMM MEASLES CODES",0))
 S TIENRUB=$O(^BUDHTSSC("B","T6B IMM RUBELLA CODES",0))
 S CTR=0 F  S CTR=$O(BUDVS(CTR)) Q:CTR'=+CTR  D
 .S VIEN=$P(BUDVS(CTR),U,5)
 .S VDATE=$P(BUDVS(CTR),U,1)
 .S X=0 F  S X=$O(^AUPNVIMM("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVIMM(X,0))
 ..S Y=$$VALI^XBDIQ1(9000010.11,X,.01)
 ..S Y=+$P($G(^AUTTIMM(Y,0)),U,3)
 ..Q:'Y
 ..I $D(^BUDHTSSC(TIEN,15,"B",Y)) S BUDX="CVX "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC(TIENMR,15,"B",Y)) S BUDMR="CVX "_Y_" on "_$$DATE^BUDHUTL1,BUDADT="CVX "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC(TIENMU,15,"B",Y)) S BUDMU="CVX "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC(TIENMEA,15,"B",Y)) S BUDMEA="CVX "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC(TIENRUB,15,"B",Y)) S BUDRUB="CVX "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 .;CPT
 .S X=0 F  S X=$O(^AUPNVCPT("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVCPT(X,0))
 ..S Y=$$VAL^XBDIQ1(9000010.18,X,.01)
 ..Q:Y=""
 ..I $D(^BUDHTSSC("AC",Y,TIEN)) S BUDX="CPT "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AC",Y,TIENMR)) S BUDMR="CPT "_Y_" on "_$$DATE^BUDHUTL1
 ..I $D(^BUDHTSSC("AC",Y,TIENMU)) S BUDMU="CPT "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AC",Y,TIENMEA)) S BUDMEA="CPT "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AC",Y,TIENRUB)) S BUDRUB="CPT "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 .;V TRANS
 .S X=0 F  S X=$O(^AUPNVTC("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVTC(X,0))
 ..S Y=$$VAL^XBDIQ1(9000010.33,X,.07)
 ..Q:Y=""
 ..I $D(^BUDHTSSC("AC",Y,TIEN)) S BUDX="CPT/TRAN "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AC",Y,TIENMR)) S BUDMR="CPT/TRAN "_Y_" on "_$$DATE^BUDHUTL1
 ..I $D(^BUDHTSSC("AC",Y,TIENMU)) S BUDMU="CPT/TRAN "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AC",Y,TIENMEA)) S BUDMEA="CPT/TRAN "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AC",Y,TIENRUB)) S BUDRUB="CPT/TRAN "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 .;V PROC
 .S X=0 F  S X=$O(^AUPNVPRC("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVPRC(X,0))
 ..S Y=$$VALI^XBDIQ1(9000010.08,X,.01)
 ..I $D(^BUDHTSSC("AP",Y,TIEN)) S BUDX="PROC "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AP",Y,TIENMR)) S BUDMR="PROC "_Y_" on "_$$DATE^BUDHUTL1
 ..I $D(^BUDHTSSC("AP",Y,TIENMU)) S BUDMU="PROC "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AP",Y,TIENMEA)) S BUDMEA="PROC "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AP",Y,TIENRUB)) S BUDRUB="PROC "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 .S X=0 F  S X=$O(^AUPNVPOV("AD",VIEN,X)) Q:X'=+X  D
 ..Q:'$D(^AUPNVPOV(X,0))
 ..S Y=$$VAL^XBDIQ1(9000010.07,X,1101)
 ..Q:Y=""
 ..I $D(^BUDHTSSC("AS",Y,TIEN)) S BUDX="SNOMED "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AS",Y,TIENMR)) S BUDMR="SNOMED "_Y_" on "_$$DATE^BUDHUTL1
 ..I $D(^BUDHTSSC("AS",Y,TIENMU)) S BUDMU="SNOMED "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AS",Y,TIENMEA)) S BUDMEA="SNOMED "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 ..I $D(^BUDHTSSC("AS",Y,TIENRUB)) S BUDRUB="SNOMED "_Y_" on "_$$DATE^BUDHUTL1(VDATE) Q
 I BUDX]"" Q "1^MMR: "_BUDX
MR1 ;
 S (X,Y)="",C=0 F  S X=$O(BUDMR(X)) Q:X'=+X  S BUDMU(X)="",BUDRUB(X)=""
 ;HAS ONE OF EACH
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
 ;
MEAEVCO ;
 I BUDMEA]"" G MUEVCO
 ;V10.0 ICD10
 K BUDG S %=P_"^ALL DX;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S T=$O(^BUDHTSSC("B","T6B IMM EVIDENCE MEASLES",0))
 S X=0,BUDHVMEA="" F  S X=$O(BUDG(X)) Q:X'=+X!(BUDHVMEA]"")  D
 .S Y=+$P(BUDG(X),U,4)
 .S Z=$P($G(^AUPNVPOV(Y,0)),U,1)
 .I $D(^BUDHTSSC("AD",Z,T)) S BUDHVMEA="1^Measles: Evidence "_$P(BUDG(X),U,2)_" on "_$$DATE^BUDHUTL1($P(BUDG(X),U)) Q
 .S S=$$VAL^XBDIQ1(9000010.07,Y,1101) I S]"",$D(^BUDHTSSC("AS",S,T)) S BUDHVMEA="1^Measles: Evidence "_S_" on "_$$DATE^BUDHUTL1($P(BUDG(X),U)) Q
 S X=$$PLCL^BUDHDU(P,"T6B IMM EVIDENCE MEASLES",EDATE,0) I X S BUDMEA="1^Measles Evidence: "_$P(X,U,2)_" on Problem List"
 I BUDHVMEA]"" S BUDMEA=BUDHVMEA
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
 ;CONTRA
 S BUDCOMEA=$$CONTRA^BUDHRP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDHTSSC("B","T6B IMM MEASLES CODES",0)),"MEASLES")
 I BUDCOMEA]"" S BUDMEA=BUDCOMEA
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
 ;
MUEVCO ;
 I BUDMU]"" G RUBEVCO
 K BUDG S %=P_"^ALL DX;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S T=$O(^BUDHTSSC("B","T6B IMM EVIDENCE MUMPS",0))
 S X=0,BUDHVMU="" F  S X=$O(BUDG(X)) Q:X'=+X!(BUDHVMU]"")  D
 .S Y=+$P(BUDG(X),U,4)
 .S Z=$P($G(^AUPNVPOV(Y,0)),U,1)
 .I $D(^BUDHTSSC("AD",Z,T)) S BUDHVMU="1^Mumps: Evidence "_$P(BUDG(X),U,2)_" on "_$$DATE^BUDHUTL1($P(BUDG(X),U)) Q
 .S S=$$VAL^XBDIQ1(9000010.07,Y,1101) I S]"",$D(^BUDHTSSC("AS",S,T)) S BUDHVMU="1^Mumps: Evidence "_S_" on "_$$DATE^BUDHUTL1($P(BUDG(X),U)) Q
 S X=$$PLCL^BUDHDU(P,"T6B IMM EVIDENCE MUMPS",EDATE,0) I X S BUDHVMU="1^Mumps: Evidence "_$P(X,U,2)_" on Problem List"
 I BUDHVMU]"" S BUDMU=BUDHVMU
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
 ;CONTRA
 S BUDCOMU=$$CONTRA^BUDHRP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDHTSSC("B","T6B IMM MUMPS CODES",0)),"MUMPS")
 I BUDCOMU]"" S BUDMU=BUDCOMU
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
RUBEVCO ;
 I BUDRUB]"" G MMRQ
 K BUDG S %=P_"^ALL DX;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S T=$O(^BUDHTSSC("B","T6B IMM EVIDENCE RUBELLA",0))
 S X=0,BUDHVRUB="" F  S X=$O(BUDG(X)) Q:X'=+X!(BUDHVRUB]"")  D
 .S Y=+$P(BUDG(X),U,4)
 .S Z=$P($G(^AUPNVPOV(Y,0)),U,1)
 .I $D(^BUDHTSSC("AD",Z,T)) S BUDHVRUB="1^Rubella: Evidence "_$P(BUDG(X),U,2)_" on "_$$DATE^BUDHUTL1($P(BUDG(X),U)) Q
 .S S=$$VAL^XBDIQ1(9000010.07,Y,1101) I S]"",$D(^BUDHTSSC("AS",S,T)) S BUDHVRUB="1^Rubella: Evidence "_S_" on "_$$DATE^BUDHUTL1($P(BUDG(X),U)) Q
 S X=$$PLCL^BUDHDU(P,"T6B IMM EVIDENCE RUBELLA",EDATE,0) I X S BUDHVRUB="1^Rubella: Evidence: "_$P(X,U,2)_" on Problem List"
 I BUDHVRUB]"" S BUDRUB=BUDHVRUB
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
 ;CONTRA
 S BUDCORUB=$$CONTRA^BUDHRP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDHTSSC("B","T6B IMM RUBELLA CODES",0)),"RUBELLA")
 I BUDCORUB]"" S BUDRUB=BUDCORUB
 I BUDMEA]"",BUDMU]"",BUDRUB]"" Q "1^MMR: "_BUDMEA_";"_BUDMU_";"_BUDRUB
MMRQ ;
 I BUDMEA="",BUDMU="",BUDRUB="" Q "0^1 MEASLES MUMPS RUBBELLA"
 Q "0^"_$S(BUDMEA="":" 1 MEASLES",1:"")_$S(BUDMU="":" 1 MUMPS",1:"")_$S(BUDRUB="":" 1 RUBELLA",1:"")