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

BUDERP6X.m

Go to the documentation of this file.
BUDERP6X ; IHS/CMI/LAB - measure C ;
 ;;12.0;IHS/RPMS UNIFORM DATA SYSTEM;;NOV 22, 2017;Build 75
 ;
CNTDTAP ;
 NEW X,Y,C
 S (X,Y)="",C=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDDTAP(X) Q
 .S Y=X
 ;now count
 S BUDDTAP=0,X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S BUDDTAP=BUDDTAP+1
 Q
RESETD ;RESET DUPES
 NEW X,Y,C
 S (X,Y)="",C=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDDT(X) Q
 .S Y=X
 S (X,Y)="",C=0 F  S X=$O(BUDDIP(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDDIP(X) Q
 .S Y=X
 S (X,Y)="",C=0 F  S X=$O(BUDTET(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDTET(X) Q
 .S Y=X
 S (X,Y)="",C=0 F  S X=$O(BUDTD(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDTD(X) Q
 .S Y=X
 S (X,Y)="",C=0 F  S X=$O(BUDPER(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDPER(X) Q
 .S Y=X
 S BUDDT=0,X=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S BUDDT=BUDDT+1
 S BUDTD=0,X=0 F  S X=$O(BUDTD(X)) Q:X'=+X  S BUDTD=BUDTD+1
 S BUDDIP=0,X=0 F  S X=$O(BUDDIP(X)) Q:X'=+X  S BUDDIP=BUDDIP+1
 S BUDTET=0,X=0 F  S X=$O(BUDTET(X)) Q:X'=+X  S BUDTET=BUDTET+1
 S BUDPER=0,X=0 F  S X=$O(BUDPER(X)) Q:X'=+X  S BUDPER=BUDPER+1
 Q
DTAP(P,BDATE,EDATE) ;EP
 NEW BUDTET,BUDVS,TIEN,TIENDT,TIENTET,TIENDIP,TIENPER,CTR,VIEN,VDATE,X,Y,BUDX,BUDDT,BUDADT,BUDDIP,BUDPER,BUDDTAP,BUDPEREV,BUDEVTD,BUDEVIP,BUDCOTET,BUDCOPER,BUDCODIP,C,BUDG,BUDA,Z,G,A
 ;
DTAPIM ;
 S BUDTET=0
 D ALLV^APCLAPIU(P,BDATE,EDATE,"BUDVS")  ;all visits in 42 days to end
 S TIEN=$O(^BUDETSSC("B","T6B IMM DTAP CODES",0))
 S TIENDT=$O(^BUDETSSC("B","T6B IMM DT CODES",0))
 S TIENTET=$O(^BUDETSSC("B","T6B IMM TETANUS CODES",0))
 S TIENDIP=$O(^BUDETSSC("B","T6B IMM DIPHTHERIA CODES",0))
 S TIENPER=$O(^BUDETSSC("B","T6B IMM PERTUSSIS 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(^BUDETSSC(TIEN,15,"B",Y)) S BUDX(VDATE)="CVX "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC(TIENDT,15,"B",Y)) S BUDDT(VDATE)="CVX "_Y_" on "_$$DATE^BUDEUTL1(VDATE),BUDADT(VDATE)="CVX "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC(TIENTET,15,"B",Y)) S BUDTET(VDATE)="CVX "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC(TIENDIP,15,"B",Y)) S BUDDIP(VDATE)="CVX "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC(TIENPER,15,"B",Y)) S BUDPER(VDATE)="CVX "_Y_" on "_$$DATE^BUDEUTL1(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(^BUDETSSC("AC",Y,TIEN)) S BUDX(VDATE)="CPT "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENDT)) S BUDDT(VDATE)="CPT "_Y_" on "_$$DATE^BUDEUTL1(VDATE),BUDADT(VDATE)="CPT "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENTET)) S BUDTET(VDATE)="CPT "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENDIP)) S BUDDIP(VDATE)="CPT "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENPER)) S BUDPER(VDATE)="CPT "_Y_" on "_$$DATE^BUDEUTL1(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(^BUDETSSC("AC",Y,TIEN)) S BUDX(VDATE)="CPT/TRAN "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENDT)) S BUDDT(VDATE)="CPT/TRAN "_Y_" on "_$$DATE^BUDEUTL1(VDATE),BUDADT(VDATE)="CPT/TRAN "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENTET)) S BUDTET(VDATE)="CPT/TRAN "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENDIP)) S BUDDIP(VDATE)="CPT/TRAN "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AC",Y,TIENPER)) S BUDPER(VDATE)="CPT/TRAN "_Y_" on "_$$DATE^BUDEUTL1(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(^BUDETSSC("AP",Y,TIEN)) S BUDX(VDATE)="PROC "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AP",Y,TIENDT)) S BUDDT(VDATE)="PROC "_Y_" on "_$$DATE^BUDEUTL1(VDATE),BUDADT(VDATE)="PROC "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AP",Y,TIENTET)) S BUDTET(VDATE)="PROC "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AP",Y,TIENDIP)) S BUDDIP(VDATE)="PROC "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AP",Y,TIENPER)) S BUDPER(VDATE)="PROC "_Y_" on "_$$DATE^BUDEUTL1(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(^BUDETSSC("AS",Y,TIEN)) S BUDX(VDATE)="SNOMED "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AS",Y,TIENDT)) S BUDDT(VDATE)="SNOMED "_Y_" on "_$$DATE^BUDEUTL1(VDATE),BUDADT(VDATE)="SNOMED "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AS",Y,TIENTET)) S BUDTET(VDATE)="SNOMED "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AS",Y,TIENDIP)) S BUDDIP(VDATE)="SNOMED "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ..I $D(^BUDETSSC("AS",Y,TIENPER)) S BUDPER(VDATE)="SNOMED "_Y_" on "_$$DATE^BUDEUTL1(VDATE) Q
 ;go through and set into DTAP if 10 days apart
 S X=0 F  S X=$O(BUDX(X)) Q:X'=+X  S BUDDTAP(X)=BUDX(X)
 D CNTDTAP  ;count to see if there are 4
 I BUDDTAP>3 S Y="1^DTap: total #: "_BUDDTAP,X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S Y=Y_"  "_BUDDTAP(X)
 I BUDDTAP>3 Q Y
 S (BUDPEREV,BUDEVTD,BUDEVDIP,BUDCOTET,BUDCOPER,BUDCODIP)=""
 ;now check contra to DTap
 S Y=$$CONTDTAP(P,$$DOB^AUPNPAT(P),EDATE)
 I Y Q Y
DT1 ;
 ;kill off any that are on the same day as the dtaps
 S (X,Y)="",C=0 F  S X=$O(BUDDT(X)) Q:X'=+X  I $D(BUDDTAP(X)) K BUDDT(X)
 S (X,Y)="",C=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDDT(X) Q
 .S Y=X
 K BUDALL
 S BUDDT=0,X=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S BUDDT=BUDDT+1,BUDALL(X)=BUDDT(X)
 S BUDDTAP=0,X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S BUDDTAP=BUDDTAP+1,BUDALL(X)=BUDDTAP(X)
 S (X,Y)="",C=0 F  S X=$O(BUDALL(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDALL(X) Q
 .S Y=X
 S BUDALL=0 S X=0 F  S X=$O(BUDALL(X)) Q:X'=+X  S BUDALL=BUDALL+1
 I BUDALL>3 D  Q "1^"_Y
 .S Y=">=1 DTap & DT/TdS",X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S Y=Y_" "_BUDDTAP(X)
 .S X=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S Y=Y_" "_BUDDT(X)
 ;
TETCVX ;
 S BUDTET=0
 ;EVIDENCE?
 S BUDEVTD=""
 K BUDG S %=P_"^LAST DX 037.;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 I $D(BUDG(1)) S BUDEVTD="1^Tetanus Evidence: "_$P(BUDG(1),U,2)_" on "_$$DATE^BUDEUTL1($P(BUDG(1),U))
 K BUDG S %=P_"^LAST DX A35.;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 I $D(BUDG(1)) S BUDEVTD="1^Tetanus Evidence: "_$P(BUDG(1),U,2)_" on "_$$DATE^BUDEUTL1($P(BUDG(1),U))
 I $$PLCODE^BUDEDU(P,"037.",EDATE) S BUDEVTD="1^Tetanus Evidence: 037. on Problem List"
 I $$PLCODE^BUDEDU(P,"A35.",EDATE) S BUDEVTD="1^Tetanus Evidence: A35. on Problem List"
 S X=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S BUDTET(X)=BUDDT(X)
 S X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S BUDTET(X)=BUDDTAP(X)
 S (X,Y)="",C=0 F  S X=$O(BUDTET(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDTET(X) Q
 .S Y=X
 S X=0 F  S X=$O(BUDTET(X)) Q:X'=+X  S BUDTET=BUDTET+1
DIP ;
 S BUDEVDIP=""
 ;V10.0 ICD10
 K BUDG S %=P_"^ALL DX;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S T=$O(^BUDETSSC("B","T6B IMM EVIDENCE DIPHTHERIA",0))
 S X=0,BUDEVDIP="" F  S X=$O(BUDG(X)) Q:X'=+X!(BUDEVDIP]"")  D
 .S Y=+$P(BUDG(X),U,4)
 .S Y=$P($G(^AUPNVPOV(Y,0)),U,1)
 .I $D(^BUDETSSC("AD",Y,T)) S BUDEVDIP="1^Diphtheria Evidence "_$P(BUDG(X),U,2)_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 S X=$$PLCL^BUDEDU(P,"T6B IMM EVIDENCE DIPHTHERIA",EDATE,0) I X S BUDEVDIP="1^Diphtheria Evidence: "_$P(X,U,2)_" on Problem List"
 S X=0 F  S X=$O(BUDDT(X)) Q:X'=+X  S BUDDIP(X)=BUDDT(X)
 S X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S BUDDIP(X)=BUDDTAP(X)
 S (X,Y)="",C=0 F  S X=$O(BUDDIP(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDDIP(X) Q
 .S Y=X
 S X=0,BUDDIP=0 F  S X=$O(BUDDIP(X)) Q:X'=+X  S BUDDIP=BUDDIP+1
 ;
PER ;
 S BUDPEREV=""
 ;V10.0 ICD10
 K BUDG S %=P_"^ALL DX;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S T=$O(^BUDETSSC("B","T6B IMM EVIDENCE PERTUSSIS",0))
 S X=0,BUDPEREV="" F  S X=$O(BUDG(X)) Q:X'=+X!(BUDPEREV]"")  D
 .S Y=+$P(BUDG(X),U,4)
 .S Y=$P($G(^AUPNVPOV(Y,0)),U,1)
 .I $D(^BUDETSSC("AD",Y,T)) S BUDPEREV="1^Pertussis: Evidence "_$P(BUDG(X),U,2)_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 S X=$$PLCL^BUDEDU(P,"T6B IMM EVIDENCE PERTUSSIS",EDATE,0) I X S BUDPEREV="1^Pertussis: Evidence "_$P(X,U,2)_" on Problem List"
 S X=0 F  S X=$O(BUDDTAP(X)) Q:X'=+X  S BUDPER(X)=BUDDTAP(X)
 S (X,Y)="",C=0 F  S X=$O(BUDPER(X)) Q:X'=+X  S C=C+1 D
 .I C=1 S Y=X Q
 .I $$FMDIFF^XLFDT(X,Y)<11 K BUDPER(X) Q
 .S Y=X
 S X=0,BUDPER=0 F  S X=$O(BUDPER(X)) Q:X'=+X  S BUDPER=BUDPER+1
 I BUDPER<4,'BUDPEREV S BUDCOPER=$$CONTRA^BUDERP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDETSSC("B","T6B IMM PERTUSSIS CODES",0)),"PERTUSSIS")
 I BUDDIP<4,'BUDEVDIP S BUDCODEP=$$CONTRA^BUDERP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDETSSC("B","T6B IMM DIPHTHERIA CODES",0)),"DIPHTHERIA")
 I BUDTET<4,'BUDEVTD S BUDCOTET=$$CONTRA^BUDERP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDETSSC("B","T6B IMM TETANUS CODES",0)),"TETANUS")
CHK ;4 of each or evidence
 S BUDA(1)=$P(BUDEVDIP,U)_U_"DIP: Evidence"_U_$P(BUDEVDIP,U,2)
 S X=0,Y="" F  S X=$O(BUDDIP(X)) Q:X'=+X  S Y=Y_" "_BUDDIP(X)
 S BUDA(2)=$S(BUDDIP>3:1,1:0)_U_"DIP: total #: 4"_U_Y
 S BUDA(3)=$P(BUDCODIP,U)_U_"DIP: CONTRA"_U_$P(BUDCODIP,U,2)
 ;
 S BUDA(4)=$P(BUDEVTD,U)_U_"Tetanus: Evidence"_U_$P(BUDEVTD,U,2)
 S X=0,Y="" F  S X=$O(BUDETT(X)) Q:X'=+X  S Y=Y_" "_BUDTET(X)
 S BUDA(5)=$S(BUDTET>3:1,1:0)_U_"Tetanus: total #: 4"_U_Y
 S BUDA(6)=$P(BUDCOTET,U)_U_"Tetanus: CONTRA"_U_$P(BUDCOTET,U,2)
 ;
 S BUDA(7)=$P(BUDPEREV,U)_U_"Perussis: Evidence"_U_$P(BUDPEREV,U,2)
 S X=0,Y="" F  S X=$O(BUDPER(X)) Q:X'=+X  S Y=Y_" "_BUDPER(X)
 S BUDA(8)=$S(BUDPER>3:1,1:0)_U_"Pertussis: total #: 4"_U_Y
 S BUDA(9)=$P(BUDCOPER,U)_U_"Pertussis: CONTRA"_U_$P(BUDCOPER,U,2)
 ;
 S G=""
 F X=1,2,3 D  Q:G]""
 .F Y=4,5,6 D  Q:G]""
 ..F Z=7,8,9 D  Q:G]""
 ...I $P(BUDA(X),U,1),$P(BUDA(Y),U,1),$P(BUDA(Z),U,1) D
 ....S G=1_U_$P(BUDA(X),U,2)_", "_$P(BUDA(Y),U,2)_", "_$P(BUDA(Z),U,2)
 ....S A="",A=$P(BUDA(X),U,3)_", "_$P(BUDA(Y),U,3)_", "_$P(BUDA(Z),U,3)
 ....S G=G_"  "_A
 I G]"" Q G
 S Y="0^"
 I BUDDIP<4,'BUDEVDIP S Y=Y_(4-BUDDIP)_" DIP "
 I BUDTET<4,'BUDEVTD S Y=Y_(4-BUDTET)_" TET "
 I BUDPER<4,'BUDPEREV S Y=Y_(4-BUDPER)_" PER"
 Q Y
CONTDTAP(P,BDATE,EDATE) ;
 NEW BUDG,X,G,Z,E,%,T,S,BUDZ
 ;first check for contraindication
 K BUDG S %=P_"^ALL DX 323.5;DURING "_$$DOB^AUPNPAT(P)_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 I '$D(BUDG(1)) G N
 S X=0,G="" F  S X=$O(BUDG(X)) Q:X'=+X!(G]"")  S Y=+$P(BUDG(X),U,4) D
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.09) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.18) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.19) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 I G]"" Q G
N K BUDG S %=P_"^ALL DX 323.51;DURING "_$$DOB^AUPNPAT(P)_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 I '$D(BUDG(1)) G N1
 S X=0,G="" F  S X=$O(BUDG(X)) Q:X'=+X!(G]"")  S Y=+$P(BUDG(X),U,4) D
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.09) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.18) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.19) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 I G]"" Q G
N1 K BUDG S %=P_"^ALL DX 323.52;DURING "_$$DOB^AUPNPAT(P)_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S X=0,G="" F  S X=$O(BUDG(X)) Q:X'=+X!(G]"")  S Y=+$P(BUDG(X),U,4) D
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.09) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.18) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 .S Z=$$VAL^XBDIQ1(9000010.07,Y,.19) I Z="E948.4"!(Z="E948.5")!(Z="E948.6") S G="1^DTAP: CONTRA DX/Ecode: "_$P(BUDG(X),U,2)_"/"_Z_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U))
 I G]"" Q G
