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

AMHPROB.m

Go to the documentation of this file.
AMHPROB ; IHS/CMI/LAB - Display Problems and Notes ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**2,5**;JUN 02, 2010;Build 18
 ;Called from data entry templates to display problems, AMHPAT must equal the patient DFN
 Q:'$G(AMHPAT)
 NEW AMHTC,AMHTCVD,AMHTDFN,AMHDFT,AMHTDLT,AMHDOI,AMHTDOO,AMHTDTM,AMHTDTN,AMHTF,AMHTFAC,AMHTFCN,AMHTFPP,AMHTICD,AMHTICL,AMHTILN
 NEW AMHTITE,AMHTN,AMHTNAB,AMHTNDF,AMHTNFL,AMHTNFP,AMHTNRQ,AMHTNSH,AMHTPBN,AMHTPLN,AMHTPNM,AMHTPRB,AMHTQ,AMHTTAT,AMHTVSC
 W !!,"PCC Problem List for ",$P(^DPT(AMHPAT,0),U),"."
 S AMHTCVD="S:Y]"""" Y=+Y,Y=$E(Y,4,5)_""/""_$E(Y,6,7)_""/""_$E(Y,2,3)"
 S AMHTTAT="A" D COMMON S AMHTTAT="I" D COMMON
 K AMHTCVD,AMHTQ,Y
 D PROBX
 W !,"Press any key to continue" R X:DTIME
 K X
 Q
COMMON ;
 I '$D(^AUPNPROB("AC",AMHPAT)) W !,"********** No ",$S(AMHTTAT="A":"ACTIVE",1:"INACTIVE")," Problems on file for this Patient",! Q
 K AMHTDFT S AMHTNDF=0
 S AMHTFAC="" F AMHTQ=0:0 S AMHTFAC=$O(^AUPNPROB("AA",AMHPAT,AMHTFAC)) Q:'AMHTFAC  D PROBSCH
 I AMHTNDF=0 W !,"********** No ",$S(AMHTTAT="A":"ACTIVE",1:"INACTIVE")," Problems on file for this Patient",! Q
 W !!,"******************",$S(AMHTTAT="A":"  ACTIVE ",1:"  INACTIVE "),"PROBLEMS AND NOTES  ********************",!!
 S AMHTFPP="" F AMHTQ=0:0 S AMHT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P)) Q:'AMHTNFP  D DSPFACN
 Q
DSPFACN ; DISPLAY NOTES FOR SELECTED FACILITY
 Q:$D(^AUPNPROB(AMHTDFN,11,AMHTNFP,11,0))'=1
 Q:$O(^AUPNPROB(AMHTDFN,11,AMHTNFP,11,0))=""
 S AMHTITE=^AUPNPROB(AMHTDFN,11,AMHTNFP,0) D GETSITE S AMHTFCN=AMHTNAB
 S AMHTNDF=0 F AMHTQ=0:0 S AMHTNDF=$O(^AUPNPROB(AMHTDFN,11,AMHTNFP,11,AMHTNDF)) Q:'AMHTNDF  D DSPN ; ACC
 Q
DSPN ; DISPLAY SINGLE NOTE
 S AMHTN=^AUPNPROB(AMHTDFN,11,AMHTNFP,11,AMHTNDF,0)
 Q:$P(AMHTN,U,4)="I"
 F AMHTQ=0:0 Q:$E(AMHTFCN)'=" "  S AMHTFCN=$E(AMHTFCN,2,99)
 S AMHTDOI=$P(AMHTN,U,5) I AMHTDOI]"" S Y=AMHTDOI X AMHTCVD S AMHTDOI=Y
 W AMHTPNM,AMHTFCN,$P(AMHTN,U),?12,AMHTDOI,?24,$P(AMHTN,U,3),!
 K AMHTDOI
 Q
 ;
PRTICD ;
 S:AMHTNRQ="" AMHTNRQ="<no narrative provided>" S AMHTICD=""
 S AMHTTXT=AMHTICD D PRTTXT
 Q
 ;
PRTTXT ; GENERALIZED TEXT PRINTER
 S AMHTDLT=1,AMHTILN=80-AMHTICL-1
 I AMHTDOO]"" S AMHTNRQ=AMHTNRQ_"  (ONSET: "_AMHTDOO_")"
 F AMHTQ=0:0 S:AMHTNRQ]""&(($L(AMHTNRQ)+$L(AMHTTXT)+2)<255) AMHTTXT=$S(AMHTTXT]"":AMHTTXT_"; ",1:"")_AMHTNRQ,AMHTNRQ="" Q:AMHTTXT=""  D PRTTXT2
 K AMHTILN,AMHTDLT,AMHTF,AMHTC,AMHTTXT,AMHTDOO
 Q
PRTTXT2 D GETFRAG W ?AMHTICL W AMHTF,! S AMHTICL=AMHTICL+AMHTDLT,AMHTILN=AMHTILN-AMHTDLT,AMHTDLT=0
 Q
GETFRAG I $L(AMHTTXT)<AMHTILN S AMHTF=AMHTTXT,AMHTTXT="" Q
 F AMHTC=AMHTILN:-1:1 Q:$E(AMHTTXT,AMHTC)=" "
 S AMHTF=$E(AMHTTXT,1,AMHTC-1),AMHTTXT=$E(AMHTTXT,AMHTC+1,255)
 Q
 ;
 ;
GETSITE ;
 S:AMHTITE="" AMHTITE="null"
 S %=$G(^AUTTLOC(AMHTITE,0))
 S AMHTNFL=$P(%,U),AMHTNFL=$S($D(^DIC(4,AMHTITE,0)):$P(^(0),U),1:"<"_AMHTITE_">")
 S AMHTNSH=$P(%,U,2) I AMHTNSH="" S AMHTNSH="<"_AMHTITE_">"
 S AMHTNAB=$J($P(%,U,7),4) I AMHTNAB="" S AMHTNAB="<"_AMHTITE_">"
 Q