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

AMHDMHPL.m

Go to the documentation of this file.
AMHDMHPL ; IHS/CMI/LAB - Display Problems and Notes ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**5**;JUN 02, 2010;Build 18
 ;Called from data entry templates to display problems, AMHPAT must equal the patient DFN
EN ;EP
 Q:'$G(AMHPAT)
 W:$D(IOF) @IOF
 W !!,"BEHAVIORAL HEALTH Diagnosis 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
 I $G(AMHPLC)=9 D PAUSE^AMHLEA
 K AMHTCVD,AMHTQ,Y,%
 D PROBX
 Q
COMMON ;
 I '$D(^AMHPPROB("AC",AMHPAT)) W !,"*****      No BH Problems on file for this Patient",! Q
 K AMHTDFT S AMHTNDF=0
 S AMHTPRB="" F AMHTQ=0:0 S AMHTPRB=$O(^AMHPPROB("AA",AMHPAT,AMHTPRB)) Q:AMHTPRB=""  S AMHTDFN=$O(^(AMHTPRB,"")) S:$P(^AMHPPROB(AMHTDFN,0),U,12)=AMHTTAT AMHTNDF=AMHTNDF+1,AMHTDFT(AMHTPRB)=AMHTDFN
 Q:AMHTNDF=0
 W !!?10,"*****  ",$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,AMHTFAC,AMHTPLN,AMHTPBN,AMHTDTM,AMHTDTN,AMHTPRB,AMHTTAT,AMHTNFP,AMHTNRQ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AMHTDFN,AMHTNDF,"")) Q:X=""
 S AMHTN=^AMHPTP(X,0)
 ;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
 S AMHTTPT=$P(AMHTN,U,7) S AMHTTPT=$S(AMHTTPT=1:"STP",AMHTTPT=2:"LTP",1:"   ")
 S AMHDMHPL("AUTH")=$P(AMHTN,U,6) S AMHDMHPL("AUTH")=$S(AMHDMHPL("AUTH")]"":$P(^VA(200,AMHDMHPL("AUTH"),0),U,2),1:"???")
 I $Y>(IOSL-3) D FF
 W ?1,AMHTPNM_"-"_$P(AMHTN,U),?7,AMHTTPT,?11,AMHTDOI,?20,AMHDMHPL("AUTH")
 S AMHTNRQ=$P(AMHTN,U,4),AMHTICL=24,AMHTTXT="" S:AMHTNRQ="" AMHTNRQ="<<<NO NOTE NARRATIVE>>>" D PRTTXT
 K AMHTDOI,AMHTTPT,AMHDMHPL("AUTH")
 Q
 ;
PRTICD ;
 S:AMHTNRQ="" AMHTNRQ="<no narrative provided>"
 D PRTTXT
 Q
 ;
PRTTXT ; GENERALIZED TEXT PRINTER
 S AMHTDLT=1,AMHTILN=80-AMHTICL-1
 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
 I $Y>(IOSL-3) D FF
 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
FF ;
 I $E(IOST)="C",IO=IO(0) W ! S DIR("A")="Press enter to continue",DIR(0)="EO" D ^DIR K DIR
 W:$D(IOF) @IOF
 Q