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

APCDETP1.m

Go to the documentation of this file.
APCDETP1 ; IHS/CMI/LAB - treatment plan update ; 
 ;;2.0;IHS PCC SUITE;**2,11**;MAY 14, 2009;Build 58
 ;
PL ;EP
 D EN1^APCDPL
 D EXIT
 Q
HS ;EP - Display Patient Profile
 D FULL^VALM1
 S X="" I DUZ(2),$D(^APCCCTRL(DUZ(2),0))#2 S X=$P(^(0),U,3) I X,$D(^APCHSCTL(X,0)) S X=$P(^APCHSCTL(X,0),U)
 I $D(^DISV(DUZ,"^APCHSCTL(")) S Y=^("^APCHSCTL(") I $D(^APCHSCTL(Y,0)) S X=$P(^(0),U,1)
 S:X="" X="ADULT REGULAR"
 K DIC,DR,DD S DIC("B")=X,DIC="^APCHSCTL(",DIC(0)="AEMQ" D ^DIC K DIC,DA,DD,D0,D1,DQ
 I Y=-1 D PAUSE,EXIT Q
 S APCDPLPT=DFN
 S APCHSTYP=+Y,APCHSPAT=DFN
 S APCDHDR="PCC Health Summary for "_$P(^DPT(APCDPLPT,0),U)
 D VIEWR^XBLM("EN^APCHS",APCDHDR)
 S (DFN,Y)=APCDPLPT D ^AUPNPAT
 K APCHSPAT,APCHSTYP,APCHSTAT,APCHSMTY,AMCHDAYS,AMCHDOB,APCDHDR
 D EXIT
 Q
ADD ;EP
 D FULL^VALM1
 I '$D(DFN) W !!,"Patient not entered." H 5 Q
 NEW APCDTPT,APCDTDI,APCDTRP,APCDTDX,APCDTPTN,APCDTRPN,APCDTP
 D HEADER
 W !,"Creating new Treatment Plan..."
TYPE ;
 K DIR
 S APCDTPT="",APCDTPTN=""
 W !!,"Enter Treatment Plan Type"
 K DIC
 S DIC="^AUTTTPL(",DIC(0)="AEMQ" D ^DIC K DIC
 I Y=-1 D EXIT Q
 S APCDTPT=+Y,APCDTPTN=$P(Y,U,2)
 S APCDOTHT=""
 I APCDTPTN'="OTHER" G DI
TYPEO ;
 S DIR(0)="9000094,.15",DIR("A")="Enter OTHER Type" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G TYPE
 I Y="" W !!,"Required!" G TYPE
 S APCDOTHT=Y
DI ;
 W !!
 S APCDTDI=""
 S DIR(0)="D^:"_DT_":EP",DIR("A")="Enter Date Initiated" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G TYPE
 S APCDTDI=Y
