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

APCHS40.m

Go to the documentation of this file.
APCHS40 ; IHS/CMI/LAB -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS PCC SUITE;**5,6,7,11,16**;MAY 14, 2009;Build 9
 ;
 ;cmi/anch/maw 8/27/2007 code set versioning in PROBASCH
 ;
PROBA ; ************ ALLERGY PROB * 9000011 *********
 ; for PROBLEM LIST codes only!
 I '$D(^AUPNPROB("AC",APCHSPAT)) X APCHSCKP G:$D(APCHSQIT) PROBAX I 'APCHSNPG W ! X APCHSCKP Q:$D(APCHSQIT)  X:'APCHSNPG APCHSBRK W ! D PROBADNR,ALR Q
 K APCHSPT S (APCHSFND,APCHSLEN)=0
 S APCHSDFN="" F APCHSQ=0:0 S APCHSDFN=$O(^AUPNPROB("AC",APCHSPAT,APCHSDFN)) Q:'APCHSDFN  I $D(^AUPNPROB(APCHSDFN,0)),$P(^AUPNPROB(APCHSDFN,0),U,12)'="D" D PROBASCH
 X APCHSCKP G:$D(APCHSQIT) PROBAX I 'APCHSNPG W ! X APCHSCKP Q:$D(APCHSQIT)  X:'APCHSNPG APCHSBRK
 W !
 I 'APCHSFND D PROBADNR,ALR G PROBAX
 S APCHSDFN="" F APCHSQ=0:0 S APCHSDFN=$O(APCHSPT(APCHSDFN)) Q:'APCHSDFN  D PROBADSP
ALR ;
 ;get date last reviewed and display
 S APCHSX=$$LASTALR^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W !,"Allergy List Reviewed On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?54,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
 S APCHSX=$$LASTALU^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W "Allergy List Updated On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?54,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
 S APCHSX=$$LASTNAA^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 ;I '$$ANYACTA^APCDAALG(APCHSPAT) W !,"No Active Problems: ",?24,$$FMTE^XLFDT($P(APCHSX,U,1)) I $P(APCHSX,U,3) W ?39,"Documented By: ",?54,$E($P($G(^VA(200,$P(APCHSX,U,3),0)),U),1,25),!
 W "No Active Allergies documented On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?56,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,22),!
 ;get date last reviewed and display
 S APCHSX=$$LASTPLR^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W !,"Problem List Reviewed On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?54,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
 S APCHSX=$$LASTPLU^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W "Problem List Updated On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?54,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
 S APCHSX=$$LASTNAP^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 ;I '$$ANYACTP^APCDAPRB(APCHSPAT) W !,"No Active Problems: ",?24,$$FMTE^XLFDT($P(APCHSX,U,1)) I $P(APCHSX,U,3) W ?39,"Documented By: ",?54,$E($P($G(^VA(200,$P(APCHSX,U,3),0)),U),1,25),!
 W "No Active Problems Documented On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
PROBAX ;
 K APCHSPT,APCHSFND,APCHSDFN,APCHSLEN,APCHSDAT,APCHSNKA
 Q
 ;
PROBASCH ;active problem search
 ;S APCHSP=$P(^ICD9(+^AUPNPROB(APCHSDFN,0),0),U,1) D PROBACHK I  D PROBALLG  cmi/anch/maw 8/27/2007 orig line
 S APCHSP=$P($$ICDDX^ICDEX(+^AUPNPROB(APCHSDFN,0),0),U,2) D PROBACHK I  D PROBALLG  ;cmi/anch/maw 8/27/2007 code set versioning
 Q
