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

APCLD716.m

Go to the documentation of this file.
  1. APCLD716 ; IHS/CMI/LAB - 2007 DIABETES AUDIT ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;
  1. ;cmi/anch/maw 9/12/2007 code set versioning in TOBACCO1,ASAPOV
  1. ;
  1. TBCODE(P,EDATE,R) ;EP
  1. NEW APCLJ,APCLI,X,APCLR
  1. S APCLJ=""
  1. ;return computed TB Status Code
  1. S X=$$TBTX^APCLD712(P)
  1. I X]"",X["TX COMPLETE" Q 1
  1. I X]"" Q 2
  1. S APCLR=$$PPD^APCLD718(P,EDATE)
  1. I APCLR["POS" D Q APCLJ
  1. .I $$TBTX^APCLD712(P)["TX COMPLETE" S APCLJ=1 Q
  1. .S APCLJ=2
  1. .Q
  1. I APCLR["NEG" S APCLJ=4 D Q APCLJ
  1. .I $$DODX(P,R,"I")="" S APCLJ=6 Q
  1. .S D=$$DODX(P,R,"I"),E=$$PPD^APCLD718(P,EDATE,"I") S APCLJ=$S(D>E:4,1:3)
  1. .Q
  1. I APCLR["Unknown" S APCLJ=5
  1. I APCLR["Refus" S APCLJ=7
  1. Q APCLJ
  1. ;;
  1. 1 ;;PPD +, treatment complete
  1. 2 ;;PPD +, not treated/treatment incomplete or unknown treatment
  1. 3 ;;PPD -, placed on or after date of DM dx
  1. 4 ;;PPD -, placed before date of DM dx
  1. 5 ;;PPD Status unknown
  1. 6 ;;PPD -, date of DX or PPD date unknown
  1. 7 ;;PPD Refused
  1. BI() ;
  1. Q $S($O(^AUTTIMM(0))>100:1,1:0)
  1. SYSMEAN(P,BDATE,EDATE) ;EP
  1. NEW X S X=$$BPS^APCLD713(P,BDATE,EDATE,"I")
  1. I X="" Q ""
  1. NEW Y,C S C=0 F Y=1:1:3 I $P(X,";",Y)]"" S C=C+1
  1. I C'=3 Q ""
  1. S C=0 F Y=1:1:3 S C=$P($P(X,";",Y),"/")+C
  1. Q C\3
  1. Q ""
  1. DIAMEAN(P,BDATE,EDATE) ;EP
  1. NEW X S X=$$BPS^APCLD713(P,BDATE,EDATE,"I")
  1. I X="" Q ""
  1. NEW Y,C S C=0 F Y=1:1:3 I $P(X,";",Y)]"" S C=C+1
  1. I C'=3 Q ""
  1. S C=0 F Y=1:1:3 S C=$P($P(X,";",Y),"/",2)+C
  1. Q C\3
  1. PPDDATE(P,EDATE) ;EP
  1. NEW X S X=$$LASTNP^APCLD718(P,EDATE)
  1. Q X
  1. LIPID(P,BDATE,EDATE) ;EP
  1. NEW X,APCL,E,G,S,O
  1. S (S,O,G)="",X=P_"^MEDS [DM AUDIT LIPID LOWERING DRUGS"_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(")
  1. I $D(APCL(1)) S O=1
  1. K APCL
  1. S X=P_"^MEDS [DM AUDIT STATIN DRUGS"_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(")
  1. I $D(APCL(1)) S S=1
  1. I S,O Q "Both"
  1. I S Q "Statin"
  1. I O Q "Other"
  1. ;refusal
  1. S G=0
  1. NEW T S T=$O(^ATXAX("B","DM AUDIT LIPID LOWERING DRUGS",0))
  1. I 'T Q "None"
  1. S X=0 F S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G) S G=$$REFUSAL^APCLD717(P,50,$P(^ATXAX(T,21,X,0),U),BDATE,EDATE)
  1. I G Q "Refused or Adverse Rxn"
  1. NEW T S T=$O(^ATXAX("B","DM AUDIT STATIN DRUGS",0))
  1. I 'T G LIPIDA
  1. S (X,G)=0 F S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G) S G=$$REFUSAL^APCLD717(P,50,$P(^ATXAX(T,21,X,0),U),BDATE,EDATE)
  1. I G Q "Refused or Adverse Rxn"
  1. LIPIDA ;
  1. ;check patient allergies file for any with va drug class CV350
  1. S X=EDATE,%DT="P" D ^%DT S B=Y
  1. S X=0,G="" F S X=$O(^GMR(120.8,"B",P,X)) Q:X'=+X D
  1. .Q:$P($P($G(^GMR(120.8,X,0)),U,4),".")>B ;entered after discharge date
  1. .S C=$O(^PS(50.605,"B","CV350",0))
  1. .S N=$P($G(^GMR(120.8,X,0)),U,2),N=$$UP^XLFSTR(N)
  1. .;I N["ASPIRIN" S APCLC=APCLC+1,APCLY(APCLC)="ALLERGY TRACKING: "_$$FMTE^XLFDT($P(^GMR(120.8,X,0),U,4))_" "_N
  1. .I C,$D(^GMR(120.8,X,3,"B",C)) S G="Refused/Adverse Rxn"
  1. .;S N=$P($G(^GMR(120.8,X,0)),U,2),N=$$UP^XLFSTR(N)
  1. .;I N["ASPIRIN" S APCLC=APCLC+1,APCLY(APCLC)="ALLERGY TRACKING: "_$$FMTE^XLFDT($P(^GMR(120.8,X,0),U,4))_" "_N
  1. I G]"" Q G
  1. Q "None"
  1. ;
  1. ;
  1. ACE(P,BDATE,EDATE) ;EP
  1. NEW X,APCL,E,X,Y,%DT,BD,G
  1. S X=P_"^MEDS [DM AUDIT ACE INHIBITORS"_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(")
  1. I $D(APCL(1)) Q "Yes"
  1. ;go through all v meds until 9999999-D and find all drugs with class CV800 or CV805
  1. NEW D,%DT K %DT S X=BDATE,%DT="P" D ^%DT S D=Y
  1. NEW V,I,%
  1. S %=""
  1. S I=0 F S I=$O(^AUPNVMED("AA",P,I)) Q:I'=+I!(%)!(I>(9999999-D)) D
  1. .S V=0 F S V=$O(^AUPNVMED("AA",P,I,V)) Q:V'=+V S G=$P(^AUPNVMED(V,0),U) I $P($G(^PSDRUG(G,0)),U,2)="CV800"!($P($G(^PSDRUG(G,0)),U,2)="CV805") S %=$P($P(^AUPNVSIT($P(^AUPNVMED(V,0),U,3),0),U),".")
  1. I %]"" Q "Yes"
  1. ;refusals
  1. NEW T S T=$O(^ATXAX("B","DM AUDIT ACE INHIBITORS",0))
  1. I 'T Q "No"
  1. S (G,X)=0 F S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G) S G=$$REFUSAL^APCLD717(P,50,$P(^ATXAX(T,21,X,0),U),BDATE,EDATE)
  1. I G,$P(G,U,2)'="N" Q "Refused"
  1. Q "No"_$S(G:" - Not Medically Indicated",1:"")
  1. ;
  1. SELF(P,BDATE,EDATE) ;EP
  1. NEW T,APCL,E,X,%DT,Y,ED,BD
  1. S X=EDATE,%DT="P" D ^%DT S ED=Y
  1. S X=BDATE,%DT="P" D ^%DT S BD=Y
  1. S E=$$LASTHF^APCLD719(P,"DIABETES SELF MONITORING",BD,ED,"F")
  1. I E]"" Q $S(E["YES":"Yes",E["NO":"No",E["REFUSED":"Refused",1:"")
  1. S X=P_"^MEDS [DM AUDIT SELF MONITOR DRUGS"_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(")
  1. I $D(APCL(1)) Q "Yes"
  1. Q "No"
  1. SDM(P,BDATE,EDATE) ;EP
  1. NEW T,APCL,E,X,%DT,Y,ED,BD
  1. S X=EDATE,%DT="P" D ^%DT S ED=Y
  1. S X=BDATE,%DT="P" D ^%DT S BD=Y
  1. S E=$$LASTHF^APCLD719(P,"STAGED DIABETES MANAGEMENT",BD,ED)
  1. I E Q "Yes"
  1. S T=$O(^ATXAX("B","DM AUDIT SDM PROVIDERS",0))
  1. I 'T Q ""
  1. S %=P_"^ALL DX [SURVEILLANCE DIABETES;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"APCL(")
  1. ;check to see if one of the providers was the primary prov
  1. NEW X,V,G,P,P1 S (G,X)=0 F S X=$O(APCL(X)) Q:X'=+X!(G) S V=$P(APCL(X),U,5) D
  1. .S P=0 F S P=$O(^AUPNVPRV("AD",V,P)) Q:P'=+P!(G) S P1=$P(^AUPNVPRV(P,0),U) I $D(^ATXAX(T,21,"B",P1)) S G=1
  1. .Q
  1. Q $S(G:"Yes",1:"No")
  1. ;
  1. ASPIRIN(P,BDATE,EDATE) ;EP
  1. NEW X,APCL,E,A,N,G
  1. S (A,B,G,N)=""
  1. S X=P_"^MEDS [DM AUDIT ASPIRIN DRUGS"_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(")
  1. I $D(APCL(1)) S A=1
  1. K APCL S X=P_"^MEDS [DM AUDIT ANTI-PLATELET DRUGS"_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(")
  1. I $D(APCL(1)) S N=1
  1. ;I A+N=2 Q "Both"
  1. I A!(N) Q "Aspirin/Antiplatelet Rx"
  1. ;I N Q "Other"
  1. ;refusal oR NMI
  1. S G=0
  1. NEW T S T=$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0))
  1. I 'T Q "None"
  1. S X=0 F S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G) S G=$$REFUSAL^APCLD717(P,50,$P(^ATXAX(T,21,X,0),U),BDATE,EDATE)
  1. I G,$P(G,U,2)'="N" Q "Refused"
  1. I G Q "None - Not Medically Indicated"
  1. NEW T S T=$O(^ATXAX("B","DM AUDIT ANTI-PLATELET DRUGS",0))
  1. I 'T Q "None"
  1. S (X,G)=0 F S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G) S G=$$REFUSAL^APCLD717(P,50,$P(^ATXAX(T,21,X,0),U),BDATE,EDATE)
  1. ;I G,$P(G,U,2)'="N" Q "Refused"
  1. I G Q "Refused or adverse rxn"
  1. ;NOW CHECK FOR ADVERSE REACTION/ALLERGY
  1. S X=BDATE,%DT="P" D ^%DT S B=Y
  1. D ASAALLEG(P,E,.APCLSAAL) ;return text of aspirin allergy if found
  1. I $D(APCLSAAL(1)) Q "Refused or adverse rxn "_APCLSAAL(1)
  1. Q "None"
  1. ;
  1. TOBACCO(P,EDATE) ;EP
  1. I '$G(P) Q ""
  1. NEW APCLTOB,APCL,X,E
  1. D TOBACCO0
  1. I $D(APCLTOB) Q APCLTOB
  1. ;D TOBACCO3
  1. ;I $D(APCLTOB) Q APCLTOB
  1. D TOBACCO1 ;check Problem file for tobacco use
  1. I $D(APCLTOB) Q APCLTOB
  1. D TOBACCO2 ;check POVs for tobacco use
  1. I $D(APCLTOB) Q APCLTOB
  1. S X=$$DENT(P,APCLRBD,APCLRED)
  1. I X]"" Q X
  1. Q "3 Not Documented "
  1. TOBACCO0 ;check for tobacco documented in health factors
  1. K APCL S X=P_"^LAST HEALTH [DM AUDIT TOBACCO HLTH FACTORS"_";DURING "_$$DOB^AUPNPAT(P)_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(") Q:E I $D(APCL(1)) D ;S APCLTOBN=$O(APCLTOB("")),APCLTOB=APCLTOB(APCLTOBN)
  1. . I $P(APCL(1),U,3)["CURRENT"!($P(APCL(1),U,3)["CESS") S APCLTOB="1 Current User" Q
  1. . S APCLTOB="2 Not a Current User "
  1. .Q
  1. Q
  1. TOBACCO3 ;lookup in health status
  1. S %=$O(^ATXAX("B","DM AUDIT TOBACCO HLTH FACTORS",0))
  1. Q:'%
  1. S X=0 K Y F S X=$O(^AUPNHF("AA",P,X)) Q:X'=+X I $D(^ATXAX(%,21,"B",X)) S D=$O(^AUPNHF("AA",P,X,0)),Y(9999999-D)=X
  1. Q:'$D(Y)
  1. S X=$O(Y(0))
  1. S Y=Y(X)
  1. S Y=$P(^AUTTHF(Y,0),U)
  1. S APCLTOB=Y
  1. I Y["CURRENT"!(Y["CESS") S APCLTOB="1 Current User" Q
  1. S APCLTOB="2 Not a Current User"
  1. Q
  1. TOBACCO1 ;check problem file for tobacco use
  1. K APCL S X=P_"^PROBLEMS [DM AUDIT PROBLEM SMOKING DXS" S E=$$START1^APCLDF(X,"APCL(") Q:E I $D(APCL(1)) D
  1. . ;I $P(^ICD9($P(APCL(1),U,2),0),U,1)=305.13 S APCLTOB="2 Not a Current User"_" - "_$E($P(^AUTNPOV($P(^AUPNPROB(+$P(APCL(1),U,4),0),U,5),0),U),1,30) Q ;cmi/anch/maw 9/12/2007 orig line
  1. . I $P($$ICDDX^ICDCODE($P(APCL(1),U,2)),U,2)=305.13 S APCLTOB="2 Not a Current User"_" - "_$E($P(^AUTNPOV($P(^AUPNPROB(+$P(APCL(1),U,4),0),U,5),0),U),1,30) Q ;cmi/anch/maw 9/12/2007 csv
  1. . S APCLTOB="1 Current user - "_$E($P(^AUTNPOV($P(^AUPNPROB(+$P(APCL(1),U,4),0),U,5),0),U),1,30)
  1. .Q
  1. Q
  1. TOBACCO2 ;check pov file for TOBACCO USE DOC
  1. NEW D,%DT
  1. S %DT="P",X=EDATE D ^%DT S D=Y
  1. NEW BDATE S BDATE=$$FMADD^XLFDT(D,-365),BDATE=$$FMTE^XLFDT(BDATE)
  1. K APCL S X=P_"^LAST DX [DM AUDIT SMOKING RELATED DXS;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"APCL(") Q:E I $D(APCL(1)) D
  1. . I $P(APCL(1),U,2)=305.13 S APCLTOB="2 Not a Current User"_" - "_$E($P(^AUTNPOV($P(^AUPNVPOV(+$P(APCL(1),U,4),0),U,4),0),U),1,30) Q
  1. . S APCLTOB="1 Current user"_" - "_$E($P(^AUTNPOV($P(^AUPNVPOV(+$P(APCL(1),U,4),0),U,4),0),U),1,30)
  1. .Q
  1. Q
  1. DENT(P,BDATE,EDATE) ;EP
  1. K ^TMP($J,"A")
  1. S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
  1. I '$D(^TMP($J,"A",1)) Q ""
  1. S X=0,G="" F S X=$O(^TMP($J,"A",X)) Q:X'=+X!(G) S V=$P(^TMP($J,"A",X),U,5) D
  1. .Q:'$D(^AUPNVSIT(V,0))
  1. .Q:'$P(^AUPNVSIT(V,0),U,9)
  1. .Q:$P(^AUPNVSIT(V,0),U,11)
  1. .S Z=0 F S Z=$O(^AUPNVDEN("AD",V,Z)) Q:Z'=+Z!(G) S B=$P($G(^AUPNVDEN(Z,0)),U) I B S B=$P($G(^AUTTADA(B,0)),U) I B=1320 S G="1 Current user - Ada Code 1320 "
  1. .Q
  1. Q G
  1. ;
  1. THERAPY(P,BD,EDATE) ;EP - therapy code for epi
  1. I '$G(P) Q ""
  1. NEW STR,TNAME,X,Y,%DT
  1. S STR="",TNAME=""
  1. S X=$$INSULIN^APCLD712(P,BD,EDATE)
  1. I X]"" S STR=STR_"2"
  1. S X=$$SULF^APCLD712(P,BD,EDATE)
  1. I X]"" S STR=STR_3
  1. S X=$$MET^APCLD712(P,BD,EDATE)
  1. I X]"" S STR=STR_4
  1. S X=$$ACAR^APCLD712(P,BD,EDATE)
  1. I X]"" S STR=STR_5
  1. S X=$$TROG^APCLD712(P,BD,EDATE)
  1. I X]"" S STR=STR_"6"
  1. I STR]"" Q STR
  1. S X=$$REFMED^APCLD712(P,BD,EDATE)
  1. I X Q 9
  1. Q 1
  1. ;
  1. TYPE(P,R,EDATE) ;EP return type 1 or 2 for epi file
  1. I '$G(P) Q ""
  1. NEW TYPE S TYPE=""
  1. I $G(R) S TYPE=$$CMSFDX^APCLD713(P,R,"DX")
  1. I TYPE="NIDDM" Q 2
  1. I TYPE["TYPE II" Q 2
  1. I TYPE="IDDM" Q 1
  1. I TYPE["2" Q 2
  1. I TYPE["1" Q 1
  1. S TYPE="" NEW X,I,C S X=$$PLDMDXS^APCLD713(P)
  1. F I=1:1 S C=$P(X,";",I) Q:C=""!(TYPE]"") I $E(C,6)=0!($E(C,6)=2) S TYPE=2
  1. I TYPE]"" Q TYPE
  1. F I=1:1 S C=$P(X,";",I) Q:C=""!(TYPE]"") I $E(C,6)=1!($E(C,6)=3) S TYPE=1
  1. I TYPE]"" Q TYPE
  1. S X=$$LASTDMDX^APCLD713(P,EDATE)
  1. I X[2 Q 2
  1. I X[1 Q 1
  1. Q ""
  1. ;
  1. DURDM(P,R,EDATE) ;EP
  1. I '$G(P) Q ""
  1. NEW Y S Y=$$DODX(P,R,"I")
  1. I Y="" Q ""
  1. I 'Y Q ""
  1. I Y>EDATE Q ""
  1. ;W !,$$HRN^AUPNPAT(P,DUZ(2)),"^",Y,"^",($$FMDIFF^XLFDT(EDATE,Y,1)\365)
  1. Q ($$FMDIFF^XLFDT(EDATE,Y,1)\365)
  1. DODX(P,R,F) ;EP - date of dx for epi file
  1. I $G(F)="" S F="E"
  1. NEW DATE,EARLY
  1. S DATE="",EARLY=9999999
  1. I $G(R) S DATE=$$CMSFDX^APCLD713(P,R,"ID")
  1. I DATE S EARLY=DATE
  1. S DATE=$$PLDMDOO^APCLD713(P,"I")
  1. I DATE,DATE<EARLY S EARLY=DATE
  1. I EARLY=9999999 S EARLY=""
  1. Q $S(F="I":$$DI(EARLY),1:$$D(EARLY))
  1. D(D) ;
  1. I D="" Q ""
  1. Q $S($E(D,4,5)="00":"07",1:$E(D,4,5))_"/"_$S($E(D,6,7)="00":"01",1:$E(D,6,7))_"/"_(1700+$E(D,1,3))
  1. DI(D) ;EP
  1. I D="" Q ""
  1. Q $E(D,1,3)_$S($E(D,4,5)="00":"07",1:$E(D,4,5))_$S($E(D,6,7)="00":"01",1:$E(D,6,7))
  1. ;;
  1. ASAALLEG(P,APCLD,APCLY) ;does patient have an aspirin allergy
  1. ;get all povs with 995.0-995.3 with ecode of e935.3 up to discharge date
  1. NEW ED,BD,APCLG,APCLC,X,Y,Z,N
  1. ;APCLD is discharge date
  1. S APCLC=0 K APCLY
  1. S ED=$$FMADD^XLFDT(APCLD,-365)
  1. ASAPOV ;
  1. K APCLG S Y="APCLG(",X=P_"^ALL DX [APCL ASA ALLERGY 995.0-995.3;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(P))_"-"_$$FMTE^XLFDT(APCLD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(APCLG(X)) Q:X'=+X S Y=+$P(APCLG(X),U,4) D
  1. .S N=$$VAL^XBDIQ1(9000010.07,Y,.04),N=$$UP^XLFSTR(N)
  1. .I N["ASPIRIN"!(N["ASA") S APCLC=APCLC+1,APCLY(APCLC)="POV: "_$$FMTE^XLFDT($P(APCLG(X),U))_" ["_$P(APCLG(X),U,2)_"] "_N
  1. .;S Z=$P(^AUPNVPOV(Y,0),U,9) I Z]"",$P($G(^ICD9(Z,0)),U)="E935.3" S APCLC=APCLC+1,APCLY(APCLC)="POV "_$$FMTE^XLFDT($P(APCLG(X),U))_" ["_$P(APCLG(X),U,2)_" + E935.3] "_N ;cmi/anch/maw 9/12/2007 orig line
  1. .S Z=$P(^AUPNVPOV(Y,0),U,9) I Z]"",$P($$ICDDX^ICDCODE(Z),U,2)="E935.3" S APCLC=APCLC+1,APCLY(APCLC)="POV "_$$FMTE^XLFDT($P(APCLG(X),U))_" ["_$P(APCLG(X),U,2)_" + E935.3] "_N ;cmi/anch/maw 9/12/2007 csv
  1. .Q
  1. K APCLG S Y="APCLG(",X=P_"^ALL DX V14.8;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(P))_"-"_$$FMTE^XLFDT(APCLD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(APCLG(X)) Q:X'=+X S Y=+$P(APCLG(X),U,4) D
  1. .S N=$$VAL^XBDIQ1(9000010.07,Y,.04),N=$$UP^XLFSTR(N)
  1. .I N["ASPIRIN"!(N["ASA") S APCLC=APCLC+1,APCLY(APCLC)="POV: "_$$FMTE^XLFDT($P(APCLG(X),U))_" ["_$P(APCLG(X),U,2)_"] "_N
  1. .Q
  1. ;now check problem list for these codes
  1. S T="",T=$O(^ATXAX("B","BGP ASA ALLERGY 995.0-995.3",0))
  1. S X=0 F S X=$O(^AUPNPROB("AC",P,X)) Q:X'=+X D
  1. .;S I=$P($G(^AUPNPROB(X,0)),U),Y=$P($G(^ICD9(I,0)),U) ;cmi/anch/maw 9/12/2007 orig line
  1. .S I=$P($G(^AUPNPROB(X,0)),U),Y=$P($$ICDDX^ICDCODE(I),U,2) ;cmi/anch/maw 9/12/2007 csv
  1. .S N=$$VAL^XBDIQ1(9000011,X,.05),N=$$UP^XLFSTR(N)
  1. .Q:$P(^AUPNPROB(X,0),U,8)>APCLD ;added after discharge date
  1. .I Y="V14.8"!($$ICD^ATXCHK(I,T,9)),N["ASPIRIN"!(N["ASA") S APCLC=APCLC+1,APCLY(APCLC)="PROBLEM LIST: "_$$FMTE^XLFDT($P(^AUPNPROB(X,0),U,8))_" ["_Y_"] "_N
  1. .Q
  1. ;now check allergy tracking
  1. S X=0 F S X=$O(^GMR(120.8,"B",P,X)) Q:X'=+X D
  1. .Q:$P($P($G(^GMR(120.8,X,0)),U,4),".")>APCLD ;entered after discharge date
  1. .S N=$P($G(^GMR(120.8,X,0)),U,2),N=$$UP^XLFSTR(N)
  1. .I N["ASPIRIN" S APCLC=APCLC+1,APCLY(APCLC)="ALLERGY TRACKING: "_$$FMTE^XLFDT($P(^GMR(120.8,X,0),U,4))_" "_N Q
  1. .S C=$O(^PS(50.605,"B","CN103",0))
  1. .I C,$D(^GMR(120.8,X,3,"B",C)) S G="Refused/Adverse Rxn" Q
  1. .S C=$O(^PS(50.605,"B","BL100",0))
  1. .I C,$D(^GMR(120.8,X,3,"B",C)) S G="Refused/Adverse Rxn" Q
  1. .S C=$O(^PS(50.605,"B","BL110",0))
  1. .I C,$D(^GMR(120.8,X,3,"B",C)) S G="Refused/Adverse Rxn" Q
  1. .S C=$O(^PS(50.605,"B","BL117",0))
  1. .I C,$D(^GMR(120.8,X,3,"B",C)) S G="Refused/Adverse Rxn" Q
  1. .Q