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

ACDPVDSP.m

Go to the documentation of this file.
ACDPVDSP ;IHS/ADC/EDE/KML - DISPLAY PATIENT VISIT; 
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
 ; This routine displays a patient's CDMIS visit with subordinate
 ; file entries.
 ;
START ;
 W !
 F  D PATLOOP Q:ACDQ
 D EOJ
 Q
 ;
PATLOOP ; DISPLAY PATIENTS UNTIL DONE
 D GETPAT
 Q:ACDQ
 D GETVSITS^ACDDEU ;       gather all visits for patient
 Q:ACDQ
 D SELECT ;                select visit to display
 Q:ACDQ
 D DISPLAY
 D DEV^ACDDEU Q:ACDQ
 I $D(ACDSLAVE)!(IO'=IO(0)) D DISPTAG
 K ACDSLAVE S IO=IO(0)
 U 0
 Q
 ;
GETPAT ; GET PATIENT
 S ACDQ=1
 S AUPNLK("ALL")=1
 S DIC="^AUPNPAT(",DIC(0)="AEMQ",DIC("S")="I $D(^ACDVIS(""D"",+Y))" D DIC^ACDFMC
 K AUPNLK("ALL")
 Q:Y<0
 S ACDDFNP=+Y,ACDDFN=$P(^DPT(ACDDFNP,0),U)
 S ACDQ=0
 Q
 ;
SELECT ; SELECT A CDMIS VISIT
 S ACDQ=1
 W !
 S ACDVIEN=0
 K ACDVLST
 I $O(^TMP("ACD",$J,"VISITS",0))="" W !,"----------",!,"No CDMIS visits!",!,"----------",! Q
 S ACDDTLOW=0,ACDDTHI=9999999
 I ACDVCNT>20 D GETDTRNG Q:ACDQ  W !
 S ACDQ=1
 W !
 S ACDLC=0
 S ACDX=ACDDTLOW S:ACDX>0 ACDX=ACDX-1
 F  S ACDX=$O(^TMP("ACD",$J,"VISITS",ACDX)) Q:ACDX=""  I ACDX'<ACDDTLOW,ACDX'>ACDDTHI S ACDY=0 F  S ACDY=$O(^TMP("ACD",$J,"VISITS",ACDX,ACDY)) Q:'ACDY  D  Q:ACDQ
 . S ACDQ=0
 . S ACDLC=ACDLC+1
 . S ACDVLST(ACDLC)=ACDY
 . S DIC="9002172.1",DA=ACDY,DR=".01;1;3;5",DIQ="ACDPDD("
 . D DIQ1^ACDFMC
 . W ACDLC,?5,ACDPDD(9002172.1,ACDY,.01),?18," - ",ACDPDD(9002172.1,ACDY,1),"/",ACDPDD(9002172.1,ACDY,5)," ",ACDPDD(9002172.1,ACDY,3),!
 . K ACDPDD
 . I '(ACDLC#20) D PAUSE^ACDDEU S:$D(DIRUT) ACDQ=1
 . Q
 S ACDQ=1
 I 'ACDLC W !,"No visits in date range",! Q
 S DIR(0)="NO^1:"_ACDLC,DIR("A")="Select one of the listed visits" K DA D ^DIR K DIR
 S:Y ACDVIEN=ACDVLST(Y)
 K ACDLC,ACDVLST
 Q:'ACDVIEN
 S ACDQ=0
 Q
 ;
GETDTRNG ; GET DATE RANGE FOR VISIT
 S ACDQ=1
 S ACDDTLOW=$O(^TMP("ACD",$J,"VISITS",0)),ACDDTHI=$O(^TMP("ACD",$J,"VISITS","Z"),-1)
 W !,"Patient has ",ACDVCNT," visits between ",$$FMTE^XLFDT(ACDDTLOW,"1")," and ",$$FMTE^XLFDT(ACDDTHI,"1"),".",!,"Enter date range of desired visit.",!
 S DIR(0)="DO^::E",DIR("A")="Enter beginning date" K DA D ^DIR K DIR
 Q:'Y
 S ACDDTLOW=Y
 S DIR(0)="D^"_Y_"::E",DIR("A")="Enter ending date",DIR("B")=X K DA D ^DIR K DIR
 Q:$D(DIRUT)
 S ACDDTHI=Y
 S ACDQ=0
 Q
 ;
DISPLAY ; EP - DISPLAY VISIT AND SUBORDINATE FILE ENTRIES
 I $O(^ACDVIS(ACDVIEN,21,0)) D
 . W !!,"This CDMIS visit has linked PCC visits."
 . S DIR(0)="Y",DIR("A")="Do you want to display the PCC visits also",DIR("B")="N" K DA D ^DIR K DIR
 . S:Y ACDPCCL=1
 . Q
DISPTAG I $D(IO("Q")) D  Q
 . S ZTRTN="DISPLAYQ^ACDPVDSP",ZTDESC="CDMIS VISIT DISPLAY",ZTDTH=$H,ZTSAVE("ACD*")=""
 . D ^%ZTLOAD
 . Q
 D DISPLAYQ S ACDQ=0
 Q
 ;
DISPLAYQ ; EP - FOR TASKMAN
 I $D(ACDSLAVE) S IOP=ACDSLAVE D ^%ZIS
 U IO
 W:IO'=IO(0) @IOF
 D:$E(IOST,1,2)="P-" CONF^ACDDEU
 W !
 D DSPVSIT^ACDDEU(ACDVIEN)
 D:$E(IOST,1,2)'="P-" PAUSE^ACDDEU
 Q:$D(DIRUT)
 S X=$P(^ACDVIS(ACDVIEN,0),U,4)
 I X'="IN",X'="RE",X'="FU",X'="IR",X'="OT",X'="TD",X'="CS" W !,"INVALID TYPE CONTACT",!
 E  S ACDCONT=X D @("DSP"_ACDCONT)
 I $G(ACDPCCL) NEW ACDPCCV S ACDPCCL=0 F  S ACDPCCL=$O(^ACDVIS(ACDVIEN,21,ACDPCCL)) Q:'ACDPCCL  S ACDPCCV=$P(^(ACDPCCL,0),U,2)  I ACDPCCV S APCDVDSP=ACDPCCV D ^APCDVDSP Q:$D(DIRUT)
 I $D(ACDSLAVE) W @IOF D ^%ZISC
 I $D(ZTQUEUED) D EOJ S ZTREQ="@"
 Q
 ;
DSPIN ; DISPLAY INITIAL
 D DSPIIF
 Q
 ;
DSPRE ; DISPLAY REOPEN
 D DSPIIF
 Q
 ;
DSPFU ; DISPLAY FOLLOWUP
 D DSPIIF
 Q
 ;
DSPIR ; DISPLAY INFO/REFERRAL
 D DSPIIF
 Q
 ;
DSPOT ; DISPLAY CRISIS BRIEF
 D DSPIIF
 Q
 ;
DSPIIF ; DISPLAY IIF ENTRY
 S DIC="^ACDIIF(",DA=$O(^ACDIIF("C",ACDVIEN,0))
 I 'DA W !,"NO IIF ENTRY TO DISPLAY",!
 E  D DIQ^ACDFMC
 D:$E(IOST,1,2)'="P-" PAUSE^ACDDEU
 Q
 ;
DSPTD ; DISPLAY TDC ENTRY
 S DIC="^ACDTDC(",DA=$O(^ACDTDC("C",ACDVIEN,0))
 I 'DA W !,"NO TDC ENTRY TO DISPLAY",!
 E  D DIQ^ACDFMC
 D:$E(IOST,1,2)'="P-" PAUSE^ACDDEU
 Q
 ;
DSPCS ; DISPLAY CLIENT SERVICES
 S ACDY=0
 S ACDQ=0
 F  S ACDY=$O(^ACDCS("C",ACDVIEN,ACDY)) Q:'ACDY  D  Q:$D(DIRUT)
 . S DIC="^ACDCS(",DA=ACDY
 . D DIQ^ACDFMC
 . I $E(IOST,1,2)'="P-" D PAUSE^ACDDEU
 . Q
 S ACDQ=0
 Q
 ;
EOJ ;
 D ^%ZISC
 D ^ACDKILL
 Q