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

AMHHS1.m

Go to the documentation of this file.
AMHHS1 ; IHS/CMI/LAB - BH HEALTH SUMMARY COMPONENT PART 2 ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**2,5**;JUN 02, 2010;Build 18
 ;
 ;
PROB ;EP
 ;get date last reviewed and display
 X APCHSCKP Q:$D(APCHSQIT)  S X="******************** BH ACTIVE PROBLEMS ********************",AMHS="",$P(AMHS," ",80-1-$L(X)/2)="" W !,AMHS,X,AMHS,!
 S AMHTCVD="S:Y]"""" Y=+Y,Y=$E(Y,4,5)_""/""_$E(Y,6,7)_""/""_$E(Y,2,3)"
 S AMHTTAT="A" D COMMON
 X APCHSCKP Q:$D(APCHSQIT)  S X="******************** BH INACTIVE PROBLEMS ******************** ",AMHS="",$P(AMHS," ",80-1-$L(X)/2)="" W !,AMHS,X,AMHS,!
 S AMHTTAT="I" D COMMON
 S AMHSX=$$LASTPLR^AMHAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W !,"BH Problem List Reviewed: ",?36,$$FMTE^XLFDT($P(AMHSX,U,1)) W ?51,"By: ",?54,$E($S($P(AMHSX,U,3):$P($G(^VA(200,$P(AMHSX,U,3),0)),U),1:""),1,25),!
 S AMHSX=$$LASTPLU^AMHAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W "BH Problem List Updated: ",?36,$$FMTE^XLFDT($P(AMHSX,U,1)) W ?51,"By: ",?54,$E($S($P(AMHSX,U,3):$P($G(^VA(200,$P(AMHSX,U,3),0)),U),1:""),1,25),!
 S AMHSX=$$LASTNAP^AMHAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 ;I '$$ANYACTP^APCDAPRB(APCHSPAT) W !,"No Active Problems: ",?24,$$FMTE^XLFDT($P(AMHSX,U,1)) I $P(AMHSX,U,3) W ?39,"Documented By: ",?54,$E($P($G(^VA(200,$P(AMHSX,U,3),0)),U),1,25),!
 W "No Active BH Problems Documented: ",?36,$$FMTE^XLFDT($P(AMHSX,U,1)) W ?51,"By: ",$E($S($P(AMHSX,U,3):$P($G(^VA(200,$P(AMHSX,U,3),0)),U),1:""),1,25),!
 K AMHTCVD,AMHTQ,Y,AMHHS,AMHPTP,AMHTTPT
 D PROBX
 Q
COMMON ;
 K AMHTDFT S AMHTNDF=0
 S AMHTPRB="" F AMHTQ=0:0 S AMHTPRB=$O(^AMHPPROB("AA",APCHSPAT,AMHTPRB)) Q:AMHTPRB=""  S AMHTDFN=$O(^(AMHTPRB,"")) S:$P(^AMHPPROB(AMHTDFN,0),U,12)=AMHTTAT AMHTNDF=AMHTNDF+1,AMHTDFT(AMHTPRB)=AMHTDFN
 I AMHTNDF=0 X APCHSCKP Q:$D(APCHSQIT)  S X=" <NONE> ",AMHS="",$P(AMHS," ",80-1-$L(X)/2)="" W AMHS,X,AMHS,!
 ;X APCHSCKP Q:$D(APCHSQIT)  W !!,"*****      ",$S(AMHTTAT="A":"  ACTIVE ",1:"  INACTIVE "),"PROBLEMS AND TREATMENT NOTES/NOTES  ***** ",!!
 S AMHTFPP="" F AMHTQ=0:0 S AMHTFPP=$O(AMHTDFT(AMHTFPP)) Q:AMHTFPP=""  S AMHTDFN=AMHTDFT(AMHTFPP) D PROBDSP
PROBX K AMHTDFT,AMHTNDF,AMHTFPP,AMHTPLN,AMHTPBN,AMHTDTM,AMHTDTN,AMHTPRB,AMHTTAT,AMHTNFP,APCHSNRQ,AMHTPNM,AMHTDFN,AMHTFCN,AMHTICD,APCHSICL,AMHTILN,AMHTN,AMHSNRQ1,AMHTDOO
 K AMHTNFL,AMHTNSH,AMHTNAB,AMHTVSC,AMHTITE
 Q
PROBSCH ;
 Q
PROBDSP ;
 S AMHTN=^AMHPPROB(AMHTDFN,0)
 S APCHSNRQ=$P(AMHTN,U,5)
 S APCHSNRQ=$$GET1^DIQ(9002011.51,AMHTDFN,.05)
 S AMHTDOO=$P(AMHTN,U,13) I AMHTDOO]"" S Y=AMHTDOO X AMHTCVD S AMHTDOO=Y
 S AMHTPNM=+$P(AMHTN,U,7)
 S Y=$P(AMHTN,U,3) X AMHTCVD S AMHTDTM=Y
 S Y=$P(AMHTN,U,8) X AMHTCVD S AMHTDTN=Y
 ;S AMHTPLN=AMHTPNM_$E("     ",1,8-$L(AMHTPNM))_AMHTDTM
 X APCHSCKP Q:$D(APCHSQIT)  W !,AMHTPNM,?4,AMHTDTM S APCHSICL=14,AMHTILN=61 D PRTICD
 D NOTEDSP
 Q
NOTEDSP ; DISPLAY NOTES UNDER PROBLEM
 Q:'$D(^AMHPTP("AE",AMHTDFN))  ;no notes
 S AMHTNDF=0 F AMHTQ=0:0 S AMHTNDF=$O(^AMHPTP("AE",AMHTDFN,AMHTNDF)) Q:'AMHTNDF  D DSPN
 Q
DSPN ; DISPLAY SINGLE NOTE
 S X=$O(^AMHPTP("AE",AMHTDFN,AMHTNDF,"")) Q:X=""
 S AMHTN=^AMHPTP(X,0)
 S AMHTDOI=$P(AMHTN,U,5) I AMHTDOI]"" S Y=AMHTDOI X AMHTCVD S AMHTDOI=Y
 S AMHTTPT=$P(AMHTN,U,7) S AMHTTPT=$S(AMHTTPT=1:"STP",AMHTTPT=2:"LTP",1:"   ")
 S AMHHS("AUTHOR")=$P(AMHTN,U,6) S AMHHS("AUTHOR")=$S(AMHHS("AUTHOR")]"":$$PROVINI^XBFUNC1($P(AMHTN,U,6)),1:"???")
 X APCHSCKP Q:$D(APCHSQIT)  W ?1,AMHTPNM_"-"_$P(AMHTN,U),?7,AMHTTPT,?11,AMHTDOI,?20,AMHHS("AUTHOR")
 S APCHSNRQ=$P(AMHTN,U,4),APCHSICL=24,APCHSTXT="" S:APCHSNRQ="" APCHSNRQ="<<<NO NOTE NARRATIVE>>>" D PRTTXT^APCHSUTL
 K AMHTDOI
 Q
 ;
PRTICD ;
 S:APCHSNRQ="" APCHSNRQ="<no narrative provided>" S AMHTICD=""
 I AMHTDOO]"" S APCHSNRQ=APCHSNRQ_"  (ONSET: "_AMHTDOO_")"
 S AMHSNRQ1=APCHSNRQ
 S APCHSNRQ="("_$P(^AMHPROB($P(AMHTN,U),0),U)_")"
 S Y=$L(APCHSNRQ) F X=Y:1:9 S APCHSNRQ=APCHSNRQ_" "
 S APCHSNRQ=APCHSNRQ_$P(^AMHPROB($P(AMHTN,U),0),U,2),APCHSTXT=""
 D PRTTXT^APCHSUTL
 S APCHSNRQ=AMHSNRQ1,APCHSICL=24,APCHSTXT="" D PRTTXT^APCHSUTL
 Q