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

BCHDHS1.m

Go to the documentation of this file.
BCHDHS1 ; IHS/CMI/LAB - CHR HEALTH SUMMARY COMPONENT PART 2 ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;IHS/CMI/LAB - Y2K
 ;
 ;CMI/TUCSON/LAB - patch 5 6/22/98 - modified reference to BCHPROB to BCHTPROB
 ;
 ;Continuation of BCHDHS
 ;
PROB ;EP
 X APCHSCKP Q:$D(APCHSQIT)  S X="<<< CHR ACTIVE PROBLEMS >>>",BCHS="",$P(BCHS," ",IOM-1-$L(X)/2)="" W !,BCHS,X,BCHS,!
 ;begin Y2K
 ;S BCHTCVD="S:Y]"""" Y=+Y,Y=$E(Y,4,5)_""/""_$E(Y,6,7)_""/""_$E(Y,1,3)" ;Y2000
 S BCHTCVD="S:Y]"""" Y=+Y,Y=$E(Y,4,5)_""/""_$E(Y,6,7)_""/""_(1700+($E(Y,1,3))" ;Y2000
 ;end Y2K
 S BCHTTAT="A" D COMMON
 X APCHSCKP Q:$D(APCHSQIT)  S X="<<< CHR INACTIVE PROBLEMS >>> ",BCHS="",$P(BCHS," ",IOM-1-$L(X)/2)="" W !,BCHS,X,BCHS,!
 S BCHTTAT="I" D COMMON
 K BCHTCVD,BCHTQ,Y,BCHHS,BCHPTP
 D PROBX
 Q
COMMON ;
 K BCHTDFT S BCHTNDF=0
 S BCHTPRB="" F BCHTQ=0:0 S BCHTPRB=$O(^BCHPPROB("AA",APCHSPAT,BCHTPRB)) Q:BCHTPRB=""  S BCHTDFN=$O(^(BCHTPRB,"")) S:$P(^BCHPPROB(BCHTDFN,0),U,12)=BCHTTAT BCHTNDF=BCHTNDF+1,BCHTDFT(BCHTPRB)=BCHTDFN
 I BCHTNDF=0 X APCHSCKP Q:$D(APCHSQIT)  S X=" <NONE> ",BCHS="",$P(BCHS," ",IOM-1-$L(X)/2)="" W BCHS,X,BCHS,!
 ;X APCHSCKP Q:$D(APCHSQIT)  W !!,"*****      ",$S(BCHTTAT="A":"  ACTIVE ",1:"  INACTIVE "),"PROBLEMS AND TREATMENT PLANS/NOTES  ***** ",!!
 S BCHTFPP="" F BCHTQ=0:0 S BCHTFPP=$O(BCHTDFT(BCHTFPP)) Q:BCHTFPP=""  S BCHTDFN=BCHTDFT(BCHTFPP) D PROBDSP
PROBX K BCHTDFT,BCHTNDF,BCHTFPP,BCHTPLN,BCHTPBN,BCHTDTM,BCHTDTN,BCHTPRB,BCHTTAT,BCHTNFP,BCHTNRQ,BCHTPNM,BCHTDFN,BCHTFCN,BCHTICD,BCHTICL,BCHTILN,BCHTN,BCHTTPT
 K BCHTNFL,BCHTNSH,BCHTNAB,BCHTVSC,BCHTITE
 Q
PROBSCH ;
 Q
PROBDSP ;
 S BCHTN=^BCHPPROB(BCHTDFN,0)
 S BCHTNRQ=$P(BCHTN,U,5)
 D GETNARR I 1
 E  S BCHTNRQ=""
 S BCHTDOO=$P(BCHTN,U,13) I BCHTDOO]"" S Y=BCHTDOO X BCHTCVD S BCHTDOO=Y
 S BCHTPNM=+$P(BCHTN,U,7)
 S Y=$P(BCHTN,U,3) X BCHTCVD S BCHTDTM=Y
 S Y=$P(BCHTN,U,8) X BCHTCVD S BCHTDTN=Y
 ;S BCHTPLN=BCHTPNM_$E("     ",1,8-$L(BCHTPNM))_BCHTDTM
 X APCHSCKP Q:$D(APCHSQIT)  W !,BCHTPNM,?4,BCHTDTM S BCHTICL=14,BCHTILN=61 D PRTICD
 D NOTEDSP
 Q
