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

AMHBPL.m

Go to the documentation of this file.
AMHBPL ; IHS/CMI/LAB - PROBLEM LIST UPDATE ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**2,4**;JUN 18, 2010;Build 28
 ;; ;
START(AMHR) ;EP
 I '$G(AMHR) Q
 I '$D(^AMHREC(AMHR,0)) Q
 NEW DFN,AMHPAT,AMHLOC,AMHDATE,AMHBHPL,AMHLINE,AMHPRCNT
 S (DFN,AMHPAT)=$P($G(^AMHREC(AMHR,0)),U,8)
 S AMHDATE=$P($P(^AMHREC(AMHR,0),U,1),".")
 S AMHLOC=$P(^AMHREC(AMHR,0),U,4)
 S AMHOVRR=1
 S APCDOVRR=1
 I '$G(AUPNDOB) S Y=DFN D ^AUPNPAT
 D EN1
 D FULL^VALM1
 D EXIT
 ;D EOJ
 Q
EOJ ;End of job cleanup
 D:$D(VALMWD) CLEAR^VALM1 ;clears out all list man stuff
 K ^TMP($J,"AMHBPL")
 K XQORNEST,VALMKEY,VALM,VALMAR,VALMBCK,VALMBG,VALMCAP,VALMCNT,VALMOFF,VALMMCON,VALMDN,VALMEVL,VALMIOXY,VALMKEY,VALMLFT,VALMLST,VALMMENU,VALMSGR,VALMUP,VALMWD,VALMY,XQORS,XQORSPEW
 K AMHBPLPT,AMHLOC,AMHPAT,AMHDATE,AMHPIEN,AMHAF,AMHPRB,AMHLOOK,AMHPDFN
 ;D KILL^AUPNPAT
 Q
EN1 ;PEP - requires DFN to be set to patient
 K ^TMP($J,"AMHBPL")
 Q:'$G(DFN)
 S AMHBPLPT=DFN
 Q:'$G(AMHBPLPT)
 Q:'$D(^AUPNPAT(AMHBPLPT))
 Q:'$D(^DPT(AMHBPLPT))
 ;S Y=AMHBPLPT D ^AUPNPAT
 S AMHOVRR=1
 D EN
 K AMHBPLPT
 D FULL^VALM1
 D EXIT
 Q
EN ;PEP  main entry point for AMH BHPL PROBLEM LIST
 S VALMCC=1 ;1 means screen mode, 0 means scrolling mode
 D EN^VALM("AMH BHPL PROBLEM LIST")
 D CLEAR^VALM1
 Q
 ;
HDR ;EP -- header code
 S VALMHDR(1)=$TR($J(" ",80)," ","-")
 S VALMHDR(2)="Patient Name: "_IORVON_$P(^DPT(AMHBPLPT,0),U)_IOINORM_"   DOB: "_$$FTIME^VALM1(AUPNDOB)_"   Sex: "_$P(^DPT(AMHBPLPT,0),U,2)_"   HRN: "_$S($D(^AUPNPAT(AMHBPLPT,41,DUZ(2),0)):$P(^AUPNPAT(AMHBPLPT,41,DUZ(2),0),U,2),1:"????")
 S VALMHDR(3)=$TR($J(" ",80)," ","-")
 Q
 ;
INIT ; -- init variables and list array
 D GATHER ;gather up all problems
 S VALMCNT=AMHLINE ;this variable must be the total number of lines in list
 S AMHOVRR="" ;for provider narrative lookup
 Q
 ;
GATHER ;EP
 ;set up array containing list of problems
 ;**** see page 7 of List Manager Manual for info on how to
 ;**** set up the array that contains the list
 K AMHBHPL
 NEW AMHSX,AMHAF,AMHF,AMHPIEN,AMHPRB,AMHP0,AMHX,AMHC,AMHLR
 K AMHQUIT,AMHBPL S AMHPRCNT=0,AMHLINE=0
 I '$D(^AMHPPROB("AC",AMHBPLPT)) S AMHBHPL(1,0)="No BH Problems currently on file",AMHBHPL("IDX",1,1)="" S AMHLINE=1 ;Q
 S AMHSX=$$LASTPLR^AMHAPI6(AMHBPLPT,,DT,"A")
 I AMHSX S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)="BH Problem List Reviewed On: "_$$FMTE^XLFDT($P(AMHSX,U,1))_"  By: "_$E($P($G(^VA(200,+$P(AMHSX,U,3),0)),U),1,25)
 S AMHSX=$$LASTPLU^AMHAPI6(AMHBPLPT,,DT,"A")
 I AMHSX S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)="BH Problem List Updated On: "_$$FMTE^XLFDT($P(AMHSX,U,1))_"  By: "_$E($P($G(^VA(200,+$P(AMHSX,U,3),0)),U),1,25)
 S AMHSX=$$LASTNAP^AMHAPI6(AMHBPLPT,,DT,"A")
 ;I '$$ANYACTP^AMHAPRB(AMHBPLPT),AMHSX S AMHLINE=AMHLINE+1,^TMP($J,"AMHBPL",AMHLINE,0)="No Active BH Problems:    "_$$FMTE^XLFDT($P(AMHSX,U,1))_"  Documented By: "_$E($P($G(^VA(200,+$P(AMHSX,U,3),0)),U),1,25)
 I AMHSX S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)="No Active BH Problems Documented On: "_$$FMTE^XLFDT($P(AMHSX,U,1))_"  By: "_$E($P($G(^VA(200,+$P(AMHSX,U,3),0)),U),1,25)
 S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)="  "
 S AMHPRCNT=0
 S AMHAF="A" D GATHER1 S AMHAF="I" D GATHER1
 Q