RP ;
 W !!
 K DIC
 S APCDTRP="",APCDTRPN=""
 S DIC=200,DIC("A")="Enter Responsible Provider: ",DIC(0)="AEMQ",DIC("S")="I $D(^VA(200,""AK.PROVIDER"",$P($G(^VA(200,+Y,0)),U),+Y)),$P($G(^VA(200,+Y,""PS"")),U,4)="""""
 D ^DIC
 I Y=-1 G DI
 S APCDTRP=+Y,APCDTRPN=$P(Y,U,2)
DX ;
 K DIC
 S APCDTDX=""
 W !!,"Please enter the diagnosis associated with this treatment plan.",!
 ;K DIC,DIADD,DLAYGO
 ;S DIC="^ICD9(",DIC(0)="AEMQ",APCDDATE=APCDTDI,DIC("S")="D ICD^AUPNCIX(+Y,,$G(APCDTDI))" D ^DIC K DIC
 ;I Y=-1 G RP
 ;S APCDTDX=+Y
 D ^APCDETPD
 I $D(APCDTERR) W !,"A valid code was not selected." G DX
 I '$G(APCDTDX) W !,"A valid code was not selected." D PAUSE G RP
CONT ;
 W !!!,"A Treatment Plan is going to be added for ",$P(^DPT(DFN,0),U)
 W !,"with the following data:"
 W !?5,"Type: ",APCDTPTN I APCDOTHT]"" W ?40,APCDOTHT
 W !?5,"Date Initiated: ",$$FMTE^XLFDT(APCDTDI)
 W !?5,"Responsible Provider: ",APCDTRPN
 W !?5,"Diagnosis: ",$P($$ICDDX^ICDEX(APCDTDX,APCDTDI),U,2)
 W !
 W !! S DIR(0)="Y",DIR("A")="Do you want to continue to add this Treatment Plan",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) D EXIT Q
 I 'Y D EXIT Q
 Q:'Y
 S X=APCDTPT
 K DD,D0,DO,DINUM,DIC,DA,DR S DIC(0)="EALMQ",DIC="^AUPNTP(",DLAYGO=9000094,DIADD=1
 S DIC("DR")=".02////"_DFN_";.03////"_APCDTDI_";.06////"_APCDTDX_";.07////"_APCDTRP_";.08////"_DT_";.09////"_DUZ_";.15///"_APCDOTHT
 D FILE^DICN K DIC,DR,DIE,DIADD,DLAYGO,X,D0
 I Y=-1 W !!,"Error creating treatment plan." H 2 D EXIT Q
 S APCDTP=+Y
 S DA=APCDTP,DDSFILE=9000094,DR="[APCD EDIT TREATMENT PLAN]" D ^DDS K DDSFILE,DR,DA
 D EXIT
 Q
EDITR ;EP
 NEW APCDTPN,APCDTP
 K DIR S DIR(0)="N^1:"_APCDRCNT_":0",DIR("A")="Select Treatment Plan" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No treatment plan selected." D EXIT Q
 S APCDTPN=+Y I 'APCDTPN K APCDTP,VALMY,XQORNOD W !,"No treatment plan selected." D EXIT Q
 S APCDTP=$O(APCDPTP("IDX",APCDTPN,0)) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 S APCDTP=APCDPTP("IDX",APCDTPN,APCDTP) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 I '$D(^AUPNTP(APCDTP,0)) W !,"Not a valid TREATMENT PLAN." D PAUSE,EXIT Q
 D FULL^VALM1
EDIT ;
 W:$D(IOF) @IOF
 D EDT
 D EXIT
 Q
EDT ;
 S DA=APCDTP,DIE="^AUPNTP(",DR=".08////"_DT_".09////"_DUZ D ^DIE K DIE,DR,DA
 S DA=APCDTP,DDSFILE=9000094,DR="[APCD EDIT TREATMENT PLAN]" D ^DDS K DDSFILE,DR,DA
 Q
DISP ;EP
 K DIR S DIR(0)="N^1:"_APCDRCNT_":0",DIR("A")="Select Treatment Plan" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No treatment plan selected." G EXIT
 S APCDTPN=+Y I 'APCDTPN K APCDTP,VALMY,XQORNOD W !,"No treatment plan selected." G EXIT
 S APCDTP=$O(APCDPTP("IDX",APCDTPN,0)) I 'APCDTP K APCDTDEL,APCDTP D PAUSE,EXIT Q
 S APCDTP=APCDPTP("IDX",APCDTPN,APCDTP) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 I '$D(^AUPNTP(APCDTP,0)) W !,"Not a valid TREATMENT PLAN." K APCDTDEL,APCDTP D PAUSE,EXIT Q
 D FULL^VALM1
 D DIQ^XBLM(9000094,APCDTP) K DIC,DA
 D EXIT
 Q
REV ;EP
 NEW APCDTP,APCDTPN,APCDTRP
 K DIR S DIR(0)="N^1:"_APCDRCNT_":0",DIR("A")="Select Treatment Plan" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No treatment plan selected." G EXIT
 S APCDTPN=+Y I 'APCDTPN K APCDTP,VALMY,XQORNOD W !,"No treatment plan selected." G EXIT
 S APCDTP=$O(APCDPTP("IDX",APCDTPN,0)) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 S APCDTP=APCDPTP("IDX",APCDTPN,APCDTP) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 I '$D(^AUPNTP(APCDTP,0)) W !,"Not a valid TREATMENT PLAN." K APCDTDEL,APCDTP D PAUSE,EXIT Q
 D FULL^VALM1
 W:$D(IOF) @IOF
REV1 ;
 S DIR(0)="S^E:Edit the Plan;D:Display the Plan;R:Continue on to enter the Review Information;X:Exit",DIR("A")="Choose an Action",DIR("B")="R" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) D EXIT Q
 I Y="E" D EDT G REV1
 I Y="D" D DIQ^XBLM(9000094,APCDTP) K DIC,DA D FULL^VALM1 G REV1
 I Y="X" D EXIT Q
 W !!,"Reviews currently on file:"
 S X=0 F  S X=$O(^AUPNTP(APCDTP,18,X)) Q:X'=+X  W !?5,$$FMTE^XLFDT($P(^AUPNTP(APCDTP,18,X,0),U)),?40,"Reviewed by: " I $P(^AUPNTP(APCDTP,18,X,0),U,2) W $P(^VA(200,$P(^AUPNTP(APCDTP,18,X,0),U,2),0),U)
 W !
 S APCDTRP=$P(^AUPNTP(APCDTP,0),U,7)
 S DA=APCDTP,DIE="^AUPNTP(",DR="[APCD TP REVIEW]",DIE("NO^")=1 D ^DIE K DIE,DR,DA
 D EXIT
 Q
DISC ;EP
 NEW APCDTP,APCDTPN,APCDTRP
 K DIR S DIR(0)="N^1:"_APCDRCNT_":0",DIR("A")="Select Treatment Plan" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No treatment plan selected." G EXIT
 S APCDTPN=+Y I 'APCDTPN K APCDTP,VALMY,XQORNOD W !,"No treatment plan selected." G EXIT
 S APCDTP=$O(APCDPTP("IDX",APCDTPN,0)) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 S APCDTP=APCDPTP("IDX",APCDTPN,APCDTP) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 I '$D(^AUPNTP(APCDTP,0)) W !,"Not a valid TREATMENT PLAN." K APCDTDEL,APCDTP D PAUSE,EXIT Q
 D FULL^VALM1
 W:$D(IOF) @IOF
DISC1 ;
 S DIR(0)="S^E:Edit the Plan;D:Display the Plan;R:Continue on to enter the Discontinue Information;X:Exit",DIR("A")="Choose an Action",DIR("B")="R" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) D EXIT Q
 I Y="E" D EDT G DISC1
 I Y="D" D DIQ^XBLM(9000094,APCDTP) D FULL^VALM1 K DIC,DA G DISC1
 I Y="X" D EXIT Q
 W !
 S APCDTRP=$P(^AUPNTP(APCDTP,0),U,7)
 S DA=APCDTP,DIE="^AUPNTP(",DR="[APCD TP DISCONTINUED]",DIE("NO^")=1 D ^DIE K DIE,DR,DA
 D EXIT
 Q
DELETE ;EP
 NEW APCDTP,APCDTPN
 K DIR S DIR(0)="N^1:"_APCDRCNT_":0",DIR("A")="Select Treatment Plan" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No treatment plan selected." G EXIT
 S APCDTPN=+Y I 'APCDTPN K APCDTP,VALMY,XQORNOD W !,"No treatment plan selected." G EXIT
 S APCDTP=$O(APCDPTP("IDX",APCDTPN,0)) I 'APCDTP K APCDTDEL,APCDTP D PAUSE,EXIT Q
 S APCDTP=APCDPTP("IDX",APCDTPN,APCDTP) I 'APCDTP K APCDTP D PAUSE,EXIT Q
 I '$D(^AUPNTP(APCDTP,0)) W !,"Not a valid TREATMENT PLAN." K APCDTP D PAUSE,EXIT Q
 D FULL^VALM1
DEL ;
 W !! S DIR(0)="Y",DIR("A")="Are you sure you want to DELETE this Treatment Plan",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 Q:$D(DIRUT)
 Q:'Y
 W !,"Deleting Treatment Plan..." S DA=APCDTP,DIK="^AUPNTP(" D ^DIK K DA,DIK
 W !!,"Treatment Plan for ",$P(^DPT(DFN,0),U)," DELETED." D PAUSE
 D EXIT
 Q
PAUSE ;EP
 S DIR(0)="EO",DIR("A")="Press enter to continue...." D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 Q
 W:$D(IOF) @IOF
 W !,$TR($J(" ",80)," ","-"),!,"Patient Name:  ",$P(^DPT(DFN,0),U),"   DOB:  ",$$FTIME^VALM1($P(^DPT(DFN,0),U,3)),"  Sex:  ",$$VAL^XBDIQ1(2,DFN,.02),!,$TR($J(" ",80)," ","-")
 Q
EXIT ;
 D TERM^VALM0
 S VALMBCK="R"
 D GATHER^APCDETP
 S VALMCNT=APCDLINE
 D HDR^APCDETP
 Q