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

ACDPFACE.m

Go to the documentation of this file.
ACDPFACE ;IHS/ADC/EDE/KML - DISPLAY PATIENT VISIT;  
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
 ; This routine displays a patient's CDMIS INITIAL, REOPEN, or
 ; TRANS/DISCH/CLOSE visit with subordinate file entry to use as a
 ; face sheet in the chart.
 ;
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
 I ACDQ S ACDQ=0 Q
 D DISPLAY ;               display selected visit
 I '$D(ACDSLAVE),$E(IOST,1,2)'="P-" D PAUSE^ACDDEU
 D DEV^ACDDEU Q:ACDQ  ;       select device
 I $D(ACDSLAVE)!(IO'=IO(0)) D DISPLAY
 K ACDSLAVE S IO=IO(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 INITIAL/REOPEN/TDC VISIT
 S ACDQ=1
 W !
 S ACDVIEN=0
 K ACDVLST
 I $O(^TMP("ACD",$J,"VISITS",0))="" W !,"----------",!,"No CDMIS visits!",!,"----------",! Q
 S (ACDLC,ACDX,ACDY)=0
 F  S ACDX=$O(^TMP("ACD",$J,"VISITS",ACDX)) Q:ACDX=""  S ACDY=0 F  S ACDY=$O(^TMP("ACD",$J,"VISITS",ACDX,ACDY)) Q:'ACDY  D
 . S ACDTC=$P(^ACDVIS(ACDY,0),U,4)
 . Q:ACDTC'="IN"&(ACDTC'="RE")&(ACDTC'="TD")
 . 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
 . Q
 I 'ACDLC W !,"----------",!,"No type IN, RE, or TD visits!",!,"----------",! 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
 ;
DISPLAY ; EP - DISPLAY VISIT AND SUBORDINATE FILE ENTRY
 ;//^ACDDE3
 I $D(IO("Q")) D  Q
 . S ZTRTN="DISPLAYQ^ACDPFACE",ZTDESC="CDMIS FACE SHEET",ZTDTH=$H,ZTSAVE("ACD*")=""
 . D ^%ZTLOAD
 . Q
 D DISPLAYQ
 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
 NEW ACDCOMC,ACDCOMCL,ACDCOMT,ACDCOMTL,ACDCONT,ACDCONTL,ACDDFN,ACDDFNP,ACDPROV,ACDPROVP
 S ACDDA=ACDVIEN,ACDWSTAF(1)=1 D ^ACDWVIS K ACDWSTAF
 S ACDTC=$P(^ACDVIS(ACDVIEN,0),U,4)
 I ACDTC="TD" S ACDDA=$O(^ACDTDC("C",ACDVIEN,0)) I 1
 E  S ACDDA=$O(^ACDIIF("C",ACDVIEN,0))
 I 'ACDDA W !!,"No '"_ACDTC_"' attached to this visit.",!
 D @("^ACDW"_$S(ACDTC="TD":"TDC",1:"IIF"))
 S ACDPFACE=1
 D P1^ACDWCD1
 K ACDPFACE
 W:IO'=IO(0) @IOF
 ;I $D(ACDSLAVE) W @IOF D ^%ZISC
 I $D(ACDSLAVE) D ^%ZISC
 I $D(ZTQUEUED) D EOJ S ZTREQ="@"
 U 0
 Q
 ;
EOJ ;
 D ^%ZISC
 D ^ACDKILL
 Q