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

APCDPG.m

Go to the documentation of this file.
  1. APCDPG ; IHS/CMI/LAB - GOAL LIST UPDATE ;
  1. ;;2.0;IHS PCC SUITE;**7**;MAY 14, 2009
  1. ;; ;
  1. START ;
  1. W:$D(IOF) @IOF
  1. F J=1:1:5 S X=$P($T(TEXT+J),";;",2) W !?80-$L(X)\2,X
  1. K X,J
  1. W !!
  1. S APCDPGPT="" F D GETPAT Q:APCDPGPT="" S DFN=APCDPGPT D EN1,FULL^VALM1,EXIT K APCDPGPT
  1. D EOJ
  1. Q
  1. GETPAT ;get patient
  1. K ^TMP($J,"APCDPG")
  1. K APCDPGPT,APCDLOC,APCDPAT,APCDDATE,APCDPIEN,APCDAF,APCDPGI,APCDOVRR,APCDLOOK,APCDPDFN
  1. D KILL^AUPNPAT
  1. S APCDPGPT=""
  1. I '$P($G(^APCDSITE(DUZ(2),0)),U,34) S AUPNLK("INAC")=1
  1. W !
  1. S DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
  1. Q:Y<0
  1. S APCDPGPT=+Y
  1. D INAC^APCDEA(APCDPGPT,.X) I 'X S APCDPGPT="" Q
  1. D DOD(APCDPGPT,.X) I 'X S APCDPGPT="" Q
  1. Q
  1. GETLOC ;
  1. S APCDLOC="",DIC="^AUTTLOC(",DIC(0)="AEMQ",DIC("B")=$P(^DIC(4,$S($G(APCDLOC):APCDLOC,1:DUZ(2)),0),U),DIC("A")="Location where GOAL List update occurred: " D ^DIC K DIC
  1. Q:Y<0
  1. S APCDLOC=+Y
  1. Q
  1. GETDATE ;
  1. S APCDDATE=""
  1. W !!,"Date GOAL List Updated: " R X:$S($D(DTIME):DTIME,1:300) S:'$T X=""
  1. Q:X=""!(X="^")
  1. S %DT="ET" D ^%DT G:Y<0 GETDATE
  1. I Y>DT W " <Future dates not allowed>",$C(7),$C(7) K X G GETDATE
  1. S APCDDATE=Y
  1. Q
  1. EOJ ;End of job cleanup
  1. D:$D(VALMWD) CLEAR^VALM1 ;clears out all list man stuff
  1. K ^TMP($J,"APCDPG")
  1. K XQORNEST,VALMKEY,VALM,VALMAR,VALMBCK,VALMBG,VALMCAP,VALMCNT,VALMOFF,VALMMCON,VALMDN,VALMEVL,VALMIOXY,VALMKEY,VALMLFT,VALMLST,VALMMENU,VALMSGR,VALMUP,VALMWD,VALMY,XQORS,XQORSPEW
  1. K APCDPGPT,APCDLOC,APCDPAT,APCDDATE,APCDPIEN,APCDAF,APCDPGI,APCDOVRR,APCDLOOK,APCDPDFN
  1. D KILL^AUPNPAT
  1. Q
  1. EN1 ;PEP - requires DFN to be set to patient
  1. K ^TMP($J,"APCDPG")
  1. Q:'$G(DFN)
  1. S APCDPGPT=DFN
  1. Q:'$G(APCDPGPT)
  1. Q:'$D(^AUPNPAT(APCDPGPT))
  1. Q:'$D(^DPT(APCDPGPT))
  1. S Y=APCDPGPT D ^AUPNPAT
  1. D GETLOC
  1. I '$G(APCDLOC) D EXIT Q
  1. D GETDATE
  1. I '$G(APCDDATE) D EXIT Q
  1. S APCDOVRR=1
  1. D EN
  1. K APCDPGPT
  1. D FULL^VALM1
  1. D EXIT
  1. Q
  1. EN2 ;PEP - can be called to update GOAL list, called from applications outside of PCC
  1. D GETPAT
  1. D EN
  1. D FULL^VALM1
  1. D EXIT
  1. Q
  1. ENDE ;EP - for data entry PL call
  1. Q:'$G(DFN)
  1. S APCDPGPT=DFN
  1. Q:'$G(APCDPGPT)
  1. Q:'$D(^AUPNPAT(APCDPGPT))
  1. Q:'$D(^DPT(APCDPGPT))
  1. S Y=APCDPGPT D ^AUPNPAT
  1. S APCDLOC=APCDPLL
  1. I '$G(APCDLOC) D EXIT Q
  1. S APCDDATE=APCDPLD
  1. I '$G(APCDDATE) D EXIT Q
  1. S APCDV=$G(APCDPLV)
  1. S APCDOVRR=1
  1. D EN
  1. K APCDPGPT
  1. D FULL^VALM1
  1. D EXIT
  1. Q
  1. EN ;PEP main entry point for APCD PG GOAL LIST
  1. S VALMCC=1 ;1 means screen mode, 0 means scrolling mode
  1. D EN^VALM("APCD PG GOAL LIST")
  1. D CLEAR^VALM1
  1. Q
  1. ;
  1. HDR ;EP -- header code
  1. S VALMHDR(1)=$TR($J(" ",80)," ","-")
  1. S VALMHDR(2)="Patient Name: "_IORVON_$P(^DPT(APCDPGPT,0),U)_IOINORM_" DOB: "_$$FTIME^VALM1(AUPNDOB)_" Sex: "_$P(^DPT(APCDPGPT,0),U,2)_" HRN: "_$S($D(^AUPNPAT(APCDPGPT,41,DUZ(2),0)):$P(^AUPNPAT(APCDPGPT,41,DUZ(2),0),U,2),1:"????")
  1. S VALMHDR(3)="'Active Goals are listed first followed by Goals not set."
  1. S VALMHDR(4)="Inactive goals are not listed."
  1. S VALMHDR(5)=$TR($J(" ",80)," ","-")
  1. Q
  1. ;
  1. INIT ; -- init variables and list array
  1. D GATHER ;gather up all GOALs
  1. S VALMCNT=APCDLINE ;this variable must be the total number of lines in list
  1. S APCDOVRR="" ;for provider narrative lookup
  1. Q
  1. ;
  1. GATHER ;EP
  1. ;set up array containing list of GOALs
  1. ;**** see page 7 of List Manager Manual for info on how to
  1. ;**** set up the array that contains the list
  1. K APCDPG
  1. NEW APCDSX
  1. K APCDQUIT,APCDPG S APCDRCNT=0,APCDLINE=0
  1. I '$D(^AUPNGOAL("AC",APCDPGPT)) S APCDPG(1,0)="No GOALs currently on file",APCDPG("IDX",1,1)="" S APCDLINE=1 ;Q
  1. S APCDLINE=APCDLINE+1,APCDPG(APCDLINE,0)=" "
  1. S APCDRCNT=0
  1. S APCDAF="A" D GATHER1 S APCDAF="N" D GATHER1
  1. Q
  1. GATHER1 ;
  1. S APCDF=0 F S APCDF=$O(^AUPNGOAL("AA",APCDPGPT,APCDF)) Q:APCDF'=+APCDF D
  1. .S APCDPGI="" F S APCDPGI=$O(^AUPNGOAL("AA",APCDPGPT,APCDF,APCDPGI)) Q:APCDPGI="" S APCDPIEN=$O(^(APCDPGI,"")),APCDP0=^AUPNGOAL(APCDPIEN,0) D
  1. ..Q:$P(^AUPNGOAL(APCDPIEN,0),U,11)="D" ;NO DELETED
  1. ..;Q:$P(^AUPNGOAL(APCDPIEN,0),U,1)="N"
  1. ..Q:$P(^AUPNGOAL(APCDPIEN,0),U,11)="ME"
  1. ..Q:$P(^AUPNGOAL(APCDPIEN,0),U,11)="C"
  1. ..Q:$P(^AUPNGOAL(APCDPIEN,0),U,11)="S"
  1. ..I APCDAF="A" Q:$P(^AUPNGOAL(APCDPIEN,0),U,1)'="S"
  1. ..I APCDAF="N" Q:$P(^AUPNGOAL(APCDPIEN,0),U,1)'="N"
  1. ..S APCDRCNT=APCDRCNT+1,APCDLINE=APCDLINE+1,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN,APCDX=""
  1. ..S APCDX=$$SETSTR^VALM1($J(APCDRCNT,2),APCDX,3,2),APCDX=$$SETSTR^VALM1(") GOAL ID: ",APCDX,5,11)
  1. ..S X=$S($P(^AUTTLOC(APCDF,0),U,7)]"":$J($P(^(0),U,7),4),1:"??")_$P(APCDP0,U,7),APCDX=$$SETSTR^VALM1(X,APCDX,16,10)
  1. ..S APCDX=$$SETSTR^VALM1("Status: ",APCDX,27,8),X=$$VAL^XBDIQ1(9000093,APCDPIEN,.01)_$S($P(APCDP0,U,11)]"":" - "_$$VAL^XBDIQ1(9000093,APCDPIEN,.11),1:""),APCDX=$$SETSTR^VALM1(X,APCDX,36,26)
  1. ..;S X="Created: "_$$DATE($P(APCDP0,U,3))_" By: "_$$VAL^XBDIQ1(9000093,APCDPIEN,.04)
  1. ..;S APCDX=$$SETSTR^VALM1(X,APCDX,63,20)
  1. ..S APCDPG(APCDLINE,0)=APCDX,APCDX="",APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. ..S APCDLINE=APCDLINE+1
  1. ..I $P(^AUPNGOAL(APCDPIEN,0),U,1)="S" S APCDX=" Goal Start Date: "_$$DATE($P(APCDP0,U,9))_" Goal Follow up Date: "_$$DATE($P(APCDP0,U,10))
  1. ..I $P(^AUPNGOAL(APCDPIEN,0),U,1)="N" S APCDX=" Goal Created Date: "_$$DATE($P(APCDP0,U,3))
  1. ..S APCDPG(APCDLINE,0)=APCDX,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. ..;goal name, reason
  1. ..S APCDLINE=APCDLINE+1
  1. ..S APCDX=" Goal Name: "_$$VAL^XBDIQ1(9000093,APCDPIEN,1101)
  1. ..S APCDPG(APCDLINE,0)=APCDX,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. ..S APCDLINE=APCDLINE+1
  1. ..S APCDX=$S($P(^AUPNGOAL(APCDPIEN,0),U,1)="S":" Goal Reason: ",1:" Reason Goal Not Set: ")_$$VAL^XBDIQ1(9000093,APCDPIEN,1201)
  1. ..S APCDPG(APCDLINE,0)=APCDX,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. ..S APCDLINE=APCDLINE+1
  1. ..S APCDX=" Provider: "_$$VAL^XBDIQ1(9000093,APCDPIEN,.08)
  1. ..S APCDPG(APCDLINE,0)=APCDX,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. ..I $O(^AUPNGOAL(APCDPIEN,13,0)) S APCDX=" Review/Progress Notes on file, use DD to see full display." D
  1. ...S APCDLINE=APCDLINE+1,APCDPG(APCDLINE,0)=APCDX,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. STEP ..S APCDC=0 I $O(^AUPNGOAL(APCDPIEN,21,0)) D
  1. ...S (APCDC,APCDL)=0 F S APCDL=$O(^AUPNGOAL(APCDPIEN,21,APCDL)) Q:APCDL'=+APCDL I $O(^AUPNGOAL(APCDPIEN,21,APCDL,11,0)) S APCDLR=$P(^AUTTLOC($P(^AUPNGOAL(APCDPIEN,21,APCDL,0),U),0),U,7) D
  1. ....S APCDX=0 F S APCDX=$O(^AUPNGOAL(APCDPIEN,21,APCDL,11,APCDX)) Q:APCDX'=+APCDX D
  1. .....Q:$P(^AUPNGOAL(APCDPIEN,21,APCDL,11,APCDX,0),U,9)="D"
  1. .....S APCDC=APCDC+1 I APCDC=1 S X=IOINORM_" "_IORVON_"Steps:"_IORVOFF S APCDLINE=APCDLINE+1,APCDPG(APCDLINE,0)=X,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. .....S X=" "_APCDLR_" Step#"_APCDC,$E(X,25)=$P($G(^AUPNGOAL(APCDPIEN,21,APCDL,11,APCDX,11)),U,1)
  1. .....S APCDLINE=APCDLINE+1,APCDPG(APCDLINE,0)=X,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. .....S X="",$E(X,12)="Status: "_$E($$SS($P($G(^AUPNGOAL(APCDPIEN,21,APCDL,11,APCDX,0)),U,9)),1,15)
  1. .....S $E(X,38)="Start Date: "_$$DATE($P(^AUPNGOAL(APCDPIEN,21,APCDL,11,APCDX,0),U,5)),$E(X,60)="F/U Date: "_$$DATE($P(^AUPNGOAL(APCDPIEN,21,APCDL,11,APCDX,0),U,6))
  1. .....S APCDLINE=APCDLINE+1,APCDPG(APCDLINE,0)=X,APCDPG("IDX",APCDLINE,APCDRCNT)=APCDPIEN
  1. ..Q
  1. .Q
  1. K APCDLR,APCDL,APCDX,APCDF
  1. Q
  1. TEXT ;
  1. ;;Patient Care Component (PCC)
  1. ;;
  1. ;;***********************************
  1. ;;* Update PCC Patient GOAL List *
  1. ;;***********************************
  1. ;;
  1. Q
  1. HELP ; -- help code
  1. S X="?" D DISP^XQORM1 W !!
  1. Q
  1. ;
  1. EXIT ; -- exit code
  1. K ^TMP($J,"APCDPG")
  1. K APCDRCNT,APCDPG,APCDLINE,APCDX,APCDP0,APCDC,APCDL,APCDLR,APCDPIEN,APCDAF,APCDPGI,APCDOVRR,APCDLOOK,APCDPDFN,APCDLOC,APCDDATE
  1. K X,Y
  1. K VALMHDR
  1. Q
  1. ;
  1. EXPND ; -- expand code
  1. Q
  1. ;
  1. DATE(D) ;EP
  1. I D="" Q ""
  1. Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
  1. DOD(P,RETVAL) ;EP - called to check to see if patient is inactive
  1. S RETVAL=1
  1. I $P($G(^DPT(P,.35)),U,1)]"" D Q
  1. .W !!,"***Warning*** You have selected a patient who is deceased.",!
  1. .K DIR S DIR(0)="Y",DIR("A")="Do you wish to continue to add data for this patient",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. .I $D(DIRUT) S RETVAL=0
  1. .S RETVAL=Y
  1. Q
  1. SS(%) ;EP
  1. I %="A" Q "ACTIVE"
  1. I %="MA" Q "MAINTAINING STEP"
  1. I %="ME" Q "STEP MET"
  1. I %="S" Q "STEP STOPPED"
  1. I %="D" Q "DELETED"
  1. Q "??"