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

BHSBH1.m

Go to the documentation of this file.
BHSBH1 ;IHS/CIA/MGH - Health Summary for Behavioral Health ;17-Mar-2006 10:36;MGH
 ;;1.0;HEALTH SUMMARY COMPONENTS;;March 17, 2006
 ;===================================================================
 ;Taken from AMHHS1
 ; IHS/CMI/LAB - BH HEALTH SUMMARY COMPONENT PART 2 ;
 ;;3.0;IHS BEHAVIORAL HEALTH;;JAN 27, 2003
 ;Continuation of converion of behavioral health over to VA health summary
 ;=====================================================================
PROB ;EP
 D CKP^GMTSUP Q:$D(GMTSQIT)  S X="******************** BH ACTIVE PROBLEMS ********************",AMHS="",$P(AMHS," ",IOM-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
 D CKP^GMTSUP Q:$D(GMTSQIT)  S X="******************** BH INACTIVE PROBLEMS ******************** ",AMHS="",$P(AMHS," ",IOM-1-$L(X)/2)="" W !,AMHS,X,AMHS,!
 S AMHTTAT="I" D COMMON
 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",BHSPAT,AMHTPRB)) Q:AMHTPRB=""  S AMHTDFN=$O(^(AMHTPRB,"")) S:$P(^AMHPPROB(AMHTDFN,0),U,12)=AMHTTAT AMHTNDF=AMHTNDF+1,AMHTDFT(AMHTPRB)=AMHTDFN
 I AMHTNDF=0 D CKP^GMTSUP Q:$D(GMTSQIT)  S X=" <NONE> ",AMHS="",$P(AMHS," ",IOM-1-$L(X)/2)="" W AMHS,X,AMHS,!
 ;D CKP^GMTSUP Q:$D(GMTSQIT)  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,BHSNRQ,AMHTPNM,AMHTDFN,AMHTFCN,AMHTICD,BHSICL,AMHTILN,AMHTN,AMHSNRQ1,AMHTDOO
 K AMHTNFL,AMHTNSH,AMHTNAB,AMHTVSC,AMHTITE
 Q
PROBSCH ;
 Q
PROBDSP ;
 S AMHTN=^AMHPPROB(AMHTDFN,0)
 S BHSNRQ=$P(AMHTN,U,5)
 D GETNARR I 1
 E  S BHSNRQ=""
 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
 D CKP^GMTSUP Q:$D(GMTSQIT)  W !,AMHTPNM,?4,AMHTDTM S BHSICL=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:"???")
 D CKP^GMTSUP Q:$D(GMTSQIT)  W ?1,AMHTPNM_"-"_$P(AMHTN,U),?7,AMHTTPT,?11,AMHTDOI,?20,AMHHS("AUTHOR")
 S BHSNRQ=$P(AMHTN,U,4),BHSICL=24,BHSTXT="" S:BHSNRQ="" BHSNRQ="<<<NO NOTE NARRATIVE>>>" D PRTTXT^BHSUTL
 K AMHTDOI
 Q
 ;
PRTICD ;
 S:BHSNRQ="" BHSNRQ="<no narrative provided>" S AMHTICD=""
 I AMHTDOO]"" S BHSNRQ=BHSNRQ_"  (ONSET: "_AMHTDOO_")"
 S AMHSNRQ1=BHSNRQ
 S BHSNRQ="("_$P(^AMHPROB($P(AMHTN,U),0),U)_")"
 S Y=$L(BHSNRQ) F X=Y:1:9 S BHSNRQ=BHSNRQ_" "
 S BHSNRQ=BHSNRQ_$P(^AMHPROB($P(AMHTN,U),0),U,2),BHSTXT=""
 D PRTTXT^BHSUTL
 S BHSNRQ=AMHSNRQ1,BHSICL=24,BHSTXT="" D PRTTXT^BHSUTL
 Q
 ;
 ;
GETNARR ;
 I BHSNRQ]"" S BHSNRQ=$S($D(^AUTNPOV(BHSNRQ)):$P(^AUTNPOV(BHSNRQ,0),U),1:"***** "_BHSNRQ_" *****")
 E  S BHSNRQ=""
 Q
 ;