PROBACHK ;checking for allergy codes
 S APCHSNKA=0
 Q:$P(^AUPNPROB(APCHSDFN,0),U,5)=""  ;IHS/CMI/LAB - no narr
 S APCHSNKA=0
 I $$ICD^ATXAPI(+^AUPNPROB(APCHSDFN,0),$O(^ATXAX("B","APCH ALLERGY DX CODES",0)),9) Q
 ;I APCHSP="692.3" Q
 ;I APCHSP="693.0" Q
 ;I APCHSP="995.0" Q
 ;I APCHSP="995.2" Q
 ;I (+APCHSP'<999.4),(+APCHSP'>999.89) Q
 ;I APCHSP?1"V14."1E Q
 ;I APCHSP="692.5" Q
 ;I APCHSP="693.1" Q
 ;I APCHSP="V15.0" Q
 ;I APCHSP["V15.0" Q
 ;I $E(APCHSP,1,3)=692,APCHSP'="692.9" Q
 ;I APCHSP="693.8" Q
 ;I APCHSP="693.9" Q
 ;I APCHSP="989.5" Q
 ;I APCHSP="989.82" Q
 ;I APCHSP="995.3" Q
 ;I APCHSP["995.2" Q
 ;S N=$P(^AUTNPOV($P(^AUPNPROB(APCHSDFN,0),U,5),0),U) I APCHSP="799.9"!(APCHSP="V82.9"),N["NO KNOWN ALLERG"!(N["NKA")!(N["NKDA")!(N["NO KNOWN DRUG ALLERG") S APCHSNKA=1 Q
 S N=$$VAL^XBDIQ1(9000011,APCHSDFN,.05) I N["NO KNOWN ALLERG"!(N["NKA")!(N["NKDA")!(N["NO KNOWN DRUG ALLERG") S APCHSNKA=1 Q
 ;I APCHSP="799.9",$P(^AUTNPOV($P(^AUPNPROB(APCHSDFN,0),U,5),0),U,1)["NO KNOWN ALLERG"!($P(^AUTNPOV($P(^AUPNPROB(APCHSDFN,0),U,5),0),U,1)["NKA")!($P(^AUTNPOV($P(^AUPNPROB(APCHSDFN,0),U,5),0),U)["NKDA") S APCHSNKA=1 Q
 Q
 ;
PROBADSP ;display allergies
 S:$L(APCHSPT(APCHSDFN))<APCHSLEN APCHSL1=$L(APCHSPT(APCHSDFN))/2,APCHSL1=(APCHSLEN/2)-APCHSL1 ;                       center recorded allergies
 W ?((IOM-APCHSLEN-12)/2),"***** "
 W ?((IOM-APCHSLEN)/2)+$G(APCHSL1),APCHSPT(APCHSDFN)
 W ?((IOM+APCHSLEN)/2)," *****",!
 K APCHSL1
 Q
 ;
PROBADNR ;display "NONE RECORDED", if no allergies recorded
 W ?((IOM-13-12)/2),"***** ",?((IOM-13)/2),"NONE RECORDED",?((IOM+13)/2)," *****",!
 Q
 ;
PROBALLG ;if allergy
 S APCHSFND=1
 I APCHSNKA D  I 1
 . S Y=$P(^AUPNPROB(APCHSDFN,0),U,8) X APCHSCVD S APCHSDAT=Y
 . S APCHSPT(APCHSDFN)="NO ALLERGY NOTED ON "_APCHSDAT_" ("_$$VAL^XBDIQ1(9000011,APCHSDFN,.05)_")"
 . S:$L($P(APCHSPT(APCHSDFN),U))>APCHSLEN APCHSLEN=$L($P(APCHSPT(APCHSDFN),U))
 . Q
 E  D
 . ;Q:$P(^AUPNPROB(APCHSDFN,0),U,5)=""  ;IHS/CMI/LAB - added this to prevent subscript
 . S APCHSPT(APCHSDFN)=$$VAL^XBDIQ1(9000011,APCHSDFN,.05) ;$P($G(^AUTNPOV(+$P(^AUPNPROB(APCHSDFN,0),U,5),0)),U,1)
 . I APCHSPT(APCHSDFN)="" S APCHSPT(APCHSDFN)="???"
 . S:$L(APCHSPT(APCHSDFN))>APCHSLEN APCHSLEN=$L(APCHSPT(APCHSDFN))
 . Q
 Q
 ;