N2 ;V10.0 ICD10
 K BUDG S %=P_"^ALL DX;DURING "_$$DOB^AUPNPAT(P)_"-"_EDATE,E=$$START1^APCLDF(%,"BUDG(")
 S T=$O(^BUDETSSC("B","T6B IMM CONTRA DTAP/DTP",0))
 S X=0,G="" F  S X=$O(BUDG(X)) Q:X'=+X!(G]"")  D
 .S Y=+$P(BUDG(X),U,4)
 .S Z=$P($G(^AUPNVPOV(Y,0)),U,1)
 .I $D(^BUDETSSC("AD",Z,T)) S G="1^DTAP: CONTRA DX "_$P(BUDG(X),U,2)_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U)) Q
 .S S=$$VALI^XBDIQ1(9000010.07,Y,1101)
 .I S]"",$D(^BUDETSSC(T,13,"B",S)) S G="1^DTAP: CONTRA DX/SNOMED "_S_" on "_$$DATE^BUDEUTL1($P(BUDG(X),U)) Q
 K BUDG
 I G]"" Q G
 S BUDZ=0,X=""
 F  S BUDZ=$O(^BUDETSSC(T,15,"B",BUDZ)) Q:BUDZ=""!(X]"")  S X=$$ANCONT^BUDERP6C(P,BUDZ,EDATE)
 I X]"" Q "1^DTAP: CONTRA IMM package: "_$$DATE^BUDEUTL1($P(X,U))_" "_$P(X,U,2)
 S X=$$CONTRA^BUDERP6C(P,$$DOB^AUPNPAT(P),EDATE,$O(^BUDETSSC("B","T6B IMM CONTRA DTAP/DTP",0)),"DTAP")
 I X Q X
 S X=$$PLCL^BUDEDU(P,"T6B IMM CONTRA DTAP/DTP",EDATE,0) I X Q "1^DTAP: CONTRA "_$P(X,U,2)_" on Problem List"
 Q ""