GATHER1 ;
 S AMHF=0 F  S AMHF=$O(^AMHPPROB("AA",AMHBPLPT,AMHF)) Q:AMHF=""  D
 .S AMHPRB="" F  S AMHPRB=$O(^AMHPPROB("AA",AMHBPLPT,AMHF,AMHPRB)) Q:AMHPRB=""  D
 ..S AMHPIEN=AMHPRB,AMHP0=^AMHPPROB(AMHPIEN,0)
 ..Q:AMHAF'=$P(^AMHPPROB(AMHPIEN,0),U,12)
 ..;quit if not meet UU
 ..;Q:'$$ALLOWV^AMHUTIL(DUZ,$P(^AMHPPROB(AMHPIEN,0),U,6))  no UU per Wendy
 ..S AMHPRCNT=AMHPRCNT+1,AMHLINE=AMHLINE+1,AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN,AMHX=""
 ..S AMHX=AMHPRCNT,AMHX=AMHX_")  ",$E(AMHX,6)="DX: "_$$VAL^XBDIQ1(9002011.51,AMHPIEN,.01),$E(AMHX,20)="Status: "_IOUON_$$VAL^XBDIQ1(9002011.51,AMHPIEN,.12)_IOUOFF,$E(AMHX,50)="Last Modified: "_$$DATE^AMHVRL($P(AMHP0,U,3))
 ..S AMHBHPL(AMHLINE,0)=AMHX,AMHX="",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ..S AMHLINE=AMHLINE+1
 ..S $E(AMHX,6)="DSM Narrative: "_$$VAL^XBDIQ1(9002012.2,$P(AMHP0,U,1),.02)
 ..S AMHBHPL(AMHLINE,0)=AMHX,AMHX="",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ..S AMHLINE=AMHLINE+1
 ..S $E(AMHX,6)="Provider Narrative: "_$$VAL^XBDIQ1(9002011.51,AMHPIEN,.05)
 ..S AMHBHPL(AMHLINE,0)=AMHX,AMHX="",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ..S AMHLINE=AMHLINE+1
 ..S $E(AMHX,6)="Date of Onset: "_$$DATE^AMHVRL($P(AMHP0,U,13))_"   Facility: "_$$VAL^XBDIQ1(9002011.51,AMHPIEN,.06)
 ..S AMHBHPL(AMHLINE,0)=AMHX,AMHX="",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
NOTE ..;
 ..I '$D(^AMHPTP("AE",AMHPIEN)) D  Q
 ...S AMHLINE=AMHLINE+1
 ...S AMHX=""
 ...S AMHBHPL(AMHLINE,0)=AMHX,AMHX="",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ..S AMHC=0 S AMHTNDF=0 F  S AMHTNDF=$O(^AMHPTP("AE",AMHPIEN,AMHTNDF)) Q:'AMHTNDF  D
 ...S AMHNIEN=0 F  S AMHNIEN=$O(^AMHPTP("AE",AMHPIEN,AMHTNDF,AMHNIEN)) Q:AMHNIEN'=+AMHNIEN  D
 ....S AMHC=AMHC+1 I AMHC=1 S X=IOINORM_"        "_IORVON_"Notes:"_IORVOFF S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)=X,AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ....S AMHLR=$$VALI^XBDIQ1(9002011.53,AMHNIEN,.07) S AMHLR=$S(AMHLR=1:"STP",AMHLR=2:"LTP",1:"   ")
 ....S X="           "_AMHLR_" Note #"_AMHC_" Added: "_$S($P(^AMHPTP(AMHNIEN,0),U,5)]"":$$FMTE^XLFDT($P(^(0),U,5),5),1:"        ")
 ....S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)=X,AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ....S X="           Narrative:  "_$P(^AMHPTP(AMHNIEN,0),U,4)
 ...S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)=X,AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ..S AMHLINE=AMHLINE+1,AMHBHPL(AMHLINE,0)=IOINORM_"  ",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 ..;S AMHLINE=AMHLINE+1
 ..;S AMHX=""
 ..;S AMHBHPL(AMHLINE,0)=AMHX,AMHX="",AMHBHPL("IDX",AMHLINE,AMHPRCNT)=AMHPIEN
 .Q
 K AMHLR,AMHL,AMHX,AMHF
 Q
TEXT ;
 ;;
 ;;*****************************************************
 ;;* Update Behavioral Health/PCC Patient Problem List *
 ;;*****************************************************
 ;;
 Q
HELP ; -- help code
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ; -- exit code
 K AMHBHPL
 K AMHPRCNT,AMHBPL,AMHLINE,AMHX,AMHP0,AMHC,AMHL,AMHLR,AMHPIEN,AMHAF,AMHPRB,AMHOVRR,AMHLOOK,AMHPDFN,AMHLOC,AMHDATE
 K X,Y
 K VALMHDR
 Q
 ;
EXPND ; -- expand code
 Q
 ;
ANYNONUU(P,R) ;EP - any problem that is allowed to be seen?
 NEW G,A,B,C
 I '$G(P) Q ""
 I '$G(R) Q ""
 S G=0
 S A=0 F  S A=$O(^AMHPPROB("AC",P,A)) Q:A'=+A!(G)  D
 .Q:$P(^AMHPPROB(A,0),U,12)="D" Q  ;deleted
 .S B=$P(^AMHPPROB(A,0),U,6)
 .Q:'$$ALLOWV^AMHUTIL(R,B)
 .S G=1
 Q G