NOTEDSP ; DISPLAY NOTES UNDER PROBLEM
 Q:'$D(^BCHPTP("AE",BCHTDFN))  ;no notes
 S BCHTNDF=0 F BCHTQ=0:0 S BCHTNDF=$O(^BCHPTP("AE",BCHTDFN,BCHTNDF)) Q:'BCHTNDF  D DSPN
 Q
DSPN ; DISPLAY SINGLE NOTE
 S X=$O(^BCHPTP("AE",BCHTDFN,BCHTNDF,"")) Q:X=""
 S BCHTN=^BCHPTP(X,0)
 S BCHTDOI=$P(BCHTN,U,5) I BCHTDOI]"" S Y=BCHTDOI X BCHTCVD S BCHTDOI=Y
 S BCHTTPT=$P(BCHTN,U,7) S BCHTTPT=$S(BCHTTPT=1:"STP",BCHTTPT=2:"LTP",1:"   ")
 S BCHHS("AUTHOR")=$P(BCHTN,U,6) S BCHHS("AUTHOR")=$S(BCHHS("AUTHOR")]"":$$PROVINI^XBFUNC1($P(BCHTN,U,6)),1:"???")
 X APCHSCKP Q:$D(APCHSQIT)  W ?1,BCHTPNM_"-"_$P(BCHTN,U),?7,BCHTTPT,?11,BCHTDOI,?20,BCHHS("AUTHOR")
 S APCHSNRQ=$P(BCHTN,U,4),APCHSICL=24,APCHSTXT="" D PRTTXT^APCHSUTL
 K BCHTDOI
 Q
 ;
PRTICD ;
 S:BCHTNRQ="" BCHTNRQ="<no narrative provided>" S BCHTICD=""
 S BCHTTXT=BCHTICD D PRTTXT
 Q
 ;
PRTTXT ; GENERALIZED TEXT PRINTER
 S BCHTDLT=1,BCHTILN=80-BCHTICL-1
 ;S BCHTNRQ="["_$E($P(^BCHTPROB($P(BCHTN,U),0),U,2),1,25)_"] "_BCHTNRQ
 S BCHTNRQ=BCHTNRQ_"  ("_$P(^BCHTPROB($P(BCHTN,U),0),U)_")" ;CMI/TUCSON/LAB - PATCH 5 changed ^BCHPROB to ^BCHTPROB 6/22/98
 I BCHTDOO]"" S BCHTNRQ=BCHTNRQ_"  (ONSET: "_BCHTDOO_")"
 F BCHTQ=0:0 S:BCHTNRQ]""&(($L(BCHTNRQ)+$L(BCHTTXT)+2)<255) BCHTTXT=$S(BCHTTXT]"":BCHTTXT_"; ",1:"")_BCHTNRQ,BCHTNRQ="" Q:BCHTTXT=""  D PRTTXT2
 K BCHTILN,BCHTDLT,BCHTF,BCHTC,BCHTTXT,BCHTDOO
 Q
PRTTXT2 D GETFRAG W ?BCHTICL W BCHTF,! S BCHTICL=BCHTICL+BCHTDLT,BCHTILN=BCHTILN-BCHTDLT,BCHTDLT=0
 Q
GETFRAG I $L(BCHTTXT)<BCHTILN S BCHTF=BCHTTXT,BCHTTXT="" Q
 F BCHTC=BCHTILN:-1:1 Q:$E(BCHTTXT,BCHTC)=" "
 S BCHTF=$E(BCHTTXT,1,BCHTC-1),BCHTTXT=$E(BCHTTXT,BCHTC+1,255)
 Q
 ;
GETNARR ;
 I BCHTNRQ]"" S BCHTNRQ=$S($D(^AUTNPOV(BCHTNRQ)):$P(^AUTNPOV(BCHTNRQ,0),U),1:"***** "_BCHTNRQ_" *****")
 E  S BCHTNRQ=""
 Q
 ;